Skip to content

Instantly share code, notes, and snippets.

@dsbonev
dsbonev / _summary
Last active August 1, 2016 09:48
Memory profile of downloading a large file (13 808 149 bytes)
copy stream: allocated memory: 294 559 250, object space profiler 20 341 328
curl binding: allocated memory: 14 693 276, object space profiler 19 160 242
curl cli: allocated memory: 17 176, object space profiler 3 916 812
ruby net http: allocated memory: 302 107 159, object space profiler 15 602 074
@dsbonev
dsbonev / gist:3ec51fcff901b789db4a
Created April 14, 2015 14:00
findClassesInStylesheets([].slice.apply(document.documentElement.classList))
function findClassesInStylesheets(classes) {
'use strict'
let regexClasses = classes.map(function (className) {
let re = new RegExp('\\.' + className)
console.log('created regexp', re)
return re
})
var sheetCount = 0,

Sublime protocol handler on Ubuntu

First, create a new desktop entry:

# /usr/share/applications/subl-urlhandler.desktop

[Desktop Entry]
Version=1.0
@dsbonev
dsbonev / gist:57fd1c610527539bad1c
Created July 14, 2014 21:04
Sublime/JSHint settings
/*
SublimeLinter settings
*/
{
"sublimelinter": "save-only",
// jshint: options for linting JavaScript. See http://www.jshint.com/options/ for more info.
// By deault, eval is allowed.
"jshint_options":
{
<snippet>
<content><![CDATA[
/* globals define */
define([${1:'dependency'}], function (${2:dependency}) {
'use strict';
return ${3://exported value};
});
]]></content>
<snippet>
<content><![CDATA[
(function (${2:\$, }window, document, undefined) {
'use strict';
${3://your code here}
})(${1:jQuery, }window, document);
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>iffe-m</tabTrigger>
<snippet>
<content><![CDATA[
(function () {
${1://your code here}
})();
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>iffe</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
@dsbonev
dsbonev / Preferences.sublime-settings
Last active August 8, 2019 09:54
Sublime settings
{
"auto_complete_commit_on_tab": true,
"auto_complete_with_fields": true,
"color_scheme": "Packages/User/SublimeLinter/Mac Classic (SL).tmTheme",
"ensure_newline_at_eof_on_save": true,
"folder_exclude_patterns":
[
".byebug_history",
".svn",
".git",
@dsbonev
dsbonev / JSHint
Last active December 14, 2015 22:38
/*
SublimeLinter settings
*/
{
"sublimelinter": "save-only",
// jshint: options for linting JavaScript. See http://www.jshint.com/options/ for more info.
// By deault, eval is allowed.
"jshint_options":
{