Skip to content

Instantly share code, notes, and snippets.

Iván López Santiago greuze

Block or report user

Report or block greuze

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
greuze / move-folder-with-history.txt
Created Apr 10, 2019
Move folder to other repo with history
View move-folder-with-history.txt
# Clone a fresh copy of origin repo and enter into it
git clone <giturl-repoA>
cd <repoA>
# Optional, to avoid pushing to the wrong remote repository
git remote rm origin
# From the repo source, remove all the files and history ourside the folder
git filter-branch --subdirectory-filter <folder-name> -- --all
# Optional, move all the files previously in the folder to a new one, as they are in the repo root now, and commit them (no push)
mkdir <directory-new-name>
mv * <directory-new-name>
greuze / .grunt_bash_completion
Created Jun 4, 2015
Autocomplete grunt task if Gruntfile.js is present
View .grunt_bash_completion
# Create function that will run when a certain phrase is typed in terminal
# and tab key is pressed twice
# fill local variable with a list of completions
local COMPLETES=`grep -s 'grunt\.registerTask' Gruntfile.js | sed "s/\s*grunt.registerTask('\([^']*\)',.*$/\1/g"`
# we put the completions into $COMPREPLY using compgen
return 0
greuze / .ctags
Last active Aug 29, 2015
node.js .ctags
View .ctags
--regex-js=/([A-Za-z0-9_$]+)[ \t]*[:=][ \t]*function[A-Za-z0-9_$ \t]*\(/\1/f, function, functions/
--regex-js=/\[[ \t]*['"]([A-Za-z0-9_$ ]+)['"][ \t]*\][ \t]*=[ \t]*function[A-Za-z0-9_$ \t]*\(/\1/f, function, functions/
--regex-js=/['"]([A-Za-z0-9_$ ]+)['"][ \t]*:[ \t]*function[A-Za-z0-9_$ \t]*\(/\1/f, function, functions/
--regex-js=/function[ \t]+([A-Za-z0-9_$]+)[ \t]*([^)])/\1/f, function, functions/
greuze / force-http-error.js
Created Feb 26, 2015
Force HTTP error in node.js requests
View force-http-error.js
var http = require('http');
var request = require('request');
function forceHttpError(error) {
var originalHttpRequest = http.request;
// Monkey-patch the http.request method with
// our implementation
http.request = function (opts, cb) {
// Call the original implementation of http.request()
var req = originalHttpRequest(opts, cb);
View .git-prompt
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# Reset
Color_Off="\[\033[0m\]" # Text Reset
# Regular Colors
Black="\[\033[0;30m\]" # Black
Red="\[\033[0;31m\]" # Red
Green="\[\033[0;32m\]" # Green
You can’t perform that action at this time.