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 | |
| // | |
| // source: http://pageconfig.com/post/remove-undesired-characters-with-trim_all-php | |
| // | |
| function trim_all( $str , $what = NULL , $with = ' ' ) | |
| { | |
| if( $what === NULL ) | |
| { | |
| // Character Decimal Use |
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
| // @source: http://stackoverflow.com/a/5386150 | |
| jQuery.fn.reverse = [].reverse; | |
| $('jquery-selectors-go-here').reverse().each(function () { | |
| //business as usual goes here | |
| }); |
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
| // @source: http://stackoverflow.com/questions/20693593/sort-select-options-by-value-attribute-using-jquery | |
| var selectList = $('#featuredSelectField option'); | |
| selectList.sort(function(a,b){ | |
| a = a.value; | |
| b = b.value; | |
| return a-b; |
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
| select * | |
| from items | |
| where item_id in (1,3,5,7,2,4,6,8) | |
| order by field(item_id, 1,3,5,7,2,4,6,8) |
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 isJsonEncoded($str) | |
| { | |
| json_decode($str); | |
| return json_last_error() == JSON_ERROR_NONE ? 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 | |
| /** | |
| * Reindexes arrays for the given object in recursive way | |
| * @param $obj | |
| * @return array | |
| */ | |
| function reindex_array_recursive($obj) | |
| { | |
| if(is_array($obj) && !is_array_assoc($obj)) |
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 | |
| /** | |
| * Checks if the array is associative or not | |
| * @param $array | |
| * @return bool | |
| */ | |
| function is_array_assoc($array) | |
| { | |
| return (bool)count(array_filter(array_keys($array),'is_string')); |
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 | |
| // Helper function | |
| /** | |
| * Sorts ranged numbers | |
| * @param $a | |
| * @param $b | |
| * @return int | |
| */ |
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 unique(array){ | |
| return $.grep(array,function(el,index){ | |
| return index == $.inArray(el,array); | |
| }); | |
| } |