Skip to content

Instantly share code, notes, and snippets.

@typpo
typpo / BCP47-locales.md
Last active March 13, 2024 09:46
BCP 47 language tags
Language Tag Language Region Description
ar-SA Arabic Saudi Arabia Arabic (Saudi Arabia)
bn-BD Bangla Bangladesh Bangla (Bangladesh)
bn-IN Bangla India Bangla (India)
cs-CZ Czech Czech Republic Czech (Czech Republic)
da-DK Danish Denmark Danish (Denmark)
de-AT German Austria Austrian German
de-CH German Switzerland "Swiss" German
de-DE German Germany
@typpo
typpo / README.md
Last active November 7, 2020 06:31
QuickChart.io benchmark

QuickChart benchmark

The code below renders 100 bar graphs with 2 data series as 400x200 images. Average time per chart: 124 ms.

$ node sample.js
Running #0/100...
Running #99/100...
Total duration for 100 charts: 12361.083189964294 ms
Average time for each chart: 123.55390819549561 ms
@typpo
typpo / gist:a2cfdc95a927b975505e8f3330f0efba
Last active July 9, 2020 23:36
QuickChart/Chart.js doughnut graph
Image Example:
https://quickchart.io/chart?bkg=white&c=%7B%20type%3A%20%27doughnut%27%2C%20data%3A%20%7B%20labels%3A%20%5B%27High%27%2C%20%27Medium%27%2C%20%27Low%27%5D%2C%20datasets%3A%20%5B%7B%20data%3A%20%5B11%2C%20110%2C%2060%5D%2C%20backgroundColor%3A%20%5B%27%234e73df%27%2C%20%27%230f3dc4%27%2C%20%27%239fb4f3%27%5D%20%7D%5D%20%7D%2C%20options%3A%20%7B%20legend%3A%20%7B%20position%3A%20%27right%27%2C%20align%3A%20%27start%27%20%7D%2C%20plugins%3A%20%7B%20datalabels%3A%20%7B%20color%3A%20%27%23fff%27%20%7D%2C%20doughnutlabel%3A%20%7B%20labels%3A%20%5B%7B%20text%3A%20%27Donut%27%2C%20font%3A%20%7B%20size%3A%2020%20%7D%20%7D%5D%20%7D%20%7D%20%7D%20%7D
Interactive Example:
https://quickchart.io/sandbox/#{%0A%20%20%20%20type:%20'doughnut',%0A%20%20%20%20data:%20{%0A%20%20%20%20%20%20%20%20labels:%20['High',%20'Medium',%20'Low'],%0A%20%20%20%20%20%20%20%20datasets:%20[{%0A%20%20%20%20%20%20%20%20%20%20%20%20data:%20[11,%20110,%2060],%0A%20%20%20%20%20%20%20%20%20%20%20%20backgroundColor:%20['%234e73df',%20'%
@typpo
typpo / example.js
Created March 17, 2020 23:04
Build a chart.js config for QuickChart using javascript-stringify
const { stringify } = require('javascript-stringify');
const chartObj = {
type: 'bar',
data: {
labels: ['January', 'February', 'March', 'April', 'May'],
datasets: [{
label: 'Dogs',
data: [ 50, 60, 70, 180, 190 ]
}]
@typpo
typpo / example.js
Last active March 17, 2020 23:06
Build a chart.js config as string with function substitution
const chartObj = {
type: 'bar',
data: {
labels: ['January', 'February', 'March', 'April', 'May'],
datasets: [{
label: 'Dogs',
data: [ 50, 60, 70, 180, 190 ]
}]
},
options: {
@typpo
typpo / example.js
Created March 17, 2020 23:00
Build a chart.js config as a string
const chartStr = `{
type: 'bar',
data: {
labels: ['January', 'February', 'March', 'April', 'May'],
datasets: [{
label: 'Dogs',
data: [ 50, 60, 70, 180, 190 ]
}]
},
options: {
@typpo
typpo / chart.json
Last active February 18, 2020 16:52
Chart.js example
{
"type": "line",
"data": {
"labels": [ "", "", "", "", "", "", "", "" ],
"datasets": [
{
"label": "comments",
"borderColor": "blue",
"yAxisID": "A",
"data": [ 0, 1, 1, 1, 2, 3, 4, 4 ],
package main
import (
"net/http"
"net/url"
)
func main() {
values := url.Values{
"phone": {"5555555"},
@typpo
typpo / textbelt-example.js
Created September 10, 2019 15:16
Textbelt node example
var request = require('request');
request.post('https://textbelt.com/text', {
form: {
phone: '5555555555',
message: 'Hello world',
key: 'textbelt',
},
}, function(err, httpResponse, body) {
if (err) {
@typpo
typpo / gist:79bf3e82d81f886d01f14c872b755057
Created July 4, 2019 17:32
QuickChart/Chart.js transparent radar chart
{
type: 'radar',
data: {
labels: ['Jan', 'Feb', 'March', 'April', 'May'],
datasets: [{
data: [ 50, 60, 70, 80, 90 ],
backgroundColor: 'transparent',
borderColor: 'red',
}]
},