Skip to content

Instantly share code, notes, and snippets.

View ronan-gloo's full-sized avatar

Ronan ronan-gloo

  • ShoppingFeed
  • France
View GitHub Profile
$serie['data'] = array(
array('value 1', 20),
array('value 2', 45),
array('other 3', 60)
);
$this->highcharts->set_type('pie');
$this->highcharts->set_serie($serie);
$data['charts'] = $this->highcharts->render();
@ronan-gloo
ronan-gloo / gist:950500
Created May 1, 2011 13:29
Fuel Inflector suggestion
<?php
/**
* plural_or_singular function.
* Call singularize or pluralize method by counting a num or an array.
*
*
* @param int $count (default: 1) string, int or array: the value to count
* @param string $str (default: '') string to pluralize / singularize
* @param bool $w_count (default: false) Determine if the function returns the count
* @param string $sep (default: ' ') count - string separator
<?php
class Controller_Decode extends Controller {
public function action_iso()
{
$content = file_get_contents(DOCROOT.'files/decode/vins.sql');
$content = utf8_decode($content);
exit($content);
return Response::forge(View::forge('decode/iso', array('content' => $content), false));
header('Content-type: image/jpeg');
$im = imagecreatefromjpeg('test.jpg');
imagefilter($im, IMG_FILTER_GRAYSCALE);
imagefilter($im, IMG_FILTER_CONTRAST, 255);
imagefilter($im, IMG_FILTER_NEGATE);
imagefilter($im, IMG_FILTER_COLORIZE, 55, 157, 18);
imagefilter($im, IMG_FILTER_NEGATE);
return Response::forge(imagejpeg($im));
@ronan-gloo
ronan-gloo / gist:3276553
Created August 6, 2012 16:54
is_string ?
public static function is_html($string)
{
return strlen(strip_tags($string)) < strlen($string);
}
@ronan-gloo
ronan-gloo / gist:3550934
Created August 31, 2012 09:45
Fancybox html5 video iframe fullscreen
$('.fancybox').fancybox({
afterLoad: function(e) {
$(e.inner).find('iframe').attr({
'webkitallowfullscreen': true,
'mozallowfullscreen': true
});
}
});
// parent controller in global namespace
abstract class Controller_Application extends Controller {
protected static $_vm = 'application';
public function before()
{
$this->view = ViewModel::forge($this->_vm);
}
if ( ! class_exists($class))
{
if ( ! class_exists($class = $viewmodel) or ! class_exists($class = '\\View_'.ucfirst($viewmodel)))
{
throw new \OutOfBoundsException('ViewModel "View_'.ucfirst(str_replace(array('/', DS), '_', $viewmodel)).'" could not be found.');
}
}
<?php
// Error: Trait method init has not been applied...
class Node implements NodeInterface {
use Component\Attribute,
Component\Manipulation {
Component\Attribute::init as protected attributes;
Component\Manipulation::init as protected manipulation;
}
}
<?php
namespace Project\Raw {
define('VT', 100000);
$mt['NS no Backslash']['start'] = microtime(true);
for ($i = 0; $i < VT; $i++) {
is_array(VT);
is_string(VT);
is_object(VT);