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
| class String | |
| # Shortcut for File.join | |
| # Usage | |
| # '..'/'foo' -> '../foo' | |
| def /(path) | |
| File.join(self, path.to_s) | |
| end | |
| end |
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
| # /usr/local ➤ ls | |
| PS1="\[\e[0;33m\]\W ➤ \[\e[0m\]" | |
| # http://github.com/mbrubeck/compleat | |
| source /usr/local/share/compleat-1.0/compleat_setup |
- Webkit bug #27922
- Opera bug DSK-283297@bugs.opera.com
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
| >>> typeof document.all | |
| "undefined" | |
| >>> document.all | |
| [object HTMLCollection] | |
| >>> typeof document.all[0] | |
| "object" |
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-zA-Z][-+.a-zA-Z\d]*): (?# 1: scheme) | |
| (?: | |
| ((?:[-_.!~*'()a-zA-Z\d;?:@&=+$,]|%[a-fA-F\d]{2})(?:[-_.!~*'()a-zA-Z\d;\/?:@&=+$,\[\]]|%[a-fA-F\d]{2})*) (?# 2: opaque) | |
| | | |
| (?:(?: | |
| \/\/(?: | |
| (?:(?:((?:[-_.!~*'()a-zA-Z\d;:&=+$,]|%[a-fA-F\d]{2})*)@)? (?# 3: userinfo) | |
| (?:((?:(?:(?:[a-zA-Z\d](?:[-a-zA-Z\d]*[a-zA-Z\d])?)\.)*(?:[a-zA-Z](?:[-a-zA-Z\d]*[a-zA-Z\d])?)\.?|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|\[(?:(?:[a-fA-F\d]{1,4}:)*(?:[a-fA-F\d]{1,4}|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|(?:(?:[a-fA-F\d]{1,4}:)*[a-fA-F\d]{1,4})?::(?:(?:[a-fA-F\d]{1,4}:)*(?:[a-fA-F\d]{1,4}|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}))?)\]))(?::(\d*))?))?(?# 4: host, 5: port) | |
| | |
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 A_reduce = [].reduce; | |
| Array.prototype.reduce = function reduce (callback, initialValue) { | |
| var operator = callback; | |
| return typeof operator == 'string' && /^[ +*/%-><!&|^?,.]/.test(operator) | |
| ? eval(this.join(operator)) | |
| : A_reduce.apply(this, arguments) | |
| }; | |
| [1,2,3,4].reduce('+') // 10 | |
| [1,2,3,4].reduce('*') // 24 |
This script is also available at .
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 Markdown(value) { | |
| this.value = value || ''; | |
| this.length = this.value.length; | |
| }; | |
| Markdown.prototype = new String; | |
| // Instance methods | |
| Markdown.prototype.toString = Markdown.prototype.valueOf = function(){return this.value}; | |
| Markdown.prototype.toHTML = function(){return Markdown.decode(this)}; |
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
| num = 1; | |
| (function () { | |
| alert(num || 2); // 1, Obviosly | |
| })(); | |
| (function () { | |
| var num = num || 2; | |
| alert(num); // 2! | |
| })(); |