Skip to content

Instantly share code, notes, and snippets.

View andychongyz's full-sized avatar
🌶️
BURN!

Andy Chong andychongyz

🌶️
BURN!
  • Kuala Lumpur, Malaysia
  • 05:37 (UTC +08:00)
View GitHub Profile
require 'byebug'
class Orange
attr_reader :diameter
# Initializes a new Orange with diameter +diameter+
def initialize
@diameter = rand(10)+1
end
end
class BankAccount
def initialize(customer_name, type, acct_number)
@customer_name = customer_name
@type = type
@acct_number = acct_number
end
def get_customer_name
@customer_name
end
@andychongyz
andychongyz / gist:e1ed3f0f100280da8fa36e22c5d5e403
Created September 9, 2016 02:54
Problem with capybara js
I, [2016-09-09T10:18:38.643264 #31880] INFO -- : Not reporting to Code Climate because ENV['CODECLIMATE_REPO_TOKEN'] is not set.
An error occurred in an after hook
Errno::EADDRINUSE: Address already in use - bind(2) for 127.0.0.1:9827
occurred at /Users/faisal/.rbenv/versions/2.1.4/lib/ruby/2.1.0/socket.rb:206:in `bind'
F
Failures:
@andychongyz
andychongyz / Gemfile
Last active September 9, 2016 03:27
Gemfile
source 'https://rubygems.org'
ruby '2.1.4'
gem 'rails', '~> 4.1.7'
gem 'coffee-rails', '~> 4.0.0'
gem 'jbuilder', '~> 2.0'
gem 'jquery-rails'
gem 'sass-rails', '~> 4.0.3'
@andychongyz
andychongyz / rails_helper.rb
Created September 9, 2016 03:28
rails_helper
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require 'spec_helper'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
# require 'shoulda/matchers'
# Requires supporting ruby files with custom matchers and macros, etc, in
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
@andychongyz
andychongyz / spec_helper.rb
Created September 9, 2016 03:28
Spec Helper
require "codeclimate-test-reporter"
require 'webmock/rspec'
require 'sidekiq/testing'
require 'capybara/rspec'
require 'capybara-screenshot/rspec'
require 'capybara/poltergeist'
Sidekiq::Testing.fake!
CodeClimate::TestReporter.start
2016-10-05T03:42:11.378866+00:00 app[web.1]: [14] * Listening on tcp://0.0.0.0:24104
2016-10-05T03:42:11.379019+00:00 app[web.1]: [14] * Listening on unix:///tmp/nginx.socket
2016-10-05T03:42:11.379165+00:00 app[web.1]: [14] Use Ctrl-C to stop
2016-10-05T03:42:11.379422+00:00 app[web.1]: Created app-initialized file
2016-10-05T03:42:11.381352+00:00 app[web.1]: Created app-initialized file
2016-10-05T03:42:11.383315+00:00 app[web.1]: [14] - Worker 0 (pid: 19) booted, phase: 0
2016-10-05T03:42:11.384169+00:00 app[web.1]: [14] - Worker 1 (pid: 23) booted, phase: 0
2016-10-05T03:42:11.562542+00:00 app[web.1]: buildpack=nginx at=app-initialized
2016-10-05T03:42:11.562875+00:00 app[web.1]: buildpack=nginx at=nginx-start
2016-10-05T03:42:11.565019+00:00 app[web.1]: nginx: [emerg] bind() to 0.0.0.0:24104 failed (98: Address already in use)
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum, this matches the default thread size of Active Record.
#
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
threads threads_count, threads_count
# Specifies the `port` that Puma will listen on to receive requests, default is 3000.
daemon off;
# Heroku dynos have at least 4 cores.
worker_processes <%= ENV['NGINX_WORKERS'] || 4 %>;
events {
use epoll;
accept_mutex on;
worker_connections 1024;
}
2016-10-05T04:03:05.190341+00:00 heroku[web.1]: State changed from crashed to starting
2016-10-05T04:03:09.169703+00:00 heroku[web.1]: Starting process with command `bundle exec puma -C config/puma_production.rb`
2016-10-05T04:03:11.673229+00:00 app[web.1]: [3] Puma starting in cluster mode...
2016-10-05T04:03:11.673257+00:00 app[web.1]: [3] * Version 3.6.0 (ruby 2.3.0-p0), codename: Sleepy Sunday Serenity
2016-10-05T04:03:11.673259+00:00 app[web.1]: [3] * Min threads: 5, max threads: 5
2016-10-05T04:03:11.673259+00:00 app[web.1]: [3] * Environment: production
2016-10-05T04:03:11.673260+00:00 app[web.1]: [3] * Process workers: 2
2016-10-05T04:03:11.673261+00:00 app[web.1]: [3] * Preloading application
2016-10-05T04:03:12.492744+00:00 app[web.1]: ** [NewRelic][2016-10-05 04:03:12 +0000 web.1 (3)] INFO : Starting the New Relic agent in "production" environment.
2016-10-05T04:03:12.492772+00:00 app[web.1]: ** [NewRelic][2016-10-05 04:03:12 +0000 web.1 (3)] INFO : To prevent agent startup add a NEW_RELIC_AGENT_EN