Skip to content

Instantly share code, notes, and snippets.

View vitkon's full-sized avatar
🎨
Building accessible UIs

Vitaly Kondratiev vitkon

🎨
Building accessible UIs
View GitHub Profile
@vitkon
vitkon / gist:5673266
Last active December 17, 2015 21:18
JS: Simple event logger (for debugging)
function initLogger () {
for(var eventName in $.event.global) {
$("*").bind(eventName, function(event) {
console.log(
event.type+": "+
event.target.nodeName+") "+
Array.prototype.slice.call(arguments, 1).join(", "));
});
}
}
@vitkon
vitkon / gist:5684304
Last active December 17, 2015 22:48
SASS: mixin – clearfix
@mixin clearfix() {
& {
*zoom: 1;
}
&:before,
&:after {
content: "";
display: table;
}
&:after {
@vitkon
vitkon / gist:5684315
Created May 31, 2013 11:11
SASS: mixin – center block
@mixin center-block {
display: block;
margin-left: auto;
margin-right: auto;
}
@vitkon
vitkon / .jshintrc
Created August 7, 2013 23:29 — forked from haschek/.jshintrc
{
// --------------------------------------------------------------------
// JSHint Configuration, Strict Edition
// --------------------------------------------------------------------
//
// This is a options template for [JSHint][1], using [JSHint example][2]
// and [Ory Band's example][3] as basis and setting config values to
// be most strict:
//
// * set all enforcing options to true
{
/*
Sets the mode in which SublimeLinter runs:
true - Linting occurs in the background as you type (the default).
false - Linting only occurs when you initiate it.
"load-save" - Linting occurs only when a file is loaded and saved.
*/
"sublimelinter": true,
@vitkon
vitkon / lastElement.js
Created August 8, 2016 11:08
last element in array
const arr = [1, 2, 3, 4, 5];
const last = [...arr].pop();
// or
const [last2, ...rest] = arr.reverse();
const rotateMatrix = arr => arr[0].map((col, i) => arr.map(row => row[i]));
// create a new array of N elements filled with specific value
const isBusy = true;
const n = 12;
const schedule = [...Array(n).fill(isBusy)];
@vitkon
vitkon / deduplication.js
Created March 10, 2017 22:08
Array with unique elements (dedupication)
const unique = arr => arr.filter(
(el, index, self) => index === self.indexOf(el)
);
@vitkon
vitkon / tslint.json
Created March 21, 2017 13:34 — forked from piotrwitek/tslint.json
TSLint rules with ESLint/React extension based on airbnb style guide
{
"rules": {
"align": [
true,
"parameters",
"arguments",
"statements"
],
"ban": false,
"class-name": true,