REST API response format based on some of the best practices
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Creates a debounced version of a function that delays its execution until after | |
| * a specified wait time has elapsed since the last time it was invoked. | |
| * | |
| * Features: | |
| * - Preserves argument and this typing. | |
| * - Supports leading (immediate) and trailing invocation options. | |
| * - Exposes cancel() and flush() helpers. | |
| * | |
| * Typical use-cases: input handlers, resize/scroll listeners, search-as-you-type. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "use client"; | |
| import { | |
| Children, | |
| cloneElement, | |
| ComponentPropsWithRef, | |
| isValidElement, | |
| MouseEvent as ReactMouseEvent, | |
| ReactElement, | |
| ReactNode, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | |
| }); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 \ |
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 |