Skip to content

Instantly share code, notes, and snippets.

View mrichman's full-sized avatar

Mark Richman mrichman

View GitHub Profile
@mrichman
mrichman / gist:189271
Created September 18, 2009 20:18
Is window.parent valid for IE and FF, but not Safari?
<script type="text/javascript">
if (!opener) {opener = window.parent;}
function ClosePopup() {
if (opener) {try{opener.DisableWindowAlwaysOnTop();}catch(e){}}
try{opener.document.getElementById(window.name + 'btnTargetButton').click();}catch(e){}
}
function OnFormSubmit() {
window.onunload = null;
[15:57:22] mark:lark_templategit:(master) $ rake db:create --trace
(in /Users/mark/code/lark_template)
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:create
rake aborted!
undefined method `[]' for false:FalseClass
mark@macpro:~/code
$rails test -m BigOldRailsTemplate/lark_template.rb
create
create app/controllers
create app/helpers
create app/models
create app/views/layouts
create config/environments
create config/initializers
create config/locales
Processing PagesController#home (for 127.0.0.1 at 2009-10-26 17:06:09) [GET]
Parameters: {"action"=>"home", "controller"=>"pages"}
Rendering template within layouts/application
Rendering pages/home
ActionView::TemplateError (uninitialized constant ActionView::SafeBuffer) on line #1 of app/views/pages/home.html.erb:
1: <% title 'hire_exchange', :false %>
2:
3: <% content_for :top_menu do %>
4: <div id="top_menu" class="span-24">
@mrichman
mrichman / 20091107103100_create_users.rb
Created November 7, 2009 15:32
What can I do to make this more useful or less error-prone?
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.timestamps
t.string :login, :null => false
t.string :first_name, :null => false
t.string :last_name, :null => false
t.string :email, :null => false
t.string :website, :null => false
t.string :company_name, :default => ''
$ rake db:seed --trace
(in /Users/mark/Sites/rails/rails_sample_app)
** Invoke db:seed (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:seed
Loaded suite /usr/bin/rake
Started
1) Error:
test_should_create_user(UsersControllerTest):
NoMethodError: undefined method `symbolize_keys' for #<User:0x102c266d8>
/test/functional/users_controller_test.rb:11:in `test_should_create_user'
/test/functional/users_controller_test.rb:10:in `test_should_create_user'
## /test/functional/users_controller_test.rb:11
post :create, users(:testuser)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
Pick an entity...
</title><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /><link id="CssLink_0bf4b9d66bb54cd6af59d7f993b968da" href="/css/reset.css" type="text/css" rel="stylesheet" media="screen" /><link id="CssLink_2b405157eb904948ad16306a04d81d83" href="/css/main.css" type="text/css" rel="stylesheet" media="screen" /><link id="CssLink_f2b02b5d284e40f5be73d6df99272eca" href="/css/entities.css" type="text/css" rel="stylesheet" media="screen" /></head>
<body>
@mrichman
mrichman / gist:233849
Created November 13, 2009 14:06
ASCII art in source code - yet another reason NEVER to pay or bill by the hour!
private string GetterRobbottoAsciiArt =
Environment.NewLine + Environment.NewLine + Environment.NewLine + Environment.NewLine +
" Vooo/ " +
Environment.NewLine +
" oooooooV. !o " +
Environment.NewLine +
" oooVVoooooVV! ooVVVoVVVo " +
Environment.NewLine +
" VVoVVooooooVVooVoo/!ooooooVVVooVooooo! oooVooVoVoVVVVVV/ " +
Environment.NewLine +
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.string :login
t.string :email
t.boolean :active, :default => true
t.boolean :confirmed, :default => false
t.string :crypted_password
t.string :password_salt
t.string :persistence_token