Skip to content

Instantly share code, notes, and snippets.

View bryanwoods's full-sized avatar
💭
Replacing Security Deposits

Bryan Woods bryanwoods

💭
Replacing Security Deposits
View GitHub Profile
@bryanwoods
bryanwoods / day1.hs
Last active December 2, 2019 11:46
Advent of Code 2019
module Main where
elfFuel :: Int -> Int
elfFuel mass = mass `div` 3 - 2
cumulativeElfFuel :: Int -> Int
cumulativeElfFuel mass
| elfFuel mass <= 0 = 0
| mass > 0 = (elfFuel mass) + cumulativeElfFuel (elfFuel mass)
@bryanwoods
bryanwoods / day1.clj
Last active December 2, 2019 03:44
Advent of Code 2019
(require '[clojure.string :as str])
(def masses
(map #(Integer/parseInt %)
(str/split (slurp "input") #"\n")))
(defn elf-fuel [mass]
(int (- (Math/floor (/ mass 3)) 2)))
(defn cumulative-elf-fuel [mass]
@bryanwoods
bryanwoods / hash_with_similar_access_warning.rb
Created April 4, 2018 14:03
Warn if a similar hash key exists to the one requested
class Hash
def [](key)
result = fetch(key, nil) and
return result
keys.map(&:to_s).include?(key.to_s) or
return result
if [String, Symbol].include?(key.class)
send("similar_#{key.class.to_s.downcase}_key_warning", key)
jogle, onann’s bloom, me shisk in quent to regopll had you sich manceressescente. I have aney mior love of Gomarito amnersiin0.
Astee nor rommury of real. The rpolintirile dilins,y grobiclt in, insiblice uner thens.
At then chinging writh of mespy. There sould youts an burtig, astanNe the Nlommagiriligy. (99.. The last fass to crare-nor to thit a perfantef meose witelins no freer, I plappens whan thy thes dopny is lingor''l.
78"The U?TThrlre reeples abdage thin hantmers- aluy, I dint, and redersaitany, stubre peary confever of spemip wall, loslerf to Culost reautirg writion waly to that cans, nee it in the will il that o*?. Emm is to a smuesso. eelith, some whho deadt wing the dile to reith the meshed of alm the mearn: and thite acrise, these, alding the confoin -6 oret mease'd for treal whene I to her teilks, that am went, ints to susudation.
15 chan caxading the wrild at the nidversaliret faal cpusing of the cloldo, by doongan ? ied she boctuon becaunens no who de suks where a kerpastely shouthor thowen
the way of the door was still the door with his head and to see him that he was still said the door of the door and the three gentlemen stood a room with his head and to see him that he was still said the door of the door and the th
module Enumerable
def method_missing(meth, *args, &block)
if "#{meth}" =~ /flat_(.*)/
send($1, *args, &block).flatten
else
super
end
end
def respond_to_missing?(meth, include_private = false)
const RHS_OF_THE_BEAST = 246;
let ifLet = (binding, then) => {
let b = binding.slice(0, binding.indexOf("="));
return eval(binding) && then.call(this, eval(b));
};
let fn = (y) => y + RHS_OF_THE_BEAST;
let reverseNumber = (number) => number.toString().split('').reverse().join('');
execute pathogen#infect()
syntax on
filetype on
filetype plugin indent on
let g:haskell_indent_case = 2
let g:Guifont="Monaco:h18.00"
let test#strategy = "neovim"
require 'pry'
words = [].tap do |word_list|
Dir["/usr/share/dict/*"].each do |filename|
File.readlines(filename).each do |word|
word_list.push(word.strip)
end
end
end.flatten
execute pathogen#infect()
syntax on
filetype on
filetype plugin indent on
let g:solarized_termcolors=256
let g:haskell_indent_case = 2