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
| var url = 'example.com/hello/world/20111020/'; | |
| //get rid of the trailing / before doing a simple split on / | |
| var url_parts = url.replace(/\/\s*$/,'').split('/'); | |
| //since we do not need example.com | |
| url_parts.shift(); | |
| Now url_parts will point to the array ["hello", "world", "20111020"]. |
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
| Download GLUT >> http://www.mediafire.com/?5329nj635679663 | |
| Akan ada file glut.h, glut32.lib, dan glut32.dll | |
| Copy file glut.h ke dalam folder C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include\gl | |
| Copy file glut32.lib ke dalam folder C:\Program Files\Microsoft Visual Studio 10.0\VC\lib | |
| Copy file glut32.dll ke dalam folder C:\Windows\System32 | |
| Catatan: untuk windows 64 bit, letakkan glut32.dll pada ‘C:\Windows\SysWOW64\’ |
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 | |
| ob_start(); // turn on output buffering | |
| include('/path/to/include.php'); | |
| $res = ob_get_contents(); // get the contents of the output buffer | |
| ob_end_clean(); // clean (erase) the output buffer and turn off output buffering | |
| ?> | |
| <?php | |
| $res = file_get_contents('http://your_server/path/to/include.php'); | |
| ?> |
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_rec generator | |
| function id_rec($set = 0){ | |
| $microtime = microtime(); | |
| $comps = explode(' ', $microtime); | |
| $ms=sprintf('%d%03d', $comps[1], $comps[0] * 1000); | |
| $ms=substr($ms,-3); | |
| return date("YmdHis", time()).sprintf("%03d", ($ms+$set)); | |
| } |
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
| CREATE TABLE IF NOT EXISTS `mitm` ( | |
| `id` int(8) NOT NULL AUTO_INCREMENT, | |
| `request_time` datetime NOT NULL, | |
| `request_time_old` int(10) NOT NULL, | |
| `remote_address` text COLLATE latin1_general_ci NOT NULL, | |
| `remote_host` text COLLATE latin1_general_ci NOT NULL, | |
| `remote_port` text COLLATE latin1_general_ci NOT NULL, | |
| `x_forwarded_for` text COLLATE latin1_general_ci NOT NULL, | |
| `http_via` text COLLATE latin1_general_ci NOT NULL, | |
| `user_agent` text COLLATE latin1_general_ci NOT NULL, |
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
| <script type="text/javascript"> | |
| var arr = [ | |
| { "ID": 135, "Name": "Fargo Chan", "Address": "34, Baker Street" }, | |
| { "ID": 432, "Name": "Aaron Luke", "Address": "BLDG 1, J Street" }, | |
| { "ID": 252, "Name": "Dilip Singh", "Address": "Hotel J, SE" } | |
| ]; | |
| // Before Sorting | |
| document.write("<b>Before Sorting </b><br/>"); | |
| for (var n = 0; n < arr.length; n++) { |
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
| #table ------------------------------------------------------------------------------------------- | |
| Roll_No | Subject | Marks | |
| --------------------------- | |
| 1212324 | MTH | 90 | |
| 1212324 | PHY | 72 | |
| 1212324 | CHE | 85 | |
| 1212324 | BIO | 78 | |
| 1212334 | MTH | 85 | |
| 1212334 | PHY | 65 |
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 imgError(image) { | |
| image.onerror = ""; | |
| image.src = "/images/noimage.gif"; | |
| return true; | |
| } | |
| <img src="image.png" onerror="imgError(this);"/> | |
| OR |
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
| var str = 'abcdefghi'; | |
| cut_string(str); | |
| //return : abcde... | |
| // cut string if length more then 5 character | |
| function cut_string(str){ | |
| return (str.length > 5 ? str.substring(0,5)+'...' : str); | |
| } |
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
| alert(url_variable('my_url')['data1']); | |
| //parse parameter string url | |
| function url_variable(url){ | |
| var vars = [], hash; | |
| //var url = "../develop/dashboard/?data1=2&data2=4"; | |
| var hashes = url.slice(url.indexOf('?') + 1).split('&'); | |
| for(var i = 0; i < hashes.length; i++) | |
| { |