by Ossi Hanhinen, @ohanhi
with the support of Futurice 💚.
Licensed under CC BY 4.0.
(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) |
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'); |
(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)) |
<!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" |
# 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 |
(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] |
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.
(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))) |
(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)) |