Skip to content

Instantly share code, notes, and snippets.

@carwin
carwin / private.xml
Last active July 27, 2017 15:06
Programmer's Shift Keys: Remapping parens, brackets and braces for to because nerd.
<?xml version="1.0"?>
<root>
<item>
<name>Programmer's Shift Keys</name>
<!--
Author: Carwin Young (@carwin)
Last Updated: 2014.07.18
v.1.1
Programmer's Shift Keys
@kaspergrubbe
kaspergrubbe / youtube_get.sh
Created August 20, 2013 17:23
Get youtube music
# brew install youtube-dl
function youtube_music
{
$(youtube-dl -f 37/22/18 "$1" --extract-audio --audio-format mp3 | tee /dev/tty)
}
function youtube_video
{
$(youtube-dl -f 37/22/18 "$1" | tee /dev/tty)
@bos
bos / AesonPlayground.hs
Last active October 18, 2016 13:56
A proof-of-concept of a new approach to encoding JSON values for aeson.
{-# LANGUAGE GeneralizedNewtypeDeriving, FlexibleInstances,
OverloadedStrings #-}
import Data.Monoid (Monoid(..), (<>))
import Data.String (IsString(..))
import Data.Text (Text)
import Data.Text.Lazy.Builder (Builder, singleton)
import qualified Data.Text.Lazy.Builder as Bld
import qualified Data.Text.Lazy.Builder.Int as Bld
@ToJans
ToJans / InventoryItems.hs
Last active January 19, 2024 10:47
Haskell implementation of Greg Young's CQRS sample: https://github.com/gregoryyoung/m-r Love the sheer elegance of Haskell; no need for all that infrastructure crap
module InventoryItems(Command(..), Event(..), handle) where
import Data.Maybe(isJust)
type Id = String
type Name = String
type Amount = Int
data Command = CreateInventoryItem Id
| RenameInventoryItem Id Name
@tolysz
tolysz / Synacor.hs
Created January 13, 2014 14:30
Some solution, still debug or (de)compile are missing.
{-# LANGUAGE LambdaCase #-}
module Main where
import qualified Data.IntMap.Strict as M
import Data.Word
import Data.Char
import Control.Applicative
import Control.Monad
import Control.Monad.Trans.State.Lazy
module Printf
%default total
data Format = FInt Format -- %d
| FString Format -- %s
| FOther Char Format -- [a-zA-Z0-9]
| FEnd --
format : List Char -> Format
@mikkeloscar
mikkeloscar / guide.md
Created June 14, 2014 20:44
Setup armv7h chroot under x86_64 host (Archlinux/Archlinuxarm biased)

Setup armv7h chroot under x86_64 host (Archlinux/Archlinuxarm biased)

Simple way to setup an arm chroot for building packages for your arm devices. This is an alternative to cross-compiling where you are limited to only linking against the libs in your toolchain.

Setup chroot-fs

You can store the chroot wherever you like. I choose to store it in a disk-image which I mount to my filesystem.

@staltz
staltz / introrx.md
Last active April 25, 2024 04:18
The introduction to Reactive Programming you've been missing
@chrisbuttery
chrisbuttery / 1.js
Last active April 6, 2024 16:10
Fade in / Fade out
// fade out
function fade(el) {
var op = 1;
var timer = setInterval(function () {
if (op <= 0.1){
clearInterval(timer);
el.style.display = 'none';
}
el.style.opacity = op;
@joefiorini
joefiorini / rails.nix
Created September 18, 2014 06:16
Nix Expression for Running Rails Apps
with (import <nixpkgs> {});
stdenv.mkDerivation {
name = "717-app";
buildInputs = [ libiconv openssl ruby21 postgresql git nodejs ];
src = "/src/717";
builder = builtins.toFile "builder.sh" ''
set -e
source $stdenv/setup