Skip to content

Instantly share code, notes, and snippets.

@insanehunter
insanehunter / gist:1181852
Created August 30, 2011 19:54
Running application tests using WaxSim
waxsim -f iphone -e CFFIXED_USER_HOME="/Users/ihunter/Library/Application Support/iPhone Simulator/5.0" \
-e DYLD_FALLBACK_FRAMEWORK_PATH="/Developer/Library/Frameworks" \
-e DYLD_FRAMEWORK_PATH="/Users/ihunter/Work/MyApp/build/Debug-iphonesimulator" \
-e DYLD_INSERT_LIBRARIES="/../../Library/PrivateFrameworks/IDEBundleInjection.framework/IDEBundleInjection" \
-e DYLD_LIBRARY_PATH="/Users/ihunter/Work/MyApp/build/Debug-iphonesimulator" \
-e DYLD_ROOT_PATH="/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk" \
-e IPHONE_SIMULATOR_ROOT="/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk" \
-e NSUnbufferedIO=YES \
-e XCInjectBundle="/Users/ihunter/Work/MyApp/build/Debug-iphonesimulator/Functest.octest" \
-e XCInjectBundleInto="/Users/ihunter/Work/MyApp/build/Debug-iphonesimulator/MyApp.app/MyApp"
@insanehunter
insanehunter / gcovr-noassert
Created September 10, 2011 08:20
Tweaked gcovr script to enable skipping functions and lines
#! /usr/bin/env python
#
# A report generator for gcov 3.4
#
# This routine generates a format that is similar to the format generated
# by the Python coverage.py module. This code is similar to the
# data processing performed by lcov's geninfo command. However, we
# don't worry about parsing the *.gcna files, and backwards compatibility for
# older versions of gcov is not supported.
#
@insanehunter
insanehunter / 01. Main Window.feature
Created December 6, 2011 15:41
MacCuke Functional Test Example
Feature: Main Window
As a user I expect application to display its main window with correct title.
(The title should be a short application name according to Mac HIG).
Another essential window part is a sidebar, providing access to main application
features.
Scenario: Application displays main window
I see a window titled "Make Buzz!"
Scenario: Application window has sidebar
@insanehunter
insanehunter / Run ruby script in Terminal.sublime-build
Created January 13, 2013 13:30
A Sublime Text 2 build script to launch ruby script in new OSX Terminal window.
{
"cmd": ["osascript", "-e", "tell app \"Terminal\"\nactivate\ndo script \"clear; ruby $file; tput setaf 7; echo '\n\n\n\nPress any key to close.'; tput sgr0; read -n 1 -s; exit\"\nend tell"]
}
@insanehunter
insanehunter / lldb command
Last active December 12, 2015 06:48
LLDB command to skip breakpoint when running unit tests (when SenTestingKit framework is loaded).
script ('SenTestingKit' in [x.file.basename for x in lldb.target.modules] and lldb.thread.GetProcess().Continue())
@insanehunter
insanehunter / Versioned.swift
Last active August 29, 2015 14:15
Versioned: monad-like structure for holding version number along with any value
public struct Versioned<T> {
public init(_ value: T) {
self.value = value
self.version = VersionGenerator.generateVersion()
}
public init(_ value: T, version: VersionGenerator.VersionType) {
self.value = value
self.version = version
}
@insanehunter
insanehunter / ConstantAccessTimeDictionaryView.swift
Created February 21, 2015 14:45
ConstantAccessTimeDictionaryView: Dictionary representation with constant time access to values by keys
public struct ConstantAccessTimeDictionaryView<Key: Hashable, Value> {
public typealias IndexType =
Versioned<_ConstantAccessTimeDictionaryView<Key, Value>.IndexType>
public init(dict: [Key : Value]) {
view = Versioned(_ConstantAccessTimeDictionaryView(dict))
}
public func index(key: Key) -> IndexType? {
return view.value.index(key).map { IndexType($0, version: self.view.version) }
@insanehunter
insanehunter / AccessibleOnQueue.swift
Last active August 29, 2015 14:15
AccessibleOnQueue: Practical example of Applicative Functor to run composition of functions in background queue
/// Structure holding value that should be accessed and mutated on
/// some dispatch queue.
///
/// Note: changing this to struct triggers a bug that 'forgets' mutations
public class AccessibleOnQueue<T> {
public init(_ value: T) {
_value = value
}
/// Creates a writer that can access and change stored value
@insanehunter
insanehunter / gist:bbc18f392e06efd1a01e
Created September 25, 2015 13:20
шелл скрипт который фиксит шрифты в имаеджмеджике
# Make a new directory for ImageMagick local settings and cd into it
mkdir ~/.magick
cd ~/.magick
# Grab script to find all fonts on system and store them in a config file
curl http://www.imagemagick.org/Usage/scripts/imagick_type_gen > type_gen
# Run script, telling it where my fonts are and create "type.xml" file with list
find /System/Library/Fonts /Library/Fonts ~/Library/Fonts -name "*.[to]tf" | perl type_gen -f - > type.xml
@insanehunter
insanehunter / latest_version.txt
Last active October 10, 2023 16:12
AM-iOS pre-commit hook latest version
1.3.1