Skip to content

Instantly share code, notes, and snippets.

View hisorange's full-sized avatar
😀
Having Fun

Zsolt Varga hisorange

😀
Having Fun
View GitHub Profile
@hisorange
hisorange / prerender.worker.js
Created October 17, 2022 10:46
Prerender New Worker
// User agents handled by Prerender
const BOT_AGENTS = [
"googlebot",
"yahoo! slurp",
"bingbot",
"yandex",
"baiduspider",
"facebookexternalhit",
"twitterbot",
"rogerbot",
@hisorange
hisorange / opwork.sh
Created October 2, 2022 23:21
OpWork Starter
docker run -it -p80:3000 opwork/runtime:latest
@hisorange
hisorange / ReactGateway.ts
Created January 17, 2022 00:00
React dev server gateway in Fastify
import { FastifyInstance } from 'fastify';
import staticMiddleware from 'fastify-static';
import { readFile } from 'fs/promises';
import { join } from 'path';
import { ILogger, Logger, Service } from '../../../app/container';
import { ROOT_DIR } from '../../../app/globals';
import { IHttpGateway } from '../../http/interface/http-gateway.interface';
@Service({
tags: 'http:gateway',
@hisorange
hisorange / ConvertArrayToCsv.php
Created May 29, 2018 20:35
ConverArrayToCsv.php
<?php
function ConvertArrayToCsv(
array $subject,
string $delimiter = ';',
string $enclosure = '"',
string $escape = '\\',
bool $pure = false
): string {
// Create a temporary resource.
$temp = tmpfile();
atomsync
@hisorange
hisorange / gist:24b2bcfaa469d3e767a0
Last active August 29, 2015 14:01
Mime types by extensions.
$mime = [
'3dm' => 'x-world/x-3dmf',
'3dmf' => 'x-world/x-3dmf',
'a' => 'application/octet-stream',
'aab' => 'application/x-authorware-bin',
'aam' => 'application/x-authorware-map',
'aas' => 'application/x-authorware-seg',
'abc' => 'text/vnd.abc',
'acgi' => 'text/html',
'afl' => 'video/animaflex',
@hisorange
hisorange / gist:10675123
Created April 14, 2014 19:09
work after disconnection
function endOutput($endMessage){
ignore_user_abort(true);
set_time_limit(0);
header("Connection: close");
header("Content-Length: ".strlen($endMessage));
echo $endMessage;
echo str_repeat("\r\n", 10); // just to be sure
flush();
}