Skip to content

Instantly share code, notes, and snippets.

View xxzefgh's full-sized avatar

Mirza Brunjadze xxzefgh

  • Tbilisi, Georgia
View GitHub Profile
const vp9CodecType = 'video/webm; codecs="vp9"'
function checkMediaSourceWay() {
return 'MediaSource' in window && MediaSource.isTypeSupported(vp9CodecType)
}
function checkHTMLMediaElementWay() {
return document.createElement('video').canPlayType(vp9CodecType) === 'probably'
}
export function snakeToCamel(str) {
return str.toLowerCase().replace(/_(.)/g, (match, $1) => $1.toUpperCase())
}
@xxzefgh
xxzefgh / nginx_reverse_proxy.conf
Created April 30, 2017 09:50
Nginx reverse proxy example configuration
upstream example {
server localhost:8080;
}
server {
listen 80;
server_name example.com;
server_tokens off;
location / {
@xxzefgh
xxzefgh / random-non-overlapping-position.js
Created March 21, 2017 04:46 — forked from magicznyleszek/random-non-overlapping-position.js
JavaScript -- get random non-overlapping position
// declarations
var positions = [];
// Returns a random integer between min (included) and max (excluded)
// Using Math.round() will give you a non-uniform distribution!
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
}
// generate random positions
<?php
namespace App;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
#!/bin/bash
app_path="/path/to/target/folder"
if [ ! -d $app_path ]; then
mkdir -p $app_path;
fi
while read oldrev newrev ref
do
@xxzefgh
xxzefgh / LaravelBridge.php
Last active May 5, 2016 09:34
Call Laravel routes and get response from pure php. Useful when you have existing project and want to use Laravel to achieve some tasks.
<?php
class LaravelBridge
{
private static $app = null;
private static $kernel = null;
private static function init()
{
if (!self::$app || !self::$kernel) {