Skip to content

Instantly share code, notes, and snippets.

View pketh's full-sized avatar
🐢
https://kinopio.club

Pirijan pketh

🐢
https://kinopio.club
View GitHub Profile
@pketh
pketh / sendEmailBatchWithTemplates.js
Created October 25, 2022 15:49
wrapped in try catch to log errors
try {
await postmark.sendEmailBatchWithTemplates(templates)
} catch (error) {
console.error('🚒 email.bulletin', error)
}
async bulletin ({subject, users, exploreSpaces}) {
const batches = utils.groupIntoBatches(users)
console.log('📧 bulletin', { subject, users: users.length, batches: batches.length })
for (const users of batches) {
const templates = users.map(user => {
return {
From: "[email protected]",
To: user.email,
TemplateAlias: "bulletin",
MessageStream: "bulletins",
groupIntoBatches (array) {
const batchSize = 100
const totalBatches = Math.ceil(array.length / batchSize)
let batches = []
_.times(totalBatches, (index) => {
const start = index * batchSize
let end = (index + 1) * batchSize
const batch = array.slice(start, end)
batches.push(batch)
})
// group cards into overlap groups
self.onmessage = function (event) {
const offset = 10
const { cards, viewport, zoom } = event.data
let newCards = cards.filter(card => isCardInViewport(card, viewport, zoom))
newCards = newCards.map(card => {
return {
id: card.id,
name: card.name,
ᵔᴥᵔ
@pketh
pketh / kinopio-markdown-userscript.js
Last active January 3, 2021 04:08 — forked from danreeves/kinopio-markdown-userscript.js
kinopio.club markdown userscript
// ==UserScript==
// @name Kinopio Markdown
// @namespace https://kinopio.club/kinopio-markdown-userscript-Q9qnmvXEPaagLx5Ufytlx
// @version 0.1
// @description convert text in cards to markdown
// @author Pirijan (forked from dnrvs)
// @match https://kinopio.club/kinopio-markdown-userscript-Q9qnmvXEPaagLx5Ufytlx
// @grant none
// ==/UserScript==
ʕ●ᴥ●ʔノ*:・
@pketh
pketh / asciiputsonglasses
Created September 10, 2020 14:30 — forked from staringispolite/asciiputsonglasses
Ascii art sunglasses meme
Puts on glasses:
(•_•)
( •_•)>⌐■-■
(⌐■_■)
Takes off glasses ("mother of god..."):
(⌐■_■)
( •_•)>⌐■-■
︵‿︵‿︵‿︵‿︵‿︵‿︵‿︵‿︵‿︵‿︵‿
︵‿︵‿ poolside fm ︵‿︵‿︵‿︵‿︵‿
︵‿︵‿︵‿︵‿︵‿︵‿ for iphone ‿︵‿
︵‿︵‿︵‿︵‿︵‿︵‿︵‿︵‿︵‿︵‿︵‿
in the app store ⓝⓞⓦ 🏝Mobile phone http://cellular.poolside.fm
@pketh
pketh / kinopio-search.js
Last active August 27, 2020 20:52
search snippet for kinopio cards
// edit search and paste me into your browser console
search = 'my cool search';
// this will only work for the spaces you have cached
// i.e. you've opened the space on this device recently
spaces = Object.keys(localStorage);
spaces = spaces.filter(space => space.startsWith('space-'));
spaces = spaces.map(space => JSON.parse(localStorage[space]));
matchingSpaces = spaces.filter(space => {
if (!space.name) { return };