Skip to content

Instantly share code, notes, and snippets.

View mikecmpbll's full-sized avatar
🎯
Focusing

Mike Campbell mikecmpbll

🎯
Focusing
  • Skipton, North Yorkshire
View GitHub Profile
app
engines
engine_one
app
models
..etc
engine_two
app
models
..etc
@mikecmpbll
mikecmpbll / home.rb
Last active August 29, 2015 13:56 — forked from joelbrewer/home.rb
def home
render 'signed_out_home' and return unless signed_in?
current_user.active_subscription? ? load_signed_in_page : redirect_to plans_path
end
<body id="brands" data-hook="body">
<ul class="letters">
<% ('A'..'Z').each do |letter| %>
<li><%= link_to letter, "#", class: "key-link", data: { letter: letter } %></li>
<% end %>
</ul>
<hr>
<% @brands.each do |key, brands| %>
<ul class="brand-letters">
<li id="letter-<%= key %>" class="key"><%= key %></li>
class Task < ActiveRecord::Base
def self.todays_tasks
where(due_date: Date.today.beginning_of_day..Date.today.end_of_day)
end
def self.tomorrows_tasks
where(due_date: Date.tomorrow.beginning_of_day..Date.tomorrow.end_of_day)
end
end
4 def import
5 unless params[:file].blank?
6 labels = Array.new
7 IO.foreach( params[:file].tempfile ) do |line|
8 if /;/.match( line )
9 labels << line.split( ';' )
10 elsif /,/.match( line )
11 labels << line.split( ',' )
12 else
13 labels << line