Skip to content

Instantly share code, notes, and snippets.

Piotr Belina piotrbelina

View GitHub Profile
@piotrbelina
piotrbelina / .Xmodmap
Last active Aug 29, 2015
Linux Ubuntu Mac Keyboard
View .Xmodmap
clear control
clear mod4
clear mod1
keycode 37 = Super_L
keycode 64 = Control_L
keycode 133 = Alt_L Meta_L
add mod1 = Alt_L Meta_L
add control = Control_L
@piotrbelina
piotrbelina / delete.sh
Created Feb 19, 2014
remove all branches on remote already merged to master
View delete.sh
git branch -r --merged |
grep origin |
grep -v '>' |
grep -v master |
grep -v vendor |
grep -v rtm |
xargs -L1 |
awk '{sub(/origin\//,"");print}' |
xargs git push -v origin --delete
View di.php
<?php
class B {}
class A {
protected $b;
public function __construct()
{
$this->b = new B();
@piotrbelina
piotrbelina / BoomerangLogJob.scala
Created Aug 3, 2013
Scalding apache log parser for boomerang.js
View BoomerangLogJob.scala
import cascading.tuple.{Fields, TupleEntry}
import com.twitter.scalding._
import java.net.URLDecoder
import scala.util.matching.Regex
class BoomerangLogJob(args: Args) extends Job(args) {
val input = TextLine(args("input"))
val output = TextLine(args("output"))
val trap = Tsv(args("trap"))
@piotrbelina
piotrbelina / Main.java
Created Jul 25, 2013
Cascading apache log parser for boomerang.js
View Main.java
package piotr;
import cascading.flow.Flow;
import cascading.flow.FlowDef;
import cascading.flow.hadoop.HadoopFlowConnector;
import cascading.operation.Aggregator;
import cascading.operation.aggregator.Average;
import cascading.operation.aggregator.Count;
import cascading.operation.regex.RegexFilter;
import cascading.operation.regex.RegexParser;
@piotrbelina
piotrbelina / categories.php
Created Mar 1, 2013
Magento categories export
View categories.php
<?php
/**
* Created by JetBrains PhpStorm.
* User: piotr
* Date: 01.03.13
* Time: 16:07
* To change this template use File | Settings | File Templates.
*/
require_once __DIR__ . '/../../../app/Mage.php';
@piotrbelina
piotrbelina / README.md
Last active Dec 14, 2015
This is a continous deploy script for crontab.
View README.md

This is a continous deploy script for crontab. To use it:

  1. Create ~/bin/deploy.sh and copy script. Change mode to executable:
chmod + x ~/bin/deploy.sh
  1. Install crontab
@piotrbelina
piotrbelina / bootstrap.php
Created Jan 10, 2013
Bootstrap generator for Magento
View bootstrap.php
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@piotrbelina
piotrbelina / gist:4040802
Created Nov 8, 2012
Dependency Injection using traits
View gist:4040802
<?php
class Container
{
protected $container = array();
public function get($name)
{
return $this->container[$name];
}
View ImageFetcher.php
<?php
class ImageFetcher
{
protected $url;
public function __construct()
{
libxml_use_internal_errors(true);
}
You can’t perform that action at this time.