View private
class Counter {
let inc : () -> Int
let dec : () -> Int
init(inc : () -> Int, dec : () -> Int) {
self.inc = inc;
self.dec = dec;
}
}
func CounterCreator(initial :Int) -> Counter {
View gist:110cd5eea24222d9a80e
+ (NSUInteger)lengthOfListWithHead:(ListNode *)node count:(NSUInteger)count {
if (!node)
return count;
else {
__unsafe_unretained id n = node.next;
return [self lengthOfListWithHead:n count:(count + 1)];
}
}
View gist:09cc466788fd99c7850a
/*
BCMutableMeshTransform+DemoTransforms.m
*/
+ (instancetype)curtainMeshTransformAtPoint:(CGPoint)point boundsSize:(CGSize)boundsSize
{
const float Frills = 3;
point.x = MIN(point.x, boundsSize.width);
View CALayer_CAMeshTransform_CALight.h
#ifndef CALayer_CAMeshTransform_CALight_h
#define CALayer_CAMeshTransform_CALight_h
typedef struct CAMeshFace {
unsigned int indices[4];
float w[4];
} CAMeshFace;
View gist:11216080
NSMutableString *s = [NSMutableString stringWithString:@"Hello"];
NSSet *set = [NSSet setWithObjects:s, nil];
NSLog(@"%d", [set containsObject:s]);
[s appendString:@"BLA"];
NSLog(@"%d", [set containsObject:s]);
NSLog(@"%d", [set.allObjects containsObject:s]);
View _UISiriWaveyView shader
// fragment shader
precision lowp float;
struct FSInput {
vec2 _texcoord;
sampler2D _texture;
float _opacity;
};
struct FSOutput {vec4 _color1;};
View CFArray.c
/*
* Copyright (c) 2013 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
View gist:8248521
@implementation UITableViewCell (SeparatoriOS7Fix)
- (void)fixSeparator
{
UIEdgeInsets insets = self.separatorInset;
self.separatorInset = UIEdgeInsetsMake(insets.top, insets.left + 1.0, insets.bottom, insets.right);
self.separatorInset = insets;
}
@end