Skip to content

Instantly share code, notes, and snippets.

View nha's full-sized avatar
🐢
https://turtlequeue.com

nha

🐢
https://turtlequeue.com
View GitHub Profile
@nha
nha / externs_for_cljs.clj
Created November 9, 2016 23:17 — forked from Chouser/externs_for_cljs.clj
Generate an externs.js file for arbitrary JS libraries for use in advanced Google Closure compilation, based on the ClojureScript code that uses the libraries.
(ns n01se.externs-for-cljs
(:require [clojure.java.io :as io]
[cljs.compiler :as comp]
[cljs.analyzer :as ana]))
(defn read-file [file]
(let [eof (Object.)]
(with-open [stream (clojure.lang.LineNumberingPushbackReader. (io/reader file))]
(vec (take-while #(not= % eof)
(repeatedly #(read stream false eof)))))))
@nha
nha / parsehtml.clj
Created October 22, 2017 23:43 — forked from seltzer1717/parsehtml.clj
Converts Bootstrap HTML to ClojureScript Om Code
;; Converts Bootstrap HTML into ClojureScript Om code
;; Formats output as well
;; Useful when you want to mock a Bootstrap layout but then convert to ClojureScript Om code.
(ns com.seltzer1717.term.server.parsehtml
(:import
(java.io
FileReader
FileWriter
BufferedReader
BufferedWriter)
@nha
nha / parsehtml.clj
Created October 22, 2017 23:43 — forked from seltzer1717/parsehtml.clj
Converts Bootstrap HTML to ClojureScript Om Code
;; Converts Bootstrap HTML into ClojureScript Om code
;; Formats output as well
;; Useful when you want to mock a Bootstrap layout but then convert to ClojureScript Om code.
(ns com.seltzer1717.term.server.parsehtml
(:import
(java.io
FileReader
FileWriter
BufferedReader
BufferedWriter)
Verifying that "nha.id" is my Blockstack ID. https://onename.com/nha
@nha
nha / edn.cljx
Created November 5, 2017 16:58 — forked from Deraen/edn.cljx
Transit / edn date/datetime serialisers
(ns metosin.common.edn
#+clj
(:require [clj-time.format :as f])
#+cljs
(:require [cljs-time.format :as f]
cljs.reader)
#+clj (:import [org.joda.time DateTime LocalDate]))
;;
;; #DateTime tagging
@nha
nha / edn.cljx
Created November 5, 2017 16:59 — forked from Deraen/edn.cljx
Transit / edn date/datetime serialisers
(ns metosin.common.edn
#+clj
(:require [clj-time.format :as f])
#+cljs
(:require [cljs-time.format :as f]
cljs.reader)
#+clj (:import [org.joda.time DateTime LocalDate]))
;;
;; #DateTime tagging
@nha
nha / replace.clj
Created November 19, 2017 19:53 — forked from chrismurrph/replace.clj
Search and replace for going to Fulcro 2.0
(ns general.replace
(:require [clojure.string :as s]
[clojure.java.io :as io]
[clojure.pprint :as pp]))
(defn indexes-of [in-str find-str]
(loop [idx 0
indexes []]
(let [found-idx (s/index-of in-str find-str idx)]
(if found-idx
@nha
nha / Datomic-HSQLDB Storage.md
Created December 8, 2017 11:57 — forked from jamesnyika/Datomic-HSQLDB Storage.md
Datomic - HSQLDB Storage Setup

Howto - Setting Up an HSQLDB Storage for Datomic

This gist walks you through the steps of setting up a storage for your datomic starter instance to use an HSQLDB instance (running as a standalone server - i do not address embedded, http, in memory or other forms of the server). I am sure the same can be applied to any other SQL based storage so it should be portable to Apache Derby. I am writing this for those who may find it useful in getting this done quickly without spending a week as I did trying to figure out what I was doing wrong.

Part I : Install & Setup Your Storage: the HSQLDB Server

  1. Download the latest version of the database from here
  2. The most important file you will need is the hsqldb.jar file. This is the database. This will need to be in your classpath to be able to run the server.
  3. I then create a bash script for easy execution of the Network Server version of the database as shown below.
@nha
nha / logicrels-lucene.clj
Created December 14, 2017 21:15 — forked from terjesb/logicrels-lucene.clj
Lucenalog: Datalog interface to Lucene in 10 lines
(ns lucenalog.core
"Lucenalog = Datalog interface to Lucene in 10 lines.
Simple but powerful.
Use
(db/add (index) {:a \"foo\" :b \"bar\"})
to index a map with Lucene. Then you can use the relation
<!doctype html>
<html ⚡>
<head>
<meta charset="utf-8">
<script async src="https://cdn.ampproject.org/v0.js"></script>
<script async custom-element="amp-lightbox" src="https://cdn.ampproject.org/v0/amp-lightbox-0.1.js"></script>
<script async custom-element="amp-list" src="https://cdn.ampproject.org/v0/amp-list-0.1.js"></script>
<script async custom-element="amp-selector" src="https://cdn.ampproject.org/v0/amp-selector-0.1.js"></script>
<script async custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-0.1.js"></script>
<link rel="canonical" href="https://ampbyexample.com/components/amp-list/">