This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$:.unshift("../sinatra/lib") | |
require 'sinatra' | |
require 'spec/interop/test' | |
require 'sinatra/test/unit' | |
set :views, File.join(File.dirname(__FILE__), '..', 'views') | |
class Rack::MockResponse | |
require 'hpricot' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ol> | |
<li> | |
<div class="time">10:30</div> | |
<q><address>John</address> hi</q> | |
</li> | |
<li><q><address>Mary</address> hey!</q></li> | |
<li><q><address>Mary</address> blah</q></li> | |
<li><q><address>John</address> blah blah?</q></li> | |
<li> | |
<div class="time">10:35</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SpecHelper | |
def session_data | |
cookies = @response.headers["Set-Cookie"] | |
serialised = Rack::Utils::parse_query(cookies)["rack.session"] | |
Marshal.load(serialised.unpack('m*').first) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra/base' | |
module Sinatra | |
module BeforeTest | |
def self.registered(app) | |
app.before do | |
file_scoped do | |
require_login! # or whatever. | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sinatra' | |
class Mobile << Sinatra::Base | |
get '/' do | |
'hello world' | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cschneid> jc3: convenience & future enhancements to be fancier | |
<cschneid> jc3: nothing pressing even in the least, just toying with ideas | |
[13:26] | |
<cschneid> found torquebox just now, totally speaks to me... seems great | |
<jc3> i'm intrigued by the long-running ruby process idea. jboss' | |
"microcontainer" already provides a lightweight "service" interface that | |
your bot would implement, essentially define "start" and "stop" methods. | |
we could probably put some syntactic sugar around that so that you could | |
package your service with the sinatra app. or there may already be a | |
way. bob knows more about the microcontainer than i. [13:29] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#```ruby | |
require 'axlsx' | |
p = Axlsx::Package.new | |
wb = p.workbook | |
wb.add_worksheet(:name => "repeated header") do |sheet| | |
sheet.add_row %w(These Column Header Will Render On Every Printed Sheet) | |
200.times { sheet.add_row %w(1 2 3 4 5 6 7 8) } | |
# This is the magic | |
wb.add_defined_name("'repeated header'!$1:$1", :local_sheet_id => sheet.index, :name => '_xlnm.Print_Titles') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Create a system that will convert a numeric value to an 3x5 LED display. | |
... | |
... | |
... | |
... | |
... | |
Feature: Generating LCD representation for single numbers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/ronn |
OlderNewer