Skip to content

Instantly share code, notes, and snippets.

View Ruxton's full-sized avatar
🎹
🍣🎸🥁🎺🎺

Greg Tangey Ruxton

🎹
🍣🎸🥁🎺🎺
View GitHub Profile
#! /bin/bash
START_DIR=$PWD
DIASPORA_DIR="/var/vhosts/diaspora.digitalignition.net/diaspora"
DEFAULT_BRANCH="develop"
UNICORN_EXEC="service unicorn"
UNICORN_CONF="/etc/unicorn/diaspora.conf"
RAILS_ENV="production"
function diaspora_unicorn_service() {
if [ $# -lt 1 ]; then
@Ruxton
Ruxton / php_handler.rb
Created June 28, 2013 01:40
The most useful Rails template handler this side of Kepler-69.
class PHPHandler
def call(template)
php = `echo "#{template.source}" | php`.html_safe.inspect
end
end
ActionView::Template.register_template_handler(:php, PHPHandler.new)
@Ruxton
Ruxton / gource_committers.bash
Created August 13, 2013 06:10
Gource joined committers caption
git_joined_committers_caption() {
authors=`git log --no-merges --format='%aN' | sort -u`
OLD_IFS=$IFS
IFS=$(echo -en "\n\b")
author_list=""
for author in $authors; do
author_first_commit=`git log --author="${author}" --pretty=format:%H|tail -1`
author_list+="$(git log -1 --format='%ct|%an started comitting' $author_first_commit)\n"
done
IFS=$OLD_IFS
@Ruxton
Ruxton / diaspora.html.erb
Last active December 21, 2015 01:39
A ruby script that fetches diaspora pods from activepods and geo locates them onto a map
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" content="text/html" http-equiv="content-type">
<title>Diaspora Pods by Country</title>
<script src="http://www.ammap.com/lib/ammap.js" type="text/javascript"></script>
<script src="http://www.ammap.com/lib/maps/js/worldLow.js" type="text/javascript"></script>
<script>
var map;
AmCharts.ready(function() {
@Ruxton
Ruxton / somejs.js
Created October 10, 2013 08:58
Confirm bandcamp window close if playing
window.onbeforeunload = function () {
var shouldConfirmClose = ($('.playing').length > 0); //get boolen value
if (shouldConfirmClose) {
//this will alert user
return 'Are you sure?';
}
else {
//this wont
window.onbeforeunload = undefined;
}
@Ruxton
Ruxton / screenshot.bash
Created March 5, 2014 05:26
Command line android screenshots via ADB
#!/bin/bash
# droidshot: droidshot [filename] - Saves screenshots via ADB to filename
function droidshot() {
local formatter="%03d"
local file="$1"
local n=1
local fn=$(printf "${formatter}" $n)
if [[ "$file" == "" ]]; then

Keybase proof

I hereby claim:

  • I am ruxton on github.
  • I am ruxton (https://keybase.io/ruxton) on keybase.
  • I have a public key whose fingerprint is 094D 1B0D 7168 CF98 4904 998D CACC 58F9 7CFA FD69

To claim this, I am signing this object:

(function($) {
return $.fn.konami = function(callback, code) {
if (code == null) {
code = "38,38,40,40,37,39,37,39,66,65";
}
return this.each(function() {
var kkeys;
kkeys = [];
return $(this).bind('keydown', function(e) {
kkeys.push(e.keyCode);