Skip to content

Instantly share code, notes, and snippets.

View gabrielgilini's full-sized avatar
🍻

Gabriel Gilini gabrielgilini

🍻
View GitHub Profile
Element.Methods.r31n = function(elm, imgs){
elm.elmImg = new Element('img',{ src: elm.checked?imgs.checked:imgs.unchecked });
if(elm.type == 'checkbox'){
elm.elmImg.observe('click',function(){
elm.checked = !elm.checked;
elm.elmImg.src = elm.checked?imgs.checked:imgs.unchecked;
});
elm.observe('change',function(){
elm.elmImg.src = elm.checked?imgs.checked:imgs.unchecked;
});
if(document.getElementsByClassName){
var elementos =
document.getElementsByClassName('esconder');
for(var i = 0, j = elementos.length; i < j; i++){
elementos[i].style.display = 'none';
}
}else{
var elementos = document.getElementsByTagName('div');
var expressao = new RegExp("(^|\\s)esconder(\\s|$)");
for(var i = 0, j = elementos.length; i < j; i++){
// Prototype
$$('.esconder').invoke('hide');
// jQuery
$('.esconder').hide();
var b = document.body;
var c = b.className ? b.className + 'js' : 'js';
b.className = c;
body.js div.hide {
display: none;
}
KevLinDev.extend = function(subClass, baseClass) {
function inheritance() {}
inheritance.prototype = baseClass.prototype;
subClass.prototype = new inheritance();
subClass.prototype.constructor = subClass;
subClass.baseConstructor = baseClass;
subClass.superClass = baseClass.prototype;
}
#!/bin/bash
width=""
height=""
prepend=""
append=""
while getopts 'h:w:p:a:' OPTION
do
case $OPTION in
w) width="$OPTARG"
;;
$ find . -iname \*.png -exec thumbalizr -w 400 -a _t {} \;
function getPositionInMatrix(needle, haystack, pos)
{
pos = pos || [];
for(var i = haystack.length; --i >= 0;)
{
if(haystack[i] === needle)
{
return pos.push(i);
}
else if(Object.prototype.toString.call(haystack[i]) === '[object Array]')
js> getPositionInMatrix('foo', ['bar',['baz','foo'],'foobar']);
1,1
js> getPositionInMatrix('foo', ['bar',['baz','rs', 'foo'],'foobar']);
1,2