This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Console logs all the parameters received. Can handle objects, functions, doms etc | |
usage : log('myObj = ',obj,'other x = ',x); | |
*/ | |
function log() | |
{ | |
buffer = ''; | |
for (var i = 0; i < arguments.length; i++) | |
{ | |
if (typeof(arguments[i]) == 'object' | |
|| typeof(arguments[i]) == 'function') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//thanks to http://www.virgentech.com/blog/2009/10/building-object-oriented-jquery-plugin.html | |
(function($){ | |
var MyPlugin = function(element, options) | |
{ | |
var elem = $(element); | |
var obj = this; | |
var settings = $.extend({ | |
param: 'defaultValue' | |
}, options || {}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#id').attr('checked', !$('#id').attr('checked')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set processfolder=avi | |
set avidemux="C:\Program Files\Avidemux 2.5\avidemux2.exe" | |
set videocodec=Xvid | |
set audiocodec=MP3 | |
mkdir %1%processfolder% | |
for %%f in (*.3gp) do %avidemux% --nogui --video-codec %videocodec% --audio-codec %audiocodec% --force-alt-h264 --load "%%f" --save "avi\%%f" --quit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//works in any language | |
switch(true) | |
{ | |
case ($i==6): | |
doSomething(); | |
break; | |
case ($i >= 8 && $i <= 17): | |
rangedData(); | |
break; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fn(){} | |
fn.apply(this, new Array(firstParam, Second, etc)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
obj.functionName = "myCall"; | |
var fn = window[obj.functionName]; | |
if(typeof fn === 'function') { | |
fn(params); | |
} | |
function myCall() {} | |
//works for objects too, instead of window = your own instance |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** random inclusive 2 integer positive numbers */ | |
function rdm(min,max) | |
{ | |
return (Math.floor(Math.random()*max+1)+min); | |
} | |
/** It has p % chances to result true ! p must be between 1 and 99 ! */ | |
function rdmp(p) | |
{ | |
return (rdm(0,100) <= p)?true:false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** Thanks to http://www.herethere.net/~samson/php/color_gradient/ | |
Usage : | |
* print_r(_generateGradients('000000','FFFFFF',16));creates 16 nuances between white and black, returns hex css | |
print_r(_generateGradients('#FF0000','#800080')); | |
*/ | |
function _generateGradientsInterpolate($pBegin, $pEnd, $pStep, $pMax) { | |
if ($pBegin < $pEnd) { | |
return (($pEnd - $pBegin) * ($pStep / $pMax)) + $pBegin; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//needs jquery | |
$.getDocHeight = function(){ | |
return Math.max( | |
$(document).height(), | |
$(window).height(), | |
/* For opera: */ | |
document.documentElement.clientHeight | |
); | |
}; |