Skip to content

Instantly share code, notes, and snippets.

View fiuzagr's full-sized avatar
🌱
Seeding

Fiuza fiuzagr

🌱
Seeding
View GitHub Profile
@fiuzagr
fiuzagr / rest-api-response-format.md
Created September 21, 2023 13:41 — forked from igorjs/rest-api-response-format.md
REST API response format based on some of the best practices
@fiuzagr
fiuzagr / queue-promise.ts
Created June 29, 2023 14:25
Queue Promises
let _queue: Promise<any> = Promise.resolve(true);
const queuePromise = (operation: (value: any) => Promise<any>) => {
return new Promise((resolve, reject) => {
_queue = _queue
.then(operation)
.then(resolve)
.catch(reject);
});
};
@fiuzagr
fiuzagr / README.md
Last active August 16, 2020 14:27
Simple React Flux with Hooks

Simple React Flux with Hooks

Usage

import { StateProvider, useGetState } from './state';

const MyComp = () => {
  const [state, actions] = useGetState();
 
@fiuzagr
fiuzagr / cpf.js
Last active April 26, 2024 11:28
Gerador/Validador de CPF funcional
const digitMod = (value, len) => {
const mod = len - Math.round(value - Math.floor(value / len) * len);
return mod >= 10 ? 0 : mod;
};
const mapValuesWithDigitModByKey = (_key, _len) => (value, key) =>
_key === key ? digitMod(value, _len) : value;
const reduceDigitsByKey = _key => (digits, value, key) => {
if (key > _key) {
@fiuzagr
fiuzagr / vim-from-source.sh
Last active December 4, 2017 19:23
Ubuntu Vim 8 +python +python3 +ruby +lua
# remove vim
sudo apt-get remove --purge \
vim vim-nox vim-runtime vim-gnome \
vim-tiny vim-common vim-gui-common
sudo rm -rf /usr/local/share/vim /usr/bin/vim
# install dependencies
sudo apt-get install \
liblua5.1-dev luajit libluajit-5.1 libncurses5-dev \
@fiuzagr
fiuzagr / dynamic-redux-sagas.md
Created June 5, 2017 14:53 — forked from mpolci/dynamic-redux-sagas.md
Helper function creating a dynamic saga for code splitting with redux-saga

Helper function

This function create a saga that runs the sagas in the startingSagas array and takes the actions with type indicated by changeActionType to replace the running sagas. The replacing actions must have a field sagas cointaining the array with the new sagas.

function createDynamicSaga (changeActionType, startingSagas) {
  function* _start (sagas) {
    try {
      yield sagas
@fiuzagr
fiuzagr / spotify_keybindings
Created March 9, 2017 21:14 — forked from jbonney/spotify_keybindings
Spotify - Linux key bindings. From XFCE / Ubuntu keyboard shortcuts configuration, assign the control command to their key. http://shkspr.mobi/blog/2011/12/linux-spotify-keybindings/
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause" XF86AudioPlay
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Stop" XF86AudioStop
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next" XF86AudioNext
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous" XF86AudioPrevious
@fiuzagr
fiuzagr / gist:46b5f4d059008cb5f22e
Created January 29, 2016 19:18 — forked from bramus/gist:5b4f4733e543912a518f
OS X 10.10 Yosemite, Apache, MySQL, PHP 5.6, (MAMP) Homebrew Dev Setup
# From http://www.iyware.com/osx-yosemite-mamp-homebrew-development-setup/
# Install Homebrew
xcode-select --install
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor
# Tap Repos
brew tap homebrew/dupes
brew tap homebrew/versions