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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 / mh.zsh-theme
Created August 19, 2015 17:31
Oh My ZSH prompt with git/node/docker-machine awareness
# mh theme
# Modified by Joseph Post
# features:
# path is autoshortened to ~25 characters
# displays git status, short SHA, and clean/dirty
# displays node/npm versions
# displays docker machine name if active.
# prompt
@jcpst
jcpst / README.md
Created January 28, 2019 15:57
SCRIPT-8
@jcpst
jcpst / gist:06ed7465384c71c2aab4
Last active December 19, 2018 02:59
Live markdown preview using jquery and marked.js
// Live markdown preview w/ jquery and marked.js
// https://github.com/chjj/marked
// HTML:
//<textarea rows=5 id="input"></textarea>
//<div id="output"></div>
$(document).ready(function () {
$("#input").keyup(function () {
var text = $(this).val();
@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": [