Skip to content

Instantly share code, notes, and snippets.

var subscription = new Rx.CompositeDisposable();
var observable = Rx.Observable.fromSocket('ws://localhost:8080', 'stock-protocol');
subscription.add(
observable.selectMany(function (value) {
var data = JSON.parse(value.data);
return Rx.Observable.fromArray(data.data);
}).groupBy(function (quote) {
return quote.symbol;
var Rx = require('./rx.node')
, twitter = require('ntwitter')
, credentials = require('./credentials')
, io = require('socket.io').listen(80);
var customBind = function (self, method) {
return function () {
return self[method].apply(self, arguments);
};
};
@xgrommx
xgrommx / index.js
Created July 22, 2014 13:23
requirebin sketch
// example using the raf module from npm. try changing some values!
var requestAnimationFrame = require("raf")
var canvas = document.createElement("canvas")
canvas.width = 500
canvas.height = 500
document.body.appendChild(canvas)
var context = canvas.getContext("2d")
@xgrommx
xgrommx / index.js
Created July 22, 2014 14:36
requirebin sketch
var Rx = require('Rx');
var source = Rx.Observable.range(0, 5);
var subscription = Rx.Node.writeToStream(source, process.stdout, 'utf8');
@xgrommx
xgrommx / gulp-ify
Created August 14, 2014 19:52 — forked from RnbWd/gulp-ify
gulp.task('gulpify', function() {
gulp.src("./src/js/**")
.pipe($.plumber())
//using vinyl-transform lets us use any transforms available to browserify
.pipe(transform(reactify))
.on('error', $.util.log)
.pipe($.ext.replace('.js'))
// converting .jsx/coffee/etc. into a temp folder prior to 'bundling' reduces additional boilerplate later-on
.pipe(gulp.dest('./temp'))
.pipe($.filter('init.js'))
directives.uploadDrop = function (){
return {
require: '?ngModel',
restrict: 'E',
template: '<div class="input-file" style="width: 150px;"><span class="glyphicon glyphicon-picture"></span></div>',
link: function (scope, element, attrs, ngModel){
if (!ngModel) return;
element.bind('drop', function (event) {
function RxBus() {
function remove(xs, x) {
xs.splice(xs.indexOf(x), 1);
}
function innerSubscription(observable) {
var disposable;
function cancel() { remove(subscriptions, subscription); }

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@xgrommx
xgrommx / d3lib.md
Created August 29, 2014 11:27 — forked from widged/d3lib.md

chartFactory

/affini-tech/ChartFactory

Based on D3.JS and Dimple, ChartFactory provide the ability to build quickly D3.JS charts without coding any lines of javascript. Just define your dashboard in a JSON and voila !

charts: [
        {id:'chart1',
         width:800,height:250,

xAxis:{type:'Category',field: "Month",orderRule:'Date'},

var caller = Function.prototype.bind.bind(Function.prototype.call);
var slice = caller(Array.prototype.slice);
var concat = caller(Array.prototype.concat);
function map(transform) {
return function (combine) {
return function (accumulator, value) {
return combine(accumulator, transform(value));
};