Skip to content

Instantly share code, notes, and snippets.

View marzocchi's full-sized avatar

Federico Marzocchi marzocchi

View GitHub Profile
@marzocchi
marzocchi / assetic-less.yml
Created September 10, 2012 20:21
Configure Assetic's LessFilter
# Sample configuration for overriding Assetic's default LessFilter
# configuration in order to define one or more "load paths".
#
# Setting load paths allows to load libraries (such as Twitter's Bootstrap
# less sources) from different directories.
#
# Save this file in your bundle's `config` directory and import it into
# yor `services.yml` using the `imports` directive, eg.:
#
# imports:
@marzocchi
marzocchi / services.yml
Created September 22, 2012 12:08
Use ClassMetadata as a service
services:
# Use an entity's ClassMetadata as if it where a service (for example, in
# other services definitions).
#
# See http://symfony.com/doc/2.0/components/dependency_injection/factories.html
foo.foo_class_metadata:
class: "Doctrine\\Common\\Persistence\\Mapping\\ClassMetadata"
factory_service: doctrine.orm.entity_manager
factory_method: getClassMetadata
arguments:
@marzocchi
marzocchi / nginx.conf
Created November 23, 2012 23:53
nginx.conf
daemon off;
http {
proxy_cache_path /usr/local/var/cache/nginx keys_zone=anon:10m;
server {
listen 8888;
server_name foo;
@marzocchi
marzocchi / .gitignore
Last active December 17, 2015 03:08
Vagrantfile and Puppet manifest
.vagrant/*
@marzocchi
marzocchi / .borisrc
Last active December 17, 2015 07:49
Boots a Symfony 2.0 kernel when running boris from the project directory, and make the DIC available as $container.
<?php
/**
* Boots a Symfony 2.0 kernel when running boris from the project directory, and
* make the DIC available as $container.
*/
require_once __DIR__ . '/app/bootstrap.php.cache';
require_once __DIR__ . '/app/AppKernel.php';
@marzocchi
marzocchi / xpath.php
Created October 22, 2013 10:32
find nodes by content in an XML document using XPath
<?php
$doc = new \DomDocument();
$doc->loadXML(file_get_Contents(__DIR__ . '/cities.xml'));
$xp = new \DOMXpath($doc);
echo $xp->query("//return/country[contains(., 'Italy (IT)')]")->length;
@marzocchi
marzocchi / manifest.json
Last active April 5, 2018 14:09
Chrome extension that overrides navigator.geolocation with Mocklocation in all pages
{
"manifest_version": 2,
"name": "Mocklocation",
"description": "Override navigator.geolocation with Mocklocation",
"version": "0.1",
"permissions": [
"http://*/*",
"https://*/*"
],
@marzocchi
marzocchi / gist:786bd06cf3bfd7831dcf
Last active August 29, 2015 14:06
attempt to get an iTerm2 tab by its tty
tell application "iTerm"
set tt to sessions of tabs of terminal windows whose tty is equal to "/dev/ttys001"
-- result is this nested list:
-- {{{select 1 of select 1 of application "iTerm"}}}
end tell
<?php
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Process\ProcessBuilder;
/**
* @author marzocchi
*/
class RequestToCurlTranslator {
@marzocchi
marzocchi / my-jira-week
Last active August 29, 2015 14:24
Print the stuff I worked on this week, if it was updated by someone
#!/bin/sh
# Needs jira-cmd: https://github.com/germanrcuriel/jira-cmd
set -e
monday=$(date -v "-"$(date +"%u")"d" -v +1d +"%Y-%m-%d 00:00")
query="assignee was currentUser() AND updatedDate > '"$monday"'"
jira jql -- "$query"
echo Query: $query
unset query