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
# I realize this declaration looks kind of crazy, but I find it | |
# way more readable and DRY than a straight list would be | |
# optionally add octet-stream to this list - evaluate security risk of any before doing so | |
CONTENT_TYPES = %w(gif jpg jpe jpeg pjpeg bmp png pdf x-png tiff).map { |st| "image/#{st}"} + | |
%w(vnd.ms-excel vnd.ms-powerpoint msword pdf).map { |st| "application/#{st}"} + | |
[ "text/plain" ] + | |
# Don't blame me, blame Microsoft - this is for Office 2007. | |
# It makes a lot of MIME types that we shouldn't actually make, | |
# but that seems pretty harmless. | |
# original list from http://www.bram.us/2007/05/25/office-2007-mime-types-for-iis/ |
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
// purpose of script is to handle rollovers unobtrusively, e.g. | |
// <img src='original.png' data-rollover='rolled.png'> | |
$(function(){ | |
$('img[data-rollover]').live('mouseover', function(){ | |
if($(this).data('rollover-original') == null) { | |
$(this).data('rollover-original', $(this).attr('src')) | |
} | |
$(this).attr('src', $(this).data('rollover')) | |
}).live('mouseout', function(){ |
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
gem 'rails', '3.1.0.rc4' | |
group :development, :test do | |
gem 'rspec-rails', '~> 2.6.1' | |
end | |
group :test do | |
gem 'factory_girl_rails' | |
gem 'rspec' | |
end |
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
# values is expected to be hash whose keys are the names of the pie segments | |
def chart_url(values, size = '300x125') | |
colors = %w(FF9900 324C8E ff0000 FF69B4 1E90FF 9ACD32 DAA520 40E0D0) | |
basic_chart = {:chs => size, :cht => 'p3', :chco => colors.join('|')} | |
chart_params = basic_chart.merge( :chd => 't:'+values.values.join(','), | |
:chdl => values.keys.map { |f| "#{f} (#{values[f]})"}.join('|'), :chtt =>'name of chart') | |
"http://chart.apis.google.com/chart?#{chart_params.to_query}" | |
end |
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
$('a[data-add-nested]').live('click', function(){ | |
var regexp = new RegExp($(this).data('add-nested-replace'), "g") | |
target = $(this).data('add-nested-target') | |
new_stuff = $($(this).data('add-nested').replace(regexp, (new Date).getTime())).hide() | |
if(!target || target == 'before') { | |
new_stuff.insertBefore($(this)) | |
} else if(target == 'after') { | |
new_stuff.insertAfter($(this)) | |
} else { | |
new_stuff.appendTo(target) |
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
source "https://rubygems.org" | |
gem "devise", git: "git://github.com/plataformatec/devise.git", branch: "rails4" | |
gem "devise-i18n", "~> 0.6.5" | |
gem "jbuilder", "~> 1.0.1" | |
gem "jquery-rails" | |
gem "haml", "~> 4.0.1" | |
gem "mongoid", git: "git://github.com/mongoid/mongoid.git", branch: "master" | |
gem "simple_form", "~> 3.0.0.beta1" | |
gem "rails", "4.0.0.beta1" |
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
# 0. Make sure you have Ruby 1.9.3 installed, and optionally RVM and PostgreSQL | |
# 0.2 If you are on the Mac, make sure you have a c compiler by installing XCode Command Line Tools or gcc4.2 with homebrew | |
# https://github.com/mxcl/homebrew/wiki/Custom-GCC-and-cross-compilers | |
# 0.5 Make sure you have bundler version ~> 1.2 as Rails depends on it | |
gem install bundler | |
# 1. Get edge Rails source (master branch) | |
git clone https://github.com/rails/rails.git |
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
describe "A robot", -> | |
it "may not injure a human being or, through inaction, allow a human being to come to harm." | |
it "must obey the orders given to it by human beings, except where such orders would conflict with the First Law." | |
it "must protect its own existence as long as such protection does not conflict with the First or Second Laws." |
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
<snippet> | |
<content><![CDATA[ | |
######## | |
################ | |
######### ########## | |
##### ###### | |
#### ##### | |
##### | |
####### | |
####### |
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
# _ _ _ | |
# | |__ __ _| |__ _ _ _ __ ___ __| | | |
# | '_ \/ _` | / _` | ' \/ _/ -_) _` | | |
# |_.__/\__,_|_\__,_|_||_\__\___\__,_| | |
# __ _ _ __| |_ ___ _ __ ___ _ _ | |
# / _| || (_-< _/ _ \ ' \/ -_) '_| | |
# \__|\_,_/__/\__\___/_|_|_\___|_| | |
# | |
# (c) 2013 stephan.com |
OlderNewer