Skip to content

Instantly share code, notes, and snippets.

View vasiliishvakin's full-sized avatar

Vasilii Shvakin vasiliishvakin

View GitHub Profile
# Local Machine Hosts
#
# If the Vagrant plugin hostsupdater (https://github.com/cogitatio/vagrant-hostsupdater) is
# installed, the following will automatically configure your local machine's hosts file to
# be aware of the domains specified below. Watch the provisioning script as you may be
# required to enter a password for Vagrant to access your hosts file.
#
# By default, we'll include the domains setup by dv through the dv-hosts file
# located in the www/ directory.
#
@vasiliishvakin
vasiliishvakin / ArrayUtils.php
Created December 11, 2013 06:01
array merge_recursive function for config in arrays and etc.
<?php
class ArrayUtils {
public static function merge_recursive()
{
$arrays = func_get_args();
$merged = array_shift($arrays);
foreach ($arrays as $currentArray) {
foreach ($currentArray as $key => $value) {
if (is_array($value) && isset ($merged[$key]) && is_array($merged[$key])) {
<?php
$indexes = {0, 'Data', 'name'};
function get_value($indexes, $arrayToAccess)
{
if(count($indexes) > 1)
return get_value(array_slice($indexes, 1), $arrayToAccess[$indexes[0]]);
else
return $arrayToAccess[$indexes[0]];
<?php
//cache
$seconds_to_cache = 60*60*24*36*3;
$ts = gmdate("D, d M Y H:i:s", time() + $seconds_to_cache) . " GMT";
header("Expires: $ts");
header("Pragma: cache");
header("Cache-Control: max-age=$seconds_to_cache");
@vasiliishvakin
vasiliishvakin / mysql_db_sync
Last active July 10, 2024 08:10
Simple bash script to sync remote mysql db to local
#!/bin/bash
LOCAL_DB=""
REMOTE_DB=""
LOCAL_USER="root"
LOCAL_PASS=""
REMOTE_USER="root"
REMOTE_PASS=''
@vasiliishvakin
vasiliishvakin / PhpAmqpLib.test.php
Created July 5, 2012 04:57
simple usage PhpAmqpLib
<?php
/**
* @author orbisnull
*/
class Admin_AmpqController extends Zend_Controller_Action
{
public function testAction()
{
$this->_helper->layout()->disableLayout();