This file contains hidden or 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 suite(fiboMax, repeats, fiboLoop) { | |
function getMedian(args) { | |
if (!args.length) {return 0}; | |
var numbers = args.slice(0).sort((a,b) => a - b); | |
var middle = Math.floor(numbers.length / 2); | |
var isEven = numbers.length % 2 === 0; | |
return isEven ? (numbers[middle] + numbers[middle - 1]) / 2 : numbers[middle]; |
This file contains hidden or 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
type attr = ..; | |
type attr += | |
| Str(string); | |
type attr += | |
| Int(int) | |
| Float(float); | |
module Bool: { | |
type attr += | |
pri |
This file contains hidden or 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
module type DEVICE = { | |
let draw: string => unit; | |
}; | |
let devices: Hashtbl.t(string, module DEVICE) = Hashtbl.create(17); | |
module SVG = { | |
let draw = string => Js.log2("svg module", string); | |
}; | |
Hashtbl.add(devices, "SVG", (module SVG): (module DEVICE)); | |
module PDF = { | |
let draw = string => Js.log2("pdf module", string); |
This file contains hidden or 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
module F = (X: {type c = pri {.. x: int};}) => { | |
let get_x = (o: X.c) => o#x; | |
}; | |
module G = | |
( | |
X: { | |
type c = | |
pri { | |
.. | |
x: int, |
This file contains hidden or 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
module rec A: { | |
type t = | |
| Leaf(string) | |
| Node(ASet.t); | |
let compare: (t, t) => int; | |
} = { | |
type t = | |
| Leaf(string) | |
| Node(ASet.t); | |
let compare = (t1, t2) => |
This file contains hidden or 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
p{padding-left:60px;} | |
#foo{ | |
border-radius:50px; | |
width:50px; | |
height:50px; | |
background:#c00; | |
position:absolute; | |
top:0; | |
left:0; | |
transition: transform 1s; |
This file contains hidden or 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
//@flow | |
import * as React from 'react' | |
import {render} from 'react-dom' | |
import styled, {keyframes, css} from 'styled-components' | |
export function run() { | |
let devpage = document.querySelector('#devpage') | |
if (!devpage) { | |
devpage = document.createElement('div') | |
const {body} = document |
This file contains hidden or 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
//@flow | |
import {createStore, type Store} from 'effector' | |
const capacity: '@@capacity' = (Symbol('buffer capacity'): any) | |
declare export function readCapacity<T>(store: Store<[T, T, T, T, T, T, T]>): 7 | |
declare export function readCapacity<T>(store: Store<[T, T, T, T, T, T]>): 6 | |
declare export function readCapacity<T>(store: Store<[T, T, T, T, T]>): 5 | |
declare export function readCapacity<T>(store: Store<[T, T, T, T]>): 4 |
This file contains hidden or 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 * as promises from './b_promises.js'; | |
const allowedWorkTime = 4; | |
const maximumTaskFrame = 100; | |
export default class Worker { | |
constructor(fn) { | |
this.fn_ = fn; | |
this.queue_ = []; | |
this.waiting_ = null; |
This file contains hidden or 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
const resolved = Promise.resolve(); | |
/** | |
* Returns a Promise that resolves on `requestIdleCallback`. | |
* | |
* @return {!Promise<!IdleDeadline>} | |
*/ | |
export function idle() { | |
return new Promise((resolve) => window.requestIdleCallback(resolve)); | |
} |