Skip to content

Instantly share code, notes, and snippets.

View orthecreedence's full-sized avatar

andrew lyon orthecreedence

View GitHub Profile
(defun return-fastest (&rest functions)
(let* ((retvals nil)
(threads nil)
(results-lock (bt:make-lock "results"))
(sig (bt:make-condition-variable))
(wrapped (mapcar (lambda (fn)
(lambda ()
(let ((got-results (bt:with-lock-held (results-lock) retvals)))
(format t "th: res1: ~a~%" got-results)
(unless got-results
@orthecreedence
orthecreedence / gist:2e7d974cfbbed733347f
Last active August 29, 2015 14:02
Non-recursive macrolet
(defpackage :mlet-nonr
(:use :cl))
(in-package :mlet-nonr)
(defun %attack (item fn)
(format t "attacking ~a, then calling fn~%" (car item))
(funcall fn (car item)))
(defmacro attack (item fn)
"This is a macro so we can bind to multiple values. In this case, %attack only
@orthecreedence
orthecreedence / gist:9916737
Last active August 29, 2015 13:57
Hotfix for disabling "minimize to tray"
cd /path/to/turtl
mkdir -p tmp/release
cd tmp
unzip ../package.nw
# in your editor of choice, open main.js and find this block (around line 154):
#
# win.on('minimize', function() {
# win.hide();
# // Window.hide() hides the tray menu, so we just remove it and re-add it
(defun sleeper ()
(let ((f1 (green-threads:make-future)))
(as:delay (lambda () (complete-future f1 'hai)) :time 3)
f1))
(defun app ()
(with-green-thread
(format t "start sleeper~%")
(format t "end sleeper: ~a~%" (wait-on (sleeper)))))