Skip to content

Instantly share code, notes, and snippets.

@jedp
jedp / xmas-lights.1.ino
Created December 23, 2014 01:19
Connecting the eTape to the Arduino
#define ETAPE A0
float resistance;
void setup(void) {
Serial.begin(9600);
}
void loop(void) {
resistance = analogRead(ETAPE);
@jedp
jedp / xmas-lights.2.ino
Last active August 29, 2015 14:11
Reporting low water level with the eTape
#define ETAPE A0
// Set crucial level as appropriate for your needs.
// For me, 687 indicates three inches of water.
#define CRUCIAL_LEVEL 687
#define LED_RED 13
float resistance;
void setup(void) {
@jedp
jedp / xmas-lights.3.ino
Last active August 29, 2015 14:11
Illuminating one of two LEDs, depending on eTape level
#define ETAPE A0
// Set crucial level as appropriate for your needs.
// For me, 687 indicates three inches of water.
#define CRUCIAL_LEVEL 687
#define LED_RED 13
#define LED_GREEN 12
float resistance;
@jedp
jedp / gist:799455
Created January 27, 2011 22:40
Gracefully handle the unavailability of Typekit
if (typeof Typekit != 'undefined') {
try {
Typekit.load({
active: function() {
// it worked. carry on ...
}
});
} catch(e) {
// probably want to fall back to no typekit
$('html').addClass('wf-inactive').removeClass('wf-loading');
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
# Sudoku solver in CoffeeScript based on the Python solution by Peter Norvig
# http://norvig.com/sudoku.html
# 2011-04-19 jonelf@gmail.com
#
# Throughout this program we have:
# r is a row, e.g. 'A'
# c is a column, e.g. '3'
# s is a square, e.g. 'A3'
# d is a digit, e.g. '9'
# u is a unit, e.g. ['A1','B1','C1','D1','E1','F1','G1','H1','I1']
@jedp
jedp / gist:970079
Created May 13, 2011 06:23
Jison grammar to convert numerals into an integer
/* Jison grammar for converting numerals into an integer */
/* The lexical analyzer
How we break things up into tokens */
%lex
%%
[0-9]+ return 'INT'
"-" return '-'
@jedp
jedp / gist:970091
Created May 13, 2011 06:46
steve.jison
/* Part of the grammar of Steve */
%lex
%%
\s+ { /* ignore whitespace */ }
[0-9]+"."[0-9]+\b { return 'FLOAT'; }
[0-9]+\b { return 'INT'; }
\"[^\"]+\" { yytext = yytext.substr(1, yyleng-2); return 'STR'; }
"int" return 'INTTYPE'
@jedp
jedp / gist:1784039
Created February 9, 2012 22:53
ldap auth for express and socket.io
// express + socket.io example (chat server)
// that requires authentication via ldap.
// express shares authentication with socket.io.
var express = require('express');
var io = require('socket.io');
var ldap = require('./lib/node-ldapauth/ldapauth');
var sessionStore = new express.session.MemoryStore(); // whatever
var parseCookie = require('connect').utils.parseCookie;
@jedp
jedp / gist:1792050
Created February 10, 2012 19:38
compiling python support in vim73
# must set this vi_cv_path_python_plibs var
# people say having a trailing slash on the python-config-dir causes problems
$ export vi_cv_path_python_plibs="-L/usr/lib64/python2.7/config -lpython2.7 -ldl"
$ ./configure --enable-cscope \
--enable-multibyte \
--enable-gui \
--with-python-config-dir=/usr/lib64/python2.7/config \
--enable-pythoninterp=yes \
--with-x \