Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am kylef on github.
  • I am kylef (https://keybase.io/kylef) on keybase.
  • I have a public key whose fingerprint is BB7D D311 C34B 09C9 0FD1 1258 93AB E8C2 33AC D3D5

To claim this, I am signing this object:

#!/usr/bin/env bash
# Automatically installs swiftenv and run's swiftenv install.
# This script was designed for usage in CI systems.
git clone --depth 1 https://github.com/kylef/swiftenv.git ~/.swiftenv
export SWIFTENV_ROOT="$HOME/.swiftenv"
export PATH="$SWIFTENV_ROOT/bin:$SWIFTENV_ROOT/shims:$PATH"
if [ -f ".swift-version" ] || [ -n "$SWIFT_VERSION" ]; then
swiftenv install -s
import requests
"""
Simple script to delete every dns entry for a cloudflare domain.
Depends on requests (pip install requests). Then fill in the
following three variables:
"""
token = 'INSERT API TOKEN'

Keybase proof

I hereby claim:

  • I am kylef on github.
  • I am kylef (https://keybase.io/kylef) on keybase.
  • I have a public key whose fingerprint is 4130 FDF9 EB2D 440D CD17 8114 C73A 0893 E165 0558

To claim this, I am signing this object:

@kylef
kylef / Mocta.md
Last active August 29, 2015 14:01 — forked from orta/Mocta.md

Getting a Mocta object

NSUserDefaults<Mocta> *defaults = [Mocta objectWithClass:[NSUserDefaults class]];
id< UITableViewDelegate , MoctaStub> delegate = [Mocta objectWithProtocol:@protocol(UITableViewDelegate)];

Expectations

Expectations are ran on dealloc, so I don't have to do it manually.

@kylef
kylef / instance-swizzle.m
Last active January 2, 2016 02:19
Replace a method on an instance at runtime
+ (void)load {
/* We want to add our method after the application has finished launching
because that's when the key window should be setup.
We will add a method to that instance. */
/*
WARNING
This would fail if another object was to key value observe the object
we are going change the class of before we change it. That means before
@kylef
kylef / post-checkout.sh
Last active December 11, 2019 21:09
Git post-checkout hook to install CocoaPods
#!/bin/bash
#
### CocoaPods git-checkout hook
#
# This is a hook which you can install, it will automatically
# run `pod install` when you do a git pull/clone/checkout.
#
# The hook can be used to make CocoaPods usable with Xcode CI.
#
## Installation
@kylef
kylef / reporting.md
Last active December 22, 2015 06:59
Problem reporting guide

When reporting any problems, please provide all the information outlined below so we can properly diagnose the problem.

  • Classification: Security, Crash/Hang/Data Loss, Performance, UI/Usability, Serious Bug, Other Bug, Feature, Enhancement
  • Reproducability: Always, Sometimes, Rarely, Unable, Not Applicable
  • Device For example: iPad 3 or iPhone 5 GSM
  • Operating System Version: For example: iOS 6.1.3
  • Application Version: For example: 1.0-3-gefebej (553)
  • Steps to reproduce: Describe exactly every step you had to do to produce the problem.
  • Expected Results: Describe what you expected to experiance after completing the above steps.
  • Actual Behaviour: Describe what actually happened after completing the steps above.
@kylef
kylef / images.py
Last active December 21, 2015 13:59
Search the current directory for unused images. Useful for finding leftover assets from files which exist in Xcode project or in your repository.
# This simple python utility crawls the current directory and finds all images.
# It will then search the directory for files using these images and also mark
# any xcode projects which include these images.
#
# Allowing you to easily find images which are no longer used (or even images
# included in xcode and not used).
#
# Usage, cd into your repository and then run:
#
# curl https://gist.github.com/kylef/6316920/raw/images.py -# | python -
/*
HTTP Link header parser (http://tools.ietf.org/html/rfc5988)
License: BSD
NSDictionary *links = KFParseRelativeLinks(@"<http://github.com?page=2>; rel=next");
NSURL *nextURL = links[@"next"];
*/
NSDictionary *KFParseRelativeLinks(NSString *header) {
NSMutableDictionary *links = [[NSMutableDictionary alloc] init];