Skip to content

Instantly share code, notes, and snippets.

View albburtsev's full-sized avatar
💭
🤔

Alexander Burtsev albburtsev

💭
🤔
View GitHub Profile
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.

@albburtsev
albburtsev / isTouchDevice.js
Created January 25, 2011 11:08
Simple touch device detection
// See from http://chris-barr.com/files/touchScroll.htm
var isTouchDevice = function(){
try {
document.createEvent("TouchEvent");
return true;
} catch(e) {
return false;
}
}
@albburtsev
albburtsev / jquery.viewport-event.js
Created February 3, 2011 12:32
Viewport Event jQuery Plugin
/*
Example:
$('div')
.viewport()
.one('viewport', function() {
$(this).addClass('view');
});
*/
(function($) {
$.fn.viewport = function() {
function fireCustomEvent(eventType) {
if ( document.dispatchEvent ) { // DOM browser
var e = document.createEvent("UIEvents");
e.initEvent(eventType, false, false);
document.dispatchEvent(e);
} else if ( document.attachEvent ) { // IE
if ( !document.documentElement[eventType] )
document.documentElement[eventType] = 1;
else
document.documentElement[eventType] += 1;
tools.htmlToText = function(html) {
var node = document.createElement('b');
node.innerHTML = html;
return node.innerText || node.textContent || '';
}
jQuery.fn.renew = function() {
return $(this.selector);
};
$('div').renew();