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
upstream unicorn_proxy_api { | |
server proxy_api_1 fail_timeout=0; | |
server proxy_api_2 fail_timeout=0; | |
server proxy_api_3 fail_timeout=0; | |
server proxy_api_4 fail_timeout=0; | |
server proxy_api_5 fail_timeout=0; | |
server proxy_api_6 fail_timeout=0; |
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
echo "***** UPDATE *****" | |
apt-get -yq update | |
echo "***** INSTALL PACKAGES *****" | |
apt-get -yq install curl git-core python g++ make python-software-properties libqt4-dev build-essential bison openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev libmagickwand-dev imagemagick | |
apt-get -yq install xvfb firefox | |
echo "***** DOWNLOADING *****" |
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
# not necessary in Rails | |
require 'cgi' | |
require 'openssl' | |
require 'open-uri' | |
# OPTIONS :force, :full_page, :thumb_width, :width, :height | |
def urlbox(url, options={}) | |
urlbox_apikey = 'xxx-xxx' | |
urlbox_secret = 'xxx-xxx' | |
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 Cart < ActiveRecord::Base | |
has_many :cart_lines | |
accepts_nested_attributes_for :cart_lines, allow_destroy: true | |
.... | |
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
class CartLine < ActiveRecord::Base | |
belongs_to :cart | |
belongs_to :product | |
%w[old_price main_price cost_price].each do |k| | |
def q_#{k} | |
quantity * #{k} | |
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
Feature: Site Follow | |
In order to follow somebody | |
As a user | |
I want to click and follow | |
Scenario: As a visitor | |
Given the sample users | |
And I am a visitor | |
And I am on @ned's site page |
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
source 'https://rubygems.org' | |
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' | |
gem 'rails', '4.0.0' | |
gem 'pg' | |
gem 'rails-i18n' | |
gem 'spree', github: 'spree/spree' | |
gem 'spree_i18n', github: 'spree/spree_i18n' |
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 FoosController < ApplicationController | |
before_action :set_foo, only: [:show, :edit, :update, :destroy] | |
# GET /foos | |
def index | |
@foos = Foo.all | |
end | |
# GET /foos/1 | |
def show |
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
# t.string "key" | |
# t.string "val" | |
class MyConfig < ActiveRecord::Base | |
class << self | |
def all_as_hash | |
begin | |
Rails.cache.fetch(:my_config_hash) do | |
h = {} | |
all.each { |m| h[m.key] = m.val } |
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
#!/bin/sh | |
### BEGIN INIT INFO | |
# Provides: stalker_crown_production | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Manage stalker process | |
# Description: Start, stop, restart stalker process for a specific application. | |
### END INIT INFO |