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
######################### | |
# .gitignore file for Xcode4 / OS X Source projects | |
# | |
# Version 2.1 | |
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects | |
# | |
# 2013 updates: | |
# - fixed the broken "save personal Schemes" | |
# - added line-by-line explanations for EVERYTHING (some were missing) | |
# |
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
# Misc python tips from https://book.pythontips.com/en/latest/index.html | |
################################################### | |
# *args | |
def test_var_args(f_arg, *argv): | |
print("first normal arg:", f_arg) | |
for arg in argv: | |
print("another arg through *argv:", arg) | |
# test_var_args('yasoob', 'python', 'eggs', 'test') | |
# first with *args |
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*) sha1:(NSString*)input | |
{ | |
const char *cstr = [input cStringUsingEncoding:NSUTF8StringEncoding]; | |
NSData *data = [NSData dataWithBytes:cstr length:input.length]; | |
uint8_t digest[CC_SHA1_DIGEST_LENGTH]; | |
CC_SHA1(data.bytes, data.length, digest); | |
NSMutableString* output = [NSMutableString stringWithCapacity:CC_SHA1_DIGEST_LENGTH * 2]; |
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
{-# LANGUAGE OverloadedStrings, DeriveGeneric #-} | |
import Data.Aeson ((.:), (.:?), decode, encode, FromJSON(..), ToJSON(..), Value(..)) | |
import Data.Aeson.Encode.Pretty | |
import qualified Data.ByteString.Lazy as BS (readFile, writeFile) | |
import Control.Applicative ((<$>), (<*>)) | |
import Control.Monad.IO.Class | |
import Control.Monad |
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
Pod::Spec.new do |s| | |
s.name = "Nimble" | |
s.version = "0.0.1" | |
s.summary = "Core Data and iCloud made nimble and fast." | |
s.homepage = "http://github.com/MarcoSero/Nimble" | |
s.license = 'MIT' | |
s.author = { "Marco Sero" => "marco@marcosero.com" } | |
s.source = { :git => "https://github.com/MarcoSero/Nimble.git", :tag => "0.0.1" } | |
s.platform = :ios, '5.0' | |
s.source_files = 'Nimble/*.{h,m}', 'Nimble/**/*.{h,m}' |
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
- (NSURLRequest *)requestForFetchRequest:(NSFetchRequest *)fetchRequest | |
withContext:(NSManagedObjectContext *)context { | |
// init the query string dictionary | |
NSMutableDictionary *queryString = nil; | |
// if we're given a predicate, convert it to a dictionary | |
if (fetchRequest.predicate) { | |
if ([fetchRequest.predicate isKindOfClass:[NSCompoundPredicate class]]) { |
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
#define ms_invoke_block_if_not_nil(BLOCK, ...) if ((BLOCK)) {(BLOCK)(__VA_ARGS__);} | |
// Usage: | |
void (^block)(id, id, id) = void(^)(id parameter1, id parameter2, id parameter3) { | |
// ... | |
}; | |
ms_invoke_block_if_not_nil(block, parameter1, parameter2, parameter3); | |
// As opposed to: |
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
# install class-dump | |
brew install class-dump | |
# dump the frameworks you're interested in | |
class-dump -H -o UIKit /Applications/Xcode5-DP.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/UIKit.framework | |
class-dump -H -o SpringBoardUI /Applications/Xcode5-DP.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/PrivateFrameworks/SpringBoardUI.framework |
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
# Load oh-my-zsh first | |
source $ZSH/oh-my-zsh.sh | |
# If we are on a big repo, re-define git prompt | |
function git_prompt_info() { | |
if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" != "1" ]]; then | |
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \ | |
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0 | |
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$ZSH_THEME_GIT_PROMPT_SUFFIX" | |
fi |
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
+ (UIImage *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize | |
{ | |
//UIGraphicsBeginImageContext(newSize); | |
UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0); | |
[image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)]; | |
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
return newImage; | |
} |
NewerOlder