Skip to content

Instantly share code, notes, and snippets.

View vangberg's full-sized avatar

Harry Vangberg vangberg

View GitHub Profile
config-one / one: RSS 22M
config-all / all: RSS 23M
def session_initiated
set("foo", "bar") {}
# @queue: [Proc{}]
set("lol", "cat") {}
# @queue: [Proc{}]
read "/foo/bar.mp3" do |result|
..
end
require 'rubygems'
require 'isaac'
configure do |c|
c.nick = "wallabotz"
c.server = "irc.freenode.net"
c.verbose = true
end
on :connect do
class SetContentTypeCharSet
def initialize(app)
@app = app
end
def call(env)
status, headers, body = @app.call(env)
headers['Content-Type'] += "; charset=UTF-8"
[status, headers, body]
end
class Array
def >> obj
ArrayMover.new delete(obj)
end
end
class ArrayMover
def initialize(obj)
@obj = obj
end
# This is our base controller, much like ApplicationController in Rails
class App < Sinatra::Base
# Default settings that should be shared by all controllers
set :foo, :bar
def shared_helper
# this will be available for everything
end
end
19:05 < harryv> nice. trying to restore nancie :)
19:24 < cypher23> harryv, why? what happened to her?
19:36 < harryv> cypher23: I rebuild my slice and in that process killed the config and made no backup :P
19:37 < tbyhlmann> Gosh, at least she's not pregnant.
20:10 < lenary> tbyhlmann: http://github.com/ichverstehe/nancie/tree/master you can help make mini-nancies if you want....
20:11 < tbyhlmann> I don't tweet at all!
20:13 < lenary> go on, make nancie pregnant
20:13 < lenary> you know you want to
20:19 < lenary> (just press the fork button)
20:20 < cypher23> I can never look at GitHub the same way again after reading what lenary just wrote
<html>
<head>
<script type="text/javascript">
window.onload = function() { alert("window.onload") }
</script>
</head>
<body>
Testside.
<script type="text/javascript">
alert("end of <body>");
get '/:foo' do
if request.xhr?
...
else
...
end
end
@vangberg
vangberg / app.rb
Created May 30, 2009 15:00
minimal sinatra rackup
require 'sinatra'
get '/' do
"Hello world"
end