Skip to content

Instantly share code, notes, and snippets.

View hkdobrev's full-sized avatar

Harry Dobrev hkdobrev

View GitHub Profile
@hkdobrev
hkdobrev / .gitignore
Last active February 3, 2024 14:37 — forked from octocat/.gitignore
# Folder view configuration files #
###################################
.DS_Store
Desktop.ini
# Thumbnail cache files #
#########################
._*
ehthumbs.db
Thumbs.db
@hkdobrev
hkdobrev / class-order.php
Last active April 11, 2025 09:57
PHP convention for the order in a class.
<?php namespace Vendor\Library;
use Another\Vendor\Library\ClassName;
abstract class ClassName extends AnotherClass implements Countable, Serializable
{
const CONSTANTS = 'top';
use someTrait, anotherTrait {
anotherTrait::traitMethod insteadof someTrait;
@hkdobrev
hkdobrev / vagrant-ssh.log
Last active December 19, 2015 20:19
Problem with `vagrant ssh` in both `vagrant up` and `vagrant ssh`.
INFO global: Vagrant version: 1.2.3
DEBUG global: Loading core plugin: /opt/vagrant/embedded/gems/gems/vagrant-1.2.3/plugins/communicators/ssh/plugin.rb
INFO manager: Registered plugin: ssh communicator
DEBUG global: Loading core plugin: /opt/vagrant/embedded/gems/gems/vagrant-1.2.3/plugins/provisioners/cfengine/plugin.rb
INFO manager: Registered plugin: CFEngine Provisioner
DEBUG global: Loading core plugin: /opt/vagrant/embedded/gems/gems/vagrant-1.2.3/plugins/provisioners/puppet/plugin.rb
INFO manager: Registered plugin: puppet
DEBUG global: Loading core plugin: /opt/vagrant/embedded/gems/gems/vagrant-1.2.3/plugins/provisioners/shell/plugin.rb
INFO manager: Registered plugin: shell
DEBUG global: Loading core plugin: /opt/vagrant/embedded/gems/gems/vagrant-1.2.3/plugins/provisioners/ansible/plugin.rb
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
@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:

@hkdobrev
hkdobrev / README.md
Created July 24, 2012 09:13
isEqual for objects in JavaScript
@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 / 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 / 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 / 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)