Skip to content

Instantly share code, notes, and snippets.

@jrson83
jrson83 / bem-and-sass.md
Created July 2, 2023 01:07 — forked from radist2s/bem-and-sass.md
BEM & SASS best practices

BEM & SASS best practices

Every block should be in separated file named as block.

Filename: rating-star.scss

.rating-star {
    $font-size: 0.5em;
    
    display: inline-block; // `display` style may be set freely
@jrson83
jrson83 / changelog.js
Created June 1, 2023 11:10 — forked from NicolasRitouet/changelog.js
Changelog.js
#!/usr/bin/env node
// TODO(vojta): pre-commit hook for validating messages
// TODO(vojta): report errors, currently Q silence everything which really sucks
'use strict';
var child = require('child_process');
var fs = require('fs');
var util = require('util');
@jrson83
jrson83 / router.ts
Created May 20, 2023 18:00 — forked from idan/router.ts
basic router in typescript
export type Route = {
method: "*" | "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS" | "CONNECT" | "TRACE"
path: string
regexp: RegExp
handler: (request: Request, route: MatchedRoute) => Promise<Response>
}
export type MatchedRoute = Route & {
url: URL
}
@jrson83
jrson83 / alert.svg
Created May 15, 2023 01:01
alert.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jrson83
jrson83 / install-zsh-windows-git-bash.md
Created April 12, 2023 11:01 — forked from fworks/install-zsh-windows-git-bash.md
Zsh / Oh-my-zsh on Windows Git Bash
@jrson83
jrson83 / cleanModules.js
Last active April 1, 2023 13:43
Deletes node_modules folders inside a workspace recursively & parallel
#!/usr/bin/env node
import { readdir, rm } from 'node:fs/promises'
/**
* @license
* MIT License
*
* Copyright (c) 2023 Jörn Spangenberg <https://jrson.me>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@jrson83
jrson83 / home.tsx
Created March 9, 2023 21:58
persistent layouts
import Layout from '../Layouts'
import { Fragment } from 'react'
const Home: React.FC = () => {
return (
<Fragment>
<h1>Home</h1>
<p>Hello, welcome to your first Inertia app!</p>
</Fragment>
)
@jrson83
jrson83 / Action.ts
Created March 2, 2023 23:21 — forked from TClark1011/Action.ts
TS - Helpful Utilities
// branded types to allow for better type inference
// with default generic types
/* eslint-disable @typescript-eslint/naming-convention */
type NO_PAYLOAD = {
JgJES6BF8uyaOwF1: "FY7eBhPYJlqOxuVp";
};
type OPTIONAL_PAYLOAD = {
A7nWdXs0r5RLuHRf: "zPcrRNRIl4r5IHbA";
};
@jrson83
jrson83 / deep-merge.ts
Created March 2, 2023 23:16 — forked from havenchyk/deep-merge.ts
deep merge
function isPlainObject(item: unknown): item is Record<string, unknown> {
return item && (item as object).constructor === Object
}
function filterProto([key, value]: [string, unknown]) {
// Avoid prototype pollution
return key !== '__proto__'
}
const deepmerge = (