- Create a gist if you haven't already.
- Clone your gist:
# make sure to replace `<hash>` with your gist's hash git clone https://gist.github.com/<hash>.git # with https git clone git@gist.github.com:<hash>.git # or with ssh
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 fetch = require('node-fetch') | |
const gistIds = [ | |
'221', | |
'218', | |
'214', | |
'213', | |
'209', | |
'207', | |
'203', |
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
// node | |
fetch('https://api.github.com/rate_limit', {headers: {Authorization: 'Basic ' + Buffer.from(`csszen:${process.env.GIST_TOKEN}`).toString('base64')}}).then(r => r.json).then(console.log) | |
// browser | |
fetch('https://api.github.com/rate_limit', {headers: {Authorization: 'Basic ' + btoa(`csszen:${token}`)}}).then(r => r.json()).then(console.log) |
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 toDataURL (src, callback, outputFormat) { | |
const img = new Image() | |
img.crossOrigin = 'Anonymous' | |
img.onload = function () { | |
const canvas = document.createElement('canvas') | |
const ctx = canvas.getContext('2d') | |
canvas.height = this.naturalHeight | |
canvas.width = this.naturalWidth | |
ctx.drawImage(this, 0, 0) | |
const dataURL = canvas.toDataURL(outputFormat) |
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
|