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
| было: | |
| if($fitwidth>$originalsize[0]) $fitwidth=$originalsize[0]; | |
| if($fitheight>$originalsize[1]) $fitheight=$originalsize[1]; | |
| if(($h[0]/$fitwidth)>($h[1]/$fitheight)) | |
| { | |
| $x=($originalsize[0] - $h[1]/$fitheight*$fitwidth) / 2; | |
| $y=0; | |
| //$fitheight=$h[1]*$fitwidth/$h[0]; | |
| }else{ |
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 | |
| function parse_mysql_dump($url) { | |
| $handle = @fopen($url, "r"); | |
| $query = ""; | |
| while(!feof($handle)) { | |
| $sql_line = fgets($handle); | |
| if (trim($sql_line) != "" && strpos($sql_line, "--") === false) { | |
| $query .= $sql_line; | |
| if (preg_match("/;[\040]*\$/", $sql_line)) { |
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
| http://jsfiddle.net/Cyd8y/embedded/result/ |
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 uploadImages($productId) { | |
| //... | |
| //изменить в шаблоне на "userfile[]" + multiple <input name="userfile[]" type="file" multiple="multiple" /> | |
| $fileName = false; | |
| if (!isset($_FILES["userfile"])) { | |
| return $fileName; | |
| } | |
| foreach ($_FILES["userfile"]["error"] as $key => $error) { | |
| if ($error == UPLOAD_ERR_OK) { |
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 setVisibleTimeout(callback, delay) { | |
| var id = null, | |
| t = 0, | |
| prefix = ''; | |
| 'o webkit moz ms'.replace(/\S+/g, function (p) { | |
| if ((p + 'Hidden') in document) { | |
| prefix = p; | |
| } | |
| }); | |
| function onVisibilityChange(event) { |
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 parseUrl2($url) { | |
| $x = parse_url($url); | |
| if (isset($x['host'])) { | |
| $y = explode(':', $x['host']); | |
| $x['hostname'] = $y[0]; | |
| } else { | |
| $x['hostname'] = null; | |
| } | |
| return $x; | |
| } |
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
| html { | |
| list-style-image: url("data:text/css;transform: scale(1.2);transition: width 0.2s, transform 0.3s;"); | |
| } |
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 urlify(text) { // urlify + escapeHTML | |
| return text.replace(/([\s\S]*?)(\bhttps?:\/\/\S+|$)/g, function (p, a, b) { | |
| b = escapeHTML(b); | |
| return escapeHTML(a) + (b ? ('<a href="' + b + '">' + truncate(b, 48) + '</a>') : ''); | |
| }); | |
| } |
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
| String.prototype.split = function (r, limit) { | |
| var s = String(this), | |
| last = null, | |
| lastIndex = null, | |
| a = []; | |
| limit = (limit === undefined ? -1 : limit) >>> 0; | |
| if (!limit) { | |
| return a; | |
| } | |
| if (r === undefined) { |
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
| // inplace merge sort | |
| // http://thomas.baudel.name/Visualisation/VisuTri/inplacestablesort.html | |
| (function () { | |
| "use strict"; | |
| var floor = Math.floor; | |
| function lower(a, from, to, value, compare) { | |
| while (to > from) { | |
| var middle = from + floor((to - from) / 2); |