(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
// `unit` is `return` from Haskell | |
// `bind` is `>>=` from Haskell, or `flatMap` from Scala | |
var None = { | |
bind: function (fn) { return this; }, | |
unit: function (v) { return Option(v); }, | |
getOrElse: function (elseValue) { return elseValue; } | |
}; | |
var Some = function (value) { |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
For pupil: all binary can be downloaded http://pan.baidu.com/s/1hqH2Pko
After overwriting, maybe need to run chmod +x /path/to/sublime_text
. For linux default installation, need to add sudo
.
For programmer:
VERSION | PLATFORM | OFFSET | ORIGINAL | CRACKED |
---|
/* | |
Convert svg files to virtual-dom's VTree | |
To use the resulting tree | |
import svg from 'virtual-dom/virtual-hyperscript/svg' | |
if you use Cycle.js: | |
import {svg} from '@cycle/dom'; | |
*/ | |
import fs from 'fs'; |
/** | |
* Fix for vw, vh, vmin, vmax on iOS 7. | |
* http://caniuse.com/#feat=viewport-units | |
* | |
* This fix works by replacing viewport units with px values on known screen sizes. | |
* | |
* iPhone 6 and 6 Plus cannot run iOS 7, so are not targeted by this fix. | |
* Target devices running iOS 8+ will incidentally execute the media query, | |
* but this will still produce the expected result; so this is not a problem. |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
, elem.offsetTop
, elem.offsetWidth
, elem.offsetHeight
, elem.offsetParent
h('div.container', [ | |
h('label.nameLabel', 'Name:'), | |
h('input.myinput', {attributes: {type: 'text'}}), | |
h('hr'), | |
h('h1.greeting', `Hello ${name}`) | |
]) | |
// or | |
div('.container', [ |
Simple state management with xstream
and ramda
, in more transparent fashion than onionify
import * as R from 'ramda'
// first we create factory for making special state stream
// that will hold our stream value and will be modified with supplied streams of reducers
type StateReducer<T> = (state: T) => T
// ==UserScript== | |
// @name Toggl on Trello | |
// @namespace http://tampermonkey.net/ | |
// @version 0.4 | |
// @description Shows toggl entries that match C### where ### is the card number. | |
// @author sdebaun@sparks.network | |
// @match https://trello.com/c/*/* | |
// @match https://trello.com/b/*/* | |
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js | |
// @grant GM_setValue |