Skip to content

Instantly share code, notes, and snippets.

View jeremysells's full-sized avatar

Jeremy Sells jeremysells

View GitHub Profile
@jeremysells
jeremysells / objects pass by reference examples.php
Last active March 2, 2017 11:18
objects pass by reference examples.php
<?php
//---TEST1----------------------------------------------------
function objectTest(stdClass $input) {
$input->name = "Sally";
}
$object = new stdClass;
$object->name = "Bob";
$object->address = "1 Test Street";
objectTest($object);
echo $object->name; //Sally
@jeremysells
jeremysells / netbeans_phpcs_xml.php
Last active July 27, 2018 17:45
Netbeans PHP QA tweaks
#!/bin/bash
# This script makes Netbeans use a custom phpcs.xml (PHP Codesniffer)
# Note: git dir does not work (NB runs out of the git dir)
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# When asked for the standards, return them
# note: The last file is our standard!
if [ $1 = '-i' ]; then
@jeremysells
jeremysells / php_dev_machine.sh
Last active April 5, 2016 22:11
php_dev_machine.sh
sudo apt-get install \
gparted \
gedit \
apache2 \
libapache2-mpm-itk \
php5 \
php5-xdebug \
php5-xsl \
php5-mcrypt \
php5-curl \
@jeremysells
jeremysells / vhost disable caching.conf
Created March 7, 2016 01:02
vhost disable caching.conf
vhost disable asset cacheing
<Directory .../public_html>
#disable caching
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</Directory>
@jeremysells
jeremysells / ShowingHtmlEscape.php
Last active February 29, 2016 21:16
Showing html escape
<?php
$value = "some\"string'™";
?>
<form name="test" action="<?php echo time(); ?>" method="POST">
<input type="text" value="<?php echo htmlentities($value, ENT_QUOTES, 'UTF-8'); ?>" name="test">
<input type="submit" value="go" name="go" />
</form>
<br/>
<br/>
@jeremysells
jeremysells / DeclarationShouldBeCompatibleWithBase.php
Created November 9, 2015 22:50
Declaration should be compatible with Base
<?php
class ModelA{
public function sayHi() { return "hi"; }
}
class ModelB extends ModelA {
public function sayHi() { return "hello"; }
}
class SomethingA{
@jeremysells
jeremysells / xdebug.ini
Created October 19, 2015 22:40
local xdebug settings
zend_extension=xdebug.so
xdebug.remote_host=127.0.0.1
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.idekey=netbeans-xdebug
xdebug.remote_autostart=1