Skip to content

Instantly share code, notes, and snippets.

Drew Olson drewolson

Block or report user

Report or block drewolson

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
@drewolson
drewolson / keybase.md
Created Mar 8, 2014
Keybase Github Proof
View keybase.md

Keybase proof

I hereby claim:

  • I am drewolson on github.
  • I am drewolson (https://keybase.io/drewolson) on keybase.
  • I have a public key whose fingerprint is 497A ADCA 08A9 4EE4 F27A 9E73 23C1 203C 9FA9 8BD6

To claim this, I am signing this object:

@drewolson
drewolson / output
Created Mar 8, 2014
keybase issue with passphrases and gpg2
View output
drew@goban:~$ keybase prove github
Your username on github: drewolson
You need a passphrase to unlock the secret key for
user: "Drew Olson <drew@drewolson.org>"
2048-bit RSA key, ID 23C1203C9FA98BD6, created 2011-05-26
this should not be in plain text when I type ...
^C%
@drewolson
drewolson / non_spooky.rb
Last active Dec 31, 2015
JavaScript: spooky action at a distance
View non_spooky.rb
foo = 1
lambda do
if true
puts foo
else
foo = 2
end
end.call
@drewolson
drewolson / gen_server.rb
Created Oct 25, 2013
A naive implementation of gen_server in Ruby, for demonstration purposes.
View gen_server.rb
require "ostruct"
require "securerandom"
module GenServer
class << self
def call(pid, method, *args)
entry = fetch_entry(pid)
value, state = entry.module.send(method, entry.state, *args)
entry.state = state
update_entry(pid, entry)
@drewolson
drewolson / async_pmap.clj
Last active Oct 3, 2017
pmap using core.async
View async_pmap.clj
(ns async-example.core
(:require [clojure.core.async :refer :all])
(:gen-class))
(defn my-pmap [f col]
(let [chans (repeatedly (count col) chan)]
(doseq [[c e] (map vector chans col)]
(go (>! c (f e))))
(map <!! chans)))
@drewolson
drewolson / streams.js
Created Jun 21, 2013
streams2 example
View streams.js
var Readable = require("stream").Readable;
function buildStream() {
var i = 0;
var stream = new Readable({objectMode: true});
stream._read = function (n) {
if (i < 10) {
stream.push(i);
} else {
@drewolson
drewolson / curry3.js
Last active Dec 18, 2015
Functional Javascript curry3 example
View curry3.js
// The code below refers to examples found on page 120 of the PDF
// required functions
var _ = require("underscore")._;
var plays = [{artist: "Burial", track: "Archangel"},
{artist: "Ben Frost", track: "Stomp"},
{artist: "Ben Frost", track: "Stomp"},
{artist: "Burial", track: "Archangel"},
@drewolson
drewolson / reflection.go
Last active Sep 6, 2019
Golang Reflection Example
View reflection.go
package main
import (
"fmt"
"reflect"
)
type Foo struct {
FirstName string `tag_name:"tag 1"`
LastName string `tag_name:"tag 2"`
@drewolson
drewolson / chat_server.rb
Created Nov 3, 2012
celluloid chat server
View chat_server.rb
require "socket"
require "rubygems"
require "bundler/setup"
require "celluloid"
module Chat
class ConnectionListener
include Celluloid
@drewolson
drewolson / chat.go
Created Oct 25, 2012
simple golang chat server
View chat.go
package main
import (
"bufio"
"net"
)
type Client struct {
incoming chan string
outgoing chan string
You can’t perform that action at this time.