Skip to content

Instantly share code, notes, and snippets.

View benkolera's full-sized avatar

Ben Kolera benkolera

  • biza.io
  • Brisbane, Australia
View GitHub Profile
@benkolera
benkolera / routes.hs
Last active February 25, 2019 00:18
Need to figure out how to get this route to work...
-- The problem is that I need to model the following routes:
-- * /profile/:username
-- * /profile/:username/favourites
--
-- And I'm a little stuck and I'm not sure whether it is my encoding of the routes,
-- that I'm missing an important combinator or Obelisk just doesn't handle this yet.
newtype Username = Username { unUsername :: Text } deriving (Eq, Ord, Show)
makeWrapped ''Username
@benkolera
benkolera / gist:55022bcf8f0f2634f01a505f3974bc08
Created January 31, 2019 00:01
Rhyolite and Vessel Notes
jbetz> is `rhyolite` for enabling the frontend to subscribe to backend events via web sockets? and has anyone outside of obsidian tried using it?
02:06 <Cale> jbetz: rhyolite is a bunch of partially-baked miscellaneous libraries which are at various levels of polish, but which we needed to open-source early for various reasons. Use it at your own risk, but please let us know if you find anything particularly good/bad if you do end up trying it out.
02:07 We've been breaking out pieces of it, taking off the sharp edges, and open sourcing them as separate libraries as time permits.
02:08 Rhyolite.Backend.App does contain something like what you described though
02:10 → mtesseract joined (~moritz@x5d8555ca.dyn.telefonica.de)
02:13 <jbetz> Cale: gotcha. I got curious when I started looking through obsidian's tezos projects.
02:18 also, I really like the idea of widget's subscribing to database queries. there's a clojure project called `precept` that pretty much does this. the database is just a graph of facts, wi
@benkolera
benkolera / clipboard.hs
Created January 23, 2019 03:18
Copy to clipboard
copyToClipboard elt doc = do
JsHtmlElement.focus elt
JsInput.select elt
JsDocument.execCommand_ doc ("copy"::String) False (Nothing::Maybe String)
pure ()
pkgs: self: super:
let
foo = ../../consumer-data-au-api-client;
upstreamOverrides = {
consumer-data-au-api-types = import ../../consumer-data-au-api-types/nix/consumer-data-au-api-types-overrides.nix;
consumer-data-au-api-client = import "${foo}/nix/consumer-data-au-api-client-overrides.nix";
};
bankOverrides = pkgs: self: super: {
consumer-data-au-api-types = self.callPackage (import ../../consumer-data-au-api-types/consumer-data-au-api-types.nix) {};
-- So I want to set up three machine, with two builder nodes having ssh access to the cache to be able
-- to copy closure to that cache machine so that nix-serve can serve up that binary cache so that both
-- builders have a common cache that they can push to and share. This is simulating the setup you may
-- want if you had an existing CI cluster but wanted to build things on it while having a cluster wide
-- cache.
let
pub = import ./nix-cache-key.pub;
sec = import ./nix-cache-key.sec;
builder = keyname: { config, nodes, pkgs, resources, lib, ... }: {
deployment.keys.privateKey = {
@benkolera
benkolera / treebutt.hs
Last active August 14, 2018 05:32
Makes a UI that allows you to add and remove elements from a tree. See https://www.youtube.com/watch?v=RQiMItSHYjw for it running
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE RecursiveDo #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Frontend where
import qualified Data.Text as T
import qualified Data.Text.Lazy as TL
{ nixpkgs ? import <nixpkgs> {} }:
with nixpkgs;
let
hpkgs = pkgs.haskell.packages.ghc843;
nlopt-new = hpkgs.mkDerivation {
pname = "nlopt-haskell";
version = "0.1.2.0";
src = fetchFromGitHub {
owner = "peddie";
repo = "nlopt-haskell";
{ nixpkgs ? import <unstable> {} }:
with nixpkgs;
let
hpkgs = pkgs.haskell.packages.ghc843;
nlopt-new = hpkgs.mkDerivation {
pname = "nlopt-haskell";
version = "0.1.2.0";
src = fetchFromGitHub {
owner = "peddie";
repo = "nlopt-haskell";
bkolera at bkolera in ~
$ cat /etc/nixos/configuration.nix
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
let
unstable = import <unstable> {};
sni = import ./lib/sni.nix;
@benkolera
benkolera / layout.svg
Created June 26, 2018 08:19
Keyboard.io layout with each key as a separate path... :)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.