Skip to content

Instantly share code, notes, and snippets.

View joekunin's full-sized avatar

Joseph Kunin joekunin

View GitHub Profile
@adicirstei
adicirstei / happy-place.clj
Created May 28, 2019 11:42
Tarbell's Happy Place made with Clojure2D
(ns happy-place
(:require [clojure2d.core :refer :all]
[clojure2d.color :as c]
[fastmath.random :as r]
[fastmath.core :as m]
[fastmath.vector :as v]))
(def dim 900)
(def agents 128)
@MichaelLawton
MichaelLawton / deleteAmazonSavedItems.js
Last active June 12, 2024 15:38
Removes all Amazon saved for later items on the cart page. It will only remove visible items. You might want to scroll first to make more items visible. To use paste code in developer console (Ctrl+Shift+J or Cmd+Opt+J in Chrome) then press enter.
function deleteSavedItems() {
var query = document.querySelectorAll("#sc-saved-cart input[value=Delete]")
if (query.length) {
query[0].click();
}
if (query.length > 1) {
setTimeout(deleteSavedItems,100);
}
else {
console.log('Finished');
@ohanhi
ohanhi / frp.md
Last active May 6, 2024 05:17
Learning FP the hard way: Experiences on the Elm language

Learning FP the hard way: Experiences on the Elm language

by Ossi Hanhinen, @ohanhi

with the support of Futurice 💚.

Licensed under CC BY 4.0.

Editorial note

@ricardojmendez
ricardojmendez / circles.cljs
Created January 13, 2015 07:19
Quil/ClojureScript sketch showing the intersection of wandering circles
(ns quil-js.circles
(:require [quil.core :as q :include-macros true]
[quil.middleware :as m]))
(deftype Circle [x y radius x-move y-move line-color fill-color alpha])
(defn draw-circle [circle]
; (.log js/console (str "Drawing " x "," y " with " overlap))
@zentrope
zentrope / index.html
Last active July 18, 2016 17:33
HelloWorld Cordova ClojureScript
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<!-- WARNING: for iOS 7, remove the width=device-width and
height=device-height attributes. See
https://issues.apache.org/jira/browse/CB-4323 -->
<meta name="viewport"
@matthewmueller
matthewmueller / osx-for-hackers.sh
Last active April 21, 2024 03:30
OSX for Hackers (Mavericks/Yosemite)
# OSX for Hackers (Mavericks/Yosemite)
#
# Source: https://gist.github.com/brandonb927/3195465
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Ask for the administrator password upfront
@daveliepmann
daveliepmann / localstorage.cljs
Created September 23, 2014 08:23
HTML5 localStorage utility functions for ClojureScript. I find it makes for cleaner code when I wrap the native JS.
(ns localstorage)
(defn set-item!
"Set `key' in browser's localStorage to `val`."
[key val]
(.setItem (.-localStorage js/window) key val))
(defn get-item
"Returns value of `key' from browser's localStorage."
[key]
@john2x
john2x / 00_destructuring.md
Last active June 6, 2024 13:40
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

@allgress
allgress / reagent_datascript.cljs
Last active February 16, 2023 21:16
Test use of DataScript for state management of Reagent views.
(ns reagent-test.core
(:require [reagent.core :as reagent :refer [atom]]
[datascript :as d]
[cljs-uuid-utils :as uuid]))
(enable-console-print!)
(defn bind
([conn q]
(bind conn q (atom nil)))
@rm-hull
rm-hull / penrose-tiling.cljs
Last active July 5, 2016 19:48
A Penrose tiling is a non-periodic tiling generated by an aperiodic set of prototiles. Penrose tilings are named after mathematician and physicist Roger Penrose who investigated these sets in the 1970s. This gist describes the tiling in terms of a rewriting grammar (an 'L-system') and renders using a turtle (https://github.com/rm-hull/turtle) on…
(ns lindenmayer-systems.demo
(:use [turtle.core :only [draw!]]
[turtle.renderer.vector :only [->svg]]
[turtle.renderer.canvas :only [->canvas]]
[enchilada :only [ctx canvas svg]]
[dommy.core :only [set-html! insert-after! replace! hide! show!]]
[jayq.core :only [show]])
(:use-macros [dommy.macros :only [sel1]]))
(def L '(:left 36))