Skip to content

Instantly share code, notes, and snippets.

View alroniks's full-sized avatar

Ivan Klimchuk alroniks

View GitHub Profile
#!/bin/bash
DEPLOY_PATH="/var/www/site"
DEPLOYER_PATH="deploy.js"
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do
TARGET="$(readlink "$SOURCE")"
if [[ $SOURCE == /* ]]; then
var fs = require('fs');
var Connection = require('ssh2');
var chokidar = require('chokidar');
var c = new Connection();
var local_path;
var deploy_path;
process.argv.forEach(function (val, index, array) {
var item_arr = val.split('=');
@alroniks
alroniks / maketree.php
Last active December 29, 2015 17:29
makeTree
<?php
function makeTree($list, $parent)
{
$tree = [];
foreach ($list as $item) {
if ($item['parent'] == $parent) {
$tree[$item['id']] = makeTree($list, $item['id']);
} else {
continue;
}
<?php
$from = "en";
$to = "ru";
$_lang = [];
$dir = "/home/ik/dev2/revolution/core/lexicon/" . $from;
$files = scandir($dir);
@alroniks
alroniks / gist:3436764
Created August 23, 2012 13:47
Price formatter
$string = '1000000000';
$array = preg_split('/(?<!^)(?!$)/u', $string);
$array = array_chunk(array_reverse($array), 3);
foreach($array as &$a){
$a = implode("", $a);
}
$result = implode(" ", array_reverse($array));