Skip to content

Instantly share code, notes, and snippets.

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

BenitoJedai

🏠
Working from home
View GitHub Profile
@BenitoJedai
BenitoJedai / demo.php
Created July 9, 2025 02:42 — forked from freekrai/demo.php
PHP session-based rate limiter for APIs
<?php
date_default_timezone_set('America/Los_Angeles');
session_start();
include("ratelimiter.php");
// in this sample, we are using the originating IP, but you can modify to use API keys, or tokens or what-have-you.
$rateLimiter = new RateLimiter($_SERVER["REMOTE_ADDR"]);
$limit = 100; // number of connections to limit user to per $minutes
$minutes = 1; // number of $minutes to check for.
@BenitoJedai
BenitoJedai / Urlquery.php
Created July 13, 2021 06:18
Php url query from array
<?php
$url = "http://stackoverflow.com";
$data = array(
'foo' => 'bar',
'baz' => 'boom',
'cow' => 'milk',
'php' => 'hypertext processor',
);
$queryParams = http_build_query($data);
if (strpos($url, '?') !== FALSE) {
@BenitoJedai
BenitoJedai / index.js
Created January 7, 2020 02:44
Emoji custom Regex
<textarea id="mojo"style="width:90vw;height:100px">
lo mejor de :chrome: y :android:
Con la app de :apple: tenes :photoshop: con el pack :adobe: que mas queres salud :mate: 馃槑馃構
</textarea>
<div id="result" style="width:300px;height:200px;background:#ffffff;color:#040404">
</div>
<button style="width:200px;height:100px;background:#6300ff;color:white" class="btn-hover color-7" onclick="setter()">Paraguay Emoji Standard by Ben</button>
<style>
.emoji{