Skip to content

Instantly share code, notes, and snippets.

@aturley
aturley / pony-considerations.md
Last active March 17, 2023 03:21
Information about Pony based on the items outlined in https://twitter.com/casio_juarez/status/898706225642086400

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 / ringmodulation.js
Created November 11, 2012 21:28
Ring modulation using the web audio api
var wac = new webkitAudioContext();
var ringGain = wac.createGainNode();
ringGain.gain.setValueAtTime(0, 0);
var ringCarrier = wac.createOscillator();
ringCarrier.type = ringCarrier.SINE;
ringCarrier.frequency.setValueAtTime(2500, 0);
var url = "Ring_Modulation-Original_sample.ogg";
@aturley
aturley / sqlite-in-5-minutes.pony
Last active June 26, 2020 10:58
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…
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]
@aturley
aturley / proposal-guidelines.md
Created February 6, 2019 18:29
pony gsoc 2019 proposal guidelines

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 December 19, 2018 21:03
A Twitch IRC bot written from scratch in 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 April 3, 2018 13:31
Basic TCP chat server in 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
@aturley
aturley / hexdump.pony
Created August 1, 2016 19:25
Naive implementation of a simple hexdump utility in 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() =>

What?

Need\Have iso trn ref val box tag
iso
trn
ref
val
box
tag
@aturley
aturley / gist:8302694
Last active April 1, 2016 20:39
BLOGPOST Just Say "No" to "Just

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.

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