Skip to content

Instantly share code, notes, and snippets.


Tyler Rick TylerRick

  • USA
View GitHub Profile
TylerRick / gist:9811465
Last active Aug 29, 2015
Canvas installation errors
View gist:9811465
Following I ran into some problems. Here's what I did to work around them.
I am installing on my development computer, running Ubuntu 13.10.
dpkg --get-selections | egrep -i "postgresql"
postgresql install
postgresql-9.1 install
postgresql-9.1-postgis deinstall
postgresql-client-9.1 install
postgresql-client-common install
TylerRick / gist:9815597
Created Mar 27, 2014
time bundle exec rake canvas:compile_assets for
View gist:9815597
canvas (stable) > time bundle exec rake canvas:compile_assets
--> Compiling static assets [css]
warning Webkit only supports pixels for the start and end stops for radial gradients. Got: 100%
warning Webkit only supports pixels for the start and end stops for radial gradients. Got: 100%
warning Webkit only supports pixels for the start and end stops for radial gradients. Got: 100%
--> creating styleguide
# writing file: app/views/info/styleguide.html.erb
--> Compiling static assets [jammit]
--> Compiled static assets [css/jammit]
--> Compiling static assets [javascript]
TylerRick / table_bounds_width_bug.rb
Created May 12, 2014
Indent doesn't get reset after rendering a centered table
View table_bounds_width_bug.rb
require "prawn"
Prawn::Document.generate("#{__FILE__}.pdf") do |pdf|
pdf.start_new_page margin: [100, 100, 100, 100]
orig_bounds_width = pdf.bounds.width
pdf.formatted_text_box [ { :text => "width: #{pdf.bounds.width}" } ], :at => [0, 20]
pdf.indent(100) do
TylerRick / gist:d5e2a57c95b354ddec5d
Last active Aug 29, 2015
zeus crash: Wrong message type! Expected ActionResponseMessage, (v0.15.3)
View gist:d5e2a57c95b354ddec5d
> zeus start
Starting Zeus server v0.15.3
[ready] [crashed] [running] [connecting] [waiting]
├── default_bundle
│  └── development_environment
│  └── prerake
├── default_bundle_with_test_env
│  └── test_environment
│  ├── cucumber_environment
TylerRick / git-merge-better
Created Sep 14, 2010
An early version of git-merge-better, part of
View git-merge-better
#!/usr/bin/env ruby
# doesn't handle if multiple conflict markers!!
require 'pathname'
require 'facets/file/rewrite'
require 'quality_extensions/pathname'
TylerRick / javascript_code.rb
Created Oct 6, 2010
Proc#to_json, JavascriptCode#to_json
View javascript_code.rb
# This allows you to represents a JavaScript function with a proc. When converted to JSON, it will
# automatically wrap the method body with "function(){" and "}" and list as many arguments as you
# had listed in your proc, automatically giving them the names a, b, c, etc.
# This is convenient when you want to create a Ruby hash representating options to be passed to
# a JavaScript method, which you plan to call to_json on when you actually output the method call
# to the web page. If you tried to represent your JavaScript function with a string value in the
# hash, then when you called to_json on the hash, it would in turn call String#to_json, which
# returns an escaped copy of the string surrounded by quotes.
TylerRick / backtrace.txt
Created Oct 5, 2011
mysql2 crash with error "ruby: double free or corruption (!prev)" while running cucumber
View backtrace.txt
When I press "Continue »" # features/step_definitions/web_steps.rb:52
Then I should see "Membership information successfully saved" # features/step_definitions/web_steps.rb:106
*** glibc detected *** ruby: double free or corruption (!prev): 0x0000000008899790 ***
======= Backtrace: =========
TylerRick / en.yml
Created Dec 15, 2011
Custom Validator that automatically provides the %{allowed_options} interpolation variable for use in your error messages
View en.yml
restrict_to: "is not one of the allowed options (%{allowed_options})"
View spree_export_import.rake
namespace :spree do
desc "Export Products to CSV File"
task :export_products => :environment do
require 'csv'
products = Product.where(:deleted_at => nil).all
puts "Exporting to #{RAILS_ROOT}/products.csv""#{RAILS_ROOT}/products.csv", "w") do |csv|
csv << [
TylerRick / gist:2501826
Created Apr 26, 2012
composite_primary_keys test failures
View gist:2501826
1) Error:
ActiveRecord::RecordNotFound: Couldn't find ReferenceCode with ID=1,1 WHERE `reference_codes`.`reference_type_id` = 1 AND `reference_codes`.`reference_code` = 1
/home/tyler/dev/rails/composite_primary_keys/lib/composite_primary_keys/relation/finder_methods.rb:111:in `block in find_with_ids'
/home/tyler/dev/rails/composite_primary_keys/lib/composite_primary_keys/relation/finder_methods.rb:91:in `map'
/home/tyler/dev/rails/composite_primary_keys/lib/composite_primary_keys/relation/finder_methods.rb:91:in `find_with_ids'
/home/tyler/.rvm/gems/ruby-1.9.3-p125/gems/activerecord-3.2.3/lib/active_record/relation/finder_methods.rb:107:in `find'
/home/tyler/.rvm/gems/ruby-1.9.3-p125/gems/activerecord-3.2.3/lib/active_record/querying.rb:5:in `find'
/home/tyler/dev/rails/composite_primary_keys/test/test_attribute_methods.rb:27:in `test_to_key_with_composite_keys'