Skip to content

Instantly share code, notes, and snippets.

View jofi's full-sized avatar

Jozef Fulop jofi

View GitHub Profile
@jofi
jofi / _flash.html.erb
Created June 1, 2012 07:16 — forked from potomak/_flash.html.erb
Rails flash messages using Twitter bootstrap
<% [:notice, :error, :alert].each do |level| %>
<% unless flash[level].blank? %>
<div class="alert-message <%= flash_class(level) %>">
<a class="close" href="#">×</a>
<%= content_tag :p, flash[level] %>
</div>
<% end %>
<% end %>
@jofi
jofi / gist:921867
Created April 15, 2011 15:18
mysql-slave-recovery
# IST DO SCREENU, aby si pri tom nemusel nocovat!!!
# ideme odobrat najnovsi dump z MASTERA (je jedno na ktorom stroji sme - mozno je vyhodnejsie byt na slave-ovi):
# priprava na dump a vynulovanie binary logov
mysql -h db-master -u root -p
FLUSH TABLES WITH READ LOCK;
RESET MASTER;
PURGE BINARY LOGS;
UNLOCK TABLES;
@jofi
jofi / gem-uninstall-from-home.sh
Created April 7, 2011 13:30
Uninstall gems from user's home dir
#!/bin/bash
for F in `ls ~/.gem/ruby/1.8/gems`
do
GEM=${F%-*}
gem uninstall $GEM -a -x -I --install-dir ~/.gem/ruby/1.8/
done
@jofi
jofi / .bashrc
Created December 1, 2010 13:06 — forked from henrik/.bashrc
Bash prompt git status information
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"