This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defpackage :fsm | |
(:use :cl) | |
(:export :standard-state-machine | |
:standard-state-machine-event | |
:state | |
:defstate | |
:deffsm)) | |
(in-package :fsm) | |
;; Basic copy-pasta protection |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; 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)) |
NewerOlder