Skip to content

Instantly share code, notes, and snippets.

View niradler's full-sized avatar
🎮

Nir Adler niradler

🎮
View GitHub Profile
@niradler
niradler / sqs.promise.js
Created October 21, 2018 11:10
aws sqs helper promise methods
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,
},
#!/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
@niradler
niradler / interview_question_mobileodt
Created August 11, 2018 18:35
find the missing number 1- 1000
// 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);
int winStates[] = {1, 1, 2, 3, 3, 3, 3};
int states[] = {0, 0, 0, 0, 0, 0, 0};
int s[] = {0, 0};
int loc = 0 ;
int s_loc = 0 ;
int s_isMatch = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(13, OUTPUT);
@niradler
niradler / wix_recruitment_day.js
Last active April 10, 2018 17:38
wix recruitment day
/* 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]
@niradler
niradler / wix_recruitment_day.js
Created April 10, 2018 13:51
wix recruitment day
// 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) {
@niradler
niradler / wix_test.js
Created March 18, 2018 17:38
wix online test
// #1
const str1 = `((())))((()())(())(())((())(()()(((()((()))()()(((((((((()())(()()(((((()()))))))(())(())(()))()()))((()((()(()((()())(()())))(()(()))(()))())))()))(())()()((((((())()))))()()((()((())())((((((()())())()))((()))))()()))(((()))((((()))))))))()((((((()(((())())))()())(()))()()()())(()()))))(()))))(((()(()))(()(()())((())))(()((())(()()((()())(()))()((()()(())((((()((()))(()()))(())()((())(()())()(()()((()(()()()))()((()(()))())((()))(())(((()))(((())((()())(())(())((())()()))()((((((())(()))(((()(((((()))()(())()())))((()))))(((()(()())(())()()()))((((((())))(()((((())()())())()())(((((((((())))(()()()(((()((()((())())(((()()))(()(()((((()((()(()())))()((())()(((((()(((((()()())(()(()()((()))())((((())()()))(()(()(()(()((((())))()((((()))())()((((())))))((((()((((()(())))(()()())((()())))))(()))(())()))())(((()))())(()()))()()((())())()())((()(()())(()))()()((())((()())(()((()((())))(())()())(())(()())()()())((())()((((((())))))))))(()()((())(()))()())((())())()))((())())(((((((()(()))(((()(
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],
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');
}
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;