Skip to content

Instantly share code, notes, and snippets.

View mauroreisvieira's full-sized avatar

Mauro Reis Vieira mauroreisvieira

View GitHub Profile
@JLarky
JLarky / IsolateCSS.tsx
Last active July 10, 2023 09:23
How to use shadow dom to isolate CSS of React component https://twitter.com/JLarky/status/1657989891526123520
export function IsolateCSS(props: { children: React.ReactNode }) {
const onceRef = useRef(false);
const [shadowRoot, setShadowRoot] = useState<ShadowRoot>();
const ref = useCallback((ref: HTMLDivElement | null) => {
if (ref && onceRef.current === false) {
onceRef.current = true;
setShadowRoot(ref.attachShadow({ mode: 'open' }));
}
}, []);
@abelflopes
abelflopes / README.md
Last active August 24, 2023 17:27
Sourcetree Custom Actions

Sourcetree Custom Actions

This gist is a collection of custom actions for Sourcetree. The actions abstract useful git commands & combinations.

Creating a custom action on Sourcetree

  1. Open sourcetree on a repository
  2. Go to the "OS top bar" > "Actions" > "Custom Actions" > "Edit..."
  3. You should now be on Sourcetree settings with the "Custom Actions" tab selected
@EllyLoel
EllyLoel / reset.css
Last active October 24, 2024 06:51
CSS Reset
/*
Made by Elly Loel - https://ellyloel.com/
With inspiration from:
- Josh W Comeau - https://courses.joshwcomeau.com/css-for-js/treasure-trove/010-global-styles/
- Andy Bell - https://piccalil.li/blog/a-modern-css-reset/
- Adam Argyle - https://unpkg.com/[email protected]/normalize.min.css / https://codepen.io/argyleink/pen/KKvRORE
Notes:
- `:where()` is used to lower specificity for easy overriding.
*/
import "./index.css";
import React from "react";
import ReactDOM from "react-dom";
import {
DataBrowserRouter,
Route,
useLoaderData,
Form,
useNavigation,
} from "react-router-dom";
@rchl
rchl / LSP.sublime-settings
Created December 13, 2021 22:43
vscode-spell-checker configuration in ST
{
"clients": {
"spellcheck": {
"enabled": false,
"command": [
"node",
"/Users/rafal/workspace/github/vscode-spell-checker/packages/_server/dist/main.js",
"--stdio"
],
"selector": "source.js | source.ts",

this is what i use so far, its obviously not a 100% replica of the typography plugin but looks good enough on my site

  /* replace typography plugin */
  .prose {
    @apply text-gray-700 dark:text-gray-300
  }
  .prose {
    & p {
@themarcba
themarcba / vdom-finished.html
Last active August 22, 2024 04:54
Vue.js-like Virtual DOM
<div id="app"></div>
<script>
// Create virtual node
function h(tag, props, children) {
// Return the virtual node
return {
tag,
props,
children,
}
import os
import sublime
import sublime_plugin
def get_npm_scripts(chosen_directory):
""" Gets the list of npm scripts defined in the package.json
Args:
chosen_directory (str) : The absolute path of the chosen directory.
@OdatNurd
OdatNurd / Adaptive.sublime-theme
Last active May 7, 2024 16:01
Patched Adaptive.sublime-theme for modifying the color of files in the sidebar based on their git status
[
// VCS badges
{
"class": "vcs_status_badge",
"parents": [{"class": "file_system_entry", "attributes": ["untracked"]}],
"layer0.texture": "Theme - Default/common/status_untracked.png",
"layer0.tint": "color(var(--yellowish) blend(rgb(255, 255, 255) 60%))",
"layer0.opacity": 1.0,
"content_margin": 6
},
@OdatNurd
OdatNurd / Default.sublime-keymap
Created June 18, 2018 23:22
Sample Sublime Plugin for a buzzword lorem ipsum that can generate multiple paragraphs at once
[
// Use our own buzzword lorem ipsum generator. It generates buzzword lorem
// using a rolling stock of 5 paragraphs and lets you generate multiple
// items at once.
{
"keys": ["tab"],
"command": "buzzword_ipsum",
"context": [
{ "key": "selection_empty", "operator": "equal", "operand": "true", "match_all": true },
{ "key": "preceding_text", "operator": "regex_match", "operand": "^.*lorem\\d*$", "match_all": true },