Skip to content

Instantly share code, notes, and snippets.

View joncardasis's full-sized avatar
🔬
📱 Probing iOS internals...

Jon Cardasis joncardasis

🔬
📱 Probing iOS internals...
View GitHub Profile
@caius
caius / ShowDerivedData.rb
Created November 5, 2011 13:49
A script for showing the derived data folder for an Xcode workspace. Intended to be invoked from a custom behaviour
#!/usr/bin/env ruby
# This script currently only works if you have your derived data in the default location.
# Get the workspace name to search for, or exit with code 1 if no value in envariable
xcodeWorkspacePath = ENV["XcodeWorkspacePath"] || exit(1)
projectName = xcodeWorkspacePath[%r{/(\w+)\.xcodeproj}, 1]
#Get the folders in derived data that could match the workspace
derived_data = File.expand_path("~/Library/Developer/Xcode/DerivedData")
# Glob out the files matching our project
@liovch
liovch / gist:3168961
Created July 24, 2012 09:01
GIMP color balance filter shader
NSString *const kColorShiftFragmentShaderString = SHADER_STRING
(
varying highp vec2 textureCoordinate;
uniform sampler2D inputImageTexture;
uniform lowp float redShift;
uniform lowp float greenShift;
uniform lowp float blueShift;
@foozmeat
foozmeat / openssl-build.sh
Last active May 22, 2024 17:56
A shell script to build openssl for iOS and Mac. It currently builds: Mac -> i386 & x86_64 // iOS -> armv7, arm64 // iOS Simulator -> i386 & x86_64.
#!/bin/bash
# This script builds the iOS and Mac openSSL libraries
# Download openssl http://www.openssl.org/source/ and place the tarball next to this script
# Credits:
# https://github.com/st3fan/ios-openssl
# https://github.com/x2on/OpenSSL-for-iPhone/blob/master/build-libssl.sh
@rismay
rismay / WSMMacros.h
Created January 25, 2014 20:13
Lazy Instantiation as a C MACRO
//You should pick one style to use consistantly in your project
//Lazy Intantiation as a C Macro clearly explaining the concept
#define WSM_LAZY(variable, assignment) (variable = variable ?: assignment)
//Lazy Intantiation as a C Macro clearly explaining the language syntax used
#define WSM_TERNARY(variable, assignment) (variable = variable ?: assignment)
//Lazy Intantiation as a semi-operator w/class prefix
#define WSM_$(variable, assignment) (variable = variable ?: assignment)
@felix-schwarz
felix-schwarz / openssl-build.sh
Last active March 19, 2024 03:16 — forked from steipete/openssl-build.h
Updated script that builds OpenSSL for OS X, iOS and tvOS. Bitcode enabled for iOS, tvOS. Updated to build for tvOS, use the latest SDKs, skip installing man pages (to save time), download the OpenSSL source over HTTPS, patch OpenSSL for tvOS to not use fork(). Currently requires Xcode7.1b or later (for the tvOS SDK).
#!/bin/bash
# This script downloads and builds the iOS, tvOS and Mac openSSL libraries with Bitcode enabled
# Credits:
# https://github.com/st3fan/ios-openssl
# https://github.com/x2on/OpenSSL-for-iPhone/blob/master/build-libssl.sh
# https://gist.github.com/foozmeat/5154962
# Peter Steinberger, PSPDFKit GmbH, @steipete.
# Felix Schwarz, IOSPIRIT GmbH, @felix_schwarz.
@rvl
rvl / git-pushing-multiple.rst
Created February 9, 2016 11:41
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

@acrookston
acrookston / README.md
Last active January 26, 2022 11:05
Xcode pre-action to build custom Info.plist

Automatic build versions from git in Xcode (and other goodies)

Installation procedure for pre-build actions to automatically populate Xcode Info.plist with dynamic data.

1. Xcode Scheme pre-action

Edit Xcode Scheme and add a pre-action script. Copy the contents of preaction.sh into the pre-action script box.

@joncardasis
joncardasis / String+Levenshtein.swift
Last active December 12, 2016 19:24
Levenshtein Algorithm in Swift 3 - Calculates the number of differences between two strings
extension String{
private func min(numbers: Int...) -> Int {
return numbers.reduce(numbers[0], {$0 < $1 ? $0 : $1})
}
func distanceFrom(string: String) -> Int{
let x = Array(self.utf16) //convert to a unicode 16 format for comparison
let y = Array(string.utf16)
//Create the Levenshtein 2d matrix, which has an extra preceeding row and column
@joncardasis
joncardasis / Measure.swift
Last active January 26, 2018 00:26
My Swift 3 Measure Execution time function using GCD
func measureBlock(_ description: String, numberOfExecutes: Int = 1, block: () -> Void) {
let start = DispatchTime.now()
for _ in 0..<numberOfExecutes {
block()
}
let end = DispatchTime.now()
let nanoTime = end.uptimeNanoseconds - start.uptimeNanoseconds
let secondsTime = (Double(nanoTime)/1000000000.0)
@chourobin
chourobin / 0-bridging-react-native-cheatsheet.md
Last active May 4, 2024 14:06
React Native Bridging Cheatsheet