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
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
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
import Dict exposing (Dict) | |
import Json.Decode as Decode | |
type SchemaData | |
= SchemaObject (Dict String SchemaData) | |
| SchemaList (List SchemaData) | |
| SchemaString String | |
| SchemaInt Int | |
| SchemaBool Bool | |
| SchemaNull |
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 ExamplesController < ApplicationController | |
def index | |
@examples = Example.order(id: :desc) | |
render json: { pagination: paginate(@examples), examples: @examples } | |
end | |
private | |
def paginate(active_relation) | |
Pagination.for(self, active_relation) |
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
es_alias = ENV.fetch('ALIAS') | |
hosts = ENV.fetch('HOSTS') | |
old_index = ENV.fetch('OLD_INDEX') | |
old_type = ENV.fetch('OLD_TYPE') | |
new_index = ENV.fetch('NEW_INDEX') | |
new_type = ENV.fetch('NEW_TYPE') | |
size = ENV.fetch('SCAN_SIZE', 100) | |
client = Elasticsearch::Client.new(hosts: hosts) | |
unless client.indices.exists(index: new_index) |
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
Rehearsal --------------------------------------------- | |
any? 0.000000 0.000000 0.000000 ( 0.000885) | |
all? 0.000000 0.000000 0.000000 ( 0.000279) | |
min block 0.960000 0.000000 0.960000 ( 0.958517) | |
------------------------------------ total: 0.960000sec | |
user system total real | |
any? 0.000000 0.000000 0.000000 ( 0.000886) | |
all? 0.000000 0.000000 0.000000 ( 0.000297) | |
min block 0.970000 0.000000 0.970000 ( 0.974703) |
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
require "benchmark" | |
Benchmark.bm(10000) do |x| | |
x.report("A") { } | |
x.report("B") { } | |
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
(function() { | |
var script = document.createElement('script'); | |
script.type = 'text/javascript'; | |
script.src = '//cdn.mark.reevoo.com/assets/reevoo_mark.js'; | |
var s = document.getElementById('reevoomark-loader'); | |
s.parentNode.insertBefore(script, s); | |
})(); | |
afterReevooMarkLoaded = [function() { | |
ReevooApi.load('YOUR_TRKREF', function(retailer) { |
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
(function() { | |
var script = document.createElement('script'); | |
script.type = 'text/javascript'; | |
script.src = 'http://cdn.mark.reevoo.com/assets/reevoo_mark.js'; | |
var s = document.getElementById('reevoomark-loader'); | |
s.parentNode.insertBefore(script, s); | |
})(); | |
afterReevooMarkLoaded = [function(){ | |
ReevooApi.load('YOUR_TRKREF', function(retailer){ |
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
(function(url, name){ | |
(window.ReevooMarkObjects = window.ReevooMarkObjects || []).concat([name]); | |
window[name] = window[name] || function(){ | |
(window[name].queue = window[name].queue || []).push([arguments]); | |
}; | |
var script = document.createElement("script"); | |
script.async = true; | |
script.src = url; |
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
# set the locations that we will look for changed assets to determine whether to precompile | |
set :assets_dependencies, %w(app/assets lib/assets vendor/assets Gemfile.lock config/routes.rb) | |
# clear the previous precompile task | |
Rake::Task["deploy:assets:precompile"].clear_actions | |
class PrecompileRequired < StandardError; end | |
namespace :deploy do | |
namespace :assets do | |
desc "Precompile assets" |
NewerOlder