Skip to content

Instantly share code, notes, and snippets.

View bobmagicii's full-sized avatar
🤌

Bob Magic II bobmagicii

🤌
View GitHub Profile
@bobmagicii
bobmagicii / gist:5136383
Created March 11, 2013 18:20
using ImageFilterIterator (cleaner)
<?php
$path = dirname(__FILE__);
foreach(new ImageFilterIterator($path) as $image) {
echo $image, PHP_EOL;
}
<?php
// this is an example of using braces to mark off code for no reason other than
// to mark off code.
{
if(is_int($input)) $this->SearchByID($input);
else if(strpos($input,'@')!==false) $this->SearchByEmail($input);
else $this->SearchByKeyword($input);
}
EDITOR=joe
<?php
$q = $db->Query(
new m\Database\Query('dma-vehicle-get-list-by-owner'),
[':OwnerID' => $id]
);
<?php
$sql = new m\Database\Query;
$sql->Select('*')
->From('dma_objects')
->NaturalJoin('dma_objects_vehicles')
->Where('obj_type="vehicle"')->AndWhere('u_id=:OwnerID')
->OrderBy('obj_time_created ASC');
echo $sql;
<?php
class PortMapper {
public $Host;
public $Guest;
public function __construct($host,$guest) {
list(
$this->Host,
$this->Guest
<?php
static function Get($what) {
if(is_int($what))
return self::FetchByID($what);
else if(strpos($what,'@') !== false)
return self::FetchByEmail($what);
else
<?php
namespace App;
class User {
public function __construct($data) {
// given raw $data do whatever is needed to populate
// the object as we wish to interact with it.
}
git rm -r --cached .
@bobmagicii
bobmagicii / gist:8312766
Last active January 2, 2016 13:49
before php 5.3, this was a huge pain in the ass to do in php-gtk. before 5.4, it was a mild pain in the ass.
<?php
namespace App;
class TrayIcon extends \GtkStatusIcon {
public $Menu;
public function __construct() {
parent::__construct();