Skip to content

Instantly share code, notes, and snippets.

View Tom32i's full-sized avatar

Thomas Jarrand Tom32i

View GitHub Profile
@Tom32i
Tom32i / Pocky.php
Last active February 4, 2016 15:04
Lazy Pocky
<?php
namespace Lazy;
class Pocky
{
private function __construct()
{
dump("Lazy Pocky");
}
@Tom32i
Tom32i / SERVE.md
Last active January 29, 2016 10:03
Quickly serve a local directory with PHP built-in server.

Quickly serve a local directory

php -S localhost:8000

You directory is accessible on: http://localhost:8000

Create an alias for it

In ~/.bashrc add:

@Tom32i
Tom32i / Car.js
Created January 15, 2016 14:46
Faut-il nommer les "méthodes" des prototypes ?
function Car (color)
{
this.color = color;
}
// Fonction anonyme?
Car.prototype.getColor = function()
{
return this.color;
};
@Tom32i
Tom32i / Inventory.php
Created January 15, 2016 07:20
Doctrine Event Inventory
<?php
namespace EventBundle\Utils;
/**
* Inventory
*/
class Inventory
{
/**
@Tom32i
Tom32i / sortable.less
Created December 4, 2013 09:54
sortable
.table {
.sorted {
.asc:before,
.desc:before {
content: "";
margin-right: 5px;
.caret();
}
.asc:before {
border-top: 0;
@Tom32i
Tom32i / ChoiceExtension.php
Last active December 29, 2015 17:59
Working with choice attributes.
<?php
namespace Acme\DemoBundle\Twig;
use Symfony\Component\PropertyAccess\PropertyAccess;
use Doctrine\Common\Inflector\Inflector;
class ChoiceExtension extends \Twig_Extension
{
/**
@Tom32i
Tom32i / table.css
Created September 20, 2013 08:04
CSS Table Behaviors
.table-behaviors {
display: table /* <table> */
display: table-cell /* <td> */
display: table-row /* <tr> */
display: table-column /* <col> */
display: table-column-group /* <colgroup> */
display: table-footer-group /* <tfoot> */
display: table-header-group /* <thead> */
}
@Tom32i
Tom32i / number.js
Created August 22, 2013 09:00
So is it a number or not? Make up your mind Javascript!
var a = parseFloat("");
alert(typeof(a)); // "Number";
alert(a); // "NaN" a.k.a. Not a Number;
@Tom32i
Tom32i / Queriable.js
Created August 12, 2013 09:55
Queriable plugin.
function Queriable (form, subset, queryKey, callback, labels)
{
if (form.length === 1 && subset.length === 1) {
this.labels = typeof(labels) != "undefined" ? labels : {};
this.statement = [];
this.form = form;
this.subset = subset;
@Tom32i
Tom32i / template.html.twig
Last active December 16, 2015 03:49
Twig: Utiliser le tag embed.
{# template.html.twig #}
<h1>Mon grand titre </h1>
{% embed "user.html.twig" %}
{% block titre %}
<h2>Mon titre</h2>
{% endblock %}
{% block bottom %}