Skip to content

Instantly share code, notes, and snippets.

View ihabunek's full-sized avatar

Ivan Habunek ihabunek

View GitHub Profile
@ihabunek
ihabunek / 1-short-life.hs
Last active November 6, 2020 20:39
Conway's Game of Life in Haskell (condensed and regular version)
module ObfuscatedGame where
import Data.Set as Set
neighbours p = Set.fromList [(fst p + dx, snd p + dy) | dx <- [-1..1], dy <- [-1..1], not (dx == 0 && dy == 0)]
lives g p = ((member p g) && count `elem` [2, 3]) || (not (member p g) && count == 3)
where count = Set.size $ Set.filter (flip member g) (neighbours p)
nextGen g = Set.filter (lives g) (union g $ unions [neighbours p | p <- toList g])
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
@ihabunek
ihabunek / gist:468ccda3ca4b2052ab83
Last active August 29, 2015 14:21
Tjedan dobrih restorana 2015
2015-06-15T16:44:34+02:00 | DEBUG | 557ee4d258b0c | de | | Opendi\Api\Application | Processing: POST http://api-staging.opendi.com/de/listings/31474/reviews
2015-06-15T16:44:34+02:00 | DEBUG | 557ee4d258b0c | de | Opendi AG | Opendi\Api\Application | Request authenticated for: Opendi AG
2015-06-15T16:44:34+02:00 | ERROR | 557ee4d258b0c | de | Opendi AG | Opendi\Api\Application | Failed executing query: "INSERT INTO bewertung (eintrag_id, bewertungtyp_id, aktiv, aktivstack, countable, name, bewertedname, rating, ratingscaled, ratingstars, numstars, ratingtitle, ratingtext, ratingurl, exteintragurl, bildname, datum, sourceeintragid, sourceratingid, locked, locktime, created, lastmodify, login_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);" with arguments: ["31474","sbb",true,false,true,"Juice","Some stuff",5,5,5,5,"Kinda liked it","It was better than some things, worse than others.","google.com","duckduckgo.com",null,"2014-02-22 09:01:25",null,"11031",null,null,null,null,n
@ihabunek
ihabunek / gist:47eed8bb22808b092301
Created June 26, 2015 06:25
Changes to PHP wiki
====== Build your own PHP on Windows ======
===== Before you Begin =====
Building PHP on Windows will require three things
- A properly set up build environment, including a compiler with the right SDK's and some binary tools used by the build system
- Prebuilt libraries and headers for third party libraries that PHP uses in the correct location
- The PHP source
===== The Build Environment =====
@ihabunek
ihabunek / gist:c74fb2d555fecea37aef
Created July 6, 2015 07:46
Compile PHP On Windows
====== Build your own PHP on Windows ======
===== Before you Begin =====
Building PHP on Windows will require three things
- A properly set up build environment, including a compiler with the right SDK's and some binary tools used by the build system
- Prebuilt libraries and headers for third party libraries that PHP uses in the correct location
- The PHP source
===== Compiler =====

From: [email protected]

Dear Mr. Habunek,

thank you for your request.

Passenger Receipts issued by Lufthansa German Airlines (DLH AG) count as tickets in accordance with German law (§ 34 UStDV) and therefore are valid invoices as defined by §14 German Sales Tax Law.

According to § 34 UStDV tickets must contain the following minimum information:

  • the full name and complete address of the contractor executing the transportation service