Skip to content

Instantly share code, notes, and snippets.

View bzick's full-sized avatar
🤔
hmmm

Ivan Shalganov bzick

🤔
hmmm
View GitHub Profile
@bzick
bzick / gist:5046482
Created February 27, 2013 09:05
PHP Mac port /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/lang/php5/Portfile
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 101787 2013-01-19 11:09:51Z ryandesign@macports.org $
PortSystem 1.0
name php5
conflicts php5-devel php52
# Keep version of php5 in sync with bundled php5 extension ports.
# Increment revision of php5-eaccelerator when updating version of php5.
epoch 1
@bzick
bzick / query-parser.js
Last active February 22, 2016 10:42
Query parser
function parseQuery() {
    var params = {};
    var query = window.location.search.substring(1);
    var vars = query.split("&");
    for (var i = 0; i < vars.length; i++) {
        var pair = vars[i].split("=");
if(params[pair[0]] === undefined) {
params[pair[0]] = [decodeURIComponent(pair[1])];
} else {
params[pair[0]].push(decodeURIComponent(pair[1]));
Enter a size of array:
11
Enter array:
10 8 -4 3 0 -7 4 2 5 0 1
Result:
33.000000 -320.000000
10.00 8.00 5.00 4.00 3.00 2.00 1.00 0.00 0.00 -4.00 -7.00
@bzick
bzick / log.txt
Created June 30, 2016 11:19
Ошибка в Extra Queries Plugin
/data/www/redmine/app/models/setting.rb:226:in `plugin_extra_queries'
/data/www/redmine/plugins/extra_queries/lib/extra_queries/field_format_record_list_patch.rb:13:in `query_filter_values_with_eq'
/data/www/redmine/plugins/extra_queries/lib/extra_queries/field_format_record_list_patch.rb:44:in `query_filter_values_with_eq'
/data/www/redmine/plugins/extra_queries/lib/extra_queries/field_format_record_list_patch.rb:44:in `query_filter_values_with_eq'
/data/www/redmine/plugins/extra_queries/lib/extra_queries/field_format_record_list_patch.rb:44:in `query_filter_values_with_eq'
/data/www/redmine/plugins/extra_queries/lib/extra_queries/field_format_record_list_patch.rb:44:in `query_filter_values_with_eq'
/data/www/redmine/plugins/extra_queries/lib/extra_queries/field_format_record_list_patch.rb:44:in `query_filter_values_with_eq'
/data/www/redmine/plugins/extra_queries/lib/extra_queries/field_format_record_list_patch.rb:44:in `query_filter_values_with_eq'
/data/www/redmine/plugins/extra_queries/lib/extra_queries/
@bzick
bzick / extra_queries.log
Created July 5, 2016 07:58
Extra Queries module. 500: stack level too deep
/data/www/redmine/.rvm/gems/ruby-2.2.4/gems/actionpack-4.2.5.2/lib/action_controller/metal/strong_parameters.rb:462:in `convert_value_to_parameters'
/data/www/redmine/.rvm/gems/ruby-2.2.4/gems/actionpack-4.2.5.2/lib/action_controller/metal/strong_parameters.rb:456:in `convert_hashes_to_parameters'
/data/www/redmine/.rvm/gems/ruby-2.2.4/gems/actionpack-4.2.5.2/lib/action_controller/metal/strong_parameters.rb:351:in `[]'
/data/www/redmine/plugins/extra_queries/lib/extra_queries/field_format_record_list_patch.rb:13:in `query_filter_values_with_eq'
/data/www/redmine/plugins/extra_queries/lib/extra_queries/field_format_record_list_patch.rb:44:in `query_filter_values_with_eq'
/data/www/redmine/plugins/extra_queries/lib/extra_queries/field_format_record_list_patch.rb:44:in `query_filter_values_with_eq'
/data/www/redmine/plugins/extra_queries/lib/extra_queries/field_format_record_list_patch.rb:44:in `query_filter_values_with_eq'
/data/www/redmine/plugins/extra_queries/lib/extra_queries/field_format_record_list_patch
@bzick
bzick / test.js
Last active September 9, 2016 18:48
Создание объекта в JS
function my_object() {
// конструктор
}
my_object.prototype = {
prop1: 1,
prop2: 2,
// ... прочие свойства
method1: function () {
@bzick
bzick / example.md
Created November 28, 2016 11:38
Очистка пустых/лишних массивов

Вариант 1. Через модификатор/функцию.

$fenom->addModifier('is_empty_array', function ($array) {
   // проверяете $array и возвращаете true/false
});

в шаблоне

@bzick
bzick / example.php
Created December 21, 2016 14:18
Добавление адд-она Storage в Fenom
<?php
$template_dir = "/path/to/templates";
$compile_dir = "/path/to/compiles";
$options = [];
// Вариант 1. Если у вас уже есть свой класс, расширяющий Fenom.
class Templater extends Fenom {
use Fenom\Storage;
}
@bzick
bzick / sandbox.md
Last active August 27, 2018 08:24
Markdown Sandbox
  • one
  • two
    • three
      • four
      • seven
        • eight
        • nine
          • ten
    • five
  • six
@bzick
bzick / envsubst.sh
Created April 5, 2019 11:38
envsubst example
export VAR1="one" VAR2="two" VAR3="three"
envsubst '$VAR1,$VAR2,$VAR3' <source.conf >destination.conf
# or
envsubst '$VAR1 $VAR2 $VAR3' <source.conf >destination.conf
# or
envsubst '${VAR1} ${VAR2} ${VAR3}' <source.conf >destination.conf