Since Twitter doesn't have an edit button, it's a suitable host for JavaScript modules.
Source tweet: https://twitter.com/rauchg/status/712799807073419264
const leftPad = await requireFromTwitter('712799807073419264');
Since Twitter doesn't have an edit button, it's a suitable host for JavaScript modules.
Source tweet: https://twitter.com/rauchg/status/712799807073419264
const leftPad = await requireFromTwitter('712799807073419264');
(by @andrestaltz)
So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).
Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:
Rx.Observable.prototype.flatMapLatest(selector, [thisArg])
Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
/** | |
* POST to create a new user. | |
*/ | |
exports.create = function *(){ | |
var body = yield parse(this); | |
// password | |
var pass = body.password; | |
assert(pass, 400, 'password is required'); |
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc | |
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/ | |
// author: Pawel Kozlowski | |
var myApp = angular.module('myApp', []); | |
//service style, probably the simplest one | |
myApp.service('helloWorldFromService', function() { | |
this.sayHello = function() { | |
return "Hello, World!" |
{ | |
// -------------------------------------------------------------------- | |
// JSHint Configuration, Strict Edition | |
// -------------------------------------------------------------------- | |
// | |
// This is a options template for [JSHint][1], using [JSHint example][2] | |
// and [Ory Band's example][3] as basis and setting config values to | |
// be most strict: | |
// | |
// * set all enforcing options to true |
If you haven't already set your NPM author info, now you should:
npm set init.author.name "Your Name"
npm set init.author.email "[email protected]"
npm set init.author.url "http://yourblog.com"
npm adduser
/* | |
Put on top of the file before describe statements | |
Usage: | |
expect(fn).toBeFunction() | |
*/ | |
beforeEach(function (){ | |
this.addMatchers({ | |
toBeFunction: function (){ | |
return Object.prototype.toString.call(this.actual)==='[object Function]'; | |
} |
/** | |
* Modified version of TJ's http support file from the Express repo: | |
* https://github.com/visionmedia/express/blob/master/test/support/http.js | |
* | |
* Module dependencies. | |
*/ | |
var EventEmitter = require('events').EventEmitter | |
, should = require('should') | |
, methods = ['get','post','put','delete','head'] |
// Basic XMPP bot example for HipChat using node.js | |
// To use: | |
// 1. Set config variables | |
// 2. Run `node hipchat_bot.js` | |
// 3. Send a message like "!weather 94085" in the room with the bot | |
var request = require('request'); // github.com/mikeal/request | |
var sys = require('sys'); | |
var util = require('util'); |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Cross-Origin Resource Sharing (CORS) test</title> | |
</head> | |
<body> | |
<body> | |
<h2>Test CORS localhost</h2> | |
<a href="#" class="put">PUT</a> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> |