Skip to content

Instantly share code, notes, and snippets.

View jasonrhodes's full-sized avatar

Jason Rhodes jasonrhodes

View GitHub Profile
function fuck() {
if killall -9 "$2"; then
echo ; echo " (╯°□°)╯︵$(echo "$2"|toilet -f term -F rotate)"; echo
fi
}
@jasonrhodes
jasonrhodes / post-receive.sh
Created September 6, 2014 18:13
My git post-receive hook for Digital Ocean -- I make a bare repo in /var/repos/{reponame}/app.git and then add this code to the post-receive hook in app.git/hooks then set up a remote via ssh to the app.git folder
#!/bin/sh
# Store git files in a different directory than the repo
git --work-tree=/var/www/meatspace-markov-memeify --git-dir=/var/repos/meatspace-markov-memeify/app.git checkout -f
# Install npm deps
cd /var/www/meatspace-markov-memeify && npm install
# If index.js is running, restart--otherwise start!
forever restart --spinSleepTime 10000 --minUptime 1000 /var/www/meatspace-markov-memeify/index.js --port=8000 || forever start --spinSleepTime 10000 --minUptime 1000 /var/www/meatspace-markov-memeify/index.js --port=8000
@gggritso
gggritso / console.lol.js
Created October 10, 2014 03:33
console.lol
console.lol = function() {
var harray = [], harrumpf = Math.floor( Math.random() * 10 + 2 );
while ( harrumpf-- ) harray.push( 'ha' );
console.log( harray.join( '' ) + '!' );
}
@jasonrhodes
jasonrhodes / gutpunch.sh
Created October 16, 2014 20:03
Because sometimes `gut punch origin master` is more accurate
# In ~/.bash_profile or ~/.profile, whichever you use
alias gut="git"
# In ~/.gitconfig
[alias]
punch = push
# Or maybe more acccurately
[alias]
punch = push -f

JavaScript Code Standards

Let's write better JavaScript, and the same, k?

Indentation

We always use spaces, and we always use four. Set your editor now.

function myFunction() {
@eades1
eades1 / code-standards.css.markdown
Created April 2, 2012 17:25
CSS Code Standards

Selectors

  • begin on a new line
  • space between selector and opening curly brace
  • closing curly brace, unindented, on its own line
selector {
  property: value;
}
@scoates
scoates / twitter_user_to_image
Last active December 19, 2015 09:49
Get a twitter profile image from a username. We route around bad APIs. Twitter wears the scumbag hat, these days.
#!/bin/bash
# Usage: $0 username
# e.g.:
# $ ./twitter_user_to_image coates
# https://si0.twimg.com/profile_images/1597362183/me.jpg
curl -sL http://twitter.com/$1 | grep profile_images | head -n1 | perl -p -e's/.*?http/http/;s/".*//;s/_bigger//'
@dragonmantank
dragonmantank / gist:6723460
Last active January 21, 2016 17:39
Reset Apache httpd to run as the vagrant user
exec { "change_httpd_user":
command => "sed -i 's/www-data/vagrant/g' /etc/apache2/envvars",
onlyif => "/bin/grep -q 'www-data' '/etc/apache2/envvars'",
notify => Service['apache2'],
require => Package['apache2'],
}
file { "/var/lock/apache2":
ensure => "directory",
owner => "vagrant",
@jasonrhodes
jasonrhodes / self.static.php
Created June 5, 2012 20:49
Self vs Static in PHP
<?php
class A
{
public static $var = "I'm set in A!<br>";
public static function getStatic() {
echo static::$var;
}
public static function getSelf() {
@markjaquith
markjaquith / plugin-deploy.sh
Created November 16, 2012 05:04 — forked from scribu/plugin-deploy.sh
Plugin deploy script
#!/bin/bash
# args
MSG=${1-'deploy from git'}
BRANCH=${2-'trunk'}
# paths
SRC_DIR=$(git rev-parse --show-toplevel)
DIR_NAME=$(basename $SRC_DIR)
DEST_DIR=~/svn/wp-plugins/$DIR_NAME/$BRANCH