This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for file in * | |
do | |
if [ -d $file ] | |
then | |
cd $file | |
echo Pulling `pwd` `git branch 2>/dev/null | grep -e '^*' | sed -E 's/^\* (.+)$/(\1) /'` | |
git pull | |
cd ../ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// REQUIRES: | |
// moment.js - http://momentjs.com/ | |
// USAGE: | |
// {{ someDate | moment: [any moment function] : [param1] : [param2] : [param n] | |
// EXAMPLES: | |
// {{ someDate | moment: 'format': 'MMM DD, YYYY' }} | |
// {{ someDate | moment: 'fromNow' }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_.mixin({ | |
// _.contains for strings with optional case sensitivity | |
hasSubstring: function (stringA, stringB, caseSensitive) { | |
if (caseSensitive) return stringA.indexOf(stringB) >= 0; | |
return stringA.toLowerCase().indexOf(stringB.toLowerCase()) >= 0; | |
}, | |
// Get the difference between two arrays - shallow only | |
diffArrays: function (a, b) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Updates your version of node.js using the version control system "n" | |
# @param a version (default is latest stable) | |
# https://github.com/tj/n | |
sudo npm cache clean -f | |
sudo npm install -g n | |
version=`node -v` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
null + null === 0 // true | |
[] + [] === '' // true | |
null + 1 === 1 // true | |
isNaN(null) // false | |
NaN === NaN // false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
background: url('https://placeholdit.imgix.net/~text?txtsize=72&txt=background%20image&w=1020&h=860') no-repeat center center fixed; | |
-webkit-background-size: cover; | |
-moz-background-size: cover; | |
-o-background-size: cover; | |
background-size: cover; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// An example of streaming html to the browser in ES2015 | |
// inspired by https://github.com/koajs/examples/tree/master/stream-view | |
// *** Usage *** | |
// const app = koa() | |
// app.use(function* () { | |
// this.type = 'html' | |
// this.body = new StreamView(this) | |
// }) | |
// app.listen(3000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import koa from 'koa' | |
import router from 'koa-route' | |
import streamView from './stream-view' | |
const app = koa() | |
const toJS = str => JSON.parse(str) | |
const toJSON = js => JSON.stringify(js) | |
// stream an html page with asynchronous data | |
app.use(router.get('/html/:title', streamView('html', function* (title) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gitadd() { | |
git diff | grep "console.log" || git add $1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
readonly user="my_dokku_username" | |
readonly host="my_hostname" | |
readonly targets=( | |
# git branch | project name | virtual host | |
# list your dokku instances here... | |
) | |
# execute from the project root |
OlderNewer