#Oh My Zsh - Git Cheat Sheet
g
– git
gst
– git status
gl
– git pull
gup
– git pull --rebase
var data = "do shash'owania"; | |
var crypto = require('crypto'); | |
crypto.createHash('md5').update(data).digest("hex"); |
/* | |
* This work is free. You can redistribute it and/or modify it under the | |
* terms of the Do What The Fuck You Want To Public License, Version 2, | |
* as published by Sam Hocevar. See the COPYING file for more details. | |
*/ | |
/* | |
* Easing Functions - inspired from http://gizma.com/easing/ | |
* only considering the t value for the range [0, 1] => [0, 1] | |
*/ | |
EasingFunctions = { |
#lang racket | |
;; asymmetric full coroutines from "Revisiting Coroutines" | |
(provide (contract-out | |
[create (-> procedure? coroutine?)] | |
[resume (->* (coroutine?) () #:rest (listof any/c) any)] | |
[yield (-> any/c any)] | |
[status (-> coroutine? (or/c 'running 'done 'suspended))])) |
package main; | |
import ( | |
"fmt" | |
"math/rand" | |
"time" | |
) | |
var ( | |
Web1 = fakeSearch("web1") |
// Utility function for detecting generators. | |
let isGenerator = x => { | |
return Function.isGenerator && | |
Function.isGenerator.call(x) | |
} | |
// Data type represents channel into which values | |
// can be `put`, or `received` from. Channel is | |
// very much like queue where reads and writes are | |
// synchronized via continuation passing. |
#lang racket | |
; Implementations and examples are inspired by Matt Might's blog posts: | |
; http://matt.might.net/articles/programming-with-continuations--exceptions-backtracking-search-threads-generators-coroutines/ | |
; Note I didn't just copy the code. I implemented it independently, so it looks a lot different from Matt's code. | |
(define (current-continuation) | |
(call/cc (lambda (k) | |
(k k)))) | |
(define (exception) |
#Oh My Zsh - Git Cheat Sheet
g
– git
gst
– git status
gl
– git pull
gup
– git pull --rebase
You don't really need a framework or fancy cutting-edge JavaScript features to do two-way data binding. Let's start basic - first and foremost, you need a way to tell when data changes. Traditionally, this is done via an Observer pattern, but a full-blown implementation of that is a little clunky for nice, lightweight JavaScript. So, if native getters/setters are out, the only mechanism we have are accessors:
var n = 5;
function getN() { return n; }
function setN(newN) { n = newN; }
console.log(getN()); // 5
setN(10);
/* eslint-disable new-cap */ | |
/** | |
* Lens types. | |
* =========== | |
* | |
* a * b = {fst: a, snd: b} | |
* a + b = {index: Boolean, value: a | b} | |
* | |
* Iso s t a b = forall (~>) . Profunctor (~>) => (a ~> b) -> (s ~> t) |
import React, {DeviceEventEmitter} from 'react-native'; | |
import {Observable} from 'rx-lite' | |
/** | |
* Creates an Observable to listen to any event of DeviceEventEmitter | |
* @param type {string} Event type | |
*/ | |
export default createObservableFromDeviceEventEmitter$ = type => { | |
let subscription; | |
return Observable.fromEventPattern( |