Skip to content

Instantly share code, notes, and snippets.

View lazamar's full-sized avatar

Marcelo Lazaroni lazamar

View GitHub Profile
@lazamar
lazamar / better-git.sh
Last active December 17, 2018 12:14
Better Git log
git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%Cgreen(%>(14)%cr) %C(bold blue)<%<(17,trunc)%an>%Creset %s %C(yellow)%d%Creset' --abbrev-commit"
@lazamar
lazamar / loadPageSection.js
Last active April 12, 2022 21:53
Vanilla JS implementation of JQuery's .load
/**
* Loads an HTML document from a URL and retuns an element selected using
* the 'selector' parameter
* Example usage:
* loadPageSection('./myPage.html', '#container', (r, err) => console.log(r, err));
*
* @method loadPageSection
* @param {String} url
* @param {String} selector - A valid CSS selector
* @param {Function} callback - To be called with two parameters (response, error)
@lazamar
lazamar / .eslintrc
Last active February 23, 2017 10:12
My eslint configuration
// Use this file as a starting point for your project's .eslintrc.
// Copy this file, and add rule overrides as needed.
{
"parser": "babel-eslint",
"extends": "airbnb",
"plugins": [
"html"
],
"env": {
"es6": true,
@lazamar
lazamar / makeLinksExternal.js
Created October 5, 2015 20:45
Make all links of an Electron project open in the OS Browser instead of the project's window.
// Little function to make all links of a page in an Electron project
// open in the OS Browser instead of the Project's window.
linksArray = document.getElementsByTagName("a");
for (var i = 0; i < linksArray.length; i++) {
linksArray[i].setAttribute("onclick","app.openInBrowser('" + linksArray[i].href + "')");
linksArray[i].href = "#";
}