Skip to content

Instantly share code, notes, and snippets.

Dani de la Cruz d4nidev

  • Barcelona
Block or report user

Report or block d4nidev

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
d4nidev /
Created Jun 18, 2019
Remove all node_modules folders
find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
d4nidev /
Last active Feb 27, 2019
Removes all local branches in a git repository which are already merged or deleted from origin.
git fetch -p && for branch in `git branch -vv --no-color | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done
d4nidev /
Last active Feb 4, 2018
My aliases for git
git config --global checkout
git config --global branch
git config --global commit
git config --global status
git config --global alias.unstage 'reset HEAD --'
git config --global alias.last 'log -1 HEAD'
d4nidev / settings.json
Created Oct 30, 2017
Visual Studio user settings
View settings.json
"atomKeymap.promptV3Features": true,
"editor.fontFamily": "Fira Code",
"editor.fontLigatures": true,
"editor.fontSize": 13,
"editor.formatOnPaste": true,
"editor.multiCursorModifier": "ctrlCmd",
"editor.tabSize": 2,
"workbench.fontAliasing": "antialiased",
"workbench.iconTheme": "material-icon-theme",
d4nidev /
Created May 26, 2017
Move history from a repo to another, filtering by folder
  1. git clone
  2. cd
  3. git remote rm origin
  4. git filter-branch --subdirectory-filter <directory 1> -- --all

You may need also to merge histories, if the new repo already exists. In order to do that, make:

  1. git pull --allow-unrelated-histories

And finally,

d4nidev /
Created Mar 9, 2017
Git Tip: Reset unstaged changes and files
# Revert changes to modified files.
git reset --hard
# Remove all untracked files and directories. (`-f` is `force`, `-d` is `remove directories`)
git clean -fd
d4nidev / firstclass.js
Created Feb 5, 2017
First class function
View firstclass.js
const writeLog = (text) => console.log(text)
d4nidev /
Created Jan 18, 2017
Git clean local branches
git branch --merged master | grep -v "\* master" | xargs -n 1 git branch -d
d4nidev /
Last active Oct 13, 2016
Open a shell terminal with a docker container given its name
docker exec -it myContainerName sh
You can’t perform that action at this time.