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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title>Slideshow demo</title> | |
<script type="text/javascript" src="slideshow.js"></script> | |
<style type="text/css"> | |
#current { position: absolute; left: 0px; top: 0px; z-index: 0; } | |
#next { position: absolute; left: 640px; top: 0px; z-index: 1; } | |
#slideshow { position: relative; border: solid #2b2b2b 3px; overflow: hidden; } | |
</style> |
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
/*jslint browser: true, indent: 2 */ | |
// Atomizer: Small embeddable JavaScript web client for Atom feeds (RFC 4287). | |
// | |
// Generates unordered lists or tables which can be inserted anywhere on | |
// the page using innerHTML. | |
// | |
// The Atom feed needs to be on the same hostname, port and protocol as the | |
// web page, because of browser security policies. | |
// See <http://en.wikipedia.org/wiki/Same_origin_policy> |
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
#!/usr/bin/env ruby | |
# encoding: UTF-8 | |
# Utility for Mac OS X to locate files which have resource forks, and which | |
# therefore might be corrupted by being transferred via a non-Mac filesystem. | |
require 'find' | |
if ARGV.length != 1 | |
puts "usage: forkboy <dir>" |
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
public class SubClass extends SuperClass { | |
protected int myValue = 69; | |
public SubClass() { | |
// You might think that field initialization will have been performed before this constructor is executed. | |
super(); | |
// However, Java doesn't actually perform all the field initialization for this object until this point in the code. | |
// Note also that there's nothing in the source code to say that initialization happens here. | |
System.out.println("Subclass constructor continuing"); |
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
#!/usr/bin/env ruby | |
# encoding: UTF-8 | |
# | |
# Simple Gödel encoding | |
# Ruby 1.9.3 | |
require 'prime' | |
# Allowed characters | |
CHARS = ' ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
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
#!/usr/bin/env ruby | |
# encoding: UTF-8 | |
'di ' | |
'ig00 ' | |
# This is both a Ruby script and a man page; you can symlink it into your | |
# man directory as commandname.1 or run man -l on this file. | |
# This is a generic skeleton for a Ruby command-line utility, showing how to | |
# make the same file work as both a Ruby script and a man page, for ease of | |
# distribution. This cool hack brought to you by mathew <meta@pobox.com>. |
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
import java.text.DecimalFormat; | |
/** | |
* The Stopwatch class provides a simple way to record the real-world time taken by an operation, | |
* averaged over multiple runs, and report the result easily in logs. | |
* | |
* An example use case would be timing JDBC calls to a relational database. | |
* | |
* This code does not measure CPU time or pay any attention to whether a thread or process is | |
* active or not. For that, you need to use a profiler. |
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
#!/usr/bin/env ruby | |
# encoding: UTF-8 | |
# Script to take IBM Lotus Domino console input on stdin, and send it to | |
# syslog. | |
# | |
# Allows you to do all your logging via syslog, rather than having to | |
# keep weeks of data in log.nsf. | |
# | |
# In rsyslog, filter like this: |
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
#!/usr/bin/env ruby | |
# encoding: UTF-8 | |
'di ' | |
'ig00 ' | |
# This is both a Ruby script and a man page; you can symlink it into your | |
# man directory as /usr/local/man/man8/jay.1 or run man -l on this file. | |
# The package which contains the kernel image itself | |
KERNEL_PACKAGE = 'linux-image' |
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
# Runs a specified shell command in a separate thread. | |
# If it exceeds the given timeout in seconds, kills it. | |
# Returns any output produced by the command (stdout or stderr) as a String. | |
# Uses Kernel.select to wait up to the tick length (in seconds) between | |
# checks on the command's status | |
# | |
# If you've got a cleaner way of doing this, I'd be interested to see it. | |
# If you think you can do it with Ruby's Timeout module, think again. | |
def run_with_timeout(command, timeout, tick) | |
output = '' |