Skip to content

Instantly share code, notes, and snippets.

View kubicek's full-sized avatar

Jiří Kubíček kubicek

View GitHub Profile
class KubicekMiddleware
def initialize(app)
@app = app
end
def call(env)
#tohle se vola pred aplikaci
env["REQUEST_URI"]="/welcome"
#zavolame aplikaci
status, headers, response = @app.call(env)
#!/usr/bin/env ruby
#
# Based on drbfs example by Kent Sibilev
require 'lib/fusefs'
# We're basically just passing all requests on to the local filesystem.
class UfsDirectory
def initialize(dir)
@dir = dir
class Performer
attr_accessor :object, :method_to_call, :parameters_for_method
def initialize(object, method_to_call, *parameters_for_method)
@object, @method_to_call, @parameters_for_method = object, method_to_call, parameters_for_method
end
def perform
object.send(method_to_call, *parameters_for_method)
Požadavek: Znovunastavení hesla
Pro přihlášení v případě zapomenutého hesla
Uživatel
By měl mít možnost si heslo znovu nastavit
Scénář: Uživatel není zaregistrován
Pokud neexistuje uživatel s emailovou adresou "email@person.com"
Když požádám o zaslání odkazu pro znovunastavení hesla na "email@person.com"
Pak bych měl vidět "Neznámý e-mail."
# Usage:
# rails project_name -m http://gist.github.com/127877.txt
Pokud /^jsem na (.+)$/ do |page_name|
Given "I am on #{page_name}"
end
Když /^jdu na (.+)$/ do |page_name|
When "I go to #{page_name}"
end
Když /^zmáčknu "([^\"]*)"$/ do |button|
When "I press \"#{button}\""
require 'rubygems'
require 'eventmachine'
require 'dnsruby'
module RedirectServer
def receive_data data
send_data <<EOF
HTTP/1.1 301 Moved Permanently
Location: http://www.daukce.cz/
Content-Type: text/html
d-i debian-installer/locale string en_US
d-i console-keymaps-at/keymap select us
# Delete/Move Rails default files
log 'moving', 'Rails default files'
run "mv README doc/README_FOR_RAILS"
run "rm public/index.html"
# Copy database.yml
log "copying", "database.yml"
run "cp config/database.yml config/database.example.yml"
# Create App config
#!/bin/bash
for ico in `cat ico.txt`;do
echo "FETCHING $ico"
`curl "http://wwwinfo.mfcr.cz/cgi-bin/ares/darv_or.cgi?ico=$ico&ver=1.0.2"` >> data.xml
curl -X PUT --data-binary @data.xml http://localhost:5984/obchodni_rejstrik/_design/updater/_update/save_xml/$ico
done