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
| // GeoIP php modules from: http://www.maxmind.com/app/php | |
| // GeoLiteCity.dat from: http://www.maxmind.com/app/geolite | |
| include("lib/geo/geoipcity.inc"); | |
| include("lib/geo/geoipregionvars.php"); | |
| include("lib/geo/timezone.php"); | |
| $gi = geoip_open("lib/geo/GeoLiteCity.dat",GEOIP_STANDARD); | |
| $record = geoip_record_by_addr($gi,$_SERVER['REMOTE_ADDR']); | |
| geoip_close($gi); |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>TITLE</title> | |
| <meta name="author" content="NAME"> | |
| <meta name="description" content="DESCRIPTION"> | |
| <meta name="keywords" content="KEYWORDS,HERE"> | |
| <link rel="shortcut icon" href="FAVICON.ico" type="image/vnd.microsoft.icon"> | |
| <link rel='stylesheet' href='//fonts.googleapis.com/css?family=FONT1|FONT2ETC' type='text/css'> |
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
| //1 | |
| document.getElementById('the_div').addEventListener( | |
| 'click', function(){ log('the_div!') }, true); | |
| document.getElementById('the_list').addEventListener( | |
| 'click', function(){ log('the_list!') }, false); | |
| document.getElementById('the_item').addEventListener( | |
| 'click', function(){ log('the_item!') }, true); | |
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
| // Implement a function prototype extension that caches function results for | |
| // the same input arguments of a function with one parameter. | |
| // | |
| // For example: | |
| // Make sin(1) have the result of Math.sin(1), but use a cached value | |
| // for future calls. | |
| // | |
| // Part 2. | |
| // Use this new function to refactor the code example. | |
| // Some good test numbers: 524287, 9369319, 2147483647 (all primes) |
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
| // 1. Write a class to support the following code: | |
| var thomas = new Person('Thomas'); | |
| var amy = new Person('Amy'); | |
| thomas.name // --> "Thomas" | |
| // 2. Add a getName() method to all Person objects, that outputs | |
| // the persons 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
| // Exercise 1 - OO || !OO | |
| // Define a data structure for cars (make and color), and a function | |
| // that logs a string like "I'm a red Mercedes" to the console. | |
| // Make two versions: a functional version, and a object-oriented version. | |
| // Example call for functional version: | |
| //logCar({ color: 'blue', make: 'BMW' }); | |
| // Example call for OO version: | |
| //(new Car('Ferrari', 'red')).log(); |
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
| var myVar = (function() { | |
| var index; | |
| function log(){ | |
| console.log(index); | |
| } | |
| function iterate(){ | |
| log(); |
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 isCreditCard(CC) { | |
| var sum = 0, mul = 1, length = CC.length, digit, tproduct; | |
| if(length > 19) return false; | |
| for (var i=0; i < length; i++) { | |
| digit = CC.substring(length-i-1,length-i); | |
| tproduct = parseInt(digit)*mul; | |
| sum += tproduct>=10 ? (tproduct % 10) + 1 : tproduct; | |
| mul += mul == 1 ? 1 : -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
| this.__sfdcSessionId = document.cookie.match(/(^|;\s*)sid=(.+?);/)[2]; |
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 loadScript(url, callback) { | |
| var head = document.getElementsByTagName("head")[0]; | |
| var script = document.createElement("script"); | |
| script.src = url; | |
| var done = false; | |
| script.onload = script.onreadystatechange = function () { | |
| if (!done && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete")) { | |
| done = true; | |
| callback(); | |
| script.onload = script.onreadystatechange = null; |
NewerOlder