require 'benchmark/ips' | |
Benchmark.ips do |benchmark| | |
benchmark.config(time: 5, warmup: 2) | |
benchmark.report("keyword-args") do | |
def foo(a: nil, b: nil, c: nil, d: nil, e: nil) | |
bar(a: a, b: b, c: c, d: d, e: e) | |
end |
require 'benchmark/ips' | |
Benchmark.ips do |benchmark| | |
benchmark.config(time: 5, warmup: 2) | |
benchmark.report("keyword-args") do | |
def foo(a: nil, b: nil, c: nil, d: nil, e: nil) | |
bar(a: a, b: b, c: c, d: d, e: e) | |
end |
" ------------------------------------------------------------------ | |
" general config | |
" ------------------------------------------------------------------ | |
set number " show line numbers | |
let mapleader = "\\" " assign \ as leader | |
set showmatch " show matching brackets. | |
set ignorecase " case insensitive matching | |
set hlsearch " highlight search results | |
set tabstop=2 " number of columns occupied by a tab character | |
set softtabstop=2 " see multiple spaces as tabstops so <BS> does the right thing |
require 'matrix' | |
# Input: an array of the n coefficients [a_n, a_n-1,..., a_1] of | |
# a univariate polynomial p of degree n ([a_n]x^n + [a_n-1]x^n-1 + ... + a_1) | |
# | |
# Output: an array of all n roots of p | |
# | |
# Exploits the fact that the eigenvalues of the companion matrix of the | |
# monic equivalent of p are the roots of p | |
# |
let stopCode = "901308" | |
fetch(`https://bustime.mta.info/api/siri/stop-monitoring.json?key=REDACTED&version=2&MonitoringRef=${stopCode}`) | |
.then(function (response) { | |
return response.json(); | |
}).then(function (json) { | |
console.log(json.Siri.ServiceDelivery.StopMonitoringDelivery[0].MonitoredStopVisit.map(visit => { | |
return visit.MonitoredVehicleJourney.MonitoredCall.ArrivalProximityText | |
})) | |
}); | |
//=> [ "1.2 miles away", "2.3 miles away", "3.1 miles away" ] |
#!/usr/bin/env ruby | |
Prediction = Struct.new(:sat_name, :local_start, :max_elevation, :local_end, keyword_init: true) | |
NOAA15 = "25338" | |
NOAA18 = "28654" | |
NOAA19 = "33591" | |
require "HTTParty" | |
require "json" |
I have never been a fan of "DRYing" out unit tests. I have always preferred to keep all of my test setup inside each individual test, and I pined about how this made my test suite more readable, isolated, and consistent; despite all of the duplication. I've never been any good at articulating why I preferred to do things this way, but I felt that it was better than the alternative: a test suite full of shared setup methods that forced me to scan many lines of code to try to understand how the tests work.
Then, I began reading xUnit Test Patterns by Gerard Meszarso. In his book, he codified some of the most profound formulas for writing unit tests. Throughout, the recurring theme around test setup was to keep things essential & relevant, and as I continued read, I began to understand that writing good unit tests is much more nuanced than I bargained for.
First, we'll define w
[2018.11.29]
To get started, Visit http://modernrobotics.org/ to download the book for free!
This Saturday, December 1st, 2018, let's have a chat! Until then, introduce yourself, invite your friends and get excited!
This is a just small fun project that I hope gets others as excited about robots as I am, but just make sure everyone is comfortable, there's a Code of Conduct