I hereby claim:
- I am zef on github.
- I am zef (https://keybase.io/zef) on keybase.
- I have a public key whose fingerprint is F64A 8E5B F886 3060 D810 54AC D97C 988F 6778 C42C
To claim this, I am signing this object:
# how much space is being taken up by .log files? | |
find . -regex '.*\.log' -exec du -hc {} + | |
# recursively clear all .log files in current directory | |
find . -regex '.*\.log' -exec cp /dev/null {} \; | |
# view .log files sorted by file size | |
find . -regex '.*\.log' -print0 | xargs -0 du | sort -gr |
require 'mini_magick' | |
root_path = '/Users/zef/Dropbox/code/some_project' | |
local_path = 'some_project/assets' | |
path = File.join(root_path, local_path, '**.png') | |
list = [] | |
Dir.glob(path).each do |file| |
- (UIImage *)imageByShiftingFromColor:(UIColor *)startColor toColor:(UIColor *)endColor | |
{ | |
CGFloat startHue, startSaturation, startBrightness, startAlpha; | |
BOOL parsedStartColor = [startColor getHue:&startHue saturation:&startSaturation brightness:&startBrightness alpha:&startAlpha]; | |
NSLog(@"start success: %i hue: %0.2f, saturation: %0.2f, brightness: %0.2f, alpha: %0.2f", parsedStartColor, startHue, startSaturation, startBrightness, startAlpha); | |
CGFloat endHue, endSaturation, endBrightness, endAlpha; | |
BOOL parsedEndColor = [endColor getHue:&endHue saturation:&endSaturation brightness:&endBrightness alpha:&endAlpha]; | |
NSLog(@"end success: %i hue: %0.2f, saturation: %0.2f, brightness: %0.2f, alpha: %0.2f", parsedEndColor, endHue, endSaturation, endBrightness, endAlpha); |
#!/usr/bin/env ruby | |
if remote = `git remote -v`.lines.find { |l| l.match /bitbucket/ } | |
matches = remote.match /(?<domain>bitbucket.org).(?<path>.*)\.git/ | |
url = "https://#{matches[:domain]}/#{matches[:path]}" | |
branch = `git symbolic-ref --short HEAD`.lines.first | |
url += "/branch/#{branch}" | |
system "open #{url}" |
extension NSURL { | |
var queryDictionary: [String: String] { | |
guard let components = NSURLComponents(string: absoluteString), items = components.queryItems else { return [:] } | |
return items.reduce([:]) { dictionary, item in | |
var dictionary = dictionary | |
dictionary[item.name] = item.value | |
return dictionary | |
} | |
} |
protocol ValueEnumerable { | |
static var allValues: [Any] { get } | |
} | |
enum ColorScheme: ValueEnumerable { | |
typealias SchemeTuple = (name: String, background: UIColor, foreground: UIColor, border: UIColor) | |
case Light | |
case Dark | |
case custom(SchemeTuple) |
I hereby claim:
To claim this, I am signing this object:
// | |
// Reusable.swift | |
// | |
// Created by Zef Houssney | |
// | |
import UIKit | |
protocol Reusable { | |
static var reuseIdentifier: String { get } |
protocol Pluralizable { | |
static var singular: String { get } | |
// Override with the correct plural, if simply appending an "s" is incorrect | |
static var plural: String { get } | |
} | |
extension Pluralizable { | |
static var singular: String { | |
return String(describing: self) | |
} |
// Created by Zef Houssney on 1/9/20. | |
// This takes some inspiration from https://gist.github.com/chriseidhof/3c6ea3fb2102052d1898d8ea27fbee07 | |
// but uses a different approach. | |
// Instead of trying to calculate the position of each item and placing them manually using calculated coordinates, | |
// this calculates the amount of space each item wants to take up, then splits the items into rows that should fit | |
// within the available width. | |
// Then, the views are distributed into rows, made up of an HStack for each row inside a VStack. | |
// | |
// This seems non-conventional, but I was having trouble getting the frame of my top-level view to be respected when returning |