Skip to content

Instantly share code, notes, and snippets.

import SwiftUI
struct ContentView : View {
let sample = Story.sample
var body: some View {
ScrollView {
HStack(spacing: 16) {
Spacer()
ForEach(sample) { story in
VStack {
@augustjoki
augustjoki / sample.m
Last active November 5, 2015 00:48
block variables
__weak typeof(self) weakSelf = self;
AFJSONRequestOperation *operation =
[AFJSONRequestOperation JSONRequestOperationWithRequest:request
success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
NSDictionary *jsonDict = (NSDictionary *) JSON;
// this is the array that stores the JSON response
NSArray *csvFiles = [jsonDict objectForKey:@"csv_files"];
[weakSelf doSomethingWithTheArray:csvFiles];
} failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON) {
@augustjoki
augustjoki / gist:1119392
Created August 2, 2011 01:14
Kill implicit animations
[CATransaction begin];
[CATransaction setValue:(id)kCFBooleanTrue
forKey:kCATransactionDisableActions];
// do stuff
[CATransaction commit];
@augustjoki
augustjoki / gist:1119391
Created August 2, 2011 01:14
Kill implicit animations
[CATransaction begin];
[CATransaction setValue:(id)kCFBooleanTrue
forKey:kCATransactionDisableActions];
[aLayer removeFromSuperlayer];
[CATransaction commit];
@augustjoki
augustjoki / gist:969755
Created May 13, 2011 00:50
UITableViewCell reuse identifier
+ (NSString *)reuseIdentifier {
static NSString *reuseIdentifier;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
reuseIdentifier = [NSStringFromClass(self) retain];
});
return reuseIdentifier;
}
@augustjoki
augustjoki / Log.txt
Created May 10, 2011 19:58 — forked from evadne/Log.txt
Shared instances for all
2011-05-11 03:25:07.462 GlobalSingletonSupportTest[63618:1803] irSharedInstance instance NSObject 15f980, 181511 ns
2011-05-11 03:25:07.465 GlobalSingletonSupportTest[63618:5303] irSharedInstance instance NSObject 15f980, 614 ns
2011-05-11 03:25:07.465 GlobalSingletonSupportTest[63618:5403] irSharedInstance instance NSObject 15f980, 584 ns
2011-05-11 03:25:07.464 GlobalSingletonSupportTest[63618:a0f] irSharedInstance instance NSObject 15f980, 1546 ns
2011-05-11 03:25:07.466 GlobalSingletonSupportTest[63618:a0f] irSharedInstance instance NSObject 15f980, 1545 ns
#!/bin/sh
if [ -d "$BUILT_PRODUCTS_DIR/${PRODUCT_NAME}.app/foo.bundle" ]; then
rm -rf "$BUILT_PRODUCTS_DIR/${PRODUCT_NAME}.app/foo.bundle"
fi
if [ -d "$BUILT_PRODUCTS_DIR/foo.bundle" ]; then
cp -r "$BUILT_PRODUCTS_DIR/foo.bundle" "$BUILT_PRODUCTS_DIR/${PRODUCT_NAME}.app/"
fi
CGFloat CGContextShadowOrientationYMultiplier() {
static CGFloat sharedMultiplier__ = 0.0;
if (sharedMultiplier__ == 0.0) {
NSString *version = [UIDevice currentDevice].systemVersion;
sharedMultiplier__ = ([version compare:@"3.2"] == NSOrderedAscending) ? 1.0f : -1.0f;
}
return sharedMultiplier__;
}
#import <Foundation/Foundation.h>
int main() {
CGFloat version = [@"4.2.1" floatValue];
NSLog(@"version: %f", version);
}
O2Machina:~ karl$ gcc main.m -o test -framework Foundation
O2Machina:~ karl$ ./test
$lipo libTapjoyConnectDeviceConnect.a libTapjoyConnectSimulatorConnect.a -create -output libTapjoyConnect.a