Skip to content

Instantly share code, notes, and snippets.

View davidcornu's full-sized avatar

David Cornu davidcornu

View GitHub Profile
@davidcornu
davidcornu / SoundParser.rb
Created August 25, 2011 17:23
Convert MP3 Files to Waveform Images in Ruby
# --------------------------------------------------------------------
# Create SoundCloud-style waveforms from mp3 files
# Author: David Cornu
# Credit for the idea goes to http://cl.ly/292t2B09022I3S3X3N2O
#
# Requirements:
# mpg123 - [ % brew install mpg123 ]
# imagemagick - [ % brew install imagemagick ]
# rmagick - [ % brew install rmagick ]
#
@davidcornu
davidcornu / jslint_textmate.rb
Created May 4, 2011 03:42
Textmate JSLint
#!/usr/bin/env ruby
require 'cgi'
lint = `/usr/local/bin/jslint4java #{ENV['TM_FILEPATH']}`
lrxp = Regexp.new(/jslint:.+.js:(\d+):(\d+):(.+)/i)
output = String.new
lint.split("\n").each do |error|
match = lrxp.match(error)
line = `cat #{ENV['TM_FILEPATH']} | head -#{match[1]} | tail -1`