Skip to content

Instantly share code, notes, and snippets.

View asanikovich's full-sized avatar
🏠
Working from home

Aliaksei Sanikovich asanikovich

🏠
Working from home
View GitHub Profile
@ethaizone
ethaizone / redirect_mobile_to_app_store.php
Last active May 24, 2022 17:56
[PHP] Auto redirect to app store. (Android/IOS)
<?php
// android store
if (preg_match('#android#i', $_SERVER ['HTTP_USER_AGENT'])) {
header('Location: market://details?id=com.google.android.apps.maps');
exit;
}
// ios
if (preg_match('#(iPad|iPhone|iPod)#i', $_SERVER ['HTTP_USER_AGENT'])) {
@lig
lig / index.html
Created May 20, 2016 14:38
IT talk - DataArt - Voronezh - Trip Planner
<!doctype html>
<html lang="en" ng-app="plannerApp">
<head>
<title>IT talk - DataArt - Voronezh - Trip Planner</title>
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet"
href="https://rawgit.com/kuhnza/angular-google-places-autocomplete/master/dist/autocomplete.min.css">
Разница между HASH и BTREE индесами в MySQL
Hash:
- представляет собой результат функции по ключу
- не видит растояния до ближайших элементов
- не может использоваться для операций диапазонов > и <
- сравнивание ключа целиком
- линейный при индексировании
- О(1) при вытаскивании значения
@judy2k
judy2k / parse_dotenv.bash
Created March 22, 2017 13:34
Parse a .env (dotenv) file directly using BASH
# Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs) MYCOMMAND
# … or ...
# Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs)
Verb URI Action Route Name View Policy Middleware
GET /resources index resources.index resources.list list can:list,Resource::class
GET /resources/create create resources.create resources.create create can:create,Resource::class
POST /resources store resources.store create can:create,Resource::class
GET /resources/{resource} show resources.show resources.show view can:view,resource
GET /resources/{resource}/edit edit resources.edit resources.edit update can:update,resource

|

@sklppr
sklppr / 0-refresher.md
Created April 5, 2017 11:03
Advanced application architecture

Refresher on anti-patterns and best practices

Most important basic philosophy “simple vs. easy”: Rails Conf 2012 Keynote: Simplicity Matters by Rich Hickey (Slides)

You probably know this already and in Ruby not all of it is done “explicitly” but it’s important to have these principles in mind when getting to know the following architecture concepts.

STUPID: Singleton, Tight Coupling, Untestability, Premature Optimization, Indescriptive Naming, Duplication
SOLID: Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion

@stfeng2
stfeng2 / cloud_sql_flags.md
Last active January 8, 2024 06:47
Cloud SQL Flags Tuning

Important Notice

  • ❗ All flags and settings described here are subject to change without any notice.
  • Last update: September 2017

Introduction

This document describes a set of MySQL flags that have been tuned in Google Cloud SQL (Second Generation) to make the out-of-box experience better on Google Cloud. This is for your reference only, with the hope that some of the settings might also be useful outside the Google Cloud environment.

innodb_buffer_pool_size

@klimslim
klimslim / warmup.php
Created October 9, 2017 10:03
Zend opcache warmup
<?php
$start = microtime(true);
$files = 0;
$errors = 0;
foreach (['/home/httpd/html/'] as $path) {
// Get the realpath and check it's valid
$path = realpath($path);
if (!$path) {
continue;
}
@adampatterson
adampatterson / sample.php
Created October 18, 2017 00:50
Whoops PHP Storm Config
<?php
namespace App\Exceptions;
use Exception;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
{
@AndreiTelteu
AndreiTelteu / Custom bread field type .md
Last active February 26, 2024 09:37
Custom bread field type stored in json format. For Laravel + Voyager admin panel

1. A new file: /app/Admin/FormFields/CustomFieldHandler.php

<?php
namespace App\Admin\FormFields;

use TCG\Voyager\FormFields\AbstractHandler;

class CustomFieldHandler extends AbstractHandler
{