Skip to content

Instantly share code, notes, and snippets.

View audionerd's full-sized avatar

Eric Skogen audionerd

View GitHub Profile
@audionerd
audionerd / custom_routes_in_jammit.rb
Created January 31, 2011 03:12
How to override Jammit's default routes (useful if you really want dots in your javascript filenames)
require 'action_controller'
require 'jammit'
require 'jammit/controller'
Jammit::Controller.class_eval do
def before_parse_request
case params[:package] + '.' + params[:extension]
when 'namespace.module.js'
params[:package] = 'namespace.module'
@audionerd
audionerd / middleman_mustache.rb
Created March 13, 2012 02:24
Mustache support for Middleman
require 'tilt-mustache'
# Mustache Renderer
module Middleman::Renderers::Mustache
class << self
def registered(app)
# Mustache is not included in the default gems,
# but we'll support it if available.
begin
@audionerd
audionerd / gist:3753910
Created September 20, 2012 04:01
YouTube app favorites - how to extract them from your iOS backups if iOS 6 replaces the YouTube app
# visit your iOS backups folder
cd ~/Library/Application\ Support/MobileSync/Backup/
# go to the most recent backup sub-folder
cd `ls -t1 | head -1`
# find the YouTube bookmarks file
grep -r "BookmarksMergeOffered" .
> ./fa2a1edd7d2789794b49856a1ad60f6ff002f1e0: <key>BookmarksMergeOffered</key>
@audionerd
audionerd / gist:4033647
Created November 7, 2012 19:01
Stativus example (pseudo-code)
var cat = new Cat()
var statechart = Stativus.createStatechart()
statechart.addState("meowing", {
enterState: function(){
cat.startMeowing()
},
exitState: function(){
cat.stopMeowing()
},
@audionerd
audionerd / index.html
Created November 7, 2012 19:49
Cat Stativus
<html>
<head>
<title>Cat Stativus</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="https://raw.github.com/etgryphon/stativus/master/stativus.js"></script>
</head>
<body>
<div id="output">
<div class="cat-meow" style="display:none; white-space: pre; font-family: monospace">
@audionerd
audionerd / index.html
Created November 9, 2012 21:48
Testing borismus/srcset-polyfill and paulirish/matchMedia.js
<html>
<head>
</head>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="https://raw.github.com/paulirish/matchMedia.js/master/matchMedia.js"></script>
<script src="https://raw.github.com/paulirish/matchMedia.js/master/matchMedia.addListener.js"></script>
@audionerd
audionerd / vinegrabber.rb
Last active July 21, 2016 02:31
given a vine.co uri, downloads the MP4 and creates an image sequence / GIF from it
# space150 vine grabber
# given a vine.co uri, downloads the MP4 and creates an image sequence / GIF from it
# requires ruby, ffmpeg, and imagemagick
require 'open-uri'
require 'nokogiri'
id = ARGV[0]
# try to convert from URL to id.
@audionerd
audionerd / gist:5059500
Created February 28, 2013 19:46
tiny hex to rgb
# tiny hex to rgb
# via http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb/11508164#11508164
def rgb(color)
[16, 8, 0].map { |n| color >> n & 255 }
end
rgb 0xfa029a
=> [250, 2, 154]
@audionerd
audionerd / sc-blend.coffee
Last active December 15, 2015 12:29
SuperCollider's SequenceableCollection blend, blendAt in CoffeeScript
# SuperCollider's SequenceableCollection blend, blendAt in CoffeeScript
# SEE ALSO:
# https://github.com/supercollider/supercollider/blob/master/SCClassLibrary/Common/Core/Object.sc
# http://danielnouri.org/docs/SuperColliderHelp/Collections/SequenceableCollection.html
# http://coleingraham.com/2012/12/31/notes-between-chromatic-just-intonation/
# http://mohayonao.github.com/subcollider.js/
class ArrayUtil
# via https://github.com/supercollider/supercollider/blob/master/SCClassLibrary/Common/Core/Object.sc
@blendAt: (array, index) ->
@audionerd
audionerd / token.rb
Last active December 17, 2015 07:58
A minimal re-usable module for "token" slugs on ActiveRecord models (AKA shortcodes, tiny urls)
# token.rb
# A minimal re-usable module for "token" slugs on ActiveRecord models (AKA shortcodes, tiny urls)
#
# USAGE
#
# class Project < ActiveRecord::Base
# include Token
# end
#
# see also: