Skip to content

Instantly share code, notes, and snippets.

View alroniks's full-sized avatar

Ivan Klimchuk alroniks

View GitHub Profile
<?php
$str = 'fD3_';
$chars = array_merge(range('a', 'z'), range('A', 'Z'), range('0', '9'), ['_']);
$total = 0;
$brut = '';
$len = strlen($str);
/**
* @see: https://www.programmingalgorithms.com/algorithm/brute-force?lang=PHP
*/
@alroniks
alroniks / template.html
Last active January 12, 2016 03:39
Yandex.Weather Snippet for MODX
[[!weather?
&cityId=`26850`
&tpl=`weather.tpl`
&cacheTime=`7200`
]]
@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',
#!/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));
1
00:00:00,000 --> 00:00:23,042
alright everyone I do it so it's ok so
she asked me to talk at Larkin goes to
2
00:00:23,042 --> 00:00:28,064
the last year was obliged i enjoy to
throw out hope some of you that reappear
<div class="wrapper navigation">
<div class="container">
<div class="row navigation__first">
<div class="col-xs-12">
<nav class="menu-catalog">
<ul>
<li class="has-submenu has-catalog"><a href="#">Каталог</a></li>
<li><a href="{$_modx->makeUrl(1844)}">Бренды</a></li>
<li class="has-submenu"><a href="{$_modx->makeUrl($_modx->resource.id)}">Покупателю</a>
{$_modx->runSnippet('!pdoMenu', [