Skip to content

Instantly share code, notes, and snippets.

View sempostma's full-sized avatar

Sem Postma sempostma

View GitHub Profile
const fs = require('fs')
const path = require('path')
const os = require('os')
const minimatch = require('minimatch')
const options = { matchBase: true }
const commit = process.argv[2] === 'commit'
const trim = x => x.trim()
#include <iostream>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <queue>
#include <functional>
#include <chrono>
class ThreadPool
@sempostma
sempostma / flattenObject-es2015.js
Last active March 13, 2020 14:46
(Un)FlattenObject
"use strict";
var isArray = function(arg) {
return Object.prototype.toString.call(arg) === '[object Array]';
};
var isObject = function(arg) {
return Object.prototype.toString.call(arg) === '[object Object]'
}
@sempostma
sempostma / jwt.js
Last active May 30, 2020 09:23
Validate firebase requests using jwt.
/*
You can obtain a token, client-side like this:
const { currentUser } = firebase.auth()
if (!currentUser) throw new Error('User has to be logged in.')
const idToken = await currentUser.getIdToken()
*/
const http = require('http')
#target illustrator
var doc = app.activeDocument;
for (var i = 0; i < doc.dataSets.length; i++) {
var d = doc.dataSets[i];
d.display();
d.update();
}
@sempostma
sempostma / package.json
Created January 4, 2020 11:05 — forked from mmattozzi/package.json
HTTP echo server using node.js and express
{
"name": "mock-http-server",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
@sempostma
sempostma / Final Export.jsx
Last active December 8, 2023 01:44
Export Illustrator document to a buch of different file formats and resolutions. File formats include: .ai, .pdf, .png, .jpg and .svg. Installation: Copy this file to your illustrator scripts folder (For windows: C:\Program Files\Adobe\Adobe Illustrator CC 2019\Presets\<your locale>\Scripts) (For Mac: Applications/Adobe Illustrator CC/Presets/<y…
/**
* Author: Sem Postma (sem@esstudio.site)
* Name: Final Export
* License: MIT
*
* Installation: Copy this file to your illustrator scripts folder:
* For windows: C:\Program Files\Adobe\Adobe Illustrator CC 2019\Presets\<your locale>\Scripts
* For Mac: Applications/Adobe Illustrator CC/Presets/<your locale>/Scripts
*
* Usage: File->Scripts->Final Export
@sempostma
sempostma / Final Export.jsx
Created November 12, 2019 14:37
Export illustrator document to a buch of different file formats and resolutions. File formats include: .ai, .pdf, .png, .jpg and .svg.
/**
* Author: Sem Postma (sem@esstudio.site)
* Name: Final Export
*
* Installation: Copy this file to your illustrator scripts folder:
* For windows: C:\Program Files\Adobe\Adobe Illustrator CC 2019\Presets\<your locale>\Scripts
* For Mac: Applications/Adobe Illustrator CC/Presets/<your locale>/Scripts
*
* Usage: File->Scripts->Final Export
* Questions? Send me an email.
var inputText = '._3u328';
var sendBtn = '._3M-N-';
setInterval(function(){
document.querySelector(inputText).innerText = 'test';
var event = new Event('input', {
'bubbles': true,
'cancelable': true
});
@sempostma
sempostma / get-urls-from-chrome-debugger.js
Created July 22, 2019 10:41
Get urls from chrome debugger
var URLs = UI.panels.network._networkLogView._dataGrid._rootNode._flatNodes.map(n => n._request._url).filter((v, i, a) => a.indexOf(v) === i)
copy(URLs.join('\n'));