Skip to content

Instantly share code, notes, and snippets.

View jansilvo's full-sized avatar
🎯
Focusing

jansilvo

🎯
Focusing
View GitHub Profile
@lsloan
lsloan / phpunit_fluent_mock.php
Last active July 12, 2023 17:09
Mocking a Fluent Interface with PHPUnit
/*
* With PHPUnit one can easily mock a class that implements a fluent interface.
*
* This will make any method call to your mock object return a reference to itself.
*/
$mock = $this->getMock('MyClass');
$mock->expects($this->any())
->method(new PHPUnit_Framework_Constraint_IsAnything())
->will($this->returnSelf());
@iHassan
iHassan / Galaxy Of Tutorial Torrents
Created February 11, 2015 01:20
Ultimate Galaxy Of Tutorial Torrents
=============================
**http://kickass.to/infiniteskills-learning-jquery-mobile-working-files-t7967156.html
**http://kickass.to/lynda-bootstrap-3-advanced-web-development-2013-eng-t8167587.html
**http://kickass.to/lynda-css-advanced-typographic-techniques-t7928210.html
**http://kickass.to/lynda-html5-projects-interactive-charts-2013-eng-t8167670.html
**http://kickass.to/vtc-html5-css3-responsive-web-design-course-t7922533.html
*http://kickass.to/10gen-m101js-mongodb-for-node-js-developers-2013-eng-t8165205.html
*http://kickass.to/cbt-nuggets-amazon-web-services-aws-foundations-t7839734.html
@discordier
discordier / gist:ed4b9cba14652e7212f5
Created December 4, 2014 06:23
options for phpStorm @noinspection annotation
javascript
ES6ValidationInspection
JSAccessibilityCheckInspection
JSBitwiseOperatorUsageInspection
JSCheckFunctionSignaturesInspection
JSClosureCompilerSyntaxInspection
JSCommentMatchesSignatureInspection
JSComparisonWithNaNInspection
JSConsecutiveCommasInArrayLiteralInspection
@tPl0ch
tPl0ch / CommandContext.php
Last active August 18, 2023 11:18
A CommandContext for Behat tests of Symfony Console Commands
<?php
namespace MFB\Behat\Subcontext;
use Behat\Gherkin\Node\PyStringNode;
use Behat\MinkExtension\Context\RawMinkContext;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\EventDispatcher\EventDispatcher;
/**
@donamkhanh
donamkhanh / gist:3800862
Created September 28, 2012 16:43
Set up multiple database in Zend Framework (v1.12)
1) Setup multiple DB in application.ini like this:
; Database 1
resources.multidb.db1.adapter = pdo_mysql
resources.multidb.db1.host = 127.0.0.1
resources.multidb.db1.username = root
resources.multidb.db1.password = vertrigo
resources.multidb.db1.dbname = my_db_1
resources.multidb.db1.default = true
; Database 2
@npinto
npinto / cv2_detect.py
Created September 5, 2012 07:13
Simple face detection with OpenCV 'cv2' python bindings from 2.4.x
import cv2
import cv2.cv as cv
def detect(img, cascade_fn='haarcascades/haarcascade_frontalface_alt.xml',
scaleFactor=1.3, minNeighbors=4, minSize=(20, 20),
flags=cv.CV_HAAR_SCALE_IMAGE):
cascade = cv2.CascadeClassifier(cascade_fn)
rects = cascade.detectMultiScale(img, scaleFactor=scaleFactor,
@Ziumin
Ziumin / MockingDialogTest.php
Created July 26, 2012 09:22
[Symfony2] Mocking user input when testing commands
<?php
namespace XXX\ToolkitBundle\Tests\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use XXX\ToolkitBundle\Command\CommonGenerateCommand;
@nrk
nrk / command.txt
Created April 2, 2012 19:19
Using ffprobe to get info from a file in a nice JSON format
ffprobe -v quiet -print_format json -show_format -show_streams "lolwut.mp4" > "lolwut.mp4.json"