This file contains hidden or 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
{ | |
"id": "c4c920d9-eca2-bcd7-6ad7-285556c577c9", | |
"name": "ELASTIC SEARCH API temp", | |
"description": "", | |
"order": [ | |
"b37eb178-4eac-e356-a391-41d7087d3565", | |
"ff953532-addd-52ec-d040-8444486d2532", | |
"b9159693-f81d-1fc9-80d2-e11feb9184f0", | |
"a4398b3c-a076-d7d6-0646-a52f75f690bb", | |
"70dbadea-a78d-752f-2b3c-2fa1dd607872", |
This file contains hidden or 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
# Change directory -> to your login directory | |
cd ~ | |
# ---------------------------------- J A V A dependency installation | |
# Installing Java 8 | |
# Add Oracle Java PPA to apt | |
sudo add-apt-repository -y ppa:webupd8team/java | |
# Update repo |
This file contains hidden or 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
module.exports = { | |
uniqueID: function(){ | |
const length = 38; | |
const unixTstamp = Math.round(new Date().getTime()/1000); | |
const chars = Math.random().toString(36).slice(2) | |
var result = ''; | |
for (var i = length; i > 0; --i) result += chars[Math.round(Math.random() * (chars.length - 1))]; | |
return result; | |
}, | |
randomString: function(){ // returns 128 bit string |
This file contains hidden or 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
module.exports = { | |
onlyNumber: function(sample){ | |
// returns false if input is not a number | |
return /^([0-9]+)$/.test(sample); | |
}, | |
onlyAlphabets: function(sample){ | |
// returns false if input is not a string of alphabets | |
return /^([a-z]+)$/.test(sample); | |
}, |
This file contains hidden or 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 jwt = require('jsonwebtoken'); | |
// http://travistidwell.com/blog/2013/09/06/an-online-rsa-public-and-private-key-generator/ | |
// use 'utf8' to get string instead of byte array (1024 bit key) | |
var privateKEY = fs.readFileSync('./private.key', 'utf8'); // to sign JWT | |
var publicKEY = fs.readFileSync('./public.key', 'utf8'); // to verify JWT | |
module.exports = { | |
sign: (payload, $Options) => { | |
/* |
This file contains hidden or 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
console.time("execution"); | |
var posts = [{ | |
"id": 1, | |
"name": "Earth", | |
"children": [2, 3] | |
}, { | |
"id": 2, | |
"name": "Asia", | |
"children": [] | |
}, { |
This file contains hidden or 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
export const getDeviceTypeInfo = () => { | |
const { width, height } = getWindowDimension() | |
const buildDeviceDetails = { | |
deviceType: '', | |
deviceTypeVariant: '', | |
orientation: 'Portrait', | |
width, | |
height, | |
isFallback: false | |
} |
This file contains hidden or 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
import AWS from 'aws-sdk'; | |
import multer, { FileFilterCallback } from "multer" | |
import multerS3 from "multer-s3"; | |
import {Request} from 'express'; | |
import { v4 as uuidv4 } from 'uuid'; | |
AWS.config.update({ | |
accessKeyId: process.env.AWS_ACCESS_KEY_ID, | |
secretAccessKey: process.env.AWS_SECRET_KEY, | |
signatureVersion: 'v4' |
This file contains hidden or 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'; | |
/** | |
* Displays logging information on the screen and in the console. | |
* @param {string} msg - Message to log. | |
*/ | |
function log(msg) { | |
var logsEl = document.getElementById('logs'); |
This file contains hidden or 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 initDevToolCode = () => { | |
const devToolSignalName = 'DEVTOOL_ASYNC_MONITOR__ASYNC_STATUS_CHANGE'; | |
const getNameId = (customName) => customName || `${(Math.random() + 1).toString(36).substring(7)}-${+ new Date()}`; | |
// PubSub outside our app | |
var eventPool = (function() { | |
var topics = {}; | |
var hOp = topics.hasOwnProperty; | |
return { |
OlderNewer