Skip to content

Instantly share code, notes, and snippets.

@IanColdwater
IanColdwater / twittermute.txt
Last active April 22, 2024 17:26
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@chockenberry
chockenberry / Debug.swift
Last active April 11, 2024 13:22
Debug and release logging in Swift that's reminiscent of NSLog()
//
// Debug.swift
//
// Created by Craig Hockenberry on 3/15/17.
// Updated by Craig Hockenberry on 2/20/24.
// Usage:
//
// SplineReticulationManager.swift:
//
@atomicbird
atomicbird / logMilestone.swift
Last active August 22, 2023 03:41
Sometimes you just want to print a message that tells you a line of code was executed. Inspired by a tweet from Paige Sun: https://twitter.com/_PaigeSun/status/1161132108875796480
/// Log the current filename and function, with an optional extra message. Call this with no arguments to simply print the current file and function. Log messages will include an Emoji selected from a list in the function, based on the hash of the filename, to make it easier to see which file a message comes from.
/// - Parameter message: Optional message to include
/// - file: Don't use; Swift will fill in the file name
/// - function: Don't use, Swift will fill in the function name
/// - line: Don't use, Swift will fill in the line number
func logMilestone(_ message: String? = nil, file: String = #file, function: String = #function, line: Int = #line) -> Void {
#if DEBUG
// Feel free to change the list of Emojis, but don't make it shorter, because a longer list is better.
let logEmojis = ["😀","😎","😱","😈","👺","👽","👾","🤖","🎃","👍","👁","🧠","🎒","🧤","🐶","🐱","🐭","🐹","🦊","🐻","🐨","🐵","🦄","🦋","🌈","🔥","💥","⭐️","🍉","🥝","🌽","🍔","🍿","🎹","🎁","❤️","🧡","💛","💚","💙","💜","🔔"]
let logEmoji = logEmojis[abs(
@haikusw
haikusw / detweet.swift
Created March 3, 2019 19:51 — forked from mxcl/detweet.swift
Delete all tweets and favorites older than two months ago. Instructions in comment.
#!/usr/bin/swift sh
import Foundation
import PromiseKit // @mxcl ~> 6.5
import Swifter // @mattdonnelly == b27a89
let swifter = Swifter(
consumerKey: "FILL",
consumerSecret: "ME",
oauthToken: "IN",
oauthTokenSecret: "https://developer.twitter.com/en/docs/basics/apps/overview.html"
@cabeca
cabeca / simulator_populator_xcode7
Last active April 16, 2020 09:18
This script removes and recreates all simulators in Xcode 7.
#!/usr/bin/env ruby
require 'JSON'
device_types = JSON.parse `xcrun simctl list -j devicetypes`
runtimes = JSON.parse `xcrun simctl list -j runtimes`
devices = JSON.parse `xcrun simctl list -j devices`
devices['devices'].each do |runtime, runtime_devices|
runtime_devices.each do |device|
#!/usr/bin/perl
# This filter changes all words to Title Caps, and attempts to be clever
# about *un*capitalizing small words like a/an/the in the input.
#
# The list of "small words" which are not capped comes from
# the New York Times Manual of Style, plus 'vs' and 'v'.
#
# 10 May 2008
# Original version by John Gruber:
@cabeca
cabeca / simulator_populator
Created September 23, 2014 21:30
This script removes and recreates all simulators in Xcode 6.
#!/usr/bin/env ruby
device_types_output = `xcrun simctl list devicetypes`
device_types = device_types_output.scan /(.*) \((.*)\)/
runtimes_output = `xcrun simctl list runtimes`
runtimes = runtimes_output.scan /(.*) \(.*\) \((com.apple[^)]+)\)$/
devices_output = `xcrun simctl list devices`
devices = devices_output.scan /\s\s\s\s(.*) \(([^)]+)\) (.*)/
@protocool
protocool / caveatPatchor.js
Created February 14, 2011 02:29
Sample caveatPatchor.js file for use in Propane 1.1.2 and above
/*
As of version 1.1.2, Propane will load and execute the contents of
~Library/Application Support/Propane/unsupported/caveatPatchor.js
immediately following the execution of its own enhancer.js file.
You can use this mechanism to add your own customizations to Campfire
in Propane.
Below you'll find two customization examples.
@incanus
incanus / gist:808151
Created February 2, 2011 18:41
This is a shell script to open the current Git repository on GitHub in the default browser. Only works at the top level of the working copy and on Mac OS X (for now).
grep github ./.git/config | sed -e 's/^.*\(github.com.*\)\.git$/\1/' -e 's/.*github\.com:*\/*/https:\/\/github.com\//' | xargs open
@incanus
incanus / GitTagBundleVersion.sh
Created December 22, 2010 02:23
This is an Xcode build script that will automatically change your app's Info.plist CFBundleVersion string to match the latest git tag for the working copy. If you have commits beyond the last tagged one, it will append a 'd' to the number.
#/bin/sh
INFO=$( echo $PWD )/MyApp-Info
TAG=$( git describe --tags `git rev-list --tags --max-count=1` )
COMMIT=
GITPATH=/usr/bin:/usr/local/bin:/usr/local/git/bin
PATH=$PATH:$GITPATH; export PATH
if [ -z $( which git ) ]; then
echo "Unable to find git binary in \$GITPATH"