Skip to content

Instantly share code, notes, and snippets.

View guillermoroblesjr's full-sized avatar

Guillermo Robles, Jr. guillermoroblesjr

View GitHub Profile
@guillermoroblesjr
guillermoroblesjr / gist:ce97301ae8d326093f66
Created May 22, 2015 19:18
Force install of a package with Bower when the bower.json file has errors
# bower install <name-for-your-directory>=http://<url>/<file-name> -S
# example
bower install dom4-polyfill=https://raw.githubusercontent.com/WebReflection/dom4/master/build/dom4.js -S
@guillermoroblesjr
guillermoroblesjr / gist:31fcd11738a868858c7c
Created May 12, 2015 01:12
Automate your git commits
#!/bin/bash
git fetch
git add --all .
git status
git commit -m "$2"
git push
@guillermoroblesjr
guillermoroblesjr / gist:0e7881125ac74d0e573f
Created April 30, 2015 15:58
Create a JavaScript function dynamically with strings
// Create the function
// 'a' and 'b' are the arguments available to the function,
// the last string is the body of your new function
var x = Function('a','b','console.log(a+b); return "apples";');
// Implementation
x(1,2); // will return 'apples' and will log to the console '3';
@guillermoroblesjr
guillermoroblesjr / gist:8d55d06cb4af7e5c6fcb
Last active August 29, 2015 14:20
Git set upstream origin remote branch
# git push -u origin my_branch
git push -u [email protected]:name-of-repo.git my-branch
# same as:
git push --set-upstream [email protected]:name-of-repo.git my-branch
@guillermoroblesjr
guillermoroblesjr / gist:9b5892d8d8d35abb08c5
Last active October 28, 2015 14:59
Git checkout/revert to an older hash on a new branch
# directory goes back to the hash, ALL changes AFTER hash are discarded.
# you can always merge in a different branch to update later changes.
git checkout -b <temp-branch-name> <myHashGoesHere>
# OR
# create a new branch
git checkout -b <temp-branch-name>
# reverts all files that were originally part of this hash back to their
@guillermoroblesjr
guillermoroblesjr / gist:867e77c2375d3684400b
Last active August 29, 2015 14:17
Underscore/Lodash each function
_.each( '<collection>', function(item,count,collection) {
// do stuff
}, this /* this becomes available in your function */);
@guillermoroblesjr
guillermoroblesjr / gist:374998dd675f6b4f7416
Created March 13, 2015 15:02
NPM shrinkwrap save with dev dependencies
npm shrinkwrap --dev
@guillermoroblesjr
guillermoroblesjr / gist:acc2ec6b189fd4c6b896
Created March 12, 2015 19:25
Save CURL output to a file
curl -o mygettext.html http://www.gnu.org/software/gettext/manual/gettext.html
@guillermoroblesjr
guillermoroblesjr / gist:39164a814e8266f47707
Created February 26, 2015 20:25
Installing/Updating Cmake with Ubuntu or LinuxMint
# From: http://www.cmake.org/pipermail/cmake/2013-February/053649.html
# This will create a directory named "Support" in your home folder, download
# and extract CMake 2.8.10. Finally it invokes cmake with the "-version"
# param to check that cmake run.
cd && mkdir Support && cd Support && \
wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2-Linux-i386.tar.gz && \
tar -xzvf cmake-2.8.10.2-Linux-i386.tar.gz && \
./cmake-2.8.10.2-Linux-i386/bin/cmake -version
find ./ -name "myfile.js"