Skip to content

Instantly share code, notes, and snippets.

View julitroalves's full-sized avatar
😘
I'm currently working in HouseCursos.com with development of web courses

Julio Alves julitroalves

😘
I'm currently working in HouseCursos.com with development of web courses
View GitHub Profile
@julitroalves
julitroalves / guzzle-async-request-example.php
Created May 9, 2025 16:14
Guzzle Http Async Request: to perform actual async request with guzzle and php you must call CurlMultiHandler::tick method.
<?php
use GuzzleHttp\Client;
use GuzzleHttp\Handler\CurlMultiHandler;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Promise;
$curl = new CurlMultiHandler();
$handler = HandlerStack::create($curl);
$client = new Client(['handler' => $handler]);
@julitroalves
julitroalves / force-disable-drupal-module-on-database.sh
Created February 19, 2025 20:30
The service "service-name" has a dependency on a non-existent service issue
#!/usr/bin/env bash
set -e
# IF YOU ACCIDENTALLY HAVE ENABLED A MODULE FROM OTHER ENVIRONMENT ON OTHER SITE causing
# The service "service-name" has a dependency on a non-existent service.
# CONGRATULATIONS! THIS SCRIPT IS FOR YOU!
#
# This script will forcefully disable a module on the database in order to do that it will
# query the config table, unserialize the blob, edit the data and serialize it back
# to the database table config.
@julitroalves
julitroalves / sliding-window.php
Created October 24, 2024 13:51
Sliding Window
<?php
/**
* Given an array of characters where each character represents a fruit tree,
* you are given two baskets, and your goal is to put the maximum number of
* fruits in each basket. The only restriction is that each basket can have only one type of fruit.
*
* You can start with any tree, but you cant skip a tree once you have started.
* You will pick one fruit from each tree until you cannot, i.e., you will stop
* when you have to pick from a third fruit type.
@julitroalves
julitroalves / coding-challenge-brackets.php
Created October 14, 2024 15:19
Code challenge open-close brackets
<?php
function isValid(string $s) {
$stack = [];
$mapping = [
')' => '(',
']' => '[',
'}' => '{',
];
@julitroalves
julitroalves / gist:0c6d216a08b6621e48c58fb1b08c4349
Last active January 13, 2025 14:34
Vagas na gringa pesquisa no google
Basta copiar e colar essa fórmula lá no google:
site:<portal>"<Cargo que você busca>" "remote" -"remote in the US"
Ali em <portal> você pode usar esses sites:
jobs.lever.co
boards.greenhouse.io
jobs.ashbyhq.com
jobs.jobvite.com
@julitroalves
julitroalves / query_distance_function.sql
Created July 29, 2022 13:43
SQL function to calculate distance between two given coordinates
CREATE OR REPLACE FUNCTION distance(
lat1 double precision,
lon1 double precision,
lat2 double precision,
lon2 double precision)
RETURNS double precision AS
$BODY$
DECLARE
R integer = 6371e3; -- Meters
rad double precision = 0.01745329252;
@julitroalves
julitroalves / Client.js
Last active June 9, 2022 20:23
Downloader Service aim to download, write and check if it exists.
export default class Client {
async print(filename) {
const fileData = await this.downloadFile();
const base64 = new Buffer(fileData, 'binary').toString('base64');
return this.save(filename, base64);
}
@julitroalves
julitroalves / regex-chat-message-with-code
Created September 22, 2021 15:02
Regex to find code inside any message text by ``
new Regex(/^\`([a-zA-Z\r\n\s\t\*\\\{\}\|\;\(\)\<\>\`\:\?\"\/\#\$\@\!\$\%\ˆ\&\-\=\_\+\/\,\.\[\]\'\d])*\`$/gm);
@julitroalves
julitroalves / avoid-keyboard-overview-ionic-v1.md
Last active May 22, 2020 15:40
Changes dynamically and avoid keyboard overview in ionic v1 when popup is opened with input focus.
  1. The first thing you can do is add a new css class to override position of the popup element.
    var popUpRecoverPass = $ionicPopup.prompt({
      title: 'Recuperar senha',
      cssClass: 'avoid-keyboard-overview',
      template: msg,
      inputType: 'email',
      inputPlaceholder: 'Digite seu email',
      cancelText: 'Cancelar',
@julitroalves
julitroalves / README.md
Last active October 22, 2020 17:39
Explicações práticas sobre testes para entrar como programador backend na Avanz

Teste Prático Back-end Avanz

Este repositório foi criado com intuito de disponibilizar os pré-requisitos práticos para se tornar um Desenvolvedor Jr. Back-end da Avanz Comunicação Digital.

Introdução

Uma agência de comunicação precisa de um sistema de criação de notícias com uma api restfull. Desenvolva uma API que contemple as atividades citadas abaixo.

Requisitos

  • HTML 5