Skip to content

Instantly share code, notes, and snippets.

View kmltml's full-sized avatar

Kamil Tomala kmltml

View GitHub Profile
from dimacs import *
from itertools import combinations
from os import path
graph_names = [
"m20", "p20", "m30", "r30_01", "r30_05", "p35", "m40", "m50", "r50_001", "r50_01", "r50_05", "p60",
"s500", "e5", "e10", "e20", "e40",
"s25", "s50",
"b20", "b30",
"b100", "m100", "r100_005",
$(document).ready(function(){
//The text inserter/scroller and the counter begin here.
//These are needed later.
oldlines = 0;
chars = 0;
//This listens for a node (line) to be inserted.
document.addEventListener("DOMNodeInserted", function (e) {
{-# LANGUAGE FlexibleInstances, FlexibleContexts #-}
module Kinds where
import Control.Monad.State
import Control.Monad.Except
import Data.List(intercalate)
import Data.Maybe(fromJust)
type VarId = Int
@kmltml
kmltml / funDB.md
Last active January 24, 2017 22:22
  • Case sensitive
  • Haskell-like syntax
  • Maybe type inference?
  • Infix table combinator functions? (Table filter predicate)

--- SQL ---

SELECT * FROM USERS
(data (List a)
(:: a (List a))
(Nil))
(def ;(-> a (-> a b a) (List b) a)
(foldl i _ Nil) i
(foldl i f (:: h t)) (foldl (f i h) f t))
(def ; (=> ((Numeric a)) (-> a a (List a)))
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>14</title>
<script src="14.js">
</script>
<style>
#name, #surname { border: 1px solid black; }
#define R 1.1
float wave(in vec2 uv, in vec2 center, in float radius) {
vec2 s = uv - center;
float r = length(s);
float h = sin(r * 50.0 + float(iFrame) / 10.0) * 0.1 * (radius - r);
if(r >= radius)
return 0.0;
else
return h;
With scala function of:
@struct
class Foo(val _0: Int, val _1: Int, val _2: Int, val _3: Int, val _4: Int)
// More than 16 bytes
def test(foo: Foo): Unit = {
...
}
it has to be converted to following signature
package demo
import demo.clang.CXCursorKind
import scala.scalanative.native._
/**
* Created by Kamil on 19.06.2016.
*/
@extern
function readFully(req: http.IncomingMessage, cont: (data: string) => void) {
var buffer = ""
req.on("data", data => {
console.log(`got data package: ${data}`)
buffer += data
})
req.on("end", () => {
cont(buffer)
})
}