Skip to content

Instantly share code, notes, and snippets.

@mylk
mylk / conky.conf
Last active July 10, 2016 14:42
My conky configuration
-- vim: ts=4 sw=4 noet ai cindent syntax=lua
--[[
Conky, a system monitor, based on torsmo
]]
conky.config = {
background = true,
cpu_avg_samples = 2,
net_avg_samples = 2,
out_to_console = false,
@mylk
mylk / MobilePrefixService.php
Last active August 14, 2016 14:18
Class that returns the mobile prefix for each country (hard coded)
<?php
/*
* Installation:
* =============
* # services.yml
* services:
* acme.mobile_prefix:
* class: Acme\AcmeBundle\Service\MobilePrefixService
*/
@mylk
mylk / CountryExtension.php
Last active March 25, 2019 13:49
Twig extension that adds a filter that returns the country name by its 2-letter ISO code
<?php
/*
* Installation:
* =============
* # services.yml
* services:
* # ...
* acme.twig.country_extension:
* class: Acme\AcmeBundle\Twig\CountryExtension
@mylk
mylk / IfNullExtension.php
Last active August 14, 2016 14:18
Twig filter that returns a default value if the given one is null
<?php
/*
* Installation:
* =============
* # services.yml
* services:
* # ...
* acme.twig.if_null_extension:
* class: Acme\AcmeBundle\Twig\IfNullExtension
@mylk
mylk / JsonDecodeExtension.php
Last active August 14, 2016 14:19
Twig filter that converts a JSON string to object
<?php
/*
* Installation:
* =============
* # services.yml
* services:
* # ...
* acme.twig.json_decode:
* class: Acme\AcmeBundle\Twig\JsonDecodeExtension
@mylk
mylk / TimeAgoExtension.php
Last active August 14, 2016 14:19
Twig filter that converts a datetime string to an "ago format", like "posted 9 months ago"
<?php
/*
* Installation:
* =============
* # services.yml
* services:
* # ...
* acme.twig.time_ago:
* class: Acme\AcmeBundle\Twig\TimeAgoExtension
@mylk
mylk / TimezoneType.php
Last active November 9, 2018 18:04
A modified Symfony Forms "timezone" type that also displays the timezone offset
<?php
/**
* A modified version of the original symfony form type that adds the timezone offset.
*
* Original version at:
* https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php
*/
/*
* Installation:
@mylk
mylk / StatesType.php
Last active April 30, 2021 10:58
A Symfony Forms choice type of the US states
<?php
/*
* Installation:
* =============
* # services.yml
* services:
* # ...
* acme.form.states:
* class: Acme\AcmeBundle\Form\Extension\StatesType
@mylk
mylk / GreekTaxOfficeType.php
Last active August 14, 2016 14:10
A Symfony Form choice type of Greek tax offices
<?php
/**
* Greek tax offices as in:
* http://www.gsis.gr/gsis/export/sites/default/gsis_site/PublicIssue/documents_DOY/kwdikoi_doy.pdf
*/
/*
* Installation:
* =============
* # services.yml
@mylk
mylk / UrlShortenerService.php
Last active August 14, 2016 16:57
A Google Shortener API wrapper
<?php
/**
* Supports URL shortening, expanding and analytics retrieval of a given period type.
*/
/*
* Installation (Symfony):
* =======================
* # services.yml
* services: