Skip to content

Instantly share code, notes, and snippets.

View Maciek416's full-sized avatar

Maciej Adwent Maciek416

View GitHub Profile
<p>
<span>
<span>The <a>quick</a> brown</span>
<span>fox. jump. ed </span>
over the lazy dogs.
</span>
</p>
["","","",""]
python -m SimpleHTTPServer 9914
@Maciek416
Maciek416 / gist:1023046
Created June 13, 2011 15:54
Best overflow tricks with sentence slicing
<!DOCTYPE html>
<html>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script type="text/javascript" src="http://documentcloud.github.com/underscore/underscore-min.js"></script>
<style>
body {
margin:0px;
padding:0px;
}
@Maciek416
Maciek416 / gist:1023020
Created June 13, 2011 15:45
Better overflow knife tricks
<!DOCTYPE html>
<html>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script type="text/javascript" src="http://documentcloud.github.com/underscore/underscore-min.js"></script>
<style>
body {
margin:0px;
padding:0px;
}
@Maciek416
Maciek416 / gist:1022910
Created June 13, 2011 14:52
Overflow Gymnastics
<!DOCTYPE html>
<html>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script type="text/javascript" src="http://documentcloud.github.com/underscore/underscore-min.js"></script>
<style>
body {
margin:0px;
padding:0px;
}
var a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
var b = _(a).reduceRight(function(memo,n){ return memo.concat([n]); },[]);
['Quad', 'Cubic', 'Quart', 'Quint'].each(function(transition, i){
Fx.Transitions[transition] = new Fx.Transition(function(p){
return Math.pow(p, i + 2);
});
});
for(var i=0;i<1;i=i+0.1){ console.log(Math.pow(i, 4)); }
0
0.00010000000000000005
0.0016000000000000007
0.008100000000000005
0.02560000000000001
0.0625
0.1296
0.24009999999999992
0.40959999999999985
@Maciek416
Maciek416 / gist:1002432
Created June 1, 2011 14:43
Attempts to make an object show up as instance_of.JimBobbbbb in console.log
var JimBob = function Barf(x){ this.x = x; };
JimBob.prototype.klass = "JimBobbbbb";
var creator = function(c, args){
var instance_of = {};
instance_of[c.klass] = function(){
return c;
};
return new (instance_of[c.klass].call(this, args));
};
var extend = function (protoProps, classProps) {
var child = inherits(this, protoProps, classProps);
child.extend = extend;
return child;
};
// Set up inheritance for the model, collection, and view.
Backbone.Model.extend = Backbone.Collection.extend = Backbone.Controller.extend = Backbone.View.extend = extend;