Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Nikita Dudnik Nek

🎯
Focusing
View GitHub Profile
@Nek
Nek / index.js
Created Feb 5, 2014
working code
View index.js
function *listen(el, evType) {
while (true)
yield function(cb) {
var fire = function(ev) {
el.removeEventListener(evType, fire);
cb(null, ev);
}
el.addEventListener(evType, fire);
}
}
@Nek
Nek / index.js
Created Feb 5, 2014
broken code
View index.js
function *listen(el, evType) {
while (true)
yield function(cb) {
var fire = function(ev) {
el.removeEventListener(evType, fire);
cb(null, ev);
}
el.addEventListener(evType, fire);
}
}
@Nek
Nek / bundle.js
Created Feb 5, 2014
transpiled code
View bundle.js
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var wrapGenerator = require('regeneratorify/runtime').wrapGenerator;
wrapGenerator.mark(listen);
function listen(el, evType) {
return wrapGenerator(function listen$($ctx) {
while (1) switch ($ctx.next) {
case 0:
if (!true) {
$ctx.next = 5;
@Nek
Nek / index.js
Created Jul 7, 2014
requirebin sketch
View index.js
// 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")
@Nek
Nek / index.js
Created Jul 17, 2014
requirebin sketch
View index.js
// example using the raf module from npm. try changing some values!
var requestAnimationFrame = require("raf")
var Bacon = require("baconjs")
var canvas = document.createElement("canvas")
canvas.width = 500
canvas.height = 100
document.body.appendChild(canvas)
var box = document.createElement("div")
@Nek
Nek / index.js
Last active Aug 29, 2015
requirebin sketch
View index.js
var ticker = require("ticker")
var PIXI = require("pixi.js")
var stage = new PIXI.Stage(0xFFFFFF, true);
stage.interactive = true;
var renderer = PIXI.autoDetectRenderer(640, 480);
renderer.view.style.display = "block";
// add render view to DOM
document.body.appendChild(renderer.view);
View Object.create.js
// http://stackoverflow.com/a/10142212/195895
if (typeof Object.create !== 'function') {
Object.create = function (o) {
function F() {}
F.prototype = o;
return new F();
};
}
View test.js
function () {
alert("!!!");
}
@Nek
Nek / jade_stylus_sublime.md
Created Dec 6, 2011 — forked from csanz/jade_stylus_sublime.md
Getting Jade and Stylus working w/ Sublime Text 2
View jade_stylus_sublime.md

Git way

cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages
git clone https://github.com/miksago/jade-tmbundle.git Jade
git clone https://github.com/LearnBoost/stylus.git Stylus

Ye Old Way

Download Jade and Stylus bundles

View playerSpec.js
describe( "Player library", function () {
describe("Player", function() {
it("exists in a library namespace", function() {
expect(mediaITPro.Player).toBeDefined();
});
it("has an attachPlayer method", function() {
expect(mediaITPro.Player.attachPlayer).toBeDefined();
});
});
You can’t perform that action at this time.