Skip to content

Instantly share code, notes, and snippets.

View DimaMinka's full-sized avatar
💻
CDK Computers - Modern Web Development

Dima Minka DimaMinka

💻
CDK Computers - Modern Web Development
View GitHub Profile
Vundle
TaskList
bufexplorer
vim-fugitive
gitv
vim-gutter
vim-airline
tabular
NERDTree
syntastic
@DimaMinka
DimaMinka / adminer.sh
Created April 10, 2018 11:54 — forked from mhemmings/adminer.sh
Download Adminer like a boss! Found myself often wanting to quickly put Adminer on a box for a few minutes while I investigated something but couldn't remember the URL. This script downloads Adminer and also has some cool extra functionality, including automatic deletion (see --help for usage)
#!/bin/bash
usage() {
printf "%s\n" "Usage: $0 [-m] [-e] [-o] [-c] [-d]"
printf "\t%s\n\t%s\n\t%s\n\t%s\n" \
"-m MySQL only" "-e English only" "-o Output file" \
"-c CSS file to download" "-d Auto-delete time (minutes)"
exit 1
}
@DimaMinka
DimaMinka / srdb.sh
Last active April 10, 2018 13:29
Search Replace DB downloader
#!/bin/bash
wget https://github.com/interconnectit/Search-Replace-DB/archive/master.zip
unzip master.zip
mv Search-Replace-DB-master srdb
rm master.zip
@DimaMinka
DimaMinka / README.md
Last active April 29, 2018 20:21
Modern WordPress Production Workflow

Modern WordPress Production Workflow

Our(CDK) modern workflow for easy development and support

Server

  • DigitalOcean Teams you can invite and manage users, ensure security with two factor authentication, and control your resource spend with centralized billing.
  • Droplet deploy
  • Monitoring - Collect metrics on visibility, monitor Droplet performance, and receive alerts when problems arise in your infrastructure — at no additional cost.
  • Backups - Affordable and easy-to-use automated backups built into the Droplet interface. Enabling this service on your Droplet can provide automatic, system-level backups at regular intervals, allowing you to easily revert or spin up new instances off of the created images. Pricing for backups is 20% of the cost of the virtual machine.
  • Snapshots - A snapshot could be taken prior to making any drastic changes to a server configuration, so that, should the changes be unsuccessful, you will have a version to r
@DimaMinka
DimaMinka / get-word-count.php
Created May 11, 2018 06:46 — forked from dikiyforester/get-word-count.php
Return information about words used in a string prior PHP 5.3
<?php
/**
* Counts words in a text string.
*
* Uses code from wp_trim_words().
*
* @param string $text Given text.
*/
function my_get_word_count( $text = '' ) {
$translations = get_translations_for_domain( 'default' );
@DimaMinka
DimaMinka / cdk_child_carbon_relationship_options
Created June 9, 2018 07:22
Get child pages relationship - Carbon Fields
/**
* Child pages filter
*
*/
function cdk_child_carbon_relationship_options( $options, $field_name ) {
if ($field_name == '_featured_articles') {
$parent_id = $_GET['post'];
$args = array(
'post_type' => 'page',

WordPress-dev-test

Simple test for modern web developers

Project init

  • vagrant/docker init with php7.1+, nginx, mysql
  • repo fork and branch checkout
  • bedrock clone
  • sage clone and install
  • make the commit, pull request and merge to the master
@DimaMinka
DimaMinka / nginx.conf
Created August 20, 2018 16:14
multisite bedrock fix for url
if (!-e $request_filename) {
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ /wp/$1 last;
rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) /wp/$1 last;
}
@DimaMinka
DimaMinka / .htaccess
Created August 27, 2018 10:22 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@DimaMinka
DimaMinka / registration_errors.php
Created September 3, 2018 06:55
Disable email requirements on new WordPress user registration - register_new_user
<?php
add_filter( 'registration_errors', function( $errors ){ return new WP_Error(); }, 10, 1 );