Skip to content

Instantly share code, notes, and snippets.

View dsmeringe's full-sized avatar

David Smeringe dsmeringe

  • Matic Tribe
  • Sweden
View GitHub Profile
@dsmeringe
dsmeringe / queryClass.php
Last active December 14, 2015 19:09
This is actually an adapter version of a type-ahead-find solution I did for a client once.. See https://gist.github.com/dsmeringe/4952481 for usage of this class.
<?php
/**
* query class that performs ..queries!! :)
*
* This is actually an adapter version of a type-ahead-find solution I did
* for a client once..
*
* See https://gist.github.com/dsmeringe/4952481 for usage of this class
*
* This class IRL is used to replicate another DB and be used to perform type
@dsmeringe
dsmeringe / rgTeaser.ts
Last active December 14, 2015 11:19
rgTeaser example usage. The extension seems old now though ;) The ext in TER: http://typo3.org/extensions/repository/view/rgteaser I guess what rgTeaser mostly does is adding a new sitemap option and then this TS..
includeLibs.user_getpages = EXT:rgteaser/user_getpages.inc
###################################
##### rgTeaser 102 ################
##### (page + content - teaser) ###
tt_content.menu.20.102 >
tt_content.menu.20.102 = CONTENT
tt_content.menu.20.102 {
table = pages
@dsmeringe
dsmeringe / latenightfail.php
Last active December 14, 2015 04:09
Yii AR query that fails only on sunday nights
<?php
//keeps failing on sunday evenings
$userInBed = Bed::model()->with('pillow','sheet')->findByAttributes(
array('user'=>':theOne'),
'',
array(':theOne'=>'smeringe')
);
@dsmeringe
dsmeringe / mysqldump_extended.txt
Created February 15, 2013 15:16
Better mysql backup command. Dump list of databases with their routines (like stored procedures) (routines are normally left out) using compressed communication and adding a drop database statement in the beginning.
mysqldump -C --routines --add-drop-database -uUSERNAME -p --databases NAMES-OF-DATABASE-1 NAME-OF-DATABASE-2..
@dsmeringe
dsmeringe / quicksearch.php
Created February 14, 2013 12:34
Example php search script returning results as JSON/JSONP. See also https://gist.github.com/dsmeringe/5134955 for "queryClass"
<?php
/**
* Search support for websites using JSON/JSONP.
* Built to be used with a jquery ui autocomplete field.
*
* This example is slightly generalized compared to it's original..
*
* Search parameter for search values is 'term', like
* quicksearch.php?term=search-value
*
@dsmeringe
dsmeringe / gist:4739033
Last active December 12, 2015 07:48
Short guide on how to setup PHPUnit properly for Yii framework projects

Quick start for Yii with PHPUnit

install PHPUnit

prepend with sudo on mac

pear install --alldeps --force phpunit/phpunit
pear install phpunit/PHPUnit_Selenium
pear install phpunit/phpunit_story

pear install phpunit/dbunit