Skip to content

Instantly share code, notes, and snippets.

View webrgp's full-sized avatar
💻
Turning coffee into code

Rodrigo Passos webrgp

💻
Turning coffee into code
View GitHub Profile

Some code snippets for easy store creation

// makeStore.ts - A function for creating more stores

import {
  Dispatch,
  Reducer,
  useContext,
  useReducer,
@webrgp
webrgp / .finicky.js
Created August 3, 2022 15:35
finicky.js config file
module.exports = {
options: {
hideIcon: true,
},
defaultBrowser: 'Safari',
handlers: [
{
match: finicky.matchHostnames(['localhost']),
browser: 'Brave Browser',
},
import React from 'react'
import { ThemeToggler } from "gatsby-plugin-dark-mode"
function ThemeToggle() {
return (
<ThemeToggler>
{({ theme, toggleTheme }) => (
<div className="flex justify-between items-center">
<label className={`w-14 h-8 flex items-center rounded-full p-1 ${ theme === 'dark' ? "bg-indigo-500" : "bg-yellow-200"}`}>
<input type="checkbox" className="hidden"
onChange={e => toggleTheme(e.target.checked ? 'dark' : 'light')}
@webrgp
webrgp / _content_blocks.twig
Created July 13, 2022 15:17
CraftCMS content blocks partial
{# prettier-ignore #}
{% if blocks is defined and blocks is iterable %}
{% for blk in blocks %}
{% if blk.type is defined %}
{% include '_blocks/_' ~ blk.type ~ '.twig' ignore missing with {
blk: blk,
index: loop.index,
} %}
{% endif %}
{% endfor %}
@webrgp
webrgp / RichText.json
Created July 13, 2022 14:49
RichText Redactor Base Configuration
{
"buttons": [
"html",
"formatting",
"bold",
"italic",
"unorderedlist",
"orderedlist",
"link",
"file"
@webrgp
webrgp / website-download
Last active April 29, 2022 15:45
Download A Website with Wget
wget --wait=2 --level=inf --limit-rate=20K --recursive --page-requisites --user-agent=Mozilla --no-parent --convert-links --adjust-extension --no-clobber -e robots=off https://example.com
@webrgp
webrgp / macOS_app_switcher.sh
Created December 29, 2021 17:06
Make sure CMD + TAB app switcher on Mac displays in all screens
defaults write com.apple.Dock appswitcher-all-displays -bool true
killall Dock
@webrgp
webrgp / macos-tab-switcher-all
Created October 7, 2021 14:23
Show macOS app switcher across all monitors
# To enable
defaults write com.apple.Dock appswitcher-all-displays -bool true
killall Dock
# To revert
defaults write com.apple.Dock appswitcher-all-displays -bool false
killall Dock
@webrgp
webrgp / path-config.json
Last active September 16, 2021 16:57
Blendid Configuration for working with Twig
{
"src": "./src",
"dest": "./public",
"html": {
"src": "html",
"dest": "./"
},
"static": {
actor: Tester
paths:
tests: tests
log: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
settings:
bootstrap: _bootstrap.php
params: