Skip to content

Instantly share code, notes, and snippets.

@stepheneb
stepheneb / .block
Created Feb 18, 2020 — forked from mbostock/.block
Pan & Zoom Axes
View .block
license: gpl-3.0
View myChompUntil.elm
module ChompUntilAfter exposing (myChompUntil)
import Parser.Advanced as A exposing ((|.), (|=))
type alias Parser a =
MyParser Never Problem a
type Problem
View Decode2.elm
module Decode2 exposing (Images, Part, Status(..), flags, images, jsonFlags, jsonStatus, jsonImages, jsonName, jsonPart, jsonParts, jsonPartInvalid, name, part, status)
import Json.Decode as D
-- Inspired by Joël Quenneville's article:
-- https://thoughtbot.com/blog/5-common-json-decoders
type alias Flags =
{ parts : List Part
@stepheneb
stepheneb / DecodeElmType.elm
Last active May 18, 2019
Decoding an Elm type from a json object
View DecodeElmType.elm
module DecodeElmType exposing (Status(..), json, statusDecoder, statusFieldToStringDecoder, statusFromStringDecoder)
import Json.Decode exposing (..)
type Status
= Queued
| Started
| Complete
View gist:d22be73a1bb3a3a58ff717528b6e769e
% git clone git@github.com:joshuaclayton/elm-ports-example.git
Cloning into 'elm-ports-example'...
remote: Enumerating objects: 251, done.
remote: Total 251 (delta 0), reused 0 (delta 0), pack-reused 251
Receiving objects: 100% (251/251), 126.73 KiB | 1.62 MiB/s, done.
Resolving deltas: 100% (87/87), done.
apps % cd elm-ports-example
elm-ports-example master % atom .
elm-ports-example master % yarn
yarn install v1.15.2
View pg_settings.txt
name | setting | short_desc
----------------------------------------+--------------------------------------------+-----------------------------------------------------------------------------------
allow_system_table_mods | off | Allows modifications of the structure of system tables.
application_name | psql | Sets the application name to be reported in statistics and logs.
archive_command | (disabled) | Sets the shell command that will be called to archive a WAL file.
archive_mode | off | Allows archiving of WAL files using archive_command.
archive_timeout | 0 | Forces a switch to the next WAL file if a new file has not been start
View pg_settings.html
<table border="1">
<tr>
<th align="center">name</th>
<th align="center">setting</th>
<th align="center">short_desc</th>
</tr>
<tr valign="top">
<td align="left">allow_system_table_mods</td>
<td align="left">off</td>
<td align="left">Allows modifications of the structure of system tables.</td>
@stepheneb
stepheneb / d3-doubleclick.js
Created Nov 1, 2018
double-clicking using D3.js in the browser
View d3-doubleclick.js
d3DomUIElement.on("click", clickAndDoubleClick(toggleSelectionHandler, selectAndStartEditingHandler));
clickAndDoubleClick = function(singlecallback, doublecallback) {
var f;
f = void 0;
return f = (function() {
var doubleclick, firstclick, g, t1, timer;
firstclick = true;
timer = null;
t1 = null;
@stepheneb
stepheneb / register-and-callback-when-available.js
Last active Jan 7, 2020
very simple javascript module dependency manager
View register-and-callback-when-available.js
// This simple module makes available a UUID generator created by Jeff Ward
//
// This module will be available under the global App.UUID
//
// After this module has completely loaded it registers itself so other modules that
// depend on it being present can wait until it is available to complete their startup.
**
* Fast UUID generator, RFC4122 version 4 compliant.
You can’t perform that action at this time.