Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍👩‍👧
#proudDadOfAGirl

Johannes Nagl johannesnagl

👨‍👩‍👧
#proudDadOfAGirl
View GitHub Profile
@johannesnagl
johannesnagl / SqlStatementCountAssertionTrait.php
Created Feb 13, 2020
Including this trait in your Laravel Test code will **automatically** start counting SQL queries for every test.
View SqlStatementCountAssertionTrait.php
<?php declare(strict_types = 1);
namespace Swat\Api\V2\Tests\Traits;
use DB;
use Illuminate\Database\Events\QueryExecuted;
use Swat\Api\V2\Tests\TestCase;
/**
* Including this trait will **automatically** start counting SQL queries
* for every test.
@johannesnagl
johannesnagl / app-Config-bootstrap.php
Created Jul 17, 2018
CakePHP2 Postgres Lateral Join Hack
View app-Config-bootstrap.php
<?php
// …
CakePlugin::load('PostgresApp');
// …
@johannesnagl
johannesnagl / viennaphp-august-2014-gathering.txt
Created Aug 11, 2014
ViennaPHP August 2014 Gathering: CakePHP point of view
View viennaphp-august-2014-gathering.txt
ViennaPHP August Gathering: http://www.meetup.com/viennaphp/events/195495012/
hi guys,
sorry for not being able to join you last week for the August gathering! Sebastian asked me to say some words about our CakePHP development point of view, but it was not possible for me to join in time (because we're running late on a quite big relaunch).
Sebastian sent my some questions, I now want to answer directly here. If there are questions left, please contact me directly and/or comment here!
* Ecosystem (Plugins, Community/Help available): How is the overall ecosystem? Are there many plugins for the framework to integrate the work of others? Is there a community which enables to build better software? Is there a good help and other resources?
@johannesnagl
johannesnagl / init-server.sh
Last active Aug 29, 2015
Initialize Server
View init-server.sh
apt-get update
apt-get upgrade -y
apt-get install git-core -y
@johannesnagl
johannesnagl / install-mod-passenger.sh
Last active Aug 29, 2015
Install Mod Passenger on Ubuntu 14.04
View install-mod-passenger.sh
# based on http://www.modrails.com/documentation/Users%20guide%20Apache.html#install_on_debian_ubuntu
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7
sudo apt-get install apt-transport-https ca-certificates -y
sudo touch /etc/apt/sources.list.d/passenger.list
echo "deb https://oss-binaries.phusionpassenger.com/apt/passenger trusty main" > /etc/apt/sources.list.d/passenger.list
sudo chown root: /etc/apt/sources.list.d/passenger.list
sudo chmod 600 /etc/apt/sources.list.d/passenger.list
View selectize.min.js
/*! selectize.js - v0.8.5 | https://github.com/brianreavis/selectize.js | Apache License (v2) */
!function(a,b){"function"==typeof define&&define.amd?define("sifter",b):"object"==typeof exports?module.exports=b():a.Sifter=b()}(this,function(){var a=function(a,b){this.items=a,this.settings=b||{diacritics:!0}};a.prototype.tokenize=function(a){if(a=d(String(a||"").toLowerCase()),!a||!a.length)return[];var b,c,f,h,i=[],j=a.split(/ +/);for(b=0,c=j.length;c>b;b++){if(f=e(j[b]),this.settings.diacritics)for(h in g)g.hasOwnProperty(h)&&(f=f.replace(new RegExp(h,"g"),g[h]));i.push({string:j[b],regex:new RegExp(f,"i")})}return i},a.prototype.iterator=function(a,b){var c;c=f(a)?Array.prototype.forEach||function(a){for(var b=0,c=this.length;c>b;b++)a(this[b],b,this)}:function(a){for(var b in this)this.hasOwnProperty(b)&&a(this[b],b,this)},c.apply(a,[b])},a.prototype.getScoreFunction=function(a,b){var c,d,e,f;c=this,a=c.prepareSearch(a,b),e=a.tokens,d=a.options.fields,f=e.length;var g=function(a,b){var c,d;return a?(a=Stri
@johannesnagl
johannesnagl / kitickety.txt
Created Feb 5, 2014
why i should get a linz.kod.io ticket for free?
View kitickety.txt
|\_/|
(. .)
=w= (\
/ ^ \//
(|| ||)
,""_""_ .
because we all love cats! and i would totally love to hear from one of the @github-octocats about their success stories!
View CakePHP Model Test
<?php
App::uses('Group', 'Model');
class GroupTest extends CakeTestCase {
public $fixtures = array('app.group', 'app.groupsUser', 'app.channelsClient', 'app.client');
public $autoFixtures = false;
public function setUp() {
parent::setUp();
View CakePHP Component Test
<?php
App::uses('Controller', 'Controller');
App::uses('CakeRequest', 'Network');
App::uses('CakeResponse', 'Network');
App::uses('ComponentCollection', 'Controller');
App::uses('StatisticComponent', 'Controller/Component');
// A fake controller to test against
class TestStatisticController extends Controller {
@johannesnagl
johannesnagl / CakePHP Helper Test
Created Dec 4, 2013
Simple test for my presentation
View CakePHP Helper Test
<?php
App::uses('Controller', 'Controller');
App::uses('View', 'View');
App::uses('ArticleHelper', 'View/Helper');
class ArticleHelperTest extends CakeTestCase {
public function setUp() {
parent::setUp();
$Controller = new Controller();