Skip to content

Instantly share code, notes, and snippets.

<div
[matTooltip]="'Info about why the button is disabled.'"
[matTooltipDisabled]="isButtonEnabled">
<button
[disabled]="!isButtonEnabled"
(click)="handleButtonClick()"
mat-button type="button" class="button">
<mat-icon>save</mat-icon>
Action
</button>
<button
[disabled]="!isButtonEnabled"
(click)="handleButtonClick()"
mat-button type="button" class="button">
<span
[matTooltip]="'Info about why the button is disabled.'"
[matTooltipDisabled]="isButtonEnabled">
<mat-icon>save</mat-icon>
Action
</span>
<button
mat-raised-button
[matTooltip]="'Info about the action'"
aria-label="Button that displays a tooltip when focused or hovered over"> Action
</button>
@hicaro
hicaro / etc-hosts-on-win.md
Created October 2, 2019 14:36 — forked from zenorocha/etc-hosts-on-win.md
/etc/hosts on Windows

1. Get your IP Address

echo `ifconfig $(netstat -nr | grep -e default -e "^0\.0\.0\.0" | head -1 | awk '{print $NF}') | grep -e "inet " | sed -e 's/.*inet //' -e 's/ .*//' -e 's/.*\://'`

2. Modify your hosts file

notepad

@hicaro
hicaro / deepDiff.js
Last active June 15, 2018 20:52
Generic deep diff between two objects
/*
Credits to sbgoran (https://jsfiddle.net/user/sbgoran/fiddles/)
https://jsfiddle.net/sbgoran/kySNu/
*/
var deepDiffMapper = function() {
return {
VALUE_CREATED: 'created',
VALUE_UPDATED: 'updated',
VALUE_DELETED: 'deleted',
@hicaro
hicaro / branch.sh
Last active December 15, 2020 15:25
Git useful commands
# create new branch
git branch <branch name>
# create new branch and checkout to it
git checkout -b <branch name>
# upload new branch to remote
git push origin <branch name>
# delete local branch
/*
Simple server side in-memory cache for Express.js with Node.js.
As the content is stored in memory the are the following points to consider:
- In-memory cache is the fastest option available;It’s easy to work with, no external dependency needed;
- We’ll lose the cached content if the server or the process goes down;
- Since it stores cached content in it’s own process memory, it will not be shared between multiple node.js process.
Another option to solve most of this issues is using a distributed cache service like Redis. It could be done with a single npm module express-redis-cache that already implements the Express a middleware.
Credits to: https://goenning.net/2016/02/10/simple-server-side-cache-for-expressjs/