Skip to content

Instantly share code, notes, and snippets.

Andrew Turley aturley

Block or report user

Report or block aturley

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
@aturley
aturley / proposal-guidelines.md
Created Feb 6, 2019
pony gsoc 2019 proposal guidelines
View proposal-guidelines.md

Name and Contact Information

Please provide information that can be used to contact you. This includes:

  • full name
  • email address
  • telephone number
  • current postal address
  • postal address where you plan to be during the Summer (if known)
  • website link (optional)
@aturley
aturley / twitch-irc-bot.pony
Created Dec 19, 2018
A Twitch IRC bot written from scratch in Pony
View twitch-irc-bot.pony
use "buffered"
use "debug"
use "net"
class TwitchChatConnectionNotify is TCPConnectionNotify
let _nick: String
let _password: String
let _reader: Reader
new iso create(nick: String, password: String) =>
@aturley
aturley / chat_server.pony
Created Apr 3, 2018
Basic TCP chat server in Pony
View chat_server.pony
use "net"
actor ConnectionHub
let _connections: Array[TCPConnection] = Array[TCPConnection]
be add(conn: TCPConnection) =>
_connections.push(conn)
be remove(conn: TCPConnection) =>
try _connections.remove(_connections.find(conn)?, 1) end
View pony-considerations.md

Pony Considerations

If you're thinking of checking out the Pony programming language, here's a list of things that I think are important to know. This list is based on a Tweet that I wrote.

Editor/IDE support

There are Pony packages for several popular editors.

@aturley
aturley / hexdump.pony
Created Aug 1, 2016
Naive implementation of a simple hexdump utility in Pony.
View hexdump.pony
class Notify is StdinNotify
let _main: Main tag
new create(main: Main tag) =>
_main = main
fun ref apply(data: Array[U8] iso) =>
_main.add_bytes(consume data)
fun dispose() =>
View ref-cap-conversion.md

What?

Need\Have iso trn ref val box tag
iso
trn
ref
val
box
tag
@aturley
aturley / sqlite-in-5-minutes.pony
Last active Mar 18, 2016
This is a Pony reimplementation of the C example from the SQLite quickstart page (http://sqlite.org/quickstart.html), using Pony's FFI system (http://tutorial.ponylang.org/c-ffi/calling-c/). In writing it I found a bug in Pony (which was subsequently fixed), so the exercise was good for something other than just learning. I'm still learning Pony…
View sqlite-in-5-minutes.pony
use "collections"
use "lib:sqlite3"
actor Main
let _env: Env
new create(env: Env) =>
_env = env
let args = env.args
var db: Pointer[U8] = Pointer[U8]
View gist:ae2bf5edefa44af8d758
let lit = [(lambda(s:String): String ref => String().append(s) end, lambda(s:String): String ref => String().append(s) end),
(lambda(s:String): String ref => String().append(s).append(s) end, lambda(s:String): String ref => String().append(s).append(s) end),
(lambda(s:String): String ref => String().append(s).append(s).append(s) end, lambda(s:String): String ref => String().append(s).append(s).append(s) end)]
var result = String()
for (la, lb) in lit.values() do
result = result.append(la("a")).append(lb("b"))
end
@aturley
aturley / gist:8302694
Last active Apr 1, 2016
BLOGPOST Just Say "No" to "Just
View gist:8302694

Recently I've been trying to modify the way that I use the word "just" when I'm at work. Merriam Webster offers a few definitions of the word; the one I'm interested in is the one that means "only", "simply", and to a lesser extent "exactly". I've been working on a new project that involves integrating a number of systems, and as I began rolling pieces out I received a lot a questions in the form of "Couldn't you just ...?" These annoyed me at first, but as I thought about it I realized I often asked questions in the same way, so I began to examine the word and the way I use it.

View gist:7265301
(ns phpon.core
(:require [instaparse.core :as insta]))
(def parse-awful
(insta/parser
"
<S> = (ARRAY / INTEGER / STRING)
ARRAY = <'a:'> SIZE <':'> REST
INTEGER = <'i:'> INT <';'>
STRING = <'s:'> SIZE <':\"'> REST
You can’t perform that action at this time.