Skip to content

Instantly share code, notes, and snippets.

View Fordi's full-sized avatar

Bryan Elliott Fordi

View GitHub Profile
@Fordi
Fordi / energy-policy-rant.md
Created July 31, 2012 03:55
Energy policy rant

First, a little context. I discovered that my policy views are largely compatible with those of Jill Stein. Unfortunately, this survey largely omits energy policy. Since energy policy is, in my opinion, the most important thing in the current spectrum of US policy, I consider this a massive oversight.

How we approach problems with energy scarcity is the single most important political question of our age.

Energy, simply put, is the capacity to do work. Because of this, it helps drive economy. It is what we use to convert natural resources into goods. It is what we use to convert sunlight into food. It is what we use to convert labor into leisure. Our ability to extract and use energy to perform work is one of the biggest reasons that slavery is relegated to illegal operations around the world. We've made energy our slave, so we no longer need to make slaves of each other.

Energy, additionally, is "free" - in that the human race does not synthesize th

@Fordi
Fordi / checkbox.css
Created June 12, 2012 16:44
Cross-browser checkbox styling with graceful fallback (now with less!)
/**
Usage (the label is required)
<input id="uid" type="checkbox" ... /><label for="uid">Label</label>
Produces styled checkboxes in IE9+, current Firefox and Chrome
Demo here: http://jsfiddle.net/7Fggq/
@author Bryan Elliott <[email protected]>
*/
@Fordi
Fordi / workflow-demo.js
Created January 31, 2012 23:41
Javascript Workflow Processor
(function () {
var sayHi = function (token) {
if (!token.progress) token.progress = {};
token.progress.saidHi = (token.progress.saidHi||0) + 1;
//true == simply proceed; false == reject workflow
return true;
},
shakeIt = function (token, next) {
token.progress.shook = (token.progress.shook||0) + 1;
next('right');
@Fordi
Fordi / rules.js
Created January 31, 2012 14:56
Rules engine for Javascript
/**
* Simple javascript rules engine
*
* @author Bryan Elliott
* @link http://codemonkeybryan.com
*
* A RuleSet is essentially a simple list of voters. By executing the RuleSet,
* you iterate over the voters and obtain a done/fail event via jQuery's Deferred
* interface.
*
@Fordi
Fordi / dependency-tree.js
Created January 30, 2012 20:07
Simple dependency tree
var Dependency = (function () {
"use strict";
var Node = function () {
var i, pub = {}, inst = this;
for (i in inst)
if (inst[i] instanceof Function)
pub[i] = (function (i) {
return function () {
return inst[i].apply(inst, arguments);
};
@Fordi
Fordi / respiration-v-generation.md
Created November 23, 2011 20:10
Respiration v. Generation

Respiration v. Generation

AGW deniers ask "Hey, we breathe CO2; does that mean we're contributing?" supposing that this makes AGW absurd. The question it begs, though, is more one of, how does CO2 emission via respiration compare to that of power generation, and what are the differential concerns?

Humans

World population: ~ 7 billion humans
[Avearge human CO2 production][humanEmission]: 2T / year
CO2 produced by human respiration: 14GT / year

@Fordi
Fordi / calculating-carbon-intensity.md
Created November 23, 2011 19:15
Calculating carbon intensity

Calculating Carbon Intensity

So terms like "oil" and "coal" are somewhat confusing, when you go to look for properties. These are names for sets of compounds that share similar, but not equivalent characteristics.

So when I went looking for the carbon intensity of oil (that is, mass ratio of CO2 produced to fuel burned for a fuel), I found myself stymied; Wikiepedia did not have a simple number, and the papers on the subject elicited by a google search tended to avoid giving actual numbers on the subject.

Not to be discouraged, I figured you could calculate it yourself, and get something in the right ballpark.

Petroleum is made up of largely "alkanes" - molecules with this ladder-like formula:

@Fordi
Fordi / couple.js
Created November 18, 2011 02:12
Library agnostic invokation events for functions
(function () {
"use strict";
/**
* Add event couplings to a function, enabling aspect-oriented design patterns
*
* @return Function Coupled function
**/
Function.prototype.couple = function () {
var fn = this,
events = {before: {}, after: {}};
@Fordi
Fordi / informed-atheism.md
Created November 1, 2011 19:15
Informed Atheism is a Rebellion

Informed atheism is a rebellion. Not against God, for you don't rebel against things you treat as nonexistant. It's the expression of a rebellion against a popular view that it's ok to hold a belief that you can't demonstrate as true.

There's simple atheism: just failing to believe in a god for whatever reason: you've never been introduced to the concept; you're "angry" at your concept of god; you simply don't have a reason to believe. These are fine; I welcome the day when nearly everyone is a "simple atheist". These are the atheists that hardly need it as a label.

Informed atheism is a different animal: it's the statement that the existence of a god has been almost entirely excluded from belief by our knowledge. We understand there may be flaws in our knowledge, but the number of flaws necessary to allow a god to be real is staggering.

In short, a simple atheist may be easily turned into a believer - indeed, it's happened at least once to every single religious believer - but an informed atheist is

@Fordi
Fordi / module-template.js
Created August 12, 2011 21:28
Module template
/**
* This code block is designed to enable the consumer of a script to name your library whatever they want, by simply
* adding the attribute 'data-library-name' to the script tag. When the time comes in your script
* you simply set Module.Space[Module.Name] = Your Cool Library
*
* Other benefits to the Module object*:
* Module.Tag is the script tag that pulled your script in. You can use this to pull in further data-* attributes for script configuration
* Module.URI contains the URI used to get your script. This can be useful if you want to use script-relative resources, such as SWF files
* You can require jQuery just by setting the jQueryVersion argument.
*