This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module AuthRequestHelper | |
| def http_auth_as(username, password, &block) | |
| @env = {} unless @env | |
| old_auth = @env['HTTP_AUTHORIZATION'] | |
| @env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials(username, password) | |
| yield block | |
| @env['HTTP_AUTHORIZATION'] = old_auth | |
| end | |
| def auth_get(url, params={}, env={}) |
A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."
- Does the design expect failures to happen regularly and handle them gracefully?
- Have we kept things as simple as possible?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (comment ; Fun with transducers, v2 | |
| ;; Still haven't found a brief + approachable overview of Clojure 1.7's new | |
| ;; transducers in the particular way I would have preferred myself - so here goes: | |
| ;;;; Definitions | |
| ;; Looking at the `reduce` docstring, we can define a 'reducing-fn' as: | |
| (fn reducing-fn ([]) ([accumulation next-input])) -> new-accumulation | |
| ;; (The `[]` arity is actually optional; it's only used when calling | |
| ;; `reduce` w/o an init-accumulator). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module AuthHelper | |
| def http_login | |
| user = 'username' | |
| pw = 'password' | |
| request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials(user,pw) | |
| end | |
| end | |
| module AuthRequestHelper | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| D [0-9] | |
| L [a-zA-Z_] | |
| H [a-fA-F0-9] | |
| E ([Ee][+-]?{D}+) | |
| P ([Pp][+-]?{D}+) | |
| FS (f|F|l|L) | |
| IS ((u|U)|(u|U)?(l|L|ll|LL)|(l|L|ll|LL)(u|U)) | |
| %{ | |
| #include <stdio.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; Datomic example code | |
| (use '[datomic.api :only (db q) :as d]) | |
| ;; ?answer binds a scalar | |
| (q '[:find ?answer :in ?answer] | |
| 42) | |
| ;; of course you can bind more than one of anything | |
| (q '[:find ?last ?first :in ?last ?first] | |
| "Doe" "John") |
NewerOlder