Skip to content

Instantly share code, notes, and snippets.

@dsummersl
dsummersl / .profile fragment
Created December 5, 2012 15:43 — forked from jcamenisch/.profile fragment
Lightning-fast project-wide find/replace with git grep and sed -- with confirm option.
gg_replace() {
if [[ "$#" == "0" ]]; then
echo 'Usage:'
echo ' gg_replace term replacement file_mask'
echo ' gg_replace [-c] term replacement file_mask'
echo
echo 'Options:'
echo ' -c == confirm. Allows you to interactively confirm each modification.'
echo
echo 'Example:'
@dsummersl
dsummersl / .profile fragment
Created December 5, 2012 15:43 — forked from jcamenisch/.profile fragment
Lightning-fast project-wide find/replace with git grep and sed
gg_replace() {
if [[ "$#" == "0" ]]; then
echo 'Usage:'
echo ' gg_replace term replacement file_mask'
echo
echo 'Example:'
echo ' gg_replace cappuchino cappuccino *.html'
echo
else
find=$1; shift
@dsummersl
dsummersl / .profile fragment
Created December 5, 2012 15:42 — forked from christilden/.profile fragment
Lightning-fast project-wide find/replace with git grep and sed
gg_replace() {
if [[ "$#" == "0" ]]; then
echo 'Usage:'
echo ' gg_replace term replacement file_mask'
echo
echo 'Example:'
echo ' gg_replace cappuchino cappuccino *.html'
echo
else
find=$1; shift
@dsummersl
dsummersl / gist:4041911
Created November 8, 2012 21:49 — forked from miceno/gist:802781
Groovy (java) escape HTML with grapes
import org.apache.commons.lang.StringEscapeUtils
// Import with groovy grapes:
@Grab(group='commons-lang', module='commons-lang', version='2.3' )
xml = '''
<module id="id" version="0.0.1" package="package"> </module>
'''
StringEscapeUtils.escapeHtml(xml).split("\n").each() {println it }