Skip to content

Instantly share code, notes, and snippets.

View jeankassio's full-sized avatar
😎
Work Work Work

Jean Kássio jeankassio

😎
Work Work Work
View GitHub Profile
@jeankassio
jeankassio / typing.js
Created October 16, 2023 15:36
Send Typing each 10 seconds with pause if no typing after 2 seconds. (keyup keydown event)
function TypingMessage(){
if(typeof(window.Typing) == 'undefined' || window.Typing == null){
console.log("Dispara Evento Escrevendo");
window.Typing = new TypingTimer(function(){
console.log("Dispara Evento Escrevendo");
@jeankassio
jeankassio / index.php
Created September 29, 2023 20:29
Deletes user data from Codechat
<?php
/*
Dependencies: https://www.php.net/manual/pt_BR/mongodb.tutorial.library.php
*/
define("ACCESS_KEY", "cBeISKzsafdrSeISKzpmOOaJ8t8WISKzpYEOOE"); //Define your access key to send
if(!isset($_GET['key'], $_POST['owner']) OR $_GET['key'] !== ACCESS_KEY){
http_response_code(500);
@jeankassio
jeankassio / remove_array_key.php
Last active February 23, 2023 03:22
PHP - search and remove any index of multidimensional array
<?php
function remove_array_key($key, &$array){
$result = array_key_exists($key, $array);
if($result){
unset($array[$key]);
return $array;
}
@milankragujevic
milankragujevic / proxy.php
Created July 1, 2021 13:19
PHP streaming proxy with support for Range requests (perfect for proxying video files with progressive download MP4 streaming)
<?php
error_reporting(0);
set_time_limit(0);
ob_end_clean();
$url = $_GET['url'];
if(isset($_SERVER['HTTP_RANGE'])) {
stream_context_set_default([
'http' => [
@joeytwiddle
joeytwiddle / async-await-forEach-alternatives.md
Last active July 22, 2024 09:05
Do not use forEach with async-await

Do not use forEach with async-await

TLDR: Use for...of instead of forEach() in asynchronous code.

For legacy browsers, use for...i or [].reduce()

To execute the promises in parallel, use Promise.all([].map(...))

The problem

@FelipeGrijo
FelipeGrijo / Leia.md
Last active July 3, 2024 19:05
Suspender Win 10 pelo cmd

Para mudar o tempo em que o pc irá suspender, altere o valor 7200. Para fazer o cálculo, faça: Hora(s) x 60 x 60.

Exemplo: 1 x 60 x 60 = 3600

Depois de x Horas o pc irá suspender.

@peuweb
peuweb / bancos_brasileiros.php
Created January 10, 2014 18:49
Lista dos bancos brasileiros em formato array
<?php
//bancos brasileiros
$bancos = array(
array('code' => '001', 'name' => 'Banco do Brasil'),
array('code' => '003', 'name' => 'Banco da Amazônia'),
array('code' => '004', 'name' => 'Banco do Nordeste'),
array('code' => '021', 'name' => 'Banestes'),
array('code' => '025', 'name' => 'Banco Alfa'),
array('code' => '027', 'name' => 'Besc'),
array('code' => '029', 'name' => 'Banerj'),
@tlongren
tlongren / example.php
Last active December 23, 2020 13:32
PHP Clean URL (SLUG) Generator
<?php
$slug = slugit("thank you for visiting");
echo $slug;
// returns: thank-you-for-visiting
?>