Skip to content

Instantly share code, notes, and snippets.

View dmitry-udod's full-sized avatar

Dima Udod dmitry-udod

View GitHub Profile
@dmitry-udod
dmitry-udod / ttl.php
Last active February 13, 2023 08:13
Cache TTL with time jitter
$ttl = (int) (3600 + (mt_rand() / mt_getrandmax() * (60 * 2))); /* +/- 2 minutes */
@dmitry-udod
dmitry-udod / .travis.yml
Created July 13, 2018 13:50
TravisCI for Laravel 5.6 (PostgreSQL, PHPUnit)
os:
- linux
language: php
php:
- '7.1'
services:
- postgresql
I, you, we, they + do
He, she, it + does
I, you, we, they + do not / don’t + do
He, she, it + does not / doesn’t + do
Do + I, you, we, they + do?
Does + he, she, it + do?
-ss, -ch, -sh, -x в конце глагола + -es: fix – fixes
согласный + -y в конце глагола + -es: study – studies
гласный + -y в конце глагола + -s: play – plays
@dmitry-udod
dmitry-udod / laravel_bik_validation.php
Last active April 24, 2019 13:20
Валидация банковских данных. соответствие БИК и расчетного счета (корреспондентского) банка (Laravel). Bank data validation bik and accounts
<?php
namespace App\Rules;
use Illuminate\Contracts\Validation\Rule;
class CheckBankAccount implements Rule
{
public $bikForTest = '';
select DISTINCT ON (t.orders) * from (select max(id) id, max(email), max(orders) as orders, campaign_id from coupons group by campaign_id ORDER BY orders DESC) as t ORDER BY t.orders DESC
@dmitry-udod
dmitry-udod / gist:25ffec34abbdbd8648835c4f44832a4f
Created August 30, 2016 13:10
Golang convert int or string to int
package main
import (
"encoding/json"
"fmt"
"log"
)
type Object struct {
Num json.Number
@dmitry-udod
dmitry-udod / .zshrc
Last active August 29, 2015 14:23 — forked from andboson/.zshrc
export GOPATH=`pwd`
export PATH="$PATH:$GOPATH/bin"
echo -e "\033[0;32m CURRENT GOPATH IS: $GOPATH \e[0m"
alias rp='source ~/.zshrc'
@dmitry-udod
dmitry-udod / ReactPHP process POST request
Created May 12, 2014 08:22
ReactPHP process POST request
$http->on('request', function ($request, $response) {
$sink = new React\Stream\BufferedSink();
$request->pipe($sink);
$sink->promise()->then(function ($requestBody) use ($response) {
parse_str($requestBody, $requestData);
var_dump($requestData);
$response->writeHead();
$response->end("Hi, thanks man.\n");
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "Video Catalog",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.3",