Skip to content

Instantly share code, notes, and snippets.

View skowron-line's full-sized avatar

K.Skaradziński skowron-line

  • Warsaw
View GitHub Profile
@skowron-line
skowron-line / pdo.php
Created September 29, 2011 13:49
[modules/database/classes/kohana/database/pdo.php] add condition to check if user use pqsql database, and correct returnig last insert id
<?php defined('SYSPATH') or die('No direct script access.');
/**
* PDO database connection.
*
* @package Kohana/Database
* @category Drivers
* @author Kohana Team
* @copyright (c) 2008-2009 Kohana Team
* @license http://kohanaphp.com/license
*/
@skowron-line
skowron-line / db.php
Created April 22, 2012 06:49
Extension for kohana 3.2 DB class
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
*
* @author skowron-line
*/
class DB extends Kohana_DB {
/**
*
* @var string cache driver
*/
@skowron-line
skowron-line / jquery-tab-emulator.js
Last active December 16, 2015 08:09
Simple tab emulator, find fields from selector and allows to skip between then.
var tab = function()
{
this.fields = $('input:not(:disabled):not([type="hidden"]):not([readonly="readonly"]), a, select:not(:disabled)');
this.current = 0;
}
$.extend(tab.prototype, {
forward: function() {
this.current++;
if(this.current > this.fields.length) {
@skowron-line
skowron-line / select2dropdown.js
Created June 30, 2013 16:15
Select to (bootstrap) dropdown..
(function($){
$.fn.select2Dropdown = function(){
var options = this.find('option'),
selected = this.find('option:selected').length == 0
? options[0]
: this.find('option:selected'),
div = document.createElement('div'),
a = document.createElement('a'),
span = document.createElement('span'),
ul = document.createElement('ul');
@skowron-line
skowron-line / module.sh
Last active December 19, 2015 14:39
Kohana module tree generator
#!/bin/bash
# sudo ./module.sh <module_name>
module=$1
path[0]="modules/$module"
path[1]="modules/$module/classes"
path[2]="modules/$module/classes/controller"
path[3]="modules/$module/classes/model"
path[4]="modules/$module/views"
path[5]="modules/$module/views/$module"
@skowron-line
skowron-line / slider.js
Last active December 23, 2015 10:49
jquery slider using toggle function. Example: http://jsfiddle.net/skowron_line/ch4g8/1/
var s = $('.slider'), i = 0;
setInterval(function(){
var o = $([]);
o = o.add(s[i]);
if(i === s.length - 1) {
i = -1;
}
i++;
o = o.add(s[i]);
@skowron-line
skowron-line / table.css
Last active December 24, 2015 03:59
table.css extend version for bootstrap 2.3.2 Example: http://skowronline.pl/table/
/*
http://skowronline.pl/table/
*/
.ordinal {
text-align:right !important;
width: 25px;
padding-left:5px;
}
a.edit-item {
color: #FCCA8B;
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
*
* @author skowron-line
*/
class DB extends Kohana_DB {
public static $_cache_driver = 'file';
public static $_log_query = false;
private static $_transaction = false;
@skowron-line
skowron-line / check-uncheck.js
Last active January 2, 2016 08:28
check parent elements, uncheck child
$.fn.checkUncheck = function(options){
var defaults = {
onCheck: jQuery.noop,
onUnCheck: jQuery.noop
};
settings = $.extend({}, defaults, options);
$(this).each(function(){
var e = $(this);
e.click(function(){
if(e[0].checked) {
@skowron-line
skowron-line / d2
Last active August 29, 2015 14:05
<?php
//Settlement
/**
* @ORM\ManyToOne(targetEntity="Certificate\LocalizationBundle\Entity\Localization", inversedBy="settlement")
*/
private $localization;
//Localization
/**
* @ORM\OneToMany(targetEntity="Certificate\LocalizationBundle\Entity\LocalizationSettlement", mappedBy="localization", cascade={"persist"})