Skip to content

Instantly share code, notes, and snippets.

View brunogama's full-sized avatar
🏠
Working from home

Bruno Gama brunogama

🏠
Working from home
  • Banco Inter
  • Brazil
  • 04:52 (UTC -03:00)
  • X @brunogama
View GitHub Profile
@ishikawa
ishikawa / itunes.sh
Created April 4, 2010 09:04
itunes.sh - control your iTunes from shell
#/bin/bash
#
# itunes.sh - Control Your iTunes from shell
#
TRACK_PROGRAM=`cat <<EOS
tell current track
name & " - " & artist
end tell
EOS`
@leandrosilva
leandrosilva / NSArray+Functional.h
Created April 10, 2010 07:31
Functional Objective-C NSArray
//
// NSArray+Functional.h
// DynamicFeatures
//
// Created by Leandro Silva on 4/10/10.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@rpavlik
rpavlik / fix_homebrew.rb
Created January 6, 2011 20:32 — forked from mxcl/install_homebrew.markdown
Fix permissions on /usr/local for Homebrew
#!/usr/bin/ruby
#
# This script fixes /usr/local only.
#
# 6th January 2010:
# Modified the script to just fix, rather than install. - rpavlik
#
# 30th March 2010:
# Added a check to make sure user is in the staff group. This was a problem
# for me, and I think it was due to me migrating my account over several
@jessedc
jessedc / iOS Icon.png bash script
Last active February 25, 2018 03:02
A simple bash script using OSX command line tool sips to resample a 1024x1024 image
#!/bin/bash
f=$(pwd)
sips --resampleWidth 512 "${f}/${1}" --out "${f}/iTunesArtwork"
sips --resampleWidth 1024 "${f}/${1}" --out "${f}/iTunesArtwork@2x"
sips --resampleWidth 57 "${f}/${1}" --out "${f}/Icon.png"
sips --resampleWidth 114 "${f}/${1}" --out "${f}/Icon@2x.png"
sips --resampleWidth 29 "${f}/${1}" --out "${f}/Icon-Small.png"
sips --resampleWidth 58 "${f}/${1}" --out "${f}/Icon-Small@2x.png"
sips --resampleWidth 50 "${f}/${1}" --out "${f}/Icon-Small-50.png"
@pk
pk / ExampleTest.m
Created June 21, 2011 15:00
Using method swizzling and blocks to test Class methods in Objective-C.
#import "SenTestCase+MethodSwizzling.m"
@interface ExampleTest : SenTestCase {}
+ (BOOL)trueMethod;
+ (BOOL)falseMethod;
@end
@implementation ExampleTest
+ (BOOL)trueMethod { return YES; }
@lukeredpath
lukeredpath / ExampleClass.m
Created June 30, 2011 22:18
Macro for creating your "shared instance" using GCD
@implementation MySharedThing
+ (id)sharedInstance
{
DEFINE_SHARED_INSTANCE_USING_BLOCK(^{
return [[self alloc] init];
});
}
@end
@pilotmoon
pilotmoon / insert_version.sh
Created August 17, 2011 10:30
XCode 4 Git Version Script
# This script fixes up the CFBundleShortVersionString with a string derived from git.
# Place it as a Build Phase just before Copy Bundle Resources
# clone: git submodule add git@gist.github.com:1151287.git gist-1151287
# call: ${SRCROOT}/gist-1151287/insert_version.sh
# PlistBuddy and git executables
buddy='/usr/libexec/PlistBuddy'
git='/usr/bin/git'
@keijiro
keijiro / PostprocessBuildPlayer
Created September 26, 2011 11:24
PostprocessBuildPlayer for Unity iOS: modifies Info.plist to use Facebook URL-scheme
#!/usr/bin/env python
import sys, os.path
install_path = sys.argv[1]
target_platform = sys.argv[2]
if target_platform != "iPhone": sys.exit()
info_plist_path = os.path.join(install_path, 'Info.plist')
@Nitewriter
Nitewriter / MyAppDelegate.m
Created September 30, 2011 13:56
UINavigationController custom navigation bar
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
// Create a new window and assign directly to provided iVar
_window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Implementation of new init method
MyCustomNavigationBar *navigationBar = [[MyCustomNavigationBar alloc] initWithFrame:CGRectZero];
UINavigationController *navigationController = [[UINavigationController alloc] initWithCustomNavigationBar:navigationBar];
@robertjpayne
robertjpayne / NSManagedObjectArchiving.h
Created October 29, 2011 10:28
NSManagedObject Archiving and Unarchiving
#import <Foundation/Foundation.h>
@interface NSManagedObjectArchiver : NSObject
/*
* Takes a NSManagedObject and converts it to a NSData archive - it traverses all relationships ( including circular ) and archives it
*/
+ (NSData *)archivedDataWithRootObject:(NSManagedObject *)pObject;
@end