I hereby claim:
- I am jonwolski on github.
- I am jonwolski (https://keybase.io/jonwolski) on keybase.
- I have a public key ASCptrwRuYFbPFz906nlT9A1N-OW0mZHUfWR9rdKKIKIuAo
To claim this, I am signing this object:
def server(form_response, test_response) | |
Proc.new {|env| | |
if env["REQUEST_METHOD"] == "POST" | |
[303, {"content-type" => "application/json", "location" => "http://localhost:8080/test" }, []] | |
elsif env["REQUEST_PATH"] == "/test" | |
[200, {"content-type" => "text/html"}, [test_response]] | |
else | |
[200, {"content-type" => "text/html"}, [form_response]] | |
end | |
} |
npm install --save express express-openid-connect |
-- TODO: Use a Map instead of a hard-coded Env | |
-- TODO: Lexical scoping for the `for` loop variables: Use a separate, but | |
-- chained Map for the loop counter (`i`) and mutate `k` from the 'global' | |
-- env | |
-- TODO: move `for` to a module | |
-- TODO: find a cleaner syntax than lambda & record (`\env -> i env`) | |
import System.Environment (getArgs) | |
import Data.Maybe (listToMaybe) |
I hereby claim:
To claim this, I am signing this object:
errors = '{ "errors": [{"detail": "no can haz" }]}' | |
run Proc.new {|env| [401, {"content-type" => "application/json"}, [errors]]} |
require 'holidays' | |
easter_of_year = -> year { | |
Holidays.between( | |
Date.civil(year, 1, 1), | |
Date.civil(year+1, 1, 1), | |
:us, :informal) | |
.select {|h| h[:name] == "Easter Sunday"} | |
} | |
easter_of_year[2030] # [{:date=>#<Date: 2030-04-21 ((2462613j,0s,0n),+0s,2299161j)>, :name=>"Easter Sunday", :regions=>[:us]}] |
package main | |
import ( | |
"io" | |
"net/http" | |
) | |
func hello(w http.ResponseWriter, r *http.Request) { | |
io.WriteString(w, "Hello World!") | |
} |
One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.
Most workflows make the following compromises:
Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure
flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.
Use production SSL certificates locally. This is annoying
(2..100).reduce(0) {|acc, i| (i.even? ? -1.0 : 1.0)/i + acc } |
{ | |
"baz": 1, | |
"foo": { | |
"bar": [ | |
"zero", | |
"one", | |
{ | |
"a": 1, | |
"b": [ | |
"red", |