Skip to content

Instantly share code, notes, and snippets.

Bartosz Ciechanowski Ciechan

Block or report user

Report or block Ciechan

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
@Ciechan
Ciechan / private
Created Jun 11, 2014
Hacky private fields
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 {
@Ciechan
Ciechan / gist:110cd5eea24222d9a80e
Created May 25, 2014
This seems to tail call correctly with jmp instead of call
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)];
}
}
@Ciechan
Ciechan / gist:09cc466788fd99c7850a
Created May 22, 2014
BCMeshTransform left curtain
View gist:09cc466788fd99c7850a
/*
BCMutableMeshTransform+DemoTransforms.m
*/
+ (instancetype)curtainMeshTransformAtPoint:(CGPoint)point boundsSize:(CGSize)boundsSize
{
const float Frills = 3;
point.x = MIN(point.x, boundsSize.width);
@Ciechan
Ciechan / CALayer_CAMeshTransform_CALight.h
Created May 14, 2014
Cleaned up headers for CAMeshTransform, CALight, and mesh&lights properties of CALayer
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
@Ciechan
Ciechan / gist:8248521
Created Jan 3, 2014
this *sometimes* helps fixing the cell separator
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
You can’t perform that action at this time.