Skip to content

Instantly share code, notes, and snippets.

View albburtsev's full-sized avatar
💭
🤔

Alexander Burtsev albburtsev

💭
🤔
View GitHub Profile
@albburtsev
albburtsev / test.js
Created January 28, 2013 19:20
Casperjs test for URL with auth basic
var casper = require("casper").create();
var argDomain = casper.cli.get("domain"),
argLogin = casper.cli.get("login"),
argPassword = casper.cli.get("password");
if ( !argDomain ) {
casper.echo('USAGE: casperjs login.js --domain=DOMAIN --login=AUTH_LOGIN --password=AUTH_PASSWORD');
casper.exit();
}
@albburtsev
albburtsev / jquery.tabinsert.js
Last active December 12, 2015 04:19
jQuery textarea tab insert
/*
* Textarea tab insert
* @dependence jQuery>=1.4.2
* @dependence https://github.com/jeresig/jquery.hotkeys
* @author Alexander Burtsev
*/
$('textarea', _form).bind("keydown", "tab", function(e) {
if ( document.selection ) { // IE
var iesel = document.selection.createRange().duplicate();
iesel.text = "\t";

This example demonstrates how to create a gradient that follows a stroke. This technique is sometimes used to indicate directionality along a curved edge, such as with hierarchical edge bundling.

To start, take any SVG path element and uniformly sample points along the path using getPointAtLength. (This method can also be used for path tweening.) Then, for each segment between adjacent points, compute the miter joint via line-line intersection. Lastly fill each segment by interpolating the start and end colors, here green to red, using the normalized length t along the path. Although each segment is a constant color, there are many segments to give the appearance of a continuous gradient.

This example uses a thin stroke in addition to filling the segments. This avoids antialiasing artifacts due to most

❯ cat .git/hooks/prepare-commit-msg
#!/bin/bash
b=`git symbolic-ref HEAD| sed -e 's|^refs/heads/||' | sed -e 's|_.*||'`
c=`cat $1`
if [ -n "$b" ] && [[ "$c" != "[$b]:"* ]]
then
echo "[$b]: $c" > $1
fi
module.exports = function(grunt) {
'use strict';
require('matchdep')
.filterDev('grunt-*')
.forEach(grunt.loadNpmTasks);
grunt.initConfig({
// ...
module.exports = (phantomcss, snap) ->
casper.test.begin 'Landing', 5, suite = (test) ->
casper.start PAGE
casper.viewport 1240, 1024
# Full page snap
casper.then ->
snap 'landing_full'
# Click into looker button

About

Давайте знакомиться.

Меня зовут Александр Бурцев, и я работаю frontend-разработчиком.

My work

В 2005-м году я устроился на работу HTML-верстальщиком. За пару лет, как это бывает с верстальщиками, я освоил JavaScript и полностью ушел в программирование. Постепенно дело дошло и до знакомства

@albburtsev
albburtsev / employees.js
Last active August 29, 2015 14:15
Задачи на собеседовании в oorraa.com
/**
* Задачи на позицию «frontend-разработчик»
*/
// --------- #1 ----------
// Дан список сотрудников в виде массива
var employees = [{
sex: 'male',
salary: 100
}, {

Определения JavaScript-терминов

Замыкание

Лучшее определение: «Замыкание - это когда объект локальных переменных [[scope]] внешней функции остается жить после ее завершения. Внутренняя функция может обратиться к нему в любой момент и получить переменную внешней функции».

MDN:

Closures are functions that refer to independent (free) variables. In other words, the function defined in the closure 'remembers' the environment in which it was created.

Суть бага в Webpack v1.12.11

Шаг 1

Есть модуль A, который импортирует модуль B В процессе первого(!) импорта модуля B происходит его инициализация, которая в коде вебпака происходит следующим образом:

/******/ 		// Check if module is in cache
/******/ if(installedModules[moduleId])