Skip to content

Instantly share code, notes, and snippets.

View nchereva's full-sized avatar

Nikolay Cherevatenko nchereva

View GitHub Profile
@nchereva
nchereva / vo.js
Created September 15, 2015 09:26
JS global VO inherits Object.prototype
Object.prototype.x = 4;
console.log(x); // 4
delete x; // true
console.log(x); // 4
delete Object.prototype.x; // true
console.log(x); // undefined
@nchereva
nchereva / testIcon.js
Created February 12, 2015 16:04
Replacing favicon on local and test environments, use it anywere.
if (/yasap|localhost/.test(window.location.hostname)) {
var link = document.querySelector('link[rel="shortcut icon"]');
link.href = link.href.replace('favicon', 'favicon_test');
}
@nchereva
nchereva / script.js
Created February 5, 2015 16:46
Cut the mustard
!function() {
function e(e, t, n) {
e.addEventListener ? e.addEventListener(t, n, !1) : e.attachEvent && e.attachEvent("on" + t, n)
}
function t(e) {
return window.localStorage && localStorage.font_css_cache && localStorage.font_css_cache_file === e
}
function n() {
if (window.localStorage && window.XMLHttpRequest)
if (t(o))
@nchereva
nchereva / Function make
Created November 22, 2013 10:35
Function make could accept parameters like numbers and last is function. Usage is make(number)(number)(number)(function for input numbers) Example: >make(1)(2)(3)(4)(function(a,b){return a+b;}); result is 10
function make(a) {
var mas = [];
mas.push(a);
var ret = function(b) {
if (typeof(b) === "function") {
console.log(mas.reduce(function(acc, input) {
acc = b(acc, input);
return acc;
}));
} else {