Skip to content

Instantly share code, notes, and snippets.

View sebathomson's full-sized avatar
🎯
Focusing

Sebastián Thomson sebathomson

🎯
Focusing
View GitHub Profile
@sebathomson
sebathomson / numberformat.js
Last active August 26, 2020 20:32
number_format(number, decimals, decPoint, thousandsSep) in JavaScript, known from PHP. It formats a number to a string with grouped thousands, with custom seperator and custom decimal point Demo: https://jsbin.com/yuremoyalu/edit?js,console
/**
* number_format(number, decimals, decPoint, thousandsSep) in JavaScript, known from PHP.
* It formats a number to a string with grouped thousands, with custom seperator and custom decimal point
* @param {number} number - number to format
* @param {number} [decimals=0] - (optional) count of decimals to show
* @param {string} [decPoint=.] - (optional) decimal point
* @param {string} [thousandsSep=,] - (optional) thousands seperator
* @author Felix Leupold <felix@xiel.de>
*/
function number_format(number, decimals, decPoint, thousandsSep) {
@sebathomson
sebathomson / calendar.twig
Created January 13, 2016 23:44 — forked from aknosis/calendar.twig
Table based calendar only using Twig
{#
time can be any string acceptable by http://www.php.net/strtotime, the
template will output that time's month.
If you don't want to pass in a date you can set time like this:
{% set time = "now"|date("U") %}
{% set time = "December 2012"|date("U") %}
How ever you want to output items onto the calendar is a different issue,
but I'd assume pushing everything into an array numerically indexed by that day:
@sebathomson
sebathomson / ObtenerContainerClass.php
Last active October 8, 2015 22:16
Obtener 'container' desde cualquier clase [Symfony2]
<?php
/*
* @author Sebastián Thomson <seba.thomson@gmail.com>
* @description
* Esta función puede ser pegada en cualquier clase del proyecto
* Y podrás acceder al Inyector de Dependencias (container)
*
* @example
* <code>