Skip to content

Instantly share code, notes, and snippets.

View guillermoroblesjr's full-sized avatar

Guillermo Robles, Jr. guillermoroblesjr

View GitHub Profile
@guillermoroblesjr
guillermoroblesjr / jqueryPlugin.amd-compatible.js
Created November 19, 2015 20:24
jQuery AMD compatible plugin template
(function(scope, undefined){
var factory = function($){
$.fn.pluginName = function() {};
};
// Set in scope if jquery is already there
if (scope.jQuery !== undefined || scope.$ !== undefined) {
factory(scope.jQuery || scope.$);
}
@guillermoroblesjr
guillermoroblesjr / show diff and commit.sh
Created October 29, 2015 17:26
Git view commit history and the diff's of the commits
# Git view commit history and the diff's of the commits.
# Will show you the same content as "git log" plus the diff of the
# changes in that commit.
git whatchanged -p
@guillermoroblesjr
guillermoroblesjr / run-in-background.sh
Created September 15, 2015 19:54
Run program in the background using the terminal
# http://www.cyberciti.biz/faq/linux-command-line-run-in-background/
# http://superuser.com/questions/198525/how-can-i-execute-a-windows-command-line-in-background
# Linux
<command> &
# Windows
START /MIN <program-name-goes-here>
@guillermoroblesjr
guillermoroblesjr / gist:d07435f666d1e1e1d089
Created September 1, 2015 20:31
Sublime Shortcut Favorites
- Column Selection: Right Mouse Button + Shift
- GoTo Anything: Ctrl + P
- GoTo Line Number: :
- GoTo Function Declaration: @
- GoTo Term: #
- Sidebar: Ctrl + K, Ctrl + B
- Delete line: Ctrl + Shift + K
- Move line up/down: Ctrl + Shift + Up/Down
@guillermoroblesjr
guillermoroblesjr / Modal.js
Created August 27, 2015 15:38
A simple modal constructor with Private and Public methods
/*
* How to use:
* var modal = new Modal({
* modalBackground: $('#manual-mode-modal'),
* modalDialog: $('#manual-mode-modal-wrapper')
* });
*
* modal.openModal();
* modal.closeModal();
*/
@guillermoroblesjr
guillermoroblesjr / gist:976c0661a3c07d049a46
Last active August 29, 2015 14:24
Reverting a file(s) to a specific Git commit
# find the file w/path you want to revert
find <a-parent-directory-of-file> -name "<name-of-file>"
# get all commits (hashes) where changes were done to this specific file
git log --abbrev-commit --pretty=oneline <path-to-your-file>
# revert this file (while keeping changes in the history) to this hash
git checkout <hash> <path-to-your-file>
# do a 'git add' and 'git commit'
node_modules/
bower_components/
*.log
build/
dist/
##########################################################
# ignore everything inside this directory
@guillermoroblesjr
guillermoroblesjr / gist:0cee829b60708eb86ae8
Created June 8, 2015 17:36
Using git diff to view changes on a file with line numbers
# find and copy the: file name, hash of change
git whatchanged
# show the diff
# e.g. git diff ee11453 src/js/my-module.js
git diff <hash> <path/filename>
# when you see this: @@ -26,31 +26,31 @@
# "-26" is the line number,
# "31" is the number of lines changed
@guillermoroblesjr
guillermoroblesjr / gist:2553cdce2230273e5a26
Last active August 29, 2015 14:22
Running node-inspector to debug Node.js apps
# spin up node-inspector, here i'm pointing it to a specific port
node-inspector --web-port=8081
# open another terminal, start the node app with the --debug-brk option
# to create a breakpoint on line 1 of your app
node --debug-brk ./app.js
# if debugging Gruntfile.js with Windows, use:
node --debug-brk c:\Users\<username>\AppData\Roaming\npm\node_modules\grunt-cli\bin\grunt <taskname>
@guillermoroblesjr
guillermoroblesjr / gist:1c8852caee6a629492de
Created May 28, 2015 18:44
Make a symlink in Windows with Cmder
# mklink /j <directory/shortcut name> <directory to create the link to>
mklink /j OPUSConfirmationsTrunk_v2.0 C:\Users\grobles4\workspace\OPUSConfirmationsTrunk_v2.0