Skip to content

Instantly share code, notes, and snippets.

View imajes's full-sized avatar

James Cox imajes

View GitHub Profile
1. Have you ever, in or outside the United States:
a. Knowingly committed any crime of moral turpitude or a drug-related offense for which you have not been arrested?
b. Been arrested, cited, charged, indicted, fined, or imprisoned for breaking or violating any law or ordinance, excluding traffic violations?
c. Been the beneficiary of a pardon, amnesty, rehabilitation decree, other act of clemency, or similar action? d. Exercised diplomatic immunity to avoid prosecution for a criminal offense in the United States?
2. Have you received public assistance in the United States from any source, including the U.S.Government or any State, county, city, or municipality (other than emergency medical treatment), or are you likely to receive public assistance in the future?
3. Have you ever:
Hey,
here's some shell action:
% rvm list
rvm rubies
jruby-1.4.0 [ x86_64-java ]
rbx-1.0.0-rc4 [ x86_64 ]
@imajes
imajes / .irbrc
Created September 13, 2010 21:22
# taken from @jsmestad's gist - http://gist.github.com/406963
require 'pp'
# Make gems available
require 'rubygems'
# Dr Nic's gem inspired by
# http://redhanded.hobix.com/inspect/stickItInYourIrbrcMethodfinder.html
require 'what_methods'
require 'ap'
@imajes
imajes / .irbrc
Created September 13, 2010 21:24
##
## needed for bundler, for console
#group :console do
# gem 'wirble'
# gem 'sketches'
# gem 'hirb'
# gem 'looksee'
# gem 'net-http-spy'
# gem 'awesome_print'
# gem 'what_methods'
def interested_in_reply
@message = Message.find_by_id(params[:id])
sender_email = User.find_by_id(@message.sender_id).profile.email
desc = @message.automatic_description_for_all_types(@message.post_type,@message.post_id)
if @message.is_interested==false
@message.is_interested=1
@message.save
Mailer.deliver_interested_reply_to_mail(sender_email, @message, desc)
render :nothing => true, :text => "You have replied that you have interest in his #{@message.post_type}.",:layout =>"main"
#
# growl_notifier.rb
# CobraMenu
#
# Created by Leigh Caplan on 7/6/10.
# Copyright (c) 2010 Onehub, Inc. All rights reserved.
#
module GrowlNotifier
GROWL_PATH = '/usr/local/bin/growlnotify'
diff --git a/lib/mongoid/railtie.rb b/lib/mongoid/railtie.rb
index c10d32b..a2fa9f4 100644
--- a/lib/mongoid/railtie.rb
+++ b/lib/mongoid/railtie.rb
@@ -10,7 +10,7 @@ module Rails #:nodoc:
module Mongoid #:nodoc:
class Railtie < Rails::Railtie #:nodoc:
- config.generators.orm :mongoid, :migration => false
+ config.app_generators.orm :mongoid, :migration => false
% bin/cucumber features
Using the default profile...
no such file to load -- spec/runner/formatter/progress_bar_formatter (LoadError)
/Users/james/.rvm/gems/ree-1.8.7-2010.02/gems/rspec-instafail-0.1.2/lib/rspec/instafail.rb:4:in `require'
/Users/james/.rvm/gems/ree-1.8.7-2010.02/gems/rspec-instafail-0.1.2/lib/rspec/instafail.rb:4
/Users/james/.rvm/gems/ree-1.8.7-2010.02/gems/fuubar-0.0.1/lib/fuubar.rb:3:in `require'
/Users/james/.rvm/gems/ree-1.8.7-2010.02/gems/fuubar-0.0.1/lib/fuubar.rb:3
/Users/james/.rvm/gems/ree-1.8.7-2010.02/gems/bundler-1.0.4.pre/lib/bundler/runtime.rb:64:in `require'
/Users/james/.rvm/gems/ree-1.8.7-2010.02/gems/bundler-1.0.4.pre/lib/bundler/runtime.rb:64:in `require'
/Users/james/.rvm/gems/ree-1.8.7-2010.02/gems/bundler-1.0.4.pre/lib/bundler/runtime.rb:62:in `each'
/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(
# Regular Expression Validation for IPv6 addresses in Ruby
#
# Inspired by (if not to say copied from): http://forums.dartware.com/viewtopic.php?t=452
# Thanks, Dartware!
IPV6_REGEX = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f