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 Array | |
def new_map | |
a = [] | |
self.each do |item| | |
a << yield(item) | |
end | |
a | |
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
<h1><%= markdown @post.title %></h1> | |
<div class="row"> | |
<div class="col-md-8"> | |
<small> | |
<%= image_tag(@post.user.avatar.tiny.url) if @post.user.avatar? %> | |
submitted <%= time_ago_in_words(@post.created_at) %> ago by | |
<%= @post.user.name %> | |
</small> | |
<p><%= markdown @post.body %></p> | |
<%= image_tag(@post.image) if @post.image? %> |
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
<h1><%= @topic.name %></h1> | |
<% if policy(@topic).update? %> | |
<%= link_to "Edit Topic", edit_topic_path, class: 'btn btn-success' %> | |
<% end %> | |
<div class="row"> | |
<div class="col-md-8"> | |
<p class="lead"><%= @topic.description %></p> | |
<% @posts.each do |post| %> |
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
require 'csv' | |
baytechs_file = "/path/to/file/baytechs.CSV" | |
devices_file = "/path/to/file/devices.CSV" | |
namespace :oob_import do | |
task :baytechs => :environment do | |
Baytech.delete_all | |
CSV.foreach(baytechs_file, headers: true) do |row| | |
p row |
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 String | |
def title_case | |
articles = ["of", "and", "the", "a"] | |
s = self.downcase | |
a = s.split(' ') | |
a.each do |i| | |
i.capitalize! unless articles.include? i | |
end | |
a.first.capitalize! |
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
mkdir app/controllers/topics/ | |
mv app/controllers/posts_controller.rb app/controllers/topics/posts_controller.rb | |
mkdir app/views/topics/posts/ | |
mv app/views/posts/_form.html.erb app/views/topics/posts/_form.html.erb | |
mv app/views/posts/edit.html.erb app/views/topics/posts/edit.html.erb | |
mv app/views/posts/new.html.erb app/views/topics/posts/new.html.erb | |
mv app/views/posts/show.html.erb app/views/topics/posts/show.html.erb |
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
AWS_ACCESS_KEY_ID: "XXXXXXXXXXXXXXXXXXXXX" | |
AWS_SECRET_ACCESS_KEY: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" | |
development: | |
SENDGRID_USERNAME: "yourappname@heroku.com" | |
SENDGRID_PASSWORD: "yourPW" | |
AWS_BUCKET: myname-bloccit-dev | |
production: | |
AWS_BUCKET: myname-bloccit-prod |
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
require 'csv' | |
equip_dom = "/tmp/equip.db_new" | |
equip_mow = "/tmp/equip.db.mow_new" | |
namespace :oob_export do | |
task :domestic => :environment do | |
puts "Building equip.db file." | |
CSV.open(equip_dom, 'w+', col_sep: ':') do |csv| | |
Baytech.where(region: "USA").all.each do |baytech| |
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
Feature: Registration | |
Scenario: User provides valid information | |
Given a unique email, password and matching password confirmation | |
When the user clicks the Sign up button | |
Then the output should be "A message with a confirmation link has been sent to your email address. Please open the link to activate your account." | |
Scenario: User supplies email, but no password | |
Given a unique email, but no password or password confirmation | |
When the user clicks the Sign up button |
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
source 'https://rubygems.org' | |
ruby '2.1.2' | |
gem 'rails', '4.1.4' | |
gem 'sass-rails', '~> 4.0.3' | |
gem 'uglifier', '>= 1.3.0' | |
gem 'coffee-rails', '~> 4.0.0' | |
gem 'jquery-rails' | |
gem 'jbuilder', '~> 2.0' |
OlderNewer