Skip to content

Instantly share code, notes, and snippets.

View willgvfranco's full-sized avatar

William Franco willgvfranco

View GitHub Profile
test('ReverseInt function exists', () => {
expect(reverseInt).toBeDefined(); //funcao existe
expect(typeof steps).toEqual('function'); // é funcao
expect(typeof Queue.prototype.constructor).toEqual('function'); // Class
expect(reverseInt(0)).toEqual(0);
expect(palindrome('aba')).toBeTruthy();
expect(palindrome(' aba')).toBeFalsy();
});
test('can remove elements from a queue', () => {
const containsCommonItem = (arr1, arr2) => arr1.some(item => arr2.includes(item))
var foo = [1, 2, 4]
var bar = [4, 4, 5]
console.log(containsCommonItem(foo, bar))
@willgvfranco
willgvfranco / array_or_not.js
Last active April 19, 2021 13:17
node-js-react
let single_or_array = ['a']
Array.isArray(single_or_array) ? single_or_array.map(d => console.log(d)) : console.log(single_or_array)
@willgvfranco
willgvfranco / javascript.md
Last active April 9, 2021 17:21
Interview

Diferença "var" e "let"

  • Let = es6
  • Let = block scope, inacessível fora; Var = function scope, acessível fora de um block
    • function() { if(true) { var x = 5} console.log(x) } // x = 5
  • Var é hoisted no topo da função, da "undefined" se ainda n deu valor

== e === - === vem tipo tbm

Null e undefined (Ambos empty)

@willgvfranco
willgvfranco / .dockerignore
Last active June 6, 2021 17:17
ready configs
.git
.ipynb_checkpoints/*
/notebooks/*
/unused/*
Dockerfile
.DS_Store
.gitignore
README.md
env.*
/devops/*

Setting up Babel and nodemon

Inital set-up

Set up project:

mkdir project
cd project
npm init -y
django-admin startproject => Criou o projeto
django-admin startapp => Cria uma aplicação dentro do projeto
MVC -> MTV
Model -> Views -> Templates
no Django as Views sao os controles
" " os Templates são as páginas
# Start server
python manage.py runserver