This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require '/Applications/Zephyros.app/Contents/Resources/libs/zephyros.rb' | |
require 'time' | |
@last_time = Time.now - 10 | |
@times = 0 | |
## | |
# Simply returns a Proc instance with the passed block. | |
def command | |
Proc.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void) loadCustomFont:(NSString*)fontFileName ofType:(NSString*)extension bundle:(NSBundle*)bundle { | |
NSString *fontPath = [bundle pathForResource:fontFileName ofType:extension]; | |
NSData *inData = [NSData dataWithContentsOfFile:fontPath]; | |
CFErrorRef error; | |
CGDataProviderRef provider = CGDataProviderCreateWithCFData((__bridge CFDataRef)inData); | |
CGFontRef font = CGFontCreateWithDataProvider(provider); | |
if (!CTFontManagerRegisterGraphicsFont(font, &error)) { | |
CFStringRef errorDescription = CFErrorCopyDescription(error); | |
NSLog(@"Failed to load font: %@", errorDescription); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" ]; then | |
echo "Supply a name for the repo/site to publish" | |
exit 1; | |
fi | |
URLROOT=gitpages.mydomain.com | |
ROOT=/home/www/gitpages.mydomain.com | |
REPOS=$ROOT/repositories |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** File: Template Preprocessor | |
* Creates precompiled handlebar templates and makes them available as a simple | |
* common js module. | |
*/ | |
var Handlebars = require('handlebars') | |
, _ = require('underscore') | |
, path = require('path') | |
, fs = require('fs') | |
, templatesSource = path.join(__dirname, 'src', 'templates') | |
, templatesDestination = path.join(__dirname, 'src', 'templates', 'precompiledTemplates.js') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
SABNZBD_CONFIG=/root/.sabnzbd/sabnzbd.ini | |
SABNZBD_HOST=--HOST_ADDRESS-- | |
SABNZBD_PORT=9200 | |
SABNZBD_APIKEY=--YOUR_API_KEY-- | |
CP_PID=/var/run/couchpotato.pid | |
CP_CONFIG=/usr/local/couchpotato.config.ini | |
CP_DATADIR=/root/.couchpotato |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(BOOL)isCoordinate:(CLLocationCoordinate2D)coordinate insideRegion:(MKCoordinateRegion)region { | |
CLLocationCoordinate2D center = region.center; | |
CLLocationCoordinate2D northWestCorner, southEastCorner; | |
northWestCorner.latitude = center.latitude - (region.span.latitudeDelta / 2.0); | |
northWestCorner.longitude = center.longitude - (region.span.longitudeDelta / 2.0); | |
southEastCorner.latitude = center.latitude + (region.span.latitudeDelta / 2.0); | |
southEastCorner.longitude = center.longitude + (region.span.longitudeDelta / 2.0); | |
return(coordinate.latitude >= northWestCorner.latitude && |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface NSArray (ExtractValuesAsArray) | |
/** Creates a new NSArray with the specific value of the items of another array. Ensure that the items of the array are KVC compliant since a key path is used to gather the values. | |
*/ | |
+(NSArray*)arrayWithValuesOfArrayItems:(NSArray*)array keyPath:(NSString*)keyPath; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CGContextRef CreateBitmapContext(CGSize size) { | |
CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB(); | |
CGContextRef ctx = CGBitmapContextCreate(nil, size.width, size.height, 8, size.width * (CGColorSpaceGetNumberOfComponents(space) + 1), space, kCGImageAlphaPremultipliedLast); | |
CGColorSpaceRelease(space); | |
return ctx; | |
} | |
UIImage* CreateUIImageFromBitmapContext(CGContextRef ctx) { | |
CGImageRef cgImage = CGBitmapContextCreateImage(ctx); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NSArray *colors = @[[UIColor redColor], [UIColor greenColor], [UIColor blueColor]]; | |
// CGFloat locations[] = {0,.5,1}; | |
// DrawVerticalGradient(rect, colors, locations, ctx); | |
void DrawVerticalGradient(CGRect rect, NSArray* colors, const CGFloat steps[], CGContextRef ctx) { | |
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); | |
NSMutableArray *cgColors = [NSMutableArray arrayWithCapacity:colors.count]; | |
for (UIColor *color in colors) { | |
[cgColors addObject:(__bridge id)(color.CGColor)]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString* localizedProperty(NSString* propertyName, id fromObject); |