Skip to content

Instantly share code, notes, and snippets.

View mcmire's full-sized avatar
🎯
Not a lot of time for side projects these days, so ping me if I'm unresponsive!

Elliot Winkler mcmire

🎯
Not a lot of time for side projects these days, so ping me if I'm unresponsive!
View GitHub Profile
@mcmire
mcmire / .eslintrc.yml
Last active January 9, 2019 01:34
My ESLint configuration
---
env:
browser: true
node: true
es6: true
extends: eslint:recommended
globals:
module: true
require: true
parserOptions:
@mcmire
mcmire / package.json
Created December 18, 2018 02:36
TypeScript configuration
{
...,
"dependencies": {
"typescript": "^3.2.2"
},
"devDependencies": {
"tslint": "^5.11.0",
"typescript-tslint-plugin": "^0.2.1"
}
}
@mcmire
mcmire / checksum.sh
Created July 12, 2018 17:40
Calculate a checksum of multiple directories
#!/bin/bash
set -euo pipefail
uname=$(uname)
checksum() {
if [[ $uname == 'Darwin' ]]; then
md5 -r
else
@mcmire
mcmire / have_row.rb
Created May 4, 2018 18:51
Table matchers for RSpec
module FeatureSpecs
def have_row(expected_row)
HaveRowMatcher.new(self, expected_row)
end
class HaveRowMatcher
def initialize(context, expected_row)
@context = context
@expected_row = expected_row
end
@mcmire
mcmire / hash_matchers.rb
Last active May 9, 2017 13:08
Hash RSpec matchers
module HashMatchers
def contain(other)
Matcher.new(other)
end
class Matcher
def initialize(other)
@other = other
end
@mcmire
mcmire / time_zones.txt
Created March 22, 2017 16:16
Time zone identifiers in Rails
[1] pry(main)> ActiveSupport::TimeZone.us_zones.map { |zone| puts "#{zone.name.inspect} => #{zone.tzinfo.name.inspect} (#{zone.utc_offset / 3600} from UTC)" }; nil
"Hawaii" => "Pacific/Honolulu" (-10 from UTC)
"Alaska" => "America/Juneau" (-9 from UTC)
"Pacific Time (US & Canada)" => "America/Los_Angeles" (-8 from UTC)
"Arizona" => "America/Phoenix" (-7 from UTC)
"Mountain Time (US & Canada)" => "America/Denver" (-7 from UTC)
"Central Time (US & Canada)" => "America/Chicago" (-6 from UTC)
"Eastern Time (US & Canada)" => "America/New_York" (-5 from UTC)
"Indiana (East)" => "America/Indiana/Indianapolis" (-5 from UTC)
@mcmire
mcmire / elixir.md
Last active March 17, 2017 11:10
Elixir notes

Elixir notes

Things I picked up while reading the getting started guide:

  • You can sort two arbitrary data types: 1 < atom evaluates to true.
  • + isn't overloaded like it is in Ruby -- it's only used for arithmetic. If you want to add two arrays together, use ++; two strings, use <>.
  • Single-quoted strings are character lists, and lists that are composed of ASCII character codes will be represented as single-quoted strings
  • Double-quotes strings are actually a different data type than single-quoted strings so 'foo' != "foo"
  • Lists are linked lists, tuples are stored contiguously in memory.
  • If you see "size" it's a performant operation, if you see "length" then you know it will scale as the data structure grows.
@mcmire
mcmire / _css_overrides.html.erb
Created November 11, 2016 22:19
Disable transitions and animations in tests
<% if Rails.env.test? %>
<style type="text/css">
* {
transition-duration: 0s !important;
animation-duration: 0s !important;
}
</style>
<% end %>
@mcmire
mcmire / have_body_including.rb
Created November 2, 2016 01:53
Matcher for testing an email's body using Markdown
# You'll need to install the `reverse_markdown` gem in order for this to work.
module Matchers
def have_body_including(expected_inner_body)
HaveBodyIncludingMatcher.new(expected_inner_body)
end
class HaveBodyIncludingMatcher
def initialize(expected_inner_body)
@expected_inner_body = expected_inner_body.rstrip.gsub(/»\s+/, "")
@mcmire
mcmire / react_ecosystem.md
Last active August 14, 2016 02:28
Notes on the React ecosystem: Flux, Reflux, Nuclear.js, and more

Following are notes I've compiled while researching the React ecosystems and frameworks/tools that people use within it.