Skip to content

Instantly share code, notes, and snippets.

View theronic's full-sized avatar

Petrus Theron theronic

View GitHub Profile
@theronic
theronic / build.boot
Created March 8, 2016 08:04
Cannot get boot-http :not-found handler to work when running `boot dev`
(set-env!
:source-paths #{"src/cljs" "src/clj"}
:resource-paths #{"resources"}
:target-path "target"
:dependencies '[[org.clojure/clojure "1.7.0"]
[adzerk/boot-cljs "1.7.228-1" :scope "test"]
[com.cemerick/piggieback "0.2.1" :scope "test"]
[weasel "0.7.0" :scope "test"]
[org.clojure/tools.nrepl "0.2.12" :scope "test"]
[adzerk/boot-cljs-repl "0.3.0" :scope "test"]
@theronic
theronic / wefix-tools.clj
Created February 13, 2017 11:58
WeFix Tools
[
chrome
homebrew
light table
boot-clj
lein
intellij
cursive
@theronic
theronic / cljs-intro.md
Created February 14, 2017 08:18
WeFix Intern Getting Started

You need boot-clj.

Reagent, because you want to see stuff quickly: https://reagent-project.github.io/

lein new tenzing your-app +reagent
cd your-app
boot dev

nREPL server started on port 63518 on host 0.0.0.0. Should start up on port 3000. If you change something in the .cljs file, it should update live in your browser.

@theronic
theronic / boot.profile
Created February 15, 2017 15:00
Put this in your ~/.boot/boot.profile
(defn- generate-lein-project-file! [& {:keys [keep-project] :or {:keep-project true}}]
(require 'clojure.java.io)
(let [pfile ((resolve 'clojure.java.io/file) "project.clj")
; Only works when pom options are set using task-options!
{:keys [project version]} (:task-options (meta #'boot.task.built-in/pom))
prop #(when-let [x (get-env %2)] [%1 x])
head (list* 'defproject (or project 'boot-project) (or version "0.0.0-SNAPSHOT")
(concat
(prop :url :url)
(prop :license :license)
@theronic
theronic / missed-revenue-heatmap.py
Created February 24, 2017 12:20
Mock Implementation of Missed Revenue Calculations
import unittest
from datetime import datetime
THE_PAST = datetime(2000, 1, 1, 9)
THE_FUTURE = datetime(2000, 1, 1, 17)
if __name__ == '__main__':
a(10)
@theronic
theronic / osx_install.sh
Last active July 24, 2017 16:59 — forked from t-io/osx_install.sh
Install most of my Apps with homebrew & cask
#!/bin/sh
echo Install all AppStore Apps at first!
# no solution to automate AppStore installs
read -p "Press any key to continue... " -n1 -s
echo '\n'
echo Install and Set San Francisco as System Font
ruby -e "$(curl -fsSL https://raw.github.com/wellsriley/YosemiteSanFranciscoFont/master/install)"
echo Install Homebrew, Postgres, wget and cask
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
#!/usr/bin/env node
if(typeof Math.imul == "undefined" || (Math.imul(0xffffffff,5) == 0)) {
Math.imul = function (a, b) {
var ah = (a >>> 16) & 0xffff;
var al = a & 0xffff;
var bh = (b >>> 16) & 0xffff;
var bl = b & 0xffff;
// the shift by 0 fixes the sign on the high part
// the final |0 converts the unsigned value into a signed value
return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0)|0);
@theronic
theronic / cljs-repl.sh
Created October 11, 2018 10:53
Start ClojureScript nREPL
# I'm no longer smart enough to learn DSLs to start my favourite language REPL.
#
# If anyone from Cognitect is reading this, AFAIC this stuff is the biggest barrier to Clojure adoption.
#
# Edit your deps.edn file:
#
# {:deps {org.clojure/clojure {:mvn/version "1.9.0"}
# org.clojure/clojurescript {:mvn/version "1.10.339"}
# ;; ...other deps.
# }
@theronic
theronic / xtensa-rust.md
Last active December 22, 2019 09:16 — forked from antoinevg/xtensa-rust.md
How to compile a version of Rust for the Xtensa to compile for ESP32

Like this:

# Use absolute paths, since relative paths like ~/Projects won't be expanded.

# - deps ------------------------------------------------------------------

sudo port install ninja  # or brew install ninja
cargo install xargo

- build llvm ------------------------------------------------------------

@theronic
theronic / clj-nrepl.clj
Created March 1, 2018 10:01
How to start an nREPL using Clojure CLI tools using clj
$ clj -Sdeps '{:deps {org.clojure/tools.nrepl {:mvn/version "0.2.12"}}}'
Clojure 1.9.0
user=> (use '[clojure.tools.nrepl.server :only (start-server stop-server)])
nil
user=> (defonce server (start-server :port 7888))
#'user/server
;; now connect to port 7888. there's probably a way to do this in one line.