Skip to content

Instantly share code, notes, and snippets.

View zorca's full-sized avatar
✴️
Working from a faraway star

Zorca Orcinus zorca

✴️
Working from a faraway star
View GitHub Profile
@zorca
zorca / wordpress.sh
Created March 12, 2019 16:52 — forked from durvalrafael/wordpress.sh
Wordpress permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
@zorca
zorca / parse_version_numbers.php
Created March 14, 2019 10:00 — forked from stevenrombauts/parse_version_numbers.php
Parse version numbers into major/minor/patch values
<?php
$versions = array('1.0 RC1', '1.0 RC2', '1.0 RC3', '1.0 RC4', '1.0 RC5', '1.0 RC6', '1.5.0', '1.5.1', '1.5.10', '1.5.11', '1.5.12', '1.5.13', '1.5.14', '1.5.15', '1.5.2', '1.5.3', '1.5.4', '1.5.5', '1.5.6', '1.5.7', '1.5.8', '1.5.9', '1.6.0', '1.6.1', '1.6.2', '1.6.3', '1.6.4', '1.6.5', '1.6.6', '1.6.7', '5.3.5-1ubuntu7.11', '2.14 RC1', '3.12RC5');
foreach($versions as $version)
{
$result = preg_match("/^(\d+)\.(\d+)[\. \-]?([a-z0-9\-\.]+)$/i", $version, $matches);
if($result)
{
$major = (int) $matches[1];
/**
* После добавления товара в корзину - показать мадолбное окно
*/
$( document.body ).on('adding_to_cart', function( a, b ) {
var $btn = $( b[0] );
var product_title = $btn.data('product_title');
if ( product_title ) {
var tpl = '';
@zorca
zorca / database.php
Created July 16, 2019 18:19 — forked from tigusigalpa/database.php
Laravel PostgreSQL SSL encryption connection config
<?php
/**
* 1. You have to store your client SSL certificates on your Laravel server, in my case this is /var/certs/mydomain.com/...
* 2. You have to right select SSL mode for PostgreSQL (see https://www.postgresql.org/docs/current/libpq-ssl.html#LIBPQ-SSL-SSLMODE-STATEMENTS), verify-full means your server CA is signed for real domain name for the PostgreSQL server (recommended)
* 3. Go to Laravel config/database.php to the section 'pgsql' and extend it to the following:
*/
return [
/*...*/
'connections' => [
/*'mysql' etc*/
@zorca
zorca / gist:e751654dec0a6481e0c356fd1c756b22
Created September 5, 2019 07:02 — forked from kagg-design/gist:7cbda38a3ce76c0502748f8ddbc9bebe
Remove current action or filter from plugin
<?php
/**
* Remove current action or filter from plugin
*
* @param string $class_name Class name enqueueing the action.
* @param null $action_name Action name.
*/
function remove_plugin_action( $class_name, $action_name = null ) {
global $wp_filter;
@zorca
zorca / .editorconfig
Created September 15, 2019 10:42 — forked from davidlonjon/.editorconfig
.editorconfig for WordPress
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org
# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/
root = true
[*]
charset = utf-8
@zorca
zorca / gist:ae5834cdab8f72ab7752592e38f67b75
Created October 18, 2019 18:19 — forked from szydan/gist:75b8a03b3fb4e099d5c1
delete all commits from repo
git checkout --orphan latest_branch && \
git add -A && \
git commit -am "initial commit" && \
git branch -D master && \
git branch -m master && \
git push -f origin master
Taken from
@zorca
zorca / download.php
Created October 28, 2019 07:21 — forked from beyerz/download.php
Symfony console, download remote file with progress bar using guzzle
/**
* @param SymfonyStyle $io
* @param $remotePath
*
* @return string
*/
public function download(SymfonyStyle $io, $remotePath)
{
$io->section("Download " . $remotePath);
$parts = parse_url($remotePath);
@zorca
zorca / functions.php
Created October 28, 2019 09:04 — forked from ericclemmons/functions.php
Auto-activate WordPress Plugins
<?php
// Add to: path/to/wp-content/wp-themes/your-theme/functions.php
/**
* Activate required plugins
*/
include_once ( ABSPATH . 'wp-admin/includes/plugin.php' );
@zorca
zorca / gist:96f99cbc6033a7d0963a0b1b20e758d7
Created November 14, 2019 18:31 — forked from dancourse/gist:92cf77829e5b0b5bba62
Laravel Homestead blackfire setup
# Edit out homestead settings
homestead edit
# Enter your details, https://blackfire.io/account/credentials
# See re-provision your homestead box
vagrant global-status
vagrant provision ???? # << this is the id of the homestead instance you have running, from global-status
# So far this didn't work so carry on...