Skip to content

Instantly share code, notes, and snippets.

View DCarper's full-sized avatar

Dan Carper DCarper

View GitHub Profile
var email_regexp = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i;
jQuery.validator.addMethod("string_of_emails", function(value, element) {
var emails = value
Given a product_trial_with_pictures exists with active: true # features/step_definitions/pickle_steps.rb:4
Too many open files - /var/folders/68/68gISV62GsmvDwtoiDeSfU+++TQ/-Tmp-/dragonfly20110328-369-1shyiuf-0 (Errno::EMFILE)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:1262:in `initialize'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:1262:in `open'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:1262:in `copy_file'
var default_options = {};
var hamsterDance = function(options) {
options = options || {};
options.merge(default_options)
// make the hamsters dance with appropriate options
}
// where i would google around for the best merge technique available since there doesn't seem to be a pattern for that either
var form_not_submitted = true;
$( function() {
$("form").validate({ rules: {...}, submitHandler: submitOnce});
})
var submitOnce = function(form) {
if ( form_not_submitted )
{ form_not_submitted = false; alert('hi'); form.submit(); }
else { return false }
$.ajax({ url: this.action+'.json',
dataType: 'json',
accepts: 'text/json',
data: $(this).serialize(),
type: 'post',
success: function(data, textStatus, XMLHttpRequest) { ... }})
// this works in all browsers except IE.. when sent from IE the server thinks it's asking for a mimetype of image/gif
// i have tried all combinations of including and excluding "accepts", "dataType", and adding ".json" onto the end of the form action.
.arrow
font-size: 0px
line-height: 0%
width: 0px
border-top: 5px solid #f6f6f6
border-left: 10px solid #77c
border-bottom: 5px solid #f6f6f6
th.headerSortUp .arrow
namespace :deploy do
[:start, :stop].each do |t|
desc "#{t} task is a no-op with passenger"
task t, :roles => :app do ; end
end
end
/Users/dancarper/.irbrc:2:in `<main>': no such file to load -- ap (LoadError)
from /usr/local/bin/macirb:36:in `block'
from /usr/local/bin/macirb:9:in `block'
from /usr/local/bin/macirb:7:in `<main>'
def index
@comments = ....
respond_to do |wants|
wants.json { render :json => { :comments => render_to_string(:partial => 'comments/comments_box.html.haml', :locals => { :comments => @comments}) }.to_json }
end
end
class Album < ActiveRecord::Base
attr_accessible :title
has_one :artist , :dependent => :destroy
has_many :genres , :dependent => :destroy
accepts_nested_attributes_for :artist, :allow_destroy => true
end