Skip to content

Instantly share code, notes, and snippets.

@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
@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
@jtobin
jtobin / fix-free-cofree.hs
Created December 9, 2015 06:13
Fix, Free, and Cofree
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE UndecidableInstances #-}
import Prelude hiding (succ)
newtype Fix f = Fix (f (Fix f))
deriving instance (Show (f (Fix f))) => Show (Fix f)
@daig
daig / App.hs
Last active June 27, 2017 19:14
Elm/Flux style Component Architecture for Reflex-Dom
{-# LANGUAGE OverloadedStrings #-}
module App where
import Component
import Notes
import Reflex.Dom
import Data.Semigroup ((<>))
app :: MonadWidget t m => m ()
app = do
add <- (BlankNote <$) <$> button "New Note"
# https://mail.haskell.org/pipermail/ghc-devs/2017-July/014364.html
# https://downloads.haskell.org/~ghc/8.2.1-rc3/
# http://taylor.fausak.me/2017/05/17/testing-ghc-release-candidates-with-stack/
compiler: ghc-8.2.0.20170704
compiler-check: match-exact
resolver: ghc-8.2.0.20170704
setup-info:
ghc:
@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
@star-szr
star-szr / Custom.css
Created September 27, 2011 17:45
IR_Black Theme (with sidebar and view-source colors) for Chrome Developer Tools
/**********************************************/
/*
/* IR_Black Skin by Ben Truyman - 2011
/*
/* Based on Todd Werth's IR_Black:
/* http://blog.toddwerth.com/entries/2
/*
/* Inspired by Darcy Clarke's blog post:
/* http://darcyclarke.me/design/skin-your-chrome-inspector/
/*
@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
@divarvel
divarvel / continuation.js
Last active May 11, 2018 08:57
Continuation monad in JS. just run $ node continuation.js
console.log("\033[39mRunning tests…");
function assertEquals(actual, expected, description) {
if(typeof(actual) === "undefined") {
console.error("\033[31m" + description + " not implemented\033[39m");
} else {
if(actual !== expected) {
console.error("\033[31m" + description + " failed, expected " + expected + ", got " + actual + "\033[39m");
} else {
console.log(description + " \033[32m ok\033[39m");
}