Skip to content

Instantly share code, notes, and snippets.

@SpacyRicochet
SpacyRicochet / calabash_steps.rb
Created April 16, 2012 10:04
Useful step definitions for calabash-ios
require 'calabash-cucumber/calabash_steps'
Then /^I should see the keyboard$/ do
res = element_exists( "keyboardAutomatic" )
if not res
screenshot_and_raise "Expected keyboard to be visible."
end
end
Then /^I should not see the keyboard$/ do
@SpacyRicochet
SpacyRicochet / .gitignore
Created May 10, 2012 13:34
gitignore for XCode 4
# Exclude OS X specific stuff
*~
.DS_Store
# Exclude XCode build folder
build/
# Exclude XCode temp nibs and swap files
*.swp
*~.nib
@SpacyRicochet
SpacyRicochet / pre-archive-action.sh
Created June 6, 2012 12:18 — forked from kommen/pre-archive-action.sh
Pre-Archive action for Xcode 4.2 to auto increment CFBundleVersion
# Upload with HockeyApp
open -a HockeyApp "${ARCHIVE_PATH}"
# Auto increment CFBundleVersion
buildPlist="${SRCROOT}/${INFOPLIST_FILE}"
CFBundleVersion=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" $buildPlist)
CFBundleVersion=$(($CFBundleVersion + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $CFBundleVersion" $buildPlist
@SpacyRicochet
SpacyRicochet / Xcode4HockeyAppIntegration.sh
Created June 6, 2012 12:50 — forked from c0diq/Xcode4HockeyAppTestFlightintegration.sh
Automatic HockeyApp Upload XCode Script
#!/bin/bash
#
# (Above line comes out when placing in Xcode scheme)
#
# Inspired by original script by incanus:
# https://gist.github.com/1186990
#
# Rewritten by martijnthe:
# https://gist.github.com/1379127
#
@SpacyRicochet
SpacyRicochet / xcodesnippets
Created October 8, 2012 14:10
Useful XCode snippets
// DebugView: Adds a Quartz border around the view.
// shortcut: debugView
// scope: Function or Method
// Don't forget to #import <QuartzCore/QuartzCore.h>.
<#view#>.layer.borderColor = [UIColor cyanColor].CGColor;
<#view#>.layer.borderWidth = 1.f;
// Localized String: Makes it easier to start localizing from the get-go.
@SpacyRicochet
SpacyRicochet / gist:5958118
Last active December 19, 2015 12:49
Mailing list subscription
_chimpKit = [[ChimpKit alloc] initWithDelegate:self andApiKey:@"APIKEY"];
NSDictionary *mergeVars = @{
@"FNAME" : @"Code name",
@"EMAIL" : @"codename@email.com",
@"BIRTHDAY" : @"dd-MM-yyyy",
@"GENDER" : @"male", // or 'female'
@"LANGUAGE" : NSLocalizedString(@"Key", nil), // localized string
@"MC_LANGUAGE" : NSLocalizedString(@"HFXMailchimpLanguageString", nil), // localized string
@"SUBSCRIBE" : @"yes", // or 'no'
};
@SpacyRicochet
SpacyRicochet / gist:6193870
Last active December 20, 2015 20:59
Interesting scripts for video and audio conversion
// For the directory 'en' find all m4v files and combine add the audio of other languages.
find * -name "*.m4v" -exec ffmpeg -i "{}" -i "../de/{}" -i "../fr/{}" -i "../nl/{}" -i "../sp/{}" -map 0 -map 1:a:0 -map 2:a:0 -map 3:a:0 -map 4:a:0 -metadata:s:a:0 language=eng -metadata:s:a:1 language=deu -metadata:s:a:2 language=fra -metadata:s:a:3 language=nld -metadata:s:a:4 language=spa -y "../all/{}" \;
// Make all audio of every m4v file mono and lower the sound bit rate to 48k. Change the size.
find * -name "*.mp4" -exec ffmpeg -i "{}" -map 0 -ac 1 -ab 48k -s 504x896 -y "../all_lq/{}" \;
// Use the following syntax to parse other extensions. Taken from: http://stackoverflow.com/a/8107281/571461
find -L . -type f -name "*.mp4" -exec sh -c 'ffmpeg -i ${1%.mp4}.wav' _ {} \;
# Upload with HockeyApp
open -a HockeyApp "${ARCHIVE_PATH}"
# Auto increment CFBundleVersion
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${INFOPLIST_FILE}"
@SpacyRicochet
SpacyRicochet / Person.h
Last active January 3, 2016 09:29
Instead of overriding class initializers, consider overriding the new methods. There's only one default 'new' method, which makes autocompletion of your own custom ones a lot easier.
/** A person, with a name. */
@interface Person : NSObject
/** Creates a new person with the specified name. */
+ (id)newWithString:(NSString *)name;
@end
@SpacyRicochet
SpacyRicochet / gist:8958266
Last active August 29, 2015 13:56
One-liners to convert retina images to non-retina images
find . -name "*@2x.png" -exec convert "{}" -resize 50% "{}.bak" \;
find . -name "*@2x.png.bak" -exec rename 's|\@2x.png.bak|.png|' "{}" \;