Skip to content

Instantly share code, notes, and snippets.

@alendit
alendit / hkt.ts
Created January 24, 2017 10:11
HKT in typescript don't work. But why?
interface Functor<F, A> {
map: <B>(this: Functor<F, A>, f: (a: A) => B) => Functor<F, B>
}
class Maybe<A> implements Functor<Maybe<A>, A> {
private constructor(public value: A) { }
static Nothing<A>() { return new Maybe<A>(undefined); }
static Just<A>(value: A) { return new Maybe<A>(value); }
map<B>(this: Maybe<A>, f: ((a: A) => B)): Maybe<B> {
@alendit
alendit / submission_downloader.py
Last active October 6, 2017 07:44
A downloader for moodle file submissions. Usage ./submission_downloader.py --token {token} --url {assignment_url}
#!/usr/bin/env python3
import argparse
import json
import os
import re
import sys
import urllib.error
import urllib.parse
import urllib.request
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
(defproject modern-cljs "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:source-paths ["src/cljs" "src/clj"]
:dependencies [[org.clojure/clojure "1.7.0"]
[org.clojure/clojurescript "1.7.48"]
[compojure "1.4.0"]]
:plugins [[lein-cljsbuild "1.1.0"]
@alendit
alendit / output.txt
Last active August 29, 2015 14:04
xdress compilation error (bug #259)
Error compiling Cython file:
------------------------------------------------------------
...
if isinstance(new_set, _SetUInt):
self.set_ptr = (<_SetUInt> new_set).set_ptr
elif isinstance(new_set, np.generic) and np.PyArray_DescrFromScalar(new_set).type_num == np.NPY_UINT32:
# scalars are copies, sadly not views, so we need to re-copy
if self.set_ptr == NULL:
self.set_ptr = new cpp_set[xdress_extra_types.uint32]()
@alendit
alendit / gist:774367e2eb1c411bc657
Last active August 29, 2015 14:01
The Internation 2014 Prize Pool Prediction
{
"metadata": {
"name": "",
"signature": "sha256:b3cc84a8e3da6c5df0957c9258a407f6a771ff218bad3cc6164a788167eedbc6"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [