Skip to content

Instantly share code, notes, and snippets.

View tbreuss's full-sized avatar
🚴‍♂️
Biking

tebe tbreuss

🚴‍♂️
Biking
View GitHub Profile
@tbreuss
tbreuss / procEnableKeysOnAllTables.sql
Last active February 23, 2016 10:44
This is a stored procedure that loops through all tables of a database and enables indexes
DELIMITER $$
DROP PROCEDURE IF EXISTS procEnableKeysOnAllTables $$
CREATE PROCEDURE procEnableKeysOnAllTables()
BEGIN
DECLARE table_name VARCHAR(255);
DECLARE end_of_tables INT DEFAULT 0;
@tbreuss
tbreuss / SymfonyEventDispatcherExample.php
Created August 25, 2014 15:57
A very simple example using the Symfony EventDispatcher component.
<?php
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class MyListener
{
public function onFooAction(Event $event)
@tbreuss
tbreuss / is_natural.php
Created April 10, 2014 19:15
A simple function to recognize whether the value is a natural number.
<?php
function is_natural($val, $acceptzero = false)
{
$return = ((string) $val === (string) (int) $val);
if ($acceptzero) {
$base = 0;
} else {
$base = 1;
}