Skip to content

Instantly share code, notes, and snippets.

Tonny Mutai lestoni

Block or report user

Report or block lestoni

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@lestoni
lestoni / sort.js
Last active Jan 30, 2018
Ranking sorting and Average
View sort.js
// Sort Arr by Ranking
function sortByRanking(arr) {
let compare = function (a,b) {
if (a.ranking < b.ranking) {
return -1;
} else if (a.ranking > b.ranking) {
return 1;
} else {
return 0;
}
View gist:acb29ca94263b2db8eefddcc87d2ab6f
  • What do Etcd, Consul, and Zookeeper do?
    • Service Registration:
      • Host, port number, and sometimes authentication credentials, protocols, versions numbers, and/or environment details.
    • Service Discovery:
      • Ability for client application to query the central registry to learn of service location.
    • Consistent and durable general-purpose K/V store across distributed system.
      • Some solutions support this better than others.
      • Based on Paxos or some derivative (i.e. Raft) algorithm to quickly converge to a consistent state.
      • Centralized locking can be based on this K/V store.
@lestoni
lestoni / gist:2c60a1fe894936e8de21
Last active Sep 17, 2015 — forked from anildigital/gist:862675ec1b7bccabc311
Remove dangling docker images
View gist:2c60a1fe894936e8de21
docker rmi $(docker images -q -f dangling=true)
View activeingredient.json
{
"_id": "55ee9d3faf18e05d4ce2f540",
"active_ingredient_interaction": "Currently updating...",
"breast_feeding_advisory": "Manufacturer advises that the drug should be avoided during breastfeeding as there is no adequate information on safety of the drug to the child",
"contra_indications": "Severe ulcer, gastrointestinal bleeding, and hypersensitivity",
"dosage": "100mg BD",
"generic": "",
"indication": "Inflammation and pain in rheumatoid arthritis, osteoarthritis and alkylosing spondylitis.",
"name": "Aceclofenac",
"picture_url": "",
@lestoni
lestoni / gist:8c74da455cce3d36eb68
Last active Jun 23, 2019
vim folding cheatsheet
View gist:8c74da455cce3d36eb68

via (https://www.linux.com/learn/tutorials/442438-vim-tips-folding-fun)

  • zf#j creates a fold from the cursor down # lines.
  • zf/string creates a fold from the cursor to string .
  • zj moves the cursor to the next fold.
  • zk moves the cursor to the previous fold.
  • zo opens a fold at the cursor.
  • zO opens all folds at the cursor.
  • zm increases the foldlevel by one.
  • zM closes all open folds.
View gist:426b251c3cf68c2c7b42
@media only screen and (max-width: 480px) and (min-width: 320px) {
/*==========================================
Get rid of the H6 it is not necessary.
Giving the heading some whitespace provides
a good visual view.
=========================================*/
.heading h2 {
font-size: 1.1em;
width: 100%;
padding: 5px;
View jsbin.losab.css
#canvas {
border: 1px solid #ccc;
}
View gist:cc02e429400463b45e88
function cruncher(fn, context){
if(typeof fn !== 'function'){
return new Error('Expected ' + fn + ' to be a function');
}
var _slice = [].slice,
memo = [];
function ingest(){
memo.push(fn.apply(context || null, _slice.call(arguments)));
@lestoni
lestoni / gist:5f7e4fa3794db843a999
Last active Aug 29, 2015
Pre-Pro Fn invocation
View gist:5f7e4fa3794db843a999
function func(fn, beforeFn, afterFn /*, thisArgs*/){
var context = arguments.length === 4 ? arguments[3] : null;
var queue = [beforeFn, fn, afterFn];
return function(){
var args = [].slice.call(arguments);
queue.forEach(function(fn, index){
index === 1 ? fn.apply(context,args) : fn.apply(context);
});
};
You can’t perform that action at this time.