Skip to content

Instantly share code, notes, and snippets.

View bazo's full-sized avatar

Martin Bazik bazo

View GitHub Profile
@bazo
bazo / cli.php
Created January 15, 2015 07:22
cli app entry point
#!/usr/bin/env php
<?php
use Symfony\Component\Console\Application;
// Let bootstrap create Dependency Injection container.
$configurator = require __DIR__ . '/app/bootstrap.php';
$configurator->addConfig(__DIR__ . '/app/config/console.neon');
{
"USD": "$",
"EUR": "€",
"GBP": "£",
"INR": "₹",
"AUD": "$",
"CAD": "$",
"SGD": "$",
"CHF": "CHF",
"MYR": "RM",
$domains = parse_ini_file(__DIR__.'/../app/config/domains.ini');
$localDomainsFile = __DIR__.'/../app/local/domains.ini';
if(file_exists($localDomainsFile)) {
$localDomains = parse_ini_file($localDomainsFile);
$domains = array_merge($domains, $localDomains);
}
$site = $domains[filter_input(INPUT_SERVER, 'SERVER_NAME')];
define('SITE', $site);
<?php
use Nette\Application\UI\Presenter;
use Nette\DI\CompilerExtension;
/**
* Auto register presenters as services
* @author Martin Bažík <[email protected]>
'use strict';
var gulp = require('gulp');
var typescript = require('gulp-tsc');
var mocha = require('gulp-mocha');
var growl = require('gulp-notify-growl');
var async = require('async');
var notify = growl();
var paths = {
jQuery(function($) {
$('form[data-async]').live('submit', function(event) {
var $form = $(this);
var $target = $($form.attr('data-target'));
$.ajax({
type: $form.attr('method'),
url: $form.attr('action'),
data: $form.serialize(),
@bazo
bazo / instructions.md
Created July 14, 2013 11:54
php 5.5 windows phpredis compilation

Pre-requisites

  • install git for windows
  • install Visual Studio 2012 or higher, any edition
  • make sure you have Visual C++ Redistributable for Visual Studio 2012 x86 or x64 installed, the latest update as of 14.7.2013 can be found here
  • download php 5.5 source code
  • download latest php sdk binary tools from here
  • download deps for php 5.5 vc11(either x64 or x86, depending on which flavor you're going to compile) from the same location

Compilation

  • create a folder X:\compilation (X is drive letter)
@bazo
bazo / curly_macros.html
Last active December 19, 2015 17:19
nette form bug
<form class="ajax" id="frm-formNewMessage" method="post" action="/translation/default/51e0996cb0d02a1425000003"> <label for="frm-formNewMessage-context">Context</label>
<input type="text" value="" id="frm-formNewMessage-context" name="context">
<label for="frm-formNewMessage-singular">Singular</label>
<input type="text" value="" data-nette-rules="[{&quot;op&quot;:&quot;:filled&quot;,&quot;msg&quot;:&quot;Please complete mandatory field.&quot;}]" required="" id="frm-formNewMessage-singular" name="singular">
<label for="frm-formNewMessage-plural">Plural</label>
<input type="text" value="" id="frm-formNewMessage-plural" name="plural">
<input type="submit" class="btn btn-primary" value="Add" name="btnSubmit">
<div><input type="hidden" value="formNewMessage-submit" name="do"></div>
@bazo
bazo / func.php
Last active December 19, 2015 16:19
<?php
$multiply = function($a, $b) {
return $a * $b;
};
$add = function($a, $b) {
return $a + $b;
}
$calc = function($strategy, $args = []) {
<?php
// The only chance now, I felt was the possibility that we'd gone to such
// excess that nobody in the position to bring the hammer down on us could
// possibly believe it.
// Hunter S. Thompson
trait CompactClass {
private $data;