// jQuery
$(document).ready(function() {
// code
})| var parser = document.createElement('a'); | |
| parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
| parser.protocol; // => "http:" | |
| parser.hostname; // => "example.com" | |
| parser.port; // => "3000" | |
| parser.pathname; // => "/pathname/" | |
| parser.search; // => "?search=test" | |
| parser.hash; // => "#hash" | |
| parser.host; // => "example.com:3000" |
| <?php | |
| /** | |
| * Set global/skip_process_modules_updates to '1' in app/etc/local.xml and | |
| * then use this script to apply updates and refresh the config cache without | |
| * causing a stampede on the config cache. | |
| * | |
| * @author Colin Mollenhour | |
| */ | |
| umask(0); | |
| ini_set('memory_limit','512M'); |
jQuery does good jobs when you're dealing with browser compatibility. But we're living in an age that fewer and fewer people use old-school browsers such as IE <= 7. With the growing of DOM APIs in modern browsers (including IE 8), most functions that jQuery provides are built-in natively.
When targeting only modern browsers, it is better to avoid using jQuery's backward-compatible features. Instead, use the native DOM API, which will make your web page run much faster than you might think (native C / C++ implementaion v.s. JavaScript).
If you're making a web page for iOS (e.g. UIWebView), you should use native DOM APIs because mobile Safari is not that old-school web browser; it supports lots of native DOM APIs.
If you're making a Chrome Extension, you should always use native APIs, not only because Chrome has almost the latest DOM APIs available, but this can also avoid performance issue and unnecessary memory occupation (each jQuery-driven extension needs a separate
| #!/bin/sh | |
| ### | |
| # SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer) | |
| # For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos | |
| ### | |
| # Alot of these configs have been taken from the various places | |
| # on the web, most from here | |
| # https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx |
| _.mixin({ | |
| // Get/set the value of a nested property | |
| deep: function (obj, key, value) { | |
| var keys = key.replace(/\[(["']?)([^\1]+?)\1?\]/g, '.$2').replace(/^\./, '').split('.'), | |
| root, | |
| i = 0, | |
| n = keys.length; |
| #!/bin/sh | |
| while true; | |
| do | |
| clear | |
| git log \ | |
| --graph \ | |
| --all \ | |
| --color \ | |
| --date=short \ | |
| -40 \ |
AI.js: Robots with Brains!
Once upon a time, there was a roboticist. She spent eight years working with robots of various shapes, sizes, and intelligence levels - her specialty was in planning and navigation algorithms (useful for driverless cars, rescue robots, etc.). Eager for some fresh air away from the lab, she switched gears and started developing a better Internet with JavaScript and Node.js.
In her time away, however, her little robot friends have also learned JavaScript! The likes of Johnny-Five and NodeCopter have breathed new life into those traditionally Python/C++-controlled machines, and our favorite roboticist's little vacation has come to a close.
Whereas 2012 was the start of moving, reactive robots programmed in JavaScript, 2013 will be the year of the smarter, autonomous robot! Task driven and data oriented, they will be the most intelligent JS robots you've ever seen - and they'll be the founders of the robot.js of tomorrow.
In this talk, we will discuss and review examples of
-
Create new files by pressing Ctrl/Cmd+alt+n and then typing the location to the file directly (note: won't actually create the file until you hit Ctrl/Cmd+S to save it)
-
Highlights hex code colours when the cursor is positioned on them.