Skip to content

Instantly share code, notes, and snippets.

View dkobia's full-sized avatar

David Kobia dkobia

View GitHub Profile
<?php
protected $_created_column = array('column' => 'account_date_add', 'format' => 'Y-m-d H:i:s');
protected $_updated_column = array('column' => 'account_date_modified', 'format' => 'Y-m-d H:i:s');
<?php
/**
* Overload saving to perform additional functions on the account
*/
public function save(Validation $validation = NULL)
{
// Do this for first time items only
if ($this->loaded() === FALSE)
{
<?php
// In Hook -- you can even just call this for Router::$controller == 'main' only
$category_list = ORM::factory('category')->where('category_visible', '1')
->where('parent_id', '0')
->where('category_trusted != 1')
->orderby('category_position', 'ASC')
->orderby('category_title', 'ASC')
->find_all();
Kohana::config_set('settings.category_list', 'category_list');
@dkobia
dkobia / gist:2777540
Created May 23, 2012 20:21
Base Class for a RESTful Kohana
<?php defined('SYSPATH') OR die('No direct access allowed.');
class Controller_API extends Controller
{
/**
* @var Object Request Payload
*/
protected $_request_payload = NULL;
/**
* @var Object Response Payload
{
"results": {
"organization": [
"Howard University",
"New York Times"
],
"person": [
"Harris Brown",
"Logosou",
"HELENE COOPER",
{
"results": {
"person": [
"Bill",
"Moi",
"Githu Muigai",
"Kibaki"
],
"organization": [
"Cabinet",
PHP Parse error: syntax error, unexpected '}' in /Users/david/LOCALHOST/Swiftriver/application/classes/swiftriver/dropletqueue.php on line 153
PHP Stack trace:
PHP 1. {main}() /Users/david/LOCALHOST/Swiftriver/index.php:0
PHP 2. Kohana_Request->execute() /Users/david/LOCALHOST/Swiftriver/index.php:118
PHP 3. Kohana_Request_Client->execute() /Users/david/LOCALHOST/Swiftriver/system/classes/kohana/request.php:1138
PHP 4. Kohana_Request_Client_Internal->execute_request() /Users/david/LOCALHOST/Swiftriver/system/classes/kohana/request/client.php:64
PHP 5. ReflectionMethod->invoke() /Users/david/LOCALHOST/Swiftriver/system/classes/kohana/request/client/internal.php:118
PHP 6. Controller_Crawler_Main->action_index() /Users/david/LOCALHOST/Swiftriver/system/classes/kohana/request/client/internal.php:118
PHP 7. Swiftriver_Crawlers::do_crawl() /Users/david/LOCALHOST/Swiftriver/application/classes/controller/crawler/main.php:107
PHP 8. Swiftriver_Crawlers::do_schedule() /Users/david/LOCALHOST/Swiftrive
@dkobia
dkobia / gist:1676525
Created January 25, 2012 14:31
Swift setup on local
#!/bin/sh
############################################################
############################################################
#
# - In terminal make the script executable by typing:
#
# chmod a+x (yourscriptname)
#
# - Then in finder right-click your file and select
# "Open with" and then "Other...".
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
var orig_width = $("#map").width();
var orig_height = $("#map").height();
currZoom = map.getZoom();
currCenter = map.getCenter();
$(".fullscreenmap_click").colorbox({
width:"100%",
<?php
...
// Array of available channel options
'channel_options' => array(
// Channel option with type
'email' => array(
// Label of the option (*tip use i18n __('xxx'))
'label' => __('Email'),
// Option type (text, textarea, password, radio)