Skip to content

Instantly share code, notes, and snippets.

@jurchiks
jurchiks / ExceptionTestCase.php
Created Sep 25, 2019
PHPUnit - broken public method calls in constructor
View ExceptionTestCase.php
<?php
use PHPUnit\Framework\TestCase;
class ExceptionTestCase extends TestCase
{
public function testException()
{
$this->expectException(TypeError::class);
$this->expectExceptionMessage('call_user_func_array() expects parameter 1 to be a valid callback, first array member is not a valid class name or object');
$this->getMockBuilder(Foo::class)
@jurchiks
jurchiks / git_update_master.bat
Last active Jan 22, 2021
Switch to master, pull from upstream, push to origin (+optionally delete feature branch)
View git_update_master.bat
@echo off
set main_branch=master
REM store current branch name in variable
for /f "delims=" %%a in ('git rev-parse --abbrev-ref HEAD') do @set branch=%%a
git checkout %main_branch% & git pull upstream %main_branch% & git push
REM this GOTO crap is only necessary because CMD doesn't support IF (foo && bar)
@jurchiks
jurchiks / multiple.conf
Last active Jan 12, 2016
Nginx config for multiple hosts, multi-user, multi-project
View multiple.conf
server {
listen 80;
server_name ~^(?<project>.+)\.(?<username>.+)\.hhvm\.dyninno\.net$;
if (!-d /home/$username/public_html/$project) {
return 405;
break;
}
set $root /home/$username/public_html/$project;
@jurchiks
jurchiks / Output.txt
Last active Jan 5, 2016
php pdo query() throws error AND exception when mysql server has gone away
View Output.txt
PHP Warning: PDO::query(): MySQL server has gone away in C:\Users\Juris\Desktop\test\test.php on line 23
Warning: PDO::query(): MySQL server has gone away in C:\Users\Juris\Desktop\test\test.php on line 23
PHP Warning: PDO::query(): Error reading result set's header in C:\Users\Juris\Desktop\test\test.php on line
23
Warning: PDO::query(): Error reading result set's header in C:\Users\Juris\Desktop\test\test.php on line 23
Exception: connection problem. Message: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
@jurchiks
jurchiks / closeOnOverlayClick.patch
Created Nov 1, 2013
jQuery UI modal dialog close on overlay click option.
View closeOnOverlayClick.patch
diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js
index c5bd42a..9512c10 100644
--- a/ui/jquery.ui.dialog.js
+++ b/ui/jquery.ui.dialog.js
@@ -26,6 +26,7 @@ $.widget( "ui.dialog", {
autoOpen: true,
buttons: [],
closeOnEscape: true,
+ closeOnOverlayClick: false,
closeText: "Close",
View EventDispatcher.java
import java.util.HashSet;
import java.util.Set;
import listeners.IBlockingAltListener;
import listeners.IBlockingListener;
import listeners.IItemReceiveListener;
import listeners.IPlayerDeathListener;
public enum EventDispatcher
{