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
// validate hmac in shopify | |
const queryString = ctx.request.url.split("?")[1]; | |
const isHmacValid = valid.checkHmacValidity( | |
process.env.SHOPIFY_API_SECRET_KEY, | |
queryString | |
); | |
// TODO: Improve error handling | |
if (!isHmacValid) { | |
ctx.redirect("/auth"); |
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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
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 componentToHex(component) { | |
const hex = component.toString(16); | |
return hex.length === 1 ? `0${hex}` : hex; | |
} | |
function rgbFromHueAndChroma(hue, chroma) { | |
const huePrime = hue / 60; | |
const hueDelta = 1 - Math.abs((huePrime % 2) - 1); | |
const intermediateValue = chroma * hueDelta; |
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
{"entity":{ | |
"canCreateTemplate" : true, | |
"containers" : { | |
"//starter.dotcms.com/application/containers/default/" : { | |
"containerStructures" : [ { | |
"id" : "86a06a2e-ba40-43d4-a3ad-3a870d43bfc1", | |
"structureId" : "799f176a-d32e-4844-a07c-1b5fcd107578", | |
"containerInode" : "61f070f0-8def-4858-ab76-f22bcb6feaaa", | |
"containerId" : "69b3d24d-7e80-4be6-b04a-d352d16493ee", | |
"code" : "#dotParse(\"//starter.dotcms.com/application/containers/default/blog.vtl\")", |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
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 generatePieChartData = (data, percentages = false, keys = []) => { | |
const isSingleArray = Object.keys(data).length <= 1; | |
if (isSingleArray) { | |
return Object.entries(data).reduce((acc, [key, data], idx) => { | |
keys.forEach((k, i) => { | |
acc[i] = { | |
id: k, | |
label: k, | |
value: data[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
Object.entries(sample[0]).reduce((acc, [key, data], idx) => { | |
var keysObj = {} | |
keys.forEach((k, i) => { | |
keysObj[k] = typeof(data[i]) === "string" ? +data[i] : data[i]; | |
}); | |
const dataObj = { | |
dimension: key, | |
...keysObj | |
} |
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 actionSheet = Machine({ | |
id: 'actionSheet', | |
initial: 'idle', | |
context: { | |
results: [] | |
}, | |
states: { | |
idle: { | |
on: { | |
SELECT: 'loading', |
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 connectedMachine = Machine({ | |
id: 'connectedData', | |
initial: 'idle', | |
context: { | |
results: [] | |
}, | |
states: { | |
idle: { | |
on: { | |
ADD: 'pending', |
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
pg_ctl -D /usr/local/var/postgres status | |
pg_ctl -D /usr/local/var/postgres start | |
pg_ctl -D /usr/local/var/postgres stop |