Skip to content

Instantly share code, notes, and snippets.

View chaudum's full-sized avatar
🏠
Working from home

Christian Haudum chaudum

🏠
Working from home
View GitHub Profile
@chaudum
chaudum / main.m
Created February 6, 2012 14:46
Subtracting the count of 2 arrays and casting it to a float
NSArray *arr1 = [NSArray arrayWithObjects:@"1", @"2", nil];
NSLog(@"[arr1 count] %lu", [arr1 count]);
NSArray *arr2 = [NSArray arrayWithObjects:@"1", @"2", @"3", nil];
NSLog(@"[arr2 count] %lu", [arr2 count]);
float diff1 = (float) ([arr1 count] - [arr2 count]);
NSLog(@"diff1: %f", diff1);
NSLog(@"UINT64_MAX: %llu", UINT64_MAX);
@chaudum
chaudum / traceback.log
Created March 31, 2012 15:13
Madvertise SDK exception after fetching ad
2012-03-31 16:09:45.652 Dubbase FM[42501:707] MadvertiseView.m (230): Deserializing json
2012-03-31 16:09:45.653 Dubbase FM[42501:707] -[NSConcreteMutableData objectFromJSONData]: unrecognized selector sent to instance 0xd676a10
2012-03-31 16:10:07.094 Dubbase FM[42501:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSConcreteMutableData objectFromJSONData]: unrecognized selector sent to instance 0xd676a10'
@chaudum
chaudum / antigravity
Created April 5, 2012 08:33
Python Antigravity
christian:~ $ python27
Python 2.7.2 (default, Feb 8 2012, 10:16:42)
[GCC 4.2.1 Compatible Apple Clang 3.0 (tags/Apple/clang-211.10.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import antigravity
@chaudum
chaudum / gist:2652397
Created May 10, 2012 10:52
Correctly rounded images in UITableViewCell
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
UIRectCorner cornerDef;
if (indexPath.row == 0) {
cornerDef = UIRectCornerTopLeft|UIRectCornerTopRight;
} else if (indexPath.row == 1) {
cornerDef = UIRectCornerBottomLeft|UIRectCornerBottomRight;
}
CAShapeLayer *maskLayer = [CAShapeLayer layer];
UIBezierPath *roundedPath = [UIBezierPath bezierPathWithRoundedRect:cell.bounds
byRoundingCorners:cornerDef cornerRadii:CGSizeMake(9.0f, 9.0f)];
@chaudum
chaudum / jaro_winkler_distance.py
Last active December 10, 2015 22:58
The higher the Jaro–Winkler distance for two strings is, the more similar the strings are. The Jaro–Winkler distance metric is designed and best suited for short strings such as person names. The score is normalized such that 0 equates to no similarity and 1 is an exact match.
import math
## JARO-WINKLER-DISTANCE
## Ported from http://www.iugrina.com/files/JaroWinkler/JaroWinkler.phps
def get_common_chars(str1, str2, allowed_distance):
str1_len = len(str1)
str2_len = len(str2)
tmp_str2 = [str2[x] for x in xrange(len(str2))]
common_chars = []
@chaudum
chaudum / Emscripten-Clang-Macports.md
Last active December 17, 2015 23:39
Emscripten emcc does not find mm_malloc.h when using Macports clang-3.2

test.c

#include <stdio.h>
#include <mm_malloc.h>

int main(int argc, const char * argv[]) {
	float *floatBuffer = _mm_malloc(256*sizeof(float), 16);
	_mm_free(floatBuffer);
	printf("%s\n", "Done!");
}
@chaudum
chaudum / Job-Offer-Django-Developer.md
Last active December 19, 2015 07:39
Job offer for a Django Developer at RjDj.

Python/Django Developer

Want to work with the team behind Last.fm, RjDj.me or Inception The App? Here is your chance! We are looking for a full-time Web Developer for an exciting new project.

image

This is you ...

  • You’re ready for your first or second job in a highly dynamic and fast moving startup environment.
@chaudum
chaudum / CHANGES.txt
Created July 28, 2014 15:39
crate 0.40.3
2014/07/28 0.40.3
=================
- fix: ORDER BY using non-indexed (index off) column do fail silently
- fix: grouping or global aggregation using non-indexed (index off)
or analyzed (fulltext) column throws misleading exception
- added documentation for match function

Keybase proof

I hereby claim:

  • I am chaudum on github.
  • I am christianhaudum (https://keybase.io/christianhaudum) on keybase.
  • I have a public key whose fingerprint is EBCE F684 BA35 529C B936 E65B 9EBD BC4E EBD1 576F

To claim this, I am signing this object:

@chaudum
chaudum / AwesomeCrateClass.java
Last active August 29, 2015 14:05
JUnit4 Testcase
package io.crate
public class AwesomeCrateClass {
public Boolean myMethod(Boolean value) {
return !value;
}
}