Skip to content

Instantly share code, notes, and snippets.

View jcpst's full-sized avatar
💯

Joseph Post jcpst

💯
View GitHub Profile
@jcpst
jcpst / pedalboard-phase-1.mmd
Last active February 26, 2024 17:21
Pedalboard
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jcpst
jcpst / full-stack-std.py
Last active November 23, 2021 04:44
python with gui and db, using standard library.
import sqlite3
from tkinter import *
conn = sqlite3.connect(':memory:')
cursor = conn.cursor()
cursor.execute('create table names (name text)')
def add_name(name):
cursor.execute('insert into names values (?)', (name,))
@jcpst
jcpst / request.js
Last active June 29, 2020 04:05
Wrapper for node's built in http
'use strict'
const http = require('https')
function request(options, body) {
return new Promise((resolve, reject) => {
const req = http.request(options, (res) => {
let data = ''
res.setEncoding('utf8')
res.on('data', (chunk) => (data += chunk))
@jcpst
jcpst / README.md
Created January 28, 2019 15:57
SCRIPT-8
@jcpst
jcpst / create-koa-ajv.js
Created October 16, 2018 12:33
Takes an array of json schemas and returns an object with middleware to validate requests
const Ajv = require('ajv');
function errFormat(obj) {
return ({ dataPath, message }) =>
`Type Error: '${obj.schema.title}${dataPath}' ${message}.\n`;
}
function validator(ajvOptions = {}) {
return (acc, schema) =>
Object.assign(acc, {
@jcpst
jcpst / manifest.json
Last active August 9, 2018 02:17
Chrome extension to get markdown from dokuwiki
{
"manifest_version": 2,
"name": "Doku-To-Markdown",
"description": "Convert Doku Page to markdown",
"version": "1.0",
"browser_action": {
"default_popup": "popup.html"
},
"permissions": [
@jcpst
jcpst / countries.html
Last active January 5, 2018 07:35
SFA (Single File App) - retrieve countries
<html><head><!--
This is a single file app, built with hyperapp.
It uses REST Countries for a data source.
Web apps do not have to be huge, complex, and have build configurations.
--><style>
/* ==========================================================================
/* Styles.
/* ========================================================================*/
@jcpst
jcpst / sfa.html
Created January 4, 2018 04:55
This is a single file app, and you can share it with your friends like the good old days
<body>
<script>
/* hyperapp 1.0.1 */
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd||n(e.hyperapp={})}(this,function(e){"use strict";e.h=function(e,n){for(var r,o=[],t=[],i=arguments.length;i-- >2;)t.push(arguments[i]);for(;t.length;)if(Array.isArray(r=t.pop()))for(i=r.length;i--;)t.push(r[i]);else null==r||!0===r||!1===r||o.push(r);return"string"==typeof e?{name:e,props:n||{},children:o}:e(n||{},o)},e.app=function(e,n,r,o){function t(e,n){return e&&{name:e.nodeName.toLowerCase(),props:{},children:n.call(e.childNodes,function(e){return 3===e.nodeType?e.nodeValue:t(e,n)})}}function i(t){for(y=!y,t=r(e,n),o&&!y&&(N=v(o,N,w,w=t));t=g.pop();)t()}function l(){y||(y=!y,setTimeout(i))}function u(e,n){var r={};for(var o in e)r[o]=e[o];for(var o in n)r[o]=n[o];return r}function f(e,n,r,o){return e.length?(o[e[0]]=1<e.length?f(e.slice(1),n,r[e[0]],{}):n,u(r,o)):n}function c(e,n){for(var r=0;r<e.length;r++)n=n[e[r]];return n}function p(n,r,o){for(var