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 / 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 = {
// 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',
// state reducer
// 💯 default state reducer
import * as React from 'react'
import {Switch} from '../switch'
const callAll = (...fns) => (...args) => fns.forEach(fn => fn?.(...args))
function toggleReducer(state, {type, initialState}) {
switch (type) {
@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 / php-docker-ext
Created February 27, 2021 22:59 — forked from hoandang/php-docker-ext
Complete list of php docker ext
RUN apt update
RUN apt upgrade -y
RUN apt install -y apt-utils
RUN a2enmod rewrite
RUN apt install -y libmcrypt-dev
RUN docker-php-ext-install mcrypt
RUN apt install -y libicu-dev
RUN docker-php-ext-install -j$(nproc) intl
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
@ronnycoding
ronnycoding / vscode_shortcuts.md
Created November 28, 2020 18:53 — forked from bradtraversy/vscode_shortcuts.md
Helpful shortcuts for VSCode

VSCode Shortcuts

List of helpful shortcuts for faster coding

If you have any other helpful shortcuts, feel free to add in the comments of this gist :)

Official List of all commands

@ronnycoding
ronnycoding / docker_debugging.md
Created July 4, 2020 21:13 — forked from veuncent/docker_debugging.md
Debugging Django apps running in Docker using ptvsd - Visual Studio (Code)

Remote debugging in Docker (for Django apps)

In order to enable debugging for your Django app running in a Docker container, follow these steps using Visual Studio (Code):

  1. Add ptvsd to your requirements.txt file
ptvsd == 4.3.2
  1. To your launch.json, add this: