Skip to content

Instantly share code, notes, and snippets.

View vkartaviy's full-sized avatar
🇺🇦
Slava Ukraini!

Volodymyr Kartavyi vkartaviy

🇺🇦
Slava Ukraini!
View GitHub Profile
@ircmaxell
ircmaxell / gist:4121166
Created November 20, 2012 21:12
Predictable Sequence Generator
<?php
class PseudoRandomGenerator {
protected $state = null;
public function __construct($seed) {
$this->state = $seed;
}
public function next($max) {
$bits = (int) floor(log($max, 2) + 1);
$bytes = (int) max(ceil($bits / 8), 1);
@jsor
jsor / Connection.php
Last active April 27, 2018 07:12
Async MySQL Client
<?php
namespace Jsor\MysqlAsync;
use React\EventLoop\LoopInterface;
use React\Promise\Deferred;
class Connection
{
private $loop;
@nikic
nikic / php-5.5-features.md
Last active August 31, 2020 10:39
List of new features in PHP 5.5
@jcward
jcward / StreamVideo.as
Created October 25, 2013 19:04
A simple example of playing a video stream in Flash (and vlc commands for serving the stream)
/**
* Streaming Video Test
*
* References:
* -----------
* http://serverfault.com/questions/288137/how-to-stream-live-video-from-a-linux-server
* https://wiki.videolan.org/Stream_VLC_to_Website_with_asf_and_Flash#Method_2_H264_and_Flash_.flv
* http://blog.morscad.com/code-snippets/creating-a-video-player-in-as3-using-netstream/
*
* Sample videos:
@vertexclique
vertexclique / cracking.md
Last active September 24, 2025 01:27
Cracking guide for Sublime Text 3 Build 3059 / 3065 ( Mac / Win x86_64 / Windows x86 / Linux x64 / Linux x86 )

MacOS

Build 3059

MD5: 59bab8f71f8c096cd3f72cd73851515d

Rename it to: Sublime Text

Make it executable with: chmod u+x Sublime\ Text

@paulirish
paulirish / what-forces-layout.md
Last active September 28, 2025 11:43
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@paullewis
paullewis / requestIdleCallback.js
Last active April 23, 2025 04:07
Shims rIC in case a browser doesn't support it.
/*!
* Copyright 2015 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@xem
xem / readme.md
Last active September 28, 2025 09:28
Maths & trigonometry cheat sheet for 2D & 3D games

Conventions

  • A = [xA, yA] is a point on the 2D plane. Same for B, C, ...
  • lengths are in any unit (ex: pixels)
  • code snippets are in JavaScript

Degrees to radians

angleRad = angleDeg * Math.PI / 180;

@dmnsgn
dmnsgn / WebGL-WebGPU-frameworks-libraries.md
Last active September 28, 2025 16:09
A collection of WebGL and WebGPU frameworks and libraries

A non-exhaustive list of WebGL and WebGPU frameworks and libraries. It is mostly for learning purposes as some of the libraries listed are wip/outdated/not maintained anymore.

Engines and libraries ⚙️

Name Stars Last Commit Description
three.js ![GitHub