Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am xeresrazor on github.
  • I am xeresrazor (https://keybase.io/xeresrazor) on keybase.
  • I have a public key ASBKknB3UphdpAtCWk71P92IV9HXE06U1KTHsxnXM8l-XQo

To claim this, I am signing this object:

//
// NSData+ValueReading.h
//
// Created by David Green on 6/16/14.
// Copyright (c) 2014 David Green. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSData (ValueReading)
#include "DWCArray.h"
GenerateArray(int, IntArray)
typedef struct {
int intA;
float floatB;
} MyStruct;
GenerateArray(MyStruct, MyArray)
@XeresRazor
XeresRazor / MutableVector.h
Created February 21, 2013 21:56
Mutable C vector generation macros
//
// MutableVector.h
// smashbots
//
// Created by David Green on 12/8/12.
// Copyright (c) 2012 Digital Worlds Entertainment. All rights reserved.
//
#include <stdint.h>
#include <stdlib.h>
@XeresRazor
XeresRazor / gist:5007084
Last active December 14, 2015 01:29
Corrected Xamarin Attributed String sample.
NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:@"Hello World" attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:16.0], NSForegroundColorAttributeName: [UIColor blackColor]}];
@XeresRazor
XeresRazor / gist:5007017
Last active December 14, 2015 01:29
Cleaned up Xamarin Example
CGImageRef cgImage;
CIContext *context = [CIContext contextWithOptions:@{kCIContextUseSoftwareRenderer: @YES}];
CIImage *ciImage = [CIImage imageWithCGImage:cgImage];
CIFilter *hueAdjustFilter = [CIFilter filterWithName:@"CIHueAdjust" keysAndValues:@"inputAngle", @(3.0 * M_PI), @"inputImage", ciImage, nil];
CIFilter *colorControlsFilter = [CIFilter filterWithName:@"CIColorControls" keysAndValues:@"inputSaturation", @(1.3), @"inputBrightness", @(0.3), @"inputImage", hueAdjustFilter.outputImage, nil];
ciImage = colorControlsFilter.outputImage;
[context createCGImage:ciImage fromRect:ciImage.extent];
@XeresRazor
XeresRazor / MutableVector.h
Created December 9, 2012 19:30
Templated Mutable Vectors in C
//
// MutableVector.h
//
// Created by David Green on 12/8/12.
// Copyright (c) 2012 Digital Worlds Entertainment. All rights reserved.
//
#include <stdint.h>
#include <stdlib.h>
#include <assert.h>
@XeresRazor
XeresRazor / Utils.h
Created March 12, 2012 20:22
Simple file logger
#import <Foundation/Foundation.h>
@interface Utils : NSObject {
}
+(void)fileLogMessage:(NSString *)message;
@end
@implementation Utils
static FILE *logFile = NULL;
@XeresRazor
XeresRazor / DGMutableArray.c
Created March 9, 2012 17:42
Resizeable C arrays
//
// DGMutableArray.c
// ArrayTest
//
// Created by David Green on 3/9/12.
// Copyright (c) 2012 David Green. All rights reserved.
//
// Object model inspired an article by Mike Ash.
//