Skip to content

Instantly share code, notes, and snippets.

View cameroncox's full-sized avatar

Cameron Cox cameroncox

View GitHub Profile
require 'thor'
module Gazette
class Application < Thor
desc "init", "Creates a new git managed blog in the current working directory"
def init
Application::Init.run
end # init
desc "post", "Post a new blog article"
require 'thor'
module Gazette
class Application < Thor
desc "init", "Creates a new git managed blog in the current working directory"
def init
Application::Init.run
end # init
desc "post", "Post a new blog article"
@cameroncox
cameroncox / gist:525
Created July 22, 2008 00:47
undefined
require 'thor'
module Gazette
class Application < Thor
desc "init", "Creates a new git managed blog in the current working directory"
def init
Application::Init.run
end # init
desc "post", "Post a new blog article"
#!/usr/bin/env ruby
$: << File.join(File.dirname(__FILE__), "..", "lib", "project")
$: << File.join(File.dirname(__FILE__), "..", "lib", "project", "web")
%w( rack sinatra haml sass ).each { |f| require(f) }
get '/' do
@listings = Listing.all
haml :index
end
get '/style' do
header 'Content-Type' => 'text/css; charset=utf-8'
sass :style
## development
== Sinatra has taken the stage on port 4567 for development with backup by Rack::Handler::Mongrel
127.0.0.1 - - [22/Jul/2008 16:49:56] "GET / HTTP/1.1" 404 660 0.0031
127.0.0.1 - - [22/Jul/2008 16:49:56] "GET /sinatra_custom_images/404.png HTTP/1.1" 200 23305 0.0008
## production
== Sinatra has taken the stage on port 4567 for production with backup by Rack::Handler::Mongrel
127.0.0.1 - - [22/Jul/2008 16:50:35] "GET / HTTP/1.1" 200 2 0.0038
127.0.0.1 - - [22/Jul/2008 16:50:35] "GET /favicon.ico HTTP/1.1" 404 18 0.0002
module Authorization
module User
# include ::DataMapper::Resource
# This is a "vanity" relationship. A user may not have all permissions for an entire role,
# but still may be said to be a member of the role.
# has_and_belongs_to_many :roles
has 1.0/0, :roles, :through => ::DataMapper::Resource
# This relationship contains the actual list of permissions the user has been granted.
has 1.0/0, :permissions, :through => ::DataMapper::Resource
#
# This is an example for the global screenrc file.
# You may want to install this file as /usr/local/etc/screenrc.
# Check config.h for the exact location.
#
# Flaws of termcap and standard settings are done here.
#
#startup_message off
class JournalEntry
include DataMapper::Resource
property :id, Serial
property :summary, Text, :lazy => true
belongs_to :user
end
$(document).ready(function() {
if (String(window.location).match(/#/i)) {
matches = String(window.location).match(/#(.*)/)
$('#contents').load(matches[1] + '.html #container #contents *');
}
$('ul li').find('a').each(function(i, link) {
$(this).click(function(i, a) {
var uri = $(this).attr('href');
$('#contents').empty();