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 aws = require('aws-sdk'); | |
const { AWS_KEY, AWS_SECRET } = process.env; | |
var sqs = new aws.SQS({ accessKeyId: AWS_KEY, secretAccessKey: AWS_SECRET, region: 'us-east-1' }); | |
const QueueUrl = ''; | |
const enablesPolling = (ReceiveMessageWaitTimeSeconds = "5") => new Promise ((resolve,reject) => { | |
const params = { | |
Attributes: { | |
ReceiveMessageWaitTimeSeconds, | |
}, |
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
#!/bin/bash | |
#curl -LJO https://gist.github.com/niradler/0fbd94573d1efb2b467fbfb90cba2297/raw | |
#chmod +x deploy.sh | |
cd ~/app/devresources | |
git commit -am "pull" | |
git pull --force |
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
// find the missing number 1- 1000 | |
const min =0, max=1000; | |
let arr = new Array(max).fill(0).map((v,k)=> k); | |
const erase = Math.floor(Math.random() * (max - min + 1)) + min; | |
arr.splice(erase,1); | |
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
/* question A, | |
params : A = [1,6,4,5,8,10] | |
return : sum max triangle sides | |
a + b > c | |
*/ | |
const solution = (A)=>{ | |
const find_triplet = (sorted_arr) => { | |
for (let i = sorted_arr.length - 1; i > 1; i--) { | |
const c = sorted_arr[i] |
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
// you can write to stdout for debugging purposes, e.g. | |
// console.log('this is a debug message'); | |
function solution(A) { | |
// write your code in JavaScript (Node.js 8.9.4) | |
const merge_sort = (A) => { | |
//https://gist.github.com/paullewis/1982121 | |
function sort(array) { |
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
// #1 | |
const str1 = `((())))((()())(())(())((())(()()(((()((()))()()(((((((((()())(()()(((((()()))))))(())(())(()))()()))((()((()(()((()())(()())))(()(()))(()))())))()))(())()()((((((())()))))()()((()((())())((((((()())())()))((()))))()()))(((()))((((()))))))))()((((((()(((())())))()())(()))()()()())(()()))))(()))))(((()(()))(()(()())((())))(()((())(()()((()())(()))()((()()(())((((()((()))(()()))(())()((())(()())()(()()((()(()()()))()((()(()))())((()))(())(((()))(((())((()())(())(())((())()()))()((((((())(()))(((()(((((()))()(())()())))((()))))(((()(()())(())()()()))((((((())))(()((((())()())())()())(((((((((())))(()()()(((()((()((())())(((()()))(()(()((((()((()(()())))()((())()(((((()(((((()()())(()(()()((()))())((((())()()))(()(()(()(()((((())))()((((()))())()((((())))))((((()((((()(())))(()()())((()())))))(()))(())()))())(((()))())(()()))()()((())())()())((()(()())(()))()()((())((()())(()((()((())))(())()())(())(()())()()())((())()((((((())))))))))(()()((())(()))()())((())())()))((())())(((((((()(()))(((()( |
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 Server(config) { | |
this.url = config.url; | |
this.actions = config.actions; | |
for (const key in this.actions) { | |
Server.prototype[key] = function(param,data) { | |
var host = this.url.concat(this.actions[key].path); | |
var find_var = host.indexOf(':'); | |
if (find_var>-1 && arguments.length>0) { | |
for (var i = 0; i < arguments.length; i++) { | |
var name=Object.getOwnPropertyNames(arguments[i])[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
if (typeof require === 'undefined') { | |
if (!axios) { | |
console.log('axios is a dependency, please include it in the top of the index.html file (<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.17.1/axios.min.js"></script>)') | |
} | |
} else { | |
var axios = require('axios'); | |
} |
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
if (typeof require === 'undefined') { | |
if (!axios) { | |
console.log('axios is a dependency, please include it in the top of the index.html file (<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.17.1/axios.min.js"></script>)') | |
} | |
} else { | |
var axios = require('axios'); | |
} | |
function Server(config) { | |
this.url = config.url; |