Skip to content

Instantly share code, notes, and snippets.

View MartinMuzatko's full-sized avatar
🐈

Martin Muzatko MartinMuzatko

🐈
View GitHub Profile
@MartinMuzatko
MartinMuzatko / config.js
Last active March 12, 2023 18:17
Vuepress open graph metadata
let ogprefix = 'og: http://ogp.me/ns#'
let title = 'Wire Up Your Front-End'
let description = 'Get your personal guide to finally piece together the missing puzzles to communicate with your server'
let color = '#f42525'
let author = 'Martin Muzatko'
module.exports = {
title,
description,
serviceWorker: true,
2 Chainz and Wiz Khalifa - We Own It
4 Non Blondes - What's Up .mp4
5 Seconds Of Summer - Amnesia
5 Seconds Of Summer - Beside You
5 Seconds Of Summer - Don't Stop
5 Seconds Of Summer - Good Girls
5 Seconds Of Summer - Heartbreak Girl
5 Seconds Of Summer - Hey Everybody!
5 Seconds Of Summer - Jet Black Heart
5 Seconds Of Summer - She Looks So Perfect
@MartinMuzatko
MartinMuzatko / comma.js
Last active November 1, 2022 18:05
JS Commarization, Number to words from Million, Billion, Trillion.... and extendible
function commarize()
{
// 1e6 = 1 Million, begin with number to word after 1e6.
if (this >= 1e6)
{
var units =
[
"Million",
"Billion",
"Trillion",
import './style.css'
import { createDrawFunction, objectTypes } from 'declarative-canvas'
interface Point {
x: number
y: number
}
interface Player extends Point {
width: number
@MartinMuzatko
MartinMuzatko / beautify-sql-schema.js
Last active August 13, 2022 17:41
Create SQLITE schema and format it
const sqlFormatter = require('sql-formatter')
const promisify = require('promisify-node')
const fs = promisify('fs')
const path = require('path')
const INDENT = '\t'
const SCHEMAFILE = path.resolve(__dirname, 'schema.sql')
(async () => {
try {
const meow = require('meow')
const prop = k => o => o[k]
const pipe = (...fns) => x => [...fns].reduce((acc, f) => f(acc), x)
const siconstore = () => ({
cli: meow(`
Usage
$ siconstore [command]
Available Commands
import { BlitzApiHandler, BlitzApiRequest, BlitzApiResponse, getSession } from 'blitz'
import multer from 'multer'
import * as path from 'path'
import * as fs from 'fs/promises'
import db from 'db'
import cors from 'cors'
import { nanoid } from 'nanoid'
const runMiddleware = (req: BlitzApiRequest, res: BlitzApiResponse, fn: (req, res, fn) => any) =>
new Promise((resolve, reject) => {
{"openapi":"3.0.1","info":{"title":"SICON Gateway REST API","version":"1.0.0","description":"This API provides access to the gateway database and its adapters, devices and spawned errors."},"host":"a","servers":[{"url":"/api/v1"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}}},"security":[{"bearerAuth":[]}],"swagger":"2.0","paths":{"/app-catalog":{"get":{"security":[{"bearerAuth":[]}],"tags":["appCatalog"],"description":"Serves a list of apps from the catalog","produces":["application/json"],"responses":{"200":{"description":"OK"},"401":{"description":"Authorization failed"}}}},"/apps":{"get":{"tags":["app"],"security":[{"bearerAuth":[]}],"description":"Serves a list of installed apps plus the default one","produces":["application/json"],"responses":{"200":{"description":"OK"},"401":{"description":"Authorization failed"}}},"post":{"security":[{"bearerAuth":[]}],"description":"Triggers the installation of a new app","tags":["app"],"produces":["application
<html>
<head>
<!-- Site optimized with MySEO 1.0 -->
{$seo_index}
<!-- Site optimized with MySEO 1.0 -->
<title>{$mybb->settings['bbname']}</title>
<meta http-equiv=“Pragma” content=”no-cache”>
<meta http-equiv=“Expires” content=”-1″>
import * as fs from 'fs/promises'
interface Habit {
name: string
process: string[]
}
interface HabitsPageDependencies {
load: (amount: number) => Promise<Habit[]>
}