Skip to content

Instantly share code, notes, and snippets.

View brianjriddle's full-sized avatar

Brian Riddle brianjriddle

View GitHub Profile
@brianjriddle
brianjriddle / ant-build-snippet.xml
Created July 25, 2013 11:01
ant task to run all the tests or only one test. You'll need to supply the properties where to find your test source, libs and what not. Mainly here so i don't have to look this up again because it's not often need to do this but ant's as poorly written as this sentence.
<target name="run-tests" depends="compile">
<junit failureproperty="test.failure" includeantruntime="false">
<classpath refid="run.classpath"/>
<formatter type="plain" usefile="no"/>
<batchtest todir="${reports.dir}" unless="test">
<fileset dir="${source.dir}" includes="**/*Test.java"/>
<formatter type="xml"/>
</batchtest>
@brianjriddle
brianjriddle / aapt-badger.txt
Last active April 19, 2019 15:47
who put that badger in androids aapt. scroll all the way to the end.
➜ ~ cd $ANDROID_SDK ➜ r21.1 git:(master) pwd /usr/local/Cellar/android-sdk/r21.1
➜ r21.1 git:(master) cd platform-tools ➜ platform-tools git:(master) strings aapt nonav
dpad
navexposed
nokeys
12key
keysexposed
keyshidden
notouch
stylus
@brianjriddle
brianjriddle / create_objc_from_json.rb
Created April 25, 2013 06:50
a little boilerplate for creating objective-c classes from json data
require 'json'
require 'open-uri'
def camel_case(string)
return string.split('_').map{|e| e.capitalize}.join
end
def camel_case_lower(s) s.split('_').inject([]){ |buffer,e| buffer.push(buffer.empty? ? e : e.capitalize) }.join
end
json = JSON.load(open(ARGV[0]))
@brianjriddle
brianjriddle / Rakefile
Created February 16, 2013 12:53
Rakefile used to deploy a jekyll site to s3
require 'rake/clean'
require 'jekyll'
require 'jekyll/site'
#remove the site dir.
CLEAN.include('_site')
desc "generate the site. keeping it simple."
task :generate do
options = Jekyll.configuration({})
@brianjriddle
brianjriddle / ocunitfilter.rb
Last active December 13, 2015 19:58
filter to get sane output from ocunit & kiwi tests when building xcode apps from the command line
#!/usr/bin/env ruby
$stdout.sync = true
@failed_tests = []
@success = true
@executed = ""
def green(s)
"\e[1;32m#{s}\e[0m"
end
public class Locale {
public static void main(String[] args) {
System.out.println(System.getProperty("file.encoding"));
System.out.println(System.getenv("LC_CTYPE"));
}
}
@brianjriddle
brianjriddle / jumbler.rb
Created November 3, 2012 13:12
takes a directory of files and randomizes the names by prefixing them with a number
# encoding: utf-8
require "fileutils"
include FileUtils::Verbose
def usage
puts "usage: jruby ORIGINAL_MUSIC_DIR"
end
if ARGV[0] and File.directory? ARGV[0]
@brianjriddle
brianjriddle / burn-example.sh
Created October 29, 2012 15:24
burn an linux|*bsd distro to usb
sudo dd if=$HOME/Downloads/ubuntu-12.10-desktop-i386.iso of=/dev/rdisk1 bs=20m
@brianjriddle
brianjriddle / Asset.java
Created June 1, 2012 18:57
Parsing xml so my eyes don't bleed
import org.apache.commons.lang.StringUtils;
import org.joda.time.DateTime;
import org.joda.time.format.*;
import org.w3c.dom.*;
import org.xml.sax.SAXException;
import se.tv4.teknik.vman.api.XmlDataReader;
import javax.xml.parsers.*;
import javax.xml.xpath.XPathConstants;
import java.io.*;
@brianjriddle
brianjriddle / post-merge.sh
Created May 30, 2012 09:34
git post commit hook to trigger if commit message has a key word that starts with %
#!/bin/sh
#will priint out a message if a commit contains a keyword prefixed with %
#
MARKERS="%\w+"
RELEASE=$(git log $(git reflog -n 1 | cut -d ":" -f1) | grep -Pio "$MARKERS"| sort -fu | tr '\n' ' ')
if [ "$RELEASE" != "" ];
then