Skip to content

Instantly share code, notes, and snippets.

@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)
@sshirokov
sshirokov / fsm.lisp
Created May 14, 2012 23:51
CLOS FSM with MOP Sauce (requires :closer-mop)
(defpackage :fsm
(:use :cl)
(:export :standard-state-machine
:standard-state-machine-event
:state
:defstate
:deffsm))
(in-package :fsm)
;; Basic copy-pasta protection
@aras-p
aras-p / preprocessor_fun.h
Last active May 28, 2024 05:15
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@SabretWoW
SabretWoW / rspec_model_testing_template.rb
Last active May 28, 2024 17:41
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@vu3rdd
vu3rdd / papers.markdown
Last active February 13, 2019 06:01
List of Papers for Bangalore PL/CS paper reading group

Context

This tweet explains it all.

I have a huge pile of papers on my computer waiting to be read. Often I read parts of it immediately after I see the paper, but I forget about it until someone points on another article, how awesome that paper is. I then remember to read it more carefully.

One way to fix it is to work with like minded people and have serious (non-hand wavy) discussion around the paper.

The list below will grow. My hard disk has more papers than I can count. I have carefully chosen a list of very readable papers in the list below. Special thanks for the authors for publishing their great ideas.

@namuol
namuol / INSTALL.md
Last active July 24, 2023 11:53
rage-quit support for bash

rage-quit support for bash

HOW TO INSTALL

Put flip somewhere in your $PATH and chmod a+x it.

Copy fuck into ~/.bashrc.

#!/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}
@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)