Skip to content

Instantly share code, notes, and snippets.

View TamiasSibiricus's full-sized avatar

Denys Kyselov TamiasSibiricus

View GitHub Profile
<?php
/**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
@TamiasSibiricus
TamiasSibiricus / CustomView.php
Created July 8, 2014 14:31
Possible prefixed layout solution
<?php
namespace App\View;
use Cake\View\View;
class CustomView extends View {
/**
* Returns layout filename for this template as a string.
*
@TamiasSibiricus
TamiasSibiricus / Cell.php
Last active August 29, 2015 14:05
merge view helpers with cell helpers
<?php
/**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
@TamiasSibiricus
TamiasSibiricus / 20141015141853_initial.php
Last active August 29, 2015 14:08
Sample failes for migrations plugin test
// config/Migrations/20141015141853_initial.php
<?php
use Phinx\Migration\AbstractMigration;
class Initial extends AbstractMigration
{
/**
@TamiasSibiricus
TamiasSibiricus / App_routes.php
Created December 13, 2014 11:46
Routes confict
<?php
/**
* App Routes configuration App/config/routes.php
*
* In this file, you set up routes to your controllers and their actions.
* Routes are very important mechanism that allows you to freely connect
* different URLs to chosen controllers and their actions (functions).
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<?php
/*
* Routing sample
* Router::scope('/', function ($routes) {
* $routes->fallbacks('InflectedRoute');
* });
* Router::connect(
* '/:slug',
* ['controller' => 'Articles', 'action' => 'view'],
* ['routeClass' => 'SlugRoute']
@TamiasSibiricus
TamiasSibiricus / imscp_migration
Created April 1, 2016 12:03 — forked from b13n1u/imscp_migration
I-MSCP migration from old server to a new one.
#Migrate i-mscp to a new server
#the new imscp is already installed and does have a different IP than the old one
#1. Dump the DB and copy the i-MSCP backup to new server:
rsync -rave "ssh -l root" /var/www/imscp/backups 10.0.0.3:/var/tmp/imscp_old_backups
#2.Install the old config DB
#3. Copy all customer data:
rsync -rave "ssh -l root " /var/www/virtual/ 10.0.0.3:/var/www/virtual

Opening and closing an SSH tunnel in a shell script the smart way

I recently had the following problem:

  • From an unattended shell script (called by Jenkins), run a command-line tool that accesses the MySQL database on another host.
  • That tool doesn't know that the database is on another host, plus the MySQL port on that host is firewalled and not accessible from other machines.

We didn't want to open the MySQL port to the network, but it's possible to SSH from the Jenkins machine to the MySQL machine. So, basically you would do something like

ssh -L 3306:localhost:3306 remotehost

<?php
class WP_Meta_Query {
//...
protected function get_sql_for_query( &$query, $depth = 0 ) {
$sql_chunks = array(
'join' => array(),
'where' => array(),
);
$sql = array(
@TamiasSibiricus
TamiasSibiricus / cloudSettings
Created September 22, 2018 20:58
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-09-22T20:58:23.786Z","extensionVersion":"v3.1.2"}