Skip to content

Instantly share code, notes, and snippets.

View manan-gup's full-sized avatar

Manan Gupta manan-gup

  • New Delhi
View GitHub Profile
@manan-gup
manan-gup / elementToPDF.js
Created February 21, 2022 20:34
Script to save a DOM element as a PDF to disk while retaining the styles
import path from "path";
import puppeteer from "puppeteer";
async function main() {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto(
"https://www.reddit.com/r/underlords/comments/mlb93c/6_4_2021_meta_builds_tier_list_by_dani/",
{ waitUntil: "networkidle0" }
);
@manan-gup
manan-gup / index.js
Created February 21, 2022 05:16
Script to download an Egghead.io course
import puppeteer from "puppeteer";
import fs from "fs";
import { execSync } from "child_process";
const folder = process.argv[2]; // This array contains command line args passed to node
// First entry is node path, second is script path, thrid onwards are the args passed.
const URL = `https://egghead.io/courses/${folder}`;
async function main() {
const browser = await puppeteer.launch({
@manan-gup
manan-gup / spotify.html
Created February 23, 2021 18:06 — forked from j-un/spotify.html
[Hugo] Shortcode for Spotify embed code
<!--
Parameters:
type - (Required) album / track / playlist / artist
id - (Required) Target ID
width - (Optional) width
height - (Optional) height
-->
{{ if .IsNamedParams }}
<iframe src="https://open.spotify.com/embed/{{ .Get "type" }}/{{ .Get "id" }}"