Skip to content

Instantly share code, notes, and snippets.

🍋
Smug JS Weenie

Ed Langley fiddlerwoaroof

🍋
Smug JS Weenie
Block or report user

Report or block fiddlerwoaroof

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 World.kt
import java.lang.RuntimeException
import java.util.Arrays
object VariantWorld2 {
class Greet : World.Visitor {
fun visit(subject: Dog, arg: String): String {
return "$arg is greeted"
}
fun visit(subject: Cat, arg: String): String {
@fiddlerwoaroof
fiddlerwoaroof / extend.js
Last active Jun 13, 2019
Static typable EP solution
View extend.js
//
// Two kinds of animals: dogs and cats
//
// I want greet and leave to be defined such that there are four
// different behaviors corresponding to each combination of dog and
// cat
//
class Animal {
receive_operation(operation) {
console.log("the animal is unresponsive");
View zipfile.lisp
(uiop:define-package :fwoar.zipfile
(:mix :cl :fwoar.lisputils)
(:export ))
(in-package :fwoar.zipfile)
(defun read-bytes (n s)
(with (seq (make-array n :element-type 'serapeum:octet))
(values seq
(read-sequence seq s))))
View oop-with-inheritance.clj
(ns oop-with-inheritance)
(defn start [arg]
(println "starting: " arg))
(defn stop [sys]
(println "stopping:" sys))
(defn server-system-local [& args]
(apply println "making server system:" args)
View routing-method-combination.lisp
(defpackage :fwoar.mc-web
(:use :cl )
(:export ))
(in-package :fwoar.mc-web)
(defclass myway-server (hunchentoot:acceptor)
((%mapper :initform (myway:make-mapper) :reader mapper)))
(defvar *current-route*)
(define-method-combination routing
View minimal.asd
;;; -*- Mode:Lisp; Syntax:ANSI-Common-Lisp; Package: ASDF-USER -*-
(in-package :asdf-user)
(defsystem :my-new-system
:description ""
:author "Ed L <edward@elangley.org>"
:license "MIT"
:depends-on (#:alexandria
#:uiop
#:serapeum
View clos-browser.lisp
(defpackage :clos-browser
(:use :clim-lisp :clim)
(:export
#:main))
(in-package :clos-browser)
(define-application-frame class-browser ()
((classes :initarg :classes :reader classes)
(visible-classes :initform nil :accessor visible-classes)
(current-class :initform nil :accessor current-class))
@fiddlerwoaroof
fiddlerwoaroof / zipfile.lisp
Last active Jul 9, 2018
Simple zipfile decoding
View zipfile.lisp
;; Presupposes the binary parser from fwoar.lisputils/bin-parser: https://github.com/fiddlerwoaroof/fwoar.lisputils/blob/master/bin-parser.lisp
(uiop:define-package :fwoar.zipfile
(:mix :cl :fwoar.lisputils :fwoar.bin-parser)
(:export ))
(in-package :fwoar.zipfile)
(defparameter *zip-local-file-header*
'((signature 4) (version 2) (flags 2) (compression 2 le->int) (mod-time 2) (mod-date 2) (crc-32 4)
(compressed-size 4 le->int)
@fiddlerwoaroof
fiddlerwoaroof / demo.hs
Created Feb 27, 2018
Unit-testing IO in Haskell
View demo.hs
module Main where
import Data.IORef
import Data.Time.Clock.POSIX
realIoUnderTest :: IORef Int -> IORef [[Char]] -> IORef Int -> IORef String -> IO ()
realIoUnderTest a b c d = do
b' <- readIORef b
putStrLn $ Prelude.unlines b'
View keybase.md

Keybase proof

I hereby claim:

  • I am fiddlerwoaroof on github.
  • I am fiddlerwoaroof (https://keybase.io/fiddlerwoaroof) on keybase.
  • I have a public key ASAjpoHMAvokBJ0hUrLDdCiYI9w63MumLlgXyWQvTYLOdwo

To claim this, I am signing this object:

You can’t perform that action at this time.