Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

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

Greg Tangey Ruxton

🎹
🍣🎸🥁🎺🎺
View GitHub Profile
(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);
@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 / 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 / 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 / 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)
#! /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
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 November 16, 2012 02:26 — forked from osiro/how_to.rb
How to make caipirinha
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'
@Ruxton
Ruxton / gist:3292990
Created August 8, 2012 07:07
Get original facebook avatar
## I have a member class, it has a method on it called facebook, you will also need the user_photos permission
#
# def facebook
# @facebook ||= Koala::Facebook::API.new facebook_auth.credentials.token if facebook?
# end
#
##
user=User.last
# rc: Rails console
alias rc="rails c"
# debugme: touch tmp/debug.txt
alias debugme="touch tmp/debug.txt"
# rgm: Generate rails migrations
function rgm() {
local fileopener file