This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
register_shutdown_function(function() { | |
$error = error_get_last(); | |
if( $error !== NULL) { | |
$errno = $error["type"]; | |
$errfile = $error["file"]; | |
$errline = $error["line"]; | |
$errstr = $error["message"]; | |
// only log fatal-type errors; all other errors will be handled by set_error_handler() above. | |
if (!($errno & E_USER_ERROR || $errno & E_COMPILE_ERROR || $errno & E_PARSE || $errno & E_ERROR)) { | |
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get a detached document from cache | |
$someDude = ....; // Pull a detached document from the cache with name "John" | |
// Use the postupdate annotation feature to trigger a call to sayMyName() | |
// which simply echo's this persons name to stdout. | |
$someDude->queuePostUpdateEvent( | |
$someDude, | |
'sayMyName', | |
array() | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$rollbarServiceDefinition = new \Symfony\Component\DependencyInjection\Definition('\RollbarNotifier'); | |
$rollbarServiceDefinition->addArgument($config['rollbarnotifier']); | |
$rollbarServiceDefinition->setLazy(true); | |
$container->setDefinition('foo.service.rollbarnotifier', $rollbarServiceDefinition); | |
... later on when I do a $container->get('foo.service.rollbarnotifier'), I see it invoking my __construct() function of \RollbarNotifier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Evidence that PHP json_encode is not returning FALSE on error. | |
* (Reference: http://us1.php.net/json_encode) | |
* | |
* Env: | |
* | |
* PHP 5.3.10-1ubuntu3.9 with Suhosin-Patch (cli) (built: Dec 12 2013 04:27:25) | |
* Copyright (c) 1997-2012 The PHP Group | |
* Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies | |
* with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+----------------+-------+---------------------+---------------------+ | |
| sender_user_id | name | num_users_contacted | num_users_responded | | |
+----------------+-------+---------------------+---------------------+ | |
| 3 | Greg | 1 | 1 | | |
| 1 | John | 4 | 0 | | |
| 7 | Linda | 1 | 1 | | |
| 6 | Sue | 2 | 2 | | |
+----------------+-------+---------------------+---------------------+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+----+-------+-------------------------------+ | |
| id | name | total_cold_inquiries_received | | |
+----+-------+-------------------------------+ | |
| 2 | Mike | 1 | | |
| 4 | Bill | 2 | | |
| 5 | Kate | 1 | | |
| 6 | Sue | 1 | | |
| 7 | Linda | 2 | | |
| 8 | Mary | 1 | | |
+----+-------+-------------------------------+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Setup some tables. | |
CREATE TABLE `users` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`name` varchar(45) NOT NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=1; | |
CREATE TABLE `internal_messages` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`owner_user_id` int(11) DEFAULT NULL, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What sql query will produce the results set below using just a single table scan? | |
animals | |
----------------- | |
| size | color | | |
----------------- | |
| big | red | | |
| small | red | | |
| small | green | | |
----------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<<<<<<< HEAD | |
<?php | |
namespace Ipf\Orm; | |
/** | |
* Basic hydrator. | |
*/ | |
abstract class Hydrator extends \Doctrine\ORM\Internal\Hydration\AbstractHydrator | |
{ | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var NotifyClass = require('./NotifyService').NotifyService; | |
var notifyService = new NotifyClass(); | |
var app = express(); | |
app.use(express.bodyParser()); | |
// all environments | |
app.set('views', __dirname + '/views'); | |
app.engine('html', require('ejs').renderFile); |