Skip to content

Instantly share code, notes, and snippets.

View colbyfayock's full-sized avatar
🚀

Colby Fayock colbyfayock

🚀
View GitHub Profile
@colbyfayock
colbyfayock / Filter Data
Created August 11, 2021 02:04
GitHub Copilot Suggestion Examples
/* Input */
const recipes = [
{
name: 'Fried Chicken',
categories: ['chicken', 'meat']
},
{
name: 'Spinach Pasta',
categories: ['pasta', 'vegan']
@colbyfayock
colbyfayock / gist:f0778baf2684d49fdaace5ee37e70138
Created September 25, 2022 20:52
Upload Blob to Cloudinary in Node
const response = await fetch("https://pbs.twimg.com/profile_images/1457798886710738944/HWg9ES8r_400x400.jpg")
const contentType = response.headers.get("Content-Type");
const blob = await response.blob();
const arrayBuffer = await blob.arrayBuffer();
const buffer = Buffer.from(arrayBuffer);
const dataUri = `data:${contentType};base64,${buffer.toString('base64')}`;
const upload = await cloudinary.uploader.upload(dataUri);
@colbyfayock
colbyfayock / 01-unsplash.js
Last active August 29, 2024 20:19
Collect images from Unsplash, then upload them to Cloudinary
// Run this 1st:
// - Create a file locally such as unsplash.js
// - Paste the contents of this file
// - Update your Unsplash access key from https://unsplash.com/developers
// - Run `node unsplash.js`
import { createApi } from 'unsplash-js';
import { promises as fs } from 'fs';
const unsplash = createApi({ accessKey: '<Your Unsplash Access Key>' });