Skip to content

Instantly share code, notes, and snippets.

View hkdobrev's full-sized avatar

Harry Dobrev hkdobrev

View GitHub Profile
@hkdobrev
hkdobrev / .htaccess
Created October 17, 2011 07:06
.htaccess rules for chrome frame
BrowserMatch MSIE ie
Header set X-UA-Compatible "IE=Edge,chrome=1" env=ie
@hkdobrev
hkdobrev / error.php
Created January 11, 2012 23:42
Custom Kohana_Exception class for handling exceptions in production.
<?php defined('SYSPATH') OR die('No direct access allowed!');
class Controller_Error extends Controller_Layout {
public function before()
{
parent::before();
$this->response->status((int) $this->request->action());
@hkdobrev
hkdobrev / hiddenFileInput.js
Created February 6, 2012 20:22
Hidden File Input jQuery Plugin
$.fn.hiddenFileInput = function () {
$.each(this.filter('input[type=file]'), function () {
var input = $(this),
parent = input.parent();
input.css({
opacity: 0,
width: parent.css('width'),
height: parent.css('height'),
position: 'absolute',
left: 0,
@hkdobrev
hkdobrev / gist:2031902
Created March 13, 2012 21:42
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Selecting / Jumping

Ctrl+L select line (repeat to select next lines)
Ctrl+D select word (repeat select others occurrences in context for multiple editing)
@hkdobrev
hkdobrev / gist:2049057
Created March 16, 2012 08:04 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@hkdobrev
hkdobrev / insertion_sort.php
Created March 18, 2012 11:53
insertion sort
<?php
function insertion_sort($arr)
{
$length = count($arr);
for ($i = 1; $i < $length; $i++)
{
$value = $arr[$i];
$j = $i - 1;
@hkdobrev
hkdobrev / randomize.php
Created March 20, 2012 12:47
randomize arrays
<?php
function randomize($initial, $to_merge = NULL)
{
$result = array();
$lengths = array();
$total = 0;
$arrays = func_get_args();
foreach ($arrays as $array)
@hkdobrev
hkdobrev / README.md
Created July 24, 2012 09:13
isEqual for objects in JavaScript
@hkdobrev
hkdobrev / README.md
Created September 16, 2012 20:32
SASS mixin for responsive grids

Responsive grids in SASS

Ever wanted to generate @media rules for your grid?

Ever used a calculator or an Excel spreadsheet to calculate widths for every column?

No more!

Usage:

def insertion_sort(list):
for index in range(len(list))
value = list[index]
i = index - 1
while i>=0 and value < list[i]:
list[i+1] = list[i] # shift number in slot i right to slot i+1
list[i] = value #shift value left into slot i
i = i - 1