Skip to content

Instantly share code, notes, and snippets.

View patrickdet's full-sized avatar

Patrick Detlefsen patrickdet

View GitHub Profile
require 'gistit'
gist = Gistit.new
gist.paste("puts 'hello world!'") # => 12345
gist.delete 12345 # => true
# 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
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
require 'open-uri'
# url dsl -- the ultimate url dsl!
#
# You just can't beat this:
#
# $ irb -r url_dsl
# >> include URLDSL
# => Object
# >> http://github.com/defunkt.json
# 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

“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”

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.

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
= 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.
41a42
> ;;;###autoload
44a46,48
> (defun string-join (separator strings)
> "Join all STRINGS using SEPARATOR."
> (mapconcat 'identity strings separator))
55a60
> ;;;###autoload
57,59c62,64
< (if (boundp 'aquamacs-version)
@patrickdet
patrickdet / DeviseJsonAdapter.rb
Created January 16, 2012 18:41 — forked from wrs/DeviseJsonAdapter.rb
JSON-encoded error and redirect results for Devise controllers
# JSON-encoded error and redirect results for Devise controllers.
# This overrides an internal method of Devise, so be careful when updating Devise!
#
# Usage:
#
# class Users::RegistrationsController < Devise::RegistrationsController
# include DeviseJsonAdapter
# end
#
# devise_for :users, :controllers => { :registrations => "users/registrations" }