Posts

Showing posts from July, 2001

Create A Sleep Function In Node Js Code Example

Example 1: javascript sleep const sleep = ( milliseconds ) => { return new Promise ( resolve => setTimeout ( resolve , milliseconds ) ) } /*Use like so*/ async function timeSensativeAction ( ) { //must be async func //do something here await sleep ( 5000 ) //wait 5 seconds //continue on... } Example 2: sleep in nodejs? await sleep ( 1000 ) function sleep ( ms ) { return new Promise ( ( resolve ) => { setTimeout ( resolve , ms ) ; } ) ; }

Add New Event Trigger Unity Code Example

Example: event trigger by code unity EventTrigger trigger = GetComponentInParent < EventTrigger > ( ) ; EventTrigger . Entry entry = new EventTrigger . Entry ( ) ; entry . eventID = EventTriggerType . PointerClick ; entry . callback . AddListener ( ( eventData ) => { Foo ( ) ; } ) ; trigger . triggers . Add ( entry ) ;

Css Text-overflow Ellipsis Dots Code Example

Example 1: css ellipsis div { white-space : nowrap ; overflow : hidden ; text-overflow : ellipsis ; } Example 2: overflow ellipsis css .truncate { width : 250 px ; white-space : nowrap ; overflow : hidden ; text-overflow : ellipsis ; }

Crontime Syntax For Every Month Code Example

Example: crontab every month // “At 00:00 on day-of-month 1.” 0 0 1 * *

Std::distance Vector Code Example

Example: std distance // Calculates the number of elements between first and last. # include <iterator> // std::distance # include <vector> // std::vector # include <algorithm> // Just if you use std::find vector < int > arr = { 2 , 5 , 3 , 8 , 1 } ; int size = std :: distance ( arr . begin ( ) , arr . end ( ) ) ; // 5 auto it = std :: find ( arr . begin ( ) , arr . end ( ) , 8 ) ; int position = std :: distance ( arr . begin ( ) , it ) ; // 3

22 Minute Timer Code Example

Example: 20 minute timer for good eyesight every 20 minutes look out the window at something 20 feet away for 20 seconds

Adding Marker To Google Maps In Google-map-react

Answer : Edit: Since this answer was posted the docs (and likely, the API) of the GoogleMapReact element was changed to support children. Any child with lat and lng would be rendered at the corresponding location on the map, as also indicated by @Jobsamuel's answer. The onGoogleApiLoaded callback should not be used for this purpose, as it is inferior to the declarative style and would not be re-run if changes are made to the map. Original answer (outdated): This may not be entirely clear from the description in the Readme, but the maps argument is, in fact, the maps API object (and map is, of course, the current Google Map instance). Therefore, you should pass both to your method: onGoogleApiLoaded={({map, maps}) => this.renderMarkers(map, maps)} and use them: renderMarkers(map, maps) { let marker = new maps.Marker({ position: myLatLng, map, title: 'Hello World!' }); } Adding a marker on your map isn't as easy as we would like to, mo

Css Flex Shorthand Property Code Example

Example 1: flex: syntex flex : none / * value 'none' case * / flex : < 'flex-grow' > / * One value syntax , variation 1 * / flex : < 'flex-basis' > / * One value syntax , variation 2 * / flex : < 'flex-grow' > < 'flex-basis' > / * Two values syntax , variation 1 * / flex : < 'flex-grow' > < 'flex-shrink' > / * Two values syntax , variation 2 * / flex : < 'flex-grow' > < 'flex-shrink' > < 'flex-basis' > / * Three values syntax * / flex : inherit Example 2: what does flex do The flex CSS property sets how a flex item will grow or shrink to fit the space available in its flex container . It is a shorthand for flex - grow , flex - shrink , and flex - basis .

Css Rotate Div 90 Degrees Code Example

Example: css rotate 90 deg transform : rotate ( 90 deg ) ;

How To Put Image In Circle Css Code Example

Example 1: css photo circle img { clip-path : circle ( ) ; } Example 2: how to make an image circular html css img { border-radius : 50 % ; }

Ahk If Else Code Example

Example: if else autohotkey i=0 ;make a variable (i) with the value 0 if (i=1) { ;when the variable i is 1 MsgBox, i is now %i% ;give a messagebox that i is the value of i (in this case 1) } Else { ;if i is anything else than 1 } ;do nothing ;This code will never show the messagebox because i is never going to be 1

Position Fixed Not Working With Scrolling Code Example

Example: fixed div with scrollable content .fixed-content { overflow-y : scroll ; overflow-x : scroll ; }