Skip to content

Instantly share code, notes, and snippets.

View sendoa's full-sized avatar

Sendoa Portuondo sendoa

View GitHub Profile
@sendoa
sendoa / xcode-git-config.sh
Created February 12, 2014 16:15
Setup initial Git setup for Xcode projects
#!/bin/sh
curl -s https://gist.github.com/sendoa/8952600/raw/bc1854640d8653d125239d112ad64537a82dd0a7/.gitignore > .gitignore
curl -s https://gist.github.com/sendoa/8957654/raw/1bc1f29b9a5e87e5ab8ee8cd7b3e8ae86d126b83/.gitattributes > .gitattributes
@sendoa
sendoa / .gitattributes
Last active January 29, 2019 18:41
Sendoa's .gitattributes for Xcode Projects
# Read http://robots.thoughtbot.com/xcode-and-git-bridging-the-gap for an explanation
# Read https://roadfiresoftware.com/2015/09/automatically-resolving-git-merge-conflicts-in-xcodes-project-pbxproj/ for more
*.pbxproj merge=union
*.strings text diff
@sendoa
sendoa / .gitignore
Last active October 18, 2015 14:42
Sendoa's .gitignore for Xcode projects
# Some ideas taken from https://gist.github.com/adamgit/3786883
# OS X
.DS_Store
*.swp
*.lock
profile
.LSOverride
# Thumbnails
#!/bin/sh
# Create a RAM disk with same perms as mountpoint
# Script based on http://itux.idev.pro/2012/04/iservice-speed-up-your-xcode-%D0%BD%D0%B5%D0%BA%D0%BE%D1%82%D0%BE%D1%80%D1%8B%D0%B5-%D1%81%D0%BF%D0%BE%D1%81%D0%BE%D0%B1%D1%8B/ with some additions
# Usage: sudo ./xcode_ramdisk.sh start
USERNAME=$(logname)
TMP_DIR="/private/tmp"
RUN_DIR="/var/run"
SYS_CACHES_DIR="/Library/Caches"
sys_rb_usr=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr
sdk_rb_usr=`xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr
sudo cp -r $sdk_rb_usr/include $sys_rb_usr/include
@sendoa
sendoa / Dlog.h
Created July 9, 2013 20:33
NSLog and NSAssert substitution macros based on the ones from Marcus Zarra http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/ When the app runs on "Release" mode, assertions are linked to TestFlight checkpoints. I always name assertion type checkpoints with "ASSERTION" prefix. Example: Alog(@"ASSERTION_NON_PARSEABLE_ITEM_DATA_RECEIVED");
#ifdef DEBUG
#define DLog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__])
#define ALog(...) [[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithCString:__PRETTY_FUNCTION__ encoding:NSUTF8StringEncoding] file:[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lineNumber:__LINE__ description:__VA_ARGS__]
#else
#define DLog(...) do { } while (0)
#define ALog(...) [TestFlight passCheckpoint:[NSString stringWithFormat:__VA_ARGS__]]
#ifndef NS_BLOCK_ASSERTIONS
#define NS_BLOCK_ASSERTIONS
#endif
#endif
@sendoa
sendoa / SDWebImageDecoder.m
Created July 4, 2013 10:06
Force image decompression
// https://github.com/rs/SDWebImage
// https://github.com/rs/SDWebImage/wiki/How-is-SDWebImage-better-than-X%3F
#import "SDWebImageDecoder.h"
@implementation UIImage (ForceDecode)
+ (UIImage *)decodedImageWithImage:(UIImage *)image
{
CGImageRef imageRef = image.CGImage;
@sendoa
sendoa / ejemplo.m
Created July 4, 2013 10:04
UILabel con URL clicable
yourTextView.editable = NO;
yourTextView.dataDetectorTypes = UIDataDetectorTypeAll;
@sendoa
sendoa / gist:5916356
Created July 3, 2013 08:28 — forked from JaviSoto/gist:5906004
Set the designated initializer at compile time
#define MSDesignatedInitializer(__SEL__) __attribute__((unavailable("Invoke the designated initializer `" # __SEL__ "` instead.")))
// Sample usage:
- (id)initWithObject:(id)object;
- (id)init MSDesignatedInitializer(initWithObject:); // <- This even gets auto-complete.
// Now calling init on this class would throw a warning.
@sendoa
sendoa / run-script.sh
Last active December 18, 2015 02:39
This script will auto-increment your Xcode project's build number for every build (debug & release). It will also increment the third position of a semantic formatted version string only for release builds: Examples: Build number: from 123 to 124 Version string: from 1.2.5 to 1.2.6
# This script will auto-increment your Xcode project's build number for every build (debug & release).
# It will also increment the third position of a semantic formatted version string only for release builds
#
# Examples:
# Buil number (CFBundleVersion): from 123 to 124
# Version string (CFBundleShortVersionString): from 1.2.5 to 1.2.6
#
# 1. Select your Target in Xcode
# 2. Select "Build Phases" Tab
# 3. Select "Add Build Phase" -> "Add Run Script"