Skip to content

Instantly share code, notes, and snippets.

Tate Johnson tatey

Block or report user

Report or block tatey

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
@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)
@tatey
tatey / benchmark.rb
Created Feb 20, 2012
Mocha VS MiniTest::Mock and SimpleDelegate VS SimpleMock
View benchmark.rb
require 'benchmark'
require 'delegate'
require 'mocha'
require 'simple_mock'
Benchmark.bm(10000) do |x|
x.report :mocha do
array = [1]
array.expects(:push).with(2).returns([1, 2])
array.push(2)
View ErrorFormatter.h
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface ErrorFormatter : NSObject
@property (strong, nonatomic) NSError *error;
- (id)initWithError:(NSError *)error;
- (UIAlertView *)alert;
You can’t perform that action at this time.