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
| class Row | |
| attr_accessor :supervisor_name, :name, :emp_pending, :sup_pending, :approved | |
| def to_s | |
| "Test #{@supervisor_name}, #{@name}, #{@emp_pending}, #{@sup_pending}, #{@approved}, #{total}, #{status}" | |
| end | |
| def total | |
| @emp_pending + @sup_pending + @approved | |
| 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
| <%= form_for Group.new do |f| %> | |
| <table summary = "groups from trainer"> | |
| <tr> | |
| <th><%= f.label(:name) %></th> | |
| <td><%= f.text_field(:name) %></td> | |
| </tr> | |
| <tr> | |
| <th><%= f.label(:area) %></th> | |
| <td><%= f.text_field(:area) %></td> | |
| </tr> |
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
| class JTask | |
| # JTask.find() | |
| # Retrieves records from the database file. | |
| # -------------------------------------------------------------------------------- | |
| # Eg: JTask.find("test.json", 1) || JTask.find("test.json", first: 10) | |
| # #=> <JTask id=x, ...> | |
| # -------------------------------------------------------------------------------- | |
| # See wiki guide for more usage examples... | |
| # https://github.com/adammcarthur/jtask/wiki/find |
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
| class BooksController < ApplicationController | |
| before_action :load_book | |
| before_action :check_access | |
| def show | |
| @comments = @book.comments.reversed_nested_set.with_state([:draft, :published]) | |
| end | |
| def subscribed | |
| end | |
| private |
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
| # config valid only for Capistrano 3.1 | |
| set :stages, %w(production staging) | |
| set :default_stage, "staging" | |
| set :application, 'aperture' | |
| set :repo_url, 'ssh://repository/git/aperture.git' | |
| set :user, "rails" |
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
| task :postcode_import => :environment do | |
| puts "\n\n Importing PostCodes" | |
| lat_long_res = [] | |
| CSV.foreach "lib/data/example.csv" do |row| | |
| if row[0].include? " " | |
| postcode = row[0] | |
| else | |
| postcode = row[0][0..3] + " " + row[4..-1] | |
| end | |
| easting = row[1].to_i |
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 add_emojify_and_kramdown(text) | |
| markdowned = Kramdown::Document.new(text).to_html | |
| raw(emojify(markdowned)) | |
| end | |
| def emojify(text) | |
| text.to_str.gsub(/:([a-z0-9\+\-_]+):/) do |match| | |
| if emoji = Emoji.find_by_alias($1) | |
| %Q{<img alt="$1" class="emoji" src="#{ image_path(emoji.image_filename) }">} |
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
| class FollowUpVisitGardensController < ApplicationController | |
| def new | |
| #1st you retrieve the group thanks to params[:group_id] | |
| #2nd you build a new comment | |
| @group = Group.find(params[:group_id]) | |
| @gardener= Gardener.find(params[:gardener_id]) | |
| @follow_up_visit_garden= FollowUpVisitGarden.new | |
| if @gardener.valid? | |
| render "new" |
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
| module ApplicationHelper | |
| def title(*parts) | |
| unless parts.empty? | |
| parts << t(:website) | |
| content_for(:title) do | |
| parts.join(' - ') | |
| end | |
| end | |
| end | |
| 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
| <% content_for :title do %> | |
| <%= @game.SportsLeagueName %>: <%= team_logo @game.away_team %> <%= @game.away_team %> at <%= @game.home_team %>" | |
| <% end %> | |
| <%= team_logo @game.away_team %> | |
| <div> | |
| <% if @game.SportsLeagueName == 'NFL' %> | |
| <%= image_tag "http://151986650d2f98828025-63e4acfff05fd55acad2fbee57a1d69b.r75.cf2.rackcdn.com/#{@game.AwayTeamID}.png" %> | |
| AT | |
| <%= image_tag "http://151986650d2f98828025-63e4acfff05fd55acad2fbee57a1d69b.r75.cf2.rackcdn.com/#{@game.HomeTeamID}.png" %> |