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
| $name = $mysqli->query("SELECT name FROM contacts WHERE id = 5")->fetch_object()->name; |
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 (window.location.hash) { | |
| var theme = window.location.hash.split('#')[1]; | |
| $("body").removeClass(function (index, css) { | |
| return (css.match(/\btheme-\S+/g) || []).join(' '); | |
| }); | |
| $("body").addClass(theme); | |
| } |
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
| <!-- Prevent FOUC (flash of unstyled content) --> | |
| <style type="text/css"> | |
| .no-fouc {display: none;} | |
| </style> | |
| <script type="text/javascript"> | |
| document.documentElement.className = 'no-fouc'; | |
| // add to document ready: $('.no-fouc').removeClass('no-fouc'); | |
| </script> |
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 alert($text,$type) { | |
| echo '<p class="alert alert-' . $type . '" fade in> | |
| <button type="button" class="close" data-dismiss="alert">×</button> | |
| ' . $text . ' | |
| </p>'."\r\n"; | |
| } | |
| alert('Request completed successfully!', 'success'); |
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 age($date) { | |
| list($year, $month, $day) = explode("/", $date); | |
| $age = date("Y") - $year; | |
| if(date("m") < $month || (date("m") == $month && date("d") < $day)) { | |
| $age--; | |
| } | |
| return $age; | |
| } | |
| echo age("1985/01/01"); |