Skip to content

Instantly share code, notes, and snippets.

@giorrrgio
giorrrgio / github_completed_checks_pr.js
Last active November 10, 2016 13:10
Greasemonkey notify completed checks on a pr
// ==UserScript==
// @name PR Checks ready
// @namespace AdEspresso
// @version 1
// @grant none
// @include /^https://github.com/adespresso/adespresso/pull/\d+/
// @require https://code.jquery.com/jquery-latest.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @require https://raw.githubusercontent.com/ttsvetko/HTML5-Desktop-Notifications/master/dist/Notification.min.js
// ==/UserScript==
@giorrrgio
giorrrgio / SRPViolation.php
Created May 27, 2016 09:58
Single responsibility principle violation in PHP
<?php
class Logger
{
public function __construct(\PDO $pdo)
{
$this->pdo = $pdo;
}
public function log($message)
Verifying that +giorrrgio is my blockchain ID. https://onename.com/giorrrgio
{
"aggs": {
"tags": {
"terms": {
"field": "tags",
"size": 1000
}
}
},
"query": {
<?php
namespace Acme\Controller;
class FooControllerTest extends \PHPUnit_Framework_TestCase
{
public function testHook()
{
$_SERVER['HTTP_HOST'] = 'localhost';
$_SERVER['HTTP_USER_AGENT'] = 'Foobar Agent';
@giorrrgio
giorrrgio / composer.json
Last active August 29, 2015 14:06
HtmlScraper
{
"require": {
"symfony/dom-crawler": "*",
"symfony/css-selector": "*"
}
}
@giorrrgio
giorrrgio / xdphp.sh
Last active August 29, 2015 14:06
xdphp.sh
#!/bin/bash
php -dxdebug.remote_autostart=On -didekey=PHPSTORM -dremote_host=localhost $*
@giorrrgio
giorrrgio / WebTestCase.php
Last active December 19, 2015 07:28
A helper method to save Symfony Client content to an html file and immediately open the page on your browser
<?php
namespace MyNamespace\CoreBundle\Test;
use Symfony\Bundle\FrameworkBundle\Client;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as SymfonyWebTestCase;
use Symfony\Component\Process\Process;
abstract class WebTestCase extends SymfonyWebTestCase
{
@giorrrgio
giorrrgio / convert.php
Last active December 15, 2015 19:09
JSON TO KML
<?php
include('php-kml/lib/kml.php');
$jsonFile = file_get_contents("data.json");
$json_a = json_decode($jsonFile, true);
$a = new kml_Document();
$a->set_id('uid000000111');
#open ~/.zshrc with your favourite editor
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="kolo"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/