Skip to content

Instantly share code, notes, and snippets.

View voronianski's full-sized avatar

Dmytro Voronianski voronianski

View GitHub Profile
@voronianski
voronianski / README.md
Created March 25, 2016 12:55 — forked from rauchg/README.md
require-from-twitter

The introduction to Reactive Programming you've been missing

(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

Getting Started with NPM (as a developer)

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 "you@example.com"
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]';
}
@voronianski
voronianski / http.js
Created February 18, 2013 20:13 — forked from bsstoner/http.js
/**
* 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');
@voronianski
voronianski / CORS_test.html
Last active December 10, 2015 13:59 — forked from bennadel/demo.htm
<!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>