Skip to content

Instantly share code, notes, and snippets.

View technicalpickles's full-sized avatar

Josh Nichols technicalpickles

View GitHub Profile

Keybase proof

I hereby claim:

  • I am technicalpickles on github.
  • I am technicalpickles (https://keybase.io/technicalpickles) on keybase.
  • I have a public key whose fingerprint is 2075 7709 272C AD6B A3E0 1CA6 9B77 22C4 6AA1 A462

To claim this, I am signing this object:

@technicalpickles
technicalpickles / gist:7013017
Created October 16, 2013 19:04
Favorite hubot commands
Year Make Model Description Price
1997 Ford E350 ac, abs, moon 3000.00
1999 Chevy Venture "Extended Edition" 4900.00
1999 Chevy Venture "Extended Edition, Very Large" 5000.00
1996 Jeep Grand Cherokee MUST SELL! air, moon roof, loaded 4799.00
@technicalpickles
technicalpickles / gist:4162161
Created November 28, 2012 15:57
unison-2.7.57 patch for ocaml 3.12.0 and later (see http://tech.groups.yahoo.com/group/unison-users/message/9348)
Common subdirectories: unison-2.27.57/lwt and unison-2.27.57-patched/lwt
Common subdirectories: unison-2.27.57/ubase and unison-2.27.57-patched/ubase
Common subdirectories: unison-2.27.57/uimac and unison-2.27.57-patched/uimac
Common subdirectories: unison-2.27.57/uimacnew and unison-2.27.57-patched/uimacnew
diff -u unison-2.27.57/update.mli unison-2.27.57-patched/update.mli
--- unison-2.27.57/update.mli 2007-04-01 23:03:20.000000000 -0400
+++ unison-2.27.57-patched/update.mli 2012-11-28 10:55:42.000000000 -0500
@@ -1,7 +1,7 @@
(* Unison file synchronizer: src/update.mli *)
(* Copyright 1999-2007 (see COPYING for details) *)
@technicalpickles
technicalpickles / gist:3980449
Created October 30, 2012 14:24
Inspecting defined Rails routes, by controller
1.9.3p194 :032 > user_routes = Authmachine::Application.routes.set.select {|r| r.defaults[:controller] == 'users' }
=> [#<Journey::Route:0x007fecfd1853c0 @name="user", @app=#<ActionDispatch::Routing::RouteSet::Dispatcher:0x007fecfd186bd0 @defaults={:action=>"create", :controller=>"users"}, @glob_param=nil, @controllers={}>, @path=#<Journey::Path::Pattern:0x007fecfd1866d0 @anchored=true, @spec=/user(.:format), @requirements={}, @separators="/.?", @names=["format"], @optional_names=nil, @required_names=nil, @re=nil, @offsets=nil>, @verb=/^POST$/, @ip=//, @constraints={:request_method=>/^POST$/}, @defaults={:action=>"create", :controller=>"users"}, @required_defaults=nil, @required_parts=nil, @parts=[:format], @decorated_ast=nil, @precedence=2>, #<Journey::Route:0x007fecfd046bf8 @name="new_user", @app=#<ActionDispatch::Routing::RouteSet::Dispatcher:0x007fecfd03ef20 @defaults={:action=>"new", :controller=>"users"}, @glob_param=nil, @controllers={}>, @path=#<Journey::Path::Pattern:0x007fecfd03ebd8 @anchored=true,
@technicalpickles
technicalpickles / gist:3977685
Created October 30, 2012 01:01
Inspecting a controller's action methods
1.9.3p194 :016 > UsersController.action_methods
=> #<Set: {"_callback_before_128", "_callback_before_130", "show", "me", "new", "create", "edit", "update", "destroy"}>
1.9.3p194 :017 > UsersController.action_methods.reject {|m| m =~ /^_callback_/ }
=> ["show", "me", "new", "create", "edit", "update", "destroy"]
@technicalpickles
technicalpickles / gist:3623243
Created September 4, 2012 16:38
Trying to store regular expression results (if a thing is a match) in ActiveRecord can be tricky
# Consider this initial model
class IpAddress < ActiveRecord::Base
attr_accessible :description
end
# At some point, we want to add a boolean field, :primary, and populate that based on if the description matches /primary/i
# Here's the obvious thing to do:
IpAddress.find_each do |ip_address|
primary = ip_address =~ /primary/i
ip_address.update_attributes :primary => primary
@technicalpickles
technicalpickles / nyoooo.coffee
Created May 22, 2012 19:00
hubot script for pasting darth vader exclaiming noooooooooooo
# Nyoooooooooooooooooooooooooooooooooooooo
#
# nyoooo - Display darth vader's exclamation
# nooooo - Display darth vader's exclamation
module.exports = (robot) ->
robot.hear /ny?oo+\b/i, (msg) ->
msg.send "http://imgur.com/8MslB.jpg"
@technicalpickles
technicalpickles / puppet-type-reference.coffee
Created May 11, 2012 14:06
Hubot puppet type reference
# Quick access to Puppet Type Reference. No longer be thrawted by googling!
#
# puppet me <type> - get <type> reference URL
module.exports = (robot) ->
robot.respond /puppet (?:me ?)(.*)/i, (msg) ->
msg.send "http://docs.puppetlabs.com/references/latest/type.html##{msg.match[1]}"
@technicalpickles
technicalpickles / gist:2029140
Created March 13, 2012 14:32
Rails template
gem 'haml', '>= 3.0.0'
gem 'haml-rails'
gem 'jquery-rails'
gem 'rspec-rails', '>= 2.0.1', :group => [:development, :test]
gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'
initializer 'generators.rb', <<-RUBY
Rails.application.config do |config|