Skip to content

Instantly share code, notes, and snippets.

<?php
$file = new Core\File\RemoteFile('http://bestclipartblog.com/clipart-pics/food-clip-art-6.png');
// Check if exists:
var_dump($file->exists());// bool(true)
// Get HTTP Status Code
var_dump($file->getHttpStatus()); // int(200)
@daveWid
daveWid / controller.php
Created April 11, 2012 12:55
Controller for Kohana
<?php defined('SYSPATH') or die('No direct script access.');
/**
* A base Controller class.
*
* @author Dave Widmer <[email protected]>
*/
class Controller extends Kohana_Controller
{
/**
@cviebrock
cviebrock / DateFormat.php
Created March 14, 2012 21:50
DateFormat class for Laravel (or anyone)
<?php
class DateFormat {
const DATE_SHORT = 'Y-m-d';
const DATE_LONG = 'F j, Y';
const DATETIME_SHORT = 'Y-m-d H:i';
const DATETIME_LONG = 'F j, Y, g:i a';
@buhrmi
buhrmi / gist:1344659
Created November 7, 2011 10:51
Sublime Text 2 Git Annotation Colors
<dict>
<key>name</key>
<string>Git Modified Line</string>
<key>scope</key>
<string>git.changes.x</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#272852</string>
</dict>
@jmhobbs
jmhobbs / twitter.php
Created October 6, 2011 16:03
Kohana 3 - OAuth & Twitter Example
<?php
class Controller_Twitter extends Controller {
public function action_index () {
// Load a consumer from config file.
$consumer = OAuth_Consumer::factory( Kohana::config( 'oauth.twitter' ) );
@ericlbarnes
ericlbarnes / time_since.php
Created August 26, 2011 12:45
PHP::time_since
// ------------------------------------------------------------------------
/**
* Timespan
*
* Returns a span of seconds in this format:
* 10 days 14 hours 36 minutes 47 seconds
*
* @access public
* @param integer a number of seconds
@jamsesso
jamsesso / mysql.php
Created July 23, 2011 16:57
Class to manage multiple MySQL server connections in an application.
<?php
class mysql extends mysqli
{
public static $servers = array();
public static function ignite_server($name, $host, $username, $password, $db, $port = null, $socket = null)
{
if(is_null($port))
$port = ini_get('mysqli.default_port');
if ($handle = fopen($csv_file, 'r'))
{
$all_headings = array_unique(explode(',', trim(fgets($handle))));
foreach ($all_headings as $heading)
{
if ( ! $heading)
{
break;
}
@jwage
jwage / SplClassLoader.php
Last active August 16, 2024 17:36
Add MIT license.
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,