spec.dir
: The top level directory where the mrbgem.rake
file exists.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Scrabble | |
LETTER_VALUES = [ | |
[ 1, 'aeioulnrst'], | |
[ 2, 'dg'], | |
[ 3, 'bcmp'], | |
[ 4, 'fhvwy'], | |
[ 5, 'k'], | |
[ 8, 'jx'], | |
[10, 'qz'] | |
].flat_map { |(score, letters)| letters.chars.product([score]) }.to_h |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'continuation' | |
class Clojure | |
def self.loop(*initial_args, &block) | |
cont = nil | |
args = callcc do |c| | |
class << (cont = c) | |
alias :recur :call | |
end |
I hereby claim:
- I am AaronLasseigne on github.
- I am aaronlasseigne (https://keybase.io/aaronlasseigne) on keybase.
- I have a public key whose fingerprint is 374C EE0A E3EE 594A 2F7F 4C61 0BE7 C118 46F3 4279
To claim this, I am signing this object:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Clojure | |
def self.repeat(x, n = nil) | |
[x].cycle(n) | |
end | |
def self.repeatedly(n = nil, &block) | |
i = n || Float::INFINITY | |
Enumerator.new(n) do |yielder| | |
while i > 0 | |
yielder << block.call |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns identicon.core | |
(:require [digest]) | |
(:require [clojure.string :as str]) | |
(import java.io.File) | |
(import java.awt.Color) | |
(import java.awt.image.BufferedImage) | |
(import javax.imageio.ImageIO)) | |
(def tiles-per-side 6) | |
(def total-tiles |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule RomanNumeral do | |
def convert(n) when n >= 1000, do: remove_and_continue(n, "M", 1000) | |
def convert(n) when n >= 900, do: remove_and_continue(n, "CM", 900) | |
def convert(n) when n >= 500, do: remove_and_continue(n, "D", 500) | |
def convert(n) when n >= 400, do: remove_and_continue(n, "CD", 400) | |
def convert(n) when n >= 100, do: remove_and_continue(n, "C", 100) | |
def convert(n) when n >= 90, do: remove_and_continue(n, "XC", 90) | |
def convert(n) when n >= 50, do: remove_and_continue(n, "L", 50) | |
def convert(n) when n >= 40, do: remove_and_continue(n, "XL", 40) | |
def convert(n) when n >= 10, do: remove_and_continue(n, "X", 10) |