Skip to content

Instantly share code, notes, and snippets.

View mcfiredrill's full-sized avatar
💭
working on datafruits

Tony Miller mcfiredrill

💭
working on datafruits
View GitHub Profile
@mcfiredrill
mcfiredrill / my_model.rb
Created May 15, 2012 22:22
class_eval in active record callback
after_save do |my_model|
self.class_eval do
# my_model.job_owner_type => "AnotherModel"
alias_method my_model.job_owner_type.underscore.to_sym, :job_owner
end
end
[tony@server ~]$ rvmsudo rvm get latest --auto
Original installed RVM version:
rvm 1.9.2 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]
/tmp/26590: line 28: [: !=: unary operator expected
You already have the latest version!
RVM reloaded!
@mcfiredrill
mcfiredrill / cubey.rb
Created September 17, 2012 08:00
cube world
require 'ruby-processing'
class Cubey< Processing::App
#load_libraries 'boids', 'opengl'
load_libraries 'opengl'
import "processing.opengl" if library_loaded? "opengl"
#def setup_opengl
# render_mode(OPENGL)
#end
@mcfiredrill
mcfiredrill / blog.rb
Created October 12, 2012 19:15
my crappy blog engine - being replaced by tumblr i guess ¯\_(ツ)_/¯
# encoding: utf-8
require 'yaml'
require 'find'
require 'mini_magick'
# slurp up .erb files in blog/
# parse the yaml frontmatter
# generate views in views/blog/
# populate the articles array
# article
#!/bin/bash
FFMPEG=`which ffmpeg`
if [ "$FFMPEG" = "" ] ; then
echo "Please install ffmpeg.";
exit 0;
fi
if [ $# != 3 ] ; then
echo "Usage: $0 <image_file> <mp3_file> <output_file.avi>";
exit 0;
@mcfiredrill
mcfiredrill / jruby problems
Created November 8, 2012 02:53
jruby problemz :|
█▓▒░tony@kiwi░▒▓█ ~/src/ruby-processing(master)$ rvm use jruby-1.6.3
Using /home/tony/.rvm/gems/jruby-1.6.3
█▓▒░tony@kiwi░▒▓█ ~/src/ruby-processing(master)$ gem install chronic
Fetching: chronic-0.8.0.gem (100%)
Successfully installed chronic-0.8.0
1 gem installed
█▓▒░tony@kiwi░▒▓█ ~/src/ruby-processing(master)$ irb
=> Unable to load pry
jruby-1.6.3 :001 > require 'chronic'
LoadError: no such file to load -- chronic
@mcfiredrill
mcfiredrill / gem home and gem env
Created November 8, 2012 03:44
gem home and gem env
█▓▒░tony@kiwi░▒▓█ ~/src/ruby-processing(master)$ ls /home/tony/.rvm/gems/jruby-1.6.3/gems/
aasm-2.2.0 ansi-1.3.0 i18n-0.5.0 paperclip-2.3.16 railties-3.0.10
abstract-1.0.0 arel-2.0.10 jquery-rails-1.0.13 polyglot-0.3.2 rake-0.8.7
actionmailer-3.0.10 builder-2.1.2 jruby-launcher-1.0.8-java progressbar-0.9.1 rake-0.9.2
actionpack-3.0.10 bundler-1.0.21 jruby-launcher-1.0.9-java rack-1.2.3 rdoc-3.9.2
activemodel-3.0.10 cocaine-0.2.0 mail-2.2.19 rack-mount-0.6.14 ruby-prof-0.10.8
activerecord-3.0.10 erubis-2.6.6 mime-types-1.16 rack-test-0.5.7 thor-0.14.6
activeresource-3.0.10 exception_notification-2.4.1 mysql2-0.2.13 rails-3.0.10 treetop-1.4.10
activesupport-3.0.10 factory_girl-2.0.4
@mcfiredrill
mcfiredrill / mytweetstream.rb
Created November 16, 2012 00:23
ruby twitter stream client
require 'rubygems'
require 'oauth'
require 'json'
CONSUMER_KEY = 'xxxxxxxx'
CONSUMER_SECRET = 'xxxxxxxx'
OAUTH_TOKEN = 'xxxxxxxx'
OAUTH_SECRET = 'xxxxxxxx'
@mcfiredrill
mcfiredrill / best.txt
Created December 1, 2012 00:24
best home movies quotes
http://en.wikipedia.org/wiki/List_of_Home_Movies_episodes
"can star wars do THIS?" - Brendon, S2E5 "The Party"
"i know a kid...a guy that makes movies" - McGuirk, S4E5, "Wizard's Baker"
"you guys!" - melissa in every episode
@mcfiredrill
mcfiredrill / error
Created December 17, 2012 01:18
sprockets encoding error
174.31.173.110 - - [16/Dec/2012 17:08:53] "GET /js/libs/modernizr-2.0.6.js HTTP/1.0" 200 - 0.0017
E, [2012-12-16T17:08:53.568260 #12145] ERROR -- : app error: /var/www/datafruits.fm/releases/20121217010420/assets/js/libs/modernizr-2
.0.6.js has a invalid US-ASCII byte sequence (Sprockets::EncodingError)
E, [2012-12-16T17:08:53.568409 #12145] ERROR -- : /var/www/datafruits.fm/shared/bundle/ruby/1.9.1/gems/sprockets-2.0.4/lib/sprockets/u
tils.rb:18:in `block in read_unicode'