- 13" Macbook Pro 3.3 GHz i7 (late 2016)
- Microsoft Surface Book (2016)
- Acer K272HUL 27" monitor 2560 x 1440
- Ergotron monitor arm
- Perixx PERIMICE-712B
| (ns clj-spec-playground | |
| (:require [clojure.string :as str] | |
| [clojure.spec :as s] | |
| [clojure.test.check.generators :as gen])) | |
| ;;; examples of clojure.spec being used like a gradual/dependently typed system. | |
| (defn make-user | |
| "Create a map of inputs after splitting name." | |
| ([name email] |
| ;; the SET game in clojure.spec | |
| ;; inspired by https://github.com/jgrodziski/set-game | |
| (require '[clojure.spec :as s]) | |
| (s/def ::shape #{:oval :diamond :squiggle}) | |
| (s/def ::color #{:red :purple :green}) | |
| (s/def ::value #{1 2 3}) | |
| (s/def ::shading #{:solid :striped :outline}) | |
| (s/def ::card (s/keys :req [::shape ::color ::value ::shading])) |
| # 1) Create your private key (any password will do, we remove it below) | |
| $ cd ~/.ssh | |
| $ openssl genrsa -des3 -out server.orig.key 2048 | |
| # 2) Remove the password | |
| $ openssl rsa -in server.orig.key -out server.key |
| iTerm2 emacs 24.2.1 -nw with paredit on OS X 10.8 Norwegian layout | |
| Left Command is my Meta. | |
| Left Alt used for inputting special characters. | |
| Caps Lock is mapped to Control. | |
| > System Preferences > Keyboard > Keyboard > Special: Caps Lock: ^ Control | |
| iTerm > Preferences > Keys: Left Command key mapped to Right Option | |
| iTerm > Preferences > Profiles > Keys: Right option acts as: +Esc |
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.
| # Standalone script to try http://rom-rb.org/ with a database | |
| require 'bundler/inline' | |
| gemfile do | |
| source 'https://rubygems.org' | |
| gem 'rom' | |
| gem 'rom-sql' | |
| gem 'rom-rails' | |
| gem 'activemodel' |
| ;; Examples from: http://www.databasteknik.se/webbkursen/relalg-lecture/index.html | |
| (def employees (table connection-info :employees)) | |
| (def departments (table connection-info :departments)) | |
| ;;== Projection == | |
| ;; SELECT salary FROM employees | |
| @(project employees #{:salary}) |
| (ns mynamespace.dt | |
| (:use clojure.set) | |
| (:use [datomic.api :only [q db] :as d]) | |
| (:use clojure.pprint) | |
| ) | |
| ;;; http://www.lshift.net/blog/2010/08/21/some-relational-algebra-with-datatypes-in-clojure-12 | |
| (defrecord Supplier [number name status city]) |
| <html> | |
| <head> | |
| <script src="out/goog/base.js" type="text/javascript"></script> | |
| <script src="hello_world.js" type="text/javascript"></script> | |
| <script type="text/javascript">goog.require("hello_world.core");</script> | |
| </head> | |
| <body> | |
| </body> | |
| <script type="text/javascript">hello_world.core.run()</script> | |
| </html> |