Skip to content

Instantly share code, notes, and snippets.

$:.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'
@cschneid
cschneid / chat.html
Created August 25, 2008 17:22 — forked from foca/chat.html
<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>
@cschneid
cschneid / gist:36630
Created December 16, 2008 15:28 — forked from gma/gist:36627
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
require 'sinatra/base'
module Sinatra
module BeforeTest
def self.registered(app)
app.before do
file_scoped do
require_login! # or whatever.
end
require 'rubygems'
require 'sinatra'
class Mobile << Sinatra::Base
get '/' do
'hello world'
end
end
<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]
@cschneid
cschneid / hack.sh
Created April 1, 2012 03:43 — forked from erikh/hack.sh
OSX For Hackers
#!/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
#
@cschneid
cschneid / repeating_header.rb
Created July 31, 2012 14:00 — forked from randym/repeating_header.rb
Excel with Ruby: Printing Header Row for every page with axlsx
#```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')
@cschneid
cschneid / Tests
Created August 15, 2012 19:46 — forked from coreyhaines/Tests
Number 2 LED
Create a system that will convert a numeric value to an 3x5 LED display.
...
...
...
...
...
Feature: Generating LCD representation for single numbers
@cschneid
cschneid / .gitignore
Created September 26, 2012 22:03 — forked from thinkerbot/.gitignore
Ruby sprintf from the command line.
/ronn