- Install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install git
- In
~/.zshrc
(per https://git-scm.com/book/en/v2/Appendix-A%3A-Git-in-Other-Environments-Git-in-Zsh):autoload -Uz compinit && compinit autoload -Uz vcs_info precmd_vcs_info() { vcs_info } precmd_functions+=( precmd_vcs_info )
- In
This file contains 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
diff --git a/error.c b/error.c | |
index 8aa081c198..d51ea349e0 100644 | |
--- a/error.c | |
+++ b/error.c | |
@@ -66,7 +66,7 @@ VALUE rb_iseqw_local_variables(VALUE iseqval); | |
VALUE rb_iseqw_new(const rb_iseq_t *); | |
int rb_str_end_with_asciichar(VALUE str, int c); | |
-long rb_backtrace_length_limit = -1; | |
+long rb_backtrace_length_limit = 5; |
This file contains 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 Levenshtein | |
def self.substring_distance(needle, haystack) | |
distances = Array.new(haystack.length.succ, 0) | |
needle.each_char.with_index do |needle_char, needle_index| | |
next_distances = [needle_index.succ] | |
haystack.each_char.with_index do |haystack_char, haystack_index| | |
deletion, insertion, substitution = | |
distances[haystack_index.succ].succ, |
By working with polynomials we can justify these definitions purely algebraically without doing any differentiation, which I hand-waved away as “a bit more algebra” in the post.
For example, from the angle sum identity
sin(ɑ + β) = sin ɑ cos β + cos ɑ sin β
we know that
sin(a + bε) = sin a cos bε + cos a sin bε
This file contains 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 "rspec" | |
def combinations(array, length) | |
if length.zero? | |
[[]] | |
else | |
array.each_index.map { |i| array.drop(i) }.flat_map do |head, *tail| | |
combinations(tail, length - 1).map do |combination| | |
[head] + combination | |
end |
This file contains 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
#!/usr/bin/env ruby | |
require 'json' | |
require 'net/https' | |
require 'time' | |
API_ENDPOINT = 'https://codeship.com/api/v1/projects.json' | |
API_KEY = ENV['CODESHIP_API_KEY'] || | |
raise('set CODESHIP_API_KEY first! get it from https://codeship.com/user/edit#user_api_key') | |
TRIES = 5 |
This file contains 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
#http://www.nhs.uk/NHSEngland/Healthcosts/Pages/Prescriptioncosts.aspx | |
Given a user who is 60 or older | |
When they collect a prescription | |
Then it should be free | |
Given a user who is younger than 16 | |
When they collect a prescription | |
Then it should be free |
This file contains 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
before function call: at start of function call: | |
ARG: args for caller args for caller | |
saved state for caller saved state for caller | |
LCL: locals for caller locals for caller | |
stack for caller stack for caller | |
args for callee --> ARG: args for callee | |
SP: saved state for callee | |
LCL: locals for callee | |
SP: |
This file contains 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 BWT | |
def encode(string) | |
chars = string.chars + ['$'] | |
chars.each_index.map(&chars.method(:rotate)).sort.map(&:last).join | |
end | |
def decode(string) | |
chars = string.chars | |
chars.inject([]) { |table| chars.zip(table).sort }. | |
map(&:join).detect { |s| s.end_with?('$') }.chop |
This file contains 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
[ | |
{ | |
"textToMatch": "HISCOX", | |
"description": "Liability & indemnity insurance", | |
"vat": "0", | |
"category": "Insurance", | |
"shouldHaveAttachment": false, | |
"ecStatus": "Non-EC" | |
}, | |
{ |
NewerOlder