This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://www.ruby-doc.org/core/classes/String.html#M001112 | |
# | |
# Calculate how many bytes String#unpack will read for a format string. | |
# | |
# Only guaranteed to work with the characters defined in classes, which are | |
# the sensible ones you should be using anyway. So there. | |
# | |
# Notably will not work with x, X, @, and so on. | |
def width(format) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.gitignore: Makefile | |
echo $(TARGETS) $(OBJS) | xargs -n 1 > .gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#include <avr/io.h> | |
#include <avr/interrupt.h> | |
#define BAUD 9600 | |
// doc8266: ATmega128RFA1 data sheet. Available at: | |
// | |
// http://www.atmel.com/dyn/resources/prod_documents/doc8266.pdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#include <termios.h> | |
#include <unistd.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
#include <fcntl.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"/> | |
<meta name="apple-mobile-web-app-capable" content="yes" /> | |
<meta name="apple-mobile-web-app-status-bar-style" content="white" /> | |
<meta name="apple-touch-fullscreen" content="yes" /> | |
<title>roku</title> | |
<script src="roku.js" type="text/javascript"></script> | |
<style type="text/css"> | |
html { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define STR(x) #x | |
#define STRINGIFY(x) STR(x) | |
#define LINESTR STRINGIFY(__LINE__) | |
#define logger_assert(x) if (!(x)) logger_die("%s: assertion failed: " #x \ | |
" (" __FILE__ ", line " LINESTR \ | |
")", __func__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FlatArray | |
instance_methods.each do |m| | |
undef_method(m) unless m =~ /(^__|^nil\?|^send$|^object_id$)/ | |
end | |
def initialize(array) | |
@target = array | |
end | |
def respond_to?(symbol, include_priv=false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Translation of Tom Moertel's tree traversal: | |
# | |
# http://blog.moertel.com/posts/2012-01-26-the-inner-beauty-of-tree-traversals.html | |
t0 = [] | |
t1 = [1] | |
t3 = [2, [1], [3]] | |
preorder_traversal = (f, z, tree) -> | |
do go = (tree, z) -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Description: | |
# Assigning jobs randomly to people with a role | |
# | |
# Commands: | |
# hubot request <role> - choose a random user with a role | |
# hubot rota <role> - show previous assignment counts | |
# | |
# Examples: | |
# hubot alisdair is a support technician | |
# hubot matthew is a support technician |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
var i, elements = document.querySelectorAll('body *'); | |
for (i = 0; i < elements.length; i++) { | |
if (getComputedStyle(elements[i]).position === 'fixed') { | |
elements[i].parentNode.removeChild(elements[i]); | |
} | |
} | |
})(); |
OlderNewer