Skip to content

Instantly share code, notes, and snippets.

@rais38
rais38 / CachingGithubPassword.md
Created October 17, 2014 11:34
Caching your GitHub password in Git
@rais38
rais38 / gist:6d8f1b49da73e6fab743
Created July 18, 2014 19:24
UITextViews in a UITableView link detection bug in iOS 7
# http://stackoverflow.com/a/23119866/1379492
- (void)prepareForReuse
{
[super prepareForReuse];
self.textView.editable = YES;
self.textView.editable = NO;
self.textView.text = nil;
}
@rais38
rais38 / gist:6ecead686af9291da542
Created July 9, 2014 09:53
Watchpoint in LLDB
Set a watchpoint on a variable when it is written to.
(lldb) watchpoint set variable -w write global_var
(lldb) watch set var -w write global_var
(gdb) watch global_var
Set a watchpoint on a memory location when it is written into. The size of the region to watch for defaults to the pointer size if no '-x byte_size' is specified. This command takes raw input, evaluated as an expression returning an unsigned integer pointing to the start of the region, after the '--' option terminator.
(lldb) watchpoint set expression -w write -- my_ptr
(lldb) watch set exp -w write -- my_ptr
(gdb) watch -location g_char_ptr
Set a condition on a watchpoint.
(lldb) watch set var -w write global
@rais38
rais38 / gist:11272383
Created April 24, 2014 22:59
Retrieve current branch OSX
- (NSString *)projectDirectoryPath
{
NSWindowController *currentWindowController = [[NSApp mainWindow] windowController];
id document = [currentWindowController document];
if (currentWindowController && [document isKindOfClass:NSClassFromString(@"IDEWorkspaceDocument")]) {
NSURL *workspaceDirectoryURL = [[[document valueForKeyPath:@"_workspace.representingFilePath.fileURL"] URLByDeletingLastPathComponent] filePathURL];
if(workspaceDirectoryURL) {
return [workspaceDirectoryURL path];
}
}
@rais38
rais38 / gist:9957819
Last active August 29, 2015 13:58
Remove multiple (same) entries on "open with" (OSX)
$ /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/\LaunchServices.framework/Versions/A/Support/\
lsregister -kill -r -domain local -domain user
$ killall Finder
@rais38
rais38 / BETTestSemaphor.h
Created March 26, 2014 02:05
Semaphor for wait a action.
//
// BETTestSemaphor.h
// TwitterClient
//
// Created by Rafael Aguilar Martín on 11/11/12.
// Copyright (c) 2012 Rafael Aguilar Martín. All rights reserved.
//
#import <Foundation/Foundation.h>
@rais38
rais38 / gist:8664759
Created January 28, 2014 09:42
Perfect for debugging animations
p [(CALayer *)[[[[UIApplication sharedApplication] windows] objectAtIndex:0] layer] setSpeed:.1f]
@rais38
rais38 / Appirater.md
Last active December 30, 2015 05:59
Pequeño documento donde explico los parámetros más interesantes de Appirater

##Appirater

Appirater creo que es la librería open source más utilizada en Objective-C para recordar al usuario que si le gusta nuestra app que la vote.

###Configuración

daysUntilPrompt

Los usuarios tendrán que tener la misma versión para que surta efecto. Se puede configurar el número de días que han pasado de la última vez que se mostró el aviso.

usesUntilPrompt

@rais38
rais38 / gist:7589410
Last active December 29, 2015 00:59
How to Create an OS X Mavericks USB Installation Drive.

@see http://lifehacker.com/how-to-create-an-os-x-mavericks-usb-installation-drive-1450280026

  • Download OS X Mavericks from the Mac App Store, if you haven't already. If it tries to start the installation, just close it.
  • Insert your USB drive (you'll need one that's 8GB or larger) and open Disk Utility.
  • Select your drive in the sidebar and go to the Erase tab. Format the drive as "Mac OS Extended (Journaled)" and name the drive "Untitled." (Note: if you already have a drive or partition named "Untitled" connected to your computer, name it something else and change the corresponding variable in step 5's terminal command, or you might experience data loss!).
  • Click the Erase button and wait for Disk Utility to finish.
  • Close Disk Utility and open up a Terminal window. Copy and paste the command into the Terminal.
sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ Mavericks.app --nointe
@rais38
rais38 / gist:7352813
Created November 7, 2013 10:57
Show/Hidden all files in OSX
$ defaults write com.apple.finder AppleShowAllFiles -boolean true;
$ killall Finder