Skip to content

Instantly share code, notes, and snippets.

flip111 /
Created Mar 22, 2020
Actix GraphQL over websocket
// Combination of:
mod schema;
use crate::schema::{create_schema, Schema};
use actix::prelude::*;
use actix_web::{middleware, web, App, Error, HttpRequest, HttpResponse, HttpServer};
use actix_web_actors::ws;
flip111 / cartesian.php
Created Mar 26, 2019
Cartesian product PHP algorithm benchmark (see comments for results)
View cartesian.php
$decimals = 2;
// test iterations
$iterations = 1000;
printf("Iterations: %d\n\n", $iterations);
flip111 / lcs.php
Created Mar 7, 2019
Longest common substring PHP algorithm benchmark (see comments for results)
View lcs.php
// reset && /usr/bin/time php lcs.php
$utf8test = true; // utf8 or ascii test input
$decimals = 2;
// test iterations
// amount is chosen so that each test takes about 10 minutes on my PC (AMD Ryzen 2400G)
// tune: round((10×60) × (iterations / runtime)) for 10 minutes
if ($utf8test) {
flip111 /
Last active Dec 27, 2017
using aiohttp together with other asyncio
# other stuff before this (imports & other code)
runner = run_app_nonblocking.setup_app(app, host='localhost', port=8080)
# Extra asyncio stuff here
loop = asyncio.get_event_loop()
# maybe add another site
extra_site = web_runner.TCPSite(runner, "", 8099,
flip111 / Main.hs
Created Jan 3, 2016
cropping an image with JuicyPixels
View Main.hs
module Main where
import Codec.Picture
import Codec.Picture.Types
import Debug.Trace
type X = Int
type Y = Int
type Width = Int
type Height = Int
flip111 / MysqlJoin.php
Created Dec 8, 2013
Support for STRAIGHT_JOIN in Doctrine. This does not work (yet) because not having a clean way to implement it. But making these changes in Doctrine directly will work.
View MysqlJoin.php
* DoctrineExtensions Vendor Specific DQL Query Features
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email