Skip to content

Instantly share code, notes, and snippets.

Erik van Eykelen evaneykelen

Block or report user

Report or block evaneykelen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@evaneykelen
evaneykelen / array_vs_set.rb
Created Aug 25, 2019
Array vs Set benchmark
View array_vs_set.rb
require 'benchmark'
require 'set'
array = File.readlines('dutch.bin') # 10k lines
hash = Hash[*array] # 5k keys => 5k values
set = array.to_set # 10k entries
line = array[-1] # Last line
Benchmark.bmbm do |x|
x.report("Array.include?") { 10_000.times { array.include?(line)} }
@evaneykelen
evaneykelen / size_vs_count.rb
Last active Aug 25, 2019
`size` vs `count` benchmark
View size_vs_count.rb
require 'benchmark'
array = File.readlines('dutch.bin') # 10k lines
hash = Hash[*array] # 5k keys => 5k values
Benchmark.bmbm do |x|
x.report {
x.report("Array count") { 10_000.times { array.count } }
x.report("Array size") { 10_000.times { array.size } }
x.report("Hash count") { 10_000.times { hash.count } }
View tr-vs-sub-vs-gsub.rb
require 'benchmark'
array = File.readlines('dutch.bin') # 10k lines
Benchmark.bmbm do |x|
x.report {
x.report("tr") { array.each { |line| line.tr('e', 'z') } }
}
end
@evaneykelen
evaneykelen / testcases.rb
Created May 25, 2019
Title casing test cases
View testcases.rb
TEST_CASES = [
[
"For step-by-step directions email someone@gmail.com",
"For Step-by-Step Directions Email someone@gmail.com"],
[
"2lmc Spool: 'Gruber on OmniFocus and Vapo(u)rware'",
"2lmc Spool: 'Gruber on OmniFocus and Vapo(u)rware'"],
[
"Have you read “The Lottery”?",
"Have You Read “The Lottery”?"],
View s3-policy.json
{
"Version": "2012-10-17",
"Id": "Policy154...",
"Statement": [
{
"Sid": "Stmt1542...",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::744...556:user/s3-user"
},
View sqs-policy.json
{
"Version": "2012-10-17",
"Id": "Policy154...",
"Statement": [
{
"Sid": "Stmt15420...",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::744...556:user/s3-user"
},
View sqs.rb
require 'open3'
class Sqs
def self.process_messages
sqs = Aws::SQS::Client.new(region: ENV.fetch("AWS_REGION"),
access_key_id: ENV.fetch("AWS_ACCESS_KEY_ID"),
secret_access_key: ENV.fetch("AWS_SECRET_ACCESS_KEY"))
queue_url = sqs.get_queue_url(queue_name: ENV.fetch("AWS_SQS_QUEUE_NAME")).queue_url
poller = Aws::SQS::QueuePoller.new(queue_url, { client: sqs })
View markdown-examples.md

It's very easy to make some words bold and other words italic with Markdown. You can even link to Google!

Sometimes you want numbered lists:

  1. One
  2. Two
  3. Three

Sometimes you want bullet points:

@evaneykelen
evaneykelen / On remote software development.md
Last active Mar 30, 2019
On remote software development
View On remote software development.md

unadjustednonraw_thumb_29

Around 2006 I started working with remote software development teams. In all but one case it has always been enjoyable, and successful from a business perspective.

I've worked with folks from Bolivia, Bulgaria, Costa Rica, Croatia, Estonia, France, Germany, Hong Kong, Hungary, Lithuania, Poland, Portugal, Spain, The Netherlands, UK, and US. The working language has been English in all cases.

To make remote working successful the first step is to hire relatively senior people. I don't mean senior in age per se, but in working experience, level of confidence in their abilities as a developer, experience in remote working, and grounded in terms of having settled in a city for a couple of years. It's OK if you don't tick all the boxes, but ticking just one is a sign you've perhaps not reached the necessary state of "balance" required to take on the responsibilities as a remote engine

@evaneykelen
evaneykelen / crr.md
Last active Jun 19, 2019
Colorize `rails routes` output and insert line breaks between controllers
View crr.md
You can’t perform that action at this time.