Posts

Showing posts from March, 2007

How To Set Text Vertical Alignment In Html Css Code Example

Example: css vertical align .top-align { vertical-align : top ; } .center-align { vertical-align : middle ; }

Create A Tag In A GitHub Repository

Image
Answer : You can create tags for GitHub by either using: the Git command line, or GitHub's web interface. Creating tags from the command line To create a tag on your current branch, run this: git tag <tagname> If you want to include a description with your tag, add -a to create an annotated tag: git tag <tagname> -a This will create a local tag with the current state of the branch you are on. When pushing to your remote repo, tags are NOT included by default. You will need to explicitly say that you want to push your tags to your remote repo: git push origin --tags From the official Linux Kernel Git documentation for git push : --tags All refs under refs/tags are pushed, in addition to refspecs explicitly listed on the command line. Or if you just want to push a single tag: git push origin <tag> See also my answer to How do you push a tag to a remote repository using Git? for more details about that syntax above. Creating tags through GitHub's web int

Converting SVG File To Android Vector Drawable XML While Keeping The Group Structure In Place

Image
Answer : Update 2019: There is no need of using any external tool or Heck as pointed by older answers. Android Studio's Asset Studio allows to convert SVG/ PSD to vectors Right click on app folder-> New Vector Asset Select second option in radio button to create vector from local file as shown in below image. Click on folder icon to load local SVG file and it will automatically convert that into vector: Have you tried Shape Shifter? Its meant as a program to let you animate vectors and svgs easily, but you can import your .svg and export to a Vector Drawable straight away. It should keep your group structure too (but I make no promises as I haven't done so explicitly myself). Create a blank xml file. write all attributes of a VectorDrawable except pathdata. Open the SVG file in wordpad. Copy the pathdata and then paste it in the xml file you created. Example SVG: <?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG

Css Selectors Child Code Example

Example 1: child css p : nth - child ( 2 ) { background : red ; } Example 2: css child selector /* Descendant selectors are used to match to any nested element. Child combinators, on the other hand, only match to the direct child element and are defined by the greater than symbol. The selector on the right must be the direct child of the element on the left. */ /* child combinator */ parent > child { ... } /* descendant selector */ parent child { ... } ancestor descendant { ... } Example 3: how to use child selectors in css ul li { margin : 0 0 5 px 0 ; } ul > li { margin : 0 0 5 px 0 ; } Example 4: all child css //Will select all li under ul //<ul> < li > < ul > < li > < / li > < li > < / li > < / ul > < / li > < / ul > Affected li = 4 ul li { margin : 0 0 5 px 0 ; } //Will only select the childer li of the ul //<ul> < li > < ul >

Full Height Div Bootstrap Code Example

Example 1: bootstrap width 100 <div class= "w-25 p-3" style= "background-color: #eee;" >Width 25 % </div> <div class= "w-50 p-3" style= "background-color: #eee;" >Width 50 % </div> <div class= "w-75 p-3" style= "background-color: #eee;" >Width 75 % </div> <div class= "w-100 p-3" style= "background-color: #eee;" >Width 100 % </div> Example 2: bootstrap height and width sizes <div style= "height: 100px; background-color: rgba(255,0,0,0.1);" > <div class= "mh-100" style= "width: 100px; height: 200px; background-color: rgba(0,0,255,0.1);" >Max-height 100 % </div> </div>

Convert Object String To Object Javascript Code Example

Example 1: convert string to object javascript var mystr = '{ "hello":"world" }' // NB: Has enclosing "" var myobj = JSON.parse(mystr); Example 2: Javascript object to JSON string var person={"first_name":"Tony","last_name":"Hawk","age":31}; var personJSONString=JSON.stringify(person); Example 3: convert data into json format in javascript Use the JavaScript function JSON.parse() to convert text into a JavaScript object: var obj = JSON.parse('{ "name":"John", "age":30, "city":"New York"}'); Example 4: javascript parse json const json = '{ "fruit": "pineapple", "fingers": 10 }'; const obj = JSON.parse(json); console.log(obj.fruit, obj.fingers); Example 5: convert string to object javascript str = "firstName:name1, lastName:last1"; // NB: No enclosing "" obj = eval('({' + str

