Skip to content

Instantly share code, notes, and snippets.

View alexbaumgertner's full-sized avatar
💻
Digital Nomad

Alex Baumgertner alexbaumgertner

💻
Digital Nomad
View GitHub Profile
// What is `callback`?
/**
* Async working method with callback
*
* @param {*} data
* @param {function} callback
*
* @returns {string}
*/
/**
* Возвращает первый найденный элемент по селектору selector
* @see http://www.w3.org/TR/CSS21/selector
* @see https://developer.mozilla.org/en-US/docs/Web/API/element
*
* @example
* // Получить элемент с классом `myclass`
* var el = document.querySelector(".myclass");
*
* // Так работать не будет, псевдо-элементы недоступны для js
// api: fromTextArea
// https://github.com/codemirror/CodeMirror/blob/a11ccbefa281a0e728b7431ba52f550854831ea6/lib/codemirror.js#L5888
var editor = targetIsTextarea ? CodeMirror.fromTextArea(target, editorOptions) : target;
// api: setCursor
// https://github.com/codemirror/CodeMirror/blob/a11ccbefa281a0e728b7431ba52f550854831ea6/lib/codemirror.js#L7438
// api: posFromIndex
// https://github.com/codemirror/CodeMirror/blob/a11ccbefa281a0e728b7431ba52f550854831ea6/lib/codemirror.js#L7624
editor.setCursor(editor.posFromIndex(initialPos));
<script>
$(document).ready( function() {
var $grid = $('.row').masonry({
// main isotope options
itemSelector: '.row__item',
columnWidth: '.row__sizer',
gutter: '.gutter-sizer',
percentPosition: true,
});
<div class="people">
<h3 class="people__title">Количество попутчиков</h3>
<form class="people__form" action="/echo" method="post">
<input class="people__form-btn" type="button" name="travel-people__plus" value="+">
<input class="people__form-field" type="text" name="travel-people__continuance" disabled>
<input class="people__form-btn" type="button" name="travel-people__minus" value="-">
<table class="people__table">
<tr>
<th class="people__table-title">№</th>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<header>
@alexbaumgertner
alexbaumgertner / html_min_valid_doc.html
Last active August 30, 2015 13:50
Stub for html code validation
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>title is required in html</title>
</head>
<body>
<!-- HTML code for validation, see https://validator.w3.org/nu/#textarea -->
var phoneMask = (function() {
var block = $('.js-phone-mask');
function init() {
block.inputmask("mask", {"mask": "8 (999) 999-9999"});
}
return {
init: init
};
@alexbaumgertner
alexbaumgertner / link.bemhtml.js
Created August 12, 2015 16:56
BEMHTML template example