Skip to content

Instantly share code, notes, and snippets.

View raganwald's full-sized avatar

Reg Braithwaite raganwald

View GitHub Profile
@willurd
willurd / gist:8ae804f51aa6f3ea1708
Last active August 29, 2015 14:16
Parametric partial function creation
// I had this idea of implementing Scala-ish automatic partial function generation
// based on placeholders, and Clojure-ish positional and rest argument replacement
// in anonymous functions created with the shorthand syntax `#()`.
// In Scala, if you have an expression such as `doSomething(_ + 1)`, Scala will
// turn that into a function of one argument that evaluates to `arg + 1`. In
// Clojure, if you use `#()` to create an anonymous function, you can reference
// arguments with `%num` (e.g. `%1`, `%2`, etc). `%` evaluates to the first
// argument and `%&` evaluates to all arguments.
@jedschneider
jedschneider / gist:6113442
Last active December 20, 2015 10:09
Another Take on 'I hated, hated, hated this CoffeeScript'

Another Take on 'I hated, hated, hated this CoffeeScript'

As a follow up to both the initial article and the followup, I wanted to give my own take on 'idiomatic CoffeeScript' as I see it. I'm a huge fan of Reggie's work and highly reccomend his books on CoffeeScript and JavaScript.

I like CoffeeScript's class syntax, I admit it. Not because I love OOP or think that we should necessarily think in in OOP concepts, but because it provides a clean functional interface for thinking in domain concepts. Classes in CoffeeScript are not classes, they are function wrappers with their own environments. If you want to think of them as classes, have at it, I won't blame you.

To review for Reggie's article, lets look at his concept of idiomatic CoffeeScript.

table = (numberO
@gigamonkey
gigamonkey / drunken-walk.py
Created February 20, 2013 04:32
Drunken walk solution
#!/usr/bin/env python3
# coding: utf-8
from random import choice
def make_board(size):
return { (x, y):choice('NSEW') for x in range(size) for y in range(size) }
def random_square(board):
return choice(list(board.keys()))
@unclebob
unclebob / apology.
Created April 27, 2012 12:19
Apology to Women Programmers.
Today I gave a keynote at ACCU in Oxford. In the midst of it I made two (count them) two statements that I should have known better than to make. I was describing the late '70s, and the way we felt about the C language at the time. My slide said something like: "C was for real men." Emily Bache, whom I know and hold in high regard, spoke up and said "What about women?". And I said something like: "We didn't allow women in those days." It was a dumb crack, and should either not have been said, or should have been followed up with a statement to the effect that that was wrong headed.
The second mistake I made was while describing Cobol. I mentioned Adm. Grace Hopper. I said something like "May she rest in peace." I don't know that any of the words were actually demeaning, but the tone was not as respectful as it should have been to an Admiral in the United State Navy, and one who was so instrumental in our industry; despite what I feel about Cobol.
I am a 59 year old programmer who was brought up