Skip to content

Instantly share code, notes, and snippets.

View bananu7's full-sized avatar
🏍️

Bartek Banachewicz bananu7

🏍️
View GitHub Profile
@bananu7
bananu7 / monad.cpp
Created November 12, 2013 23:25
Monadz
#include <iostream>
#include <functional>
#include <memory>
using std::function;
using std::unique_ptr;
template<typename A>
class Maybe {
public:
import Control.Monad.State
data Field = Black | White | Empty deriving(Eq, Show)
type Board = [Field]
data Winner = PlayerBlack | PlayerWhite | NoOneYet deriving(Eq, Show)
nth :: Int -> Board -> Field
nth n = head . drop (n-1)
import Control.Monad.State
type Count = Int
--type Sum = Int
type MyState = State Count
n :: Float -> Float -> MyState Float
n x s = do
c <- get
import Control.Monad.State
import Control.Monad.Trans
f :: State Int Int
f = do
x <- get
let x' = x+1
put x'
return 0
--DECLARE @czas TABLE (czasid int)
CREATE TABLE #tempczas (czasid int)
INSERT INTO Czas (id,x)
OUTPUT INSERTED.id INTO #tempczas(czasid)
VALUES (2,5);
declare @czasid int
set @czasid = (select * from #tempczas)
void breaking() {
std::cout << "Nice!~\n";
}
std::tuple<double, double> breaking_multi() {
return std::make_tuple(567.2, 2.567);
}
struct a_type {
std::tuple<double, double> breaking_multi() {
@bananu7
bananu7 / Image.html
Last active November 6, 2020 02:51
Prototype of image processing tool.
<html>
<head>
<script>
function preloader() {
var img = new Image(); // Create new img element
img.addEventListener("load", function() {
var myWorker = new Worker("run.js");
@bananu7
bananu7 / parserkm.hs
Created January 12, 2014 20:56
A parser of simple typed sums
import Text.ParserCombinators.Parsec
import Text.Parsec.Numbers
data Value = Kilometer Double | Mile Double
value = try valKm <|> valMile
valKm, valMile :: GenParser Char st Value
@bananu7
bananu7 / canvas.js
Created January 21, 2014 00:57
Sample Haste compiler output
/* Thunk
Creates a thunk representing the given closure.
Since we want automatic memoization of as many expressions as possible, we
use a JS object as a sort of tagged pointer, where the member x denotes the
object actually pointed to. If a "pointer" points to a thunk, it has a
member 't' which is set to true; if it points to a value, be it a function,
a value of an algebraic type of a primitive value, it has no member 't'.
*/
function T(f) {

Vim Notes

Setup

The Vim on the server is horribly outdated. Many of the things below won’t work, or will require extensive setup. In order to ease the pain, I suggest using the version installed and maintained by Micha via the [EBI-predoc config][config].