Skip to content

Instantly share code, notes, and snippets.

View patrickdet's full-sized avatar

Patrick Detlefsen patrickdet

View GitHub Profile
on:
push:
branches:
- master
jobs:
update-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@0.9.0
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
class UserSignup
def initialize(params)
@params = params
@success = false
signup
end
def user
@user
end
@patrickdet
patrickdet / id_rsa.pub
Created October 30, 2013 21:11
public ssh key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDW3MQ/9xTFHnicb5hcMr+dbE6w5GHm2iyLtLB87dgI9OVsz+scUymxg434IFPNVdvMiQEt4zDiTY8bPdBAKwGz7A6z2yHWcK97emvZEvJ7IqIyybqbflH4ldzn1+T0czhpeWYGNWtz2MpXFDkdEAHeHm/tkjBnXTdfbqlp6LCXB7KZ8uoWlbRw1Wsx1R6JVsb5TFV2gVGVQ0q0MD+FqOEFUtTG+LcyI1CjMwVdSzvIDUw0AZ7htlE0DMNMU1Q3jQxniyqASOf73MPpXKxXnwXY9rWH6iwsGKQ5MaHXTkVUwmC/ykkn/DAF6HRSJTUBJim5sj4xTLb1vnau9/aH00At
@patrickdet
patrickdet / Prozesse.md
Created March 6, 2012 21:03 — forked from salzig/Prozesse.md
Betriebssysteme

Prozess - das laufende Programm

Programm

Erzeugung

  • unix: fork, execve
  • windows:CreateProcess

Beenden

  • unix: exit / kill
  • windows: ExitProcess / TerminateProcess
@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" }
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.

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”