Skip to content

Instantly share code, notes, and snippets.

View vasiliishvakin's full-sized avatar

Vasilii Shvakin vasiliishvakin

View GitHub Profile
@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();
@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=''
<?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");
<?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]];
@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])) {
# 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 / samba
Created May 18, 2016 09:39
init.d script for samba 4.4
#!/usr/bin/env bash
### BEGIN INIT INFO
# Provides: samba
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Should-Start: slapd
upstream php-www {
server unix:/var/run/php5-fpm.sock;
}
@vasiliishvakin
vasiliishvakin / Some.php
Created August 7, 2016 05:18
Get chail items
public function getImages()
{
if (null === $this->images) {
$command = new RelationLoadCommand(PageImageRelation::class, $this);
$this->images = $this->delegate($command);
}
return $this->images;
}
VERSION BUILD=9030808 RECORDER=FX
SET !EXTRACT_TEST_POPUP NO
'SET !SINGLESTEP YES
SET !LOOP 1
SET POSTITLE EVAL("var l=\"{{!LOOP}}\"; var r=l===1?2:l*2; r")
'PROMPT {{POSTITLE}} !VAR1
TAB T=1