Skip to content

Instantly share code, notes, and snippets.

CREATE TABLE `component_status_logs` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`component_id` int(11) DEFAULT NULL,
`build_id` int(11) DEFAULT NULL,
`build_flow_id` int(11) DEFAULT NULL,
`test_ci_result_id` int(11) DEFAULT NULL,
`status` int(11) DEFAULT NULL,
`statistic` varchar(255) DEFAULT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
CREATE TABLE `build_flows` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`device_id` int(11) DEFAULT NULL,
`device_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`job_id` int(11) DEFAULT NULL,
`job_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`branch` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`build_type` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`pbt_sdk` tinyint(4) DEFAULT '0',
`pbt_opensource` tinyint(4) DEFAULT '0',
@StasKoval
StasKoval / install-comodo-ssl-cert-for-nginx.rst
Last active September 1, 2015 13:44 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@StasKoval
StasKoval / regex-console.text
Last active September 14, 2015 13:10
Remove all console.log from JS in Sublime
Ensure regex button is selected and then type this in the search field.
\s*console\.log(.*);
$ ssh-keygen -t rsa
$ ssh-copy-id -i ~/.ssh/id_dsa.pub user@machine
$ ssh user@machine
require 'net/ssh'
require 'logger'
Net::SSH.start(
'host', 'user',
:host_key => "ssh-rsa",
@StasKoval
StasKoval / application.rb
Created September 27, 2015 00:21 — forked from stereoscott/application.rb
Redirect Mobile User-Agent to Subdomain as Rack Middleware (in Rails)
module YourApp
class Application < Rails::Application
# ...
config.middleware.insert_before "Rack::Cache", "SubdomainRedirect"
# ...
end
end
@StasKoval
StasKoval / gist:d2afb91aace974a2030b
Created December 2, 2015 13:09 — forked from alex-zige/gist:5795358
Rails Rspec API Testing Notes

Rails Rspec APIs Testing Notes

Folders Structure

  spec
  |--- apis #do not put into controllers folder. 
        |--- your_api_test_spec.rb  
  |--- controllers
  |--- models
  |--- factories
 |--- views
@StasKoval
StasKoval / obervable_example.rb
Created December 30, 2015 18:18 — forked from jensendarren/obervable_example.rb
Example of using Observable in Ruby
require 'observer'
class CoffeeShop
include Observable
attr_reader :customers
def initialize(name, capacity)
@name = name
@capacity = capacity
@customers = []
@StasKoval
StasKoval / enumerable_example.rb
Created December 30, 2015 18:19 — forked from jensendarren/enumerable_example.rb
See rotati blog post
class Coffee
attr_accessor :name
attr_accessor :strength
def initialize(name, strength)
@name = name
@strength = strength
end
def <=>(other_coffee)
class ReportsController < ApplicationController
def group_columns columns, items
numitems = items.length
rows = numitems / columns
rows += 1 if numitems % columns > 0
extras = numitems % rows if rows > 0
1.upto(rows).map { |rownum|
# distribute the extras evenly
extra = 0