Skip to content

Instantly share code, notes, and snippets.

@pissang
pissang / echarts-svg.js
Last active March 2, 2024 15:27
Server side SVG rendering of ECharts
const echarts = require("echarts");
const Canvas = require('canvas');
const {JSDOM} = require('jsdom');
const fs = require('fs');
echarts.setCanvasCreator(() => {
return new Canvas(100, 100);
});
const {window} = new JSDOM();
global.window = window;
@Icelandjack
Icelandjack / Constraints.org
Last active April 2, 2024 20:22
Type Classes and Constraints

Reddit discussion.

Disclaimer 1: Type classes are great but they are not the right tool for every job. Enjoy some balance and balance to your balance.

Disclaimer 2: I should tidy this up but probably won’t.

Disclaimer 3: Yeah called it, better to be realistic.

Type classes are a language of their own, this is an attempt to document features and give a name to them.

function docker-compose() {
if ($pwd.Path.StartsWith('C:\Users')) {
$projectName = Split-Path "$pwd" -leaf
$dockerPath = "/c" + $($($pwd -replace "^[a-z]:(.*)$",'$1') -replace "\\","/")
$dockerCmd = "docker run -v $dockerPath" + ":/$dockerPath -w $dockerPath -v /var/run/docker.sock:/var/run/docker.sock -e COMPOSE_PROJECT_NAME=$projectName -ti --rm dduportal/docker-compose:latest $args"
Write-Host $dockerCmd
Invoke-Expression $dockerCmd
} else {
Write-Error 'You must be under C:\Users, otherwise fileshare to boot2docker will not work!'
}
@nkpart
nkpart / Err.hs
Last active August 20, 2022 01:20
Lens, Prisms, and Errors.
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fwarn-missing-methods #-}
module Err where
import Control.Lens
import Control.Monad.Error
import Control.Monad.Error.Lens
-- Here is a fairly typical situation, where we have low level errors in certain
@folone
folone / gist:6089236
Last active October 10, 2020 18:26
Table of unicode operators in scalaz 6.0.x
@sebastiaanvisser
sebastiaanvisser / g1.hs
Created May 29, 2013 08:36
Composing algebras using Arrow and Applicative.
{-# LANGUAGE GADTs, TypeOperators, TupleSections #-}
module Generics.Algebra where
import Control.Category
import Control.Arrow
import Control.Applicative
import Prelude hiding ((.), id)
import Generics.Combinator