Angular NgSwitch Example

directive The [ngSwitch] directive on a container specifies an expression to match against. The expressions to match are provided by ngSwitchCase directives on views within the container. Every view that matches is rendered. If there are no matches, a view with the ngSwitchDefault directive is rendered. Elements within the [ NgSwitch] statement but outside of any NgSwitchCase or ngSwitchDefault directive are preserved at the location. See also NgSwitchCase NgSwitchDefault Structural Directives Exported from CommonModule Selectors [ ngSwitch] Properties Property Description @ Input() ngSwitch : any Write-Only Description Define a container element for the directive, and specify the switch expression to match against as an attribute: <container-element [ngSwitch]="switch_expression"> Within the container, * ngSwitchCase statements specify the match expressions as attributes. Include * ngSwitchDefault as t

Convert Double To Int In Flutter Code Example

Example 1: dart convert int to double int intVar = 5 ; double doubleVar = intVar . toDouble ( ) ; Example 2: double to int flutter double x = 2.5 ; int a = x . toInt ( ) ; int b = x . truncate ( ) ; int c = x . round ( ) ; int d = x . ceil ( ) ; int e = x . floor ( ) ; print ( a ) ; // 2 print ( b ) ; // 2 print ( c ) ; // 3 print ( d ) ; // 3 print ( 3 ) ; // 2 Example 3: flutter convert double to int int calc_ranks ( ranks ) { double multiplier = .5 ; return ( multiplier * ranks ) . round ( ) ; } Example 4: double to int in dart int calc_ranks ( ranks ) { double multiplier = .5 ; return ( multiplier * ranks ) . round ( ) ; }

Adding Admin Menu Separators In WordPress

Answer : You should hook in admin_menu : add_action('admin_menu','admin_menu_separator'); And use something lower than 220 . The biggest offset I got in my system is 99 . Check this very fine class to deal with Admin Menus. It appeared in this WPSE Question: Add a Separator to the Admin Menu?

Discord Colors Formating Code Example

Example 1: css discord color guide Default : #839496 ``` NoKeyWordsHere ``` Quote : #586e75 ```brainfuck NoKeyWordsHere ``` Solarized Green : #859900 ```CSS NoKeyWordsHere ``` Solarized Cyan : #2aa198 ```yaml NoKeyWordsHere ``` Solarized Blue : #268bd2 ```md NoKeyWordsHere ``` Solarized Yellow : #b58900 ```fix NoKeyWordsHere ``` Solarized Orange : #cb4b16 ```glsl NoKeyWordsHere ``` Solarized Red : #dc322f ```diff -NoKeyWordsHere ``` Example 2: css discord color guide And here is the escaped Default : #839496 ``` This is a for statement ``` Quote : #586e75 ```bash #This is a for statement ``` Solarized Green : #859900 ```diff + This is a for statement ``` //Second Way to do it ```diff ! This is a for statement ``` Solarized Cyan : #2aa198 ```cs "This is a for statement" ``` ```cs 'This is a for statement' ``` Solarized Blue : #268bd2 ```ini [This is a for statement] ``` //Second Way to do it ```asciidoc = This is a for statement = ``` Solarized Yellow

Cron Guru Every 30 Mins Code Example

Example: crontab every 30 minutes in specific minute // every 30 minutes */30 * * * * // it depends on the crontab version you are using // example: every 30 minutes at number '5' // mode 1 5,35 * * * * // mode 2 5/30 * * * *

Margin Auto Bootstrap Class Code Example

