Skip to content

Instantly share code, notes, and snippets.

View jeremyheiler's full-sized avatar

Jeremy Heiler jeremyheiler

View GitHub Profile
(defn decode-key
"Converts a train case string into a snake case keyword."
[s]
(keyword (str/replace s "_" "-")))
(defn encode-key
"Converts a snake case keyword into a train case string."
[k]
(str/replace (name k) "-" "_"))
@jeremyheiler
jeremyheiler / with-system-out-str.clj
Last active March 13, 2019 16:50
Hijacking System.out with Clojure
(defmacro with-system-out-str
[& body]
`(let [out# System/out
buf# (java.io.ByteArrayOutputStream.)
prs# (java.io.PrintStream. buf#)
wtr# (java.io.OutputStreamWriter. prs#)]
(try
(System/setOut prs#)
(binding [*out* wtr#]
(do ~@body))

Notes from "Shut Up and Take My Money" by Josh Kaufman

Link: http://vimeo.com/71250239

Every business has five parts:

  1. Value creation
  2. Marketing - "here i am, this is what i do, here is why you should be interested"
  3. Sales - doing transactions
  4. Value delivery - what does it take to give what i've sold to the customer?
Last login: Thu Dec 21 10:07:10 on ttys004
~:$ brew cask install factor
==> Caveats
To use factor, you may need to add the /usr/local/Caskroom/factor/0.97/factor/ directory
to your PATH environment variable, eg (for bash shell):
export PATH=/usr/local/Caskroom/factor/0.97/factor/:"$PATH"
==> Satisfying dependencies
==> Downloading http://downloads.factorcode.org/releases/0.97/factor-macosx-x86-64-0.97.dmg

Keybase proof

I hereby claim:

  • I am jeremyheiler on github.
  • I am jeremyheiler (https://keybase.io/jeremyheiler) on keybase.
  • I have a public key ASAs3bSDe1LhsxrGbV44a-4Wtsrdzhn9OxR1bgkIDPpk4Ao

To claim this, I am signing this object:

import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public interface HttpFilter extends Filter {
class MyNotify
let env: Env
new create(env': Env) =>
env = env'
fun ref apply(data: Array[U8] iso) =>
env.out.print(consume data)
fun ref dispose() =>

Echo Arg

This is a followup to the ["Hello World"][hello-world] walkthrough.

Code

actor Main
  new create(env: Env) =>
 try

Hello World

This post walks through the Pony "hello world" program.

Code

First, the program in all its glory.

actor Main
// This is a pony program that will print the first arg provided to the program.
// Every pony program requires an actor called "Main"
actor Main
// This is a constructor for the Main actor named "create".
// It is a convention (supported by syntactic sugar) to call constructors "create".
// In general, a constructor can have any name that begins with a lower case character.
// However, the Main actor requires its constructor to be called "create".