Skip to content

Instantly share code, notes, and snippets.

@nicmart
nicmart / mediawiki-globals-1.20.php
Created March 8, 2013 15:20
Mediawiki 1.20 globals. Wrapping mediawiki code into a symfony application forced me to explicitly declare all global variables (more than 800!). This is the file I include for that declarations.
<?php
/*
* This file lists all global variables found in Medawiki 1.20
*
* (c) 2013 Nicolò Martini <nicmartnic@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
[user]
name = Nicolò Martini
email = electroportal.net@gmail.com
[github]
user = nicmart
token = xxxx
[core]
excludesfile = /Users/nic/.gitignore_global
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
@nicmart
nicmart / current
Last active December 11, 2015 16:08
I have to choose the more elegant interface for selectors for the treebuilder library. Here I post some alternatives to se how they look like.
<?php
// Current interface
$tree
->leaf('element', 'author')
->key('value', 'author_name')
->value('element', 'name')
->end()
->leaf('element', 'date')
->value(function(\DateTime $dateTime) { return $dateTime->format('d-m-Y'); })
@nicmart
nicmart / README.md
Last active August 29, 2015 14:21
StatementBuilder

StatementBuilder

This library was born to improve the abstraction in the conversion of an Expression to a SQL statement, but it is completely Expression and SQL agnostic, so it can be used for simlar use-cases.

The problem

Let's say you have a type FieldConverter that converts a FieldExpression object to a prepared statement. That is basically a function type

FieldConverter: FieldExpression => PreparedStatement

For the sake of the argument, let's assume that PreparedStatement is just a string with placeholders, without the PDO values bindings.

@nicmart
nicmart / gist:94aa30f10c42ca47f004
Created May 9, 2014 10:55
Extension client page test
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>HTML5 basic skeleton</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style type="text/css">