Skip to content

Instantly share code, notes, and snippets.


Gois guilhermejcgois

View GitHub Profile
guilhermejcgois /
Last active Aug 29, 2019
Getting all scopes from commits summary in a repo for commitizen friendly repos
git log --pretty="%s" | grep -o -P '(?<=\().*(?=\))' | grep -v -F 'pull request' | uniq
guilhermejcgois / md5-from-deps.js
Created Dec 17, 2018
Get MD5 hash from dependencies and devDependencies from a package.json
View md5-from-deps.js
const crypto = require('crypto');
const pjson = require('../package.json');
const depsStr = JSON.stringify(pjson.dependencies);
const devDepsStr = JSON.stringify(pjson.devDependencies);
const allDepsStr = depsStr + devDepsStr;
echo "\nChecking for console.logs()...\n"
# Get from
exec 1>&2
# enable user input
exec < /dev/tty
guilhermejcgois /
Created Sep 28, 2017
Run lint on typescript files before commit (under test)
# Based on:
# Stash modified files, but keep the index tree
git stash -q --keep-index
# 1. Run diff for tree index withtou create a new index tree, showing only files names and iff the file was added or copied or deleted or renamed.
# 2. Grep only for .ts files
# 3. Execute tslint for each file that was modified with type checking enabled
guilhermejcgois / getStyle.ts
Last active Sep 18, 2021
Get computed styles (in typescript)
View getStyle.ts
// Gist adapted from:
export getStyle(el: Element, styleProp: string): string {
let value;
const defaultView = el.ownerDocument.defaultView;
// W3C standard way:
if (defaultView && defaultView.getComputedStyle) {
// sanitize property name to css notation (hypen separated words eg. font-Size)
styleProp = styleProp.replace(/([A-Z])/g, '-$1').toLowerCase();
return defaultView.getComputedStyle(el, null).getPropertyValue(styleProp);
} else if (el['currentStyle']) { // IE
guilhermejcgois / 0_reuse_code.js
Created Jun 10, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console