Skip to content

Instantly share code, notes, and snippets.

View cideM's full-sized avatar

Florian Beeres cideM

View GitHub Profile
@cideM
cideM / fuzzy.lua
Created September 10, 2020 18:49
Lua Neovim Fuzzy Finder Experiment
local a = vim.api
local test_data = { "foo", "bar", "bax" }
local test_options = {
height = 75,
width = 100,
relative = "editor",
anchor = "NW",
style = "minimal",
{
description = "Nix. All. The. Things.";
inputs = {
home-manager = {
url = "github:rycee/home-manager";
inputs.nixpkgs.follows = "/unstable";
};
nixpkgs = {
# 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, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
@cideM
cideM / Main.purs
Last active October 20, 2020 17:29
module Main where
import Prelude
import Effect (Effect)
import Control.Monad.Except.Trans (throwError)
import Effect.Console (log)
import Control.Alt ((<|>))
import Data.Generic.Rep as GR
import Foreign (Foreign, ForeignError(..), fail)
import Foreign as Foreign
@cideM
cideM / example.hs
Created December 7, 2020 16:47
Problem with `fgl` in Haskell
#! /usr/bin/env nix-shell
#! nix-shell -p "haskellPackages.ghcWithPackages (pkgs: with pkgs; [fgl])" -i "runghc -Wall"
{-# LANGUAGE ScopedTypeVariables #-}
import qualified Data.Graph.Inductive.Graph as G
import qualified Data.Graph.Inductive.NodeMap as GM
import Data.Graph.Inductive.PatriciaTree (Gr)
type Graph = Gr String Integer
#! /usr/bin/env nix-shell
#! nix-shell -p "haskellPackages.ghcWithPackages (pkgs: with pkgs; [scotty text relude co-log])" -i "runghc -Wall"
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PatternSynonyms #-}
@cideM
cideM / foo
Created January 7, 2021 10:24
Nix Shell With Specific GHC Version
$ nix-env -f "<nixpkgs>" -qaP -A haskell.compiler
haskell.compiler.ghc8101 ghc-8.10.1
haskell.compiler.integer-simple.ghc8101 ghc-8.10.1
haskell.compiler.ghc8102 ghc-8.10.2
haskell.compiler.integer-simple.ghc8102 ghc-8.10.2
haskell.compiler.ghc8102Binary ghc-8.10.2-binary
haskell.compiler.ghc8102BinaryMinimal ghc-8.10.2-binary
haskell.compiler.integer-simple.ghc8103 ghc-8.10.3
haskell.compiler.ghc8103 ghc-8.10.3
haskell.compiler.native-bignum.ghcHEAD ghc-8.11.20200824
@cideM
cideM / foo.js
Last active March 12, 2021 10:12
const vanillaFn = (notes) => {
const grouped = {};
notes.forEach((note) => {
const {
author: { id: currentId },
content,
section,
} = note;
if (!grouped[section]) grouped[section] = { len: 0, data: {} };
echo '[{"name":"v1.22.10","zipball_url":"https://api.github.com/repos/yarnpkg/yarn/zipball/v1.22.10","tarball_url":"https://api.github.com/repos/yarnpkg/yarn/tarball/v1.22.10","commit":{"sha":"785cda8020aa5f513d6f60b8349bca8dab9dd79b","url":"https://api.github.com/repos/yarnpkg/yarn/commits/785cda8020aa5f513d6f60b8349bca8dab9dd79b"},"node_id":"MDM6UmVmNDk5NzA2NDI6cmVmcy90YWdzL3YxLjIyLjEw"}]' | tr ',' '\n' | awk -F'":"' '{ version;
gsub(/"/, "", $2)
if ($1 ~ /name/ ) { version = $2 }
if ($1 ~ /tarball/) { gsub(/v/, "", version); print version, $2 } }'
echo '[{"name":"v1.22.10","zipball_url":"https://api.github.com/repos/yarnpkg/yarn/zipball/v1.22.10","tarball_url":"https://api.github.com/repos/yarnpkg/yarn/tarball/v1.22.10","commit":{"sha":"785cda8020aa5f513d6f60b8349bca8dab9dd79b","url":"https://api.github.com/repos/yarnpkg/yarn/commits/785cda8020aa5f513d6f60b8349bca8dab9dd79b"},"node_id":"MDM6UmVmNDk5NzA2NDI6cmVmcy90YWdzL3YxLjIyLjEw"}]' | tr ',' '\n' | awk -F'":"' '{ version; gsub(/"/, "", $2); if ($1 ~ /name/ ) { version = $2; } if ($1 ~ /tarball/) { gsub(/v/, "", version); print version, $2; } }'