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 / 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;
}
}
package io.crate.metadata.settings;
import com.google.common.collect.Sets;
import org.junit.Test;
import static org.junit.Assert.*;
public class CrateSettingsTest {
@Test
OsService osService = mock(OsService.class);
OsStats osStats = mock(OsStats.class);
OsStats.Mem mem = mock(OsStats.Mem.class);
when(osStats.mem()).thenReturn(mem);
when(mem.actualFree()).thenReturn(byteSizeValue);
when(mem.actualUsed()).thenReturn(byteSizeValue);
when(mem.usedPercent()).thenReturn((short) 22);
when(mem.freePercent()).thenReturn((short) 78);
bind(OsService.class).toInstance(osService);
...
childImplementations.put(FREE, new MemoryExpression(FREE) {
@Override
public Long value() {
return osService.stats().mem().actualFree().bytes();
}
});
childImplementations.put(USED, new MemoryExpression(USED) {
@Override
public Long value() {
@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)];