01/13/2012. From a lecture by Professor John Ousterhout at Stanford, class CS140
Here's today's thought for the weekend. A little bit of slope makes up for a lot of Y-intercept.
[Laughter]
| <?php | |
| // parameters | |
| $hubVerifyToken = 'TOKEN123456abcd'; | |
| $accessToken = "xxx"; | |
| // check token at setup | |
| if ($_REQUEST['hub_verify_token'] === $hubVerifyToken) { | |
| echo $_REQUEST['hub_challenge']; | |
| exit; | |
| } |
| <input type="text" name="field-name" class="field-name" /> |
| <?php | |
| $user_agent = $_SERVER['HTTP_USER_AGENT']; | |
| switch( true ){ | |
| case preg_match('/iphone|ipad/si',$user_agent): | |
| $url = 'https://itunes.apple.com/us/app/whatsapp-messenger/id310633997?mt=8'; | |
| break; | |
| case stristr($user_agent, 'android'): |
| //return an array of objects according to key, value, or key and value matching | |
| function getObjects(obj, key, val) { | |
| var objects = []; | |
| for (var i in obj) { | |
| if (!obj.hasOwnProperty(i)) continue; | |
| if (typeof obj[i] == 'object') { | |
| objects = objects.concat(getObjects(obj[i], key, val)); | |
| } else | |
| //if key matches and value matches or if key matches and value is not passed (eliminating the case where key matches but passed value does not) | |
| if (i == key && obj[i] == val || i == key && val == '') { // |
| $(function () { | |
| "use strict"; | |
| // for better performance - to avoid searching in DOM | |
| var content = $('#content'); | |
| var input = $('#input'); | |
| var status = $('#status'); | |
| // my color assigned by the server | |
| var myColor = false; |