Skip to content

Instantly share code, notes, and snippets.

<script language="JavaScript">
function Calculate(form){
roof_area=parseFloat(form.roof_area.value);
total_rainfall=parseFloat(form.total_rainfall.value);
percentage=parseFloat(form.percentage.value);
total_gallons=roof_area*total_rainfall*(percentage/100)*0.623;
form.output.value=total_gallons;
form.output.value+=" gallons collected annually";
}
# i create a symlink from file_name to its text.plain equivalent to keep the view
# shared between a text email and the web UI view DRY
#
# it seems there should be an easier way?
file_name = "#{RAILS_ROOT}/app/views/notifier/#{notifier_method_name}.html.erb"
string = render_to_string :file => file_name
render :text => "<pre>#{string}</pre>"
create temp table temp_course_text_fields_and_summary_for_sfi_9_1_09 AS select c.code, c.type, c.id, c.in_catalog, c.summary, ctf.description, ctf.instructions from courses c join course_text_fields ctf on c.id = ctf.course_id where c.account_id = 67;
\copy temp_course_text_fields_and_summary_for_sfi_9_1_09 to 'sfi_course_text_fields_and_summary.csv' WITH CSV HEADER
remove ^M from file in vim via search-and-replace :%s/^M//g
Processing CoursesController#blah (for 127.0.0.1 at 2009-10-06 21:22:06) [GET]
Parameters: {"action"=>"blah", "controller"=>"courses"}
Account Load (2.8ms) SELECT * FROM "accounts" WHERE ("accounts"."subdomain" = E'admin') LIMIT 1
User Load (3.9ms) SELECT * FROM "users" WHERE ("users"."id" = 1)
SQL (0.3ms) BEGIN
SQL (40.1ms) INSERT INTO "courses" ("name", "credit_units", "custom_d", "approval_items_count", "mastery_score", "custom_e", "launch_window_height", "aicc_course_id", "aliased
_id", "code", "author", "custom_f", "in_catalog", "waitlist_max", "custom_g", "is_featured", "resource_id", "account_id", "custom_h", "private_price", "blog_id", "custom_i", "cert
ificate_id", "forum_id", "launch_window_width", "type", "custom_j", "picture_id", "requires_authorization", "has_waitlist", "active_enrollment_count", "is_active", "attendance_max
", "retrospect_range", "custom_a", "is_public", "public_price", "summary", "waitlist_items_count", "course_package_id", "aicc_course_system", "custom_b", "c
SELECT name, lower(groups.name) FROM "groups" WHERE ("groups".account_id = 66) ORDER BY lower(name);
name | lower
--------------------------------------------------------------------------+--------------------------------------------------------------------------
C-AAL | c-aal
C-AATC | c-aatc
CABIN-CABIN SERVICES-ACCOUNT MANAGER | cabin-cabin services-account manager
CABIN-CABIN SERVICES-AIRCRAFT CABIN AGENT | cabin-cabin services-aircraft cabin agent
CABIN-CABIN SERVICES-AIRCRAFT CABIN CARPET AGENT | cabin-cabin services-aircraft cabin carpet agent
CABIN-CABIN SERVICES-CABIN SERVICE AGENT | cabin-cabin services-cab
➜ ~ sudo port installed
Password:
dlopen(/opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib, 10): no suitable image found. Did find:
/opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib: mach-o, but wrong architecture
while executing
"load /opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib"
("package ifneeded Pextlib 1.0" script)
invoked from within
"package require Pextlib 1.0"
(file "/opt/local/bin/port" line 40)
def QueueEntry.run_next_job
queue_entry = QueueEntry.get_next_job_from_queue(QueueEntry.server_id)
unless queue_entry.nil?
if @child = fork
logger.info "AAAAAAAAAAAAAAAAAAAAAAAAAAAAA - Parent forked #{@child}: #{Time.now}"
Process.wait
logger.info "AAAAAAAAAAAAAAAAAAAAAAAAAAAAA - Done waiting for #{@child}: #{Time.now} - #{$?}"
else
(rdb:1) p association
INTERNAL ERROR!!! ActiveRecord::ConnectionNotEstablished
/var/www/rails/rollbook/releases/20091118154734/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:in `retrieve_connection'
/var/www/rails/rollbook/releases/20091118154734/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:123:in `retrieve_conne
ction'
/var/www/rails/rollbook/releases/20091118154734/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:115:in `connection'
/var/www/rails/rollbook/releases/20091118154734/vendor/rails/activerecord/lib/active_record/base.rb:3103:in `quoted_table_name'
/var/www/rails/rollbook/releases/20091118154734/vendor/rails/activerecord/lib/active_record/base.rb:1583:in `find_one'
/var/www/rails/rollbook/releases/20091118154734/vendor/rails/activerecord/lib/active_record/base.rb:1574:in `find_from_ids'
/
@wallace
wallace / bundle-to-ebs.sh
Created January 8, 2010 21:59 — forked from fairchild/bundle-to-ebs.sh
application
#!/bin/bash -xe
EBS_DEVICE='/dev/sdh'
INSTANCE_ID=$1
AKI=${2:-'aki-d314f0ba'}
ARI=${3:-'ari-d014f0b9'}
ARCH=${4:-'x86_64'}
SIZE=${5:-20}
AZ=${6:-'us-east-1a'}
NAME=${7:-"rollbook app"}
auto_enrollment_id | count
--------------------+-------
9 | 73
13 | 3
14 | 8
19 | 2431
32 | 5
60 | 1
61 | 1
62 | 93