Skip to content

Instantly share code, notes, and snippets.

@dstarh
dstarh / thymeleaf.html
Created September 13, 2012 13:55
thymeleaf th:attr
<tr th:each="obj : ${objects}" th:fragment="row" th:attr="data-obj-id=${obj.id}">
<td th:attr="data-obj-id=${obj.id}" th:text="${obj.id}> </td>
</tr>
Problem: Virgin common runs apt-get update, writes a file named apt-get.updated, but it only runs apt-get update once, if apt-get-updated does not exist
It only runs apt-get update then installs a list of packages
/* *******************************************
// LICENSE INFORMATION
// The code, "Detecting Smartphones Using PHP"
// by Anthony Hand, is licensed under a Creative Commons
// Attribution 3.0 United States License.
//
// Updated 01 March 2010 by Bryan J Swift
// - Remove un-needed if statements instead just returning the boolean
// inside the if clause
//
log4j = {
appenders {
console name:'stdout', layout:pattern(conversionPattern: '[%r] %c{2} %m%n')
if (tools.error.email.to && Globals.getProperties().SMTP_HOST) {
def patternLayout = new org.apache.log4j.PatternLayout()
patternLayout.setConversionPattern("[%r] %c{2} %m%n")
def mailAppender = new org.apache.log4j.net.SMTPAppender()
mailAppender.setFrom("errors@email.com")
mailAppender.setTo("${tools.error.email.to}")
mailAppender.setSubject("Grails Tools Application Error")
dstarh:danger-danger-squared.local in [/usr/local/site/tools] rm -rf ~/.grails
dstarh:danger-danger-squared.local in [/usr/local/site/tools] |NUT-37-grails-2.1.4-java-7 ✗|$ grails install-plugin sublog --stacktrace
| Installed plugin sublog-0.5.3
| Error Error executing script InstallPlugin: BUG! exception in phase 'conversion' in source unit 'Script1.groovy' No such property: importPackages for class: org.codehaus.groovy.ast.ModuleNode (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
BUG! exception in phase 'conversion' in source unit 'Script1.groovy' No such property: importPackages for class: org.codehaus.groovy.ast.ModuleNode
at org.codehaus.gant.IncludeTargets.leftShift(IncludeTargets.groovy:72)
at org.codehaus.gant.IncludeTargets$leftShift$0.call(Unknown Source)
at InstallPlugin$_run_closure8.doCall(InstallPlugin:246)
at InstallPlugin$_run_closure8.call(InstallPlugin)
at InstallPlugin$_run_closure14_closure29.doCall(InstallPlugin:337)
foo
-------
foo_id
name
foo_hierarchy
-------
foo_child_id
foo_parent_id
id
string pattern = @"[^ -~]";
string input = THE XML STRING
string replacement = "";
Regex rgx = new Regex(pattern);
string result = rgx.Replace(input, replacement);
Console.WriteLine("Original String: '{0}'", input);
Console.WriteLine("Replacement String: '{0}'", result);
#/bin/sh
echo -e "\033]50;SetProfile=$1\a"
/usr/bin/ssh $*
echo -e "\033]50;SetProfile=Default\a"
#foo
#bar
#baz
renders
<div id="foo">
<div id="bar">
<div id="baz">
</div>
@dstarh
dstarh / gist:4525095
Last active December 11, 2015 01:39
class heirarchy
module X
def initialize(params ={})
puts 'setting params in module x'
@foo = params[:foo]
end
end
module Y
def initialize(params ={})
super if defined?(super)
puts 'setting params in module y'