Skip to content

Instantly share code, notes, and snippets.


Tore Darell toretore

View GitHub Profile
toretore / README
Created May 4, 2011
Rails authentication
User authentication with Rails
This is all you need to have fully working and secure authentication in Rails.
Why use this instead of <bloated auth framework>? Well, there are a number of
reasons, but I guess you'll just have to go through a few apps where you
learn the hard way why the idea of a "fully featured" authentication
framework that doesn't get on your nerves is a mirage.
Don't simply copy and paste this without understanding everything it does. It's
View donkey
donkeys are awesome
View elm-tips.elm
-- The `msg` in `Html msg` and `Cmd msg` can be anything
-- Most Elm apps will have a `Msg` type at the top lever describing the messages
-- that can be processed by `update`:
type Msg
= UserLoaded (Maybe User)
| UserSelected User
View location.elm
module Location
type Location
= None
| SelectCountry (List Country)
| CountrySelected Country
| SelectRegion Country (List Region)
| RegionSelected Country Region
| SelectCity Country Region (List City)
| Complete Country Region City
View Customers.elm
module Customers exposing (Error, Customers, init, toLoading, toFailure, toSuccess)
type alias Error = String
type Customers
= NotAsked
| Loading (Maybe Error) (Maybe (List Customer))
| Failure Error (Maybe (List Customer))
| Success (List Customer)
View logging.rb
require 'logger'
require 'fileutils'
require 'time'
require 'fiber'
module Logging
class Logger
View lb.rb
require 'thread'
state = {time:, status: "Flux Capacitor running"}
messages =
class TimeChange
attr_reader :time
def initialize(t)
@time = t
View chrome_sockets_link.rb
View chrome_sockets.rb
require 'socket'
def log(s)
puts "#{'%H:%M:%S')}: #{s}"
server ='', 1337)
loop do
socket = server.accept
View waiter.rb
class Waiter
def initialize
@m, @cv =,
@signalled = false
def wait
@m.synchronize{ @cv.wait(@m) until @signalled; @signalled = false }
def signal
@m.synchronize{ @signalled = true; @cv.signal }