This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 | |
| # Notice I set UTF-8 as the default above. As far as I'm concerned there | |
| # are two choices of encoding: UTF-8, and legacy crap. If I need to deal | |
| # with anything else I'll handle it explicitly, as in this example. | |
| # Open an ISO-8859-1 file. | |
| infile = File.open("iso88591.txt", "r:iso-8859-1") |
This file contains hidden or 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 | |
| # Convert FLAC files to mp3 files, keeping metadata from the FLAC files. | |
| # | |
| # Requires that FLAC (including metaflac) and LAME tools be installed | |
| # and on the path. | |
| # | |
| # Takes any number of .flac files on the command line. |
This file contains hidden or 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 | |
| # Google Reader to Evernote | |
| # Quick hack together of a Ruby script which will pull all your Google Reader | |
| # starred items into an Evernote notebook in ENML (Evernote export format). | |
| # Requires Ruby 2.0, no other special dependencies. Should work on 1.9 but I | |
| # haven't tested it. | |
| # |
This file contains hidden or 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/ruby | |
| # An example of BluePages / IBM Intranet Password authentication using Ruby. | |
| # Uses the gem ruby-ldap, a Ruby wrapper for OpenLDAP. Works with Ruby 2.0. | |
| # | |
| # To get this code to work, you must | |
| # | |
| # 1. gem install ruby-ldap | |
| # 2. add | |
| # |
This file contains hidden or 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/ruby | |
| # encoding: UTF-8 | |
| # The audit team wanted to know that we were doing logging as required. As | |
| # evidence, they asked for a regular report consisting of the first 10 lines | |
| # of each daily log file. I wrote this script to automate the process. | |
| # If you want the last 10 lines instead, I suggest the Ruby Gem called Elif, | |
| # which wraps any IO object to read line by line backwards. | |
| LINES_OF_LOG = 10 |