Skip to content

Instantly share code, notes, and snippets.

View AdrienGiboire's full-sized avatar
🥦
Plant-fueled, you can't test me!

Adrien AdrienGiboire

🥦
Plant-fueled, you can't test me!
View GitHub Profile
// uglify -b
function forgetVar() {
myLongVariableName = 2;
}
function dontForgetVar() {
var a = 2;
}
// Original
function forgetVar() {
myLongVariableName = 2;
}
function dontForgetVar() {
var myVeryVeryLongVariableName = 2;
}
var a = function() {
return document.getElementById.apply(document, arguments);
};
// Compression naïve et théorique
var a = document.getElementById;
var mine = a('mine'),
his = a('mine'),
hers = a('mine');
// Version originale
var mine = document.getElementById('mine');
var his = document.getElementById('his');
var hers = document.getElementById('hers');
function logStyles() {
var a = document.body.style;
console.log(a.border, a.margin, a.padding);
};
function logStyles() {
var doc_style = document.body.style;
console.log(doc_style.border,
doc_style.margin,
doc_style.padding);
}
function point() {
function b(b) {
a.position += b;
}
var a = {};
return a.position = 0, a.up = function() {
a.move(10);
}, a.down = function() {
a.move(-10);
}, a;
function point() {
var p = {};
p.position = 0;
function move (pixels) {
p.position += pixels;
};
p.up = function () { p.move(10); };
p.down = function () { p.move(-10); };
function point() {
var a = {};
return a.position = 0, a.move = function(b) {
a.position += b;
}, a.up = function() {
a.move(10);
}, a.down = function() {
a.move(-10);
}, a;
};