Skip to content

Instantly share code, notes, and snippets.

@iamcam
iamcam / BuildPhase1.sh
Last active August 29, 2015 14:18
Automate iOS + WatchKit extension build numbers w/ Git
if [ ${CONFIGURATION} == "AppStore" ]; then
buildNumber=$(git rev-list HEAD | wc -l | tr -d ' ')
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/AppName/AppName-Info.plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/AppName WatchKit App/Info.plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/AppName WatchKit Extension/Info.plist"
fi;
if [ ${CONFIGURATION} == "Release" ]; then
buildNumber=$(git rev-list HEAD | wc -l | tr -d ' ')
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/AppName/AppName-Info.plist"
@webaware
webaware / gist:5d1dc611437dc60f25fb
Last active August 29, 2015 14:10
Add product description underneath the product title on an order form from Order Form for WooCommerce. Requires version 1.0.5 or higher. http://orderform-woo.webaware.net.au/
<?php
/**
* add product description to Order Form for WooCommerce product
* @param WC_Product $product
* @param array $attrs
*/
add_action('orderform_woocommerce_order_item_end', function($product, $attrs) {
$description = $product->get_post_data()->post_content;
@mchambers
mchambers / reflect.swift
Last active March 5, 2021 09:20
Basic Reflection in Swift.
// Let's define a basic Swift class.
class Fruit {
var type=1
var name="Apple"
var delicious=true
}
// We can get at some info about an instance of an object using reflect(), which returns a Mirror.
reflect(Fruit()).count
reflect(Fruit())[1].0