Skip to content

Instantly share code, notes, and snippets.

View heregoesnoth's full-sized avatar
🏠
Working from home

Lucas Gomes heregoesnoth

🏠
Working from home
View GitHub Profile
@heregoesnoth
heregoesnoth / isZigzag.js
Created October 5, 2021 04:23
isZigzag CodeSignal
function isZigzag(numbers) {
let arr = []
for(let i = 0; i < numbers.length - 2; i++) {
if ((numbers[i] < numbers[i+1] && numbers[i+1] > numbers[i+2]) || (numbers[i] > numbers[i+1] && numbers[i+1] < numbers[i+2])) {
arr.push(1)
} else {
arr.push(0)
}
}
@heregoesnoth
heregoesnoth / directive.js
Created July 26, 2019 06:45
VueJS directive example
// Registra a diretiva personalizada global chamada `v-focus`
Vue.directive('focus', {
// Quando o elemento vinculado é inserido no DOM...
inserted: function (el) {
// Coloque o foco no elemento
el.focus()
}
})