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
# format ruby syntax | |
# :symbol => 'with rocket' | |
# will be converted to | |
# symbol: 'without rocket' | |
function! s:FormatRuby() | |
silent! execute '%s/:\(\w\+\)\ =>/\1: /g' | |
endfunction | |
command! -range=% frs call <SID>FormatRuby() |
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
select.form-control + .chosen-container.chosen-container-single .chosen-single { | |
display: block; | |
width: 100%; | |
height: 34px; | |
padding: 6px 12px; | |
font-size: 14px; | |
line-height: 1.428571429; | |
color: #555; | |
vertical-align: middle; | |
background-color: #fff; |
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
DEPRECATION WARNING: Accessing paths using dot style as in `config.paths.app.controller` is deprecated. Please use `config.paths["app/controller"]` style instead. (called from <class:Application> at /Users/CheeseFace/Sites/st_pancras/config/application.rb:55) | |
Please install the sqlite3 adapter: `gem install activerecord-sqlite3-adapter` (sqlite3 is not part of the bundle. Add it to Gemfile.) | |
/Users/CheeseFace/Sites/st_pancras/vendor/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:71:in `rescue in establish_connection' | |
/Users/CheeseFace/Sites/st_pancras/vendor/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:68:in `establish_connection' | |
/Users/CheeseFace/Sites/st_pancras/vendor/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/railties/databases.rake:61:in `create_database' | |
/Users/CheeseFace/Sites/st_pancras/vendor/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/railties/databases. |
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 tag_percentage | |
total_tags = 0.0 | |
Article.all_tag_counts.each do |tag| | |
total_tags += tag.count | |
end | |
return tag_percent = (count / total_tags * 100).ceil | |
end |
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
module ArticlesHelper | |
def tag_percentage(count) | |
total_tags = 0.0 | |
Article.all_tag_counts.each do |tag| | |
total_tags += tag.count | |
end | |
return tag_percent = (count / total_tags * 100).ceil | |
end |
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
module ArticlesHelper | |
def tag_popularity_as_hex(tag_count) | |
# must use floats | |
# most saturated colour possible, used for a highly used tag | |
max_r = 255.0 | |
max_g = 0.0 | |
max_b = 0.0 | |
# least saturated colour possible, used for tags that are rarely used | |
min_r = 255.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
.block | |
.content | |
%h2 All Editor Accounts | |
.inner | |
.actions-bar.wat-cf | |
= paginate @users | |
%table.table | |
%thead | |
%tr | |
%th Email |
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
module ApplicationHelper | |
def markdown(text) | |
options = [:hard_wrap, :filter_html, :autolink] | |
Redcarpet.new(text, *options).to_html.html_safe | |
end | |
# Use within views to set the page's HTML title | |
def title(title = nil) | |
default = "" |
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 new | |
@editable_area = EditableArea.new | |
if EditableArea.all.last.present? | |
@editable_area.text = EditableArea.all.last.text | |
end | |
@editable_areas = EditableArea.order('created_at desc').limit(15) | |
new! | |
end |
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
.page-header | |
%h1 Website Introduction | |
.row | |
- unless collection | |
.span12 | |
%p | |
You have not created any text for this section yet, please click | |
initialise to add text. | |
.well | |
= link_to 'Initialise', new_admin_site_intro_path, :class => 'btn large primary' |
OlderNewer