Skip to content

Instantly share code, notes, and snippets.

View below's full-sized avatar
💭
I love feedback on my ARM64 Repo

Alexander von Below below

💭
I love feedback on my ARM64 Repo
View GitHub Profile
@below
below / gist:1501383
Created December 20, 2011 12:17
Simple Script to set a version number in the Info Plist
# This needs to go into a script build phase prior to "Copying resources"
# Set the version from version.txt
product_version=`cat version.txt`
# Instead of version.txt, you can use whatever your filthy heart desires
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion \"$product_version\"" "$TARGET_BUILD_DIR/$INFOPLIST_PATH"
exit 0
@below
below / gist:3447720
Created August 24, 2012 08:51
Make less do more in OS X Terminal
# Configure less to register the represented file with the terminal.
if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
export LESS='-P?n?f'"$(printf '\e]6;%%f\a')"'%f .?m(file %i of %m) ..?e(END) ?x- Next\: %x..%t'
fi
@below
below / pseudo
Created October 21, 2013 11:19
Total Pseudocode
BOOL compilerSwitch = NO;
#ifdef __FOOCOMPILERDEFINE__
compilerSwitch = YES;
#endif
if (compilerSwitch || [self someOtherActivationLikeInAppPurchaseOrYouNameIt]) {
[MrScott energize];
}
@below
below / gist:7419166
Created November 11, 2013 19:44
Also er baut, und dann kommt plötzlich (und ohne Ausführung der Tests):
** TEST SUCCEEDED **
[FOO] $ /bin/bash -xe /var/folders/kx/gv59n06j26n3n1fwxsxctb_m0000gq/T/hudson2864317743272309338.sh
Recording test results
No test report files were found. Configuration error?
Build step 'Publish JUnit test result report' changed build result to FAILURE
Finished: FAILURE`
I would think my question is pretty easy, as what I am trying to do seems like a very common use case.
There are two entities, "Speaker" and "Session". And the Speaker has a to-many relationship, "sessions", with an inverse in the Session entity. So a Speaker can be related to many sessions, and a Session can have many speakers.
My problem is in the UI: I have an NSArrayController, "SpeakerSessionController", its purpose is to show the sessions currently associated with the selected speaker. So the goal was to set its content array to the sessions key of the selection of my "SpeakerController". That does not work natively (neither does setting the content set), so I threw in a value transformer to transform the _NSMutableFaultingSet to an NSArray.
So far, so good. I can now add a session to the speaker it seems, putting a breakpoint into the value transformer shows me that there is an object.
But it is not shown in the table view that should be listing all the sessions for the selected speaker. Where am I
@below
below / swift try
Last active August 29, 2015 14:02
import Foundation
var str = "https://github.com/robelkin/altconf-data/raw/master/sessions.json"
let url = NSURL(string:str)
var error : NSErrorPointer = nil
if (url != nil) {
let jsonData = NSData(contentsOfURL: url!, options: .Data, error: error)
var trust : Unmanaged<SecTrust>?
let status : OSStatus = SecTrustCreateWithCertificates(nil, nil, &trust)
let certificate = SecTrustGetCertificateAtIndex(trust?.takeUnretainedValue(), 0)
let serverCertData = SecCertificateCopyData(certificate).takeUnretainedValue()
/*
error: cannot convert the expression's type 'CFData' to type '$T6'
let serverCertData = SecCertificateCopyData(certificate).takeUnretainedValue()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
*/
@below
below / gist:1192cb4cb613c13c3e54
Created September 24, 2014 14:19
objc_msgSend
- (void) bar {
SEL selector = @selector(foo);
typedef void (send_type) (id, SEL);
send_type func = (send_type)objc_msgSend();
func (self, selector);
}
foobar.m:25:22: error: used type 'send_type' (aka 'void (__strong id, SEL)') where arithmetic or pointer type is required
send_type func = (send_type)objc_msgSend();
@below
below / FileHandle.playground
Created October 28, 2014 12:41
Swift FileHandle Test
// Playground - noun: a place where people can play
import Cocoa
import XCPlayground
let path = XCPSharedDataDirectoryPath + "log.txt"
let fileURL = NSURL(fileURLWithPath: path)
if (fileURL != nil) {
var error : NSError? = nil;
let fileHandle = NSFileHandle(forWritingToURL: fileURL!, error:&error)
import UIKit
protocol myProtocol {
func dothatthing () -> Void
}
var array : [protocol<myProtocol>] = []
class A : myProtocol {
func dothatthing() {