Skip to content

Instantly share code, notes, and snippets.

Eyal Lotem Peaker

Block or report user

Report or block Peaker

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View faults.py
from contextlib import contextmanager
@contextmanager
def injected_fault(params):
fault_manager.inject(params)
try:
yield
finally:
fault_manager.clear(params)
@Peaker
Peaker / output.js
Last active Feb 25, 2016
With slow wrapping...
View output.js
var o = Object.freeze;
var logResult = function (scope,exprId,result) { return result;};
var logNewScope = function (parentScope,childScope,lamId) {};
var scopeId_0 = 0;
var scopeCounter = 1;
var logobj = function (obj) {
for (var key in obj) console.log(key + " = " + obj[key]);
};
var wrap = function (fast,slow) {
var count = 0;
@Peaker
Peaker / output.js
Created Feb 25, 2016
Lamdu-generated JS
View output.js
var greaterequals = function (i3) {
return {tag: i3.infixl >= i3.infixr ? "True" : "False",data: undefined};
};
var plus = function (i5) { return i5.infixl + i5.infixr;};
var dotdot = function (local_1) {
return function (local_2) {
var x = greaterequals(Object.freeze({infixl: local_1.begin
,infixr: local_1.end}));
switch (x.tag)
{
@Peaker
Peaker / foo.js
Created Feb 25, 2016
es5 pretty printer improved
View foo.js
function flapjaxInit(options) {
var defaultOptions = {includeSynonyms: true
,exportMisc: true
,exportCore: true
,exportDOM: true
,exportDOMMisc: true
,exportWS: true
,hide: []
,show: []
,redefine: false};
@Peaker
Peaker / flapjax.js
Created Feb 25, 2016
Original pretty print of flapjax
View flapjax.js
function flapjaxInit(options) {
var defaultOptions = {includeSynonyms: true
,exportMisc: true
,exportCore: true
,exportDOM: true
,exportDOMMisc: true
,exportWS: true
,hide: []
,show: []
,redefine: false};
@Peaker
Peaker / flapjax-improved.js
Created Feb 25, 2016
Improved Javascript Formatting
View flapjax-improved.js
function flapjaxInit(options) {
var defaultOptions = {includeSynonyms: true
,exportMisc: true
,exportCore: true
,exportDOM: true
,exportDOMMisc: true
,exportWS: true
,hide: []
,show: []
,redefine: false};
@Peaker
Peaker / hangman.hs
Last active Oct 4, 2015 — forked from ToJans/hangman.hs
A haskell implementation of the hangman game
View hangman.hs
{-# OPTIONS -Wall #-}
import Control.Monad (when, unless)
import Data.Char (toLower)
import Data.List (transpose)
import System.Random (randomIO)
wordsPath :: FilePath
wordsPath = "/usr/share/dict/words"
addHangImage :: [String] -> [String]
View *temp*.txt
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE GADTs #-}
module KTuple where
type family Fst (xs :: (a, b)) :: a where
@Peaker
Peaker / AttemptedChange
Created Jun 1, 2015
Changing the compiler to emit a more informative error -- didn't work
View AttemptedChange
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim
index 2a9d15b..530f226 100644
--- a/compiler/sigmatch.nim
+++ b/compiler/sigmatch.nim
@@ -251,7 +251,7 @@ proc describeArgs*(c: PContext, n: PNode, startIdx = 1;
arg = c.semOperand(c, n.sons[i])
n.sons[i] = arg
if arg.typ.kind == tyError: return
- add(result, argTypeToString(arg, prefer))
+ add(result, typeToString(arg.typ, prefer))
@Peaker
Peaker / gist:9e1d87e81945184871e4
Created Jun 1, 2015
Weird error about immutability
View gist:9e1d87e81945184871e4
import tables, strutils
proc getFrequencies() : CountTable[string] =
let wordFrequencies = initCountTable[string]() # <-- this should be var
for line in open("example1.nim").lines():
for word in line.split(", "):
wordFrequencies.inc(word)
return wordFrequencies
You can’t perform that action at this time.