Skip to content

Instantly share code, notes, and snippets.

View chomamateusz's full-sized avatar

Mateusz Choma chomamateusz

View GitHub Profile
@chomamateusz
chomamateusz / makeScreenshotsOfAllPages.js
Created March 15, 2023 12:38
Canva page screenshots
// works only in Firefox and its based on https://firefox-source-docs.mozilla.org/devtools-user/taking_screenshots/index.html
// you need to find the wrapper over pages in Canva (they all should have same class) and pass them as an arg to this function
// if Canva structure will change you can play with selector in first `.map`
const makeScreenshotsOfAllPages = ({ pageWrapperClass }) => (
$$(`.${pageWrapperClass}`)
.map((e, i) => `.${pageWrapperClass}:nth-of-type(${i+1}) > div:nth-of-type(2)`)
.map((selector, i) => `:screenshot --selector "${selector}" --file --filename "${document.title.replaceAll('/', '')}${i + 1}.png"`)
.map((command) => {
@chomamateusz
chomamateusz / copy-contents-to-chapter.js
Created July 26, 2021 14:24
copy-contents-to-chapter
(async ({ sourceCourseId, targetChapterId }) => {
const getContents = async (id) => {
const response = await fetch("https://coderoad.thinkific.com/api/v2/courses/" + id, {
"body": null,
"method": "GET",
"mode": "cors",
"credentials": "include"
})
const data = await response.json()
return data.contents
### STAGE 1: Build ###
FROM node:12.10.0-alpine as builder
WORKDIR /app
COPY package.json package-lock.json ./
COPY public/ public/
COPY src/ src/
RUN npm install
// this function maps an object into array of objects
// and puts object keys into key property of array items
const mapObjectToArray = (obj) => (
Object.entries(obj || {})
.map(([key, value]) => (
typeof value === 'object' ?
{...value, key}
:
{key, value}
))
@chomamateusz
chomamateusz / asana-see-only-assigned-to-me.js
Last active January 7, 2019 07:10
Asana - see only tasks assigned to me in project board
// copy-paste to browser console ;)
// you MUST have an avatar if you want to use this script!
(() => {
const topRightUserAvatarSelector = '.Avatar.Avatar--small.TopbarPageHeaderGlobalActions-settingsMenuAvatar'
const sortableCardSelector = '.BoardCardWithCustomProperties'
const sortableCardAvatarSelector = '.Avatar.Avatar--small.DomainUserAvatar-avatar'
const baseImgURL =
document.querySelector(topRightUserAvatarSelector)