This file contains hidden or 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 [goog.events :as events] | |
; import [goog.history Html5History] | |
; [goog Uri] | |
; [goog.history EventType] | |
(defn listen [el type] | |
(let [out (chan)] | |
(events/listen el type | |
(fn [e] (put! out e))) | |
out)) |
This file contains hidden or 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
find /path/to/wordpress/ -type d -exec chmod 755 {} \; | |
find /path/to/wordpress/ -type f -exec chmod 644 {} \; |
This file contains hidden or 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 |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
NewerOlder