Skip to content

Instantly share code, notes, and snippets.

View cstorey's full-sized avatar

cstorey

View GitHub Profile
@puffnfresh
puffnfresh / objectunion.js
Last active December 12, 2015 02:28
Creation of unions, with automatic value constructors and an automatic fold encoding.
// Boilerplate
function objectUnion(definer) {
var defined = 0, length = 0, isDefined = false, definitions, key;
definitions = definer(function() {
var names = arguments, fold;
if(isDefined) {
throw new TypeError('This objectUnion has already been defined');
}
function Ctor() {}
#!/usr/bin/ruby
require 'twitter'
require 'marky_markov'
def tweets
block = Twitter.user_timeline("joedamato", count: 200)
text = block.map(&:text)
max = block.last.id
until block.empty?
@candera
candera / README.md
Last active February 13, 2024 10:04
Clojure config files

A little Clojure configuration reader

This is a handy bit of code I've written more than once. I thought I'd throw it in here so I can refer back to it later. Basically, it lets you read a config file to produce a Clojure map. The config files themselves can contain one or more forms, each of which can be either a map or a list. Maps are simply merged. Lists correspond to invocations of extension points, which in turn produces a map, which is merged along with everything else.

An Example

Consider the following files:

names.edn

@paulp
paulp / The Signs of Soundness
Last active June 17, 2021 06:48
The Signs of Soundness
Hello scala, my old friend
I've come to take you home again
Because a feature slowly creeping
left me plagued with doubts and weeping
and the version that was tagged in the repo
just has to go
it lacks the signs of soundness
On sleepless nights I hacked alone
applying ant and other tools of stone
@gkossakowski
gkossakowski / specialization-mh.md
Created January 11, 2013 21:17
Random ideas from Scala compiler hacker (@gkossakowski) on how we could improve specialization scheme by exploiting MethodHandles. What you read below is not a plan or a commitment of any kind. I just wanted to get it out from my head and hear what other people think while I'm busy with other things.

Specialization with method handles

Two canonical examples for specialization:

  • Function1
  • Tuple2

Function1 specialization

Specializing Function1 is a lot easier because functions do not have specialized fields.

@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?

@travisbrown
travisbrown / fizzbuzz.scala
Created November 18, 2012 19:31
FizzBuzz in the type system
// Searching for large ModAux instances can be extremely slow.
// See this version for a faster solution: https://gist.github.com/4108026
import shapeless._, Nat._
trait FizzBuzz[N <: Nat] {
def steps: List[String]
def show = println(steps.reverse.mkString("\n"))
}
@include handhelds {
table.responsive {
width: 100%;
thead {
display: none;
}
tr {
display: block;
}
td, th {