Skip to content

Instantly share code, notes, and snippets.

@sr
sr / bot.rb
Created January 28, 2009 21:19 — forked from vangberg/gist:54192
# Meh, I went overboard. Usage:
#
# To tweet, write in channel:
# nancie, tweet this: some nice thing about sinatra and stuff
# To give permissions, private message:
# /msg nancie allow awesome_user
#
# Additional extensions are welcome.
require 'rubygems'
@sr
sr / twicl
Created January 30, 2009 16:03 — forked from leahneukirchen/twicl
#!/usr/bin/env ruby
# -*- ruby -*-
# twitter command line client
# That's What I Call Lame
# 09nov2008 +chris+
require 'json'
require 'open-uri'
@sr
sr / base.rb
Created January 31, 2009 01:33 — forked from rtomayko/base.rb
class Foo < Sinatra::Base
host_name "sinatrarb.com"
user_agent /Mosaic/
provides :xml
get '/' do
"Welcome!"
end
get '/' do
"You are not to be welcomed!"
use Rack::Auth::Basic do |username,password|
password == 'secret'
end
get '/' do
"welcome in the secret zone"
end
commit 4039b792c6af983552705302c282bd35b59ea9e4
Author: Simon Rozet <simon@rozet.name>
Date: Wed Jan 28 23:57:51 2009 +0100
Back to the essences
* Back to Markdown
* I suck at CSS, and I'd rather provide no CSS
than one that sucks.
* All that JS floating around is just unecessary bloat to me.
@sr
sr / gist:66980
Created February 19, 2009 16:15
my dwm config
/* See LICENSE file for copyright and license details. */
/* appearance */
static const char font[] = "-*-terminus-medium-r-normal-*-14-*-*-*-*-*-*-*";
static const char normbordercolor[] = "#cccccc";
static const char normbgcolor[] = "#cccccc";
static const char normfgcolor[] = "#000000";
static const char selbordercolor[] = "#0066ff";
static const char selbgcolor[] = "#0066ff";
static const char selfgcolor[] = "#ffffff";
@sr
sr / atomize
Created February 19, 2009 20:20
my retarded tumblog
#!/usr/bin/env bash
cat <<EOF
<entry>
<title>Omnifaria $1</title>
<published>$(date --utc)</published>
<updated>$(date --utc)</updated>
<content type="xhtml"><div>$(cat | ./src/markdown)</div></content>
</entry>
EOF
@sr
sr / test.rb
Created February 24, 2009 03:00 — forked from brynary/gist:69372
module Rack
module Test
module Session
attr_reader :last_response
attr_reader :last_request
alias_method :response, :last_response
alias_method :request, :last_request
def initialize(app)
@sr
sr / gist:91275
Created April 7, 2009 15:07
Hax integrity to refresh the page
#!/usr/bin/env ruby
require "rubygems"
require "integrity"
class Refresher
JS = <<-EOS
<script type="text/javascript">
//<![CDATA[
setTimeout('location.reload()', %s * 1000)
//]]>
@sr
sr / gist:108184
Created May 7, 2009 16:08
Crazy test/unit + rack/test hax
require "test/unit"
require "rack/test"
require "contest"
require "sinatra/base"
class MyApp < Sinatra::Base
set :environment, :test
get "/" do
"Hi, #{params["name"]}."