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
| class OsVersion | |
| attr_reader :ruby_platform, :os, :ident, :version, :build | |
| def initialize | |
| @ruby_platform = RUBY_PLATFORM | |
| if File.exists?("/proc/version") | |
| @os = :linux | |
| @ident = File.open("/proc/version").readlines.join | |
| elsif `sw_vers`.length != 0 | |
| @os = :macosx | |
| @version = `sw_vers -productVersion`.chop! |
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
| <?php | |
| function tidyInput($input) { | |
| exec("echo " . escapeshellarg($input) . " | /usr/bin/tidy --indent auto --indent-spaces 2 --output-xhtml yes --show-errors 0 --show-warnings no --quiet yes --tidy-mark no --show-body-only yes", $response); | |
| return implode("\n", $response); | |
| } | |
| /* this is for use in my blogging application to clean up fragments of XHTML on my own site. Clean your inputs and prevent failure. :) -tom */ | |
| ?> |
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
| puts File.open("/Users/tommorris/tmp/latin.txt").readlines.collect {|l| l.strip }.uniq.sort * "\n" |
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
| require 'open-uri' | |
| require 'hpricot' | |
| def isAnonymousGist(url) | |
| (Hpricot(open(url))/"div[@class = 'file']").each { |i| | |
| if (i/"span[@class = 'date']/a[@href]").size == 0 | |
| url = "http://gist.github.com" + (i/"div[@class = 'info']/span/a")[0]['href'] | |
| system "open \"" + url + "\"" | |
| puts url | |
| end |
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
| require 'xml' | |
| hp = XML::HTMLParser.string("<html><body><p>pooey</body></html>") | |
| a = hp.parse | |
| a.find("//p").to_a[0].first.to_s |
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
| <?xml version="1.0"?> | |
| <log began="2008-09-24 10:36:03 +0100" source="irc://irc.freenode.net/%23vocamp"> | |
| <event id="T02T6X8L2Y1" name="memberParted" occurred="2008-09-24 10:46:09 +0100"> | |
| <message><span class="member">FabGando1</span> left the chat room.</message> | |
| <who hostmask="[email protected]" identifier="fabgando1">FabGando1</who> | |
| <reason>Read error: 110 (Connection timed out)</reason> | |
| </event> | |
| <event id="A6G56H9L2Y1" name="topicChanged" occurred="2008-09-24 10:46:29 +0100"> | |
| <message>You changed the topic to "VoCampOxford".</message> | |
| <by self="yes" hostmask="[email protected]">tommorris</by> |
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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:irc="http://irc-edelweiss.inria.fr/2008/09/irc/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns="http://www.w3.org/1999/xhtml" xmlns:sioc="http://rdfs.org/sioc/ns#"> | |
| <xsl:output method="xml" indent="yes"/> | |
| <xsl:template match="text()" /> | |
| <xsl:template match="log"> | |
| <html> | |
| <head profile="http://ns.inria.fr/grddl/rdfa/"> | |
| <title>IRC Logger for <xsl:value-of select="@source"/></title> | |
| <style type="text/css"> | |
| body { |
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
| @prefix : <http://tommorris.org/ns/vote#> . | |
| @prefix owl: <http://www.w3.org/2002/07/owl#> . | |
| @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | |
| @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | |
| @prefix sioc: <http://rdfs.org/sioc/ns#> . | |
| @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | |
| <http://purl.org/dc/terms/references> a rdf:Property . | |
| <http://purl.org/dc/terms/subject> a rdf:Property . |
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
| class Fixnum | |
| def divisible?(by) | |
| if by.class == Array | |
| self.divisible_by_all?(by) | |
| elsif by.class == Range | |
| self.divisible_by_all?(by.to_a) | |
| elsif by.class == String | |
| self.divisible?(by.to_i) | |
| else | |
| self.divmod(by)[1] == 0 |
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
| " ,g - create google a href for word under cursor | |
| map ,g <Esc>Bm`:r!ghref <cword><CR>"gdd``i<C-R><C-R>g<esc>dwi<BackSpace><Esc> | |
| vmap ,g yvgvdm`:r!ghref '<C-R>=substitute(@0, "['\n]", " ", "g")<cr>'<cr>"gdd``i<C-R><C-R>g<Esc>i<BackSpace><Esc> |
OlderNewer