Instantly share code, notes, and snippets.

View mvd.sh
#!/bin/bash
# get source and destination parent
if [[ -z $1 ]]; then
echo "source and destionation parent arguments required"
exit 1
fi
SOURCE=$1
DESTINATION_PARENT=~/Documents/bb-bk-00
View javascript.json
{
"Test flag": {
"prefix": "test",
"body": [
"// @test"
],
"description": "Flag line as testing only"
},
"Todo flag": {
"prefix": "todo",
View findSelectors.js
'use strict';
const file = 'some_file.js';
const ignore = [
'a',
'input',
'span',
'td',
'title',
View mobile-width-helpers.js
// not for production use
function MobileWidthHelpers () {
this.stringName = stringName;
var ignoreElements = [
'SCRIPT',
'LINK',
'META'
];
function stringName ($el) {
View indefinite_mutation_observer.js
// support multiple browsers
// http://stackoverflow.com/questions/2844565/is-there-a-jquery-dom-change-listener/11546242#11546242
MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
var elementId = 'some-id';
// instantiate initial observer
var observer = new MutationObserver(observeIndefinitely(elementId));
observer.observe(document.getElementById(elementId), {
// expensive, only use what's needed of these
attributes: true,
childList: true,
View cp_branch.sh
echo -n "$(git rev-parse --abbrev-ref HEAD)" | pbcopy
View test.sublime-snippet
<snippet>
<content><![CDATA[
// @test
]]></content>
<tabTrigger>test</tabTrigger>
<description>@test</description>
</snippet>
View todo.sublime-snippet
<snippet>
<content><![CDATA[
// @todo
]]></content>
<tabTrigger>todo</tabTrigger>
<description>@todo</description>
</snippet>
View heroku-deploy.sh
#!/bin/bash
# requires that node app.js be contained in a Procfile
# ./heroku-deploy.sh <NODE_ENV> <local_branch_to_push> <app_to_destroy_if_redeploy>
# validate minimal input
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Run with at least NODE_ENV and local_branch_to_push as arguments $1 and $2"
exit 1
fi
View console_info.sublime-snippet
<snippet>
<content><![CDATA[
console.info('${1:thing}:', ${1}); // @test
]]></content>
<tabTrigger>info</tabTrigger>
<description>console.info()</description>
<scope>source.js</scope>
</snippet>