View rspec_model_testing_template.rb
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
View longest_common_substring_ruby.rb
def find_longest_common_substring(s1, s2)
if (s1 == "" || s2 == "")
return ""
end
m = Array.new(s1.length){ [0] * s2.length }
longest_length, longest_end_pos = 0,0
(0 .. s1.length - 1).each do |x|
(0 .. s2.length - 1).each do |y|
if s1[x] == s2[y]
m[x][y] = 1
View Gemfile_0
gem 'bootstrap-sass'
gem 'devise'
gem 'mailboxer'
View _task.html.erb
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><%= task.title %></h3>
</div>
<div class="panel-body">
<%= truncate task.description, length: 50 %>
</div>
</div>
View application.rb
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# configurations
# preload tokens in application.yml to local ENV
config = YAML.load(File.read(File.expand_path('../application.yml', __FILE__)))
config.merge! config.fetch(Rails.env, {})
config.each do |key, value|
View _message.html.erb
<li class="<%= self_or_other(message) %>">
<div class="avatar">
<img src="http://placehold.it/50x50" />
</div>
<div class="chatboxmessagecontent">
<p><%= message.body %></p>
<time datetime="<%= message.created_at %>" title="<%= message.created_at.strftime("%d %b %Y at %I:%M%p") %>">
<%= message_interlocutor(message).name %><%= message.created_at.strftime("%H:%M %p") %>
</time>
</div>
View status_codes.txt
100 = :continue
101 = :switching_protocols
102 = :processing
200 = :ok
201 = :created
202 = :accepted
203 = :non_authoritative_information
204 = :no_content
205 = :reset_content
206 = :partial_content
View gemfile
gem 'faker', github: 'stympy/faker'
gem 'rack-contrib'
gem 'soulmate', :require => 'soulmate/server'
View addthis.js
// turbolinks addthis
var initAdthis;
initAdthis = function(){
// Remove all global properties set by addthis, otherwise it won't reinitialize
for (var i in window) {
if (/^addthis/.test(i) || /^_at/.test(i)) {
delete window[i];
}
}
View modems.conf
# Modems configuration
#
# Example and default values
#
# group = modems
# id = "my-id"
# name = "my-name"
# detect-string = "MODEM"
# detect-string2 = "" [Default]
# init-string = "AT+CNMI=1,2,0,0,0" [Default]