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 / index.html
Created October 19, 2019 21:25 — forked from CodeMyUI/index.html
Learning Three.js
<div class =container> </div>
@nha
nha / css-parser.md
Created July 13, 2018 15:17 — forked from kachayev/css-parser.md
Parsing CSS file with monadic parser in Clojure
@nha
nha / gh-validation.clj
Created June 20, 2018 09:42 — forked from ska2342/gh-validation.clj
Some code for a ring middleware written in Clojure to validate Github webhook calls
;; (c) 2016 Stefan Kamphausen
;; Released under the Eclipse Public License as is common in the Clojure world.
;;; Summary
;; This gist shows how you can implement GitHub webhook validation as a Clojure ring middleware.
;;; Description
;; It is not a ready-made solution that you can just plug into your code. It makes some assumptions that
;; may or may not be valid in your situation. I don't want to turn this into a full-blown generic
;; open source library because of this. Instead I provide this gist so that you can take the parts
@nha
nha / README.md
Created April 8, 2018 09:17 — forked from mfikes/README.md
Keywords in ClojureScript React Native Hiccup

Instead of using vars in React Native Hiccup, it would be interesting to use keywords.

Consider the way things are currently done:

(def ReactNative (js/require "react-native"))
(def text (r/adapt-react-class (.-Text ReactNative)))

(defn greeting []
 [text "Hello"])
(ns morel.core
(:import (com.oracle.truffle.api.nodes RootNode NodeInfo Node$Child))
(:require [clojure.interop :refer [defclass]]
[clojure.reflect :as reflect]))
(defclass
^{NodeInfo {:language "SL"
:description "The root of all SL execution trees"}}
SLRootNode [language
frame-descriptor
@nha
nha / rich_hickey_fogus_interview.md
Created March 23, 2018 12:50 — forked from harfangk/rich_hickey_fogus_interview.md
Rich Hickey Interview with Fogus on CodeQuarterly (likely from around June 2011)

The original website containing this interview has disappeared. I've googled a bit to find this transcript. I'm saving it myself to provide another link to the great interview and preserve it.

Rich Hickey Q&A by Michael Fogus

Best known as the inventor of Clojure, a Lisp that runs on the Java Virtual Machine and the first new member of the Lisp family to attract any widespread interest since Scheme and Common Lisp, Rich Hickey has been a software developer and consultant for two decades.

Prior to starting work on Clojure, he made four attempts to combine Lisp with either Java or Microsoft’s Common Language Runtime: jfli, Foil, Lisplets, and DotLisp but Clojure was the first to draw significant attention. To date there have been four books published on Clojure, including The Joy of Clojure by interviewer Michael Fogus. The first Clojure conference, ClojureConj held in 2010, drew over two hundred attendees. And the Clojure Google group has, as of this writing, 4,880 members who have posted over 46,000 mes

(ns ansible.core
(:require [clojure.java.shell :as sh]
[clojure.string :as str]
[cheshire.core :as cheshire]
[clojure.java.io :as io])
(:import (java.io File)
(com.fasterxml.jackson.core JsonGenerator)
(java.util Base64)
(java.security MessageDigest MessageDigest$Delegate)))
@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
@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 / 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