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
  • 11:25 (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>
@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'
@matthewphiong
matthewphiong / config
Created November 13, 2011 07:02
Sublime CodeIntel config file
{
"Python": {
"python": '~/.virtualenvs/your_env/bin/python',
"pythonExtraPaths": ['~/.virtualenvs/your_env/lib/python2.6/site-packages',
]
},
}
@brunogama
brunogama / random_image_generator.py
Created February 3, 2012 21:18
My random size image generator script (only for UNIX systems).
import random
import string
from os import system as s
for i in range(14):
new = '%s.jpg' % (''.join(random.choice(string.ascii_lowercase + string.digits) for x in range(15)))
cmd = 'cp terra.jpg %s' % (new)
s(cmd)
s('dd if=/dev/urandom of=dummy_bytes bs=1m count=80')
cmd = 'cat dummy_bytes >> %s' % (new)
@seiji
seiji / gist:1735284
Last active September 30, 2015 06:08
build for ios using unity editor
;; This buffer is for notes you don't want to save, and for Lisp evaluation.
;; If you want to create a file, visit that file with C-x C-f,
;; then enter the text in that file's own buffer.
/Applications/Unity/Unity.app/Contents/MacOS/Unity \
-batchmode \
-quit \
-projectPath $PROJECT_PATH \
-executeMethod CommandBuild.BuildiOS
@lukeredpath
lukeredpath / MAYBE_NULL.m
Created February 20, 2012 18:14
MAYBE_NULL
#define MAYBE_NULL(value) (value == [NSNull null] ? nil : value)
self.myProperty = MAYBE_NULL([dict objectForKey:@"might_be_null"]);
@rnystrom
rnystrom / Iphone Icon.png Bash Script
Created April 5, 2012 15:04 — forked from jessedc/iOS Icon.png bash script
A simple bash script using OSX command line tool sips to resample a 512x512px image
#!/bin/zsh
# Compatible with bash, just change "zsh" to "bash"
# First param: The folder that the original file is stored in
# Second param: The original image name
sips --resampleWidth 512 "${1}/${2}" --out "${1}/iTunesArtwork"
sips --resampleWidth 57 "${1}/${2}" --out "${1}/Icon.png"
sips --resampleWidth 114 "${1}/${2}" --out "${1}/Icon@2x.png"
sips --resampleWidth 29 "${1}/${2}" --out "${1}/Icon-Small.png"
sips --resampleWidth 58 "${1}/${2}" --out "${1}/Icon-Small@2x.png"
@odrobnik
odrobnik / gist:2711594
Created May 16, 2012 15:58
Force decompression of UIImage on background queue before setting on UIImageView
dispatch_queue_t queue = dispatch_queue_create("PlusFlickrPhotoView Queue", DISPATCH_QUEUE_CONCURRENT);
dispatch_async(queue, ^{
// force decompress of image
UIGraphicsBeginImageContext(CGSizeMake(1, 1));
[image drawAtPoint:CGPointZero];
UIGraphicsEndImageContext();
// set the image on main thread
dispatch_sync(dispatch_get_main_queue(), ^{
@tancnle
tancnle / gist:2969692
Created June 22, 2012 01:32
Fix incorrect Nokogiri loaded libraries

Every time I upgrade libxml2 via Homebrew, running cucumber test will post an annoying warning message

WARNING: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.8.0

To fix it:

$ gem uninstall nokogiri
$ brew link libxml2

$ gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.8.0/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.8.0/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26