Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
import sys
import bibtexparser
from bibtexparser.bparser import BibTexParser
FIELDS_TO_KEEP = {
'*': ['title', 'author', 'year', 'pages', 'ENTRYTYPE', 'ID'],
[
{ "keys": ["ctrl+q"], "command": "exit" },
{ "keys": ["ctrl+shift+n"], "command": "new_window" },
{ "keys": ["ctrl+shift+w"], "command": "close_window" },
{ "keys": ["ctrl+o"], "command": "prompt_open_file" },
{ "keys": ["ctrl+shift+t"], "command": "reopen_last_file" },
{ "keys": ["alt+o"], "command": "switch_file", "args": {"extensions": ["cpp", "cxx", "cc", "c", "hpp", "hxx", "hh", "h", "ipp", "inl", "m", "mm"]} },
{ "keys": ["ctrl+n"], "command": "new_file" },
{ "keys": ["ctrl+s"], "command": "save" },
<html>
<head>
<style media="screen" type="text/css">
#content {
margin-top: 2em;
font-size: 16pt;
font-family: monospace;
}
#nodes {
top: 0px;
module Evaluator where
--data Expr
-- = Lit Int
-- | Add Expr Expr
class ExprSym e where
lit :: Int -> e
add :: e -> e -> e
{-# language BangPatterns #-}
module Main where
import Criterion.Main
import System.Random
data Expr = Literal Int
| Add Expr Expr
| Var String
deriving (Eq, Show)
@mmakowski
mmakowski / EventSourcing1.hs
Last active August 29, 2015 14:04
EventSourcing1
module EventSourcing where
import Control.Monad.State
data Command = CreateToDoItemCommand { cmdTodoId :: String, cmdDescription :: String }
| MarkCompletedCommand { cmdTodoId :: String }
deriving (Eq, Ord, Show)
data Event = ToDoItemCreatedEvent { evtTodoId :: String, evtDescription :: String }
| ToDoItemCompletedEvent { evtTodoId :: String }
import java.util.concurrent.Executor
import scala.collection.mutable
import scala.concurrent._
import scala.util.{Success, Failure}
implicit val synchronousExecutionContext = ExecutionContext.fromExecutor(new Executor {
def execute(task: Runnable) = task.run()
})
@mmakowski
mmakowski / set.hs
Last active December 17, 2015 08:09
module Set where
import Control.Applicative
import Control.Monad.State
import Data.List
import Data.Maybe
import Data.Ord
import System.Random
data Colour = Red | Purple | Green deriving (Eq, Enum, Ord, Bounded, Show)
@mmakowski
mmakowski / sql.hs
Last active December 16, 2015 02:49
{-# LANGUAGE OverloadedStrings, FlexibleInstances #-}
module SQL where
import Control.Applicative
import Database.SQLite3
import Data.Function
import Data.Int
import Data.Text
dbname = "chinook.sqlite"
case class Env()
case class A(env: Env, b: B)
case class B()
trait Serialisation[T, U, -C] {
def serialised(obj: T): U
def deserialised(obj: U, context: C): T
}