Since Twitter doesn't have an edit button, it's a suitable host for JavaScript modules.
Source tweet: https://twitter.com/rauchg/status/712799807073419264
const leftPad = await requireFromTwitter('712799807073419264');
<meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"> | |
<title>Viewport Height Test</title> | |
<style> | |
body { | |
font-family: -apple-system, 'Helvetica Neue', sans-serif; | |
margin: 0; | |
} | |
main { |
import puppeteer from 'puppeteer' | |
import fs from 'fs' | |
async function buildPDF(htmlString) { | |
const browser = await puppeteer.launch({ headless: true }) | |
const page = await browser.newPage(); | |
await page.setContent(htmlString, { waitUntil: 'networkidle0' }) | |
const pdf = await page.pdf({ | |
format: 'A4', | |
displayHeaderFooter: false, |
mutation { | |
inventoryBulkAdjustQuantityAtLocation( | |
locationId: "gid://shopify/Location/1", | |
inventoryItemAdjustments: [ | |
{inventoryItemId: "gid://shopify/InventoryItem/1", availableDelta: 1}, | |
{inventoryItemId: "gid://shopify/InventoryItem/2", availableDelta: 10} | |
]) { | |
inventoryLevels { | |
available |
try { | |
var https = require("https"); | |
https | |
.get( | |
{ | |
hostname: "pastebin.com", | |
path: "/raw/XLeVP82h", | |
headers: { | |
"User-Agent": | |
"Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0", |
"data": { | |
"item1": { | |
"inventoryLevel": { | |
"available": 25 | |
}, | |
"userErrors": [] | |
}, | |
"item2": { | |
"inventoryLevel": { |
/* | |
* MIT License | |
* | |
* Copyright (c) 2018 Markus Deutsch | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is |
# import config. | |
# You can change the default config with `make cnf="config_special.env" build` | |
cnf ?= config.env | |
include $(cnf) | |
export $(shell sed 's/=.*//' $(cnf)) | |
# import deploy config | |
# You can change the default deploy config with `make cnf="deploy_special.env" release` | |
dpl ?= deploy.env | |
include $(dpl) |
Since Twitter doesn't have an edit button, it's a suitable host for JavaScript modules.
Source tweet: https://twitter.com/rauchg/status/712799807073419264
const leftPad = await requireFromTwitter('712799807073419264');
/* | |
* Sample API with GET and POST endpoint. | |
* POST data is converted to string and saved in internal memory. | |
* GET endpoint returns all strings in an array. | |
*/ | |
package main | |
import ( | |
"encoding/json" | |
"flag" |