Review of some concepts
|
Informative
|
|
|
100
|
Continue
|
|
101
|
Switching Protocol
|
|
Success
|
|
|
200
|
OK
|
|
201
|
Created (POST)
|
|
202
|
Accepted
|
|
203
|
Non-Authoritative Information
|
|
204
|
No Content
|
|
Redirect
|
|
|
301
|
Move Permanently
|
|
Client Error
|
|
|
400
|
Bad Request
|
|
401
|
Unaithorized
|
|
402
|
Payment Required
|
|
403
|
Forbidden
|
|
404
|
Not Found
|
|
408
|
Timeout
|
|
429
|
Too Many Requests
|
|
451
|
Illegal
|
|
Server Error
|
|
|
500
|
Internal Server Error
|
|
502
|
Bad Gateway
|
|
503
|
Service Unavailable
|
|
List
|
|
|
lst
|
[10, 20, 30, 40, 50]
|
|
lst[:-1]
|
[10, 20, 30, 40]
|
|
lst[1:-1]
|
[20, 30, 40]
|
|
lst[::2]
|
[10, 30, 50]
|
|
lst[::-1]
|
[50, 40, 30, 20, 10]
|
|
and, or, not, True False
|
|
|
Import
|
|
|
from mod import mod1, mod2
|
mod1()
|
|
import mod
|
mod.mod1()
|
|
Operators
|
+ - / // % *
|
|
a
|
|
|
Operations
|
|
|
.len()
|
|
|
.sorted(list)
|
|
|
list.sort()
|
|
|
.reversed(list)
|
|
|
list.reverse()
|
|
|
Lists Operations
|
|
|
.append()
|
[ , , []]
|
|
.extend()
|
[ , , , ]
|
|
.insert(index, value)
|
|
|
.remove()
|
|
|
Dictionaries Operations
|
|
|
{key: value}
|
|
|
d[key]
|
value
|
|
.update()
|
|
|
.values()
|
|
|
.keys()
|
|
|
a
|
|
|
Strings
|
|
|
.count()
|
|
|
.index()
|
|
|
.upper()
|
|
|
.capitalize()
|
|
|
.split("_")
|
|
|
.strip(" ")
|
Remove todos os caracteres
|
|
SELECT column1, column2 FROM table_name WHERE x = "ads" ORDER BY column1 DESC
|
|
SELECT COUNT(column_name) FROM table_name WHERE condition;
|
|
SELECT AVG(column_name) FROM table_name WHERE condition;
|
|
SELECT SUM(column_name) FROM table_name WHERE condition;
|
|
SELECT column1, ... FROM table_name WHERE columnN LIKE pattern;
% - any, _something |
|
INSERT INTO table name (column1, column2, column3, ...) VALUES (value1, value2, value3, ...)
|
|
UPDATE table_name SET column1 = value1, column2 = value2, ... WHERE condition
|
|
DELETE FROM table_name WHERE condition
|
|
CREATE TABLE table_name (column1 datatype, column2 datatype, ...)
|
|
DROP TABLE table_name
|
|
DROP DATABASE databasename
|
|
ALTER TABLE table_name ADD column_name datatype;
|
|
ALTER TABLE table_name DROP COLUMN column_name;
|
|
ALTER TABLE table_name MODIFY COLUMN column_name datatype;
|
|
Arrays
|
|
|
.equals(Object[] arr1, Object[] arr2)
|
|
|
.sort(Object[] arr)
|
|
|
.toString()
|
|
|
String
|
|
|
.indexOf(char a)
|
|
|
.charAt(int index)
|
|
|
.equals(String s)
|
|
|
.format(String s, int 1, String 2, int 3, ...)
|
|
|
.length()
|
|
|
.subString(int beginIndex, int endIndex)
|
|
|
.toLowerCase()
|
|
|
.toUpperCase()
|
|
|
List<E>
|
|
|
.add(int index, E element)
|
|
|
.add (E element)
|
|
|
.contains(Object o)
|
|
|
.get(int index)
|
|
|
.indexOf(Object o)
|
|
|
.isEmpty()
|
|
|
.remove(int index)
|
|
|
.remove(Object o)
|
|
|
.set(int index, E Element)
|
|
|
.size()
|
|
|
.toArray()
|
|
|
.subList(int fromIndex, int toIndex)
|
|
|
HashMap<Object Key, Object Value>
|
|
|
.get(Object Key)
|
|
|
.put(Key key, Value value)
|
|
|
.remove(Object key)
|
|
|
.replace(K key, V value)
|
|
|
.size()
|
|
|
.values()
|
|
|
.containsKey(Object Key)
|
|
|
.containsValue(Object Value)
|
|
|
HashSet<E>
|
|
|
.add(E e)
|
|
|
.contains(Object o)
|
|
|
.remove(Object o)
|
|
|
.size()
|
|
|
.isEmpty()
|
|
|
.clear()
|
|
|
jUnits
|
|
|
void teste(){ ... }
|
assertEquals(exp, comp)
|
|
Criar repo
|
git init
|
|
Aceder a staging area
|
git status
|
|
Adicionar ficheiro a Staging Area
|
git add {nome do ficheiro}
|
|
Remover da Staging Area
|
git reset HEAD -- <file>
|
|
Dar commit
|
git commit -m "Commit message"
|
|
Criar novo branch
|
git branch <new-branch-name>
|
|
Mudar de branch
|
git checkout {branch}
|
|
Merge Branch
|
git merge <branch-name>
|
|
Push para remoto
|
git push <remote> <branch>
|
|
Atualizar
|
git pull
|
|
Remover ficheiro do repositorio
|
git rm <file>
|
|
Schema.create({ nome: name, password })
|
|
Schema.findOne({ _id: id })
|
|
Schema.find({ name: name })
|
|
Schema.exists({ _id: id })
|
|
Schema.updateMany({ {_id: id}, {name: name} })
|
|
Schema.deleteOne({ _id: id })
|
|
Single Responsibility
|
Class can have one responsibility
|
|
Open/Closed
|
Interfaces = - if's
|
|
Liskov Substitution
|
Subclass can do what Super does
|
|
Interface Segregation
|
Threedimensional shape x shape
|
|
Dependency Inversion
|
|
|
const express = require('express')();
|
|
|
Get
|
app.get('/info', (req, res)=>{})
|
|
Post
|
app.post('/:id', (req, res) => {))
|
|
Send
|
res.status(200).send({})
|
|
Redirect
|
res.redirect(301, '/')
|
|
render(){return(<div>...</div>)}
|
|
|
Array => .map(() => { ... })
|
|
|
onClick = {() => this.handleSomething()}
|
|
|
Counters: <Counter onDelete={}/>
|
Counter: this.props.onDelete
|
|
Class
|
|
|
state = {...json...}
|
|
|
this.setState({count: this.state.count + 1})
|
|
|
componentDidMount
|
|
|
componentDidUpdate
|
|
|
componentWillUnmount
|
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.