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
| $('p').animate({ | |
| left: '+=90px', | |
| top: '+=150px', | |
| opacity: 0.25 | |
| }, 900, 'linear', function() { | |
| // function code on animation complete | |
| }); |
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
| $.ajax({ | |
| type: 'POST', | |
| url: 'backend.php', | |
| data: "q="+myform.serialize(), | |
| success: function(data){ | |
| // on success use return data here | |
| }, | |
| error: function(xhr, type, exception) { | |
| // if ajax fails display error alert | |
| alert("ajax error response type "+type); |
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
| $("a[href='#top']").click(function() { | |
| $("html, body").animate({ scrollTop: 0 }, "slow"); | |
| return 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
| $("a").on("click", function(e){ | |
| e.preventDefault(); | |
| }); |
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
| $("a").hover( | |
| function () { | |
| // code on hover over | |
| }, | |
| function () { | |
| // code on away from hover | |
| } | |
| ); |
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 = | |
| "Lorem ipsum dolor sit amet, consectetur | |
| adipiscing elit. Nunc ut elit id mi ultricies | |
| adipiscing. Nulla facilisi. Praesent pulvinar, | |
| sapien vel feugiat vestibulum, nulla dui pretium orci, | |
| non ultricies elit lacus quis ante. Lorem ipsum dolor | |
| sit amet, consectetur adipiscing elit. Aliquam | |
| pretium ullamcorper urna quis iaculis. Etiam ac massa | |
| sed turpis tempor luctus. Curabitur sed nibh eu elit | |
| mollis congue. Praesent ipsum diam, consectetur vitae |
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 // display source code | |
| $lines = file('http://google.com/'); | |
| foreach ($lines as $line_num => $line) { | |
| // loop thru each line and prepend line numbers | |
| echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br>\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
| // Include the TextMagic PHP lib | |
| require('textmagic-sms-api-php/TextMagicAPI.php'); | |
| // Set the username and password information | |
| $username = 'myusername'; | |
| $password = 'mypassword'; | |
| // Create a new instance of TM | |
| $router = new TextMagicAPI(array( | |
| 'username' => $username, |
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 currency($from_Currency,$to_Currency,$amount) { | |
| $amount = urlencode($amount); | |
| $from_Currency = urlencode($from_Currency); | |
| $to_Currency = urlencode($to_Currency); | |
| $url = "http://www.google.com/ig/calculator?hl=en&q=$amount$from_Currency=?$to_Currency"; | |
| $ch = curl_init(); | |
| $timeout = 0; | |
| curl_setopt ($ch, CURLOPT_URL, $url); | |
| curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); | |
| curl_setopt($ch, CURLOPT_USERAGENT , "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)"); |
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 getImages($html) { | |
| $matches = array(); | |
| $regex = '~http://somedomain.com/images/(.*?)\.jpg~i'; | |
| preg_match_all($regex, $html, $matches); | |
| foreach ($matches[1] as $img) { | |
| saveImg($img); | |
| } | |
| } | |
| function saveImg($name) { |