Skip to content

Instantly share code, notes, and snippets.

View alroniks's full-sized avatar

Ivan Klimchuk alroniks

View GitHub Profile
@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));
<?php
$from = "en";
$to = "ru";
$_lang = [];
$dir = "/home/ik/dev2/revolution/core/lexicon/" . $from;
$files = scandir($dir);
@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;
}
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('=');
#!/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
@alroniks
alroniks / lang.php
Created January 16, 2014 10:32
Script for add all files of modx lexicons to trasifex
<?php
$cmdSource = 'tx set --source -r modx-revolution.core-{:slug} -l {:lang} core/lexicon/{:lang}/{:file} -t PHP_ALT_ARRAY';
$cmdTransl = 'tx set -r modx-revolution.core-{:slug} -l {:lang} core/lexicon/{:lang}/{:file} -t PHP_ALT_ARRAY';
$search = ['{:slug}', '{:file}', '{:lang}'];
$langs = [
'ru',
'de',
'cs',
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
Updated for MODx Revo by: Hansek http://www.modxcms.cz/ [email protected]
Created for MODx Evo by : Coroico (http://modx.wangba.fr)
Short Description: Language files checking tool for MODx Revolution
Version: 1.2
Created by: Coroico (http://modx.wangba.fr)

#Release 1.0.13 from 03.03.2014.

This release includes quite a few changes and improvements that would make simpler of creating sites on MODX EVO.

Fixes: 44
Refactoring: 42
Improvements: 24
Security: 1

##Main things, on that I would like to draw attention:

@alroniks
alroniks / .vimrc
Created March 10, 2014 12:19 — forked from JeffreyWay/.vimrc
set nocompatible " Disable vi-compatibility
set t_Co=256
colorscheme xoria256
set guifont=menlo\ for\ powerline:h16
set guioptions-=T " Removes top toolbar
set guioptions-=r " Removes right hand scroll bar
set go-=L " Removes left hand scroll bar
set linespace=15
@alroniks
alroniks / extends
Last active August 29, 2015 14:08
extends
<?php
/*
* Nested templates in MODX Revolution
*
* Using: Make layout template and call it in other template as [[>layout]]
* Use [[@yield]] for determine block that will be replaced by child temlate
*
* Required OnParseDocument event
*
* @author Ivan Klimchuk <[email protected]>