Skip to content

Instantly share code, notes, and snippets.

View yocontra's full-sized avatar

contra yocontra

View GitHub Profile
@yocontra
yocontra / after.js
Last active August 29, 2015 14:04
use pipelines with gulp
var buffer = require('vinyl-buffer');
var source = require('vinyl-source-stream');
var browserify = require('browserify');
var uglify = require('gulp-uglify');
gulp.task('index', function(){
var bundler = browserify('newstimeline/livescript/index.ls');
bundler.transform('browserify-livescript');
return bundler.bundle({insertGlobals: true})
var Timer = React.createClass({
displayName: 'Timer',
propTypes: {
interval: React.PropTypes.number,
onTick: React.PropTypes.func
},
getDefaultProps: function() {
return {
interval: 1000
};
var last = Date.now();
var lag = 0;
setInterval(function(){
lag = Date.now() - last;
last = Date.now();
}, 0);
const os = require('os');
const fs = require('fs');
const path = require('path');
const execFile = require('child_process').execFile;
const tmpfile = path.join(os.tmpdir(), process.versions.v8+'.flags.json');
const exclusions = ['--help'];
module.exports = function (cb) {
fs.exists(tmpfile, function (exists) {
@yocontra
yocontra / scss.sh
Created August 31, 2015 06:45
how somebody compiles a folder of scss files using make and bash
#!/bin/bash
# SCSS include path
BINPATH=`dirname $0`
STATIC_DIR="$BINPATH/../root/static/scss"
# SCSS
function compile_dir {
SCSS_DIR=$1
SCSS=scss
@yocontra
yocontra / funk.js
Created June 19, 2011 08:26
get da funk
//
// Create main view
//
A2B.createView = function() {
// create map view
A2B.mapview = Titanium.Map.createView({
mapType: Titanium.Map.STANDARD_TYPE,
animate:true,
regionFit:true,
region:{latitude:33.74511, longitude:-84.38993, latitudeDelta:0.5, longitudeDelta:0.5},
@yocontra
yocontra / gist:1789699
Created February 10, 2012 13:42
dox AST transformer
//This function initializes the library
exports.initialize = function (wha) {
console.log("initialized " + wha);
};
//This is super complex - watch out for it!
//Serious bro
exports.coolprop = "hi";
//This function kills a process
@yocontra
yocontra / rAFshim.coffee
Created February 14, 2012 21:11 — forked from phated/rAFshim.coffee
window.requestAnimationFrame shim
###
http://paulirish.com/2011/requestanimationframe-for-smart-animating/
http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
requestAnimationFrame polyfill by Erik Möller
fixes from Paul Irish and Tino Zijdel
Coffeescript and AMD by Blaine Bublitz
###
makeUUID = ->
"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace /[xy]/g, (a, b) ->
b = Math.random() * 16
return (if a is "y" then b & 3 | 8 else b | 0).toString 16
@yocontra
yocontra / stuff.coffee
Created April 24, 2012 07:31
Coffeescript override __bind to track function scope
@['__bind'] = (fn, scope) ->
nu = ->
fn.apply scope, arguments
(nu._scope?=[]).push scope
return nu