This file contains 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
/* | |
@theme Outback | |
@override-placeholders html, xml, sourcecode.js | |
*/ | |
:document-base { | |
color: #fff; | |
background-color: #2b2b2c; | |
insertion-point-color: #fff; | |
selection-background-color: #000; |
This file contains 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
def time_ago(timestamp, from_timestamp = nil) | |
return if timestamp.nil? | |
from_timestamp = Time.now.to_i if from_timestamp.nil? | |
difference = from_timestamp - timestamp | |
periods = ['second', 'minute', 'hour', 'day', 'week', 'month', 'year', 'decade'] | |
lengths = [60, 60, 24, 7, 4.35, 12, 10] | |
i = 0 |
This file contains 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
def time_ago_in_words(from_time, include_seconds = false) | |
distance_of_time_in_words(from_time, Time.now, include_seconds) | |
end | |
def distance_of_time_in_words(from_time, to_time = 0, include_seconds = false, options = {}) | |
from_time = from_time.to_time if from_time.respond_to?(:to_time) | |
to_time = to_time.to_time if to_time.respond_to?(:to_time) | |
distance_in_minutes = (((to_time - from_time).abs)/60).round | |
distance_in_seconds = ((to_time - from_time).abs).round |
This file contains 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
# | |
# Sinatra Partials | |
# Copyright (C) 2011 Jack Polgar | |
# | |
# @copyright Jack Polgar 2011 | |
# @license New BSD License | |
# @example: | |
# render_partial 'articles/article', :article => article | |
# | |
helpers do |
This file contains 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
#!/bin/bash | |
# | |
################################################################### | |
# Script to update Nginx to the latest version. # | |
# June 3rd 2011 Vlad Ghinea. # | |
################################################################### | |
# | |
# Needs to be called with the version number as argument and also | |
# with "sudo env PATH=$PATH" in front to preserve the paths. | |
# |
This file contains 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
Domains = { | |
/domain\.com/ => '/', | |
/forum\.domain\.com/ => '/forum/index' | |
} | |
Ramaze::Route['sub domains'] = lambda do |uri, action| | |
Domains.each do |regex, sub_uri| | |
if action['env']['HTTP_HOST'] =~ regex | |
return sub_uri | |
end |
NewerOlder