Skip to content

Instantly share code, notes, and snippets.

@michaeljforster-zz
michaeljforster-zz / react-tutorial.lisp
Created May 9, 2014 12:11
Facebook's React assimilated
(in-package #:grok-cl-parenscript-react)
(hunchentoot:define-easy-handler (handle-tutorial :uri "/tutorial")
()
(cl-who:with-html-output-to-string (stream)
(:html
(:head
(:title "React Tutorial")
(:script :type "text/javascript" :src *react-url*))
(:body
@PuercoPop
PuercoPop / First draft.lisp
Last active August 29, 2015 14:01
Fuck lispbuilder's event-loop
(in-package :famiclom)
(require 'sb-sprof)
(defun check-for-input ()
(let ((event (sdl:new-event)))
(loop
;; Pops the event-queue and binds it to event, return 0 if no pending
;; events.
:for event-poll = (sdl-cffi::SDL-Poll-event event)
(defun event-p (x) t) ;; constantly t
(defun key-p (x) t) ;; constantly t
;; w/o defpattern
(match event
((and (sdl:event- (type (eq :key-down-event)))
;;^^^^^^^^^^ this specify the container type
;;^^^^ this is a slot
;; ^^^^^^^^^^^^^^^^^^ and this specifies the type of the slot.
(sdl::key- (key (eq :sdl-key-z)) state)))
#!/usr/bin/cl -Q -sp coleslaw --entry entry
;;;;
;; This script assumes it is executed from the repository's top level directory
;; to determine correctly the blog-dir variable.
;;;;
;; (coleslaw:preview #P"/home/puercopop/Projects/RunaRimac/hello-world.md")
(defun entry (argv)
(declare (ignorable argv))
(let
;; Lambkin, a garbage-collected heap suitable for microcontrollers.
;; Copyright (C) 2015 Andy Wingo <wingo@igalia.com>.
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@stassats
stassats / gist:741780
Created December 15, 2010 08:41
lisp file analyzer
;;; Usage (percentage (analyze-systems '(a b c d))) => 42.23
(eval-when (:compile-toplevel :load-toplevel :execute)
(when (asdf:find-system :named-readtables nil)
(asdf:load-system :named-readtables)))
(defun analyze-form (form)
(typecase form
(symbol
(when (eql (symbol-package form) (find-package 'cl))
(require :sb-concurrency)
(defpackage :demo (:use :cl :sb-thread :sb-concurrency :sb-ext))
(in-package :demo)
(defun make-atomic-boolean (&optional (init nil))
(list init))
(defun atomic-boolean-get (ab)
(barrier (:read)
#!/usr/bin/env ruby
# coding: utf-8
abort "Usage: fuck you <name>" unless ARGV[0] == "you" && ARGV.size == 2
a = "abcdefghijklmnopqrstuvqxyz".each_char.to_a
b = "ɐqɔpǝɟƃɥıɾʞʃɯuodbɹsʇnʌʍxʎz".each_char.to_a
ws = Hash[a.zip(b)]
ws.default = ->(f){f}
@deplinenoise
deplinenoise / Asm
Created July 30, 2014 21:36 — forked from emoon/Asm
; Pure Lisp based assembler
(def my-fun (input1 :in d1
input2 :in d2
output :out d0)
(move.l input1 output)
(add.l input2 output))
----------------------------------------------------------------------------------------
; We can also have loop constructions by doing a macro (no need for it to be 'built-in')
@guicho271828
guicho271828 / case.lisp
Last active May 5, 2018 18:51
case -> jump table (see fcase8, fcase9)
#!/bin/sh
#|-*- mode:lisp -*-|#
#|
exec ros -Q -- $0 "$@"
|#
(progn ;;init forms
(ros:ensure-asdf)
#+quicklisp (ql:quickload '(:alexandria :trivia :iterate) :silent t))
(defpackage :ros.script.case.3724474528