Skip to content

Instantly share code, notes, and snippets.

Thu Dec 29 09:52:15 2011] [notice] Apache/2.2.3 (CentOS) configured -- resuming normal operations
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::lock_error> >'
what(): Invalid argument (22)
[ pid=6509, timestamp=1325170340 ] Process aborted! signo=SIGABRT(6), reason=SI_TKILL, signal sent by PID 6509 with UID 0, backtrace available.
--------------------------------------
[ pid=6509 ] Backtrace with 35 frames:
PassengerHelperAgent[0x813c35a]
[0x3c4440]
[0x3c4402]
/lib/libc.so.6(gsignal+0x50)[0x138df0]
def district_choices
if @state
districts = Portal::District.find(:all, :conditions => {:state => @state })
return districts.map { |d| {:id => d.id , :name => d.name }}
end
default = Portal::District.default
return {:id => default.id, :name => default.name }
end
@knowuh
knowuh / static_assets
Created December 13, 2011 17:08
List of static loaded assets on main CC website.
Assets loaded with absolute (ish) paths:
./sites/all/themes/cc/includes/footer.php:
<img src="http://www.concord.org/sites/all/themes/cc/img/loading-white.gif" alt="Loading..."/>
./sites/all/themes/cc/subscribe.html:
<img src="http://www.concord.org/sites/all/themes/cc/img/loading-white.gif" alt="Loading..."/>
./sites/all/themes/cc/page-activities.tpl.php:
@knowuh
knowuh / gist:1453210
Created December 9, 2011 20:39
protoTypeGraphables
xml.OTDataCollector("local_id" => id, "name" => "datacollector", "multipleGraphableEnabled" => multi,
"title" => "#{pt.name} Sensor#{if predict_id then ' and Prediction' end} Graph", "autoScaleEnabled" => "true") {
if predict_id
xml.graphables {
xml.OTDataGraphable("connectPoints" => "true", "locked" => "true",
"color" => "0xff0000", "drawMarks" => "false", "name" => "Prediction",
"xColumn" => "0", "yColumn" => "1") {
xml.dataStore { otml_object_reference(xml, "#{predict_id}_datastore") }
}
}
#flash
.padded_contents
- flash.each_pair do |key, message|
%div{:class=>"flash flash_#{key}"}= message
class HelpRequestAddNumStudents < ActiveRecord::Migration
def up
add_column :help_requests, :num_students, :integer
end
def down
remove_column :help_requests, :num_students
end
@knowuh
knowuh / help_request.sh
Created September 23, 2011 13:05
generating help_request Model, View, Controller, Tests, and route:
# there is a 'generator' to run which will create all of our boilerplate
# code for the 'help request'
./script/generate cc_rspec_haml_scaffold HelpRequest email:string login:string name:string class_name:string activity:string no_students:int computer_type:string os:string browser:string ip_address:string problem_type:string all_computers:bool pre_loaded:bool more_info:text logfile:text referrer:text
# clearer to view fields if its broken up:
./script/generate cc_rspec_haml_scaffold HelpRequest\
email:string \
login:string \
@knowuh
knowuh / report_usage.rb
Created September 13, 2011 21:44
Report on embeddable usage
EmbeddableKlasses = [
Embeddable::ImageQuestion,
Embeddable::SoundGrapher
]
class Investigation < ActiveRecord::Base
EmbeddableKlasses.each do |klass|
eval "has_many :#{klass.name[/::(\w+)$/, 1].underscore.pluralize}, :class_name => '#{klass.name}',
:finder_sql => 'SELECT #{klass.table_name}.* FROM #{klass.table_name}
INNER JOIN page_elements ON #{klass.table_name}.id = page_elements.embeddable_id AND page_elements.embeddable_type = \"#{klass.to_s}\"
INNER JOIN pages ON page_elements.page_id = pages.id
@knowuh
knowuh / convert_sass_to_scss
Created September 2, 2011 20:03
convert sass to scss by example
#convert .sass files to scss files:
bundle exec sass-convert -R --from sass --to scss ./public/stylesheets/sass/
# delete the old sass files:
find ./public/stylesheets/sass -name "*.sass" | xargs rm
# rename the directory.
mv ./public/stylesheets/sass ./public/stylesheets/scss
Bundler.require(:default)
JRUBY = defined? RUBY_ENGINE && RUBY_ENGINE == 'jruby'
RAILS_ROOT = File.dirname(File.dirname(File.expand_path(__FILE__)))
APP_DIR_NAME = File.basename(RAILS_ROOT)
$LOAD_PATH.unshift(File.join(RAILS_ROOT,"lib"))