Skip to content

Instantly share code, notes, and snippets.

View shamansir's full-sized avatar

Ulric Wilfred shamansir

View GitHub Profile
shamansir / Pairs.purs
Last active June 14, 2023 12:20
PureScript Records Pairing
module Data.Record.Pairs where
import Prelude
import Data.Symbol (class IsSymbol)
import Prim.RowList as RL
class Pairs (xsA :: RL.RowList Type) (xsB :: RL.RowList Type)
shamansir / purs-typeclasses.cue
Last active May 15, 2021 10:46
PureScript typeclasses in CUE -> JSON, for
plus: {
name: "Plus"
info: "Left and Right identity for Alt"
parent: "alt"
"package": "Control*"
{ name: "empty"
, def: "f a"
, laws : // FIXME: laws are incorrect
shamansir / FromHex.elm
Last active May 3, 2021 20:07
Color from Hex in Elm
module FromHex exposing (..)
import Color exposing (Color)
hexToColor : String -> Result String Color
hexToColor str =
digitToInt digit =
case digit of
shamansir / backloggery_load_games.js
Last active August 16, 2021 09:30
Load games list as JSON From Backloggery page
let games = Array.from(document.getElementsByClassName('gamebox'));
function loadTitle(gamebox) {
if (!gamebox) return null;
return gamebox.querySelector('h2 b') ? gamebox.querySelector('h2 b').textContent.trim() : null;
function isNowPlaying(gamebox) {
return gamebox.classList.contains('nowplaying');
shamansir /
Last active October 2, 2020 12:22
Installing video file as a screensaver on macOS

Based on this article:

The difference is that the Aerial Configuration screens shown there are outdated.

First, you need to prepare the video file so it would be visible to Aerial. Due to security.

  1. Create /Users/Shared/screensavers folder.
  2. Put a copy of your video file to /Users/Shared/screensavers.
  3. That should be enough.
shamansir / BinPack.elm
Created August 26, 2020 07:09
Elm 2D Bin Packing
module BinPack exposing (..)
import Browser
import Html exposing (Html, button, div, text, input)
import Html.Attributes as H exposing (..)
import Html.Events exposing (onClick)
import Random
import Svg exposing (..)
import Svg.Attributes as S exposing (..)
shamansir / Main.elm
Last active August 14, 2020 08:49
Elm program quick template
module Main exposing (..)
import Browser
import Html exposing (Html)
import Html as H
type alias Flags = ()
shamansir / Main.elm
Last active June 25, 2020 11:27
Elm parser loop example
module Main exposing (main)
import Browser
import Html exposing (Html, button, div, h2, input, text)
import Html.Attributes exposing (class, placeholder, value)
import Html.Events exposing (onClick, onInput)
import Parser exposing (..)
import Parser as P exposing (..)
module ComonadicUI.Component where
import Control.Comonad (Comonad(..))
import ComonadicUI.Pairing
import ComonadicUI.UI
type Component base w m a = w (UI base m a)
shamansir /
Created March 10, 2020 18:13
Image Magick MacOS X Preparation
# magick: set the correct path to libMagickCore.dylib
install_name_tool -change \
/ImageMagick-7.0.9/lib/libMagickCore-7.Q16HDRI.7.dylib \
@executable_path/../lib/libMagickCore-7.Q16HDRI.7.dylib \
# magick: set the correct path to libMagickWand.dylib
install_name_tool -change \
/ImageMagick-7.0.9/lib/libMagickWand-7.Q16HDRI.7.dylib \
@executable_path/../lib/libMagickWand-7.Q16HDRI.7.dylib \