Skip to content

Instantly share code, notes, and snippets.

View mortik's full-sized avatar

Marten Klitzke mortik

View GitHub Profile
@mortik
mortik / sync_dotfiles
Created May 23, 2013 22:12
Sync dotfiles to server
function scp-dotfiles () {
if [ -z "$1" ]; then
return
fi
echo -n $'syncing files to '
echo -n `set_color $RED_COLOR`
echo -n $1
echo `set_color $DEFAULT_COLOR`
scp ~/.dot-files/.srv_bashrc $1:~/.bashrc
scp ~/.dot-files/.srv_bash_aliases $1:~/.bash_aliases
@mortik
mortik / .bash_rc
Last active December 17, 2015 16:30
My prompt for bash
DEFAULT_COLOR="[00m"
GRAY_COLOR="[37m"
PINK_COLOR="[35m"
GREEN_COLOR="[32m"
ORANGE_COLOR="[33m"
RED_COLOR="[31m"
if [ `id -u` == '0' ]; then
USER_COLOR=$RED_COLOR
else
USER_COLOR=$PINK_COLOR
@mortik
mortik / form_helper.rb
Created April 14, 2013 12:41
Form Helper for form errors in Rails
# encoding: utf-8
module FormHelper
def form_error?(obj, method)
obj.errors[method].empty? ? '' : 'error'
end
def form_errors(obj, method)
obj.errors[method].join ' '
end
end
@mortik
mortik / active_nav_helper.rb
Created April 14, 2013 12:09
Nav Helper to check which navigation item is currently active
# encoding: utf-8
module ActiveNavHelper
def get_active_nav nav = 'home'
if nav == @active_nav
return "active"
end
end
end
@mortik
mortik / sortable_helper.rb
Created April 14, 2013 12:08
Sortable Helper for tables in Rails Dependencies: - url_plumber gem
# encoding: utf-8
module SortableHelper
def sortable column, title = nil, remote = true
title ||= column.titleize
css_class = column == sort_column ? "current #{sort_direction}" : nil
direction = column == sort_column && sort_direction == "asc" ? "desc" : "asc"
link_to title, plumb(sort: column, direction: direction, page: nil), {:class => css_class}
end
end
@mortik
mortik / sublime_text_shortcuts.md
Last active December 15, 2015 22:09 — forked from lucasfais/gist:1207002
Shortcuts for Sublime Text

Sublime Text

Useful Shortcuts (Mac OS X)

General

|  ⌘T  |    go to file
|  ⌘⌃P  |    go to project
|  ⌘R  |    go to methods
|  ⌃G  |    go to line
|  ⌘KB  |    toggle side bar