Skip to content

Instantly share code, notes, and snippets.

View chayn1k's full-sized avatar

Pavel Tchaikovsky chayn1k

View GitHub Profile
@chayn1k
chayn1k / dabblet.css
Created December 16, 2011 09:13
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
html, body {
height:100%;
}
header.ex{
background: #f00006;
background: linear-gradient(45deg, #f06, yellow);
@chayn1k
chayn1k / 1-tmpl.js
Created September 28, 2012 22:18 — forked from furf/1-tmpl.js
JavaScript Micro Templating
// Simple JavaScript Templating
// John Resig - http://ejohn.org/ - MIT Licensed
// @see http://ejohn.org/blog/javascript-micro-templating/
(function(){
var cache = {};
this.tmpl = function tmpl(str, data){
// Figure out if we're getting a template, or if we need to
// load the template - and be sure to cache the result.
var fn = !/\W/.test(str) ?
@chayn1k
chayn1k / index.html
Created February 12, 2013 20:00
A CodePen by chayn1k. Interactive Particle Logo - Interactive CodePen Logo. Created with ParticleSlider. Responsive & lowers quality for mobile devices. See http://particleslider.com for more information
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>ParticleSlider</title>
</head>
<body id="particle-slider">
<div class="slides">
<div id="first-slide" class="slide" data-src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAyAAAAGQCAMAAABh+/QGAAAC9FBMVEXu7u7u7u7////5+fn////u7u78/Pz7+/v////////////5+fn////////////7+/v////////////39/f////6+vr+/v76+vr////////39/f////v7+/9/f3v7+/////////+/v74+Pj////////////////////8/Pz5+fn////////////w8PD+/v7z8/P////7+/v////////9/f3u7u7////////4+Pj////////////////////////////////////u7u7////6+vr////09PT////////////////////////////////4+Pj////////y8vL////////////////////////v7+/////////////09PTu7u79/f3////////39/f////////////////////////////////////////////8/Pz////29vb////////z8/P////////////////x8fH////////////////////////z8/P////z8/P////////////////////////////////////19fX////v7+/x8fH////////////////////39/f////////w8PD////////x8fHz8/P////////////z8/P19fX////19fX////////////y8vL////29vb////x8fH////29vb////////////////////////////

Improved swipe gestures plugin for jQuery

What was changed (compared to the original v0.1.2):

  • Don’t modify the default settings internally.
  • Merge the options recursively (deep copy) so that the custom threshold values actually get used.
  • Allow overriding the options globally through $.fn.swipe.options.
  • Use namespaced jQuery events (using the swipe namespace) instead of DOM2 addEventListener to prevent errors in old IEs.
  • Simplified and optimized code.
  • Changed swipeLeft and swipeRight functions to be called within the context of the bound element. Thanks, @kswedberg!
@chayn1k
chayn1k / gist:6241806
Last active December 21, 2015 03:19 — forked from sapegin/gist:4510703
  • Картинки для ретины.
  • Фавиконка 16×16.
  • Фавиконка 32×32.
  • Иконки для Айоса и Андроида.
  • Счётчик.
  • Проверка битых ссылок.
  • 404-я страница.
  • RSS.
  • robots.txt.
  • humans.txt.
@chayn1k
chayn1k / hexagon.js
Created September 18, 2013 15:16 — forked from Breefield/hexagon.js
// Create a Paper.js Path to draw a line into it:
var hexagon = new Path();
// Color our path black
hexagon.strokeColor = 'black';
// How many points do we want our object to have
var points = 6;
// How large should it be
var radius = 60;
// 0 to 2PI is a circle, so divide that by the number of points

BEM-XJST

Это БЭМ-ориентированные хелперы над стандартным XJST-синтаксисом. Сюда входит:

  • синтаксический сахар для подпредикатов про БЭМ предметную область
  • возможность писать вложенные шаблоны
  • синтаксический сахар для apply по какой-то mode (apply(this._mode = 'bla'))
  • ключевое слово applyCtx (синтаксический сахар для applyNext(this.ctx = { some: 'new' }))
Подпредикаты про БЭМ
@chayn1k
chayn1k / index.html
Last active December 28, 2015 05:49 — forked from anonymous/jsbin.erahEBOj.css
горизонтальный скролл по колонкам
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
<link href="style.css" rel="stylesheet">
<script src="main.js"></script>
</head>
<body>
<div id='container'>
@chayn1k
chayn1k / dabblet.css
Created January 14, 2014 13:23
SVG alternative to fittext.js
/* SVG alternative to fittext.js */
div {
width: 300px;
height: 150px;
float: left;
margin-right : 10px;
background: #f06;
font: bold 150% sans-serif;
text-shadow: 0 1px 2px rgba(0,0,0,.5);
@chayn1k
chayn1k / 0_reuse_code.js
Created February 5, 2014 17:14
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console