Skip to content

Instantly share code, notes, and snippets.

View olix0r's full-sized avatar
🍓

Oliver Gould olix0r

🍓
View GitHub Profile
(ns gob.core
[:use [clojure.core.reducers :only (cat)]]
[:use [clojure.string :only (join)]])
(def penus "PENUS")
(defn env-columns [config]
(let [columns (System/getenv "COLUMNS")]
(if (nil? columns)
config
@olix0r
olix0r / keybase.md
Created July 31, 2014 21:36
keybase.md

Keybase proof

I hereby claim:

  • I am olix0r on github.
  • I am olix0r (https://keybase.io/olix0r) on keybase.
  • I have a public key whose fingerprint is 2DD1 B90B 6EAA AD36 CF44 DE78 B1D8 3BB8 13B1 7069

To claim this, I am signing this object:

@olix0r
olix0r / food.rs
Last active August 29, 2015 14:10
babby's breakfast program
/// Food, food, food. I love food.
pub mod food {
use std::rand::{Rand, Rng};
/// All food has calories
pub trait Food {
fn calories(&self) -> u64;
}
/// There are some things you can eat for breakfast.
@olix0r
olix0r / fooer_bad.go
Created April 7, 2015 20:59
Adapters in go
package main
type Goaled interface {
Goaled() bool
}
type Sane interface {
Sane() bool
}
@olix0r
olix0r / Api.scala
Last active September 15, 2015 13:11
case class WatchEvent(kind: String)
class Api(client: Service[Request, Resopnse]) {
def mkreq(): Request = ???
def watch(): AsyncStream[WatchEvent] =
for {
rsp <- AsyncStream.fromFuture(client(mkreq()))
watch <- rsp.status match {
package com.twitter.finagle.httpx
import org.jboss.netty.handler.codec.http.multipart.HttpPostRequestEncoder
/**
* A goddamned awful hack.
*/
object PostRequestEncoder {
def encode(req: Request, params: Seq[(String, String)]): Unit = {
@olix0r
olix0r / git-reaper
Created November 10, 2015 19:09
a little script for reaping a merged working branch
#!/bin/sh
set -e
# When the current branch has been merged to the origin, update master
# and delete the local branch.
branch=$(git rev-parse --abbrev-ref HEAD)
if [ -z "$branch" ]; then
@olix0r
olix0r / gob.clj
Last active December 17, 2015 18:29
my first clojure program
(ns gob.core)
(use '[clojure.string :only (join)])
(def penus "PENUS")
(defn env-columns [config]
(let [columns (System/getenv "COLUMNS")]
(if (nil? columns)
config
@olix0r
olix0r / jammer.scala
Last active December 18, 2015 14:59 — forked from anonymous/jammer.scala
import com.twitter.finagle.{Filter, Service}
import com.twitter.util.{Await, Future}
case class Fruit(flavor: String)
case class Veggie(flavor: String)
case class Jam(flavor: String)
object Jammer extends Service[Veggie, Jam] {
def apply(veg: Veggie) =
Future value Jam(veg.flavor)
@olix0r
olix0r / IsThisSafe.scala
Created February 19, 2016 19:26
Is this safe?
def call(): Future[String] = ???
val strings = Var.async[Try[String]](None) { strings =>
def loop(): Future[Unit] =
call().transform {
case Return(s) =>
strings() = Return(s)
Future.sleep(1.minute).before(loop())
case Throw(NonFatal(e)) =>
strings() = Throw(e)