Skip to content

Instantly share code, notes, and snippets.

View limarc's full-sized avatar
🚀

Alex Lobashev limarc

🚀
  • Cyprus, Limassol
View GitHub Profile
@limarc
limarc / sublime-settings.json
Last active December 15, 2017 12:40
My Sublime Text 3 settings
{
"always_show_minimap_viewport": true,
"auto_complete": true,
"bold_folder_labels": true,
"color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme",
"default_line_ending": "unix",
"ensure_newline_at_eof_on_save": true,
"fallback_encoding": "Cyrillic (Windows 1251)",
"file_exclude_patterns":
[
// inherit.js
var inherit = function(parent, child) {
var _ = function() {};
_.prototype = parent.prototype;
child.prototype = new _();
child.prototype.constructor = child;
};
// inherit-es5.js
@limarc
limarc / spoiler.js
Last active August 29, 2015 14:04
Spoiler ui
/*
* ...
*/
(function(global) {
'use strict';
/*
* Constructor.
*
* @param {Mixed} element The jquery object or selector.
var timing = window.performance.timing,
metrics = {
dns: timing.domainLookupEnd - timing.domainLookupStart,
tcp: timing.connectEnd - timing.connectStart,
request: timing.responseStart - timing.requestStart,
response: timing.responseEnd - timing.responseStart,
paint: timing.domContentLoadedEventEnd - timing.domLoading,
dom: timing.domComplete - timing.domLoading,
total: timing.loadEventEnd - timing.navigationStart
};
@limarc
limarc / in-between-margin-trick.css
Created October 23, 2014 07:29
In between margin trick
/* Old */
.classname {
...
margin-top: 20px;
}
.classname:first-child {
margin-top: 0;
}
@limarc
limarc / duplicate-stylesheets.js
Last active August 29, 2015 14:08
Determination of duplicate stylesheets
/**
* Поиск дублированных стилей
*
* @param {Mixed} collection Коллекция
*/
function duplicates(collection) {
var maps = [], path = '', key = 0;
if (!Array.isArray(collection)) {
collection = [].slice.apply(collection);
// Modified prototype object
Object.prototype.x = 'test';
// Test
var http = new XMLHttpRequest();
http.open('GET', '/test.json', true);
http.onreadystatechange = function(event) {
if (http.readyState == 4) {
try {
var json = JSON.parse(http.responseText);
@limarc
limarc / ws.js
Created September 24, 2015 07:54
var ws = new WebSocket('ws://echo.websocket.org');
ws.addEventListener('open', function(e) {
console.log('CONNECTED', e);
});
ws.addEventListener('message', function(e) {
console.log('RESPONSE', e);
});
@limarc
limarc / spec.js
Last active October 16, 2015 18:27
JSCS validateMagicNumber rules
var arr = [1, 2, 3, 4, 5];
const secondsInDay = 24 * 60 * 60;
var x = 1;
function getTotal(subtotal) {
var beforeTax = subtotal + 9.99;
return beforeTax + (beforeTax * 0.13);
}
setTimout(function() {}, 200);
var sha1 = require('sha1');
function WebpackSortingFix() {}
WebpackSortingFix.prototype.apply = function(compiler) {
compiler.plugin('compilation', function(compilation) {
compilation.plugin('optimize-modules', function(modules) {
for (var index in modules) {
var module = modules[index];