Skip to content

Instantly share code, notes, and snippets.

View creative-dev-lab's full-sized avatar

~ Coffee + Work + Fun ~ creative-dev-lab

View GitHub Profile
import Foundation
struct Post: Decodable {
let id: String
let title: String
let body: String
}
struct GraphQLResult<T: Decodable>: Decodable {
let object: T?
@creative-dev-lab
creative-dev-lab / splitImage.js
Created July 22, 2020 09:30 — forked from poissoj/splitImage.js
Split image for pdfMake
const PAGE_HEIGHT = 700;
const PAGE_WIDTH = 500;
const content = [];
function getPngDimensions (base64) {
const header = atob(base64.slice(22, 70)).slice(16, 24);
const uint8 = Uint8Array.from(header, c => c.charCodeAt(0));
const dataView = new DataView(uint8.buffer);
@creative-dev-lab
creative-dev-lab / fix-homebrew-npm.md
Created July 20, 2020 07:17 — forked from DanHerbert/fix-homebrew-npm.md
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

READ THIS Very Important Update

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.