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
/** How to import very large data in mysql tables, from CSV | |
windows : run mysql -> cmd -> c:/wamp/bin/mysql/mysql5.5.8/bin/mysql | |
copy the csv file to the folder (or use absolute path to it)*/ | |
load data local infile 'mails.csv' into table database_name.table_name fields terminated by ',' | |
//you can add : enclosed by '"' | |
; /* when you type semicolon the command will be send (NOT at enter) | |
You`ll get a resulit like | |
Query OK, 71922 rows affected, 65535 warnings (10.95 sec) | |
Records: 73148 Deleted: 0 Skipped: 1226 Warnings: 73186 |
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 | |
); | |
}; |
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
/** 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
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
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
<?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
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
$('#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
//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 || {}); |