Skip to content

Instantly share code, notes, and snippets.

View locations.clj
(ns scratch.scratch)
(def locations
[{:unit "moscow"
:type "city"
:subunits [{:unit "abc"
:type "area"}
{:unit "xyz"}]}
{:unit "london"}
{:unit "tokyo"}])
View keybase.md

Keybase proof

I hereby claim:

  • I am flyingmachine on github.
  • I am nonrecursive (https://keybase.io/nonrecursive) on keybase.
  • I have a public key ASDS9szLnff6f8HuT0fd8PAIK9wAr_4J8_68dAGc2z50GQo

To claim this, I am signing this object:

@flyingmachine
flyingmachine / android-setup.md
Last active Jan 10, 2020
How I set up my Android development environment
View android-setup.md
  1. Download the SDK from http://developer.android.com/sdk/index.html
  2. Unpack the ZIP file (named adt-bundle-<os_platform>.zip)
  3. Move the directory adt-bundle-<os_platform> to /Applications/Android: `mv adt-bundle-<os_platform> /Applications/Android
  4. Rename "eclipse" to "Android": mv /Applications/Android/eclipse/eclipse.app /Applications/Android/eclipse/Android.app
  5. Start the Android app
  6. Go to Window->Android SDK Manager
  7. Install packages:
    • Intel x86 Atom System Image
    • Google APIs
    • Intel x86 Emulator Accelerator (HAXM) # this is toward the bottom
View guard-task.clj
(set-env!
:source-paths #{"src"}
:resource-paths #{"html"}
:dependencies '[[adzerk/boot-cljs "2.1.3" :scope "test"]
[adzerk/boot-reload "0.5.2" :scope "test"]
[org.clojure/clojurescript "1.9.908"]
[pandeiro/boot-http "0.8.3" :scope "test"]])
(require
'[adzerk.boot-cljs :refer [cljs]]
@flyingmachine
flyingmachine / gist:4004807
Created Nov 2, 2012
clojure korma heroku db connection
View gist:4004807
(defdb db
(if (System/getenv "DATABASE_URL")
(let [db-uri (java.net.URI. (System/getenv "DATABASE_URL"))
user-and-password (clojure.string/split (.getUserInfo db-uri) #":")]
{:classname "org.postgresql.Driver"
:subprotocol "postgresql"
:user (get user-and-password 0)
:password (get user-and-password 1) ; may be nil
:subname (if (= -1 (.getPort db-uri))
(format "//%s%s" (.getHost db-uri) (.getPath db-uri))
View os_projects.clj
(ns cljobs.resources.manage.os-projects
(:require [cljobs.resources.common :as c]
[cljobs.db.queries :as q]))
(def new-data (c/query-result q/user-os-projects))
(defn process-params
[ctx]
(-> (c/assoc-user ctx :os-project/user)
(update-in [:request :params]
View os_projects.clj
(ns cljobs.resources.manage.os-projects
(:require [cljobs.resources.common :as c]
[cljobs.db.validations :as v]
[cljobs.db.queries :as q]
[datomic.api :as d]))
(def new-data (c/query-result q/user-os-projects))
(defn process-params
[ctx]
View works.clj
(div :class "filters"
(loop-tpl :bindings [name ["bob" "joe"]]
(div
(h3 (text "~{name}"))))
(ul
(loop-tpl :bindings [attr ["a" "b"]]
(li (text "~{attr}")))))
View ex.clj
(div :class "filters"
(loop-tpl :bindings [name ["bob" "joe"]]
(div
(h3 (text "~{name}"))
(ul
(loop-tpl :bindings [attr ["a" "b"]]
(li (text "~{attr}")))))))
@flyingmachine
flyingmachine / defnpd.clj
Last active Dec 18, 2015
This macro lets you easily create functions with default positional arguments
View defnpd.clj
(defmacro defnpd
;; defn with default positional arguments
[name args & body]
(let [unpack-defaults
(fn [args]
(let [[undefaulted defaulted] (split-with (comp not vector?) args)
argcount (count args)]
(loop [defaulted defaulted
argset {:argnames (into [] undefaulted)
:application (into [] (concat undefaulted (map second defaulted)))}