Skip to content

Instantly share code, notes, and snippets.

Tate Johnson tatey

View GitHub Profile
View datadog_prerun.sh
#!/usr/bin/env bash
# Datadog bills by the number of unique hosts that were used in the month and
# every time we launch a one off dyno it results in a new
# host (e.g. run.4030404). This script is executed when the dyno launches and
# determines whether the agent should be running to reduce the number of
# unique hosts that we are billed for.
# Disable the Datadog Agent for one-off runs (e.g. console, release).
if [ "$DYNOTYPE" == "run" ] || [ "$DYNOTYPE" == "release" ]; then
@tatey
tatey / 00_cli
Created May 17, 2019
Federal Election 2019 Bingo Card Generator in Ruby
View 00_cli
$ ruby 01_bingo.rb > ~/Downloads/board_1.html
@tatey
tatey / 0_MyView.swift
Created Mar 30, 2019
Why can't I use this "setter" via the Appearance proxy?
View 0_MyView.swift
class MyView: UIView {
func set(borderTintColor: UIColor?, forControlState controlState: UIControl.State) {
// literally empty
}
// I've also tried prefixing with @objc
}
@tatey
tatey / 0_MyView.swift
Created Mar 30, 2019
Why can't I use this "setter" via the Appearance proxy?
View 0_MyView.swift
class MyView: UIView {
func set(borderTintColor: UIColor?, forControlState controlState: UIControl.State) {
// literally empty
}
// I've also tried prefixing with @objc
}
View 1_LayoutMarginsHackView.swift
import UIKit
class LayoutMarginsHackView: UIView {
var actualLayoutMargins: UIEdgeInsets = .zero
override var layoutMargins: UIEdgeInsets {
set {
if #available(iOS 11, *) {
super.layoutMargins = newValue
} else {
@tatey
tatey / 0_attribute_encrypted.rb
Last active Aug 21, 2018
AttributeEncrypted is a simple way to encrypt values in the database using the same mechanism as Rails credentials, including the master key.
View 0_attribute_encrypted.rb
# AttributeEncrypted is a simple way to encrypt values in the database
# using the same mechanism as Rails credentials, including the master key.
#
# Example:
# class User
# include AttributeEncrypted
#
# attr_accessor :encrypted_secret
# attr_encrypted :secret
# end
@tatey
tatey / equality.rb
Created Aug 2, 2018
What could possibly go wrong?
View equality.rb
module Equality
def ==(other)
return false unless other.is_a?(self.class)
instance_variables.all? do |ivar|
instance_variable_get(ivar) == other.instance_variable_get(ivar)
end
end
end
View 0_solution.md
View console output
fu$ yarn exec webpack-dev-server
yarn exec v1.3.2
warning package.json: No license field
module.js:544
throw err;
^
Error: Cannot find module './codes.json'
at Function.Module._resolveFilename (module.js:542:15)
at Function.Module._load (module.js:472:25)
View gist:82f7ef75532a75671441
crystal(test)$ bin/crystal spec spec/std/socket_spec.cr
clang: error: no such file or directory: '/Users/Tate/Code/manastech/crystal/src/ext/libcrystal.a'
Error: execution of command failed with code: 1: `cc -o "/Users/Tate/Code/manastech/crystal/.crystal/crystal-run-spec.tmp" "${@}" -rdynamic /Users/Tate/Code/manastech/crystal/src/ext/libcrystal.a -levent -lpcre -lgc -lpthread -ldl`
You can’t perform that action at this time.