Example 1: bootstrap Margin and padding Use the margin and padding spacing utilities to control how elements and components are spaced and sized. Bootstrap 4 includes a five-level scale for spacing utilities , based on a 1 rem value default $spacer variable. Choose values for all viewports ( e.g. , .mr-3 for margin-right : 1 rem ) , or pick responsive variants to target specific viewports ( e.g. , .mr-md-3 for margin-right : 1 rem starting at the md breakpoint ) . <div class= "my-0 bg-warning" >Margin Y 0 </div> <div class= "my-1 bg-warning" >Margin Y 1 </div> <div class= "my-2 bg-warning" >Margin Y 2 </div> <div class= "my-3 bg-warning" >Margin Y 3 </div> <div class= "my-4 bg-warning" >Margin Y 4 </div> <div class= "my-5 bg-warning" >Margin Y 5 </div> <div class= "my-auto bg-warning" >Margin Y Auto</div> Examp

Convert RGBA To HEX

Answer : Since alpha value both attenuates the background color and the color value, something like this could do the trick: function rgba2rgb(RGB_background, RGBA_color) { var alpha = RGBA_color.a; return new Color( (1 - alpha) * RGB_background.r + alpha * RGBA_color.r, (1 - alpha) * RGB_background.g + alpha * RGBA_color.g, (1 - alpha) * RGB_background.b + alpha * RGBA_color.b ); } (Try it interactively: https://marcodiiga.github.io/rgba-to-rgb-conversion)

Css Selected Text Color Code Example

Example 1: custom selection color css ::selection { color: #000000; background-color: red; } /* for firefox */ ::moz-selection { color: #000000; background-color: red; } Example 2: change highlight color html ::-moz-selection { /* Code for Firefox */ color: red; background: yellow; } ::selection { color: red; background: yellow; } Example 3: css selected color ::selection { background-color: #222; color: white; } Example 4: css selector color ::selection { color: #ffffff; background-color: red; }

Sass And Less Css Tutorial Code Example

Example: less sass css Syntactically Awesome Stylesheets ( Sass ) and Leaner CSS ( LESS ) are both CSS preprocessors. They are special stylesheet extensions that make designing easier and more efficient. Both Sass and LESS compile into CSS stylesheets so that browsers can read them. This is a necessary step because modern browsers cannot read . Go to this site for differenced between SASS and LESS https : //css-tricks.com/sass-vs-less/

Angular Force Reload Component Code Example

Example 1: How to Reload a Component in Angular reloadComponent ( ) { let currentUrl = this . router . url ; this . router . routeReuseStrategy . shouldReuseRoute = ( ) => false ; this . router . onSameUrlNavigation = 'reload' ; this . router . navigate ( [ currentUrl ] ) ; } Example 2: refresh current component angular reloadCurrentRoute ( ) { let currentUrl = this . _router . url ; this . _router . navigateByUrl ( '/' , { skipLocationChange : true } ) . then ( ( ) => { this . _router . navigate ( [ currentUrl ] ) ; console . log ( currentUrl ) ; } ) ; } Example 3: angular refresh component without reloading page /*You can use a BehaviorSubject for communicating between different components throughout the app. You can define a data sharing service containing the BehaviorSubject to which you can subscribe and emit changes. Define a data sharing service */ import { Injecta

Constructor Overloading In Java Example

Example 1: default constructor java Default constructor is a constructor created by compiler ; if user does not create a constructor in a class . If user defines a constructor in a class then java compiler will not create default constructor . Example 2: Can we overload the constructors Yes , the constructors can be overloaded by changing the number of arguments accepted by the constructor or by changing the data type of the parameters

Converting KMZ-file To KML

Answer : Yes. Inside the .kmz is a file called doc.kml , see wikipedia | Keyhole Markup Language | Structure You can use 7-zip to open the KMZ archive. References: KMZ Files | Recommended Directory Structure or change the file extension to .zip under windows to open with winzip. In unix/linux/osx: cp myfile.kmz myfile.zip unzip myfile.zip cp doc.xml myfile.kml No need for a third party tool. Change the extension to .zip, open and extract the file you want.