Skip to content

Instantly share code, notes, and snippets.

@koloda
koloda / fabric.js
Created January 11, 2013 14:05 — forked from TCotton/fabric.js
function html5_canvas() {
// declear variables
var $canvas, $rect, $circle, $triangle, $i, $limit, $width, $height;
//create canvas object with div id
$canvas = new fabric.Canvas('canvas_1');
// create Circle - note radius
@koloda
koloda / bootstrap 2 hide all popovers when new activate
Created June 5, 2014 11:24
bootstrap 2 hide all popovers when new activate
$(function(){
$('a.class').popover({'title':'Title', 'content':$('#content').html(), 'html':true, 'placement':'bottom'});
$('a.class').live('click', function(){
$('a.class').not(this).popover('hide');
});
});
@koloda
koloda / Validate georgian date
Created June 18, 2014 16:53
Validate georgian date
public function validGeorgianDate($attribute, $params)
{
$parts = explode('/', $this->$attribute);
if(count($parts) == 3)
if(is_numeric($parts[0]) && is_numeric($parts[1]) && is_numeric($parts[2]))
if (checkdate($parts[0], $parts[1], $parts[2]))
return;
$this->addError($attribute, "Value is nod valid date.");
}
apt-get install -y ppa-purge
add-apt-repository -y ppa:ondrej/php5-oldstable
apt-get update
ppa-purge ppa:ondrej/php5
apt-get update && apt-get upgrade -y && apt-get autoremove -y && apt-get autoclean -y
sudo apt-add-repository ppa:glasen/intel-driver
sudo apt-get update
sudo apt-get install xserver-xorg-video-intel
#If you use Ubuntu 12.04, then you can enable the 'SNA' feature (disabled by default) of Intel Sandy Bridge architecture which improves #both 2D and 3D performance. For that, enter the below command in your Terminal window to open the text editor with administrative #privileges. (/etc/X11/xorg.conf)
Section "Device"
Identifier "Card0″
Driver "intel"
Option "AccelMethod" "sna"
@koloda
koloda / elementarySoftwareInstaller.sh
Last active January 21, 2016 12:21
Install all software after installing clean ElementaryOs
#! /bin/bash
wait
apt-get update
wait
apt-get upgrade
wait
apt-get install php5 php5-xdebug php5-xmlrpc php5-odbc php5-mysql php5-memcache php5-memcached php5-mcrypt php5-intl php5-imap php5-imagick php5-gd php5-curl php5-cli php-pear php-codesniffer
wait
@koloda
koloda / changeJavaVersion
Created July 10, 2014 13:20
change Java version
sudo update-alternatives --config javac
sudo update-alternatives --config java
@koloda
koloda / jsDateToFormatFunction
Created July 12, 2014 00:21
js - date to format function
if(!Date.prototype.toLocaleFormat){
Date.prototype.toLocaleFormat = function(format) {
var f = {
Y : this.getFullYear(),
y : this.getFullYear()-(this.getFullYear()>=2e3?2e3:1900),
m : this.getMonth() + 1,
d : this.getDate(),
H : this.getHours(),
M : this.getMinutes(),
S : this.getSeconds()
@koloda
koloda / url_get_params_as_array.js
Last active August 29, 2015 14:16
(JS) Считывает GET переменные из URL страницы и возвращает их как ассоциативный массив.
function getUrlVars()
{
var vars = {}, hash;
var hashes = window.location.toString().slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
vars[hash[0]] = hash[1];
}
@koloda
koloda / gist:9ba26631afc984dc3da8
Created May 12, 2015 11:36
set keyboard switching to Alt+Shift (in elementary OS)
gsettings set org.pantheon.desktop.gala.keybindings switch-input-source "['<Alt>Shift_L', '<Alt>Shift_R', '<Shift>Alt_L', '<Shift>Alt_R']"