##Object Merger
Recurcively merges two objects.
merge(
{foo:"foo"},
{bar:{lol:"lol"}}
);
##Object Merger
Recurcively merges two objects.
merge(
{foo:"foo"},
{bar:{lol:"lol"}}
);
A minimalist masonry function
mason(containerElement,brickElement,brickWidth,brickHeight)
Only works with one size of brick.
The only advantage of using this over using inline-block elements is that you can use css transitions.
recursively checks every parent of the element to get the ABSOLUTE offset of the element.
call it like this:
getOff(element).x
getOff(element).y
//function | |
calendar = function(year,month,template,rowStart,rowEnd,cellStart,cellEnd){ | |
var tmpl=function(a,b){return a.replace(/\{\{([^{}]+)}}/g,function(c,d){return typeof b[d]=="function"?b[d]():b[d]})} | |
return tmpl(template,{ | |
monthName:"January,February,March,April,May,June,July,August,September,October,November,December".split(",")[month], | |
year:year, | |
days:function(f,txt,i){ |
a neat function that allows this:
document.getElementsByTagName('i').innerHTML="pie";
and it will change the innerHTML of all tags AUTOMATICALLY!!!!
incredible!
#Javascript Rss Reader#
Takes a rss feed and prints html (defined by a template) for every post.
Turns indentation into {curly brackets} Great for a yml to json converter or something. Credit to @maettig for writing all* the code.
Turn this:
if(3==3)
alert("obviously!")
alert("lol!")
Into:
Why?
Because why the hell not?
Allows you to use nodelist methods on strings!
It's kinda useless on it's own, but with https://gist.github.com/2847249 it's pretty fun =D
This function allows element methods to be used on nodelists, kinda like what jQuery does.
jQuery .html() clone
A (Hopefully) perfect clone of the jQuery .html() method
If it has an argument, it will set the innerhtml of the element to the value of the argument.
If it has no argument, it returns the innerHTML of the element.
It is also chainable! yay!