Skip to content

Instantly share code, notes, and snippets.

View skinofstars's full-sized avatar

Kevin Carmody skinofstars

View GitHub Profile
@skinofstars
skinofstars / headersMiddleware.js
Last active May 2, 2017 13:37
Feathers schema switching in sequelize
// setup a middleware that provides access to the express headers
module.exports = (req, res, next) => {
req.feathers.headers = req.headers;
next();
};
@skinofstars
skinofstars / migrate.js
Created May 2, 2017 14:00
Simple sequelize migration retry script
#!/usr/bin/env node
'use strict';
const program = require('commander');
const exec = require('child_process').exec;
program
@skinofstars
skinofstars / model-includes.hook.js
Last active August 10, 2017 02:57
Feathers hook for including seqeulize models
'use strict';
// Feathers hook to do `/thing?includes=other`
// before : {
// find: [modelIncludes()],
// get: [modelIncludes()]
// },
// after : {
// find: [modelIncludes()],
@skinofstars
skinofstars / services.js
Created June 13, 2019 10:03
FeathersJS - Demo of services picking up each others hooks
module.exports = function(app) {
class BeepBoop {
async update(id, data, params) {
console.log("BeepBoop", id, params);
// passing params here will also pass the route.id
await app.service("zap").update("456", {}, params);
return Promise.resolve();
}
@skinofstars
skinofstars / wp_believe.md
Last active August 11, 2020 10:12
wp_believe

I believe the president Made America Great Again. I believe we need him reelected to Make America Great Again Again.

I believe Joe Biden is “Sleepy” and “weak.” I believe Biden could “hurt God” and the Bible.

I believe that if Biden is elected, there will be “no religion, no anything,” and he would confiscate all guns, “immediately and without notice.” He would “abolish” “our great,” “beautiful suburbs,” not to mention “the American way of life.” There would be “no windows, no nothing” in buildings.

I believe the news media would have “no ratings” and “will go down along with our great USA!” if the president loses — and that this would be bad even though the media is fake.

I believe it’s normal for the president to say “Yo Semites” and “Yo Seminites,” “Thigh Land,” “Minne-a-napolis,” “toe-tally-taria-tism,” “Thomas Jeffers” and “Ulyss-eus S. Grant.” I believe it’s Biden who’s cognitively impaired.

@skinofstars
skinofstars / .gitignore
Created August 19, 2020 08:37
XCode Swift gitignore
# Node builds
.cache/
coverage/
node_modules/
*.log
# Exclude build output
macos.safari-extension/yeehah_extension/script.js
@skinofstars
skinofstars / crypt.js
Last active October 6, 2020 22:06
Public-key Cryptography in NodeJS
// FROM https://vanjs-decentralized.hashbase.io/#12
const crypto = require('crypto');
const read = require('fs').readFileSync;
// The original message
const message = Buffer.from('Hi Alice! This is a secret :)');
// ENCRYPT message with Alice PUBLIC key
const alicePublicKey = read('./keys/alice/public_key.pem');
@skinofstars
skinofstars / getUSPSKeylineCheckDigit.spec.ts
Created June 14, 2021 18:40
USPS Traditional ACS keyline MOD 10 check digit
const keylinesChecks: [string, number][] = [
['JLSTMS6796', 9],
['TMS1112/62', 3],
['218XN91LMS', 4],
['OTUBIKALAM', 8],
['ABC999NN//3', 2],
['ANIT 028', 1],
['0012 ////', 8],
['811N IS00 0111', 9],
['OTUB IKAL AM', 8],