Skip to content

Instantly share code, notes, and snippets.

View crosstyan's full-sized avatar

Crosstyan crosstyan

View GitHub Profile
@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.
@jpoehls
jpoehls / mklink.psm1
Created June 7, 2012 19:40
Native PowerShell wrapper for MKLINK.
@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]))
@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 -
@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
@kapkaev
kapkaev / gist:4619127
Created January 24, 2013 09:30
MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error. Resque
$ redis-cli
> config set stop-writes-on-bgsave-error no
@Starefossen
Starefossen / vim-cheats.md
Last active April 16, 2025 12:53
My vim cheat sheet for working with tabs and window splits.

Tabs

New Tab

  • :tabnew - new blank tab
  • :tabedit [file] - open file in tab

Cursor Movement

  • gt (:tabn) - next tab
@polarity
polarity / javascript.partial.markdown
Last active July 10, 2024 21:18
# Functional Programming Javascript: using Partials

Functional Programming Javascript: using Partials

Partials are basically functions that return functions with some already predefined arguments and need some arguments to be completed. Let's say you have a function with several arguments to be set, but you don't want to set the majority of arguments over and over again because you need it more than once.

# my useless function to write something to the dom
function writeSomethingToDom(element, content){
	element.append(content);
}

# use the function repeatedly 
@samvasko
samvasko / makefile
Created April 7, 2014 09:37
Makefile for building keil projects
# Makefile for building keil projects
KEIL=wine "/home/bliker/.wine/drive_c/Keil/UV4/UV4.exe"
TMP=/tmp/keil.out
NULL=/dev/null
# Will prevent it from exiting even when somehing failied
build:
-@$(KEIL) -j0 -b -o $(TMP) *.uvproj 2> $(NULL);
@cat $(TMP)