Skip to content

Instantly share code, notes, and snippets.

View imajes's full-sized avatar

James Cox imajes

View GitHub Profile
% ruby validate_ipv6.rb
A syntax error has occurred:
missing 'end' for 'do' started on line 38
near line /Users/james/validate_ipv6.rb:230, column 4
Code:
end
^
Backtrace:
class User
include Mongoid::Document
references_one :best_friend, :class_name => "Person"
references_one :worst_enemy, :class_name => "Person"
end
require "stateful"
class Folder < ActiveRecord::Base
include Stateful
# ...
stateful do
state :active
state :inactive
# Tab Completion
require "irb/completion"
require "rubygems"
# from https://github.com/aniero/dotfiles/blob/master/irbrc
# Assume a bundler-managed environment, so find and require the irb-specific
# enhancement gems directly. This does not do dependency tracking, so
# dependent gems must be explicitly specified!
def irb_require(gemname, lib=nil)
# allow bundler or rubygems a fair shake at loading the library first
javascript:(function(){var%20otherlib=false;if(typeof%20jQuery=='undefined'&&typeof%20$=='function'){otherlib=true;}function%20getScript(url,success){var%20script=document.createElement('script');script.src=url;var%20head=document.getElementsByTagName('head')[0],done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){done=true;success();script.onload=script.onreadystatechange=null;head.removeChild(script);}};head.appendChild(script);}getScript('http://code.jquery.com/jquery-latest.min.js,function(){if(typeof%20jQuery!=undefined){if(otherlib){$jq=jQuery.noConflict();}if(!jQuery('body').hasClass('collapsible-comments')){jQuery('body').addClass('collapsible-comments');var%20span_html='%3Cspan%20style=\'cursor:pointer;margin-left:10px;\'%20class=\'expand-handle\'%3E[-]%3C/span%3E';if(window.location.href.indexOf('item?id=')!=-1){jQuery('center%20%3E%20table%20%3E%20tbody%20%3E%20tr:eq(2)%20%3E%20td%20%3E%20table:eq(1)%20sp
@imajes
imajes / workers.rake
Created May 3, 2011 20:00 — forked from karmi/workers.rake
Rake taks to launch multiple Resque workers in development/production with simple management included
# Rake task to launch multiple Resque workers in development/production with simple management included
require 'resque/tasks' # Require Resque tasks
namespace :workers do
# = $ rake workers:start
#
# Launch multiple Resque workers with the Rails environment loaded,
# so they have access to your models, etc.
@imajes
imajes / watchr.rb
Created May 4, 2011 14:21
Watchr script for rspec in rails 3
ENV["WATCHR"] = "1"
system 'clear'
def growl(message, file='')
growlnotify = `which growlnotify`.chomp
status = message.include?('0 failures, 0 errors') ? 'pass' : 'fail'
title = "Watchr Test Results for #{file.split("/").last}"
image = "~/.autotest_images/#{status}.png"
options = "-w -n Watchr --image '#{File.expand_path(image)}' -m '#{message}' '#{title}'"
system %(#{growlnotify} #{options} &)
<snip long config stuff here>
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing default-1 commands
config.status: executing po-properties commands
config.status: executing gdk/gdkconfig.h commands
[root@app gtk+-3.0.9]# make V=1
make all-recursive
make[1]: Entering directory `/root/gtk+-3.0.9'
Making all in po
make[2]: Entering directory `/root/gtk+-3.0.9/po'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/root/gtk+-3.0.9/po'
Making all in po-properties
make[2]: Entering directory `/root/gtk+-3.0.9/po-properties'
make[2]: Nothing to be done for `all'.
% rvm info
ree-1.8.7-2011.03:
system:
uname: "Linux app02.45257.blueboxgrid.com 2.6.18-238.5.1.el5.028stab085.3 #1 SMP Mon Mar 21 20:05:12 MSK 2011 x86_64 GNU/Linux"
bash: "/bin/bash => GNU bash, version 4.1.5(1)-release (x86_64-pc-linux-gnu)"
zsh: "/usr/bin/zsh => zsh 4.3.10 (x86_64-unknown-linux-gnu)"
rvm: