Skip to content

Instantly share code, notes, and snippets.

View lenary's full-sized avatar

Sam Elliott lenary

View GitHub Profile
---
pid: tmp/pids/thin.pid
rackup: config.ru
log: ginatra.log
port: 3001
max_conns: 1024
timeout: 30
environment: production
chdir: /projects/lenary/ginatra
debug: true
@lenary
lenary / blog.rb
Created May 19, 2009 20:07 — forked from vangberg/blog.rb
require 'sinatra'
class Blog < Sinatra::Default
get '/' do
..
end
end
if __FILE__ == $0
Blog.run!
end
# stolen from http://github.com/cschneid/irclogger/blob/master/lib/partials.rb
# and made a lot more robust by me
# this implementation uses erb by default. if you want to use any other template mechanism
# then replace `erb` on line 13 and line 17 with `haml` or whatever
module Sinatra::Partials
def partial(template, *args)
template_array = template.to_s.split('/')
template = template_array[0..-2].join('/') + "/_#{template_array[-1]}"
options = args.last.is_a?(Hash) ? args.pop : {}
options.merge!(:layout => false)
module Hancock
module Helpers
module Merb
begin
::Merb::Authentication.user_class = User
class ::Merb::Authentication
def fetch_user(session_user_id)
Merb::Authentication.user_class.get(session[:user_id])
set nocompatible
set background=light
syntax on
colorscheme railscasts
filetype plugin indent on
set vb t_vb=
set nowrap
set linebreak
set spl=en_gb spell
set number
o
//
........................o\\
@lenary
lenary / 1 - Rails.md
Created August 24, 2009 13:57
A Sorted List of the Repos I Am Following
require 'sinatra'
module Sinatra
module Foo
module Helpers
def foo
@bar = 'Bye'
end
end
def self.registered(app)
def command(command, identifier)
IO.popen(command) do
File.open("commands/#{identifier}.stderr", "w") do |f|
f.puts $stderr.readpartial
end
File.open("commands/#{identifier}.stdout", "w") do |f|
f.puts $stdout.readpartial
end
end
end
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Vicious Delicious Console</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$("#command_line input").focus();
$("#command_line").submit(function () {