Skip to content

Instantly share code, notes, and snippets.

@zakariamouhid
zakariamouhid / image.php
Last active December 3, 2021 23:00
write arabic text inside box
<?php
$input_text = isset($_GET['text']) ? $_GET['text'] : '';
$font = './fonts/Cairo-Regular.ttf';
$bg_image_path = 'photo.png';
$font = realpath($font);
require('./I18N/Arabic.php');
$Arabic = new I18N_Arabic('Glyphs');
$text = $Arabic->utf8Glyphs(htmlspecialchars($input_text));
@zakariamouhid
zakariamouhid / fetch-jsonp.js
Last active November 12, 2020 22:56
simple jsonp that supports browser caching
const fetchJSONP = ((callback, callbackName) => {
const map = new WeakMap();
window[callbackName] = json => {
const script = document.currentScript;
const fn = map.get(script);
if (fn) {
map.delete(script);
fn(json);
script.remove();
}