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 'http://rubygems.org' | |
## Rails | |
gem 'rails', '3.2.13' | |
gem 'mysql2' | |
## Views | |
gem 'jquery-rails' | |
gem "haml" |
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
upstream example.com { | |
server unix:///var/www/example.com/shared/sockets/puma.sock fail_timeout=0; | |
} | |
server { | |
listen 80; | |
server_name *.example.com; | |
return 301 http://example.com$request_uri; | |
} |
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
layouts = [ | |
[[500,250][500,250]], | |
[[250,250],[250,250],[250,250],[250,250]] | |
] | |
- @posts.each_with_index do |post,i| | |
row = layouts[i%layouts.length] # On récupere ici une ligne de layout | |
- row.each do |elm| | |
= content_tag :div, :style => "width:#{elm.first}px;height:#{elm.last}px;float:left" | |
next row.length |
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
def self.calculate_delay(now = Time.now.to_date) | |
next_payment = Date.new((now+1.month).year, (now+1.month).month, -1) | |
# Affiche la date passée en argument, a priori date de commande, puis la date du prochain prélèvement et le délais entre les 2 en jours | |
[now.strftime('%d/%m/%Y'),next_payment.strftime('%d/%m/%Y'),(next_payment-now).to_i] | |
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
create db/migrate/20111006135013_create_posts.rb | |
create app/models/post.rb | |
invoke rspec | |
create spec/models/post_spec.rb | |
route resources :posts | |
invoke scaffold_controller | |
create app/controllers/posts_controller.rb | |
invoke haml | |
create app/views/posts | |
create app/views/posts/index.html.haml |
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
<script type="text/javascript" charset="utf-8"> | |
var currentPage = 5; | |
function nearBottomOfPage() { | |
return scrollDistanceFromBottom() < 150; | |
} | |
function scrollDistanceFromBottom(argument) { | |
return $(document).height()-$(window).scrollTop()-$(window).height(); |
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
f = File.new("clean.csv", 'a') | |
File.open('members_Pyramyd_NTCV_Sep_6_2011.csv').each do |line| | |
f.puts line.split(",")[0..2].join(',') | |
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
def index | |
@magazine = Magazine.published.first | |
@published_magazines = Magazine.published | |
if @magazine | |
@summaries = @magazine.pages.summaries | |
@description = @magazine.metadescription | |
redirect_to magazine_url(@magazine) | |
else | |
redirect_to new_magazine_path |
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
When "filling a new todo task" do | |
Then "should see its newly added task" do | |
visit '/' | |
fill_in "task_message", :with => "I have to read some BDD books" | |
click_button "Todo!" | |
within("#nav_badge") do | |
page.should have_content(3) | |
end | |
within("#todo_badge") do | |
page.should have_content(3) |
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
@font-face { | |
font-family: "NeuzeitTextbookRegular"; | |
src: url(/fonts/neuzeittextbook_regular-webfont.eot?1300874573); | |
src: local("☺"), url(/fonts/neuzeittextbook_regular-webfont.woff?1300874573) format("woff"), url(/fonts/neuzeittextbook_regular-webfont.ttf?1300874573) format("truetype"), url("/fonts/neuzeittextbook_regular-webfont.svg#webfontJ6Q9a4kP") format("svg"); | |
font-weight: normal; | |
font-style: normal; } |