Skip to content

Instantly share code, notes, and snippets.

View lezhnev74's full-sized avatar
🐘
Eating the elephant in pieces

Dmitry Lezhnev lezhnev74

🐘
Eating the elephant in pieces
View GitHub Profile
@Akimkin
Akimkin / tzlist.php
Last active December 8, 2022 08:46
Get list of timezones translated to given language in PHP
<?php
/**
* Get list of timezones translated in given language
*
* Requires PHP Intl extension to be present & active in your PHP setup
*
* @param string $langcode - an ISO 639-1 language code
* @return array
*/
@pokap
pokap / assertArraySimilar.php
Last active August 9, 2022 15:08
[PHPunit] assert two arrays are equal, but ignore orders
<?php
trait ArrayTestCaseTrait
{
/**
* Asserts that two associative arrays are similar.
*
* Both arrays must have the same indexes with identical values
* without respect to key ordering
*
@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active April 15, 2024 02:19
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@davidrushton
davidrushton / Kernel.php
Created February 17, 2016 17:29
Laravel 5 Database Queue - Shared Hosting
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
@esatemre
esatemre / elastic.js
Created October 23, 2015 10:43
ElasticSearch Support for jQuery-QueryBuilder
*!
* jQuery QueryBuilder ElasticSearch Filter Support
* Allows to convert exported rules as a ElasticSearch filter query object.
* Copyright 2015 Esat Emre Demirel (http://blog.esatemre.com)
*/
function getRawFilter(data) {
var hede = parse(data);
return JSON.stringify(hede);
}
function parse(data) {
@mindplay-dk
mindplay-dk / session-life-cycle.md
Last active March 28, 2024 19:52
Complete overview of the PHP SessionHandler life-cycle

This page provides a full overview of PHP's SessionHandler life-cycle - this was generated by a set of test-scripts, in order to provide an exact overview of when and what you can expect will be called in your custom SessionHandler implementation.

Each example is a separate script being run by a client with cookies enabled.

To the left, you can see the function being called in your script, and to the right, you can see the resulting calls being made to a custom session-handler registed using session_set_save_handler().

@barryvdh
barryvdh / .phpstorm.meta.php
Last active October 20, 2021 22:16
Laravel PhpStorm Meta file
<?php
namespace PHPSTORM_META {
/**
* PhpStorm Meta file, to provide autocomplete information for PhpStorm
* Generated on 2017-09-28.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
@xdamman
xdamman / install_ffmpeg_ubuntu.sh
Created July 2, 2014 21:03
Install latest ffmpeg on ubuntu 12.04 or 14.04
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update