Skip to content

Instantly share code, notes, and snippets.

Avatar

Wim Mostmans Sitebase

View GitHub Profile
@Sitebase
Sitebase / gist:4016452
Created Nov 5, 2012 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts
View gist:4016452

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
View gist:4038104
-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
-moz-box-sizing: border-box; /* Firefox, other Gecko */
box-sizing: border-box; /* Opera/IE 8+ */
@Sitebase
Sitebase / clearfix.css
Created Nov 10, 2012 — forked from terkel/clearfix.css
CSS: Clearfix
View clearfix.css
.clearfix {
*zoom: 1;
}
.clearfix:before,
.clearfix:after {
content: "";
display: table;
}
.clearfix:after {
clear: both;
@Sitebase
Sitebase / Procfile
Created Nov 13, 2012
PHP Worker file that restarts after crash
View Procfile
worker: while true; do cd /app/www/ && /app/bin/php worker.php; sleep 1; done
View 0-dependencies.sh
#!/bin/bash
logger="logger -t bbbx-boot"
install()
{
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get -y \
-o DPkg::Options::=--force-confdef \
-o DPkg::Options::=--force-confold \
install $@
@Sitebase
Sitebase / gist:4510386
Created Jan 11, 2013
Phing list fileset
View gist:4510386
<fileset id="src.php.custom" dir="${base.dir}src/application/">
<include name="controllers/**/*.php" />
<include name="core/**/*.php" />
<include name="models/**/*.php" />
<include name="modules/**/*.php" />
<include name="helpers/**/*.php" />
<exclude name="**/libraries/**/*.php" />
</fileset>
<target name="fileset-list">
@Sitebase
Sitebase / Unit testing
Last active Dec 11, 2015
Requirements for unit testing
View Unit testing
## Install ##
* nodejs: http://nodejs.org/download/ (how to guide for win if needed: http://dailyjs.com/2012/05/03/windows-and-node-1/)
* pear
* phpunit:
* pear channel-discover pear.phpunit.de
* pear install phpunit/PHPUnit
* jshint: npm install jshint
## Sublime config ##
https://github.com/Sitebase/sublime-config
@Sitebase
Sitebase / Doctrine.php
Created Feb 22, 2013
Custom doctrine type to store uuid's as binary(16) values in a MySQL database. Set the column type that you want to use as BINARY(16) in MySQL and your good to go.
View Doctrine.php
\Doctrine\DBAL\Types\Type::addType('uuid', 'BuboBox\Doctrine2\DBAL\Types\UuidType');
@Sitebase
Sitebase / gist:5134567
Created Mar 11, 2013
Use array explode in combination with list and support different number of array items. In this example $params can have one, two or three items. Not set items will be null.
View gist:5134567
list($field1, $field2, $field3) = array_pad(explode('.', $params, 3), 3, NULL);
@Sitebase
Sitebase / MY_Form_validation.php
Created Mar 11, 2013
CodeIgniter unique validator that has support for excluding a specific row.
View MY_Form_validation.php
public function unique($value, $params)
{
$CI =& get_instance();
list($table, $field, $exclude_field, $exclude_value) = array_pad(explode('.', $params, 4), 4, NULL);
$CI->form_validation->set_message('unique', 'The %s that you requested is unavailable.');
$CI->db->select('COUNT(*) AS dupe')->from($table)->where($field, $value)->limit(1);
if($exclude_field AND $exclude_value)
{