Skip to content

Instantly share code, notes, and snippets.

View anthonyringoet's full-sized avatar

Anthony R anthonyringoet

View GitHub Profile
@anthonyringoet
anthonyringoet / package.json
Created March 25, 2014 07:04
npm quick build
{
"name": "foobar",
"version": "0.0.0",
"description": "foobar description",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"watch-js": "watchify js/app.js -o js/bundle.js",
"build-js": "browserify js/app.js > js/bundle.js",
"start": "http-server .",
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Naive promise implementation</title>
</head>
<body>
<button id="a-button">Click</button>
</body>
</html>
@anthonyringoet
anthonyringoet / index.js
Created May 5, 2014 16:50
requirebin sketch
var vkey = require('vkey')
document.body.addEventListener('keydown', function(ev) {
console.log(vkey[ev.keyCode])
}, false)
@anthonyringoet
anthonyringoet / index.js
Created May 18, 2014 18:37
requirebin sketch
var v = document.createElement('video');
v.id = 'myVideo';
document.body.appendChild(v);
var getUserMedia = require('getusermedia');
var attachMediaStream = require('attachmediastream');
// get user media
getUserMedia(function (err, stream) {
// if the browser doesn't support user media
@anthonyringoet
anthonyringoet / index.js
Created May 27, 2014 14:49
requirebin sketch
var N = require('notification-count');
var n = new N();
setInterval(function(){
n.add();
},500)
@anthonyringoet
anthonyringoet / index.js
Created June 13, 2014 07:09
requirebin sketch
var Game = require('crtrdg-gameloop');
var canvas = document.createElement('canvas');
canvas.id = 'game';
var body = document.getElementsByTagName('body')[0];
body.appendChild(canvas);
var game = new Game({
canvasId: 'game',
@anthonyringoet
anthonyringoet / index.js
Created June 13, 2014 07:09
requirebin sketch
var Game = require('crtrdg-gameloop');
var canvas = document.createElement('canvas');
canvas.id = 'game';
var body = document.getElementsByTagName('body')[0];
body.appendChild(canvas);
var game = new Game({
canvasId: 'game',
@anthonyringoet
anthonyringoet / index.js
Created June 13, 2014 07:09
requirebin sketch
var Game = require('crtrdg-gameloop');
var canvas = document.createElement('canvas');
canvas.id = 'game';
var body = document.getElementsByTagName('body')[0];
body.appendChild(canvas);
var game = new Game({
canvasId: 'game',
* { background-color: rgba(255,0,0,.2); }
* * { background-color: rgba(0,255,0,.2); }
* * * { background-color: rgba(0,0,255,.2); }
* * * * { background-color: rgba(255,0,255,.2); }
* * * * * { background-color: rgba(0,255,255,.2); }
* * * * * * { background-color: rgba(255,255,0,.2); }
@anthonyringoet
anthonyringoet / gulpfile.js
Created December 9, 2014 08:30
Tiny static live reload server
var gulp = require('gulp');
var livereload = require('gulp-livereload')
var port = process.env.PORT || 4444;
gulp.task('server', function(next) {
var finalhandler = require('finalhandler');
var http = require('http');
var serveStatic = require('serve-static');
var serve = serveStatic(__dirname, {'index': ['index.html']});