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
{
/*
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 / JS Inhertence
Last active August 29, 2015 13:56
Simple JS Prototype chain
var Person = function (name) {
this.name = name;
}
Person.prototype.test = function () {
return 'This is person test';
}
Person.prototype.describe = function () {
return 'This is ' + this.name;
@vitkon
vitkon / gist:0e3a5d4842475868b8e2
Created August 26, 2014 05:27
JavaScriptCore symlink for OSX
sudo ln /System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc /bin/jsc
@vitkon
vitkon / gist:0c2efb70103332715e44
Created November 17, 2014 16:27
Get url parameter by name
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
<h3>Choose a building</h3>
Current building: {{currentBuilding.name}}
<select>
{{#each buildings}}
<option value="{{_id}}" selected={{equals _id currentBuilding._id}}>{{name}}</option>
{{/each}}
</select>
@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,