Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View barthr's full-sized avatar
🎯
Focusing

Bart barthr

🎯
Focusing
View GitHub Profile
@barthr
barthr / vector.go
Last active May 1, 2017 10:30
Vector class for golang
package statistic
import "math"
type Vector []float64
func (v Vector) Equal(other Vector) bool {
if other == nil || v == nil {
return false
}
// Exercise 1
let isLeap (year:int) :bool =
year % 4 = 0 && year % 100 <> 0 || year % 400 = 0
// Exercise 3
let rec map mapFn list =
match list with
| [] -> []
| x::xs -> [mapFn x] @ map mapFn xs
@barthr
barthr / Interpreter.fs
Created April 16, 2017 21:23
Interpreter of small Assembly machine
module SVM.Interpreter
type ProgramState =
{
ProgramCounter:int
Memory: list<(int * SVMAST.Literal)>
Registers: Map<string, SVMAST.Literal>
Labels: Map<string, int>
}
@barthr
barthr / errors.go
Last active November 17, 2016 13:16
Persit errors golang
package errorstore
import "github.com/boltdb/bolt"
var (
errName = []byte("error")
)
type ErrorPersistance interface {
SetError(key, value string)
package main
import (
"encoding/json"
"io/ioutil"
"log"
"net/http"
)
var items = []string{}
@barthr
barthr / ticketswap.js
Last active August 27, 2019 10:54
Javascript Ticketswap crawler
var current = window.location.href;
var party_url = "";//Typ hier je Feest url
var base_url = "https://www.ticketswap.nl";
$( document ).ready(function() {
if (current.indexOf("event") > -1) {
refreshPage();
}
else if (current.indexOf("listing") > -1){
orderCard();