Skip to content

Instantly share code, notes, and snippets.

View abdo-host's full-sized avatar
🏠
Working from home

Abdo Hamoud abdo-host

🏠
Working from home
View GitHub Profile
@KristofferEriksson
KristofferEriksson / useBroadcastChannel.ts
Created February 5, 2024 09:20
A React hook that allows you to send and receive messages between browser tabs or windows
import { useCallback, useEffect, useRef, useState } from "react";
interface UseBroadcastChannelOptions {
name: string;
onMessage?: (event: MessageEvent) => void;
onMessageError?: (event: MessageEvent) => void;
}
interface UseBroadcastChannelReturn<D, P> {
isSupported: boolean;
@abdo-host
abdo-host / country-flag.json
Created January 16, 2024 23:24 — forked from pratikbutani/country-flag.json
A JSON for Country List with Flag Image
[
{
"flag": "https://twemoji.maxcdn.com/2/svg/1f1e6-1f1e8.svg",
"country": "Ascension Island",
"code": "ac"
},
{
"flag": "https://twemoji.maxcdn.com/2/svg/1f1e6-1f1e9.svg",
"country": "Andorra",
"code": "ad"
@nezamy
nezamy / gulpfile.js
Last active December 23, 2023 21:54
Post Css & Sass & RTL Gulp Config
const { src, dest, watch, series, task } = require('gulp');
const postcss = require('gulp-postcss');
const autoprefixer = require('autoprefixer');
const cssnext = require('cssnext');
const precss = require('precss');
const cssnano = require('cssnano');
const sass = require('gulp-sass');
const fontMagician = require('postcss-font-magician');
const rtlcss = require('rtlcss');
const rename = require('gulp-rename');
@james2doyle
james2doyle / slim-stream-route.php
Created January 10, 2018 06:05
Create a streaming download of a large file with Slim PHP using the build in Stream class
<?php
use Slim\Http\Request;
use Slim\Http\Response;
use Slim\Http\Stream;
$app->get('/stream', function (Request $request, Response $response, array $args) {
// a 100mb file
$path = '../public/files/document.pdf';
@revant
revant / Procfile
Last active February 22, 2024 14:17
Use node server with frappe-bench
redis_cache: redis-server config/redis_cache.conf
redis_socketio: redis-server config/redis_socketio.conf
redis_queue: redis-server config/redis_queue.conf
web: bench serve --port 8000
socketio: /usr/bin/node apps/frappe/socketio.js
custom_app: /usr/bin/node apps/custom_app/custom_node.js
watch: bench watch
schedule: bench schedule
worker_short: bench worker --queue short
@resmall
resmall / gist:51b328aa303b15979e77
Last active October 15, 2022 22:14
Imports an sql file and execute the script in Laravel Seeder
public function run() {
DB::unprepared(File::get('path/to/SQL/file'));
}
@champsupertramp
champsupertramp / currency_list
Last active January 27, 2024 01:35 — forked from MindaugasR/currency_list
World Currency list in PHP Array
array (
'ALL' => 'Albania Lek',
'AFN' => 'Afghanistan Afghani',
'ARS' => 'Argentina Peso',
'AWG' => 'Aruba Guilder',
'AUD' => 'Australia Dollar',
'AZN' => 'Azerbaijan New Manat',
'BSD' => 'Bahamas Dollar',
'BBD' => 'Barbados Dollar',
'BDT' => 'Bangladeshi taka',