Skip to content

Instantly share code, notes, and snippets.

View jordancalder's full-sized avatar
🤖
not a bot

Jordan Calder jordancalder

🤖
not a bot
View GitHub Profile
@jordancalder
jordancalder / gist:6971483
Created October 14, 2013 06:10
js replace
jQuery(document).ready(function () {
jQuery(".imgResize").on('load', function () {
var $this = jQuery(this);
if ($this.width() > $this.height()) {
$this.addClass("landscape");
} else if ($this.width() < $this.height()) {
$this.addClass("portrait");
} else {
}
@jordancalder
jordancalder / gist:8672286
Created January 28, 2014 17:35
Wordpress - Display Current Template
//Add to functions.php
add_action('wp_head', 'show_template');
function show_template() {
global $template;
print_r($template);
}
@jordancalder
jordancalder / gist:561b0f6a721d7223f200
Created January 13, 2015 21:48
Git Overwrite Local Conflicts - Leave Other Local Changes Alone
git add *
git commit -m "commit message"
//Fetch changes and overwrite local conflicts
git fetch origin master
git merge -s recursive -X theirs origin/master
@jordancalder
jordancalder / gist:1e1868d19bd49099e3cd
Created January 13, 2015 23:39
Remove anything staged but not committed
git reset --hard
@jordancalder
jordancalder / gist:9408f615ffc34779a3cd
Created January 13, 2015 23:40
Remove all untracked files/directories (You really screwed up)
git clean -df .
@jordancalder
jordancalder / gist:b31b6d4194200d2b5582
Created January 13, 2015 23:41
Remove latest commit, keep changes in local working directory
git reset --soft HEAD~1
@jordancalder
jordancalder / gist:ca5321a67043d70ab829
Created January 13, 2015 23:42
Go back when you've already pushed a commit
git revert [commithash]
@jordancalder
jordancalder / gist:d92009160ff122c1fe1a
Created January 26, 2015 17:18
Install Node.js and NPM on AWS
sudo yum update
sudo yum install gcc-c++ make
sudo yum install openssl-devel
sudo yum install git
git clone git://github.com/joyent/node.git
cd node
git checkout v0.10.26
./configure
make
sudo make install
@jordancalder
jordancalder / gist:6817ef9bf045f1262eab
Created January 26, 2015 19:56
Install MongoDB on AWS
echo "[MongoDB]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck=0
enabled=1" | sudo tee -a /etc/yum.repos.d/mongodb.repo
sudo yum install -y mongodb-org-server mongodb-org-shell mongodb-org-tools
sudo mkdir /data /log /journal
@jordancalder
jordancalder / gist:2fd88361385243a15ead
Created March 20, 2015 20:45
Create repo from CLI (Add to ~/.bash_profile)
github-repo() {
repo_name=$1
dir_name=`basename $(pwd)`
if [ "$repo_name" = "" ]; then
echo "Repo name (hit enter to use '$dir_name')?"
read repo_name
fi
if [ "$repo_name" = "" ]; then