Skip to content

Instantly share code, notes, and snippets.

/**
* Transform a Query object to its SQL value
*
* @param Query $query
*
* @return string
*/
function queryToSql($query)
{
// Unnest query objects
@ramonsmits
ramonsmits / gist:7563502
Created November 20, 2013 13:52
Example of Mandrill webhook JSON data.
[
{
"event": "send",
"msg": {
"ts": 1365109999,
"subject": "This an example webhook message",
"email": "example.webhook@mandrillapp.com",
"sender": "example.sender@mandrillapp.com",
"tags": [
"webhook-example"
@igorw
igorw / import_sql.php
Last active December 16, 2015 12:29
Using symfony/console's ArgvInput standalone.
<?php
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
$input = new ArgvInput($argv, new InputDefinition([
new InputArgument('sql', InputArgument::REQUIRED),
new InputOption('update', 'u', InputOption::VALUE_NONE),
@KuiKui
KuiKui / gist:3963086
Created October 27, 2012 05:42
Debian Squeeze 64 LAMP Vagrant box
@nikic
nikic / accessors.markdown
Created October 13, 2012 11:22
Analysis of getter/setter usage in Symfony and Zend Framework

In order to get a bit of "hard data" on what accessors will actually be used for once they are introduced I wrote a small script that scans through a codebase, finds all getter and setter methods and checks them for various characteristics. (The analyze.php file in this Gist.)

Here are the results of running it on a Symfony (Standard) skeleton.

absoluteTotal        => 18516 (486.6%)
total                =>  3805 (100.0%)
skipped              =>   124 (  3.3%)
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@ziadoz
ziadoz / awesome-php.md
Last active April 17, 2024 21:06
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.