Skip to content

Instantly share code, notes, and snippets.

View ronnycoding's full-sized avatar
🇻🇪
The only way to do great work is to love what you do.

Ronny Freites ronnycoding

🇻🇪
The only way to do great work is to love what you do.
View GitHub Profile
@ronnycoding
ronnycoding / tmux-cheat-sheet.md
Created December 31, 2021 16:19 — forked from michaellihs/tmux-cheat-sheet.md
tmux Cheat Sheet
@ronnycoding
ronnycoding / Link-usage.js
Created August 31, 2021 00:39 — forked from aweber1/Link-usage.js
Next.js custom routes with regex + Server support + Client-side routing
@ronnycoding
ronnycoding / post-merge
Created August 13, 2021 03:56 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@ronnycoding
ronnycoding / RequestService.ts
Last active July 23, 2021 18:43
OOP - Request Service
import axios, { AxiosStatic, AxiosResponse } from 'axios';
interface IJson {
[key: string]: string | IJson;
}
/**
* Internal types
*/
@ronnycoding
ronnycoding / strapi-docker-compose.yml
Created July 17, 2021 20:28
Strapi docker compose
version: "3.1"
services:
strapi:
image: strapi/strapi
volumes:
- ./swap-backend:/srv/app
- /srv/app/node_modules
ports:
- 1337:1337
@ronnycoding
ronnycoding / ControlProps4.js
Created July 9, 2021 05:01
React Patterns
// Control Props
// 💯 don't warn in production
import * as React from 'react'
import warning from 'warning'
import {Switch} from '../switch'
const callAll = (...fns) => (...args) => fns.forEach(fn => fn?.(...args))
const actionTypes = {
@ronnycoding
ronnycoding / ControlProps3.js
Created July 9, 2021 05:00
React Patterns
// Control Props
// 💯 extract warnings to a custom hook
import * as React from 'react'
import warning from 'warning'
import {Switch} from '../switch'
const callAll = (...fns) => (...args) => fns.forEach(fn => fn?.(...args))
const actionTypes = {
@ronnycoding
ronnycoding / ControlProps2.js
Created July 9, 2021 05:00
React Patterns
// Control Props
// 💯 add a controlled state warning
import * as React from 'react'
import warning from 'warning'
import {Switch} from '../switch'
const callAll = (...fns) => (...args) => fns.forEach(fn => fn?.(...args))
const actionTypes = {
@ronnycoding
ronnycoding / ControlProps.js
Created July 9, 2021 04:59
React Patterns
// Control Props
// 💯 add read only warning
import * as React from 'react'
import warning from 'warning'
import {Switch} from '../switch'
const callAll = (...fns) => (...args) => fns.forEach(fn => fn?.(...args))
const actionTypes = {
// state reducer
// 💯 state reducer action types
import * as React from 'react'
import {Switch} from '../switch'
const callAll = (...fns) => (...args) => fns.forEach(fn => fn?.(...args))
const actionTypes = {
toggle: 'toggle',