Skip to content

Instantly share code, notes, and snippets.

View bhaskarmelkani's full-sized avatar
🎯
Focusing

Bhaskar Melkani bhaskarmelkani

🎯
Focusing
View GitHub Profile
@bhaskarmelkani
bhaskarmelkani / monit
Last active August 29, 2015 14:17 — forked from roman01la/monit
check host localhost with address 127.0.0.1
start "/sbin/start myapp"
stop "/sbin/stop myapp"
if failed port 3000 protocol HTTP
request /
with timeout 5 seconds
then restart
@bhaskarmelkani
bhaskarmelkani / luhn.js
Created April 16, 2016 12:03
Script for validating Debit/Credit card number using Luhn's Theorem.
function luhn_validate(n){
var l = /^[0-9]+$/.test(n)&&n.length, s = 0, b = 1;
while (l)
s += (b ^= 1) ? +[0, 2, 4, 6, 8, 1, 3, 5, 7, 9][+n[--l]] : +n[--l];
return !!s && s % 10 === 0;
}
---
swagger: "2.0"
info:
version: "1.0.0"
title: "Swagger Petstore"
description: "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification"
termsOfService: "http://swagger.io/terms/"
contact:
name: "Swagger API Team"
license:
---
swagger: "2.0"
type: "string"
# Reference:
https://www.cloudgear.net/blog/2015/5-minutes-kubernetes-setup/
# install homebrew and cask
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# install virtualbox
brew cask install virtualbox
# install dockertoolbox
swagger: "2.0"
info:
version: 2.0.0
title: Swagger Petstore
description: A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification
termsOfService: http://swagger.io/terms/
contact:
name: Swagger API Team
email: foo@example.com
url: https://tech.zalando.com
var myArray = [1,2,3];
// with `for of`
for(var value of myArray) {
console.log(value);
}
// without `for of`
var _myArray = myArray[Symbol.iterator]();
while(var _iteration = _myArray.next()) {
Object.keys(Array.prototype[Symbol.unscopables]); // -> ['copyWithin', 'entries', 'fill', 'find', 'findIndex', 'keys']
// Without unscopables:
class MyClass {
foo() { return 1; }
}
var foo = function () { return 2; };
with (MyClass.prototype) {
foo(); // 1!!
}
#!/bin/bash
set -e
# A precommit hook that uses spotless to format only staged files
# It also supports partially stage files using the following steps:
# 1. It stashed all the unstaged changes and then runs spotlessApply
# 2. After spotless apply is finished it applyes the stashed changes back on the code (that is also formatted/changed by spotless)
# 3. All the files that have conflicts due to the stash apply, it merges the conflict with the changes that are coming from the stash to not loose any new changes that were not staged
//@version=5
indicator(title='Smoothed Mode', shorttitle='Consensus Price', overlay=true)
//User Inputs
percentageToleranceInput = input.int(title="Percentage Tolerance", defval=25) // The +/- tolerance in comparing values to compare them equal to get their mode
lengthInput = input.int(title="Length", defval=20)
source = input.source(title="Source", defval=close)
//getSmoothedModeForArray(array) =>