I hereby claim:
- I am boone on github.
- I am boone (https://keybase.io/boone) on keybase.
- I have a public key whose fingerprint is 7713 6FEA DE34 477B 241F E9EB 9D8A 85BC B79C C67E
To claim this, I am signing this object:
# http://adventofcode.com/day/2 | |
defmodule AdventDay2 do | |
# Part 1 | |
# | |
# present_dimensions - String a list of present dimensions, each in the format of | |
# 1x2x3 where 1 is the length, 2 is the width and 3 is the height, | |
# in feet. | |
# | |
# Returns an integer of the area of wrapping paper required, in square feet. | |
def required_wrapping_paper(present_dimensions) do |
// http://adventofcode.com/day/1 - part 1 | |
// | |
// instructions - String containing coded instructions for moving up a floor with | |
// "(" and down a floor with ")" | |
// Starting ground floor numbered zero is assumed. | |
// Returns an integer value for the expected floor. | |
func upsAndDowns(instructions: String) -> Int { | |
var floor: Int = 0 | |
for character in instructions.characters { |
# http://adventofcode.com/day/3 - part 1 | |
# | |
# instructions - String with sequentials commands for which direction to take. | |
# ^ north, v south, > east, < west | |
# | |
# Returns an integer of the area of wrapping paper required, in square feet. | |
def houses_visited(instructions) | |
visited = [[0, 0]] | |
x = 0 |
# http://adventofcode.com/day/2 - part 1 | |
# | |
# present_dimensions - String a list of present dimensions, each in the format of | |
# 1x2x3 where 1 is the length, 2 is the width and 3 is the height, | |
# in feet. | |
# | |
# Returns an integer of the area of wrapping paper required, in square feet. | |
def required_wrapping_paper(present_dimensions) | |
total_area = 0 |
# http://adventofcode.com/day/1 - part 1 | |
# | |
# instructions - String containing coded instructions for moving up a floor with | |
# "(" and down a floor with ")" | |
# Starting ground floor numbered zero is assumed. | |
# | |
# Returns an integer value for the expected floor. | |
def ups_and_downs(instructions) | |
instructions.count("(") - instructions.count(")") | |
end |
#!/bin/bash | |
# Watch a running process and notify by email when it's done | |
# usage ./pcomplete.sh pid email | |
# or nohup ./pcomplete.sh pid email & to background it | |
# TODO verify args | |
# TODO timeout option | |
# TODO include abiity to detach and run in the background |
# truncate string by byte limit | |
# | |
# str - String | |
# limit - Maximum number of bytes | |
# | |
# Returns a String | |
def limit_string(str, limit) | |
limited_string = "" | |
str.each_char do |c| |
I hereby claim:
To claim this, I am signing this object:
# Monkey patch for CVE-2012-5664 on Rails 2.3.14 | |
# put this file in your config/initializers directory | |
# comments/corrections: https://gist.github.com/2921706 | |
# Ruby on Rails SQL Injection | |
# based on a patch from @tenderlove | |
# https://rubyonrails-security.googlegroups.com/attach/23daa048baf28b64/2-3-dynamic_finder_injection.patch?view=1&part=2 | |
module ActiveRecord | |
class Base |
# Monkey patch for CVE-2012-2695 on Rails 2.3.14 | |
# put this file in your config/initializers directory | |
# comments/corrections: https://gist.github.com/2921706 | |
# Ruby on Rails SQL Injection | |
# based on a patch from @presidentbeef | |
# https://rubyonrails-security.googlegroups.com/attach/aee3413fb038bf56/2-3-sql-injection.patch?view=1&part=3 | |
module ActiveRecord | |
class Base |