Skip to content

Instantly share code, notes, and snippets.

View davidlevy's full-sized avatar

David Levy davidlevy

View GitHub Profile
@sketchthat
sketchthat / shortenUrl (jQuery)
Last active November 28, 2017 19:24
Use bitly to generate a short URL with jQuery.
// Generate Access Token
// https://bitly.com/a/oauth_apps
var shortenUrl = function(accessToken, longUrl) {
$.getJSON('https://api-ssl.bitly.com/v3/shorten', {
access_token: accessToken,
longUrl: longUrl
})
.success(function(resp) {
console.log('URL: ', resp.data.url);
@matthewsuan
matthewsuan / axios.js
Last active December 20, 2024 16:45
Axios request queue-like that limits number of requests at any given time
import axios from 'axios'
const MAX_REQUESTS_COUNT = 5
const INTERVAL_MS = 10
let PENDING_REQUESTS = 0
// create new axios instance
const api = axios.create({})
/**
@wshayes
wshayes / intercom_help_export.py
Created October 29, 2020 20:10
Export (via webscraping) Intercom Article Help documents
#!/usr/bin/env python
# -*- coding: utf-8-*-
"""
Webscrape Intercom Help Articles and export them into markdown and html as a JSON data file
This captures Collection info but not Sections. Images are downloaded into an images folder.
The images are renamed with the collection directory name (see the dir_map dict below) in numerical order.
You will need to dedupe duplicate images using another tool. Renaming the images avoids bad initial names
and duplicate image filenames (quick hack and not ideal - feel free to improve as desired.)
@OrionReed
OrionReed / dom3d.js
Last active June 27, 2025 05:23
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