Skip to content

Instantly share code, notes, and snippets.

Alexander Moon mr-moon

  • Tallinn, Estonia, Europe
Block or report user

Report or block mr-moon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mr-moon / await.js
Created Nov 4, 2017
clean javascript API for waiting for some condition to be met
View await.js
* A helper that simplifies waiting for something to happen. It acts like an observer without any
* particular observable. So your 'evaluator' function may do anything, untill it's returns non-undefined value
* For example, you may want to "observe" a sessionStorage value regardless of browser support of the
* "storage" events.
* @example
* ```js
* var awaiter = await(
mr-moon / gist:77c90944804f7da71ecd
Last active Aug 29, 2015
Doing supported browsers check with library.
View gist:77c90944804f7da71ecd
INTERNET_EXPLORER = 'Internet Explorer',
FIREFOX = 'Firefox',
CHROME = 'Chrome',
OPERA = 'Opera',
OPERA_MINI = 'Opera Mini',
SAFARI = 'Safari',
MAXTHON = 'Maxthon',
WEBKIT = 'WebKit',
TRIDENT = 'Trident',
View gist:1486161
* Evaluates the given number against array of numbers, and returns
* the one that is the "closest"
* @param value Value to be tested
* @param array Array of numbers
* @param method uint a comparison method. 0 - round, 1 - ceil, 2 - floor
* @return The closest value from <code>array</code> parameter
public static function closestAgainstArray(value:Number, array:Array, method:uint = 0):Number
You can’t perform that action at this time.