Skip to content

Instantly share code, notes, and snippets.

createCounter = function () {
var counter = {};
return Proxy.create({
get : function (key) {
if (! (key in counter) {
counter.key = 0;
}
console.log("Вы вызвали свойство " + key + " " + (++counter) + " раз"
}
});
@Quby
Quby / LICENSE.txt
Created July 30, 2011 16:36 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Quby <art543484 at ya.ru>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@Quby
Quby / LICENSE.txt
Created July 26, 2011 09:59 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@Quby
Quby / anim.js
Created July 16, 2011 18:23
Animation helper
/*
* Author : Artem Smirnov <[email protected]>
*
* Examples :
* anim(function (time) {
* console.log(time.elapsed);
* });
*
* anim(function (time) {
* console.log(time.before);
_(style)
.chain()
.keys()
.filter(function (key) {
return 0 <= key && key <= 1;
})
.each(function (key) {
colors.push(key, [style[key]])
});
@Quby
Quby / gist:1077665
Created July 12, 2011 09:13
Best JavaScript function
(function () {
if (!Worker) //Detect IE
document.location = "http://www.whatbrowser.org/ru/browser/";
})();
Class = (function () {
var Extend = function (Child, Parent) {
for (var prop in Parent.prototype)
Child.prototype[prop] = Parent.prototype[prop];
}
return function (Class) {
var Constructor = Class.Init || function () {};
Constructor.prototype = Class;
@Quby
Quby / screwed.js
Created July 5, 2011 17:04 — forked from nathansmith/screwed.js
Force yourself to learn JavaScript.
// If you're a glutton for punishment, and/or claim
// that JavaScript libraries have too much "bloat",
// use this to force yourself to write JS longhand.
(function(window) {
function screwed() {
window.$ = null;
window.$A = null;
window.$F = null;
window.$H = null;
#page {
position : absolute ;
border-right : 5px solid #9E9E9E ;
left : 10% ;
width : 50% ;
top : 0px ;
}
h1 > a {
@Quby
Quby / gist:1014693
Created June 8, 2011 15:52
Sugar.js mini tutorial
/*
Let's write a Point constructor, that have 3 types of call
Point(x,y);
Point([x,y]);
Point({x:x, y:y});
We can make many checks but with Sugar.js we can just write
*/
function Point () {
sugar(arguments, this)