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
family = { | |
uncles: ["bob", "joe", "steve"], | |
sisters: ["jane", "jill", "beth"], | |
brothers: ["frank","rob","david"], | |
aunts: ["mary","sally","susan"] | |
} |
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
require 'pdfkit' | |
require 'nokogiri' | |
require 'haml' | |
# config/initializers/pdfkit.rb | |
PDFKit.configure do |config| | |
# Note: Often required for Windows OS configuration | |
# config.wkhtmltopdf = '/path/to/wkhtmltopdf' | |
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
require 'pdfkit' | |
require 'nokogiri' | |
require 'haml' | |
# config/initializers/pdfkit.rb | |
PDFKit.configure do |config| | |
# Note: Often required for Windows OS configuration | |
# config.wkhtmltopdf = '/path/to/wkhtmltopdf' | |
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
# lib/store_stylesheet.rb | |
class StoreStylesheet | |
def initialize(store) | |
@store = store | |
end | |
# The path of the compiled stylesheet, i.e. stores/id-timestamp.css | |
def stylesheet_file | |
filename = [ |
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
# Development tools: | |
sudo apt-get update | |
sudo apt-get -y upgrade | |
sudo apt-get -y install build-essential git-core curl libssl-dev libreadline6 libreadline6-dev zlib1g zlib1g-dev | |
# Pour passenger | |
sudo apt-get -y install libcurl4-openssl-dev | |
# Pour nokogiri | |
sudo apt-get -y install libxslt-dev libxml2-dev |
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
class PagesController < ApplicationController | |
before_filter :login_required, :except => [ :show ] | |
# GET /pages | |
# GET /pages.xml | |
def index | |
@pages = Page.find(:all) | |
respond_to do |format| | |
format.html # index.html.erb |
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
var DateHelper = { | |
timeAgoInWords: function(from) { | |
return this.distanceOfTimeInWords(new Date(), from); | |
}, | |
distanceOfTimeInWords: function(to, from) { | |
var distance_in_seconds = ((to - from) / 1000); | |
var distance_in_minutes = (distance_in_seconds / 60).floor(); | |
if (distance_in_minutes <= 0) return "less than a minute"; |
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
// cf http://www.37signals.com/svn/posts/1557-javascript-makes-relative-times-compatible-with-caching | |
var DateHelper = { | |
// Takes the format of "Jan 15, 2007 15:45:00 GMT" and converts it to a relative time | |
// Ruby strftime: %b %d, %Y %H:%M:%S GMT | |
time_ago_in_words_with_parsing: function(from) { | |
var date = new Date; | |
date.setTime(Date.parse(from)); | |
return this.time_ago_in_words(date); | |
}, |