(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.
interface Option<T> { | |
map <U>(fn: (a: T) => U): Option<U>; | |
isSome(): boolean; | |
isNone(): boolean; | |
isSomeAnd(fn: (a: T) => boolean): boolean; | |
isNoneAnd(fn: () => boolean): boolean; | |
unwrap(): T; | |
unwrapOr(def: T): T; | |
unwrapOrElse(f: () => T): T; | |
map<U>(f: (a: T) => U): Option<U>; |
interface Result<T, E> { | |
map<U>(fn: (a: T) => U): Result<U, E>; | |
mapErr<U>(fn: (a: E) => U): Result<T, U>; | |
isOk(): boolean; | |
isErr(): boolean; | |
ok(): Option<T>; | |
err(): Option<E>; | |
and<U>(res: Result<U,E>): Result<U,E>; | |
andThen<U>(op: (T) => Result<U,E>): Result<U,E>; |
The MIT License (MIT) | |
Copyright (c) 2014 Tomas Kafka | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
<?php //\\ dɥd¿> | |
;namespace ǝɔɐdsǝɯɐu; | |
class ssɐlɔ | |
{ //\\ } | |
function uoıʇɔunɟ | |
( ) | |
{ //\\ } | |
;echo oɥɔǝ; |
React = require("react") | |
VideoPlayerComponent = require("components/VideoPlayerComponent") | |
AppComponent = React.createClass | |
# Need to add this manually if you want it to show up in React Chrome Dev Tools | |
# See https://github.com/jsdf/coffee-react-transform/issues/16 | |
displayName: "AppComponent" | |
render: -> | |
<div> |
var Dialog = React.createClass({ | |
render: function() { | |
// 1) render nothing, this way the DOM diff will never try to do | |
// anything to it again, and we get a node to mess with | |
return React.DOM.div(); | |
}, | |
componentDidMount: function() { | |
// 2) do DOM lib stuff | |
this.node = this.getDOMNode(); |
<?php | |
$addOne = partial(operator('+'), 1); | |
$double = partial(operator('*'), 2); | |
$greaterThan3 = partial(operator('>'), …(), 3); | |
assert( | |
map([1, 2, 3], $double)->§ | |
== [2, 4, 6] | |
); |
(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.
var WebSocketServer = require('ws').Server; | |
var wss = new WebSocketServer({port: 8080}); | |
var jwt = require('jsonwebtoken'); | |
/** | |
The way I like to work with 'ws' is to convert everything to an event if possible. | |
**/ | |
function toEvent (message) { | |
try { |
#The power of z
Do you spend lots of time doing things like this?
cd this/is/the/path/that/i/want/so/i/type/it/all/out/to/get/whereiwant
With z, you could just do this: