My Recent Pastes (30 and counting)

Browse Pastes by realname Nic Williams (30 and counting)


April 25, 2008
7:51PM EDT
by realname Nic Williams

$:.unshift File.dirname(__FILE__)

module NumberUtilities
  def self.process_array(args)
    current_op = nil
    args.inject(args.shift.to_f) do |total, op_or_arg|
      if op_or_arg =~ /[\d\.]+/ && arg = op_or_arg.to_f

April 17, 2008
7:56PM EDT
by realname Nic Williams

$:.unshift File.dirname(__FILE__) if $0 == __FILE__
require 'kim/document'
require 'kim/semantic_annotation'

if $0 == __FILE__
  $sample = "Seven UK airlines including British Airways, Virgin Atlantic," +
          " BMI British Midland and EasyJet, on Friday took over control" +

April 14, 2008
7:55PM EDT
by realname Nic Williams

module Dramatis; end

module Dramatis::ActorMethods
  def do_actor_things
    puts "do_actor_things #{self.class}"
  end
  

April 14, 2008
6:58PM EDT
by realname Nic Williams

module M

  class Wrapper
    def initialize wrapped
      puts "Doing Wrapper init"
    end
  end

April 14, 2008
9:50AM EDT
by realname Nic Williams

  def self.reverse(relation_name)
    @@reverse_hash ||= {
      "Type Of" => "Typed By",
      "Typed By" => "Type Of",
      "Describes" => "Is Described",
      "Is Described" => "Describes",
      "Used For" => "Uses",

April 13, 2008
9:25PM EDT
by realname Nic Williams

/* Copyright (c) 2007 Dr Nic Williams ([email protected] || http://drnicwilliams.com)
 * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
 *
 * Version: @VERSION
 * Requires jQuery 1.2.3+
 * Docs: http://docs.jquery.com/Plugins/ajax_cache
 * Dependencies: jCache 1.0.2 - http://plugins.jquery.com/project/jCache

April 13, 2008
9:24PM EDT
by realname Nic Williams

/* Copyright (c) 2007 Dr Nic Williams ([email protected] || http://drnicwilliams.com)
 * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
 *
 * Version: @VERSION
 * Requires jQuery 1.2.3+
 * Docs: http://docs.jquery.com/Plugins/ajax_cache
 * Dependencies: jCache 1.0.2 - http://plugins.jquery.com/project/jCache

April 13, 2008
9:15PM EDT
by realname Nic Williams

/* Copyright (c) 2007 Dr Nic Williams ([email protected] || http://drnicwilliams.com)
 * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
 *
 * Version: @VERSION
 * Requires jQuery 1.2.3+
 * Docs: http://docs.jquery.com/Plugins/ajax_cache
 * Dependencies: jCache 1.0.2 - http://plugins.jquery.com/project/jCache

April 13, 2008
9:11PM EDT
by realname Nic Williams

/* Copyright (c) 2007 Dr Nic Williams ([email protected] || http://drnicwilliams.com)
 * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
 *
 * Version: @VERSION
 * Requires jQuery 1.2.3+
 * Docs: http://docs.jquery.com/Plugins/ajax_cache
 * Dependencies: jCache 1.0.2 - http://plugins.jquery.com/project/jCache

April 13, 2008
8:29PM EDT
by realname Nic Williams

  $.updateRelationsCheckboxes = function(relationsList, url) {
    if (url) $.jCache.setItem(url, relationsList);
    $('input.relation').each(function(index) {
      var label = $(this).next().next().html();
      for (var i=0; i < relationsList.length; i++) {
        if (label == relationsList[i]) {
          $(this).click();

April 12, 2008
12:34AM EDT
by realname Nic Williams

    $.getJSON(recent_nodes_journey_thought_guide_path($.journey()), {
        data: { offset: recentNodesCount },
      },
      function(responseBody) {
        $('.recent_nodes_more').remove();
        for (var i=0; i < responseBody.length; i++) {
          $('<li><a href="">' + responseBody[i] + '</a></li>')

April 12, 2008
12:31AM EDT
by realname Nic Williams

    $.getJSON({
      url: recent_nodes_journey_thought_guide_path($.journey()),
      data: { offset: recentNodesCount },
      error: function(xhr) {
         $('#errorDisplay')
           .appendTo('Error: ' + xhr.status + ' ' + xhr.statusText);
       },

April 11, 2008
7:19PM EDT
by realname Nic Williams

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        url = git://github.com/jnunemaker/twitter.git

April 11, 2008
7:29AM EDT
by realname Nic Williams

#!/Users/nicwilliams/ruby/ruby/ruby-trunk
# coding: utf-8

# Replace #! with location of your ruby1.9 or 
# run through ruby1.9 manually.

Infinity = 1.0/0.0

April 11, 2008
5:36AM EDT
by realname Nic Williams

# This would have been cool in ruby1.9
Infinity = 1.0/0.0
∞ = Infinity

# unfortunately...
# > /Users/nicwilliams/Desktop/infinity.rb:2: invalid multibyte char

Next page