Skip to content

Instantly share code, notes, and snippets.

View bananu7's full-sized avatar
🏍️

Bartek Banachewicz bananu7

🏍️
View GitHub Profile
@bananu7
bananu7 / SO_Answer_21851338.md
Last active August 29, 2015 13:56
Answer to a closed question #21851338

Describing what was the real problem was really helpful, because it helps someone debugging to narrow down the code issue.

I'd like to experiment, if you don't mind and write my answer from my point of view, not from the point of your solution.

1. First code analysis

It looked rather okay and was properly formatted. I found the labirynth description to be extremely unreadable, so I simply broke it up in lines:

char maze[110] =

"|.|________\n"

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].

@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) {
@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 / 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");
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() {
--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)
import Control.Monad.State
import Control.Monad.Trans
f :: State Int Int
f = do
x <- get
let x' = x+1
put x'
return 0
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
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)