Skip to content

Instantly share code, notes, and snippets.

Avatar

Dustin Getz dustingetz

View GitHub Profile
@dustingetz
dustingetz / install-Python-AmazonLinux-20171023.log
Created Aug 10, 2020 — forked from mrthomaskim/install-Python-AmazonLinux-20171023.log
Amazon Linux AMI, pyenv, virtualenv, Python, ... Hello, World!
View install-Python-AmazonLinux-20171023.log
### prerequisites
sudo yum groupinstall "Development Tools"
git --version
gcc --version
bash --version
python --version # (system)
sudo yum install -y openssl-devel readline-devel zlib-devel
sudo yum update
### install `pyenv`
@dustingetz
dustingetz / ordering.clj
Created May 30, 2019 — forked from joinr/ordering.clj
examples of composeable ordering functions
View ordering.clj
(ns ordering)
;;We want to pack some information along with
;;our functions so that when our interpreter picks them
;;up, we can determine if the function should be applied
;;directly as a comparator, or if we need to "lift"
;;it into the comparator domain.
(defn ordering? [x] (get (meta x) :ordering))
;;convenience macro to help us create functions with
;;ordering specified in meta
View forall.clj
;; Because in formal logic, ∀x.P(x) = ¬∃x.¬P(x)
(d/q '[:find ?id
:in $ [?interest ...]
:where
[?a :account/id ?id]
(not-join [?a ?interest]
[?a :account/interest ?i]
(not [(= ?i ?interest)]))])
;; It is harder to understand when you bind interest as above if you
@dustingetz
dustingetz / build.boot
Created Nov 20, 2017 — forked from borkdude/build.boot
Boot node hot reloading
View build.boot
(set-env!
:source-paths #{"src/cljs"}
:resource-paths #{"resources"}
:dependencies '[[adzerk/boot-cljs "1.7.228-2" :scope "test"]
[adzerk/boot-cljs-repl "0.3.3" :scope "test"]
;;[adzerk/boot-reload "0.4.13" :scope "test"]
[powerlaces/boot-figreload "0.5.13"]
[pandeiro/boot-http "0.7.6" :scope "test"]
[com.cemerick/piggieback "0.2.1" :scope "test"]
[org.clojure/tools.nrepl "0.2.12" :scope "test"]
@dustingetz
dustingetz / dynamic-cursor.cljs
Last active Jan 29, 2016 — forked from idibidiart/dynamic-cursor
Dynamic Cursor for Reagent
View dynamic-cursor.cljs
(ns main.hello
(:require
[clojure.walk :as walk]
[reagent.core :as r]))
(enable-console-print!)
; Advantages of Dynamic Cursor vs Reagent's own Cursor-as-function:
View gist:8837731

I like LYAH as a reference and cheat-sheet but I found it a little slow for learning Haskell.

Here's my recommended order for just learning Haskell:

http://yannesposito.com/Scratch/en/blog/Haskell-the-Hard-Way/ 80% completion here is fine if you feel your attention waning, the next thing will address hammering in things like functors and monads via typeclasses.

https://github.com/NICTA/course/ this will hammer in the lessons in a very direct form by forcing you to confront the challenges and lessons learned by the creators and community of Haskell itself. Doing the exercises here is critical for being fluent.

Real World Haskell is available online. I recommend it as a reference only.

@dustingetz
dustingetz / serve.py
Last active Aug 14, 2019 — forked from rca/serve.py
serve static assets for frontend development, with http headers to disable caching
View serve.py
#!/usr/bin/env python
import SimpleHTTPServer
class MyHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def end_headers(self):
self.send_my_headers()
SimpleHTTPServer.SimpleHTTPRequestHandler.end_headers(self)
def send_my_headers(self):
self.send_header("Cache-Control", "no-cache, no-store, must-revalidate")
View list-eligible-projects.scala
// projects for which the given user has a matching skill but is not a member.
def listEligibleProjects(userId: Int)(implicit session: Session): Seq[ProjectInfo] = {
val q = for {
p <- Projects if (! (p.id in {
for (pm <- ProjectMembers if pm.userId === userId) yield pm.projectId
}) && (p.id in {
View gist:2877043
oskarth
9:00 following lein-cljs simple tutorial. How come a clojurescript hello world is like 10k LOCs generated and is there any way to reduce it by a couple of magnitudes?
TimMc
9:00 dwierenga: That too, actually. They're not *fun* to read, but you can figure them out without too much work.
dwierenga
9:00 in CSV format, with all appropriate quoting and escaping.
hiredman
9:00 dwierenga: ok
TimMc
9:01 oskarth: Because everything is included when you don't turn on optimizations.
You can’t perform that action at this time.