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 | |
| // truncate with smart check for spaces | |
| function truncate($string, $limit = 75, $break = " ", $pad = "...") | |
| { | |
| if (strlen($string) <= $limit) return $string; | |
| $string = substr($string, 0, $limit); | |
| if (false !== ($breakpoint = strrpos($string, $break))) | |
| { | |
| $string = substr($string, 0, $breakpoint); |
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 | |
| $Caracteres = 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789'; | |
| $max = strlen($Caracteres) - 1; | |
| for($x=1; $x<=100; $x++) { | |
| for($i=0; $i < 8; $i++) { | |
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 getDifference($startDate,$endDate,$format) | |
| { | |
| list($date,$time) = explode(' ',$endDate); | |
| $startdate = explode("-",$date); | |
| $starttime = explode(":",$time); | |
| list($date,$time) = explode(' ',$startDate); | |
| $enddate = explode("-",$date); | |
| $endtime = explode(":",$time); |
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 | |
| $img_src = "img/sample.jpg"; | |
| $imgbinary = fread(fopen($img_src, "r"), filesize($img_src)); | |
| $img_str = base64_encode($imgbinary); | |
| echo '<img src="data:image/jpeg;base64,'.$img_str.'" alt="Alt text" />'; | |
| ?> |
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
| global $assign_to_config; | |
| if( ! isset($assign_to_config['global_vars'])) | |
| { | |
| $assign_to_config['global_vars'] = array(); | |
| } | |
| $useragent = $_SERVER['HTTP_USER_AGENT']; // Let's do some device detection | |
| if (preg_match('/android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht( |
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
| jQuery.fn.center = function () { | |
| this.css("position","absolute"); | |
| this.css("top", Math.max(0, (($(window).height() - $(this).outerHeight()) / 2) + | |
| $(window).scrollTop()) + "px"); | |
| this.css("left", Math.max(0, (($(window).width() - $(this).outerWidth()) / 2) + | |
| $(window).scrollLeft()) + "px"); | |
| return this; | |
| } | |
| jQuery.fn.center = function(parent) { |
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
| /** | |
| * Devuelve un número como cadena formateada con ceros a la izda | |
| * @param {number} number El número original | |
| * @param {integer} targetLength Número de caracteres que queremos obtener | |
| * @return {string} Cadena compuesta de ceros y el número original | |
| */ | |
| function leftPad(number, targetLength) { | |
| var output = number + ''; | |
| while (output.length < targetLength) { | |
| output = '0' + output; |
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> | |
| <head> | |
| <style> | |
| .loading-background | |
| { | |
| width:48px; | |
| height:48px; | |
| display:inline-block; | |
| background-color:Green; |
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 | |
| // | |
| // uses the PHP SDK. Download from https://github.com/facebook/php-sdk | |
| include("facebook-php-sdk/src/facebook.php"); | |
| // | |
| // from the facebook app page | |
| define('YOUR_APP_ID', '32WEWWEWWEWEWEWEWEW24'); | |
| define('YOUR_APP_SECRET', '49fd00ce6237WEEWEWEWEWEW2'); | |
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> | |
| <head></head> | |
| <body> | |
| <div id="fb-root"></div> | |
| <script> | |
| window.fbAsyncInit = function() { | |
| FB.init({ | |
| appId : 'YOUR_APP_ID', // App ID | |
| channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File | |
| status : true, // check login status |