Pode ser redeclarada | Pode ser reatribuida | É escopada em bloco | |
---|---|---|---|
var |
✅ | ✅ | ❌ |
let |
❌ | ✅ | ✅ |
const |
❌ | ❌ | ✅ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require("http"); | |
const PORT = 8080; | |
const server = http.createServer((req, res) => { | |
if (req.url === "/") { | |
res.end("Welcome home!"); | |
} | |
if (req.url === "/user") { | |
if (req.method === "GET") { | |
res.end("This is the user page"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Kills port | |
function kill-port() { | |
echo 'Killing port ' $1 | |
kill $(lsof -t -i :$1) | |
echo 'Killed port ' $1 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function aboveAverage(numbers = []) { | |
let total = numbers.reduce((acc, curr) => acc + curr, 0); | |
let average = total / numbers.length; | |
let aboveAverage = numbers.filter(number => number > average); | |
return aboveAverage.length; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias list='f() { | |
cd /Users/emerson/Projects/$1; | |
printf "Please select folder:\n" | |
select d in */; do test -n "$d" && break; echo ">>> Invalid Selection"; done | |
cd "$d" | |
};f' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const session = require('express-session'); | |
const passport = require('passport'); | |
const cookieParser = require('cookie-parser'); | |
const fs = require('fs'); | |
const https = require('https'); | |
const cfenv = require('cfenv'); | |
const axios = require('axios'); | |
const settings = require('./settings.js'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Wikipedia | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://en.wikipedia.org/* | |
// @match https://pt.wikipedia.org/* | |
// @grant none | |
// @import https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ "id": 11, "name": "Mr. Foo" }, | |
{ "id": 12, "name": "Narco Bar" }, | |
{ "id": 13, "name": "Bombasto" }, | |
{ "id": 14, "name": "Celeritas" }, | |
{ "id": 15, "name": "Magneta" }, | |
{ "id": 16, "name": "RubberMan" }, | |
{ "id": 17, "name": "Dynama" }, | |
{ "id": 18, "name": "Dr IQ" }, | |
{ "id": 19, "name": "Magma" }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ids = [ ... ]; | |
ids.forEach(function(id, i){ | |
callApi(id); | |
}); | |
function callApi(videoId) { | |
$.ajax({ | |
type: 'GET', |
NewerOlder