Skip to content

Instantly share code, notes, and snippets.

{
"data":[
{
"type":"projects",
"id":"1",
"relationships":{
"team":{
"data": {
"type":"teams",
"id":"1"
@EdSancha
EdSancha / gist:2e58f25b174fa4aa5418
Created April 20, 2015 21:05
Override html format
- (NSString *)overrideHTMLFormat:(NSString *)htmlText {
NSArray *tagsToOverride = @[@"body",@"b", @"a", @"td", @"span", @"p", @"div"];
NSString *header = @"<head><style> ";
for (NSString *tag in tagsToOverride) {
header = [header stringByAppendingString:tag];
header = [header stringByAppendingString:@" {font-family: HelveticaNeue !important; font-size: 11pt !important; line-height:18pt !important} "];
}
@EdSancha
EdSancha / gist:7472b86551018049a6b0
Created March 9, 2015 22:34
Listen to context changes and check whether an specific value has been changed
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(contextChanged:) name:NSManagedObjectContextWillSaveNotification object:nil];
-(void)contextChanged:(NSNotification *)notification {
for(NSManagedObject *object in [(NSManagedObjectContext *)notification.object updatedObjects]) {
if([object isKindOfClass:[Product class]]) {
id value = [object changedValues][@"value"];
if (value){
NSLog(@"%@",object);
}
}
@EdSancha
EdSancha / Multiple CollectionViews Bug
Created March 27, 2014 05:32
Multiple CollectionViews Bug - Solution
//
// EDSViewController.m
// MultipleCollectionViews
//
// Created by Eduardo Diaz Sancha on 3/26/14.
// Copyright (c) 2014 edsancha. All rights reserved.
//
#import "EDSViewController.h"
#import "EDSCollectionViewCell.h"
@EdSancha
EdSancha / autoPatapatPlayer
Last active August 29, 2015 13:57
Javascript adapted from http://pastebin.com/d3kiyqp6 in order to create automatic sequences in http://patatap.com it stops automatically after 16 measures
var rnd = function( to, from ) {
return Math.floor( Math.random() * (to - from + 1) + from );
};
var triggerKey = function(key) {
triggerKeyEvent(
document.getElementsByTagName('body')[0], key
);
// Fast Enumeration Best Techniques:
// Following Nick Lockwood article: http://iosdevelopertips.com/objective-c/high-performance-collection-looping-objective-c.html?utm_source=iOSDevTips&utm_campaign=wordtwit&utm_medium=twitter
// NSArray Fast Enumeration
NSMutableArray *array;
for (<#type *object#> in array) {
<#statements#>
}