Skip to content

Instantly share code, notes, and snippets.


Nicolas Sturm sturmenta

  • Argentina
View GitHub Profile
mrousavy /
Last active Sep 21, 2022
Memoize!!! 💾 - a react (native) performance guide
In computing, memoization or memoisation
is an optimization technique used primarily
to speed up computer programs by storing
the results of expensive function calls and  
returning the cached result when the same
inputs occur again.                                         
                                                     — wikipedia
sturmenta /
Last active Nov 17, 2021
mac m1- start configuration
defaults write autohide-delay -float 0; defaults write autohide-time-modifier -int 0;killall Dock
  • show hide folders & files
defaults write AppleShowAllFiles -bool YES && killall Finder
laurenclark /
Last active Mar 20, 2020
Install mongodb on catalina
# copy from line 3 to 12 and paste in terminal
sudo mkdir -p /Users/$USER/mongo/db; # to ask for a password at the beginning
/usr/bin/ruby -e "$(curl -fsSL"; # install homebrew
brew install wget; wget;
tar -zxvf mongodb-macos-x86_64-4.2.1.tgz;
cd mongodb-macos-x86_64-4.2.1;
sudo cp ./bin/* /usr/local/bin/; sudo ln -s ./bin/* /usr/local/bin/;
cd ..; rm -rf mongodb-macos-x86_64-4.2.1 mongodb-macos-x86_64-4.2.1.tgz;
bennettmcelwee / stringify.js
Last active Feb 23, 2022
Version of JSON.stringify limitied to a specific depth.
View stringify.js
// Similar to JSON.stringify but limited to a specified depth (default 1)
// The approach is to prune the object first, then just call JSON.stringify to do the formatting
const prune = (obj, depth = 1) => {
if (Array.isArray(obj) && obj.length > 0) {
return (depth === 0) ? ['???'] : => prune(e, depth - 1))
} else if (obj && typeof obj === 'object' && Object.keys(obj).length > 0) {
return (depth === 0) ? {'???':''} : Object.keys(obj).reduce((acc, key) => ({ ...acc, [key]: prune(obj[key], depth - 1)}), {})
} else {
return obj
rexlow / md
Last active May 7, 2020
Run React Native on specific iOS simulator version
View md
To add a simulator
Choose Hardware > Device > Manage Devices.
Xcode opens the Devices window.
At the bottom of the left column, click the Add button (+).
In the dialog that appears, enter a name in the Simulator Name text field and choose the device from the Device Type pop-up menu.
//by default
gunjanpatel /
Last active Oct 4, 2022
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

DavidWells / reset.css
Last active Oct 4, 2022 — forked from karbassi/reset.css
CSS reset. Follow me on the twitters for more tips:
View reset.css
v2.0-modified | 20110126
License: none (public domain)
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,

Folder Structure

Please note

While this gist has been shared and followed for years, I regret not giving more background. It was originally a gist for the engineering org I was in, not a "general suggestion" for any React app.

Typically I avoid folders altogether. Heck, I even avoid new files. If I can build an app with one 2000 line file I will. New files and folders are a pain.