Skip to content

Instantly share code, notes, and snippets.

View jkubicek's full-sized avatar

Jim Kubicek jkubicek

View GitHub Profile
@jkubicek
jkubicek / ascii_art
Last active December 15, 2015 19:10
Emoticon Faces
/code _-====-__-======-__-========-_____-============-__
_( coffee _)
OO( train )_
0 (_ choo! _)
o0 (_ choo! _)
o '=-___-===-_____-========-___________-===-dwb-='
.o _________
. ______ ______________ | | _____
_()_||__|| ________ | | |_________| __||___||__
(BNSF 1995| | | | | __Y______00_| |_ _|
@jkubicek
jkubicek / .git-completion.sh
Created March 13, 2013 20:30
Git tab completion script
#!bash
#
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
@jkubicek
jkubicek / git-open-file-github
Created March 7, 2013 00:52
Opens the currently active Xcode file in GitHub
#!/usr/bin/env ruby
# Get the current Xcode file
filename = `osascript -e 'tell application "Xcode" to set current_document_path to path of last source document'`
# Parse the file name
name = File.basename(filename)
dir = File.dirname filename
# Change to the working directory of our repo
@jkubicek
jkubicek / git-merge-it
Created March 1, 2013 19:06
Merges the current branch into master and deletes the branch. Doesn't attempt to fix any issues and will fail if something goes wrong.
#! /usr/bin/ruby
unless `git status -s`.strip.empty?
puts "Cannot merge-it when your working directory is dirty.\nClean that shit up, bruh"
exit
end
curr_branch = `git branch | grep "*" | sed "s/* //"`.strip
system("git checkout master && git merge #{curr_branch} && git branch -d #{curr_branch}")
@jkubicek
jkubicek / gist:4569613
Last active December 11, 2015 07:58
How big is a UIView?
UIView *view = [[UIView alloc] init];
NSData *objData = [NSData dataWithBytes:(__bridge const void *)(view) length:malloc_size(view)];
NSLog(@"Object contains %@", objData);
/*
Code via http://mikeash.com/pyblog/friday-qa-2009-03-13-intro-to-the-objective-c-runtime.html
Output:
Object contains <bc8d7f00 603f6507 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 200000c0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000>
@jkubicek
jkubicek / gho
Created January 3, 2013 07:43
Oneliner bash command for opening the current git repo in github
git config --get remote.origin.url | sed 's#^[^:]*.\([^.]*\)\.git#http://github.com/\1#' | xargs open
@jkubicek
jkubicek / Fix embedded framework versions
Last active November 3, 2015 18:17
Fix embedded framework version numbers
# Add this script as a build phase in your project. It will update
# all embeded framework marketing versions and build version to be
# equal to the marketing and build version in your main app.
# More details:
# https://github.com/Carthage/Carthage/issues/859
# https://forums.developer.apple.com/thread/23778
PLIST_PATH=$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH
PLIST_PATH=$(dirname $PLIST_PATH)/$(basename $PLIST_PATH .plist)
@jkubicek
jkubicek / gist:3759637
Created September 21, 2012 03:54
Sort Obj-C properties and methods
#!/usr/bin/ruby
def sortProperties(lines)
props = Hash.new
lines.each {|line|
props[line.gsub(/@.+?(\w+?);[^;]*?$/, "\\1")] = line
}
sortedKeys = props.keys.sort
@jkubicek
jkubicek / gist:2960126
Created June 20, 2012 14:19 — forked from cliss/gist:2959813
2012 MacBook Options on $2700 Budget
+---------------+--------------------------+-------------------------+------------------------+
| | 13" MacBook Air | 15" MacBook Pro | 15" Retina MacBook Pro |
| | $2450 | $2790 | $2750 |
+===============+==========================+=========================+========================+
| CPU | 2.0 Dual Core i7 $1500 | 2.3 Quad Core i7 $1800 | 2.3 Quad Core i7 $2200 |
+---------------+--------------------------+-------------------------+------------------------+
| RAM | 8 GB $100 | 16 GB (OWC) $170 | 16 GB $200 |
+---------------+--------------------------+-------------------------+------------------------+
| HD Size/Style | 512 GB SSD $500 | 120 GB SSD (OWC) $140 | 256 GB SSD |
| | | 750 GB 7200 RPM $150 | |
#!/usr/bin/ruby
# First we save our current branch to a dummy branch
# Just in case something goes awry.
`git branch -f git-squish-backup`
branches = `git branch`
curr_branch = /^\*.+/.match(branches)[0]
curr_branch.sub!(/^\*./, '')