Skip to content

Instantly share code, notes, and snippets.

@Peaker
Peaker / rot.json
Created November 29, 2021 08:56
Example on each byte
[
{
"schemaVersion": 15
},
{
"tagOrder": 0,
"tag": "0f82aca66af91493b1ff401de5f1f7e3",
"names": {
"hebrew": "אורך",
"english": {
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 February 25, 2016 23:16
With slow wrapping...
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 February 25, 2016 16:46
Lamdu-generated 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 February 25, 2016 16:02
es5 pretty printer improved
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 February 25, 2016 00:33
Original pretty print of flapjax
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 February 25, 2016 00:32
Improved Javascript Formatting
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 October 4, 2015 11:08 — forked from ToJans/hangman.hs
A haskell implementation of the hangman game
{-# 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]
{-# 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 June 1, 2015 19:46
Changing the compiler to emit a more informative error -- didn't work
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))