Skip to content

Instantly share code, notes, and snippets.

View dr-dimitru's full-sized avatar
👨‍💻
get 💩 done

dr.dimitru dr-dimitru

👨‍💻
get 💩 done
View GitHub Profile
@dr-dimitru
dr-dimitru / tutorial.md
Last active January 2, 2016 05:48
Reinstalling Mac OS X

This file briefly describes main moments of fresh isntalling process and troubleshooting of most common erros and mistakes.

Before follow steps below create Time Mashine or any other backup copy of your files!!!

###Create Bootable USB or CD/DVD This step is very common to every one who even once tried to reinstall fresh copy of Mac OS X since 10.6

@dr-dimitru
dr-dimitru / minify_function.php
Last active May 16, 2024 04:59
HTML MINIFY RegEx
$re = '%# Collapse whitespace everywhere but in blacklisted elements.
(?> # Match all whitespans other than single space.
[^\S ]\s* # Either one [\t\r\n\f\v] and zero or more ws,
| \s{2,} # or two or more consecutive-any-whitespace.
) # Note: The remaining regex consumes no text at all...
(?= # Ensure we are not in a blacklist tag.
[^<]*+ # Either zero or more non-"<" {normal*}
(?: # Begin {(special normal*)*} construct
< # or a < starting a non-blacklist tag.
(?!/?(?:textarea|pre|script)\b)
@dr-dimitru
dr-dimitru / BroadcomBluetoothHostControllerUSBTransport
Created June 22, 2014 08:43
Mac OS X Mavericks 10.9 bluetooth adapter driver reset
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
@dr-dimitru
dr-dimitru / object.js
Created September 11, 2014 10:20
Vanilla JS inArray
/*
* @function
* @name Object.prototype.inArray
* @description Extend Object prototype within inArray function
*
* @param {mix} needle - Search-able needle
* @param {bool} searchInKey - Search needle in keys?
*
*/
Object.defineProperty(Object.prototype, 'inArray',{
@dr-dimitru
dr-dimitru / object.js
Created September 11, 2014 16:18
Meteor defineReactiveProperty() method
/*
* @function
* @name Object.defineReactiveProperty
* @description define Reactive property:
* - set callback before Setter and Getter
* - set callback on Setter
* - set callback on Getter
*
* @param {object} target - Object on which we define a property
* @param {string} prop - Name of defining property
@dr-dimitru
dr-dimitru / string.js
Last active August 29, 2015 14:07
Clone (a.k.a. create singleton) for String object
/*jshint strict:false */
/*
* @function
* @namespace String.prototype
* @name clone
*
* @description Clone (a.k.a. create singleton) of String object
* This method allows to resolve issue with variable's referencing
* See performance here: http://jsperf.com/clone-create-singleton-for-string-object
@dr-dimitru
dr-dimitru / readme.md
Last active August 29, 2015 14:07
JavaScript: 4 ways to concatenate a string
@dr-dimitru
dr-dimitru / readme.md
Last active August 29, 2015 14:07
Test performance of array toString join
@dr-dimitru
dr-dimitru / readme.md
Last active August 29, 2015 14:07
localStorage square bracket syntax vs. methods
var symbols = '23456789QWERTYUPASDFGHJKZXCVBNM';
var qty = 1500000;
var length = 7;
var code, hash, i, maxIndex, rand, symbol, _i, _j;
maxIndex = symbols.length - 1;
for (i = _i = 1; 1 <= qty ? _i <= qty : _i >= qty; i = 1 <= qty ? ++_i : --_i) {
code = 'KX ';
hash = 0;
for (symbol = _j = 1; 1 <= length ? _j <= length : _j >= length; symbol = 1 <= length ? ++_j : --_j) {
rand = Math.floor((Math.random() * maxIndex) + 1);