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
/* fadeOut animation css */ | |
.fadeOut { | |
animation-name: fadeOut; | |
-webkit-animation-name: fadeOut; | |
animation-duration: 0.4s; | |
-webkit-animation-duration: 0.4s; | |
animation-timing-function: ease-in-out; | |
-webkit-animation-timing-function: ease-in-out; |
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
require 'sinatra' | |
require 'vimeo' | |
require 'shotgun' | |
require 'haml' | |
enable :sessions | |
set :protection, :except => :frame_options | |
get '/:key/:secret/:access_token/:access_token_secret/:user_id' do |
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 test = ["this is an element", "this is an element", "so is this"]; | |
var unique = test.filter(function(elem, pos, self) { | |
return self.indexOf(elem) == pos; | |
}); | |
console.dir(unique); |
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 a method inside of a JavaScript Object. In this instance, the method gets | |
* recreated with each Class Instance. Sometimes desirable, sometimes not. | |
*/ | |
function Wizard () { | |
this.name = "The Wiz"; | |
this.level = 1; | |
this.shoot = function () { | |
alert('Imma Shoot You!'); | |
}; |
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
# Batch renaming/mv/cp/etc... using bash | |
# Step 1: to make a backup copy of all pdf files in a directory | |
for i in *.pdf ; do mv "$i" "${i}.backup" ; done | |
# Step 2: to copy one file over all of the original files in this directory | |
for i in *.pdf ; do cp "~/source.pdf" "${i}" ; done |
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
# ~/.atom/init.coffee | |
atom.commands.add 'atom-text-editor', 'exit-insert-mode-if-preceded-by-j': (e) -> | |
editor = @getModel() | |
pos = editor.getCursorBufferPosition() | |
range = [pos.traverse([0,-1]), pos] | |
lastChar = editor.getTextInBufferRange(range) | |
if lastChar != "j" | |
e.abortKeyBinding() | |
else |
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
# put this function in your .bash_profile or .zshrc to open the github compare screen | |
# for your current branch. Of course, you must push your branch up remotely first for this to work. | |
# The function parses your current working branch from the output of git branch | |
# and opens github in Chrome, right to the compare page for your branch. | |
# | |
# Edit myaccountname and myreponame and enter the account and repo of your choice. | |
# | |
function openpr () { | |
ACCOUNT=myaccountname # replace with your account name | |
REPO=myreponame # replace with your repo name |
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 accounts = [ | |
{ name: 'James Brown', msgCount: 123 }, | |
{ name: 'Stevie Wonder', msgCount: 22 }, | |
{ name: 'Sly Stone', msgCount: 16 }, | |
{ name: 'Otis Redding', msgCount: 300 } // Otis has the most messages | |
]; | |
// get sum of msgCount prop across all objects in array | |
var msgTotal = accounts.reduce(function(prev, cur) { | |
return prev + cur.msgCount; |