Skip to content

Instantly share code, notes, and snippets.

@imathis
imathis / task.rb
Created March 27, 2012 18:56
Edit Octopress post
desc "Edit a post (defaults to most recent)"
task :edit_post, :title do |t, args|
args.with_defaults(:title => false)
posts = Dir.glob("#{source_dir}/#{posts_dir}/*.*")
post = (args.title) ? post = posts.keep_if {|post| post =~ /#{args.title}/}.last : posts.last
if post
puts "Opening #{post} with #{editor}..."
system "#{ENV['EDITOR']} #{post} &"
else
puts "No posts were found with \"#{args.title}\" in the title."
@DrSkippy
DrSkippy / AgeProgressMeter.pde
Created November 12, 2012 04:00
Graphic showing how many months old you are compared to median and long lifespans
import java.util.*;
int boxSize = 5; // pixel size of month representation
int boxSpacing = 4; // vertical and horizontal spacing
int decadeSpacing = 2*boxSpacing; // extra space between decades
int markerOverhang = 18;
int margin = 150;
int w;
// Ages
int age = 0;
@puffnfresh
puffnfresh / arityguard.js
Last active December 11, 2015 18:19
Wat? You need arity guard!
function arityGuard(f) {
function guarded() {
var length = f._length || f.length;
if(arguments.length != length) {
throw new TypeError(
(f._name || f.name || '<anonymous>') +
' called with ' +
arguments.length +
' argument(s), expected ' +
length
@cschneid
cschneid / README.md
Last active January 2, 2016 17:29
Quick Outline of QT + Haskell Group Project for Boulder Haskell Group

What this is

The Boulder Haskell Group is going to start working on a shared project to enhance the HSQML library on Hackage, which binds to the QT library for cross-platform GUI development.

This doc is a braindump currently. Please send pull requests w/ any more found out information as we go. It will probably be edited down and become a real README at somepoint for our new project.

URLs

QT: http://qt-project.org/

import java.util.Optional;
import java.util.function.Function;
class Main {
public static void main(String[] args) {
Optional<String> o = Optional.of("foo");
Function<String, String> f = s -> null;
Function<String, String> g = String::valueOf;
//lawless lolz
@david-christiansen
david-christiansen / Dep.scala
Created August 20, 2014 20:19
Simple presentation of singletons in Scala
package dep
import scala.language._
object Dep extends App {
sealed trait Nat {
type Plus[M <: Nat] <: Nat
def plus[M <: Nat](m: M): Plus[M]
}
@gigamonkey
gigamonkey / criteria.txt
Last active January 5, 2020 06:21
Hiring criteria: looking for the ability to …
Write a program that does what it’s supposed to do
Write idiomatic code
Debug a program that you wrote
Debug a program someone else wrote
Debug the interaction between a system you wrote and one you didn’t
File a good bug report
Modify a program you didn’t write
Test a program you wrote
Test a program you didn’t write
Learn a new programming language
@djspiewak
djspiewak / streams-tutorial.md
Created March 22, 2015 19:55
Introduction to scalaz-stream

Introduction to scalaz-stream

Every application ever written can be viewed as some sort of transformation on data. Data can come from different sources, such as a network or a file or user input or the Large Hadron Collider. It can come from many sources all at once to be merged and aggregated in interesting ways, and it can be produced into many different output sinks, such as a network or files or graphical user interfaces. You might produce your output all at once, as a big data dump at the end of the world (right before your program shuts down), or you might produce it more incrementally. Every application fits into this model.

The scalaz-stream project is an attempt to make it easy to construct, test and scale programs that fit within this model (which is to say, everything). It does this by providing an abstraction around a "stream" of data, which is really just this notion of some number of data being sequentially pulled out of some unspecified data source. On top of this abstraction, sca

@arvearve
arvearve / gist:4158578
Created November 28, 2012 02:01
Mathematics: What do grad students in math do all day?

Mathematics: What do grad students in math do all day?

by Yasha Berchenko-Kogan

A lot of math grad school is reading books and papers and trying to understand what's going on. The difficulty is that reading math is not like reading a mystery thriller, and it's not even like reading a history book or a New York Times article.

The main issue is that, by the time you get to the frontiers of math, the words to describe the concepts don't really exist yet. Communicating these ideas is a bit like trying to explain a vacuum cleaner to someone who has never seen one, except you're only allowed to use words that are four letters long or shorter.

What can you say?

@pchiusano
pchiusano / type-inhabitants.markdown
Last active January 7, 2023 17:23
Reasoning about type inhabitants in Haskell

This is material to go along with a 2014 Boston Haskell talk.

We are going to look at a series of type signatures in Haskell and explore how parametricity (or lack thereof) lets us constrain what a function is allowed to do.

Let's start with a decidedly non-generic function signature. What are the possible implementations of this function which typecheck?

wrangle :: Int -> Int