Skip to content

Instantly share code, notes, and snippets.

@bazo
bazo / ape.js
Created February 16, 2012 16:34
ape client
var apeConfig = {
domain: 'auto',
server: 'server.com:6969',
transport: 1,
}
var baseUrl = 'http://' + window.location.hostname;
if(window.location.port != 80)
{
{
"location": {
"type": "Polygon",
"coordinates": [
[
48.122033990283,
17.036580815472
],
[
48.211966009717,
@bazo
bazo / gist:5233194
Last active December 15, 2015 08:48
json to array conversion
GsonBuilder gsonBuilder = new GsonBuilder();
Gson inputGson = new Gson();
ArrayList<ArrayList<String>> list = inputGson.fromJson(json, ArrayList.class);
Coordinate[] coordinates = new Coordinate[list.size()];
for (int i = 0; i < list.size(); i++) {
coordinates[i] = new Coordinate(Double.parseDouble(list.get(i).get(0)), Double.parseDouble(list.get(i).get(1)));
}
@bazo
bazo / config.neon
Created April 8, 2013 11:01
factory error
embeddedMedia:
class: Components\EmbeddedMedia
implement: Components\IEmbeddedMediaFactory
arguments: [%snippet%]
@bazo
bazo / gist:5427161
Last active December 16, 2015 11:28 — forked from anonymous/gist:5427135
<?php
//sid.php (indexy)
if(isset($SID["_MSG_ARRAY"])) foreach ( $SID["_MSG_ARRAY"] as $m ) $SID["MESSAGES"] .= $m;
if(isset($SID["_ERR_ARRAY"])) foreach ( $SID["_ERR_ARRAY"] as $m ) $SID["ERRORS"] .= $m;
if(isset($SID["_CON_ARRAY"])) foreach ( $SID["_CON_ARRAY"] as $m ) $SID["CONTENT"] .= $m;
//sid.php (variable)
//z kerej riti sa vzal $select_flag?
ab.connect("ws://localhost:8080",
// WAMP session was established
function(connection) {
// things to do once the session has been established
window.connection = connection;
connection.subscribe('deploy', function(topic, data) {
// This is where you would add the new article to the DOM (beyond the scope of this tutorial)
console.log(data); //this prints out broadcasted data
});
<?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;
@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 = []) {
@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 / 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)