Skip to content

Instantly share code, notes, and snippets.

View markrickert's full-sized avatar

Mark Rickert markrickert

View GitHub Profile
@schacon
schacon / gist:942899
Created April 26, 2011 19:19
delete all remote branches that have already been merged into master
$ git branch -r --merged |
grep origin |
grep -v '>' |
grep -v master |
xargs -L1 |
awk '{split($0,a,"/"); print a[2]}' |
xargs git push origin --delete
@IanVaughan
IanVaughan / uninstall_gems.sh
Created June 9, 2012 20:37
Uninstall all rbenv gems
#!/usr/bin/env bash
uninstall() {
list=`gem list --no-versions`
for gem in $list; do
gem uninstall $gem -aIx
done
gem list
gem install bundler
}
@seanlilmateus
seanlilmateus / gist:3187192
Last active March 5, 2021 07:17
How to use Obj-C with MacRuby/Rubymotion

Using Obj-C with MacRuby/Rubymotion

This little post aims to help you to translate Objective-C Blocks into Ruby blocks. Let's start by taking a look at few examples of iOS API call where blocks are used for animations and enumeration

Ruby Lambda Syntaxes:

Im Rubymotion and MacRuby you can use all the Ruby Lambda syntaxes that are:

block = lambda { |param|  ... }
@asmallteapot
asmallteapot / rbm_singleton.rb
Created September 20, 2012 18:00
Singletons in RubyMotion 1.4
# http://blog.rubymotion.com/post/31917526853/rubymotion-gets-ios-6-iphone-5-debugger
class STSomeAPIClient
def self.sharedClient
Dispatch.once { @instance ||= new }
@instance
end
end

RubyMotion #inspect 2013 Traveling Guide

Overview

This document is a travel guide to RubyMotion's first conference, #inspect 2013.

http://www.rubymotion.com/conference

If you are attending or considering attending the conference, you might find here some handy tips that will answer questions you might have. If you have a question that isn't answered here, feel free to contact us and we will update this document accordingly.

@iwarshak
iwarshak / Gemfile
Last active May 12, 2018 21:54
Here is what you need to get your Rubymotion application logs sent to papertrailapp.com. I am using Cocoalumberjack (CLJ) which seems to be the logging framework of choice for Cocoa, motion-logger which is a thin RM wrapper around Cocoalumberjack. CLJ allows you to write your own loggers, which is what PapertrailLogger is. It simply fires off lo…
source :rubygems
gem "rake"
gem 'motion-logger' #cocoalumberjack wrapper
@orta
orta / gist:7117853
Created October 23, 2013 12:36
HTML -> NSAttributedString using only UIKit
+ (NSAttributedString *)artsyBodyTextAttributedStringFromHTML:(NSString *)HTML withFont:(UIFont *)font
{
NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
style.lineHeightMultiple = 1.2;
style.paragraphSpacing = font.pointSize * .5;
NSDictionary *textParams = @{
NSFontAttributeName : font,
NSParagraphStyleAttributeName : style,
@tristanoneil
tristanoneil / harvest
Created October 24, 2013 13:37
How to override Harvest for Mac time settings.
For AppStore apps:
defaults write com.getharvest.harvestxapp TimeFormat hours_minutes
defaults write com.getharvest.harvestxapp TimeFormat decimal
defaults write com.getharvest.harvestxapp TimeFormat server
For apps downloaded directly from GetHarvest:
defaults write ~/Library/Preferences/com.getharvest.harvestx.plist TimeFormat hours_minutes
defaults write ~/Library/Preferences/com.getharvest.harvestx.plist TimeFormat decimal
@alexrothenberg
alexrothenberg / ui_view.rb
Created November 21, 2013 16:23
Convenience methods for dealing with coordinates in RubyMotion
class UIView
def top
frame.origin.y
end
def left
frame.origin.x
end
def height
frame.size.height
end
@forrestgrant
forrestgrant / foo.rb
Created June 3, 2014 12:41
Swift - RubyMotion
numbers = [20, 19, 7, 12]
numbers.map { |n| 3 * n }