Skip to content

Instantly share code, notes, and snippets.

@snoyberg
snoyberg / transformers.rs
Created December 2, 2020 08:39
Transformers: Rust in disguise
#![feature(generic_associated_types)]
trait Functor {
type Unwrapped;
type Wrapped<A>: Functor;
fn map<F, B>(self, f: F) -> Self::Wrapped<B>
where
F: FnOnce(Self::Unwrapped) -> B;
}
@dino-
dino- / string-conversions.hs
Last active May 26, 2024 02:17
A handy illustration of converting between String, Text and ByteString in Haskell
#! /usr/bin/env stack
-- stack --resolver lts-18.8 script
{-# LANGUAGE OverloadedStrings #-}
{-
This is a handy illustration of converting between five of the commonly-used
string types in Haskell (String, ByteString, lazy ByteString, Text and lazy
Text).
@neilmayhew
neilmayhew / Relativize.hs
Created August 17, 2018 21:27
Utility to make symlinks relative
import Control.Monad
import Data.Functor
import Numeric
import System.Directory (canonicalizePath)
import System.Environment
import System.FilePath
import System.IO
import System.Posix.Files
import Text.Printf
@mcgirr
mcgirr / GenStackScript.hs
Last active January 19, 2018 09:32
A Haskell stack script to generate stack scripts!
#!/usr/bin/env stack
{- stack
script
--resolver lts-8.22
--package http-conduit
--package aeson
--package text
--package unordered-containers
--package directory
-}
@martijnvermaat
martijnvermaat / nixos.md
Last active July 13, 2024 09:08
Installation of NixOS with encrypted root
@adham90
adham90 / spacemacs-keybindings
Last active April 5, 2024 14:24
spacemacs keybindings that i need to learn
SPC s c remove highlight
**** Files manipulations key bindings
Files manipulation commands (start with ~f~):
| Key Binding | Description |
|-------------+----------------------------------------------------------------|
| ~SPC f c~ | copy current file to a different location |
| ~SPC f C d~ | convert file from unix to dos encoding |
| ~SPC f C u~ | convert file from dos to unix encoding |

This is unmaintained, please visit Ben-PH/spacemacs-cheatsheet

Useful Spacemacs commands

  • SPC q q - quit
  • SPC w / - split window vertically
  • SPC w - - split window horizontally
  • SPC 1 - switch to window 1
  • SPC 2 - switch to window 2
  • SPC w c - delete current window
@mcgirr
mcgirr / emoji.rs
Created April 4, 2015 22:20
Print the martini Emoji 🍸 in the Rust programming language from a Unicode character code
fn main ()
{
let martini_emoji = '\u{1F378}';
println!("{}", martini_emoji);
}
@paf31
paf31 / 24days.md
Last active August 8, 2023 05:53
24 Days of PureScript

This blog post series has moved here.

You might also be interested in the 2016 version.