Skip to content

Instantly share code, notes, and snippets.

@mmack
mmack / tests
Created December 10, 2009 13:52
def test_logins
assert_equal @existingbob, User.authenticate("exbob@mcbob.com", "test") ## works
assert_equal @existingbob, User.authenticate("exbob@mcbob.com", "test1") ## works not -> <#<User id: 1000002, email: "exbob@mcbob.com", hashed_password: "77a0d943cdbace52716a9ef9fae12e45e2788d39", salt: "1000", updated_at: "2009-12-10 13:50:33", created_at: "2009-12-10 13:50:33">> expected but was <nil>.
assert_nil @existingbob, User.authenticate("exbob@mcbob.com", "test1") ## works also not !!!! -> <nil> expected but was <#<User id: 1000002, email: "exbob@mcbob.com", hashed_password: "77a0d943cdbace52716a9ef9fae12e45e2788d39", salt: "1000", updated_at: "2009-12-10 13:51:34", created_at: "2009-12-10 13:51:34">>.
end
def end_date
end_date = start_date + length.minutes
end
def real_end_date
real_end_date = start_date + length.minutes + 15.minutes
end
def real_start_date
real_start_date = start_date - 15.minutes
>> s1.created_at
=> Mon, 07 Jun 2010 15:27:07 UTC +00:00
>> s2.created_at
=> Mon, 07 Jun 2010 15:27:07 UTC +00:00
>> s1.created_at == s2.created_at
=> false
>>
require 'rubygems'
require 'libxml'
include LibXML
class PostCallbacks
include XML::SaxParser::Callbacks
def on_start_element(element, attributes)
if element == 'product'
<product>
<a001>KNV1972090700076</a001>
<a002>04</a002>
<a194>03</a194>
<a197>KNV</a197>
<productidentifier>
<b221>03</b221>
<b244>9783150047552</b244>
</productidentifier>
<productidentifier>
rake aborted!
Command failed with status (1): [bundle exec /Users/dexcs/.rvm/rubies/ruby-...]
/Users/dexcs/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:995:in `block in sh'
/Users/dexcs/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:1010:in `call'
/Users/dexcs/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:1010:in `sh'
/Users/dexcs/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:1094:in `sh'
/Users/dexcs/.rvm/gems/ruby-1.9.2-rc2/gems/cucumber-0.8.5/lib/cucumber/rake/task.rb:72:in `run'
/Users/dexcs/.rvm/gems/ruby-1.9.2-rc2/gems/cucumber-0.8.5/lib/cucumber/rake/task.rb:142:in `block in define_task'
/Users/dexcs/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Users/dexcs/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:636:in `block in execute'
routes.rb:
match 'fax/send(/:user_id(/:token))' => 'fax#send', :as => :fax_send#, :via => :post
rake route:
fax_send /fax/send(/:user_id(/:token))(.:format) {:controller=>"fax", :action=>"send"}
controller:
class FaxController < ApplicationController
def send
end
@mmack
mmack / gist:756295
Created December 27, 2010 17:04
padrino setup not working
$ padrino g project wikirocket -a postgres -d datamapper -s jquery -b
$ cd wikirocket
$ padrino start
-----------------
>> Listening on localhost:3000, CTRL+C to stop
NoMethodError: undefined method `matched?' for nil:NilClass
/Users/max/.rvm/gems/ruby-1.9.2-p0/gems/padrino-core-0.9.19/lib/padrino-core/application/routing.rb:66:in `route'
/Users/max/.rvm/gems/ruby-1.9.2-p0/gems/sinatra-1.1.2/lib/sinatra/base.rb:549:in `call!'
/Users/max/.rvm/gems/ruby-1.9.2-p0/gems/sinatra-1.1.2/lib/sinatra/base.rb:538:in `call'
@mmack
mmack / test
Created April 5, 2011 09:18
test
uzffkufku
<!DOCTYPE html>
<head>
<title>Pusher Test</title>
<script src="http://js.pusherapp.com/1.8/pusher.min.js" type="text/javascript"></script>
<script type="text/javascript">
// Enable pusher logging - don't include this in production
Pusher.log = function(message) {
if (window.console && window.console.log) window.console.log(message);
};