Skip to content

Instantly share code, notes, and snippets.

View sebacruz's full-sized avatar
🤖

Sebastián Cruz sebacruz

🤖
View GitHub Profile
@sebacruz
sebacruz / json.php
Created February 8, 2012 22:02 — forked from salathe/json.php
JSON Helper for Kohana v3
<?php defined('SYSPATH') or die('No direct script access.');
/**
* JSON helper class
*
* Examples:
* $j = JSON::decode('{"Organization": "Kohana"}'); // Good
* $j = JSON::decode("{'Organization': 'Kohana'}"); // Invalid
* $j = JSON::decode('{"Organization": "Kohana"}', NULL, 1); // depth stack exceeded
*
* @package Kohana
@sebacruz
sebacruz / ajax.php
Created February 8, 2012 22:02 — forked from lukemorton/ajax.php
Ajax Template Controller for Kohana 3.1
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* AJAX Helper
*
* @author Sergei Gladkovskiy <smgladkovskiy@gmail.com>
* @author Luke Morton
*/
class AJAX {
/**
@sebacruz
sebacruz / bootstrap.php
Created February 8, 2012 22:09 — forked from nexeck/bootstrap.php
Kohana v3.2 Bootstrap for multiple environment configs
<?php defined('SYSPATH') or die('No direct script access.');
// -- Environment setup --------------------------------------------------------
// Load the core Kohana class
require SYSPATH.'classes/kohana/core'.EXT;
if (is_file(APPPATH.'classes/kohana'.EXT))
{
// Application extends the core
@sebacruz
sebacruz / gist:1828073
Created February 14, 2012 16:51
Signup response
<?xml version='1.0' encoding='utf-8'?>
<root ><status ><![CDATA[FAIL]]></status>
<message ><errors ><error ><![CDATA[[error_insert_user]Error al tratar de crear el usuario]]></error>
</errors>
</message>
</root>
Array
(
[algorithm] => HMAC-SHA256
[issued_at] => 1329245315
[profile_id] => 183881448297360
[user] => Array
(
[country] => ar
[locale] => es_LA
[age] => Array
mysql> USE tacobell_site;
Database changed
mysql> SHOW TABLES;
ERROR 1018 (HY000): Can't read dir of './tacobell_site/' (errno: 13)
mysql> SELECT * FROM c4GDF__users;
ERROR 1036 (HY000): Table 'c4GDF__users' is read only
mysql>
@sebacruz
sebacruz / gist:1855853
Created February 17, 2012 22:34
Aviso en macro
#showtooltip Habilidad
/cast Habilidad
/rw OBJECTIVO texto que quieras
ORBETIVO puede ser:
%t: pone el nombre del target
%f: pone el nombre del foco
@sebacruz
sebacruz / gist:1858327
Created February 18, 2012 08:53
Normalizes URL according to RFC 3986 to use it in comparison operations.
<?php
/**
* Normalizes URL according to RFC 3986 to use it in comparison operations.
* The function gets URL argument by reference and modifies it.
*
* It returns the normalized URL on success and FALSE of failure.
*
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_OpenId
@sebacruz
sebacruz / example.php
Created March 1, 2012 22:12
Controlador de ejemplo con partner personalizado desde el código.
<?php defined('SYSPATH') or die('No direct script access.');
class Controller_Standalone_Signup_Example extends Controller_Standalone_Signup_v5 {
/**
* Sets the session to use in this app
*
* @var string
* @access public
*/
<?php defined('SYSPATH') or die('No direct script access.');
/**
* Settings related to the Kohana 3 MAXMIND GeoIP module.
*
* @package Kohana GeoIP 3
*/
return array(
// Database location
'database' => MODPATH . 'geoip/database/GeoIP-106_20111129.dat',