Instantly share code, notes, and snippets.

View speedtest.hs
module Main where
import Data.List
f :: Int -> Int -> Int
f x y = x + (y * 2)
sum' :: [Int] -> Int
sum' = foldl' (+) 0
g :: Int -> Int
View upgrade_to_0.12.md

How to upgrade to Purescript 0.12

Before we begin, the type search in Pursuit is a great way to search for the functions you need.

Reset your tooling by deleting the bower_components/, .psci_modules/, .pulp-cache/, .psc-package/ and output/ folders. Then run psc-package build --only-dependencies.

Import changes and effects

Using sed or your other favourite global replace tool to search and replace all occurences in the list

View keybase.md

Keybase proof

I hereby claim:

  • I am Rembane on github.
  • I am eqroot (https://keybase.io/eqroot) on keybase.
  • I have a public key whose fingerprint is A05D 2DCD 038E 751E B1A1 DDDD 88AA 23B7 AEA5 8DCE

To claim this, I am signing this object:

View klapasnelhest.py
from collections import Counter
from operator import itemgetter
# Javascript för att hämta data från val.sverok.se.
# Array.from(document.querySelectorAll('#content > div > table > tbody > tr td:nth-child(4)')).map(x => x.textContent).join(', ')
# Resulterande data.
orter = "Skövde , Helsingborg  , Trollhättan , Ålberga , Upplands Väsby , Lövestad ,  , Göteborg , Nybro , Göteborg ,  ,  , Norrköping , Malmö ,  ,  , Hagfors ,  , Kalmar ,  , Kristinehamn  , Linköping , Göteborg  , Lindome , Krokom ,  ,  , Jönköping ,  ,  ,  , Göteborg , Lund , Göteborg ,  ,  , Göteborg , Malmö , Karlstad , Göteborg ,  ,  , Lund , Norrköping , Norrköping , Malmö , Jonkoping ,  , Malmö ,  ,  , Göteborg , Burträsk , Västervik , Visby , Sävar , Lund , Staffanstorp , Västerås , Göteborg ,  , Limhamn , Göteborg , Linköping ,  ,  ,  , Huskvarna  , Eskilstuna , Norrköping , Karlskrona , Linköping , Tyringe , Luleå , Göteborg , Farsta ,  , Stockholm ,  , UMEÅ , Ålberga , Lund ,  , Skövde ,  ,  , Genarp ,  , Malmö ,  , Rydsgård , Karlsh
View NiceHaskell.hs
runRandom :: State StdGen a -> IO a
runRandom x = do
g <- newStdGen
return $ evalState x g
View cosplaying_ints.c
#include <stdio.h>
int main() {
int x = 42;
int *p = &x;
printf("Value of the cosplayer: %d", p);
}
View get_and_group_photos.py
#!/usr/bin/env python3
import os
import os.path
import re
import subprocess
currdir = os.path.dirname(os.path.realpath(__file__))
picpattern = re.compile(r'(jpg|cr2)$', flags=re.IGNORECASE)
datepattern = re.compile(r'(\d{4}):(\d{2}):(\d{2})')
View FizzBuzz4.hs
module Main where
continue :: ([a] -> [b]) -> [a] -> [b]
continue _ [] = []
continue f (x:xs) = f (x:xs)
f1, f2, f3, b1, b2, b3, b4, b5 :: [Int] -> [(Bool, String)]
f1 (x:xs) = (False, show x):continue f2 xs
f2 (x:xs) = (False, show x):continue f3 xs
View msgorder.erl
-module(msgorder).
-compile(export_all).
% How to get messages in correct order, even though things outside of our
% control try to put them in a semi-random order.
f(T, X) ->
Parent = self(),
Ref = make_ref(),
spawn_link(fun() -> timer:send_after(T, Parent, {Ref, {T, X}}) end),
View threading_bla.py
import sys
from time import sleep
from threading import Thread
def communicator():
print('This does not print')
sys.stdout.flush()
while(True):
#frame.evaluateJavaScript('document.getElementById("footer").appendChild(document.createTextNode("Hejjibejj"));')
#fr.evaluateJavaScript('alert("Yo");')