Skip to content

Instantly share code, notes, and snippets.

View nissoh's full-sized avatar
🎯
Focusing

itburnz nissoh

🎯
Focusing
  • 2501
  • Sea of information
View GitHub Profile
@nissoh
nissoh / streamDecorator
Created May 10, 2015 09:42
Most & React - Stream ES7 decorator.
import React, { Component } from 'react';
import excEnv from 'react/lib/ExecutionEnvironment';
import most from 'most'
export default function Stream(streams) {
return DecoratedComponent => {
class StreamComponent extends Component {
constructor(props) {
@nissoh
nissoh / index.js
Last active August 29, 2015 14:24
requirebin sketch
var most = require('most');
var DROP = 0, GRAB = 1, DRAG = 2;
// The thing we want to make draggable
var playground = document.querySelector('.playground');
var draggable = document.querySelector('.draggable');
var dragOffset = {};
// A higher-order stream (stream whose events are themselves streams)
@nissoh
nissoh / index.js
Created July 4, 2015 19:22
requirebin sketch
var most = require('most');
var DROP = 0, GRAB = 1, DRAG = 2;
// The thing we want to make draggable
var playground = document.querySelector('.playground');
var draggable = document.querySelector('.draggable');
var dragOffset = {};
// A higher-order stream (stream whose events are themselves streams)
@nissoh
nissoh / index.js
Last active August 29, 2015 14:24
requirebin sketch
var most = require('most');
var DROP = 0,
GRAB = 1,
DRAG = 2;
// The thing we want to make draggable
var playground = document.querySelector('.playground');
var draggable = document.querySelector('.draggable');
var dragOffset = {};
@nissoh
nissoh / index.js
Created July 10, 2015 09:50
requirebin sketch
var most = require('most');
var DROP = 0, GRAB = 1, DRAG = 2;
// The area where we want to do the dragging
var area = document.querySelector('.dragging-area');
// The thing we want to make draggable
var draggable = document.querySelector('.draggable');
@nissoh
nissoh / index.js
Last active August 29, 2015 14:24
requirebin sketch
var most = require('most');
var hasTouch = 'ontouchstart' in window;
var dragEvtMap = {
START: hasTouch ? 'touchstart': 'mousedown',
END: hasTouch ? 'touchend' : 'mouseup',
HOVER: hasTouch ? 'touchmove' : 'mousemove'
};
@nissoh
nissoh / index.js
Created October 25, 2015 14:15
requirebin sketch
// require() some stuff from npm (like you were using browserify)
// and then hit Run Code to run it on the right
var Api = require('anx-api');
// Create a new instance with api target
var api = new Api({
target: 'https://api.appnexus.com'
});
api.login('username', 'password').then(function (token) {
@nissoh
nissoh / index.js
Created December 6, 2015 21:19
requirebin sketch
// hello world
var most = require('most');
var start = most.fromEvent('mousedown', document);
var end = most.fromEvent('mouseup', document);
var timeWindow = start.constant(end);
@nissoh
nissoh / example.js
Created January 15, 2016 10:17 — forked from anaisbetts/example.js
Cool tricks with ES6 templated strings
import {p} from './get-path';
console.log(p`${'userDesktop'}/MyApp`);
// On Windows
>> C:\Users\TheUser\Desktop\MyApp
// On OS X
>> /Users/TheUser/Desktop/MyApp
@nissoh
nissoh / esnextbin.md
Last active February 17, 2016 21:37
esnextbin sketch