Skip to content

Instantly share code, notes, and snippets.

View chayn1k's full-sized avatar

Pavel Tchaikovsky chayn1k

View GitHub Profile
@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) ?

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 / 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
@chayn1k
chayn1k / javascript_resources.md
Created February 5, 2014 17:14 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@chayn1k
chayn1k / css_resources.md
Created February 5, 2014 17:14 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@chayn1k
chayn1k / rails_resources.md
Created February 5, 2014 17:14 — forked from jookyboi/rails_resources.md
Rails-related Gems and guides to accelerate your web project.

Gems

  • Bundler - Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.
  • rabl - General ruby templating with json, bson, xml, plist and msgpack support
  • Thin - Very fast and lightweight Ruby web server
  • Unicorn - Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels.
  • SimpleCov - SimpleCov is a code coverage analysis tool for Ruby 1.9.
  • Zeus - Zeus preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.
  • [factory_girl](h