Skip to content

Instantly share code, notes, and snippets.

/* Random Boolean */
var randomNumber = Math.random() >= 0.5;
console.log(randomNumber);
/**
* ================== angular-ios9-uiwebview.patch.js v1.1.0 ==================
*
* This patch works around iOS9 UIWebView regression that causes infinite digest
* errors in Angular.
*
* The patch can be applied to Angular 1.2.0 – 1.4.5. Newer versions of Angular
* have the workaround baked in.
*
* To apply this patch load/bundle this file with your application and add a
@RobinBuschmann
RobinBuschmann / 01_websockets_nginx.config
Created April 12, 2016 12:56 — forked from raulanatol/01_websockets_nginx.config
Configure nginx to accept websockets on AWS Elastic Beanstalk
files:
"/etc/nginx/conf.d/01_websockets.conf":
mode: "000644"
owner: root
group: root
content: |
upstream nodejs {
server 127.0.0.1:8081;
keepalive 256;
}
{
"extends": "tslint:latest",
"rules": {
"arrow-parens": false,
"class-name": false,
"no-empty": false,
"no-trailing-whitespace": false,
"object-literal-sort-keys": false,
"interface-name": true,
"no-consecutive-blank-lines": false,
// Implementation
// ---------------
interface Cases<V> {
[value: string]: Resolver<V>;
default: Resolver<V>;
}
type Resolver<V> = () => V;
const switchcase = <V extends any>(value: string | number, cases: Cases<V>): V =>
cases[value in cases ? value : 'default']();
/**
* @example
* ```ts
* const [selectedItems, nonSelectedItems] = partition(array, item => item.selected);
* const [
* numsLessThan5,
* numsLessThan10,
* numsLessThan30,
* numsGreaterEquals30
* ] = partition(