Skip to content

Instantly share code, notes, and snippets.

Jeremy Heiler jeremyheiler

Block or report user

Report or block jeremyheiler

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:e7f62faf9bf5d61268b42b6833264a42
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
View keybase.md

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:

View HttpFilter.java
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 {
View termecho1.pony
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() =>
View pony-echoarg.md

Echo Arg

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

Code

actor Main
  new create(env: Env) =>
    try
View pony-helloworld.md

Hello World

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

Code

First, the program in all its glory.

actor Main
View echoarg.pony
// 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".
View parsing.clj
(ns parsing)
;; http://www.cs.nott.ac.uk/~pszgmh/monparsing.pdf
(defn parse
[p input]
(p (seq input)))
(defn result
[v]
View 2015.txt
Book | Author
----------------------------------------
The Martian | Andy Weir
1984 | George Orwell
Starship Troopers | Robert A. Heinlein
The Gods Themselves | Isaac Asimov
Dune | Frank Herbert
View gist:86dffef5b0fbe6a7eed3
user=> (defprotocol P (plength [this]) (pget [this index]))
P
user=> (deftype Foo [v] P (plength [this] (count v)) (pget [this index] (nth v index)))
user.Foo
user=> (defn obj-seq [obj index] (lazy-seq (if-not (= index (plength obj)) (cons (pget obj index) (obj-seq obj (inc index))) nil)))
#'user/obj-seq
user=> (obj-seq (->Foo [1 2 3]))
ArityException Wrong number of args (1) passed to: user/obj-seq clojure.lang.AFn.throwArity (AFn.java:429)
user=> (obj-seq (->Foo [1 2 3]) 0)
(1 2 3)
You can’t perform that action at this time.