Skip to content

Instantly share code, notes, and snippets.

View ihabunek's full-sized avatar

Ivan Habunek ihabunek

View GitHub Profile
@ihabunek
ihabunek / performance.php
Created February 4, 2014 12:56
Testing a static event emitter in Evenement
<?php
require 'vendor/autoload.php';
define("LISTENERS", 100);
define("EVENTS", 100000);
printf("\n* Emitting %d events to %d listeners.\n\n", EVENTS, LISTENERS);
// --- Dynamic ---

Keybase proof

I hereby claim:

  • I am ihabunek on github.
  • I am ihabunek (https://keybase.io/ihabunek) on keybase.
  • I have a public key whose fingerprint is 66DA B78A 4C4F 0D9B 00F5 F179 D625 F8FA ED82 13F4

To claim this, I am signing this object:

@ihabunek
ihabunek / sgndecode
Last active August 29, 2015 14:00
Skripta za dekodiranje SGN datoteka s bankovnim izvodima (bez provjere potpisa)
#!/bin/bash
file=$1
if [ -f "$file" ]
then
xmllint --xpath "/FileUpload/File/text()" --nocdata $file | base64 -d | funzip
else
echo "File not found: $file"
fi
@ihabunek
ihabunek / composer.json
Created May 8, 2014 13:02
Weird error reporting in ReactPHP
{
"require": {
"react/event-loop": "0.4.*"
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>author</key>
<string>Marcus Ekwall, Ivan Habunek</string>
<key>name</key>
<string>Obsidian</string>
<key>version</key>
<string>0.1</string>
Successfully installed Django-1.7.4 Pillow-2.7.0 coverage-3.7 dj-database-url-0.3.0 django-allauth-0.19.1 django-braces-1.4.0 django-model-utils-2.2 django-tinymce-1.5.3 factory-boy-2.4.1 ipython-3.0.0 mock-1.0.1 oauthlib-0.7.2 psycopg2-2.6 python-openid-2.2.5 requests-2.6.0 requests-oauthlib-0.4.2 six-1.9.0
---> 1d5c3b94e365
Removing intermediate container 74db76855140
Successfully built 1d5c3b94e365
Attaching to conferenceweb_web_1
web_1 | Performing system checks...
web_1 |
web_1 | System check identified no issues (0 silenced).
web_1 | Unhandled exception in thread started by <function wrapper at 0x7f805db677d0>
web_1 | Traceback (most recent call last):
ihabunek@groucho: ~/projects/webcamp/conference-web (master) $ sudo docker-compose up
Recreating conferenceweb_db_1...
Recreating conferenceweb_web_1...
Attaching to conferenceweb_db_1, conferenceweb_web_1
web_1 | Performing system checks...
web_1 |
web_1 | System check identified no issues (0 silenced).
web_1 |
web_1 | You have unapplied migrations; your app may not work properly until they are applied.
web_1 | Run 'python manage.py migrate' to apply them.
@ihabunek
ihabunek / fp.php
Last active August 29, 2015 14:17
How functional programming affected my use of PHP
// Before FP
$listings = [];
foreach ($docs as $item) {
$listings[] = Listing::fromSolr($item);
}
// After FP
$listings = array_map([Listing::class, 'fromSolr'], $docs);
2015-04-28 13:39:05,161 [qtp1373889186-316] INFO core.SolrCore.Request - [listings_shard2_replica1] webapp=/solr path=/select params={d=20&fl=*,score&fl=*,_dist_:geodist(),_distboost_:recip(geodist(),2,200,20)&q={!boost+b%3Drecip(geodist(),2,200,20)}cc:at+AND+what:anwalt~&sfield=loc&pt=47.8644225,13.0106433&debug=query&wt=json&fq={!geofilt}} status=500 QTime=2
2015-04-28 13:39:05,162 [qtp1373889186-316] ERROR solr.servlet.SolrDispatchFilter - null:java.lang.NullPointerException
at org.apache.solr.request.json.ObjectUtil$ConflictHandler.mergeMap(ObjectUtil.java:60)
at org.apache.solr.request.json.ObjectUtil.mergeObjects(ObjectUtil.java:114)
at org.apache.solr.request.json.RequestUtil.mergeJSON(RequestUtil.java:259)
at org.apache.solr.request.json.RequestUtil.processParams(RequestUtil.java:176)
at org.apache.solr.util.SolrPluginUtils.setDefaults(SolrPluginUtils.java:166)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:140)
at org.apache.solr.core.SolrCore.execute(S