Skip to content

Instantly share code, notes, and snippets.


Patrick Detlefsen patrickdet

View GitHub Profile
View peepopen.el
> ;;;###autoload
> (defun string-join (separator strings)
> "Join all STRINGS using SEPARATOR."
> (mapconcat 'identity strings separator))
> ;;;###autoload
< (if (boundp 'aquamacs-version)
= Ruby Packaging Standard
The aim of this document is two-fold. First, to specify a common
structure of how a Ruby package distributed as source (that is, but
not limited to, development directories, version-controlled
repositories, .tar.gz, Gems, ...) should conform to.
Second, to document common and proven ways to structure Ruby packages,
and to point out certain anti-patterns that sneaked into common use.
It is by intent not to innovate.
View authlogic rails 3 app.rdoc

I'm working on both learning authlogic and Rails 3. The process here works (given the Rails 3.0.0.beta1 gem) for me. There is a list of the many resources I complied this from at the bottom of the document.

Travelers beware: this is incomplete, and possibly even wrong. But between the stuff about scaffolding and binary logic's example app you should be able to get off your feet.

Basic Application

We assume Rails 3 is installed. We will create a rails app as usual.

rails authtest
cd authest
rails g scaffold post title:string body:text
rails g scaffold user username:string fullname:string is_admin:boolean

“A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.”

I think it's from “The moon is a harsh mistress”

View websock_action.rb
# Requires Cramp 0.8+
require 'rubygems'
require 'usher'
require 'cramp/controller'
Cramp::Controller::Websocket.backend = :thin
class WebsockAction < Cramp::Controller::Websocket
periodic_timer :send_hello_world, :every => 2
on_data :received_data
View url_dsl.rb
require 'open-uri'
# url dsl -- the ultimate url dsl!
# You just can't beat this:
# $ irb -r url_dsl
# >> include URLDSL
# => Object
# >>
View customdomain.rb
require 'net/dns/resolver'
# Custom Domain
# Require net-dns gem
# A Rack middleware to to resolve the custom domain to original subdomain
# for your multi telent application.
# It's all transperant to your application, it performs cname lookup and
View rails_template.rb
# Delete unnecessary files
run "rm public/index.html"
run "rm public/favicon.ico"
run "rm public/images/rails.png"
run "rm public/javascripts/prototype.js"
run "rm public/javascripts/effects.js"
run "rm public/javascripts/dragdrop.js"
run "rm public/javascripts/controls.js"
# Copy database.yml for distribution use
View production.log
Processing CommentsController#create (for at 2009-02-24 22:13:48) [POST]
Session ID:
Parameters: {"comment"=>{"filter_id"=>"Textile", "author"=>"patrick Detlefsen", "content"=>"hello world comment", "author_email"=>"", "author_url"=>""}, "submit"=>"Save Comment", "url"=>["articles"], "action"=>"create", "controller"=>"comments"}
Redirected to
Completed in 3.47220 (0 reqs/sec) | DB: 0.06800 (1%) | 302 Found []
Processing CommentsController#index (for at 2009-02-24 22:13:52) [GET]
Session ID:
View container.scm
(container-ok? maxvolumen container)
(= (apply + container) maxvolumen))
(container-zu-voll? maxvolumen container)
(> (apply + container) maxvolumen))
(packecontainer stueckgutliste maxvolumen1 container1)