Skip to content

Instantly share code, notes, and snippets.

View thomasphorton's full-sized avatar

Tom Horton thomasphorton

View GitHub Profile
.DS_Store
node_modules
@thomasphorton
thomasphorton / rpi-gpio-test.js
Created November 6, 2015 09:11
Basic test script for Raspberry Pi GPIO
var gpio = require('rpi-gpio');
var pin = 11;
gpio.setup(pin, gpio.OUT, function() {
gpio.write(pin, true, function(err) {
if (err) throw err;
});
});
@thomasphorton
thomasphorton / diff-gpio-admin.c
Created November 6, 2015 09:04
quick2wire-gpio-admin diff
diff --git a/src/gpio-admin.c b/src/gpio-admin.c
index 38569bb..faea863 100644
--- a/src/gpio-admin.c
+++ b/src/gpio-admin.c
@@ -27,7 +27,7 @@ static void usage_error(char **argv) {
static void allow_access_by_user(unsigned int pin, const char *filename) {
char path[PATH_MAX];
- int size = snprintf(path, PATH_MAX, "/sys/devices/virtual/gpio/gpio%u/%s", pin, filename);
+ int size = snprintf(path, PATH_MAX, "/sys/class/gpio/gpio%u/%s", pin, filename);
@thomasphorton
thomasphorton / jquery-masked-input.js
Created October 30, 2013 15:09
/* Masked Input plugin for jQuery Copyright (c) 2007-2011 Josh Bush (digitalbush.com) Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license) Version: 1.3 */
(function (a) {
var b = (a.browser.msie ? "paste" : "input") + ".mask",
c = window.orientation != undefined;
a.mask = {
definitions: {
9: "[0-9]",
a: "[A-Za-z]",
"*": "[A-Za-z0-9]"
},
dataName: "rawMaskFn"
@thomasphorton
thomasphorton / jquery-placeholder.js
Created October 30, 2013 15:06
/* * Placeholder plugin for jQuery * --- * Copyright 2010, Daniel Stocks (http://webcloud.se) * Released under the MIT, BSD, and GPL Licenses. */
;
(function (b) {
function d(a) {
this.input = a;
a.attr("type") == "password" && this.handlePassword();
b(a[0].form).submit(function () {
if (a.hasClass("placeholder") && a[0].value == a.attr("placeholder")) a[0].value = ""
})
}
d.prototype = {
@thomasphorton
thomasphorton / wizard-form.asp
Last active December 23, 2015 00:29
ASP - Form Wizard Template
<%
pageTitle = "Form Title"
NetInsightID = "property-mgr-start"
RDSendEmailTo = "your-email@duke-energy.com"
state = Request.Cookies("state")
confirmationMessage = "A confirmation e-mail will be sent to you once processing is complete."
submitButtonText = "Submit"
formType = "wizard"
%>
@thomasphorton
thomasphorton / simple-form.asp
Last active December 23, 2015 00:29
ASP - Simple Form Template
<%
RDSendEmailTo = "your-email@duke-energy.com"
pageTitle = "Form Title"
NetInsightID = "interest"
state = Request.Cookies("state")
custServicePhone = ""
confirmationMessage = "Thank you for submitting your request."
submitButtonText = "Submit"
formType = "simple"
@thomasphorton
thomasphorton / carousel-initialization.js
Created September 10, 2013 20:48
JS - Carousel Banner Initialization