Skip to content

Instantly share code, notes, and snippets.

View eric-wood's full-sized avatar
🥑
probably snacking

Eric Wood eric-wood

🥑
probably snacking
View GitHub Profile
@eric-wood
eric-wood / now_playing.rb
Created March 28, 2012 18:45
iTunes track information in your terminal!
# Show iTunes information in real-time in the terminal
def status
cmd = "osascript -e 'tell application \"iTunes\" to player state'"
`#{cmd}`
end
def track_name
cmd = "osascript -e 'tell application \"iTunes\" to name of current track'"
`#{cmd}`
@eric-wood
eric-wood / refresh_latex.rb
Created September 6, 2012 16:46
Automatic LaTeX re-rendererer
#!/usr/bin/env ruby
# refresh_latex
# Automagically re-render LaTeX files and open the result in a PDF reader.
# Using Skim we can do all of this without losing focus to the editor,
# although I provide code to somewhat accomplish this with Preview.app
#
# As of right now it only works in OS X since it uses the "open" command.
# Feel free to port it to any platform you want to
#
chmod +x git-hooks/pending_migrations_check.rb
cd .git/hooks
ln -is ../../git-hooks/pending_migrations_check.rb post-merge
ln -is ../../git-hooks/pending_migrations_check.rb post-checkout
@revolunet
revolunet / web-audio-fetch-stream.js
Last active June 30, 2024 09:21
Web Audio streaming with fetch API
//
// loads remote file using fetch() streams and "pipe" it to webaudio API
// remote file must have CORS enabled if on another domain
//
// mostly from http://stackoverflow.com/questions/20475982/choppy-inaudible-playback-with-chunked-audio-through-web-audio-api
//
function play(url) {
var context = new (window.AudioContext || window.webkitAudioContext)();