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
'use strict'; | |
/*****************NATIVE forEACH*********************/ | |
Array.prototype.myEach = function(callback) { | |
for (var i = 0; i < this.length; i++) | |
callback(this[i], i, this); | |
}; | |
//tests |
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
var express = require("express"); | |
var app = express(); | |
var request = require("request"); | |
var axios = require("axios"); | |
var cheerio = require("cheerio"); | |
var db = require("quick.db"); | |
var cors = require("cors"); | |
app.use(cors()); |
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 createAndInitialize2DArray(size) { | |
// catch a bug & fix me! | |
var defaultValue = 0; | |
var twoDimensionalArray = []; | |
function initOneDArray() { | |
var row = []; | |
for (var i = 0; i < size; i++) { | |
row.push(defaultValue); | |
} |
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 increment ( numbers ) { | |
let iterator = numbers.length - 1 | |
while ( iterator >= 0 ) { | |
let num = numbers[ iterator ] | |
num++ | |
if (num > 0 && num <= 9) { | |
numbers[ iterator ] = num |
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
<!-- simple drag and drop using vanila Js and Jquery --> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>Drag Drop Demo By Nitin</title> | |
<style> | |
.uploader {position:relative; overflow:hidden; width:100%; |
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
// still working on optimization for this code | |
var addFloatsToArray = function (a) { | |
var l = ([]); | |
for (var i = 0; i < a.length; i++) { | |
var f = a[i]; | |
{ | |
/* add */ (l.push(f) > 0); | |
} | |
} |
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 () { | |
'use strict'; | |
const fs = require('fs'); | |
const elasticsearch = require('elasticsearch'); | |
const esClient = new elasticsearch.Client({ | |
host: 'localhost:9200', | |
log: '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
const fs = require('fs'); | |
const path = require('path'); | |
const errorLogHandler = async (request, reply) => { | |
await saveErrorLog(request.body); | |
reply.send({ success: true }); | |
}; | |
const saveErrorLog = (ed) => { | |
let fileName = getFileName(); | |
let today = getTodayDateFormat() |
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 retry(isDone, next) { | |
var current_trial = 0, max_retry = 50, interval = 10, is_timeout = false; | |
var id = window.setInterval( | |
function() { | |
if (isDone()) { | |
window.clearInterval(id); | |
next(is_timeout); | |
} | |
if (current_trial++ > max_retry) { | |
window.clearInterval(id); |