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
| ##### | |
| ## INITIAL CONFIGURATION | |
| ##### | |
| # Fork sstephenson/prototype on GitHub | |
| # Go to this url and click the fork button. This will create a prototype | |
| # repository under your GitHub account. | |
| http://github.com/sstephenson/prototype |
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
| %h1.lol | |
| NO U |
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($, doc) { | |
| var getHTML = function getHTML() { | |
| return $.String(this.raw.outerHTML); | |
| }; | |
| if (!('outerHTML' in doc.documentElement)) { | |
| var dummy = doc.createElement('html'); | |
| getHTML = function getHTML() { | |
| dummy.appendChild(this.raw.cloneNode(true)); | |
| var result = dummy.innerHTML; |
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
| // Example | |
| document.observe("lol:konami", function() { | |
| $(document.body).insert(new Element('h1').update("KONAMI!!!").setStyle({fontWeight: "bold", color: "red"})); | |
| }); |
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
| so my workflow is that each ticket gets a branch. Before merging the branch to master | |
| it needs to be peer-reviewed. So sometimes I have a bunch of branches that are off | |
| being reviewed while I work on something else. | |
| Currently when I run "git branch" I see: | |
| [branch 1] | |
| [branch 2] | |
| [branch 3] | |
| *[branch 4] | |
| [branch 5] |
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
| // Truncate a string to the closest word | |
| String.prototype.truncateToWord = function( length ) { | |
| return this | |
| .slice( 0, length + 1 ) | |
| .split( /\s+/ ) | |
| .slice( 0, -1 ) | |
| .join( " " ) | |
| } | |
| // Examples |
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
| // Proposed syntax for IRC bot | |
| // --------------------------- | |
| jerk(function() { | |
| // `watch_for` takes a regular expression, and matches it against everything that is said | |
| watch_for(/^api (\w+)\.(\w+)/, function(message) { | |
| // Message object has properties: match_data, channel, user, text | |
| // `say` replies in the channel that the message was heard in | |
| say(message.user.nick + ": Something " + message.match_data[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
| =begin | |
| License: latest LGPL :D | |
| As per my discussion with Gianni (@gf3), | |
| http://twitter.com/phillmv/status/2659984348 | |
| http://twitter.com/phillmv/status/2660026344 | |
| http://twitter.com/phillmv/status/2660059102 | |
| http://twitter.com/phillmv/status/2660184885 | |
| http://twitter.com/phillmv/status/2660283856 and | |
| http://twitter.com/phillmv/status/2660306850 |
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
| document.observe('dom:loaded', function() { | |
| $$('input[tabindex="1"]')[0].focus(); | |
| }); |
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
| // How to get the iframe document object | |
| // Assume 'iframe' is a variable to the iframe DOM element | |
| var iframe_document = null; | |
| if (iframe.contentDocument) iframe_document = iframe.contentDocument; | |
| else if (iframe.contentWindow) iframe_document = iframe.contentWindow.document; | |
| else if (iframe.document) iframe_document = iframe.document; | |
| else throw(new Error("Cannot access iframe document.")); |