Skip to content

Instantly share code, notes, and snippets.

View jerriclynsjohn's full-sized avatar

Jerric Lyns John jerriclynsjohn

View GitHub Profile
@jerriclynsjohn
jerriclynsjohn / timescaledb-quickstart-node-prisma.md
Created July 4, 2024 08:19
Quick Start: Node, Prisma and TimescaleDB

Quick Start: Node, Prisma and TimescaleDB

Goal

This quick start guide is designed to get the Node.js developer up and running with TimescaleDB as their database.

Pre-requisites

To complete this tutorial, you will need a cursory knowledge of the Structured Query Language (SQL). The tutorial will walk you through each SQL command, but it will be

@jerriclynsjohn
jerriclynsjohn / settings.json
Created September 8, 2023 14:47
.vscode settings
{
// Custom Typings for Next 13
"typescript.tsdk": "node_modules/typescript/lib",
// For Prettier
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"prettier.requireConfig": true,
"[prisma]": {
"editor.defaultFormatter": "Prisma.prisma"
@jerriclynsjohn
jerriclynsjohn / cuid.js
Created August 14, 2023 12:20 — forked from ericelliott/cuid.js
CUID - A Better Browser-side UID (Intentionally not GUID compliant)
/**
* cuid.js
* Collision-resistant UID generator for browsers and node.
* Sequential for fast db lookups and recency sorting.
* Safe for element IDs and server-side lookups.
*
* Extracted from CLCTR
*
* Copyright (c) Eric Elliott 2012
* MIT License
# example netlify.toml
[build]
command = "npm run build"
functions = "functions"
publish = "public"
## Uncomment to use this redirect for Single Page Applications like create-react-app.
## Not needed for static site generators.
[[redirects]]
from = "/*"
@jerriclynsjohn
jerriclynsjohn / toCase.js
Created October 14, 2019 01:01 — forked from trenskow/toCase.js
An convenience method for converting to and from different casing types.
if (!String.prototype.toCase) {
Object.defineProperties(String.prototype, {
'toCase': {
value: function(type = 'camel') {
const seperators = {
'camel': '',
'pascal': '',
'snake': '_',
'domain': '.',
@jerriclynsjohn
jerriclynsjohn / 1.rollup.config.js
Last active February 25, 2022 15:42
Svelte + Tailwind + Storybook - Starter Template
import svelte from 'rollup-plugin-svelte';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import livereload from 'rollup-plugin-livereload';
import { terser } from 'rollup-plugin-terser';
import postcss from 'rollup-plugin-postcss';
import autoPreprocess from 'svelte-preprocess';
const production = !process.env.ROLLUP_WATCH;
@jerriclynsjohn
jerriclynsjohn / .storybook-postcss.config.js
Created September 2, 2019 06:51
Svelte + Tailwind + Storybook - Starter Template
var tailwindcss = require('tailwindcss');
module.exports = {
plugins: [
require('postcss-import')(),
tailwindcss('./tailwind.config.js'),
require('autoprefixer'),
],
};
@jerriclynsjohn
jerriclynsjohn / tailwind.md
Created September 2, 2019 05:45 — forked from sandren/tailwind.md
Tailwind CSS best practices

Tailwind CSS best practices

Utility classes

  1. When writing a string of multiple utility classes, always do so in an order with meaning. The "Concentric CSS" approach works well with utility classes (i.e,. 1. positioning/visibility 2. box model 3. borders 4. backgrounds 5. typography 6. other visual adjustments). Once you establish a familiar pattern of ordering, parsing through long strings of utility classes will become much, much faster so a little more effort up front goes a long way!

  2. Always use fewer utility classes when possible. For example, use mx-2 instead of ml-2 mr-2 and don't be afraid to use the simpler p-4 lg:pt-8 instead of the longer, more complicated pt-4 lg:pt-8 pr-4 pb-4 pl-4.

  3. Prefix all utility classes that will only apply at a certain breakpoint with that breakpoint's prefix. For example, use block lg:flex lg:flex-col lg:justify-center instead of block lg:flex flex-col justify-center to make it very clear that the flexbox utilities are only applicable at the

@jerriclynsjohn
jerriclynsjohn / strong-password-regex.md
Created July 18, 2019 07:28
Strong password Regular Expression
  • Passwords will contain at least 1 upper case letter
  • Passwords will contain at least 1 lower case letter
  • Passwords will contain at least 1 number or special character
  • There is no length validation (min, max) in this regex!

Regular expression for JavaScript:

/((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/