Skip to content

Instantly share code, notes, and snippets.

View Cristy94's full-sized avatar
🏓
<3 Table tennis!

Buleandra Cristian Cristy94

🏓
<3 Table tennis!
View GitHub Profile
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
# Remove .php extension
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\ (.*)\.php [NC]
RewriteRule ^ %1 [R=301,NE,L]
# Check whether the file exists then set it back internally
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^.*$ $0.php [L,NE]
@Cristy94
Cristy94 / video-scroll-fix.js
Created March 25, 2021 19:56
Fix browser HTML5 video controls showing up while scrolling
// The problem is that if you have video controls (progress bar, full-screen button)
// they will pop up when video scrolls into viewport, leading to a distracting
// Solution: Remove controls via JS and only add them when video is hovered
<script>
(function() {
var videos = document.querySelectorAll('video');
var i;
for(i = 0; i < videos.length; ++i) {
(function (video) {
video.removeAttribute('controls');
@Cristy94
Cristy94 / EventSystem.ts
Created January 15, 2020 23:48
TypeScript simple global Event System
export const enum EventType {
INFO_UPDATED,
}
type DATA_INFO_UPDATED = string;
type IEventCallback<T> = (data: T) => void;
interface IEventSubscribers {
[eventType: number]: Array<IEventCallback<any>> | undefined;
inline int round_positive_float(float f)
{
return static_cast〈int〉(f + 0.5f);
}
class ControlledRandom
{
float state = 1.0f;
int index = 0;
static constexpr float constant_to_multiply[101] =
@Cristy94
Cristy94 / react-vscode-snippets.json
Created April 2, 2018 11:40
React Typescript VSCode snippets for quickly creating components (use shorthand 'rc' or 'rcc')
{
"React Connected Component": {
"prefix": "rcc",
"body": [
"import * as React from 'react';\r",
"import { connect } from 'react-redux';\r",
"\r",
"interface IOwnProps {\r",
"\r",
"}\r",