Skip to content

Instantly share code, notes, and snippets.

View logaan's full-sized avatar
🥔
Starchy

Logan Campbell logaan

🥔
Starchy
View GitHub Profile
#!/usr/bin/env ruby
DICTIONARY = File.read('/Users/logaan/Desktop/scrabble2019.txt').split("\n").map{ |w| w.strip }
WORDLE_WORDS = DICTIONARY.filter{ |w| w.length == 5 }
LETTER_SCORES = WORDLE_WORDS.flat_map { |word| word.chars }.reduce({}) do |counts, character|
if counts.include?(character)
counts[character] = counts[character] + 1
else
counts[character] = 1
/* Here's the same function written three different ways */
/* map */
let squareMap = ns => List.map(n => n * n, ns);
// squareMap([1,2,3]) => [1, 4, 9]
/* tail recursive */
let rec squareRec' = (out, ns) =>
switch (ns) {
class Dude
def initialize(warrior, previous)
@warrior = warrior
@direction = previous[:direction]
@previous = previous
end
def dump_state
{
direction: @direction,
@logaan
logaan / hello.sh
Created June 4, 2018 13:55
Kittens
#!/usr/bin/env bash
echo "Hello World"

Keybase proof

I hereby claim:

  • I am logaan on github.
  • I am logaan (https://keybase.io/logaan) on keybase.
  • I have a public key ASAXxlgO0rDH7X7A6xtuGqKm96hq989v3I4nEtA1p_vhFAo

To claim this, I am signing this object:

(ns hex-transition.core
(:require [clojure.string :refer [join]]
[clojure.pprint :refer [pprint]]))
(defn hex->int-parts [hex-string]
(for [[a b] (partition 2 hex-string)]
(Integer/parseInt (str a b) 16)))
(defn hex->int-parts [hex-string]
(for[[a b](partition 2 hex-string)](Integer/parseInt(str a b)16)))
(macroexpand-all
'(for [x (range 10)]
(println x)))
(let* [iter__4590__auto__ (fn* iter__16957
([s__16958]
(new clojure.lang.LazySeq
(fn* []
(loop* [s__16958 s__16958]
(let* [temp__4092__auto__ (clojure.core/seq s__16958)]
(ns permutations
(:require [midje.sweet :refer :all]))
(defn permute
([in]
(set (permute [] in)))
([concrete possible-next]
(mapcat
(fn [n]
(let [new-next (disj possible-next n)
(defn handle-patch-operation [{:keys [op path value]} data]
(case op
:replace (assoc-in data path value)))
(handle-patch-operation
{:op :replace
:path [:completed?]
:value false}
{:text "Kittens"
:completed? true})
(require 'vlad.core)
(def rules
(join (attr [:name] present)
(attr [:message] present)))
(def names
{[:name] "Name"
[:message] "Message"})