Skip to content

Instantly share code, notes, and snippets.

View funky-monkey's full-sized avatar

Sidney de Koning funky-monkey

View GitHub Profile
@funky-monkey
funky-monkey / show_ipa_metadata.sh
Created November 30, 2015 16:09 — forked from niw/show_ipa_metadata.sh
Extract iTunesMetadata.plist from ipa file, read it and dump it.
#!/usr/bin/env bash
TEMP_PLIST=/tmp/metadata.plist
for i in "$@"; do
if unzip -p "$i" iTunesMetadata.plist >"$TEMP_PLIST"; then
name=$(/usr/libexec/PlistBuddy -c 'Print :itemName' "$TEMP_PLIST")
id=$(/usr/libexec/PlistBuddy -c 'Print :itemId' "$TEMP_PLIST")
appleid=$(/usr/libexec/PlistBuddy -c 'Print :appleId' "$TEMP_PLIST" 2>/dev/null ||
/usr/libexec/PlistBuddy -c 'Print :com.apple.iTunesStore.downloadInfo:accountInfo:AppleID' "$TEMP_PLIST" 2>/dev/null ||
@funky-monkey
funky-monkey / gist:c597d720cedb7432d6af
Created February 17, 2016 20:32 — forked from Bouke/gist:11261620
Multiple Python installations on OS X

Previous versions used homebrew to install the various versions. As suggested in the comments, it's better to use pyenv instead. If you are looking for the previous version of this document, see the revision history.

$ brew update
$ brew install pyenv
$ pyenv install 3.5.0
$ pyenv install 3.4.3
$ pyenv install 3.3.6
$ pyenv install 3.2.6
$ pyenv install 2.7.10

$ pyenv install 2.6.9

@funky-monkey
funky-monkey / API.md
Created April 29, 2016 08:11 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

Sometimes we need to open Setting's Preferences not of our app, but of the iPhone itself. What should we do to acomplish this?

[UPDATE: Added Wallet And Apple Pay below]

[UPDATE: Changed prefs for Bluetooth]

keyboard

@funky-monkey
funky-monkey / ios-cell-registration-swift.md
Last active June 15, 2017 09:46 — forked from gonzalezreal/ios-cell-registration-swift.md
iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

A common task when developing iOS apps is to register custom cell subclasses for both UITableView and UICollectionView. Well, that is if you don’t use Storyboards, of course.

Both UITableView and UICollectionView offer a similar API to register custom cell classes:

public func registerClass(cellClass: AnyClass?, forCellWithReuseIdentifier identifier: String)
public func registerNib(nib: UINib?, forCellWithReuseIdentifier identifier: String)
@funky-monkey
funky-monkey / SSLPin.swift
Last active October 6, 2016 08:22 — forked from mdelete/gist:d9dbc320d5de347c2a85
Swift iOS SSL public key pinning
func connection(connection: NSURLConnection, didReceiveAuthenticationChallenge challenge: NSURLAuthenticationChallenge) {
if(challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust) {
var localTrust: Unmanaged<SecTrust>?
let serverTrust = challenge.protectionSpace.serverTrust!
let serverPublicKey = SecTrustCopyPublicKey(serverTrust).takeRetainedValue();
let certificateData = NSData(contentsOfFile: NSBundle.mainBundle().pathForResource("pinning-certificate", ofType: "der")!)
let localCertificate = SecCertificateCreateWithData(kCFAllocatorDefault, certificateData).takeRetainedValue();
let policy = SecPolicyCreateBasicX509().takeRetainedValue()
if SecTrustCreateWithCertificates(localCertificate, policy, &localTrust) == errSecSuccess {
@funky-monkey
funky-monkey / diff.mdown
Created November 17, 2016 10:34 — forked from ndarville/diff.mdown
Paul Heckel's Diff Algorithm

[Isolating Differences Between Files][paper]

Advantage over Other Algorithms

The diff output is more specific:

[I]f a whole block of text is moved, then all of it, rather than just the beginning and end, is detected as changed.

>The algorithm described here avoids these difficulties. It detects differences that correspond very closely to our intuitive notion of difference.

@funky-monkey
funky-monkey / Tutorial.md
Created November 18, 2016 21:03 — forked from RF-Nelson/Tutorial.md
Using the Multipeer Connectivity Framework to Create the Open Source Selfie Stick iOS App

Using the iOS Multipeer Connectivity Framework to Create Open Source Selfie Stick

In this gist, I will discuss how I used the Multipeer Connectivity framework to create Open Source Selfie Stick. Open Source Selfie Stick is a free open-source iOS app that allows users to sync two devices over WiFi or Bluetooth and allows one to act as a remote control for the other's camera.

This tutorial assumes some knowledge of the Swift programming language and iOS development with Xcode.

Feel free to comment and point out any errors or improvements. If you'd like to help improve the app itself, make a fork from dev branch of the git repo. I plan on updating this document and explaining any newly added features or refactoring. As this gist w

@funky-monkey
funky-monkey / optparse-template.rb
Created November 28, 2016 12:00 — forked from rtomayko/optparse-template.rb
Ruby optparse template
#!/usr/bin/env ruby
#/ Usage: <progname> [options]...
#/ How does this script make my life easier?
# ** Tip: use #/ lines to define the --help usage message.
$stderr.sync = true
require 'optparse'
# default options
flag = false
option = "default value"
# Ways to execute a shell script in Ruby
# Example Script - Joseph Pecoraro
cmd = "echo 'hi'" # Sample string that can be used
# 1. Kernel#` - commonly called backticks - `cmd`
# This is like many other languages, including bash, PHP, and Perl
# Returns the result of the shell command
# Docs: http://ruby-doc.org/core/classes/Kernel.html#M001111