Skip to content

Instantly share code, notes, and snippets.

View Fordi's full-sized avatar

Bryan Elliott Fordi

View GitHub Profile
@Fordi
Fordi / jsdaemon.sh
Last active August 29, 2015 03:31
Bluetooth joypad-watching daemon for RetroPie
#!/bin/bash
# For my RetroPie-based Game Frame
# When a bluetooth controller is connected, will turn on the screen, put the processor into
# "performance" mode, and start EmulationStation
# When any controller presses L+R+Start+Select, the reverse will occur:
# ES is killed, the processor is put into "ondemand" mode, HDMI is turned off, and all BT
# devices are disconnected.
watch_pad() {
DEV=/dev/input/$1
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Fordi
Fordi / Object.watch.js
Last active August 29, 2015 14:17
Object.watch and Object.getMetadata for all browsers
/***
* Object.watch / Object.unwatch for all browsers
* Plus bonus: Object.assign / Object.getMetadata / Object.getGUID
* @author Bryan Elliott
* @copyright 2015 GPLv2
**/
(function () {
"use strict";
var meta = {},
guid = 1,
@Fordi
Fordi / index.html
Last active August 29, 2015 14:18 — forked from TheMcMurder/index.html
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap-responsive.css" rel="stylesheet">
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" rel="stylesheet">
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
</head>
<div class="page-header">
<center>
/**
* ImmutableArray - exactly what it sounds like: an Array you can't change.
*
* Usage:
* var myArray = [1, 2, 3],
* myImmutableArray = myArray.immutable;
*
* ImmutableArrays can be used in place of normal Arrays in most cases, with the exception of the following mutator functions:
* #pop(), #push(item), #reverse(), #shift(), #unshift(item), #splice(start, length, items...), and #sort([sortfn])
* If used, these will throw a warning, copy the array, mutate it, and return the mutated array.
@Fordi
Fordi / jquery.ajaxcancel.js
Created June 30, 2011 16:03
Function for killing all running ajax requests in jQuery
(function ($) {
var _ajax = $.ajax,
xhrQueue = [];
$.ajax = function () {
var ret;
xhrQueue.push(ret=_ajax.apply(this, arguments));
return ret;
};
$.ajaxCancel = function () {
while (xhrQueue.length>0) xhrQueue.pop().abort();
@Fordi
Fordi / PHP's str_split for Javascript
Created July 1, 2011 23:55
Crock32: The Base32 implementation outlined by Douglas Crockford
Javascript str_split:
String.prototype.strSplit = function (n) {
return this.match(new RegExp('.{1,'+(n||1)+'}', 'g'));
}
@Fordi
Fordi / ShortcutIcon.js
Created July 19, 2011 19:29
Shortcut icon manager
jQuery.icon = (function ($) {
var types = {
ico: 'image/x-icon',
gif: 'image/gif',
png: 'image/png',
jpg: 'image/jpeg',
jpeg: 'image/jpeg'
},
_icon,
_stack=[],
@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.
*
@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