This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# STRFTIME | |
# %a - The abbreviated weekday name (``Sun'') | |
# %A - The full weekday name (``Sunday'') | |
# %b - The abbreviated month name (``Jan'') | |
# %B - The full month name (``January'') | |
# %c - The preferred local date and time representation | |
# %d - Day of the month (01..31) | |
# %e - Day of the month - no leading zero NOTE: need plugin for this to work in Win32 | |
# %H - Hour of the day, 24-hour clock (00..23) | |
# %I - Hour of the day, 12-hour clock (01..12) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Breadcrumb | |
def breadcrumbs | |
rbreadcrumbs.reverse | |
end | |
def rbreadcrumbs | |
crumbs = [] | |
crumbs << self | |
crumbs << self.parent.rbreadcrumbs if self.parent |

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Admin controller sets layout and has before filter requiring login | |
class ManualsController < AdminController | |
# only allow admins unless index or show action | |
padlock(:on_all_except => [:index, :show]) { current_user.admin? } | |
# only allow admins or users with view privileges on the show action | |
padlock(:on => :show) { current_user.admin? || current_user.can_view_manual?(Manual.find(params[:id])) } | |
def index |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):001:0> thing | |
NameError: undefined local variable or method `thing' for main:Object | |
from (irb):1 | |
irb(main):002:0> defined? thing | |
=> nil | |
irb(main):003:0> thing = thing | |
=> nil | |
irb(main):004:0> thing | |
=> nil | |
irb(main):005:0> defined? thing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):001:0> thing | |
NameError: undefined local variable or method `thing' for main:Object | |
from (irb):1 | |
irb(main):002:0> defined? thing | |
=> nil | |
irb(main):003:0> thing = thing | |
=> nil | |
irb(main):004:0> thing | |
=> nil | |
irb(main):005:0> defined? thing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
sublayout '2col' | |
end | |
class PagesController < ApplicationController | |
sublayout '3col' | |
end | |
class AdminController < ApplicationController | |
sublayout '1col' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In layout file below linked stylesheets/js files. Note: This is HAML... | |
:javascript | |
jQuery(function($){ | |
#{yield :onload} | |
}); | |
In view files. Again HAML... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// outside of this you can refer to jQuery as $j | |
$j = jQuery.noConflict(); | |
jQuery(document).ready(function($){ | |
// your stuff goes here! | |
// just use $ to refer to jQuery from within here | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# make'em pretty colors | |
export PS1='\[\033[0;35m\]\h\[\033[0;33m\] \w\[\033[00m\]: ' | |
# show current Git branch | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
function proml { | |
local BLUE="\[\033[0;34m\]" |