Skip to content

Instantly share code, notes, and snippets.

cwoodcox in ~/Projects with 1.9.3 on master λ gsay "party rock is in the house tonight everybody just have a good time and we gonna make you lose your mind"
/Users/cwoodcox/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/spec_set.rb:90:in `block in materialize': Could not find multi_json-1.3.6 in any of the sources (Bundler::GemNotFound)
from /Users/cwoodcox/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/spec_set.rb:83:in `map!'
from /Users/cwoodcox/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/spec_set.rb:83:in `materialize'
from /Users/cwoodcox/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/definition.rb:127:in `specs'
from /Users/cwoodcox/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/environment.rb:27:in `specs'
from /Users/cwoodcox/.rvm/gems/ruby-1.9.3-p194@global/gems/rubygems-bundler-1.0.3/lib/rubygems-bundler/noexec.rb:41:in `candidate?'
from /Users/cwoodcox/.rvm/gems/ruby-1.9.3-p194@global/gems/rubygems-bundler
# This:
render partial: 'posts/post_preview', collection: @posts, as: :post
# Is not the same as this:
render 'posts/post_preview', collection: @posts, as: :post
# Even though this:
render 'posts/post_preview', collection: @posts
# Behaves exactly as it should.
stirng.c:98:3: error: no matching function for call to 'rb_define_module_function'
rb_define_module_function(stirng_module, "distance", stirng_distance, 2);
^~~~~~~~~~~~~~~~~~~~~~~~~
/Users/cwoodcox/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h:1101:6: note: candidate function not viable: no known conversion from 'VALUE (VALUE, VALUE)' to 'VALUE (*)(...)' for 3rd argument;
void rb_define_module_function(VALUE,const char*,VALUE(*)(ANYARGS),int);
^
Interval Since Last Panic Report: 2077764 sec
Panics Since Last Report: 1
Anonymous UUID: 6DCCF5D8-CE06-4466-9DE9-A9923CD67A2B
Thu Jul 12 09:35:25 2012
panic(cpu 0 caller 0xffffff80002c473a): Kernel trap at 0xffffff80002ab8be, type 13=general protection, registers:
CR0: 0x000000008001003b, CR2: 0x0000000003737e7c, CR3: 0x0000000023da5021, CR4: 0x00000000000606e0
RAX: 0x968b848208010000, RBX: 0xffffff800ee2a0f0, RCX: 0xffffff800a0e7e40, RDX: 0xffffff800c935a28
RSP: 0xffffff807eff39d0, RBP: 0xffffff807eff3a60, RSI: 0x0000000105c79000, RDI: 0xffffff800c935a28
R8: 0xffffff80008bde08, R9: 0xffffff80008bde10, R10: 0xfffffe8142276498, R11: 0x00080000001119ab
@cwoodcox
cwoodcox / gist:2932916
Created June 14, 2012 20:58
solution for gist: 2932517
class RoutesTest < ActionDispatch::IntegrationTest
def setup
@routes = Shim::Engine.routes
end
def test_index_route
assert_routing "", { :controller => "shim/pages", :action => "show", :id => "index" }
end
def test_page_route
@cwoodcox
cwoodcox / config-routes.rb
Created June 14, 2012 19:51
Issue while testing a Rails Engine
Shim::Engine.routes.draw do
match "*id" => 'pages#show', :as => :page, :format => false
root :to => 'pages#show', :id => "index"
end
$ ->
$("#nav-main li").click ->
toExpand = $ $(this).data("expand")
$(".nav-sub").hide()
toExpand.show()
if $(this).hasClass("open")
$("#nav-sub-group").height(0) unless $(this).siblings().hasClass("open")
$("#nav-main li").removeClass("open")
@cwoodcox
cwoodcox / gist:2494074
Created April 25, 2012 22:44
TIL this works in Ruby
module Stuff
def some_method
# stuff...
end
rescue Exception => ex
# Deal with ex here...
end
require 'json'
require 'csv'
require 'pry'
data = JSON.parse(DATA.read)
CSV.open 'data.csv', 'wb' do |csv|
mapping = {
"name" => "custom_field_1",
"email" => "custom_field_4",
"phone" => "custom_field_3",
if params[:q]
attrs = {
id: 0,
business_partner_id: 1,
street_number: params[:q]['near_filter(1)'],
city: params[:q]['near_filter(2)'],
state: params[:q]['near_filter(3)'],
zip_code: params[:q]['near_filter(4)'],
icon_name: "home"
}