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
/** | |
* The first commented line is your dabblet’s title | |
*/ | |
background: #f06; | |
background: linear-gradient(45deg, #f06, yellow); | |
min-height:100%; |
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
#!/usr/bin/env bash | |
if [ -f $1 ] ; then | |
case $1 in | |
*.tar.bz2) tar xjf $1 ;; | |
*.tar.gz) tar xzf $1 ;; | |
*.jar) jar xvf $1 ;; | |
*.bz2) bunzip2 $1 ;; | |
*.rar) rar x $1 ;; | |
*.gz) gunzip $1 ;; | |
*.tar) tar xf $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 | |
# php switch for homebrew | |
# $ brew tap josegonzalez/php && brew install php53 --with-mysql && brew install php54 --with-mysql | |
# Might as well ask for password up-front, right? | |
sudo -v | |
VERSION_FILE="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/php-switch.version" |
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 | |
cp -f ~/.Trash/Sublime\ Text\ 2.app/Contents/Resources/Sublime\ Text\ 2.icns /Applications/Sublime\ Text\ 2.app/Contents/Resources/Sublime\ Text\ 2.icns |
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
define(['rivets', 'backbone'], function(rivets, Backbone){ | |
rivets.configure({ | |
adapter: { | |
subscribe: function(obj, keypath, callback) { | |
if (obj instanceof Backbone.Collection) { | |
obj.on('add remove reset', function () { | |
callback(obj[keypath]); | |
}); | |
} else { | |
obj.on('change:' + keypath, function (m, 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
def findAdjWithBase(w: Int, h: Int)(r: Int, c: Int) = { | |
def check(x: (Int, Int)) = 0 < x._1 && x._1 <= h && 0 < x._2 && x._2 <= w | |
if(check((r, c))){ | |
List((-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)) | |
.map(x => (x._1 + r, x._2 + c)).filter(check) | |
} | |
} | |
val findAdj = findAdjWithBase(9, 9)_ |
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 man in 1 3 5 7; do | |
ln -sf /usr/local/lib/node_modules/npm/man/man${man}/* /usr/local/share/man/man${man} | |
done | |
ln -sf /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm | |
npm update npm -g |
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
angular | |
.module('MyApp') | |
.config(['$provide', function($provide){ | |
$provide.decorator('$rootScope', ['$delegate', function($delegate){ | |
Object.defineProperty($delegate.constructor.prototype, '$onRootScope', { | |
value: function(name, listener){ | |
var unsubscribe = $delegate.$on(name, listener); | |
this.$on('$destroy', unsubscribe); | |
}, |
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
var withWalking = function() { | |
this.walk = function() { | |
console.log(this.name + ' is walking'); | |
}; | |
this.turn = function(direction) { console.log('turning', direction); | |
}; | |
this.stopWalking = function() { | |
console.log('stopped walking'); | |
}; | |
}; |
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
// TODO: Add Validations | |
var List = function (value) { | |
this.value = value || []; | |
}; | |
List.prototype.unit = function (value) { | |
return new List(value); | |
}; | |
List.prototype.flatMap = function (fn, context) { |