Skip to content

Instantly share code, notes, and snippets.

View vinicius73's full-sized avatar
🤓
"Those who cannot acknowledge themselves, will eventually fail."

Vinicius Reis vinicius73

🤓
"Those who cannot acknowledge themselves, will eventually fail."
View GitHub Profile
const parseResponse = ({ data }) => {
if (data.error === true) {
return Promise.reject(data)
}
return data
}
const http = axios.create({ })
import { deburr, sortBy } from 'lodash'
const sanitizeAndLower = value => deburr(value).toLowerCase()
//
const sortByString = (list, key) => sortBy(list, x => sanitizeAndLower(x[key]))
const sortByName = list => sortByString(list, 'name')
@vinicius73
vinicius73 / gist:4088c95bf8bacb37bfc8c1c587f5c0eb
Created March 25, 2017 16:21 — forked from thursby/gist:8ac6cb96c84b6d20a3fb1bf3048d46ed
Set the sensitivity for the Logitech M570 in Linux. For whatever reason most controls won't let you set sensitivity less than 1. My trackball likes 0.4. The way this is set is weird because the IDs seem to change whenever the USB is connected and disconnected. I wrote this oneliner to find 'em and change it.
xinput list --short | grep Logitech | awk '{print $5}' | cut -f2 -d"=" | xargs -I id xinput set-prop id "Device Accel Constant Deceleration" 0.4
@vinicius73
vinicius73 / plugins-title.js
Created March 11, 2017 17:59
viue - dinamic title
export default Vue => {
Vue.mixin({
created () {
const { title } = this.$options
if (title !== undefined) {
this.$title = title
}
}
})
import { identity } from 'lodash'
import waith from './waith'
export default (action, repetitions, timeToWaith = 3000) => {
const onError = counter => () => {
if (counter < repetitions) {
return run(counter + 1)
}
return Promise.reject(new Error('TRIES_FAILURE'))
@vinicius73
vinicius73 / problema.md
Last active December 14, 2017 19:36
Um exercício simples com js

Default true

Existem 3 entradas possiveis

  • true
  • false
  • undefined

as saídas serão:

  • undefinded => true
@vinicius73
vinicius73 / var-let-const.md
Last active September 30, 2019 13:52
var, let e const no JavaScript

var, let e const

Em JavaScript há uma comportamento chamado hoisting. O uso de var trazia algumas pegadinhas, como por exemplo, declarar a mesma variavel 2x usando var

var abc = 25
// ...
// ...
var abc = 99
@vinicius73
vinicius73 / npm-cheat-sheet.md
Last active April 5, 2019 07:32 — forked from AvnerCohen/npm-cheat-sheet.md
Node.js - npm Cheat Sheet

Node.js - npm Cheat Sheet

(Descrição completa e mais comandos aqui - https://npmjs.org/doc/index.html)

Instale um pacote e também atualize o package.json com a versão instalada e o nome do pacote.
npm install <module-name> --save
# Versions
# Where the ambientum cache will live
A_CACHE_HOME=$HOME/.cache/ambientum
# Define specific cache directories
A_NPM_CONFIG=$A_CACHE_HOME/npm-config
A_NPM_CACHE=$A_CACHE_HOME/npm-cache
A_COMPOSER_CACHE=$A_CACHE_HOME/composer