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 'benchmark/ips' | |
SIZE = 10 | |
Benchmark.ips do |x| | |
x.report('insane') do | |
[0].cycle.take(SIZE) | |
end | |
x.report('sane') do |
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 CustomerNotifier | |
def initialize(mail_server, templates) | |
@mail_server = mail_server | |
@templates = templates | |
end | |
def confirm_order(customer, data) | |
@mail_server.send_mail(customer.email_address, @templates[:confirm_order].render(data)) | |
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
From 46cff894e9de7284395b4df996914221f96fc1ac Mon Sep 17 00:00:00 2001 | |
From: Aidan Coyle <packrat386@gmail.com> | |
Date: Tue, 20 Nov 2018 21:40:36 -0600 | |
Subject: [PATCH] Bats first attempt | |
--- | |
src/pv/display.c | 4 ++-- | |
1 file changed, 2 insertions(+), 2 deletions(-) | |
diff --git a/src/pv/display.c b/src/pv/display.c |
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
[fg-386] tldr-cpp-client > ./tldr -l | |
Pages for osx | |
airport | |
apachectl | |
archey | |
as | |
base64 | |
brew-cask | |
brew-mas | |
brew |
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
def myfunc(prog = "") | |
mystr = "hi there" | |
eval(prog) | |
mystr.scream | |
end | |
puts 'first' | |
begin | |
myfunc | |
rescue => e |
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
package main | |
import "fmt" | |
var true = false | |
func main() { | |
fmt.Println(true) | |
} |
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
package main | |
import ( | |
"errors" | |
"fmt" | |
"testing" | |
) | |
var err error |
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
// pacakge iface is a comparison of two different interfaces for a client | |
// to a simple REST API. Assume I had access to both `GET /resource`, which | |
// returns a list of all resources (which may be empty), and `GET /resource/:id`, | |
// which returns the resource with the given ID, OR a 404 if no resource | |
// has that ID. Additionally, since these are http requests they could also | |
// fail with some other non-200 status code for a variety of reasons, and | |
// we want to be able to distinguish between a request that failed and a | |
// resource not existing. | |
// | |
// The issue I find is that using pointers is nicer in the case of getting a |
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
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
var access func() int | |
func init() { |
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
[fg-386] escape > go test -bench=. -benchmem 2> /dev/null | |
goos: darwin | |
goarch: amd64 | |
BenchmarkA-8 2000000000 0.28 ns/op 0 B/op 0 allocs/op | |
BenchmarkAPrint-8 2000000 682 ns/op 8 B/op 1 allocs/op | |
BenchmarkEmptyPrint-8 2000000 611 ns/op 0 B/op 0 allocs/op | |
BenchmarkB-8 2000000000 0.27 ns/op 0 B/op 0 allocs/op | |
PASS | |
ok _/Users/acoyle/side/escape 5.117s |