Skip to content

Instantly share code, notes, and snippets.

View termi's full-sized avatar

Егор Халимоненко termi

View GitHub Profile
@WebReflection
WebReflection / Object.getOwnPropertyDescriptors.js
Created March 3, 2014 01:39
A plural ES5 + ES6 friendly version of Object.getOwnPropertyDescriptor
'getOwnPropertyDescriptors' in Object || (
Object.getOwnPropertyDescriptors = function (Object) {
var
gOPD = Object.getOwnPropertyDescriptor,
gOPN = Object.getOwnPropertyNames,
gOPS = Object.getOwnPropertySymbols,
gNS = gOPS ? function (object) {
return gOPN(object).concat(gOPS(object));
} :
gOPN,
@bobslaede
bobslaede / modernizr.positionfixed.js
Created September 16, 2011 08:50
Modernizr position fixed check
;(function(Modernizr, window) {
Modernizr.addTest('positionfixed', function () {
var test = document.createElement('div'),
control = test.cloneNode(false),
fake = false,
root = document.body || (function () {
fake = true;
return document.documentElement.appendChild(document.createElement('body'));
}());
/**
* jQuery event "tap" (Based on https://developers.google.com/mobile/articles/fast_buttons)
*
* @author RubaXa <trash@rubaxa.org>
* @license MIT
*/
(function (window, $){
var
support = window.TapSupportEnabled && ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch
@RubaXa
RubaXa / gist:4084463
Created November 16, 2012 05:33
xtpl vs. fest

Fest

<?xml version="1.0"?>
<fest:template xmlns:fest="http://fest.mail.ru" context_name="json">
	<div class="elm">
		<fest:attributes>
			<fest:attribute name="id">box</fest:attribute>
			<fest:attribute name="style">color: red;</fest:attribute>
			<fest:attribute name="class"><fest:space/>js-elm</fest:attribute>
@Raynos
Raynos / clone.js
Created August 9, 2012 02:24
A proper clone
// example: http://jsfiddle.net/QVqHs/
function clone(o) {
return Object.create(
Object.getPrototypeOf(o),
getOwnPropertyDescriptors(o)
)
}
function getOwnPropertyDescriptors(o) {