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 ChangePrimaryKeyTypeOnContentUnit < ActiveRecord::Migration | |
def change | |
change_column :content_units, :guoid, :integer, limit: 8 | |
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
class CreateContentUnits < ActiveRecord::Migration | |
def up | |
create_table :content_units, id: false do |t| | |
t.boolean :active, default: false | |
end | |
execute 'ALTER TABLE content_units ADD guoid BIGINT(20) PRIMARY KEY AUTO_INCREMENT FIRST;' | |
end | |
def down | |
drop_table :guoids |
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 CreateContentUnits < ActiveRecord::Migration | |
def change | |
create_table :content_units, id: false do |t| | |
t.integer :guoid, limit: 8, auto_increment: true, primary_key: true | |
t.boolean :active, default: false | |
end | |
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
class ContentUnit < ActiveRecord::Base | |
self.primary_key = :guoid | |
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 CreateContentUnits < ActiveRecord::Migration | |
def up | |
create_table :content_units do |t| | |
t.string :name, null: false | |
t.boolean :active, default: false | |
end | |
execute('ALTER TABLE `content_units` CHANGE `id` `id` BIGINT(20) NOT NULL AUTO_INCREMENT') | |
end | |
def down |
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
{ | |
"id": 1, | |
"active": null, | |
"visibility": null, | |
"created_at": "2016-06-17T04:31:44.000Z", | |
"title_field": null, | |
"owner_id": 1, | |
"owner_type": "Project", | |
"content": [ | |
{ |
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
2.3.0 :001 > require 'benchmark' | |
=> true | |
2.3.0 :002 > x, y = 1, 2; | |
2.3.0 :003 > puts Benchmark.measure { 10000000.times { [x, y].max } } | |
3.300000 0.000000 3.300000 ( 3.301698) | |
=> nil |
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
# This code is assumed to be part of one application(http://microservices2.btdashboard.com) sharing session with other(http://microservices1.btdashboard.com) | |
# '_your_app_session' is session_store key config in session_store.rb | |
# 'KzBxYy9jUURwbEYxR3ZCRmI3' is value of session cookie read in controller action | |
cookie = Mechanize::Cookie.new('_your_app_session', 'KzBxYy9jUURwbEYxR3ZCRmI3') | |
cookie.domain = ".btdashboard.com" # check domain config in session_store.rb | |
cookie.path='/' # Set as per your application settings | |
# More cookie settins as required | |
uri = URI.parse('http://microservices1.btdashboard.com') |
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
# scan file on disk | |
options = {location: '/path/to/file'} | |
# initiate scan - returns ClamScan::Response object | |
respone = ClamScan::Client.scan(options) | |
# check output from clamscan | |
puts response.body | |
# check response status |
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
ClamScan.configure do |config| | |
config.default_scan_options.merge {remove: 'yes'} | |
end |