Skip to content

Instantly share code, notes, and snippets.

View blackgold9's full-sized avatar

Stephen Vanterpool blackgold9

View GitHub Profile
DOMAIN = 'media_player'
REQUIREMENTS = ['jvc_tools==0.1.3']
import logging
import voluptuous as vol
from homeassistant.helpers.entity import ToggleEntity
_LOGGER = logging.getLogger(__name__)
platform :ios, :deployment_target=>"6.0"
inhibit_all_warnings!
target :todayGHTests, :exclusive => true do
link_with 'todayGHUnitTests'
pod 'Specta'
pod 'OCHamcrest'
pod 'Expecta', :git=>'git@github.com:blackgold9/expecta.git'
pod 'OCMock'
pod 'GHUnitIOS'
Ld /Users/svanter/Library/Developer/Xcode/DerivedData/Today-fwbocoigxhinoqcjapbfvowxhzwp/Build/Products/Debug-iphoneos/todayGHUnitTests.app/todayGHUnitTests normal armv7
cd /Users/svanter/git/iOS-TodayApp/Today
setenv IPHONEOS_DEPLOYMENT_TARGET 6.1
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -L/Users/svanter/Library/Developer/Xcode/DerivedData/Today-fwbocoigxhinoqcjapbfvowxhzwp/Build/Products/Debug-iphoneos -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/lib/system -F/Users/svanter/Library/Developer/Xcode/DerivedData/Today-fwbocoigxhinoqcjapbfvowxhzwp/Build/Products/Debug-iphoneos -F/
@blackgold9
blackgold9 / gist:4115078
Created November 20, 2012 00:15
AFIamgeRequestOperation modification
static dispatch_queue_t af_image_request_operation_processing_queue;
static dispatch_queue_t image_request_operation_processing_queue() {
if (af_image_request_operation_processing_queue == NULL) {
af_image_request_operation_processing_queue = dispatch_queue_create("com.alamofire.networking.image-request.processing", 0);
dispatch_set_target_queue(af_image_request_operation_processing_queue, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0));
}
return af_image_request_operation_processing_queue;
}
@blackgold9
blackgold9 / gist:3856657
Created October 9, 2012 04:41
Alternate contextWillSave
- (void)contextWillSave:(NSNotification *)notification
{
NSManagedObjectContext *context = (NSManagedObjectContext *)notification.object;
if (context.insertedObjects.count > 0) {
NSArray *insertedObjects = [[context insertedObjects] allObjects];
MRLog(@"Context %@ is about to save. Obtaining permanent IDs for new %lu inserted objects", [context MR_description], (unsigned long)[insertedObjects count]);
__autoreleasing NSError *error = nil;
BOOL success = [context obtainPermanentIDsForObjects:insertedObjects error:&error];
if (!success && error) {
[MagicalRecord handleErrors:error];
@blackgold9
blackgold9 / MR_inCOntextFix.m
Created August 2, 2012 23:08
Made this "fix" to MR_inContext
- (id) MR_inContext:(NSManagedObjectContext *)otherContext
{
__block NSError *error;
if ([self.objectID isTemporaryID]) {
if (otherContext.parentContext == self.managedObjectContext)
{
// We have a temporary id, which can never be used to lookup accross contexts, but we're trying it from a child context, so we can just get it
[self.managedObjectContext performBlockAndWait:^{
MRLog(@"Automatically obtaining a permanent Id so we can find it in a child context");
[self.managedObjectContext obtainPermanentIDsForObjects:[NSArray arrayWithObject:self] error:nil];
@blackgold9
blackgold9 / gist:1668813
Created January 24, 2012 08:17
modifications to enqueueOperation
-(void) enqueueOperation:(MKNetworkOperation*) operation forceReload:(BOOL) forceReload {
dispatch_queue_t originalQueue = dispatch_get_current_queue();
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[operation setCacheHandler:^(MKNetworkOperation* completedCacheableOperation) {
// if this is not called, the request would have been a non cacheable request
//completedCacheableOperation.cacheHeaders;
NSString *uniqueId = [completedCacheableOperation uniqueIdentifier];
[self saveCacheData:[completedCacheableOperation responseData]
forKey:uniqueId];
@blackgold9
blackgold9 / gist:1654503
Created January 21, 2012 23:26
image problem
NSURL *imageURL = [NSURL URLWithString:[podcast logoURL]];
[[SVPodcatcherClient sharedInstance] imageAtURL:imageURL
onCompletion:^(UIImage *fetchedImage, NSURL *url, BOOL isInCache) {
if ([[url absoluteString] isEqualToString:[imageURL absoluteString]]) {
if(!isInCache) {
CATransition *transition = [CATransition animation];
[self.logoImageView.layer addAnimation:transition forKey:nil];
}
diff --git a/Support/lib/spec/mate.rb b/Support/lib/spec/mate.rb
index 6d0ce89..b634303 100644
--- a/Support/lib/spec/mate.rb
+++ b/Support/lib/spec/mate.rb
@@ -1,18 +1,18 @@
# This is based on Florian Weber's TDDMate
require 'rubygems'
+# Load spec/autorun
ENV['TM_PROJECT_DIRECTORY'] ||= File.dirname(ENV['TM_FILEPATH'])
module CanCan
# This module is automatically included into all Mongoid
module MongoidAdditions
module ClassMethods
# Returns a scope which fetches only the records that the passed ability
# can perform a given action on. The action defaults to :read. This
# is usually called from a controller and passed the +current_ability+.
#
# @articles = Article.accessible_by(current_ability)
#