Skip to content

Instantly share code, notes, and snippets.

View crosstyan's full-sized avatar

Crosstyan crosstyan

View GitHub Profile
@tcsavage
tcsavage / MonadTransformersExample.hs
Last active March 25, 2022 19:44
Example of ReaderT monad transformer
module Main where
import Control.Monad (replicateM)
import Control.Monad.Trans (lift)
import Control.Monad.Reader (ReaderT, ask, runReaderT)
import Control.Monad.Random (Rand, getRandomR, evalRand)
import System.Random (getStdGen, StdGen)
import Text.Printf
op :: ReaderT Int (Rand StdGen) String
@BigglesZX
BigglesZX / gifextract.py
Created November 5, 2012 10:31
Extract frames from an animated GIF, correctly handling palettes and frame update modes
import os
from PIL import Image
'''
I searched high and low for solutions to the "extract animated GIF frames in Python"
problem, and after much trial and error came up with the following solution based
on several partial examples around the web (mostly Stack Overflow).
There are two pitfalls that aren't often mentioned when dealing with animated GIFs -
@ckirkendall
ckirkendall / A-sum-higher-kinds.clj
Created June 19, 2012 22:12 — forked from bkyrlach/GenericVersion.scala
Polymorphism - Summation of Higher Kinds(Clojure, Ocaml, Haskell, Scala, Java).
(defrecord Tree [left elm right])
(defprotocol Monoid
(append [a b] )
(identity [a] ))
(defprotocol Foldable
(foldl [l f i])
(mfirst [l]))
@jpoehls
jpoehls / mklink.psm1
Created June 7, 2012 19:40
Native PowerShell wrapper for MKLINK.
@ghoseb
ghoseb / ns-cheatsheet.clj
Last active March 25, 2025 21:21 — forked from alandipert/ns-cheatsheet.clj
Clojure ns syntax cheat-sheet
;;
;; NS CHEATSHEET
;;
;; * :require makes functions available with a namespace prefix
;; and optionally can refer functions to the current ns.
;;
;; * :import refers Java classes to the current namespace.
;;
;; * :refer-clojure affects availability of built-in (clojure.core)
;; functions.