Skip to content

Instantly share code, notes, and snippets.

View zetrider's full-sized avatar

T.Kalimullin zetrider

View GitHub Profile
@zetrider
zetrider / RoutestTest.php
Created October 9, 2021 06:36
Laravel test via DebugBar
<?php
namespace Tests\Feature;
use Tests\TestCase;
class RoutesTest extends TestCase
{
const PHP_VERSION = '7.4.22';
const MAX_TIME_DURATION_SECONDS = 1;
@zetrider
zetrider / Detect TestFlight, XCode, Simulator, AppStore
Created June 4, 2021 20:31
Detect TestFlight, XCode, Simulator, AppStore
enum Environment: String {
case production = "production"
case development = "development"
}
func env() -> Environment {
// TestFLight, Xcode
if Bundle.main.appStoreReceiptURL?.lastPathComponent == "sandboxReceipt" {
return .development
}
@zetrider
zetrider / 8-1.html
Created February 21, 2021 16:16
8-1
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
</head>
<body>
@zetrider
zetrider / laravel_bash_deploy.sh
Last active February 24, 2021 11:40
Laravel: Bash deploy
#!/bin/sh
# Grant privileges
# echo "YOUR_USER ALL=NOPASSWD: /usr/sbin/service php7.4-fpm reload" | sudo tee -a /etc/sudoers.d/php-fpm > /dev/null
# echo "YOUR_USER ALL=NOPASSWD: /usr/sbin/service nginx restart" | sudo tee -a /etc/sudoers.d/php-fpm > /dev/null
# echo "YOUR_USER ALL=NOPASSWD: /usr/sbin/service supervisor restart" | sudo tee -a /etc/sudoers.d/php-fpm > /dev/null
NAME=$(date +"%m-%d-%Y-%H-%M-%S")
FOLDER=releases/$NAME
BACKUP=backup/before_$NAME.sql
/**
* Sync morphToMany
*
* @param morphToMany $morphToMany
* @param array $ids
* @return array
*/
public static function syncMorphToMany($morphToMany, $ids)
{
$changes = [
@zetrider
zetrider / Ubuntu: php-fpm, nginx, mariadb, ssh
Last active February 21, 2021 17:06
Ubuntu: php-fpm, nginx, mariadb, ssh
#scp ~/.ssh/id_rsa.pub [email protected]:~
# [ -d ~/.ssh ] || (mkdir ~/.ssh; chmod 711 ~/.ssh)
# cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
# chmod 600 ~/.ssh/authorized_keys
# rm ~/id_rsa.pub
apt install -y software-properties-common
add-apt-repository ppa:ondrej/php
# add-apt-repository universe
@zetrider
zetrider / WordPress - replace serialize options
Created September 13, 2019 16:54
old domain to new domain
<?
global $wpdb;
define('MY_OLD_DOMAIN', 'http://olddomain.ru');
define('MY_NEW_DOMAIN', 'http://newdomain.ru');
function myWalkCallback(&$item, $key)
{
$item = str_replace(MY_OLD_DOMAIN, MY_NEW_DOMAIN, $item);
}
@zetrider
zetrider / css
Created May 12, 2019 18:36
Bootstrap4 Debug Grid
.bootstrap-grid {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 9999;
width: 100%;
height: 100%;
}
@zetrider
zetrider / brew upgrade Sierra
Created February 2, 2017 08:47
Error: /usr/local must be writable!
1. sudo chown -R $(whoami) /usr/local
2. brew update
3. sudo chmod 0755 /usr/local
4. sudo chown root:wheel /usr/local
5. brew upgrade
hg revert --all -r-1