Skip to content

Instantly share code, notes, and snippets.

View thecodeboss's full-sized avatar
:shipit:
ȶɦɛƈօɖɛɮօֆֆ

Michael Oliver thecodeboss

:shipit:
ȶɦɛƈօɖɛɮօֆֆ
View GitHub Profile
@thecodeboss
thecodeboss / prisma-slonik-usage.ts
Created July 22, 2022 22:01
Prisma/Slonik Usage Example
import { PrismaClient } from '@prisma/client';
import type { User } from '@prisma/client';
import { createPool, sql } from 'slonik';
export const buildBaseConnectionURL = (config) => {
return (
'postgresql://' +
config.DB_USER +
':' +
config.DB_PASS +
@thecodeboss
thecodeboss / substitution_cypher.js
Last active January 14, 2018 10:29
Substitution Cypher
// Converts a character to a value between 0 and 25
function toIndex(char) {
return (char.charCodeAt(0) + 26 - 97) % 26;
}
// Converts a number from 0 to 25 back into a character
function fromIndex(idx) {
return String.fromCharCode(((idx + 26) % 26) + 97);
}