Skip to content

Instantly share code, notes, and snippets.

@elmart
elmart / prepare-commit-msg
Created May 9, 2014 18:53
Git prepare-commit-msg hook to automatically add task context headings
#!/bin/bash
#
# Called by "git commit" with the name of the file that has the
# commit message, followed by the description of the commit
# message's source. The hook's purpose is to edit the commit
# message file. If the hook fails with a non-zero status,
# the commit is aborted.
#
# This hook automatically inserts Task/Subtask headings into commit messages.
# Each line in .git/task file gets added as a level.
@alxjrvs
alxjrvs / gist:4b73771294ea25feb2f7
Last active August 29, 2015 14:06
Android-motion Gotchas!

#Two Gotcha's In the @RubyMotion getting started guide for Android

##The NDK Does not Support API level L I got this error when I tried to rake device for the first time.

ERROR! It looks like your version of the NDK does not support API level L. Switch to │  7       structure: Structure
a lower API level or install a more recent NDK.
@jamonholmgren
jamonholmgren / README.md
Last active August 29, 2015 14:15
RubyMotion REPL documentation helper.

Lets you check Cocoa Touch documentation from the RubyMotion REPL.

screenshot

License: MIT, 2015 Jamon Holmgren

@rmetzler
rmetzler / snippet.rb
Created April 4, 2011 11:25
rake tasks for git
require 'readline'
def git_branch
`git branch | grep "*"`.strip[2..-1]
end
def compare_git_ver
m = /git version (\d+).(\d+).(\d+)/.match(`git version`.strip)
return true if m[1].to_i > 1
return false if m[1].to_i < 1
@rosskarchner
rosskarchner / gist:1001799
Created June 1, 2011 04:43
Script that adds OpenMeta tags to Pukka cache
#! /usr/bin/python
#requires: openmeta command line tool, openmeta python library
from glob import glob
from plistlib import readPlistFromString
import shlex, subprocess, openmeta
get_xml="plutil -convert xml1 -o - %s"
@wojtekmach
wojtekmach / account_test.rb
Created May 3, 2012 09:45
Writing MiniTest extensions
require 'minitest/autorun'
module MiniTest::Assertions
def assert_changes(obj, method, exp_diff)
before = obj.send method
yield
after = obj.send method
diff = after - before
assert_equal exp_diff, diff, "Expected #{obj.class.name}##{method} to change by #{exp_diff}, changed by #{diff}"
@hookercookerman
hookercookerman / restkit.rb
Created July 31, 2012 10:36
Working RestKit Mapping RubyMotion
class Photo
attr_accessor :max_id_str
URL = ""
def self.load
manager.loadObjectsAtResourcePath URL, objectMapping:mapping, delegate:self
end
def self.manager
@kattrali
kattrali / ruby_cfstringtransform.rb
Created September 18, 2012 09:14
Fun with RubyMotion! An extension of the Ruby String class to support transliteration using CFStringTransform()
# encoding: UTF-8
class String
# Extend string to include transliterations to different orthographies
# from Latin character set or the reverse (`to_latin`)
#
# Supported Orthographies:
# Arabic, Cyrillic, Greek, Hangul, Hiragana, Katakana, Latin, Thai
#
@seanlilmateus
seanlilmateus / chronic.rb
Created October 13, 2012 18:40
Chronic like natural language date parser with foundation on Macruby
#!/usr/bin/env macruby -wKU
framework 'Foundation'
p myDate = NSDate.dateWithNaturalLanguageString("tomorrow", locale:nil)
p myDate = NSDate.dateWithNaturalLanguageString("last monday", locale: nil)
p myDate = NSDate.dateWithNaturalLanguageString("this tuesday at 5:00 o'clock pm", locale: nil)
p myDate = NSDate.dateWithNaturalLanguageString("may 27th", locale: nil)
p myDate = NSDate.dateWithNaturalLanguageString("6/4/2012", locale: nil)
@russellbeattie
russellbeattie / twitterfeed.php
Created October 16, 2012 10:08
Twitter stream as a feed in Atom format (using oauth)
<?
/**
* twitterfeed.php
*
* A single file script which serves an authenticated personal Twitter timeline as an Atom feed.
*
* To use:
* 1) Go to https://dev.twitter.com/apps and create a new App
* 2) Use the Authentication button to create the tokens/secrets needed
* 3) Copy the results into the appropriate spots below