Skip to content

Instantly share code, notes, and snippets.

View taai's full-sized avatar

Jānis Lācis taai

  • Latvia
View GitHub Profile
git submodule add git://github.com/zombor/KOstache.git modules/kostache
git submodule init
git submodule update --init --recursive
this gives me an error:
fatal: Not a git repository: ../../../../../../../../..//c/var/www/portal/htdocs/.git/modules/modules/kostache/modules/vendor/mustache
Failed to recurse into submodule path 'modules/kostache'
@taai
taai / integer.php
Created July 31, 2012 08:52
Integer field type for Kohana-ORM-Leap - modified to support 8byte integers and fallback to strings, if system doesn't support 8byte integers
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* Copyright 2011-2012 Spadefoot
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@taai
taai / test_call_user_func.php
Created August 3, 2012 13:23
Don't use call_user_func() when you can live without it. I's 4-8 times slower!
<?php
class Employee {
public static function salary()
{
return 0;
}
public function test1()
@taai
taai / model.php
Created August 15, 2012 17:07
self::get_called_class() throws error
<?php
abstract class Base_DB_ORM_Model extends Kohana_Object {
public function get_errors_filename()
{
$self = get_class($this);
return call_user_func(array($self, 'errors_filename'));
}
@taai
taai / bootstrap.php
Created November 27, 2012 16:15
look at set_exception_handler(array('App_Exception_Handler', 'handle'));
<?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
@taai
taai / Handler.php
Created November 27, 2012 16:19
Can't set custom exception handler in Kohana 3.3
<?php defined('SYSPATH') or die('No direct script access.');
/**
* App Exception handler
*/
class App_Exception_Handler {
public static function handle(Exception $e)
{
@taai
taai / gist:4155288
Created November 27, 2012 16:33
Classes loaded
I18n
Kohana_I18n
Log
Kohana_Log
Config
Kohana_Config
App_Exception_Handler
Log_File
Kohana_Log_File
Log_Writer
@taai
taai / example.html
Last active December 17, 2015 04:18
<script>
Post = can.Model({
}, {
init: function() {
var children = this.children;
this.removeAttr('children');
this.children = new Post.List( children.serialize() );
}
});
@taai
taai / vestule
Created August 9, 2013 09:44
Vēstule Latvijas Republikas Saeimai. Rīgā, 2013. gada 9. augustā.
Sveicināti!
Vēlos izteikt pretenziju par grozījumiem Latvijas Administratīvo pārkāpumu kodeksā - Nr: 431/Lp11.
Pretenzijas man ir pret 171.3 pantu.
171.3 pants. Alkoholisko dzērienu iegādāšanās, ja pircējs vecumā no 18 līdz 25 gadam neuzrāda personu apliecinošu dokumentu
Par alkoholisko dzērienu iegādāšanos, ja pircējs vecumā no 18 līdz 25 gadam neuzrāda personu apliecinošu dokumentu –izsaka brīdinājumu vai uzliek naudas sodu līdz divdesmit pieciem latiem.
Loģiski spriežot, 24 gadus veca persona, iegādājoties alkoholiksu dzērienu un neuzrādot personu apliecinošu dokumentu, būs izdarījusi administratīvu pārkāpumu, par kuru var tikt sodīta ar līdz pat 25 latu naudas sodu.
@taai
taai / gist:7747966
Last active December 30, 2015 00:09
This enables IE9 to do a CORS (cross-domain) request. Place this right after jQuery script. I recommend to download this and save it locally. Library can found here: https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest
<!--[if IE 9]>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.1/jquery.xdomainrequest.min.js"></script>
<![endif]-->