Skip to content

Instantly share code, notes, and snippets.

View nebiros's full-sized avatar

Juan Alvarez nebiros

View GitHub Profile
@nebiros
nebiros / gist:1139649
Created August 11, 2011 13:29
My git svn workflow
# clone svn repo, -s means standar svn repo (trunk, branches, tags)
$ git svn clone file:///tmp/test-svn -s
# branches list
$ git branch -a
$ git repack -d
# creates and jump to the new branch
$ git checkout -b new_branch
# add changes
$ git add <FILE>
# commit changes to the current branch
@SlaunchaMan
SlaunchaMan / JKTableViewCell.h
Created August 13, 2011 05:08
A subclass of UITableViewCell to allow for images to be added after cell creation
#import <UIKit/UIKit.h>
@interface JKTableViewCell : UITableViewCell
@end
@erans
erans / UIImage+Resize.m
Created November 7, 2011 07:10
UIImage+Resize.m Fix for Rotation / Orientation on iOS 5
- (UIImage *)resizedImage:(CGSize)newSize interpolationQuality:(CGInterpolationQuality)quality {
BOOL drawTransposed;
CGAffineTransform transform = CGAffineTransformIdentity;
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 5.0) {
// Apprently in iOS 5 the image is already correctly rotated, so we don't need to rotate it manually
drawTransposed = NO;
} else {
switch (self.imageOrientation) {
case UIImageOrientationLeft:
@drogus
drogus / Gemfile
Created April 24, 2012 18:43
AbstractController
gem "actionpack"
@marfife-gist
marfife-gist / ui_sugar.js
Created April 30, 2012 01:46
Titanium UI shortcuts
var i, j, event_;
function TiUber() {
this.NO_SELECTION_ROW = Ti.UI.iPhone.TableViewCellSelectionStyle.NONE;
this.FLEXSPACE = Ti.UI.createButton({ systemButton:Ti.UI.iPhone.SystemButton.FLEXIBLE_SPACE });
this.currentWindow = function() { return Ti.UI.currentWindow; };
this.win = function(data) {
@jernejcic
jernejcic / XcodeAutoVersioning.sh
Created May 1, 2012 23:00 — forked from PaulCapestany/XcodeAutoVersioning.sh
Xcode Auto-incrementing Version and Build numbers
# Increment the build number with every build.
BUILDNUM=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}")
BUILDNUM=$(($BUILDNUM + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $BUILDNUM" "${PROJECT_DIR}/${INFOPLIST_FILE}"
# This splits a two-decimal version string, such as "0.45.123", allowing us to increment the third position.
VERSIONNUM=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${PROJECT_DIR}/${INFOPLIST_FILE}")
NEWSUBVERSION=`echo $VERSIONNUM | awk -F "." '{print $3}'`
NEWSUBVERSION=$(($NEWSUBVERSION + 1))
NEWVERSIONSTRING=`echo $VERSIONNUM | awk -F "." '{print $1 "." $2 ".'$NEWSUBVERSION'" }'`
@besi
besi / Environment.h
Created May 24, 2012 14:56
Environment
//
// Environment.h
//
#import <Foundation/Foundation.h>
// Convenience Macros
#define ENVIRONMENT_PROPERTY(key) @property (readonly) NSString *key;
#define ENVIRONMENT_PROPERTY_BOOL(key) @property (readonly) BOOL key;
@mongrelion
mongrelion / 001-markdown-benchmark.rb
Created June 1, 2012 16:07
Ruby Markdown parser libraries benchmark
%w[rubygems open-uri benchmark kramdown bluecloth maruku rdiscount].each do |lib|
require lib
end
n = 1000
md = open('http://maruku.rubyforge.org/maruku.md').read
def parse_md(parser, md)
parser.new(md).to_html
end
@pec1985
pec1985 / test1.js
Created June 25, 2012 15:37
Optimizing Appcelerator's Titanium
/**
* Test #1
* Adding 10,000 Ti.UI.TableViewRows to a Ti.UI.TableView
* The rows have the Ti.UI.iPhone.TableViewCellSelectionStyle.BLUE constant in them
*
* Total time in my Mac: 1228ms
*/
var win = Ti.UI.createWindow({
backgroundColor: '#ccc'
@woods
woods / enable_trim.sh
Created August 12, 2012 20:19
Enable TRIM support for 3rd Party SSDs. Works for Mountain Lion.
#!/bin/bash
#
# Enable TRIM support for 3rd Party SSDs. Works for Mountain Lion
#
# Source: http://digitaldj.net/2011/07/21/trim-enabler-for-lion/
set -e
set -x
# Back up the file we're patching