Skip to content

Instantly share code, notes, and snippets.

Avatar
🎹
🍣🎸🥁🎺🎺

Greg Tangey Ruxton

🎹
🍣🎸🥁🎺🎺
View GitHub Profile
View konami.gradius.js
(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);
View keybase.md

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:

@Ruxton
Ruxton / screenshot.bash
Created Mar 5, 2014
Command line android screenshots via ADB
View screenshot.bash
#!/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
@Ruxton
Ruxton / somejs.js
Created Oct 10, 2013
Confirm bandcamp window close if playing
View somejs.js
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 / diaspora.html.erb
Last active Dec 21, 2015
A ruby script that fetches diaspora pods from activepods and geo locates them onto a map
View diaspora.html.erb
<!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 / gource_committers.bash
Created Aug 13, 2013
Gource joined committers caption
View gource_committers.bash
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 / php_handler.rb
Created Jun 28, 2013
The most useful Rails template handler this side of Kepler-69.
View php_handler.rb
class PHPHandler
def call(template)
php = `echo "#{template.source}" | php`.html_safe.inspect
end
end
ActionView::Template.register_template_handler(:php, PHPHandler.new)
View diaspora-upgrade.sh
#! /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
View XBMC.log
20:29:15 T:139663440447360 NOTICE: -----------------------------------------------------------------------
20:29:15 T:139663440447360 NOTICE: Starting XBMC (12.0 Git:ae08a23), Platform: Linux (Ubuntu 12.04.2 LTS, 3.2.0-36-generic x86_64). Built on Jan 29 2013
20:29:15 T:139663440447360 NOTICE: special://xbmc/ is mapped to: /usr/share/xbmc
20:29:15 T:139663440447360 NOTICE: special://xbmcbin/ is mapped to: /usr/lib/xbmc
20:29:15 T:139663440447360 NOTICE: special://masterprofile/ is mapped to: /home/ruxton/.xbmc/userdata
20:29:15 T:139663440447360 NOTICE: special://home/ is mapped to: /home/ruxton/.xbmc
20:29:15 T:139663440447360 NOTICE: special://temp/ is mapped to: /home/ruxton/.xbmc/temp
20:29:15 T:139663440447360 NOTICE: The executable running is: /usr/lib/xbmc/xbmc.bin
20:29:15 T:139663440447360 NOTICE: Local hostname: Rogue
20:29:15 T:139663440447360 NOTICE: Log File is located: /home/ruxton/.xbmc/temp/xbmc.log
@Ruxton
Ruxton / how_to.rb
Created Nov 16, 2012 — forked from osiro/how_to.rb
How to make caipirinha
View how_to.rb
def name_of_the_drink ingredients
case ingredients
when 'cachaça + lime + ice + sugar'
return 'Caipirinha'
when 'cachaça + juice + sugar'
return 'Batida'
when 'cachaça + cashew'
return 'Caju Amigo'
when 'cachaça + water + sugar + orange||lime + cloves + cinnamon + ginger'
return 'Quentão'