Skip to content

Instantly share code, notes, and snippets.

View elliottwilliams's full-sized avatar
🏳️‍🌈

Elliott Williams elliottwilliams

🏳️‍🌈
View GitHub Profile
@elliottwilliams
elliottwilliams / 1_version_hash.py
Created September 24, 2019 21:44
Hashing a Cartfile dependency's version with the versions of its subdependencies
from hashlib import sha1
from collections import namedtuple
def version_hash_for_dependency(dependency, dependency_graph):
"""
Returns a hex string created by hashing together the versions of
`dependency` with the versions of its dependencies and subdependencies as
specified in `dependency_graph`. For example, given the dependency graph:
A -> B D

Which rules take which methods?

Each column beginning with a & should be read as a rule conforming to the previous column's protocol and this column's.

Rule AnalyzerRule CorrectableRule &AnalyzerRule CollectingRule &AnalyzerRule CollectingCorrectableRule &AnalyzerRule
collectInfo(for:) implement fatal error implement fatal error
collectInfo(for:compilerArguments:) extension implement extension implement
collectInfo(for:into:compilerArguments:) extension extensio
@elliottwilliams
elliottwilliams / README.md
Created May 12, 2019 06:40
183 issues opened during the #NoTechForICE demonstration

Since GitHub's API differentiates between deleted issues and issues that never existed, we can see how many issues were created and deleted during the #NoTechForICE demonstration.

There were at least 183 issues opened today. That's pretty cool!

Context

On 2019 May 11, tech workers were protesting Palantir's relationship with ICE by opening issues on a number of Palantir's open source libraries. ICE uses Palantir's software to coordinate the deportation of immigrant families and children in the United States. Read more at https://gist.github.com/noahzgordon/29af8c13106ddc591ccaa1ea0ce6af74.

@elliottwilliams
elliottwilliams / .block
Created March 20, 2019 20:29 — forked from mbostock/.block
Mobile Patent Suits
license: gpl-3.0
@elliottwilliams
elliottwilliams / Rakefile
Last active October 23, 2018 05:47
Automatically bump and commit Xcode project version and build numbers
# Follow the instructions at https://developer.apple.com/library/archive/qa/qa1827/_index.html
# ("Technical Q&A QA1827: Automating Version and Build Numbers Using agvtool")
#
# Then manage versions with `rake`:
#
# $ rake bump[build]
# $ rake bump[minor]
# $ rake bump[major]
def perform_bump(level)
@elliottwilliams
elliottwilliams / AnyEquatable.swift
Last active May 6, 2018 13:57
Type-erased Equatable container in Swift 4
struct AnyEquatable: Equatable {
let equalTo: (Any) -> Bool
let value: Any
init<V: Equatable>(_ value: V) {
self.value = value
equalTo = { ($0 as? V) == value }
}
static func == (lhs: AnyEquatable, rhs: AnyEquatable) -> Bool {
return lhs.equalTo(rhs.value)
}
prefix operator *
protocol Dereferencable {
associatedtype DereferencablePointee
static prefix func * (pointer: Self) -> DereferencablePointee
}
extension UnsafePointer: Dereferencable {
typealias DereferencablePointee = Pointee
static prefix func * (pointer: UnsafePointer) -> Pointee {
return pointer.pointee
}
@elliottwilliams
elliottwilliams / ColorBrewer.swift
Created February 1, 2018 17:34
B-spline interpolation between multi-point color schemes
//
// ColorBrewer.swift
// Proper
//
// Created by Elliott Williams on 10/2/17.
// Copyright © 2017 Elliott Williams. All rights reserved.
//
import Foundation
import UIKit
#!/usr/bin/env ruby
require 'set'
# Searches through the given markdown files to find reference-style links that
# are not defined.
abort "Usage: unlinked.rb [files...]" if ARGV.empty?
ARGV.each do |filename|
defs = Set.new
reqs = Set.new
#!/usr/bin/env ruby
USAGE = <<EOF
usage: xcode2vimr.rb [path_of_open_xcode_file]
This script talks to Xcode via osascript to determine its cursor's line number
for the given file, then opens VimR to the specified line.
If no path argument is given, it determines the path via the title of the
frontmost Xcode window.