Skip to content

Instantly share code, notes, and snippets.

@tgvashworth
tgvashworth / gist:5598252
Last active December 17, 2015 10:58
Github to Bitbucket
#!/bin/sh
# Github -> Bitbucket
# - Save this in /usr/local/bin as github-to-bitbucket
# - Then:
# cd /usr/local/bin
# chmod u+x github-to-bitbucket
# - Then restart your terminal
# - You should now have a github-to-bitbucket command
// io.js
define(['jquery'], function ($) {
return $({});
});
...
// main.js
require(['io', 'toast'], function (io, toast) {
io.on('my_event', function () {});
#!/bin/sh
# Commit and sync to Github
# To install, run:
# cd /usr/local/bin && wget -O commit-and-sync https://gist.github.com/phuu/5680243/raw/gistfile1.sh && chmod u+x commit-and-sync
# then restart yaw terminals.
BRANCH="$(git symbolic-ref HEAD 2>/dev/null)"
# Reconnaissance
@tgvashworth
tgvashworth / gist:5704768
Last active December 18, 2015 01:38
Make staging easy.
#!/bin/sh
# install:
# cd /usr/local/bin && wget -O stage-me https://gist.github.com/phuu/5704768/raw/gistfile1.sh && chmod u+x stage-me
branch=`git symbolic-ref HEAD 2>/dev/null | cut -d"/" -f 3-`
echo "Merging ⭠ $branch into ⭠ staging."
read -p "Is this correct? [y/N] : " -r
if [[ $REPLY =~ ^[Yy]$ ]]
then
@tgvashworth
tgvashworth / deferCallable.js
Last active December 19, 2015 01:19
deferCallable
/**
* Defer callable. Kinda tricky to explain. Basically:
* "Don't make newFn callable until I tell you via this trigger callback."
*
* Example:
// Only start logging after 3 seconds
var log = function (str) { console.log(str); };
var deferredLog = deferCallable(log, function (done) {
setTimeout(done, 3000);
(function (scope, name, fn, map) {
if (typeof define === 'function' && define.amd) {
define(fn)
} else if (typeof exports === 'object') {
var rtn = fn(require, module.exports, module);
if (module.exports !== rtn &&
typeof rtn !== 'undefined') module.exports = rtn;
} else {
var exp = {}, mod = { exports: exp },
reqr = function (i) { return map[i] ? scope[map[i]] : scope[i]; };
{ URI:
{ root: 'URI.js',
files: { default: 'URI.min.js', minified: 'URI.min.js' },
versions: [ '1.7.2' ] },
accounting:
{ root: 'accounting.js',
files: { default: 'accounting.js', minified: 'accounting.min.js' },
versions: [ '0.3.2' ] },
ace:
{ root: 'ace',
> var events = require('events');
undefined
> var ee = new events.EventEmitter();
undefined
> var thing1 = Object.create(ee);
undefined
> var thing2 = Object.create(ee);
undefined
> thing1.on('fish', console.log.bind(console, 'thing1'));
{}
a=require;a('http').createServer(function(b,c){d=a('url').parse(b.url,1).query;setTimeout(c.end.bind(c),d.t,c.writeHead(302,{Location:d.u}))}).listen(3e3)
<!DOCTYPE html>
<meta charset=utf-8 />
<title></title>
#yolo