Skip to content

Instantly share code, notes, and snippets.


Martin Knospe mknospe

  • Berlin, Germany
View GitHub Profile
mknospe / generateGoogleCustomFontLinks.js
Created May 28, 2019
Synchronous NodeJS script to parse CSS files and read out used font-family, font-weight and font-styles to generate a <link> tag for Google custom fonts.
View generateGoogleCustomFontLinks.js
mknospe / elementReadyObserver.js
Created May 3, 2019
ES5 Element ready observer using a MutationObserver to detect, if an HTML element generated on runtime is ready to be accessed.
View elementReadyObserver.js
function isElement(addedNode, selector, callback) {
if (typeof addedNode.querySelector === 'function' && addedNode.querySelector(selector)) {
var elementReadyObserver = new MutationObserver(function (mutations) {
for (var i=0, numMutations=mutations.length; i<numMutations; i++) {
for (var j=0, numNodes=mutations[i].addedNodes.length; j<numNodes; j++) {
isElement(mutations[i].addedNodes[j], '#YOUR-CSS-SELECTOR > .OF-THE-ELEMENT.TO-OBSERVE', function() {
mknospe / carrierLookup.js
Last active Apr 25, 2019
NodeJS script to lookup carrier information in parallel using the paid service twilio. ( The data is read from a CSV-file, parsed, processed and written to the output csv-file.
View carrierLookup.js
// Install dependencies
// npm i -s node-fetch csv-writer csvtojson
const fetch = require('node-fetch');
const csvToJson = require('csvtojson');
const createCsvWriter = require('csv-writer').createObjectCsvWriter;
function lookup(phonenumber) {
const sid = '__YOUR_TWILIO_SID__';
const token = '__YOUR_TWILIO_AUTH_TOKEN__';