Skip to content

Instantly share code, notes, and snippets.

View mckoss's full-sized avatar

Mike Koss mckoss

View GitHub Profile
@mckoss
mckoss / unit.js
Created December 7, 2009 19:47
JavaScript Unit Testing Framework
// 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();
@mckoss
mckoss / simple.html
Created December 8, 2009 18:10
Simple HTML
<html>
<head>
<title>Sample File</title>
</head>
<body>
<h1><script>document.write(document.title></script></h1>
</body>
</html>
@mckoss
mckoss / DynDict.py
Created December 30, 2009 03:20
DynDict - implement a nested collection of dictionaries
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.
// 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 () {
@mckoss
mckoss / moved.md
Created December 30, 2011 00:28
A Bitcoin Primer
@mckoss
mckoss / securing_rails_updates.md
Created March 5, 2012 15:14 — forked from peternixey/securing_rails_updates.md
How Homakov hacked GitHub and how to protect your application

##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

@mckoss
mckoss / gist:4211704
Created December 5, 2012 02:53
String-based Hierarchical Deterministic Bitcoin Keys

String-based Heirarchical Deterministic Keys

This is an alternate proposal to [BIP32].

Version History:

  • 12-7-2102: Addition of chain code (much as BIP32 uses).
  • 12-3-2012: Initial Proposal (version 1)

Motivation

@mckoss
mckoss / designer.html
Created August 8, 2014 20:54
designer
<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 {
@mckoss
mckoss / goodbye
Created August 8, 2014 20:56
My little sumpin'
I am not here.
@mckoss
mckoss / gist:a56114f27c4a90f51502
Created March 26, 2015 21:40
Firebase Promise Wrappers
// 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;
}