Skip to content

Instantly share code, notes, and snippets.

View biakaveron's full-sized avatar

Ivan Brotkin biakaveron

  • Russian Federation
View GitHub Profile
@biakaveron
biakaveron / cusel-fixed-min-2.5.js
Created November 6, 2012 06:59
Обновленная версия cuSel (скроллинг работает с jQuery 1.7+)
/* -------------------------------------
cusel version 2.5
last update: 31.10.11
смена обычного селект на стильный
autor: Evgen Ryzhkov
updates by:
- Alexey Choporov
- Roman Omelkovitch
using libs:
@biakaveron
biakaveron / request.php
Created May 23, 2012 06:46
Old-style Request->uri() for Kohana v3.2
<?php defined('SYSPATH') or die('No direct script access.');
class Request extends Kohana_Request {
public function uri(array $params = null)
{
if ($params === NULL)
{
return parent::uri();
}
class Debug extends Kohana_Debug {
public static function vars()
{
if (func_num_args() === 0)
return;
$backtrace = debug_backtrace();
$path = $backtrace[0]['file'];
$filename = Debug::path($path);

GitHub OAuth Busy Developer's Guide

This is a quick guide to OAuth2 support in GitHub for developers. This is still experimental and could change at any moment. This Gist will serve as a living document until it becomes finalized at Develop.GitHub.com.

OAuth2 is a protocol that lets external apps request authorization to private details in your GitHub account without getting your password. All developers need to register their application before getting started.

Web Application Flow

  • Redirect to this link to request GitHub access:
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* Kohana-World Exception Handler
*
* @package KW-Core
* @author Kohana-World Development Team
* @license MIT License
* @copyright 2011 Kohana-World Development Team
*/
@biakaveron
biakaveron / jelly_mptt.php
Created February 8, 2011 14:52
very draft Jelly MPTT class
<?php defined('SYSPATH') OR die('No direct access allowed.');
abstract class Jelly_Model_MPTT extends Jelly_Model {
protected static $_columns = array(
'left' => 'lft',
'right' => 'rgt',
'scope' => 'scope',
'level' => 'lvl',
'parent_id' => 'parent_id',
@biakaveron
biakaveron / route.php
Created January 29, 2011 22:13
routes with prefixes and suffixes
<?php defined('SYSPATH') OR die('No direct access allowed.');
class Route extends Kohana_Route {
protected static $_prefix = array();
protected static $_suffix = array();
protected function _patch()
{
if ( ! empty(self::$_prefix))
@biakaveron
biakaveron / orm-remove.php
Created August 27, 2010 07:52
how to delete all user roles? Need ORM changes
/**
* Removes a relationship between this model and another (or delete all relationships).
*
* @param string alias of the has_many "through" relationship
* @param mixed related ORM model or NULL to clear relationship
* @return ORM
*/
public function remove($alias, ORM $model = NULL)
{
$query = DB::delete($this->_has_many[$alias]['through'])
diff --git a/classes/kohana/auth/orm.php b/classes/kohana/auth/orm.php
index dfca403..ed3a78c 100644
--- a/classes/kohana/auth/orm.php
+++ b/classes/kohana/auth/orm.php
@@ -143,11 +143,11 @@ class Kohana_Auth_ORM extends Auth {
if ($token = cookie::get('authautologin'))
{
// Load the token and user
- $token = ORM::factory('user_token', $token);
+ $token = ORM::factory('user_token', array('token' => $token));
// bootstrap.php
Route::set('artist','(sales(/<month>(/<day>)))')
->defaults(array(
'controller' => 'sales',
'action' => 'month',
));
// classes/sales.php
class Controller_Sales extends Controller {