This file contains 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 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 retryCircuitBreaker(attempts, limit, wait, fn) { | |
return new Promise((resolve, reject) => { | |
setTimeout(function() { | |
fn().then(resolve).catch(reject); | |
}, attempts * wait); | |
}).catch(function(error) { | |
console.log(error); | |
if(attempts > limit){ | |
return Promise.reject(error); | |
} |
This file contains 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
ko.observableArray.fn.trackHasItems = function () { | |
//create a sub-observable | |
this.hasItems = ko.observable(); | |
//update it when the observableArray is updated | |
this.subscribe(function (newValue) { | |
this.hasItems(newValue && newValue.length); | |
}, this); | |
//trigger change to initialize the value |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Knockout Performance Tests</title> | |
<meta charset="utf-8" /> | |
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.3.0/knockout-debug.js"></script> | |
<script src="https://rawgit.com/brianmhunt/knockout-fast-foreach/master/dist/knockout-fast-foreach.js"></script> | |
<link type="text/css" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha/css/bootstrap.min.css"/> |
This file contains 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
/* | |
knockout-selectize.js (v0.1) | |
Copyright (c) Ninjacode Limited - http://ninjacode.co.uk | |
License: MIT (http://www.opensource.org/licenses/mit-license.php) | |
@auther Anish Patel, Ninjacode | |
*/ | |
(function (ko, $, undefined) { |