Skip to content

Instantly share code, notes, and snippets.

Kasper Munck kaspermunck

Block or report user

Report or block kaspermunck

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kaspermunck
kaspermunck / gist:9b1dcbf07773b22e109eefd552200e00
Created Aug 10, 2016
Creating encrypted Realm and attempting to catch any exception thrown.
View gist:9b1dcbf07773b22e109eefd552200e00
var configuration = Realm.Configuration.defaultConfiguration
let encryptionKey = NSMutableData(length: 64)!
SecRandomCopyBytes(kSecRandomDefault, encryptionKey.length, UnsafeMutablePointer<UInt8>(encryptionKey.mutableBytes))
configuration.encryptionKey = encryptionKey
let filename = "private.realm"
let fileURL = configuration.fileURL?.URLByAppendingPathComponent(filename)
configuration.fileURL = fileURL
@kaspermunck
kaspermunck / Nibloading category
Created May 7, 2014
An example of how loading a nib file with a custom view can be done
View Nibloading category
// UIView+KHMNibLoading.h
@interface UIView (KHMNibLoading)
+ (instancetype)viewFromNib;
@end
// UIView+KHMNibLoading.m
+ (instancetype)viewFromNib {
NSString *className = NSStringFromClass([self class]);
@kaspermunck
kaspermunck / org.jenkins-ci.plist
Last active Dec 17, 2015
Modified org.jenkins-ci.plist. An attempt to make Jenkins work with xctool.
View org.jenkins-ci.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>StandardOutPath</key>
<string>/var/log/jenkins/jenkins.log</string>
<key>StandardErrorPath</key>
<string>/var/log/jenkins/jenkins.log</string>
<key>EnvironmentVariables</key>
<dict>
@kaspermunck
kaspermunck / build_and_run_unit_tests.sh
Created Apr 12, 2013
A slightly modified XcodeTest build script that works for projects with Kiwi installed via CocoaPods (that use workspaces).
View build_and_run_unit_tests.sh
#!/bin/bash
# Script to compile and run unit tests from the command line
# The scheme and target name of the main app
MAIN_APP_TARGET="$1"
# The scheme and target name of the unit tests
UNIT_TEST_TARGET="$2"
# The path to libXcodeTest.a, if not in current directory
@kaspermunck
kaspermunck / install_dependencies.sh
Created Apr 12, 2013
Installs dependency (WaxSim) of XcodeTest, which is needed to run application unit tests from command line. Run from before_install: in .travis.yml before building with XcodeTest.
View install_dependencies.sh
#!/bin/bash
# run prior to building with XcodeTest to install WaxSim.
# clone and install waxsim
git clone https://github.com/jonathanpenn/WaxSim.git
cd WaxSim
xcodebuild install DSTROOT=/ INSTALL_PATH=/usr/local/bin
@kaspermunck
kaspermunck / unity3d.gitignore
Created Apr 10, 2013
I went to Recreate-Hell and back after having used an insufficient .gitignore file with Unity3d (I lost all metadata for all my prefabs, models and materials). Here's a .gitignore file that will save you from the troubles I had. Note that you must enable meta data files as noted in the file.
View unity3d.gitignore
# .gitignore file to use with Unity3d projects on a mac
# annoying, autogenerated, hidden file used by Finder
.DS_Store
# Enable Meta Files in in Unity -> Edit -> Project Settings -> Editor
# or you will mess up your prefabs, models and materials when
# ignoring Library/
Library/
You can’t perform that action at this time.