Skip to content

Instantly share code, notes, and snippets.

View vipickering's full-sized avatar
🦧
Contemplating things

Vincent Pickering vipickering

🦧
Contemplating things
View GitHub Profile
@cleverdevil
cleverdevil / overcast-recently-played.py
Last active March 4, 2024 09:28
Fetch recently played episodes from Overcast.fm. Then, publish history to my website.
'''
You'll need to pip install some dependencies:
* python-dateutil
* requests
Also, populate your EMAIL and PASSWORD below.
'''
from xml.etree import ElementTree
@kevinmarks
kevinmarks / diffdata.js
Last active December 26, 2018 16:52
Diff data stripped - compare objects and show only the inner bits that differ
function diffdatastripped(legacy,shiny) {
let delta={},allgood=true;
for (const key in legacy){
const oldval = legacy[key];
const newval = shiny[key];
if (typeof(oldval)==='object' && typeof(newval)==='object'){
delta[key] = diffdatastripped(oldval,newval)
if (delta[key] !="✅") {
allgood=false;
}
var mediumIntegrationToken = "REPLACE_WITH_YOUR_MEDIUM_INTEGRATION_TOKEN";
// That's it. No need to edit anything else below.
// split the comma-separated tags string into an array then remove any whitespace
var tagsArray = input.medium_tags.split(',');
for (var i = 0; i < tagsArray.length; i++) {
tagsArray[i] = tagsArray[i].trim();
}
@cookie-ag
cookie-ag / app.js
Created November 17, 2017 10:47
Multiple Requests (Promisified)
var __request = require('./logic.js').__request;
var urls = ["http://www.example.com/firts", "http://www.example.com/second", "http://www.example.com/third"];
__request(urls, 'GET', false);
@JamieMason
JamieMason / get-in.js
Last active March 4, 2023 10:15
Access deeply nested value in JavaScript: get, getIn, deepGet, getDeep, pluckDeep, deepPluck, getNested, getProp, getDeepProp, getDescendant
const isWalkable = value => value !== null && typeof value !== 'undefined';
const getChild = (parent, child) => (isWalkable(parent) ? parent[child] : undefined);
const getIn = (descendants, origin) => descendants.split('.').reduce(getChild, origin);
@jaredpalmer
jaredpalmer / tweet.js
Created April 6, 2016 22:45
send-tweet.js
/*
* Code snippet for posting tweets to your own twitter account from node.js.
* You must first create an app through twitter, grab the apps key/secret,
* and generate your access token/secret (should be same page that you get the
* app key/secret).
* Uses oauth package found below:
* https://github.com/ciaranj/node-oauth
* npm install oauth
* For additional usage beyond status updates, refer to twitter api
* https://dev.twitter.com/docs/api/1.1
var mediumIntegrationToken = "REPLACE_WITH_YOUR_MEDIUM_INTEGRATION_TOKEN";
// That's it. No need to edit anything else below.
// split the comma-separated tags string into an array then remove any whitespace
@brock
brock / nodereinstall.sh
Last active June 13, 2024 12:20
Complete Node Reinstall. I've moved this to a repo at http://git.io/node-reinstall
#!/bin/bash
# node-reinstall
# credit: http://stackoverflow.com/a/11178106/2083544
## program version
VERSION="0.0.13"
## path prefix
PREFIX="${PREFIX:-/usr/local}"
@zachleat
zachleat / reading_time.rb
Last active October 21, 2020 23:00
Read this in X minutes Liquid Filter Plugin (for Jekyll)
# Outputs the reading time
# Read this in “about 4 minutes”
# Put into your _plugins dir in your Jekyll site
# Usage: Read this in about {{ page.content | reading_time }}
module ReadingTimeFilter
def reading_time( input )
words_per_minute = 180
@dougalcampbell
dougalcampbell / utfluv.js
Created March 12, 2012 19:44
Handle invalid JS character sequences
/**
* encode to handle invalid UTF
*
* If Chrome tells you "Could not decode a text frame as UTF-8" when you try sending
* data from nodejs, try using these functions to encode/decode your JSON objects.
*
* see discussion here: http://code.google.com/p/v8/issues/detail?id=761#c8
* see also, for browsers that don't have native JSON: https://github.com/douglascrockford/JSON-js
*
* Any time you need to send data between client and server (or vice versa), encode before sending,