Skip to content

Instantly share code, notes, and snippets.

View atefBB's full-sized avatar

Atef Ben Ali atefBB

View GitHub Profile
themsaid / AppServiceProvider.php
Created January 26, 2020 16:24
Re-encryption after APP_KEY rotation
namespace App\Providers;
use App\Encrypter;
use Illuminate\Support\Str;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
swalkinshaw /
Last active November 13, 2023 08:40
Designing a GraphQL API
adamwathan / promise-take-at-least.js
Last active February 26, 2023 14:25
// Creates a new promise that automatically resolves after some timeout:
Promise.delay = function (time) {
return new Promise((resolve, reject) => {
setTimeout(resolve, time)
// Throttle this promise to resolve no faster than the specified time:
Promise.prototype.takeAtLeast = function (time) {
return new Promise((resolve, reject) => {
oanhnn /
Created May 14, 2017 16:47
How to fix composer error "Content-Length Mismatch"

First, run:

$ composer config --list --global        //this will get the composer home path.
[home] /root/.composer                   //it's my composer home path.

And then, edit the config.json in [home] directory, make it like this:

  "config": {
 "github-protocols": [
Majkl578 / Dockerfile
Last active November 8, 2019 17:41
Dockerized example for article at about running multiple PHP versions:
FROM debian:stretch
ENV DEBIAN_FRONTEND noninteractive
# install NGINX
RUN apt-get update && \
apt-get install -y nginx --no-install-recommends && \
rm -rf /var/lib/apt/lists/*
method: POST,
data: { name: "Matt"}
.done(function () {
// whatever you normally do here
.fail(function (res) {
if (res.status !== 422) {
rubo77 /
Last active December 13, 2023 23:58
A php include that replaces all mysql functions with the corresponding mysqli functions

If you have any questions open an issue there or enhancements as Pull Request

replacement for all mysql functions

Be aware, that this is just a workaround to fix-up some old code and the resulting project will be more vulnerable than if you use the recommended newer mysqli-functions instead. So only If you are sure that this is not setting your server at risk, you can fix your old

"name":"AGS Script",
thegitfather /
Last active June 10, 2024 19:57
Vanilla JavaScript Quick Reference / Cheatsheet
megaxorg /
Last active December 2, 2022 20:23
PHP: CURL Requests with Tor

#CURL Connections with Tor

Install Apache, PHP, CURL & Tor with apt-get

sudo apt-get install -y apache2 php5 php5-curl tor

Tor creates a proxy on your mashine with port 9050 for SOCKS5 connections.