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 / wp-image-placeholder.php
Created January 8, 2020 18:28 — forked from mihdan/wp-image-placeholder.php
Заменяет битые ссылки на кратинки в WordPress на заглушки. Удобно, например на тестовом сайте, чтобы не переносить фотки с боевого.
<?php
/**
* Plugin Name: Mihdan: Image Placeholder
*/
namespace Mihdan\Image_Placeholder;
$images = array(
// Обычные
'https://placeimg.com/640/480/animals',
@zorca
zorca / slugify.js
Created December 27, 2019 18:01 — forked from mathewbyrne/slugify.js
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
@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...
@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 / 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 / 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 / .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: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 / 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*/
/**
* После добавления товара в корзину - показать мадолбное окно
*/
$( 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 = '';