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 / macrolight list.json
Created October 18, 2023 18:13
kinopio code languages list
[
{"id": 1,"name": "txt"},
{"id": 2,"name": "c", "color": "#555555", "keywords": ["auto", "break", "case", "char", "const", "continue", "default", "do", "double", "else", "enum", "extern", "float", "for", "goto", "if", "int", "long", "register", "return", "short", "signed", "sizeof", "static", "struct", "switch", "typedef", "union", "unsigned", "void", "volatile", "while"]},
{"id": 3,"name": "c++", "color": "#f34b7d", "keywords": ["alignas", "alignof", "and", "and_eq", "asm", "auto", "bitand", "bitor", "bool", "break", "case", "catch", "char", "char8_t", "char16_t", "char32_t", "class", "compl", "concept", "const", "consteval", "constexpr", "const_cast", "continue", "co_await", "co_return", "co_yield", "decltype", "default", "delete", "do", "double", "dynamic_cast", "else", "enum", "explicit", "export", "extern", "false", "float", "for", "friend", "goto", "if", "inline", "int", "long", "mutable", "namespace", "new", "noexcept", "not", "not_eq", "nullptr", "operator", "or", "or_eq", "private", "protected
@pketh
pketh / gist:f6b37564b8f42fca7c61eb43c39287de
Last active October 25, 2024 10:05
disable ios text field autozoom
// https://stackoverflow.com/a/57527009
const disableIOSTextFieldZoom = () => {
if (!isIOS()) { return }
const element = document.querySelector('meta[name=viewport]')
if (element !== null) {
let content = element.getAttribute('content')
let scalePattern = /maximum\-scale=[0-9\.]+/g
if (scalePattern.test(content)) {
content = content.replace(scalePattern, 'maximum-scale=1.0')
} else {
@pketh
pketh / convert json canvas to kinopio space.js
Created March 13, 2024 21:20
convert json canvas to kinopio space.js
// https://jsoncanvas.org
const convertFromCanvas = (space) => {
const yThreshold = 150
let newSpace = {}
try {
newSpace.name = `Canvas ${utils.journalSpaceName({})}`
newSpace.id = nanoid()
newSpace.background = consts.defaultSpaceBackground
@pketh
pketh / spacePreviewImage.js
Created February 19, 2025 13:23
Generates a bitmapped preview image of a space document
import controllers from './controllers.js'
import utils from '../utils.js'
import consts from '../consts.js'
import { createCanvas, loadImage, createImageData, CanvasRenderingContext2D, DOMMatrix, ImageData } from 'canvas'
import { polyfillPath2D } from 'path2d-polyfill'
import webp from '@cwasm/webp'
import moment from 'moment'
import _ from 'lodash'
import heicConvert from 'heic-convert'