Skip to content

Instantly share code, notes, and snippets.

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

eber eber404

🏠
Working from home
View GitHub Profile
// CFG de Treino
// Adicionar arquivo na pasta: 'arquivos de programas/steam/steamapps/common/counter strike global ofencive/csgo/config'
// Executar com: 'exec treino-granada'
clear
echo "########## CONFIGURANDO TREINO DE GRANADA! ##########"
// Ativar o uso de comandos que modificam o mapa/player
sv_cheats 1
@eber404
eber404 / autoexec.cfg
Last active July 17, 2021 17:27 — forked from RenanJPaula/autoexec.cfg
CS GO
// removes the shifting of the arm when crouching down.
cl_viewmodel_shift_left_amt "0"
cl_viewmodel_shift_right_amt "0"
cl_bob_lower_amt "0"
cl_bobamt_lat "0.1"
cl_bobamt_vert "0.1"
cl_bobcycle "0.1"
// scales the HUD depending on what resolution you use, 1 is max.
async function recursion(
callback,
limitOfExec,
shouldExec = true,
execNumber = 0
) {
return new Promise(async (resolve, reject) => {
if (!shouldExec) return resolve(execNumber)
execNumber += 1
// current
-novid -no-browser -nojoy -noaafonts -w 1280 -h 720 -refresh 60 -freq 60 +snd_use_hrtf 0 -high -d3d9ex +exec autoexec -noborder -limitvsconst +r_dynamic 0 -r_emulate_g +sdr_spew_level 0 +net_client_steamdatagram_enable_override -1 +net_steamcnx_allowrelay 0 +net_steamcnx_enabled 0
const user = {
name: "Brian O'Conner",
age: 22,
cars: ['Mitsubishi Eclipse', 'Toyota Supra', 'Nissan Skyline GT-R'],
address: {
country: "United States",
state: "CA",
city: "Los Angeles",
getFullAddress: function () {
return `${this.city}, ${this.state} - ${this.country}`;
const user = {
name: "Brian O'Conner",
age: 22,
cars: ['Mitsubishi Eclipse', 'Toyota Supra', 'Nissan Skyline GT-R'],
address: {
country: "United States",
state: "CA",
city: "Los Angeles",
getFullAddress: function () {
return `${this.city}, ${this.state} - ${this.country}`;
const user = {
name: "Brian O'Conner",
age: 22,
cars: ['Mitsubishi Eclipse', 'Toyota Supra', 'Nissan Skyline GT-R'],
address: {
country: "United States",
state: "CA",
city: "Los Angeles",
getFullAddress: function () {
return `${this.city}, ${this.state} - ${this.country}`;
function copyObject(obj) {
const newObject = {};
for (let key in obj) {
const prop = obj[key];
newObject[key] = typeof prop === "object" ? copyObject(prop) : prop;
}
return newObject;
@eber404
eber404 / recursive_map.js
Created December 30, 2021 14:36
just a custom remake of map method in js
function myMap(callback, originalArray, internalCounter = 0) {
originalArray = internalCounter === 0 ? this : originalArray
const [head, ...tail] = this
callback(head, internalCounter, originalArray)
internalCounter++
return tail.length > 0 ? [head, ...tail.myMap(callback, originalArray, internalCounter)] : head
}

Desafio de promises

Faça a requisição de 95 posts, de 20 em 20 posts por request, da URL https://jsonplaceholder.typicode.com/posts, a documentação da paginação está aqui https://github.com/typicode/json-server#paginate. Estas requisições devem ser feitas sequencialmente (só requisita os próximos 20 depois que terminar de requisitar tudo dos 20 anteriores)

Para cada vez que 20 posts forem carregados, carregar todos os comentários de cada um deles de maneira concorrente/paralela (ou seja, requisitar os comentários de todos os 20 posts ao mesmo tempo). Para pegar os comentários de um post você usa a URL https://jsonplaceholder.typicode.com/posts/ID_DO_POST/comments. Isso deve ser feito antes de carregar os próximos 20 posts.

Após carregar todos os posts, carregar os usuários de todos os 95 posts concorrentemente/paralelamente. Para carregar um usuário usa-se a URL https://jsonplaceholder.typicode.com/users/ID_DO_USUARIO. Lembrando que um mesmo usuário pode ter mais de um post, então o mesmo usuário não dev