- unix: fork, execve
- windows:CreateProcess
- unix: exit / kill
- windows: ExitProcess / TerminateProcess
| sum : Tree Int -> Int | |
| sum tree = | |
| case tree of | |
| Empty -> 0 | |
| Node v left right -> | |
| v + sum left + sum right | |
| flatten : Tree a -> List a | |
| flatten tree = | |
| case tree of |
| # 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" } |
| 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) |
| = 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. |
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
“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”
| # 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 |
| 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 |
| 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 |