This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cartesian = (function(range) { | |
return { | |
'inX': inX, | |
'outX': outX, | |
'inY': inY, | |
'outY': outY | |
}; | |
function inX(value) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, sys, math | |
def _min(a, b): | |
signA = a < 0 | |
signB = b < 0 | |
branch1 = signA & (~signB & 1) # branch1 = (signA && !signB) | |
branch2 = signB & (~signA & 1) # branch2 = (signB && !signA) | |
notBranched = (~branch1) & (~branch2) & 1 # notBranched = (!branch1 && !branch2) | |
branch3 = notBranched & ((a - b) >> 31 & 1) # branch3 = (notBranched && a < b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param key | |
* @param additionalParameters | |
* @return promise | |
**/ | |
function MyCacheSetter(key, params) { | |
return $http.post('some_url', { | |
someField: params.someValue | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Compile with: | |
* clang -Wall -Werror -std=c99 -g IntegerToEnglish.c -o IntegerToEnglish | |
* | |
* OR | |
* gcc -Wall -Werror -std=c99 -g IntegerToEnglish.c -o IntegerToEnglish | |
* | |
**/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(factory) { | |
var module = factory(); | |
// AMD | |
if (typeof define === 'function' && define.amd) { | |
define(function() { return module; }); | |
} | |
// CommonJS | |
if (typeof exports === 'object') { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var API = 'crypto2', | |
METHOD = 'getRandomValues'; | |
var maxValueLookup = { | |
'[object Uint8Array]': 0xff, | |
'[object Uint8ClampedArray]': 0xff, | |
'[object Uint16Array]': 0xffff, | |
'[object Uint32Array]': 0xffffffff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A Queue, implemented as two stacks. | |
* | |
* Push has a worst case of O(1) | |
* Pop has a worst case of O(N), and a best case of O(1) | |
* | |
**/ | |
function Queue() { | |
this.clear(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#include <assert.h> | |
#include <math.h> | |
int32_t min_int32(int32_t a, int32_t b) | |
{ | |
uint32_t branch1, | |
branch2, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import * | |
def _expand_args_float(func): | |
def wrapper(*args): | |
return func(*([float(i) for i in args])) | |
return wrapper | |
@_expand_args_float | |
def easeInQuad(t, b, c, d): | |
t /= d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getUrlParams(url) { | |
return (url.replace(/.*\/[^/?]+(?=\?|$)/, '').replace(/^\?/, '')) | |
.split('&') | |
.map(function(kvPair) { | |
return kvPair.split('=').map(decodeURIComponent); | |
}).reduce(function(objToReturn, item) { | |
objToReturn[item[0]] = item[1]; | |
return objToReturn; | |
}, {}); | |
} |