Make sure nodejs is installed
git clone https://github.com/etsy/statsd.git
cd statsd
cp exampleConfig.js config.js
subl config.js
node stats.js config.js
# app/models/user.rb | |
class User < ActiveRecord::Base | |
has_many :posts, dependent: :destroy | |
end | |
# app/models/post.rb | |
class Post < ActiveRecord::Base | |
belongs_to :user | |
scope :published, -> { where(published: true) } | |
end |
form.filter_form .filter_form_field.filter_numeric_range input[type='text'] { | |
background-position: 100% 3px; | |
background-repeat: no-repeat; | |
padding-right: 25px; | |
width: calc(50% - 3px); | |
} | |
form.filter_form .filter_form_field.filter_numeric_range .separator, form.filter_form .filter_form_field.filter_numeric_range input[type='text'] { | |
display: inline-block; | |
float: none; |
<%#- app/views/spree/admin/promotions/rules/_order_quantity.html.erb %> | |
<div class='panel-body'> | |
<div class='row no-marginb'> | |
<div class='form-group col-xs-12 col-md-6 no-marginb'> | |
<%= select_tag "#{param_prefix}[preferred_operator_min]", options_for_select(Spree::Promotion::Rules::OrderQuantity::OPERATORS_MIN.map{|o| [Spree.t("order_quantity_rule.operators.#{o}"),o]}, promotion_rule.preferred_operator_min), { class: 'select2 select_item_total marginb' } %> | |
<%= select_tag "#{param_prefix}[preferred_operator_max]", options_for_select(Spree::Promotion::Rules::OrderQuantity::OPERATORS_MAX.map{|o| [Spree.t("order_quantity_rule.operators.#{o}"),o]}, promotion_rule.preferred_operator_max), { class: 'select2 select_item_total' } %> | |
</div> | |
<div class='form-group col-xs-12 col-md-6 no-marginb'> | |
<%= text_field_tag "#{param_prefix}[preferred_quantity_min]", promotion_rule.preferred_quantity_min, class: 'form-control marginb' %> | |
<%= text_field_tag "#{param_prefix}[preferred_quantity_ |
Change root password:
sudo passwd
Change user password:
passwd
require 'csv' | |
input_file = "#{Rails.root}/High School Database CSV.csv" | |
file_1 = CSV.open("#{Rails.root}/High_School_Database_#{1}.csv", 'w') | |
file_2 = CSV.open("#{Rails.root}/High_School_Database_#{2}.csv", 'w') | |
file_3 = CSV.open("#{Rails.root}/High_School_Database_#{3}.csv", 'w') | |
count = 0 | |
CSV.foreach(input_file) do |row| | |
if count < 400000 | |
file_1 << row | |
elsif count < 800000 |
git diff --color --name-status master..develop | grep -E '^A.*.js|^A.*.css' # js & css | |
git diff --color --name-status master..develop | grep -E '^A.*db/migrate/.*.rb' # migrations |
class DropUsers < ActiveRecord::Migration
def change
drop_table :users do |t|
t.string :email, null: false
t.timestamps null: false
end
end
end
# 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: |
Rails provide different ways to load associations from database to avoid N + 1 query being fired.
I have two models User
and Post
with following associations:
# app/models/user.rb
class User < ActiveRecord::Base
has_many :posts
end