Skip to content

Instantly share code, notes, and snippets.

@dstarh
dstarh / gist:1085432
Created July 15, 2011 19:58
switch tag
#{layout.tags.switch value:3}
#{layout.tags.block case:1}
do for 1
#{/layout.tags.block}
#{layout.tags.block case:2}
do for 2
#{/layout.tags.block}
#{layout.tags.block case:3}
do for 3
#{/layout.tags.block}
@dstarh
dstarh / osx.custom.bash
Created April 30, 2012 18:55
custom osx plugin
#!/usr/bin/env bash
function copy() {
if [ ! $(uname) = "Darwin" ]
then
echo "This function only works with Mac OS X"
return 1
fi
cat "$*" | /usr/bin/pbcopy
}
@dstarh
dstarh / alias.sh
Created June 19, 2012 02:22
alias -p | grep git
alias __git_find_on_cmdline='__git_find_subcommand'
alias g='git'
alias ga='git add'
alias gall='git add .'
alias gb='git branch'
alias gba='git branch -a'
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gci='git commit --interactive'
alias gcl='git clone'
@dstarh
dstarh / settings.js
Created August 28, 2012 14:53
settings
{
"analysis":{
"analyzer":{
"customAnalyzer":{
"type":"custom",
"tokenizer":"standard",
"stopwords":"_none_",
"filter": ["custom_stop"]
}
},

Custom Favicons for sites See - https://skitch.com/dstarh/exi5e/menubar - these are my custom github icons that tell me which project I'm in without having to click the tab

Note this was done in chrome but will likely work in firefox with greasemonkey

  • Install Tamper Monkey
  • Create a new userscript based on the attached user script changing the match url and the url in the addFavicon (note for my images i just used skitch and shared the links you can get the direct image link from the link page)
  • note the match url can be any part of a domain with * replacing any portion of it.
  • Reload the page, it should now have your custom favicon
@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>
MAIN FILE
<table>
<tr th:each="object : ${objects}" th:include="admin/objects/list_partial :: row" th:attr=data-id=${object.id}>
</tr>
</table>
Include
<div th:each={role : ${roles}>
<select>
<option th:each="user : ${users}" th:attr="selected=${formBean.membershipList.?[user.id == user.id AND userAssetRole.id == role.id]} ? 'selected'" th:text="${user.firstName} + ' ' + ${user.lastName}">John Smith</option>
</select>
</div>
@dstarh
dstarh / gist:4196457
Created December 3, 2012 17:15
nginx conf
server {
listen 8081;
server_name whatever.com;
#charset koi8-r;
#access_log logs/host.access.log main;
#location / {
# root html;
@dstarh
dstarh / syslog.sh
Created December 5, 2012 14:35
syslog
/var/log/syslog
{
maxage 36500
daily
missingok
ifempty
delaycompress
compress
dateext
extension log