Skip to content

Instantly share code, notes, and snippets.

View dcreager's full-sized avatar

Douglas Creager dcreager

View GitHub Profile
@jacobsandlund
jacobsandlund / split_opts.sh
Created March 27, 2012 23:17
Split combined short shell options
#!/bin/sh
# This shows how to handle combined short options along with
# other long and short options. It does so by splitting them
# apart (e.g. 'tar -xvzf ...' -> 'tar -x -v -z -f ...')
while test $# -gt 0
do
case $1 in
@juliangamble
juliangamble / gist:7e9692a2840227c950a8
Created September 28, 2014 04:28
References from Nada Amin's StrangeLoop Talk 'Programming Should Eat Itself'
Here is a reference to the part of the video where the slides are listed:
https://www.youtube.com/watch?v=SrKj4hYic5A&feature=youtu.be&t=28m
Here are the references:
SMITH - Reflection and Semantics in Lisp - 1983
http://www-public.it-sudparis.eu/~gibson/Teaching/CSC7322/ReadingMaterial/Smith84.pdf
WAND & FRIEDMAN - The Mystery of the Tower in Lisp - 1986
http://www.cs.indiana.edu/pub/techreports/TR196.pdf
@bangedorrunt
bangedorrunt / rust_functor.rs
Last active March 3, 2020 10:05 — forked from srijs/rust-functor.rs
Rust Functor
use std::boxed::Box;
use std::option::Option;
use std::result::Result;
use Maybe::*;
#[derive(Debug, PartialEq, Eq)]
enum Maybe<T> {
Nothing,
Just(T),
}
Language Adding files from filesystem to the build How? Unfinished files break the program?
Rust Explicit mod declaration No
CommonJS Explicit require import No
ES6 Explicit import import No
Python Explicit import import No
Lua (new) Explicit require import No
PHP Explicit require or use via autoload import or any use No
Perl Explicit use import No
@rust-play
rust-play / playground.rs
Created January 6, 2019 19:38
Code shared from the Rust Playground
pub struct Int(i64);
pub struct Add<E>(E,E);
pub struct Mul<E>(E,E);
trait Evaluate { fn eval(&self) -> i64; }
impl Evaluate for Int { fn eval(&self) -> i64 { self.0 } }
impl<E> Evaluate for Add<E> where E: Evaluate { fn eval(&self) -> i64 { self.0.eval() + self.1.eval() } }
impl<E> Evaluate for Mul<E> where E: Evaluate { fn eval(&self) -> i64 { self.0.eval() * self.1.eval() } }
#[test]