Skip to content

Instantly share code, notes, and snippets.

[
{
"name": "Turtle Rock",
"category": "Rivers",
"city": "Twentynine Palms",
"state": "California",
"id": 1001,
"isFeatured": true,
"isFavorite": true,
"park": "Joshua Tree National Park",
@joshuaballoch
joshuaballoch / gist:4493648
Created January 9, 2013 14:45
ideas on how to attach page-specific javascript
javascript:
window.app = window.app || {};
app.view = new Ledapei.SomeNameOfAView();
it "should not allow a material to be ranked without criteria" do
material = create :material
material.material_type_sym = :ranked
material.valid?.should_not be_true
end
/*!
* Bootstrap v2.2.2
*
* Copyright 2012 Twitter, Inc
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Designed and built with all the love in the world @twitter by @mdo and @fat.
*/
class GigaMaterialOptionEditForm
constructor: (element) ->
@element = $ element
@element.on 'click.giga_material_option_edit_form', '.icon-refresh', $.proxy(this, 'revert_to_inherited_data')
revert_to_inherited_data: (e)->
field = e.currentTarget
alert e.currentTarget
field.closest('.controls').find('input[type=text]').val('')
headers = {
:to => @manufacturer_user.email,
:reply_to => '[email protected]',
:subject => _("Manufacturer Application Received"),
}
mail headers do |format|
format.html { render "notify_user_manufacturer_submitted_#{locale}" }
end
/Users/joshuaballoch/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
@joshuaballoch
joshuaballoch / gist:3971899
Created October 29, 2012 06:18
migrate data with globalize3
#Suppose I have added the new translation columns and set in the CriterionMaterial to translate audit_result and auditor_name
#EG: in the migration:
add_column :criterion_material_translations, :audit_result, :text
add_column :criterion_material_translations, :auditor_name, :string
#now to migrate old columns to new columns...
CriterionMaterial.all.each do |k|
Globalize.with_locale :"en-US" do
k.audit_result = #what to put here?
end
end
@joshuaballoch
joshuaballoch / gist:3937901
Created October 23, 2012 09:36
rack test error running paperclip rspec and accepts_nested_attributes_for
#Association Mismatch occurs when trying to create a project using Factory Girl:
Failures:
1) Project#address_city should works
Failure/Error: create(:project).address_city.should be_nil
ActiveRecord::AssociationTypeMismatch:
ProjectImage(#70115373883740) expected, got Rack::Test::UploadedFile(#70115311431900)
# ./spec/models/project_spec.rb:194:in `block (3 levels) in <top (required)>'
@joshuaballoch
joshuaballoch / gist:3759388
Created September 21, 2012 02:05
rake error on populate_chemical_attributes
Joshuas-MacBook-Pro:gigabase joshuaballoch$ rake populate_chemical_attributes --trace
** Invoke populate_chemical_attributes (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute populate_chemical_attributes
rake aborted!
Mysql2::Error: Table 'giga_development.function_translations' doesn't exist: SHOW FULL FIELDS FROM `function_translations`
/Users/joshuaballoch/.rvm/gems/ruby-1.9.3-p194@gigabase/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in `query'
/Users/joshuaballoch/.rvm/gems/ruby-1.9.3-p194@gigabase/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in `block in execute'
/Users/joshuaballoch/.rvm/gems/ruby-1.9.3-p194@gigabase/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log'