Skip to content

Instantly share code, notes, and snippets.

Avatar
🏓
<3 Table tennis!

Buleandra Cristian Cristy94

🏓
<3 Table tennis!
View GitHub Profile
View .htaccess remove PHP extension
# 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 Mar 25, 2021
Fix browser HTML5 video controls showing up while scrolling
View video-scroll-fix.js
// 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 Jan 15, 2020
TypeScript simple global Event System
View EventSystem.ts
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;
View controlle-randomness.cpp
inline int round_positive_float(float f)
{
return static_castint〉(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 Apr 2, 2018
React Typescript VSCode snippets for quickly creating components (use shorthand 'rc' or 'rcc')
View react-vscode-snippets.json
{
"React Connected Component": {
"prefix": "rcc",
"body": [
"import * as React from 'react';\r",
"import { connect } from 'react-redux';\r",
"\r",
"interface IOwnProps {\r",
"\r",
"}\r",