This Gist moved to https://github.com/coinlab/bitcoin-docs.
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
| // unit.js - Unit testing framework | |
| // Copyright (c) 2007-2009, Mike Koss (mckoss@startpad.org) | |
| // | |
| // Usage: | |
| // ts = new UT.TestSuite("Suite Name"); | |
| // ts.DWOutputDiv(); | |
| // ts.AddTest("Test Name", function(ut) { ... ut.Assert() ... }); | |
| // ... | |
| // ts.Run(); | |
| // ts.Report(); |
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
| <html> | |
| <head> | |
| <title>Sample File</title> | |
| </head> | |
| <body> | |
| <h1><script>document.write(document.title></script></h1> | |
| </body> | |
| </html> |
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
| import UserDict | |
| class DynDict(UserDict.DictMixin): | |
| """ | |
| Implement a dynamic dictionary object, which acts as the union of the dictionaries | |
| from which it was created. | |
| The first dictionary is searched first, and subsequent dictionaries are searched when no results are found. | |
| New elements are always created in the first dictionary. |
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
| // From http://clients1.google.com/js/counter2_compiled.js | |
| google.eggRequest = function (a) { | |
| var b = document.createElement("SCRIPT"); | |
| b.src = "http://clients1.google.com/egg?ei=" + google.kEI + "&cd=" + a; | |
| google.append(b) | |
| } | |
| google.egg || | |
| function () { |
##How Homakov hacked GitHub and the line of code that could have prevented it
@homakov’s explot on GitHub was simple and straightforward. Calling it an attack makes it sound malicious whereas the truth was that GitHub bolted its front door but left the hinges on quick release. Homakov released the hinges, walked in and shouted to anyone who would listen that they had a problem.
He was right. The Rails defaults are vulnerable and there’s no better illustration of this than when when one of the best Rails teams in the world is severely compromised.
TL;DR: How to protect your Rails application from the GitHub attack
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
| <link rel="import" href="../core-icon-button/core-icon-button.html"> | |
| <link rel="import" href="../core-toolbar/core-toolbar.html"> | |
| <link rel="import" href="../core-header-panel/core-header-panel.html"> | |
| <link rel="import" href="../core-item/core-item.html"> | |
| <polymer-element name="my-element" attributes="foo bar"> | |
| <template> | |
| <style> | |
| :host { |
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
| I am not here. |
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
| // Get Firebase value from a query as a Promise. | |
| function getValue(ref, allowNull) { | |
| return new Promise(function(resolve, reject) { | |
| ref.once('value', | |
| function(snap) { | |
| var result = snap.val(); | |
| if (result === null && !allowNull) { | |
| reject(new Error("No data at location: " + ref.toString())); | |
| return; | |
| } |