Skip to content

Instantly share code, notes, and snippets.

View rklancer's full-sized avatar

Richard Klancer rklancer

View GitHub Profile
@rklancer
rklancer / gist:2123097
Created March 19, 2012 18:31
Console.log safety
// prevent a console.log from blowing things up if we are on a browser that
// does not support it
if (typeof console === 'undefined') {
window.console = {} ;
console.log = console.info = console.warn = console.error = function(){};
}
nodes[0][0] = 1.6720000505447388;
nodes[0][1] = 1.6720000505447388;
nodes[0][2] = 1.6720000505447388;
nodes[0][3] = 1.6720000505447388;
nodes[0][4] = 1.6720000505447388;
nodes[0][5] = 1.6720000505447388;
nodes[0][6] = 1.6720000505447388;
nodes[0][7] = 1.6720000505447388;
nodes[0][8] = 1.6720000505447388;
nodes[0][9] = 1.6720000505447388;
###
Stubs. Assume 'box', 'piston' and 'wrap' would be defined for you in the environment:
###
# Helper function so that a callback-accepting computed property can be defined simply
wrap = (f, cb) ->
(cb2) ->
if cb2
f (args...) -> cb2 cb args...
from drupal-dev:
/
/sites/all/themes/cc/flash/config.xml
/sites/all/themes/cc/flash/header.swf
/sites/all/themes/cc/flash/img/home-alternate.jpg
/sites/all/themes/cc/flash/img/img1.jpg
/sites/all/themes/cc/flash/img/img2.jpg
/sites/all/themes/cc/flash/img/img3.jpg
/sites/all/themes/cc/flash/img/img4.jpg
@rklancer
rklancer / gist:1373790
Created November 17, 2011 17:13
applet tag
<applet id="sc1712-applet" archive="org/concord/sensor-native/sensor-native.jar, org/concord/otrunk/otrunk.jar, org/concord/framework/framework.jar, org/concord/frameworkview/frameworkview.jar, jug/jug/jug.jar, jdom/jdom/jdom.jar, org/concord/sensor/sensor.jar, org/concord/data/data.jar, org/concord/sensor/sensor-applets/sensor-applets.jar" code="org.concord.sensor.applet.OTSensorApplet" codebase="/jnlp" width="100%" height="40" mayscript="true"><param name="resource" value="/distance.otml"><param name="listenerPath" value="Smartgraphs.sensorController"><param name="name" value="sc1712-applet"></applet>
do =>
toMatchUsing = (matcher) ->
(pairs) ->
return false if @actual?.length isnt pairs.length or typeof @actual isnt 'object'
return false for a, i in @actual when not matcher( a, pairs[i] )
true
@addMatchers(
toEqualPairs: toMatchUsing (a, [x, y]) -> a[0] is x and a[1] is y
toEqualPointsDefinedBy: toMatchUsing (a, [x, y]) -> a.get('x') is x and a.get('y') is y
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>currentDocument</key>
<string>app/views/portal/districts/new.html.haml</string>
<key>documents</key>
<array>
<dict>
<key>expanded</key>
@rklancer
rklancer / gist:1212303
Created September 12, 2011 20:25
default_project error in rails portal
bin/rake db:drop:all
git clean -fdx .
echo "rvm use `rvm current`" > .rvmrc
bundle install --binstubs
ruby config/setup.rb -n "Cross Project Portal" -D xproject -u <username> -p <password> -t xproject --states none -y -q -f
RAILS_ENV=production bin/rake db:create:all
RAILS_ENV=production bin/rake db:migrate:reset
RAILS_ENV=production bin/rake app:setup:new_app
bin/rake db:dump
rails s
@rklancer
rklancer / gist:1203403
Created September 8, 2011 13:37
Stylesheets *seem* to be being compiled...
rails3-portal (rails3.0)$ rm public/stylesheets/*.css
rails3-portal (rails3.0)$ rails s -eproduction
=> Booting WEBrick
=> Rails 3.0.10 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
running Admin::Project.create_or_update_default_project_from_settings_yml
Problem processing key 'host' in config/mailer.yml
undefined method `host=' for ActionMailer::Base:Class
Started observers
rails3-portal (rails3.0)$ RAILS_ENV=production bin/rake db:migrate:reset
Didn't start observers because you are running: rake db:migrate
rake aborted!
uninitialized constant APP_CONFIG
Tasks: TOP => db:migrate:reset => db:migrate => environment
(See full trace by running task with --trace)