Skip to content

Instantly share code, notes, and snippets.

View user-snippets.vscode.json
{
"Print object to console":{
"prefix": "stringify",
"body": "console.log(\"stringify $0\", JSON.stringify($0, null, 2))"
},
"Safe print object to console":{
"prefix": "stringifysafe",
"body": "console.log('inspect $0',require('util').inspect($0))"
},
"saveToFile":{
@favio41
favio41 / vscode.keybindings.json
Last active Oct 16, 2019
keyboard shortcuts for vscode (open keyboard shortcuts)
View vscode.keybindings.json
[
{
"key": "cmd+k cmd+e",
"command": "-keybindings.editor.defineWhenExpression",
"when": "inKeybindings && keybindingFocus"
},
{
"key": "cmd+k cmd+e",
"command": "eslint.executeAutofix"
},
@favio41
favio41 / .vscode_launch.json
Last active Oct 9, 2019
Debug jest test of current open file
View .vscode_launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest Current file",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
"${file}"
View .vscode_settings.json
{
"workbench.colorTheme": "Monokai",
"editor.rulers": [80,120],
"workbench.colorCustomizations": {
"editorRuler.foreground": "#40404050"
}
}
@favio41
favio41 / brew-java-and-jenv.md
Created Feb 14, 2019 — forked from tomysmile/brew-java-and-jenv.md
How To Install Java 8 on Mac
View brew-java-and-jenv.md

Install HomeBrew first

brew update
brew tap caskroom/cask
brew install brew-cask

If you get the error "already installed", follow the instructions to unlink it, then install again:

@favio41
favio41 / .gitconfig
Last active Sep 6, 2019
Alias for .gitconfig
View .gitconfig
[alias]
graph1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
graph2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
graph = !"git graph2"
fetch-develop = fetch origin develop:develop
fetch-master = fetch origin master:master
amend = commit -a --amend
undo = reset --soft HEAD~1
ignored = git ls-files -v
forget = update-index --assume-unchanged
@favio41
favio41 / cloudformation.yml
Created Sep 19, 2018
AWS cloudformation user creation with programmatic access and s3 policy
View cloudformation.yml
AWSTemplateFormatVersion: '2010-09-09'
Resources:
# Setup an user
user:
Type: AWS::IAM::User
Properties:
UserName: !Join
- '-'
- - 'changeme'
View console-timezones.js
console.table({
"01 - moment('2016-04-14T00:00:00+00:00').format()": moment('2016-04-14T00:00:00+00:00').format(),
"02 - moment.utc('2016-04-14T00:00:00+00:00').format()": moment.utc('2016-04-14T00:00:00+00:00').format(),
"03 - moment('2016-04-14T00:00:00+01:00').format()": moment('2016-04-14T00:00:00+01:00').format(),
"05 - new Date('2016-04-14T00:00:00+00:00')": new Date('2016-04-14T00:00:00+00:00'),
"04 - new Date(Date.parse('2016-04-14T00:00:00+00:00'))": new Date(Date.parse('2016-04-14T00:00:00+00:00')),
"09 - moment('2016-04-14T00:00:00+00:00').tz('Europe/London').format()": moment('2016-04-14T00:00:00+00:00').tz('Europe/London').format(),
"10 - moment.utc('2016-04-14T00:00:00+00:00').tz('Europe/London').format()": moment.utc('2016-04-14T00:00:00+00:00').tz('Europe/London').format(),
});
@favio41
favio41 / handy.sh
Created Mar 23, 2016
Linux handy commands
View handy.sh
Show the filename without line breaking, and wait for changes.
less -S +F filename
View Crockford.closure.js
//In this way we prevent 2 things:
// 1- Polute the global scope
// 2- The creation of the array name each time digitToName is called
var digitToName = (function(digit){
var names = ['one', 'two', 'tree']
return function(){
return names[digit];
}
}());
You can’t perform that action at this time.