Skip to content

Instantly share code, notes, and snippets.

what k4/k7 k9 example result
---------------------------------------------------------------------------------
each-left a f\:b a f\:b (!3)*\:!2 (0 0;0 1;0 2)
each-right a f/:b a f/:b (!3)*/:!2 (0 0 0;0 1 2)
fold f/v f/v */6 7 42
fold w/initial a f/v a f/v 7*/11 13 1001
scan f\v f\v -\1 1 1 1 0 -1
scan w/initial a f\v a f\v 3-\1 1 1 2 1 0
@tomhicks
tomhicks / plink-plonk.js
Last active March 18, 2024 02:23
Listen to your web pages
@rosszurowski
rosszurowski / un-country-centroids.json
Last active February 18, 2022 15:32
A compiled list of coordinates for all 193 countries in the UN. Compiled from this list of UN members (https://en.wikipedia.org/wiki/Member_states_of_the_United_Nations#Current_members), and this list of country centroids (http://gothos.info/resources/).
[
{ "name": "Afghanistan", "lat": 33, "long": 66 },
{ "name": "Albania", "lat": 41, "long": 20 },
{ "name": "Algeria", "lat": 28, "long": 3 },
{ "name": "Andorra", "lat": 42.5, "long": 1.5 },
{ "name": "Angola", "lat": -12.5, "long": 18.5 },
{ "name": "Antigua and Barbuda", "lat": 17.05, "long": -61.8 },
{ "name": "Argentina", "lat": -34, "long": -64 },
{ "name": "Armenia", "lat": 40, "long": 45 },
{ "name": "Australia", "lat": -25, "long": 135 },
@jcushman
jcushman / example.sql
Created February 9, 2017 19:40
Store JSON history with the fast-json-patch library and Postgresql triggers
-- Enable pl/v8:
CREATE EXTENSION plv8;
-- Create json history table:
CREATE TABLE json_history (id BIGSERIAL PRIMARY KEY, tstamp timestamp DEFAULT now(), table_name text, column_name text, target_id bigint, transform json);
-- Create test table:
CREATE TABLE test_json (id BIGSERIAL PRIMARY KEY, data JSON);
-- Enable history tracking on test_json.data:
@dennisreimann
dennisreimann / Main.elm
Last active April 2, 2024 20:17
A reaction to the article "A small dive into, and rejection of, Elm"
{-
This file is a reaction to the article "A small dive into, and rejection of, Elm":
https://hackernoon.com/a-small-dive-into-and-rejection-of-elm-8217fd5da235#.9w3ml4r6b
I think constructive criticism is very welcome in the Elm community. Pointing out
possibilities for documentation improvements, mentioning missing features or ways
in which the language could evolve etc. are imho a vital part of a good community.
However, the article above is neither well informed nor constructive. IMHO ranting
@Tehnix
Tehnix / brew-up-system.sh
Last active December 7, 2023 18:55
Set up OS X with brew
#!/bin/sh
binaries=(
awscli
trash
tree
git
mosh
tmux
screen
zsh
@evancz
evancz / Focus.md
Last active March 3, 2017 14:58
Potential outline of a simple and useful lens library for Elm

Focus

A Focus is a way to work with particular parts of a large chunk of data. On the most basic level, it lets you get and set fields of a record in a simple and composable way. This means you could avoid writing special record update syntax and use something that composes much more elegantly.

This API is inspired by the concept of Bidirectional Lenses as described by Nate Foster and seen in a modified form in Haskell as "lenses" and in ClojureScript as "cursors". My personal opinions and understanding comes from this talk by Simon Peyton Jones, discussions with @seliopou, and a basic understanding of Nate Foster's PhD thesis on bidirectional lenses. I chose the name "Focus" for this outline because it is sort of like a lens that only lets you see in one direction.

Here's the pseudocode that describes the basic API:

modul