Skip to content

Instantly share code, notes, and snippets.

class Settings(models.Model):
# basic settings
include_basic = models.BooleanField(default=True, null=False)
include_people = models.BooleanField(default=False, null=False)
class Meta:
abstract = True
class Account(models.Model):
# the user that this account belongs to
@mikebannister
mikebannister / gist:733458
Created December 8, 2010 15:51
Wondering why I can't catch this assertion error
var assert = require('assert');
var EventEmitter = require('events').EventEmitter;
var TestEmitter = function() {
var self = this;
EventEmitter.call(this);
setTimeout(function() {
self.emit('any', false);
}, 2000);
};
This:
<%= link_to "Destroy", employees_confirm_path(
:path => employee_path,
:return_path => request.env['PATH_INFO'])
%>
Renders this:
<a href="/employees/confirm?path=%2Femployees%2F14&amp;return_path=%2Femployees%2F14">Destroy</a>
it "renders select box with employees job title selected" do
render
rendered.should have_selector("form") do |form|
form.should have_selector("select",
:name => "employee[job_title_id]") do |select|
select.should have_xpath(".//option[@selected = 'selected']") do |option|
p option
end
end
end
class Object
def self.my_accessor(*accessor_names)
accessor_names.each do |name|
define_method name do
instance_var_name = "@#{name.to_s}".to_sym
self.instance_variable_get(instance_var_name)
end
writer_name = "#{name.to_s}=".to_sym
define_method writer_name do |value|
instance_var_name = "@#{name.to_s}".to_sym
scenario "Payroll report" do
sign_in :then_visit => reports_payroll_path
save_and_open_page
visit timesheets_path
save_and_open_page
end
CREATE DATABASE database_name CHARACTER SET utf8;
GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'localhost' IDENTIFIED BY 'your_password';
def new
@timesheet = Timesheet.new
@timesheet.employee = Employee.find(params[:employee_id]) rescue nil
end
rvm gemset create moof
rvm gemset use moof
rails new moof
cd moof
emacs Gemfile <- add rspec
bundle
rails g rspec:install
rake -T
<excerpt>
apt-get -y update
locale-gen en_GB.UTF-8
/usr/sbin/update-locale LANG=en_GB.UTF-8
aptitude -y safe-upgrade && aptitude -y full-upgrade
apt-get -y update