Skip to content

Instantly share code, notes, and snippets.

View aliasmac's full-sized avatar
🎯
Building Voice Tech @ DeepL

Aliasgar Makda aliasmac

🎯
Building Voice Tech @ DeepL
View GitHub Profile
[
{
"time": 1662715800000,
"low": 315.01,
"high": 316.2,
"open": 316.2,
"close": 315.87
},
{
"time": 1662715860000,
@aliasmac
aliasmac / ollyUltipro.js
Last active July 22, 2020 09:51
Report path clarification
const request = {
request: [
{
$: {
'xmlns:i': 'http://www.w3.org/2001/XMLSchema-instance',
},
ReportPath: {
_: params.report_path
}
@aliasmac
aliasmac / oneOfFormatter.js
Created July 21, 2020 14:32
oneOfFormatter Demo
const getJobSchema = () => ({
description: 'The type of job you wish to start.',
type: 'object',
required: true,
oneOf: [
{
title: 'Blast Query',
type: 'object',
properties: {
blast_query: {
@aliasmac
aliasmac / bufferParser.js
Created July 21, 2020 14:17
Buffer Parser Demo
// Parses a buffer response from API.
exports.parseBuffer = input => {
let json = (new Buffer(input)).toString("utf8");
// Regex here converts numbers larger than 9 digits to strings.
json = json.replace(/([\[:])?(\d{9,})([,\}\]])/g, "$1\"$2\"$3");
json = JSON.parse(json);
return {
result: json
@aliasmac
aliasmac / enumHelper.js
Last active July 21, 2020 14:13
Enum Helper Demo
const RETURNABLE_IMAGE_FIELDS = [
'summary_set',
'display_set',
'detail_set',
'allowed_use',
'alternative_ids',
'artist',
'artist_title',
'asset_family',
'call_for_image',
// Request:
{
url: 'https://sandbox.walmartapis.com/v3/token',
data: { grant_type: 'client_credentials' },
options: {
headers: {
Authorization: 'Basic <base64String>=',
Accept: 'application/json',
'Content-Type': 'application/x-www-form-urlencoded',
'WM_SVC.NAME': 'Walmart Marketplace',
@aliasmac
aliasmac / example.js
Created May 1, 2020 14:39
Building stock data
const stocks = [
['Apple (APPL)', 159, '2.0%', '26/04/20', 'First'],
['Amazon (AMZN)', 237, '9.0%', '25/04/20', 'Second'],
['Netflix (NFLX)', 262, '16.0%', '23/04/20', 'First'],
['Alphabet (GOOGL)', 305, '3.7%', '21/04/20', 'Second'],
['Microsoft (MSFT)', 356, '16.0%', '13/04/20', 'Fourth']
]
const createData = (name, price, change, date, watchlist) => {
return { name, price, change, date, watchlist }