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
## | |
# Exportable methods to help create XML from models. | |
# | |
# Author: Joel Parker Henderson (joel@joelparkerhenderson.com) | |
# License: GPL | |
# | |
module Exportable | |
## | |
# Get this object's export string, such as an XML element string. |
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
require_relative 'exportable' | |
class Project | |
include Exportable | |
attr_accessor :name | |
attr_accessor :description | |
attr_accessor :items | |
def initialize(args) | |
@name, @description, @items = args.values |
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
## | |
# Exportable module to help create XML from models. | |
# | |
# Author: Joel Parker Henderson (joel@joelparkerhenderson.com) | |
# License: GPL | |
# | |
module Exportable | |
## | |
# Get this object's export string, such as an XML element string. |
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
require 'ostruct' | |
class Transaction | |
attr_accessor :name, :last_name, :nation_id | |
def nation; OpenStruct.new(name: "Nation ID " + nation_id); end | |
end | |
@transaction = Transaction.new |
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 Roman | |
Memo = {} | |
Code = [["","I","II","III","IV","V","VI","VII","VIII","IX"], | |
["","X","XX","XXX","XL","L","LX","LXX","LXXX","XC"], | |
["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM"], | |
["","M","MM","MMM"]] | |
def self.to_roman(n) | |
Memo[n] ||= begin | |
l = Math.log10(n).to_i |
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 UIKit | |
class HomeViewController: UIViewController { | |
@IBOutlet weak var pageControl: UIPageControl! | |
@IBOutlet weak var pageImageView: UIImageView! | |
@IBOutlet weak var pageCaptionLabel: UILabel! | |
var pageIndex = 0 | |
let pageIndexMin = 0 |
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
=begin rdoc | |
= WebGet Ruby Gem: HashMore | |
Author:: Joel Parker Henderson, joelparkerhenderson@gmail.com | |
Copyright:: Copyright (c) 2007-2010 Joel Parker Henderson | |
License:: CreativeCommons License, Non-commercial Share Alike | |
License:: LGPL, GNU Lesser General Public License |
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
diff --git a/common.mk b/common.mk | |
index ea244cc..4f22609 100644 | |
--- a/common.mk | |
+++ b/common.mk | |
@@ -629,7 +629,8 @@ file.$(OBJEXT): {$(VPATH)}file.c $(RUBY_H_INCLUDES) {$(VPATH)}io.h \ | |
gc.$(OBJEXT): {$(VPATH)}gc.c $(RUBY_H_INCLUDES) {$(VPATH)}re.h \ | |
{$(VPATH)}regex.h $(ENCODING_H_INCLUDES) $(VM_CORE_H_INCLUDES) \ | |
{$(VPATH)}gc.h {$(VPATH)}io.h {$(VPATH)}eval_intern.h {$(VPATH)}util.h \ | |
- {$(VPATH)}debug.h {$(VPATH)}internal.h {$(VPATH)}constant.h | |
+ {$(VPATH)}debug.h {$(VPATH)}internal.h {$(VPATH)}constant.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
#!/usr/bin/env ruby | |
# | |
# Two words are "directly connected" if one word can transform into the other by any of: | |
# * substitution of one character for another, e.g. "tan" => "ton" | |
# * insertion of one character, e.g. "tan" => "than" | |
# * deletion of one character, e.g. "tan" => "an" | |
# | |
# Two words are "connected" if applying the rules above repeatedly can directly connect words: | |
# * e.g. "tan" => "ton" => "tone" => "one" => "on" | |
# * e.g. "tan" => "an" => "in" => "pin" => "pink" |