Skip to content

Instantly share code, notes, and snippets.

View kovagoz's full-sized avatar

Zoltan Kovago kovagoz

  • IBM Budapest Lab
  • Budapest
View GitHub Profile
@kovagoz
kovagoz / post-checkout
Created August 25, 2014 09:14
Composer install on git checkout
#!/bin/bash
old_head="$1"
new_head="$2"
branch_switch="$3"
git_root=$(git rev-parse --show-toplevel)
git diff --name-only $new_head $old_head | grep composer.lock > /dev/null
@kovagoz
kovagoz / doctrine-geojson.php
Created January 10, 2014 14:55
Doctrine geospatial query with GeoJson
<?php
use GeoJson\Geometry\Point;
$city = new City;
$city->name = 'Budapest';
$city->coordinates = new Coordinates(47.51, 19.03);
$city->save();
$city = DB::createQueryBuilder('City')
@kovagoz
kovagoz / doctrine-geo.php
Created January 9, 2014 22:57
Doctrine MongoDB geospatial query example
<?php
$city = DB::createQueryBuilder('Ni\City')
->field('coordinates')->geoNear(46.1643154116, 18.9664363861)
->spherical(true)
->distanceMultiplier(6378.137) // rad => km
->limit(1)
->getQuery()
->getSingleResult();
alias codecept='() { vagrant ssh -c "cd /vagrant/www && vendor/bin/codecept $*" }'
alias composer='() { vagrant ssh -c "cd /vagrant/www && composer $*" }'
@kovagoz
kovagoz / storage_image_extension
Last active December 29, 2015 21:49
Brainstorm
class File
__construct($filename)
$this->workingCopy = new WorkingCopy($filename)
hasWorkingCopy()
return $this->workingCopy && $this->workingCopy->exists()
getWorkingCopy()
if (!$this->hasWorkingCopy())
$this->workingCopy = new WorkingCopy(Storage::download($this->id))
return $this->workingCopy
@kovagoz
kovagoz / gist:6937508
Created October 11, 2013 16:09
logstash nginx access log backfill
input {
tcp {
type => "nginx"
port => 3333
}
}
filter {
grok {
type => "nginx"