Skip to content

Instantly share code, notes, and snippets.

View zacwest's full-sized avatar

Zac West zacwest

View GitHub Profile
@zacwest
zacwest / ZSWFileTester.m
Created June 3, 2015 14:53
Saving optimal JPEGs
//
// ZSWFileTester.m
// Image Size Test
//
// Created by Zachary West on 3/4/14.
// Copyright (c) 2014 Zachary West. All rights reserved.
//
#import "ZSWFileTester.h"
@zacwest
zacwest / baseball_standings.js
Last active June 13, 2022 15:17
Post Baseball standings to Slack. This code is awful, I don't know JavaScript, but it works. You probably need to figure out the emoticons for each team in your Slack.
var token = 'your-token-here'; // from https://erikberg.com/api for wildcard
var agent = 'Your/1.0 <user@agent>';
var fetch = require('node-fetch');
var hooks = {'https://hooks.slack.com/services/…': '#channel',
'https://hooks.slack.com/services/…': '#channel'};
var team_table = {
"los-angeles-dodgers": ":dodgerslogo:",
"san-francisco-giants": ":giants:",
@zacwest
zacwest / associate.sh
Last active December 5, 2022 22:51
Associate Sublime Text with various programming file extensions
#!/bin/bash
if ! command -v duti &> /dev/null; then
brew install duti
fi
declare -a extensions=(
## uti-based
public.plain-text
public.source-code
#!/usr/bin/swift
import AppKit
import CoreServices
let args = CommandLine.arguments[1...]
let words = args.filter { !$0.hasPrefix("-") }
guard !words.isEmpty else {
print("Usage: \(URL(string: #file)!.lastPathComponent) [-o] <word1> [word2 [word3 [...]]]")
@zacwest
zacwest / ios-font-sizes.swift
Last active March 27, 2024 07:16
iOS default font sizes - also available on https://www.iosfontsizes.com
let styles: [UIFont.TextStyle] = [
// iOS 17
.extraLargeTitle, .extraLargeTitle2,
// iOS 11
.largeTitle,
// iOS 9
.title1, .title2, .title3, .callout,
// iOS 7
.headline, .subheadline, .body, .footnote, .caption1, .caption2,
]