Skip to content

Instantly share code, notes, and snippets.

View avdyushin's full-sized avatar

Grigory Avdyushin avdyushin

View GitHub Profile
@avdyushin
avdyushin / delayedCall.m
Created September 2, 2013 07:21
Delayed function call using Grand Central Dispatch
double d = 2.0f; // Delay
dispatch_time_t t = dispatch_time(DISPATCH_TIME_NOW, d * NSEC_PER_SEC);
dispatch_after(t, dispatch_get_main_queue(), ^(void){
// Call any function
});
@avdyushin
avdyushin / randomHexColor.js
Created September 2, 2013 07:18
Generates random hex color string for CSS style
function randomHexColor() {
var v = ( Math.floor( Math.random() * 0xFFFFFF ) ).toString(16);
while ( v.length < 6 ) { v = '0' + v; }
return ( '#' + v );
}