Skip to content

Instantly share code, notes, and snippets.

View atroutt's full-sized avatar

Audrey Troutt atroutt

View GitHub Profile
@atroutt
atroutt / transitionQuestions_allQuestions.vm
Created November 16, 2012 21:54
Liferay velocity templates and structures for displaying all articles with a given structure.
## name: All transition questions
## description:
## This is the template to display all transition questions. The structure that is associated with this template directly is not really used.
## Instead it depends on the TransitionQuestion template and TransitionQuestion structure.
## The $structureId, below needs to be updated with the id of the TransitionQuestion structure in your instance of Liferay.
#* update your portal-ext.properties to add these two lines:
#allow velocity templates to use the serviceLocator variable
journal.template.velocity.restricted.variables=
*#
## --------------------------------------------
@atroutt
atroutt / gist:5542757
Created May 8, 2013 19:00
Add your git branch name to your bash prompt and color the prompt. Put this in your bash.rc or whatever
# From http://trevmex.com/post/7320627392/how-to-add-git-and-subversion-info-to-a-bash-prompt
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo " ("${ref#refs/heads/}$(parse_git_dirty)")"
}
@atroutt
atroutt / gist:33edd2d2d0a63758365c
Created June 11, 2015 15:26
XCode/iOS Silence warning for undeclared selector
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wundeclared-selector"
//whatever code using undeclared selector
#pragma clang diagnostic pop
require 'json'
require 'open-uri'
# TODO GET YOUR OWN URL AND AUTH TOKEN
# See Foursquare API Explorer at https://developer.foursquare.com/docs/explore#req=venues/search%3Fll%3D40.0879508,-75.3941218 for new URL
source = "https://api.foursquare.com/v2/venues/search?ll=40.0879508,-75.3941218&limit=50&radius=100000&oauth_token=GETYOUROWN"
# 39.9165295,-75.144234 IKEA SOUTH PHILLY
# 39.9205883,-75.145728 South Philly big box stores
# 40.0879508,-75.3941218 KOP mall
data = JSON.load(open(source))
require 'json'
require 'levenshtein'
# Given two files with lists (one item per line) see if you can fuzzy match strings between the two.
# Only prints out matching strings and the match distance (lower is better, scale is normalized 0.0-1.0)
shortList = []
File.open("shortList", "r") do |f|
f.each_line do |v|
@atroutt
atroutt / cp-android-drawables.sh
Last active July 17, 2016 22:14
Convenient script for sucking icons from https://github.com/google/material-design-icons into your Android app
#!/bin/bash
# 1. PUT THIS SCRIPT IN YOUR APP's RES folder, for example /Users/myname/Developer/MyAndroidProject/app/src/main/res
# 2. UPDATE THIS VARIABLE to point to your local clone of https://github.com/google/material-design-icons
# if you don't alread have it git clone git@github.com:google/material-design-icons.git
basefolder="/Users/myname/Developer/material-design-icons"
# 3. Find Material Icons on https://design.google.com/icons/ and note the group and icon name and use this script to suck them into your project
if [ $# -lt 2 ]; then