Skip to content

Instantly share code, notes, and snippets.

@veekaybee
veekaybee / normcore-llm.md
Last active December 8, 2023 22:22
Normcore LLM Reads
View normcore-llm.md
@snuffyDev
snuffyDev / hooks.ts
Created February 4, 2022 23:18
Reddit OAuth2 (outdated) SvelteKit Hooks file
View hooks.ts
import type { Handle, GetSession } from '@sveltejs/kit';
import * as cookie from 'cookie';
import * as jsonwebtoken from 'jsonwebtoken';
import { handleTokenRefresh } from '$lib/helpers/refresh';
import { JWT_SECRET } from './env';
const getJWT = (cookie: string): jsonwebtoken.Jwt => {
if (typeof cookie !== 'string' || cookie.length === 0) return;
return jsonwebtoken.decode(cookie, { complete: true });
@pesterhazy
pesterhazy / indexeddb-problems.md
Last active November 22, 2023 08:19
The pain and anguish of using IndexedDB: problems, bugs and oddities
View indexeddb-problems.md

This gist lists challenges you run into when building offline-first applications based on IndexedDB, including open-source libraries like Firebase, pouchdb and AWS amplify (more).

Note that some of the following issues affect only Safari. Out of the major browsers, Chrome's IndexedDB implementation is the best.

Backing file on disk (WAL file) keeps growing (Safari)

When this bug occurs, every time you use the indexeddb, the WAL file grows. Garbage collection doesn't seem to be working, so after a while, you end up with gigabytes of data.

Random exceptions when working with a large number of indexeddb databases (Safari)

@NigelEarle
NigelEarle / Knex-Migrations-Seeding.md
Last active November 15, 2023 03:24
Migration and seeding instructions using Knex.js!
View Knex-Migrations-Seeding.md

Migrations & Seeding

What are migrations??

Migrations are a way to make database changes or updates, like creating or dropping tables, as well as updating a table with new columns with constraints via generated scripts. We can build these scripts via the command line using knex command line tool.

To learn more about migrations, check out this article on the different types of database migrations!

Creating/Dropping Tables

View promise_series.js
let itemIDs = [1, 2, 3, 4, 5];
itemIDs.reduce((promise, itemID) => {
return promise.then(_ => api.deleteItem(itemID));
}, Promise.resolve());
@kitten
kitten / reactiveconf-sc-cfp.md
Last active November 17, 2020 15:06
ReactiveConf 2017 Lightning Talk CFP: With styled-components into the future
View reactiveconf-sc-cfp.md

styled-components Logo

With styled-components into the future

Preprocessing is dead, long live preprocessing!


This is a CFP for ReactiveConf 2017's open call for Lightning talks. If you'd like to see this talk become a reality, please ⭐ star this gist. #ReactiveConf

@stewartknapman
stewartknapman / shopify-money.js
Created February 27, 2017 23:25
The Shopify.formatMoney method extracted from option_selection.js for stand-alone purposes.
View shopify-money.js
var Shopify = Shopify || {};
// ---------------------------------------------------------------------------
// Money format handler
// ---------------------------------------------------------------------------
Shopify.money_format = "${{amount}}";
Shopify.formatMoney = function(cents, format) {
if (typeof cents == 'string') { cents = cents.replace('.',''); }
var value = '';
var placeholderRegex = /\{\{\s*(\w+)\s*\}\}/;
var formatString = (format || this.money_format);
@thegitfather
thegitfather / vanilla-js-cheatsheet.md
Last active November 21, 2023 07:37
Vanilla JavaScript Quick Reference / Cheatsheet
View vanilla-js-cheatsheet.md
@carlessanagustin
carlessanagustin / Nginx_Cheat_Sheet.md
Last active November 6, 2023 05:20
Nginx Cheat Sheet
View Nginx_Cheat_Sheet.md
@LeCoupa
LeCoupa / bash-cheatsheet.sh
Last active December 4, 2023 06:10
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
View bash-cheatsheet.sh
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04