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
# In ~/.bash_aliases | |
## Git | |
alias g='git' | |
alias gcb='git checkout -b' | |
alias gpp="git pull && git push && git push --tags" | |
## Shell | |
alias ll='ls -lh' | |
alias reload='. ~/.bash_login' | |
alias tf='tail -f -n 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
#!/bin/sh -x | |
# git name-rev is fail | |
CURRENT=`git branch | grep '\*' | awk '{print $2}'` | |
git checkout master | |
git merge ${CURRENT} | |
git push origin master | |
git checkout ${CURRENT} |
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/sh -x | |
# git name-rev is fail | |
CURRENT=`git branch | grep '\*' | awk '{print $2}'` | |
git checkout master | |
git pull origin master | |
git checkout ${CURRENT} | |
git rebase master |
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
# Found this somewhere on the intertubes. | |
# Posting here for future use and posterity | |
mysqldump --user=username --password=password --default-character-set=latin1 --skip-set-charset dbname > dump.sql | |
sed -r 's/latin1/utf8/g' dump.sql > dump_utf.sql | |
mysql --user=username --password=password --execute="DROP DATABASE dbname; CREATE DATABASE dbname CHARACTER SET utf8 COLLATE utf8_general_ci;" | |
mysql --user=username --password=password --default-character-set=utf8 dbname < dump_utf.sql |
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
registration_request = FacebookRegistration::SignedRequest.new(params[:signed_request]) | |
registration_params = registration_request.parse_request | |
pp registration_params |
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 'rubygems' | |
require 'haml' | |
require 'sinatra' | |
require 'redis' | |
helpers do | |
def redis | |
@redis ||= Redis.new | |
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
/*! | |
* Javascript Logger | |
* https://gist.github.com/gists/902014 | |
* | |
* Copyright 2011, Brandon Leonardo | |
*/ | |
var Logger = function(options) { | |
var opts = options || {}; | |
this.debugMode = opts['debugMode'] || 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
function toSentence(arr) { | |
arr = arr.slice(0); | |
switch (arr.length) { | |
case 0: | |
return ""; | |
case 1: | |
return arr.pop().name; | |
default: | |
var lastItem = arr.pop(); | |
return _.pluck(arr, 'name').join(', ') + " and " + lastItem.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
/* Given an array of strings it returns a sentence. */ | |
function toSentence(arr) { | |
arr = arr.slice(0); | |
switch (arr.length) { | |
case 0: | |
return ""; | |
case 1: | |
return arr.pop(); | |
default: | |
var lastItem = arr.pop(); |
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
echo "ServerName [name]" | tee /etc/apache2/conf.d/fqdn | |
service apache2 restart | |
hostname -f | |
# Potentially: vi /etc/hostname | |
# Setup IPTABLES | |
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT | |
iptables -A INPUT -p tcp --dport 22 -j ACCEPT | |
iptables -A INPUT -p tcp --dport 80 -j ACCEPT | |
iptables -A INPUT -p tcp --dport 443 -j ACCEPT |
OlderNewer