Skip to content

Instantly share code, notes, and snippets.

View dagda1's full-sized avatar

Paul dagda1

View GitHub Profile
function scrollToTop() {
$('html, body').animate({ scrollTop: 0 }, 'slow');
}
task "Teach and Test Notification":
clients:
include @local
reminder_subject "You have been selected to take the $test test"
reminder_body """You have been selected to sit the $test on the $date<br/><br/>
The test details will be emailed to you on that date."""
subject "Your $test details"
require File.dirname(__FILE__) + '/../test_helper'
class ParserTests < Test::Unit::TestCase
should_parse_leads "from an html file" do
@parser = LeadCapturer::Parser.new(File.read("email.html"))
end
should_parse_leads "with duplicate identifiers" do
@html = <<-eohtml
<?xml version='1.0' ?><a:searchrequest xmlns:a='DAV:' ><a:sql>SELECT "DAV:id","urn:schemas:contacts:account","urn:schemas:contacts:bday","urn:schemas:contacts:billinginformation","urn:schemas:contacts:businesshomepage","urn:schemas:contacts:c","urn:schemas:contacts:callbackphone","urn:schemas:contacts:children","urn:schemas:contacts:childrensnames","urn:schemas:contacts:cn","urn:schemas:contacts:co","http://schemas.microsoft.com/exchange/companies","urn:schemas:contacts:computernetworkname","urn:schemas:contacts:customerid","urn:schemas:contacts:department","urn:schemas:contacts:dn","urn:schemas:contacts:email1","urn:schemas:contacts:email2","urn:schemas:contacts:email3","urn:schemas:contacts:employeenumber","http://schemas.microsoft.com/exchange/extensionattribute1","http://schemas.microsoft.com/exchange/extensionattribute2","http://schemas.microsoft.com/exchange/extensionattribute3","http://schemas.microsoft.com/exchange/extensionattribute4","urn:schemas:contacts:facsimiletelephonenumber","urn:schemas:calen
/Volumes/TextMate 1.5.9/TextMate.app/Contents/SharedSupport/Support/lib/tm/process.rb:169:in `run': JRuby only supports F_SETFL and F_GETFL with NONBLOCK for fcntl/ioctl (NotImplementedError) from
/Volumes/TextMate 1.5.9/TextMate.app/Contents/SharedSupport/Support/lib/tm/executor.rb:211:in
`parse_version' from /Volumes/TextMate
1.5.9/TextMate.app/Contents/SharedSupport/Support/lib/tm/executor.rb:98:in `run' from
/Volumes/TextMate
1.5.9/TextMate.app/Contents/SharedSupport/Bundles/Ruby.tmbundle/Support/RubyMate/run_script.rb:93
Factory.define :user do |user|
user.email {"paul.cowan@hotmail.com"}
user.password {"paulcowan"}
user.password_confirmation {"paulcowan"}
user.association(:role)
end
function dateFromJson(json) {
return new Date(parseInt(json.replace(/(^.*\()|([+-].*$)/g, '')));
}
[BaseSecurityFilter(role: "Admin")]
public class AuditController : BaseController
{
private readonly dynamic _structureService;
[HttpGet]
[CatchException(false)]
public ViewResult All()
{
var audits = _commonDao.GetAll<Audit>(new[] { "CreatedOn" });
@dagda1
dagda1 / autoprop_init.rb
Created October 21, 2010 07:57
autoproperty_init.rb
class Class
def attr_initializer(*attributes)
attr_reader *attributes
class_eval <<-RUBY
def initialize(#{attributes.join(', ')})
#{attributes.map{ |attribute| "@#{attribute}" }.join(', ')} = #{attributes.join(', ')}
end
RUBY
end
end
@dagda1
dagda1 / with.hql
Created October 27, 2010 13:44
extra clause in with
Select q FROM GeneralQuestion
q Left Join q.QuestionResponses as qr with qr.ContactUid = :contactuid
WHERE q.ParentUid = :audituid