Skip to content

Instantly share code, notes, and snippets.

View bananu7's full-sized avatar
🏍️

Bartek Banachewicz bananu7

🏍️
View GitHub Profile
package com.company;
abstract class A {
public abstract void hello();
}
abstract class B extends A {
}
class C extends B {
@bananu7
bananu7 / log.txt
Created January 7, 2016 19:24
Build log for a problematic CircleCI container
Using a sandbox located at /home/ubuntu/Hate/.cabal-sandbox
/opt/alex/3.1.3/bin/alex --version
/usr/bin/gcc -dumpversion
/opt/ghc/7.10.2/bin/haddock --version
/opt/happy/1.19.3/bin/happy --version
/opt/ghc/7.10.2/bin/hpc version
looking for tool hsc2hs near compiler in /opt/ghc/7.10.2/bin
found hsc2hs in /opt/ghc/7.10.2/bin/hsc2hs
/opt/ghc/7.10.2/bin/hsc2hs --version
/opt/ghc/7.10.2/bin/ghc -c /tmp/1804289383846930886.c -o /tmp/16816927771714636915.o
@bananu7
bananu7 / WeakMap.js
Last active November 25, 2015 15:14
function WeakMap() {
this.keys = [];
this.values = [];
}
WeakMap.prototype.set = function set(k, v) {
// look for existing keys first
for (var kI = 0; kI < this.keys.length; kI++) {
if (this.keys[kI] === k) {
this.values[kI] = v;
return;
//if (hljs) console.log("HLJS OK");
function messageObserverCb(evts) {
evts.forEach(function(evt) {
for (var i = 0; i < evt.addedNodes.length; i++) {
var monologueMsg = evt.addedNodes[i];
if (!monologueMsg) return;
// for each added message in a monologue, colour its blocks
-- non-lens version (BROKEN)
addNativeFunction :: String -> FunctionData -> Context -> Context
addNativeFunction name fn ctx = newCtx
where
newRef :: FunctionRef
newRef = (\(FunctionRef i) -> FunctionRef (i+1)) $ fst $ Map.findMax (functions ctx)
ctxWithNewRef = ctx { functions = Map.insert newRef fn (functions ctx) }
insertNewValue :: TableData -> TableData
insertNewValue (TableData td) = TableData $ Map.insert (Str name) (Function newRef) td
@bananu7
bananu7 / MonadST.hs
Created September 24, 2015 06:46
ST monad example
import Control.Monad
import Control.Monad.ST
import Data.STRef
imperativeSum :: Num a => [a] -> a
imperativeSum xs = runST $ do
n <- newSTRef 0 -- Create an STRef (place in memory to store values)
forM_ xs $ \x -> do -- For each element of xs ..
modifySTRef n (+x) -- add it to what we have in n.

###Factorio rules

  1. Don't be a dick
  2. The player that hosts has to retrieve the most recent save and remember to replace it with the new one when everything has ended
  3. Destroying of any property requires consent to those that put it down

###Signed players

#Lounge Game Marmalade Rules

Organisatorial

  • The event takes place on 22 March 2015 between 17:00 and 23:00 UTC.
  • Participants may be individuals or teams of two.
  • 24 hours before the start of the event, three themes are picked randomly. Each participant has to incorporate two of those themes in their entry.
  • Each participant must have their entry published on a publicly available source code repository when the event ends.
  • Each entry must be accompanied by a description of its contents, including any build/run/play instructions that might be required.
static const char * const floppy_xpm[] = {
"32 32 4 1",
". c #FFFFFF",
"+ c #4750C8",
"@ c #FF0000",
"# c #FF00FF",
"................................",
".++++.@@@@@@@@@@@@@@@@@@@@.++++.",
".+..+.@@@@@@@@@@@@@@@@@@@@.++++.",
".+..+......................++++.",
@bananu7
bananu7 / HaskellState.md
Last active August 29, 2015 14:15
Cheat sheet - state in haskell

Simple, opaque/plain state

A regular function

fn :: Int -> Int
fn x = x + 1

A monad with state used directly

fnM :: State Int ()