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
# Load plugins (only those I whitelist) | |
Pry.config.should_load_plugins = false | |
# Pry.plugins["doc"].activate! | |
# Launch Pry with access to the entire Rails stack. | |
# If you have Pry in your Gemfile, you can pass: ./script/console --irb=pry instead. | |
# If you don't, you can load it through the lines below :) | |
rails = File.join Dir.getwd, 'config', 'environment.rb' | |
if File.exist?(rails) && ENV['SKIP_RAILS'].nil? |
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
Show hidden characters
// Settings in here override those in "Default/Preferences.sublime-settings", and | |
// are overridden in turn by file type specific settings. | |
{ | |
"color_scheme": "Packages/Color Scheme - Custom/Railscasts.tmTheme", | |
"gutter": true, | |
"fade_fold_buttons": false, | |
"tab_size": 2, | |
"translate_tabs_to_spaces": true, | |
"draw_centered": false, | |
"draw_minimap_border": true, |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>jQCloud Example</title> | |
<link rel="stylesheet" type="text/css" href="../jqcloud/jqcloud.css" /> | |
<style type="text/css"> | |
<% | |
def css_lines(color) | |
new_lines = [] | |
r = color[:target][0..1].to_i(16) |
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 hc_votes_per_ages(search_params = {}) | |
# TODO apply search params | |
# 0-18 19-24 25-34 35-49 50-64 65-inf | |
now_s = Time.now.to_formatted_s(:db) | |
age_votes = {"0" => [], "1" => [], "2" => [], "3" => [], "4" => [], "5" => [], "6" => []} | |
age_labels = {"0" => "< 18", "1" => "18 - 25", "2" => "25 - 35", "3" => "35 - 50", "4" => "50 - 65", "5" => "> 65", "6" => "unknown"} | |
model.answers.each do |a| | |
query = "COUNT(users.id) as vote_count, CASE | |
WHEN users.birthday>(NOW() - INTERVAL '18 year') THEN 0 | |
WHEN users.birthday<=(NOW() - INTERVAL '18 year') AND users.birthday>(NOW() - INTERVAL '25 year') THEN 1 |
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 hc_votes_per_ages | |
# 0-18 19-24 25-34 35-49 50-64 65-inf | |
now_s = Time.now.to_formatted_s(:db) | |
age_votes = {"0" => [], "1" => [], "2" => [], "3" => [], "4" => [], "5" => [], "6" => []} | |
age_labels = {"0" => "< 18", "1" => "18 - 25", "2" => "25 - 35", "3" => "35 - 50", "4" => "50 - 65", "5" => "> 65", "6" => "unknown"} | |
model.answers.each do |a| | |
query = "COUNT(users.id) as vote_count, CASE | |
WHEN users.birthday>(NOW() - INTERVAL '18 year') THEN 0 | |
WHEN users.birthday<=(NOW() - INTERVAL '18 year') AND users.birthday>(NOW() - INTERVAL '25 year') THEN 1 | |
WHEN users.birthday<=(NOW() - INTERVAL '25 year') AND users.birthday>(NOW() - INTERVAL '35 year') THEN 2 |
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
RewriteEngine On | |
Options Indexes FollowSymlinks Multiviews | |
RewriteBase / | |
RewriteCond %{HTTP_HOST} www.sito.com | |
RewriteCond %{REQUEST_URI} !drupal/ | |
RewriteRule ^(.*)$ http://www.sito.com/drupal/$1 [L] |
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
GEM | |
remote: http://rubygems.org/ | |
specs: | |
actionmailer (3.1.0.rc5) | |
actionpack (= 3.1.0.rc5) | |
mail (~> 2.3.0) | |
actionpack (3.1.0.rc5) | |
activemodel (= 3.1.0.rc5) | |
activesupport (= 3.1.0.rc5) | |
builder (~> 3.0.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
class Post | |
include Mongoid::Document | |
include Mongoid::Paranoia | |
include Mongoid::Timestamps | |
field :title, :type => String | |
attr_accessor :tags_string | |
accepts_nested_attributes_for :answers |
NewerOlder