Skip to content

Instantly share code, notes, and snippets.

#!/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
// io.js
define(['jquery'], function ($) {
return $({});
});
...
// main.js
require(['io', 'toast'], function (io, toast) {
io.on('my_event', function () {});
@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

Why?

Why are am I here? Why am I alive, on this planet, at this time?

A big question? No, a deepity. In one reading, truth. In another, nonsense.

The word ‘why’ can be taken in two ways: why meaning for what purpose did x happen; and why meaning how did x happen. Let's look at ‘why am I here?’ from both perspectives.

In the first sense, the question can be rewritten as ‘for what purpose am I here?’. In the second, ‘how is it that I came to be here?’.

@tgvashworth
tgvashworth / gist:5478385
Last active December 16, 2015 18:29
local tld dreamcode/ideas
// Array
// pros:
// simple, no duplication of ports
// cons:
// a tld can be duplicated
{
6000: [
"api.name.dev",
"admin.name.dev"
@tgvashworth
tgvashworth / examples.js
Created April 21, 2013 20:21
Managing Modularity – Code Example
var myModule = (function () {
// Private
var name = "AsyncJS";
// Public
return {
getName: function () {
return name;
},
setName: function (value) {
return (name = value);
@tgvashworth
tgvashworth / .gitconfig
Last active December 13, 2022 14:15
.gitconfig & .gitignore
# A ~/.gitconfig file
[user]
name = YOUR NAME
email = YOUR EMAIL
[github]
user = YOUR USERNAME
token = YOUR TOKEN
[core]
quotepath = false
editor = nvim
@tgvashworth
tgvashworth / async-binary-insert.js
Last active December 15, 2015 22:19
Async Binary Insert
// Insert value into into array (via comparison cb) then call the done cb
var insert = function insert(item, arr, compare, done) {
if (!done) {
done = compare;
compare = false;
}
compare = compare || function (a, b, cb) { return cb(a < b); };
@tgvashworth
tgvashworth / gist:5331538
Created April 7, 2013 17:44
Debounced callback
// Debouce a callback
var debounce = (function () {
// Save the previously used callbacks and timers
var cbs = [],
timers = [];
// When debounce is called, they're calling this function
return function (delay, cb) {
// Find or store this callback
var cbIndex = cbs.indexOf(cb);