Skip to content

Instantly share code, notes, and snippets.

View paulca's full-sized avatar

Paul Campbell paulca

View GitHub Profile
We couldn’t find that file to show.
# class Event
# parse_dates :start_date, :end_date
# end
class ActiveRecord::Base
def self.parse_dates(*args)
args.flatten.each do |method_name|
class_eval do
define_method "#{method_name}=" do |date|
<script type="javascript">
(function($){
var params, source;
params = function(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
source = params('source')
$(function() {
// Request ticket release info from Tito API and template it into the page, if available.
var target = $("#barebones-registration"),
conferenceService = $.tito('bocoup/backboneconf'),
ticketTemplate = _.template($("#ticket-template").html());
conferenceService.releases().then(function(r) {
var ticketForm = $(ticketTemplate({
releases: r
@paulca
paulca / gist:7e95c044b5263c1f3119
Created October 8, 2014 15:44
whois javascript.nyc
paulca:~ paulcampbell$ which whois
/usr/bin/whois
paulca:~ paulcampbell$ whois javascript.nyc
Domain Name: JAVASCRIPT.NYC
Domain ID: D112597-NYC
Sponsoring Registrar: GoDaddy.com, Inc.
Sponsoring Registrar IANA ID: 146
Registrar URL (registration services): whois.godaddy.com
Domain Status: ok
In order to register for this event, you must agree to the following:
1) You must agree to the [publicity release](http://link-to-publicity-release)
2) You must agree to the [waiver](http://link-to-waiver)
@paulca
paulca / script.md
Last active August 29, 2015 14:25
So Coded 2015 Script

SO Coded 2015 - The MC Script

Thursday

Having given the last talk at So Coded 2013, I was delighted to be asked to come and MC the 2015 edition of the conference. The last time I MC'ed at an event, I found that briefly interviewing speakers before their slot led to a lot of randomness and, in one case, introducing the wrong speaker. So I decided to try and introduce a very loose narrative, based on a picaresque journey that represented the conference’s thematic arc, but with lots of my favourite pop culture references. Many thanks to Julia, Ole and Thorben for having me back.

I’ve added notes in italics just in case any of the (obvious, but obviously obvious to me) references aren’t clear. Much of the sense of these little bits are with apologies to Jennifer Brook and her time machine from Úll

describe Task, "notifications" do
before(:each) do
@company = mock_model(Company)
@first_user = mock_model(User, :login => 'first', :sms_for? => true, :company => @company )
@second_user = mock_model(User, :login => 'second', :sms_for? => true, :company => @company)
@third_user = mock_model(User, :login => 'third', :sms_for? => true, :company => @company)
@company.stub!(:users).and_return([@first_user, @second_user, @third_user])
@company.stub!(:users_who_are_not).and_return([@second_user, @third_user])
@first_user.stub!(:tasks_for).and_return([])
// application.js
// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
function leave_note(){
if($("div#note").css('display')=='none'){
$("div#note").dialog();
$('div#note').show();
} else {
$('div#note').hide();
$("div#note").dialog("destroy");
en:
activerecord:
models:
room: Room
attributes:
room:
name: Room name
description: Room description
max_size: Room size limit
color_scheme_id: Choose color scheme