Please see the regular repo.
(ns ical.core | |
(:require | |
[om.core :as om :include-macros true] | |
[om.dom :as dom :include-macros true] | |
[sablono.core :as html :refer-macros [html]])) | |
(enable-console-print!) | |
(def weekdays ["saturday" "monday" "tuesday" "wednesday" "thursday" "friday" "sunday"]) |
# based on http://api.rubyonrails.org/classes/ActionController/RequestForgeryProtection.html | |
module Auth | |
extend ActiveSupport::Concern | |
included do | |
helpers do | |
def session | |
env['rack.session'] | |
end |
""" | |
This script uses Github's API V3 with Basic Authentication to export issues from | |
a repository. The script saves a json file with all of the information from the | |
API for issues, comments, and events (on the issues), downloads all of the | |
images attached to issues, and generates a markdown file that can be rendered | |
into a basic HTML page crudely mimicking Github's issue page. If the gfm module | |
is available, the script will go ahead and render it itself. | |
In the end, you'll be left with a folder containing a raw .json file (which you | |
can use to extract information for your needs, or to import it somewhere else), |
State machines are everywhere in interactive systems, but they're rarely defined clearly and explicitly. Given some big blob of code including implicit state machines, which transitions are possible and under what conditions? What effects take place on what transitions?
There are existing design patterns for state machines, but all the patterns I've seen complect side effects with the structure of the state machine itself. Instances of these patterns are difficult to test without mocking, and they end up with more dependencies. Worse, the classic patterns compose poorly: hierarchical state machines are typically not straightforward extensions. The functional programming world has solutions, but they don't transpose neatly enough to be broadly usable in mainstream languages.
Here I present a composable pattern for pure state machiness with effects,
FROM nginx | |
HEALTHCHECK --interval=3s --retries=20 CMD curl -fs http://localhost:${HTTP_PORT:-8000} |
CREATE OR REPLACE FUNCTION generate_sequential_uuid(p_interval_length int DEFAULT 60) | |
RETURNS uuid | |
LANGUAGE plpgsql | |
AS $$ | |
DECLARE | |
v_i int; | |
v_time bigint; | |
v_bytes int[16] = '{}'; | |
v_hex text[16] = '{}'; | |
BEGIN |