Skip to content

Instantly share code, notes, and snippets.

View riccjohn's full-sized avatar
☠️

John Riccardi riccjohn

☠️
View GitHub Profile
@riccjohn
riccjohn / typescriptreact.json
Last active June 4, 2025 22:10
VSCode Snippets
{
"Create Storybook Story": {
"prefix": ["sbstory", "storybookstory"],
"body": [
"import type { Meta, StoryObj } from '@storybook/react';",
"import ${1:${TM_FILENAME_BASE/(.*)\\.stories$/$1/}} from './${1:${TM_FILENAME_BASE/(.*)\\.stories$/$1/}}';",
"",
"const meta = {",
"\tcomponent: ${1:${TM_FILENAME_BASE/(.*)\\.stories$/$1/}},",
"\targs: {",
@riccjohn
riccjohn / convertMdImgToHtml.ts
Last active February 5, 2025 22:31
Convert markdown images to html image tags
type Options = {
width?: number;
height?: number;
class?: string;
};
const convertMdImgToHtml = (markdownImages: string[], options?: Options) => {
const convertedImages = markdownImages.map((markdownImage) => {
return markdownImage.replace(
/!\[(.*?)\]\((.*?)\)/g,
// ==UserScript==
// @name Display current year PTO only
// @namespace MetricAi
// @version 2024-03-26
// @description Hides PTO from previous & future calendar years
// @author You
// @match https://psa.metric.ai/home/my-timeoff/policies/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=metric.ai
// @grant none
// ==/UserScript==
// ==UserScript==
// @name MetricAI Max Width
// @namespace MetricAi
// @version 2024-03-29
// @description Make content full width
// @author You
// @match *://psa.metric.ai/home/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=metric.ai
// @grant none
// ==/UserScript==
{
index: 0,
timestamp: 1537236800416,
data: 'Genesis Block',
prevHash: '0',
thisHash: 'a0fec317fe451b2aaeefc62db8e58a69a2eb72811bc0618693815c428882e4b0'
},
{
index: 1,
timestamp: 1537236800417,
const sha256 = require('sha256');
class Block {
constructor(index, timestamp, data, prevHash) {
this.index = index;
this.timestamp = timestamp;
this.data = data;
this.prevHash = prevHash;
this.thisHash = sha256(
this.index + this.timestamp + this.data + this.prevHash
const createBlockchain = num => {
const blockchain = [createGenesisBlock()];
let previousBlock = blockchain[0];
for (let i = 1; i < num; i += 1) {
const blockToAdd = nextBlock(previousBlock, `This is block #${i}`);
blockchain.push(blockToAdd);
previousBlock = blockToAdd;
}
console.log(blockchain);
const sha256 = require('sha256');
class Block {
constructor(index, timestamp, data, prevHash) {
this.index = index;
this.timestamp = timestamp;
this.data = data;
this.prevHash = prevHash;
this.thisHash = sha256(
this.index + this.timestamp + this.data + this.prevHash
const sha256 = require('sha256');
class Block {
constructor(index, timestamp, data, prevHash) {
this.index = index;
this.timestamp = timestamp;
this.data = data;
this.prevHash = prevHash;
this.thisHash = sha256(
this.index + this.timestamp + this.data + this.prevHash
const sha256 = require('sha256');
class Block {
constructor(index, timestamp, data, prevHash) {
this.index = index;
this.timestamp = timestamp;
this.data = data;
this.prevHash = prevHash;
this.thisHash = sha256(
this.index + this.timestamp + this.data + this.prevHash