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
# Guide | |
# Configure the essential configurations below and do the following: | |
# | |
# Repository Creation: | |
# cap deploy:repository:create | |
# git add . | |
# git commit -am "initial commit" | |
# git push origin master | |
# | |
# Initial Deployment: |
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
function Machine(first, $){ | |
var cur = {}, next = $[first]; | |
var self = { | |
go : function(to){ next = next ? next : ($[to] || $.undefined); }, | |
trigger : function(event){ self.go( cur.tx && cur.tx[event] ); } | |
}; | |
return function(){ | |
if(next){ | |
cur.exit && cur.exit.call(self); |
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
class KeyGenerator | |
require "digest/sha1" | |
def self.generate(length = 10) | |
Digest::SHA1.hexdigest(Time.now.to_s + rand(12341234).to_s)[1..length] | |
end | |
end |
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
#ignore file(s), add file(s), list file(s) | |
assume = update-index --assume-unchanged | |
unassume = update-index --no-assume-unchanged | |
assumed = "!git ls-files -v | grep ^h | cut -c 3-" | |
#call your last stash a snapshot | |
snapshot = !git stash save "snapshot: $(date)" && git stash apply "stash@{0}" | |
#merging | |
ours = "!f() { git checkout --ours $@ && git add $@; }; f" |
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
Storage.prototype.setObject = function(key, value) { | |
this.setItem(key, JSON.stringify(value)); | |
} | |
Storage.prototype.getObject = function(key) { | |
return JSON.parse(this.getItem(key)); | |
} | |
// Extend the default Number object with a formatMoney() method: | |
// usage: someVar.formatMoney(decimalPlaces, symbol, thousandsSeparator, decimalSeparator) |
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 delay = (function(){ | |
var timer = 0; | |
return function(callback, ms){ | |
clearTimeout (timer); | |
timer = setTimeout(callback, ms); | |
}; | |
})(); |
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
# Install Dependencies | |
# sudo apt-get install build-essential | |
# sudo apt-get build-dep php5 | |
sudo apt-get install libmysqlclient-dev mysql-client libcurl4-openssl-dev libgd2-xpm-dev libjpeg-dev libpng3-dev libxpm-dev libfreetype6-dev libt1-dev libmcrypt-dev libxslt1-dev bzip2 libbz2-dev libxml2-dev libevent-dev libltdl-dev libmagickwand-dev libmagickcore-dev imagemagick libreadline-dev libc-client-dev libsnmp-dev snmpd snmp libvpx-dev libxpm-dev libgmp3-dev libicu-dev libpspell-dev libtidy-dev freetds-dev unixodbc-dev librecode-dev libglib2.0-dev libsasl2-dev libgeoip-dev imagemagick libmagickcore-dev libmagickwand-dev | |
# Stop Apache | |
sudo service apache2 stop | |
# Cleanup Packages | |
sudo apt-get autoremove |
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
//ajax | |
$.ajax({ | |
url: '/endpoint' | |
}).done(function(data){ | |
// do something awesome | |
}).fail(function(xhr){ | |
// sad little dance | |
}); | |
var xhr = new XMLHttpRequest(); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Fun with Buttons</title> | |
<style> | |
/*structure*/ | |
.button, input[type="button"] { | |
box-shadow: .1em .2em .5em #aaa; | |
height: 22px; | |
display: block; |
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
// Example: | |
JavaScript.load("/javascripts/something.js"); | |
// With callback (that’s the good thing): | |
JavaScript.load("http://www.someawesomedomain.com/api.js", function() { | |
API.use(); // or whatever api.js provides ... | |
}); |
OlderNewer