Skip to content

Instantly share code, notes, and snippets.

View fogus's full-sized avatar
💭
attempting to learn how to better learn

Fogus fogus

💭
attempting to learn how to better learn
View GitHub Profile
@fogus
fogus / cdart.md
Last active April 22, 2022 16:26

RESOLUTION

I had an older version of Dart installed in a Flutter dev setup and it seemed that it was being picked up at some point in the init/build process. Removing the old Dart version fixed the errors below.

versions:

OSX

java -version
openjdk version "11.0.8" 2020-07-14
@fogus
fogus / chain.st
Created March 30, 2022 16:39 — forked from zeroflag/chain.st
Object>>chain
^ ChainProxy new setTarget: self
ChainProxy>>doesNotUnderstand: aMessage
target := aMessage sendTo: target.
^ target
ChainProxy>>setTarget: anObject
target := anObject.
^ self
;;;; 0 - naive
(defn take+rest0 [n coll]
[(->> coll (take n) vec)
(drop n coll)])
; "Elapsed time: 700 msecs" with (range), take 10
; "Elapsed time: 5860 msecs" with (range), take 100
; "Elapsed time: 818 msecs" with [0...99999], take 10
; "Elapsed time: 6439 msecs" with [0...99999], take 100
Boardgame you...
don’t like: cards against humanity
think is overhyped: munchkin
think is underappreciated: blockers, klunker, hyle
love: go, gin, homeworlds
can play over and over: hearts
should play more often: tramways, fjords
Got me into hobby: civilization
changed my life: chess
surprised me the most: the mushroom eaters
;; qualified method expansions from `make-fn`
;; https://github.com/fogus/thneed/blob/master/src/fogus/rdr.clj
;; METHOD: Math/abs
;; SIGS: [[int] [long] [float] [double]]
(clojure.core/fn abs11949
([G__11950]
(clojure.core/cond
@fogus
fogus / monad.bas
Created February 11, 2022 17:44
Sid Sackson's Monad game in QBasic
DECLARE SUB Hugemonad ()
DECLARE SUB Colours ()
SCREEN 9
CLEAR , , 5000
WIDTH , 43
CALL Colours
CALL Hugemonad
LINE (380, 240)-(596, 303), 2, BF
@fogus
fogus / char.py
Last active February 10, 2022 18:13
import random
class Die:
def __init__(self, n):
self.sides = n
def roll(self):
return random.randint(1, self.sides)
dice = [Die(6), Die(6), Die(6)]
@fogus
fogus / mh.clj
Last active February 10, 2022 19:11
(import (java.lang.invoke MethodHandles
MethodHandles$Lookup
MethodType
MethodHandle))
(def ^MethodHandle abs-handle (.findStatic (MethodHandles/lookup)
Math
"abs"
(MethodType/methodType Long/TYPE Long/TYPE)))
@fogus
fogus / basicinterpreter.lisp
Created January 19, 2022 13:03 — forked from lispm/basicinterpreter.lisp
Basic Interpreter, sectorlisp example translated to Common Lisp
; source https://github.com/woodrush/sectorlisp-examples/blob/main/lisp/basic.lisp
; Common Lisp translation: joswig@lisp.de, 2022
; https://gist.github.com/lispm/a2f56a1a6dc5599a039eb7134d99cd4a
(defun basic-example ()
(BASICINTERPRETER
(QUOTE (
(10 REM FIND AND PRINT PRIME NUMBERS BELOW N_MAX. )
(20 LET N_MAX = (1 1 1 1 1 1 1 1 1 1 1 1 1 1 1) )
(30 LET I = (1 1) )
;; LISP-2 acting like LISP-1 (by Ron Garrett)
(defmacro define (name&args &body body)
(let ((name (car name&args))
(args (cdr name&args)))
`(defun ,name ,args
(flet ,(mapcar (lambda (arg) `(,arg (&rest args) (apply ,arg args)))
args)
,@body))))