Skip to content

Instantly share code, notes, and snippets.

/*
* allegro
*
* Created by teamon on 08-11-20.
* Copyright (c) 2008 __MyCompanyName__. All rights reserved.
*/
#include <Allegro/allegro.h>
#include <math.h>
[ 14:28:14 teamon ~/Sites/current/merb-user ] merb -i
Loading init file from /Users/teamon/Sites/current/merb-user/config/init.rb
Loading /Users/teamon/Sites/current/merb-user/config/environments/development.rb
~ Connecting to database...
~ Loaded slice 'MerbAuthSliceActivation' ...
~ Loaded slice 'MerbAuthSlicePassword' ...
~ Loaded slice 'MerbAuthSlicePasswordReset' ...
~ Parent pid: 74050
~ Compiling routes...
~ "Merb::Controller"
## login
merb : worker (port 4000) ~ Started request handling: Sun Dec 28 23:41:33 +0100 2008
merb : worker (port 4000) ~ Routed to: {"submit"=>"Zaloguj", "action"=>"update", "_method"=>"put", "controller"=>"merb_auth_slice_password/sessions", "password"=>"monkey", "login"=>"teamon"}
merb : worker (port 4000) ~ Params: {"submit"=>"Zaloguj", "action"=>"update", "_method"=>"put", "controller"=>"merb_auth_slice_password/sessions", "password"=>"monkey", "login"=>"teamon"}
~ SELECT "session_id", "data", "created_at" FROM "sessions" WHERE ("session_id" = '1f22d587125d0731dd5bb120a767fc3b') ORDER BY "session_id" LIMIT 1
~ SELECT "activated_at", "activation_code", "password_reset_code", "id", "login", "email", "name", "street", "postcode", "city", "phone", "www", "crypted_password", "salt" FROM "users" WHERE ("login" = 'teamon') ORDER BY "id" LIMIT 1
merb : worker (port 4000) ~[[SESSION]] {"user"=>3, "authentication_strategies"=>nil, "return_to"=>nil, "flash"=>#<Flash:0x24738c4 @attrs={}, @keepers=[]>}[[/SESS
class FlashTest < Application
def index
render
end
def with_hash
redirect "/flash_test", :message => {:error => "Some error"}
end
[ 19:29:53 teamon ~/Sites/current/merb-user ] cucumber -r features features/authentication/login.feature --quiet
Feature: Login
To ensure the safety of the application
A regular user of the system
Must authenticate before using the app
Scenario: Failed Login
Given I am not authenticated
When I go to /login
And I fill in "login" with "i_dont exist"
And I fill in "password" with "me either"
[ 19:40:35 teamon ~/Sites/current/merb-user ] cucumber -r features features/authentication/login.feature --quiet
Feature: Login
To ensure the safety of the application
A regular user of the system
Must authenticate before using the app
Scenario: Failed Login
Given I am not authenticated
When I go to /login
And I fill in "login" with "i_dont exist"
And I fill in "password" with "me either"
// Common JavaScript code across your application goes here.
jQuery.ajaxSetup({
'beforeSend': function(xhr) { xhr.setRequestHeader("Accept", "text/javascript") }
})
$(document).ready(fuction() {
$("div.votes a").click(function(){
$.post(this.href, {"vote[value]": (this.className == "vote_up") ? 1 : -1});
})
})
# zad5 http://dl-client3.getdropbox.com/u/70986/infa/matura2007/inf_pr_cz2.pdf
class Fixnum
def first?
!(2..Math.sqrt(self)).any? {|i| self % i == 0}
end
def sum_is_first?
self.to_s.split(//).inject(0) {|s, e| s+=e.to_i}.first?
end
Feature: Mage categories
To create, update or delete new category
An authenticated user of the system
Goes to categories page and do the right thing
Scenario: Successful category creating
Given I am authenticated as "teamon"
And the following categories exist:
When I go to admin homepage
And I click "Add category"
And I fill in "name" with "Ruby"
# Sets up the Merb environment for Cucumber (thanks to krzys and roman)
require "rubygems"
# Add the local gems dir if found within the app root; any dependencies loaded
# hereafter will try to load from the local gems before loading system gems.
if (local_gem_dir = File.join(File.dirname(__FILE__), '..', 'gems')) && $BUNDLE.nil?
$BUNDLE = true; Gem.clear_paths; Gem.path.unshift(local_gem_dir)
end
require "merb-core"