Skip to content

Instantly share code, notes, and snippets.

View staypufd's full-sized avatar

Sam Griffith Jr staypufd

View GitHub Profile
@staypufd
staypufd / .lisp
Created February 5, 2016 04:10
Example of using SPLIT-SEQUENCE from cl-utilities package for Common Lisp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; 1. Example of using quicklisp to laod in
;;; cl-utilities and use one function
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Load in the cl-utilities package
(ql:quickload "cl-utilities")
;;; Tell the cl-user namespace to use the cl-utilities package
initialize
| sampleCell width height n |
super initialize.
n := self cellsPerSide.
sampleCell := LOCell new.
width := sampleCell width.
height := sampleCell height.
self bounds: (5 @ 5 extent: (width * n) @ (height * n) + (2 * self borderWidth)).
cells := Array2D new: 5 tabulate: [ :i :j | self newCellAt: i at: j].
@staypufd
staypufd / fizz-buzz-with-special.clj
Created May 12, 2020 02:19
Managing Conditions across functions boundaries
```clojure
(ns specialdemo.core
(:require [special.core :refer [condition manage]])
(:gen-class))
(defn fizz-buzz [i]
(let [f (fn [n]
(for [i (range n)]
(cond
(and (= (mod i 3) 0)

Keybase proof

I hereby claim:

  • I am staypufd on github.
  • I am staypufd (https://keybase.io/staypufd) on keybase.
  • I have a public key ASCXD3EQsLw74ZdDgbVp8a8FSbdsPZTfKXFLm3H65kggqwo

To claim this, I am signing this object:

@staypufd
staypufd / gist:0dea840c972383162be5810e15b3d53e
Last active May 16, 2017 17:29
.bashrc that has config for virtual environments to be required and a nice little script 'eve' that tries to activate python virtualenv and if not prints a informative error
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python2.7
MYSQL=/usr/local/mysql/bin
MYBIN=~/bin
export PATH=$PATH:$MYBIN
export PATH=$PATH:$MYSQL
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH
# Colors
@staypufd
staypufd / gist:25ea1d2da98543b94a5ca2cedd259ddc
Created January 12, 2017 22:54
Playing with Om Next in Klipse
http://app.klipse.tech/?container&cljs_in.gist=viebel/69a7c0cdf289bad342fefe82fdeb7179
@staypufd
staypufd / gist:3d246e33051e583de09a
Created October 22, 2015 01:56
Print out Datomic Query Results Nicely in REPL
;; Assumes a Datomic DB where an Entity is defined that has attribute
;; :park.amenity/label of type string. Subsitute your query in place
;; of this example.
(let [vec-str (->>
(d/q '[:find ?amenity-name
:where [?e :park.amenity/label ?amenity-name]]
(db))
(sort-by first))]
(doseq [x vec-str]
@staypufd
staypufd / Parent with two siblings
Last active September 23, 2015 13:37
This is the parent with the state that I want one child to be able to change and that triggers the render which looks at local state and then changes
(defn section-button-view [title-and-symbol-vector owner]
(om/component
(sab/html
[:div {:style {:color "black"
:border "1px solid grey"
:border-radius "4px"
:padding "5px"
:margin "5px"
:text-align "center"
create table quote (
id identity,
quotation varchar(1000) not null,
author varchar(100) not null,
);
insert into quote (quotation, author) values ('The hardest thing in the world to understand is the income tax.', 'Albert Einstein');
insert into quote (quotation, author) values ('The only thing that interferes with my learning is my education.', 'Albert Einstein');
insert into quote (quotation, author) values ('I am convinced that He (God) does not play dice.', 'Albert Einstein');
Mac - Run HSQLDB
NOTE: Assumes your hsqldb is installed at the top level of your home directory.
java -cp ~/hsqldb-2.3.2/hsqldb/lib/hsqldb.jar org.hsqldb.server.Server