Skip to content

Instantly share code, notes, and snippets.

Stuart Ellis stuartellis

Block or report user

Report or block stuartellis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View pressman.md

Pressman - "Chess where everything is a queen"

The objective of this game is to remove all of your opponent's pieces from the board.

Preparing the Board

The game requires two players, a board, and thirty-two pieces. There should be two colors of pieces, sixteen pieces of each color.

For the rest of this document, we will assume that one color of pieces is black, and that the other color is white.

@stuartellis
stuartellis / Modules as Plugins
Created Feb 10, 2011
Code sample for using Ruby modules as plugins
View Modules as Plugins
#!/usr/bin/env ruby -wKU
class Item
attr_accessor :title
def initialize(title)
@title = title
end
end
@stuartellis
stuartellis / gist:657305
Created Oct 31, 2010
Possible solution to Euler problem 5
View gist:657305
#!/usr/bin/env ruby -wKU
class Application
def test(input)
pass = false
(1..20).each do |number|
if input % number == 0
@stuartellis
stuartellis / gist:629646
Created Oct 16, 2010
A solution to the URL Splitter problem
View gist:629646
# A solution to: http://sites.google.com/site/tddproblems/all-problems-1/URL-splitting
class UrlSplitter
def self.split(url)
match = url.match /(\w+):\/\/([^\/]+)(\/|$)(.*)?/
results = {:protocol => match[1], :domain => match[2]}
if match[4] == ""
results[:path] = nil
else
View lorem-ipsum
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque rutrum ligula mi, nec volutpat nibh. Cras non urna massa, eu sollicitudin ligula. Donec nec lacinia est. Nulla odio risus, laoreet id blandit ac, condimentum at ipsum. Proin eu quam risus. Mauris quis arcu volutpat risus interdum hendrerit. Morbi id risus risus, ut condimentum lorem. Suspendisse venenatis eros enim. Sed quis aliquam nunc. Ut eget erat lorem.
Curabitur tincidunt, purus eget ornare volutpat, elit leo laoreet ante, nec tincidunt ligula neque et nunc. Donec ultrices viverra euismod. Pellentesque ut vulputate odio. Fusce ut mi eget tortor imperdiet semper feugiat a lorem. In hac habitasse platea dictumst. Etiam in ligula a felis laoreet vulputate nec at elit. Cras ut velit eget tellus tempor imperdiet id a justo. Suspendisse at metus dolor, a pretium nisl. Vivamus varius posuere porttitor. Proin ullamcorper, tortor convallis semper eleifend, justo enim suscipit risus, eu sagittis mauris nisi eget lorem. Etiam in fringilla ante. Nam
View se-fib-solution
#!/usr/bin/env ruby -wKU
puts `ps -o rss= -p #{$$}`.to_i
current_fib = 1
fib_numbers = []
for i in 1..4000000 do
if i == current_fib * 2
fib_numbers << i
View Glyph Gemspec validation error
rake gemspec:validate --trace
(in /Users/se/Downloads/glyph)
** Invoke gemspec:validate (first_time)
** Invoke version_required (first_time)
** Execute version_required
** Execute gemspec:validate
glyph.gemspec is invalid. See the backtrace for more details.
rake aborted!
undefined method `prerelease?' for nil:NilClass
View Glyph Bundler Gemspec warning
["book/output/html5/glyph.html", "book/output/html5/images/document_generation.png", "book/output/html5/images/glyph.png", "book/output/html5/images/glyph.svg", "book/output/html5/styles/default.css", "book/output/html5/styles/lazy.css", "book/output/html5/styles/ultraviolet/lazy.css"] are not files
View Glyph 452af36 backtrace
/Users/se/.rvm/gems/ruby-1.8.7-p299@jruby_quickstart/bundler/gems/glyph-452af36/lib/glyph/commands.rb:44:in `+'
/Users/se/.rvm/gems/ruby-1.8.7-p299@jruby_quickstart/bundler/gems/glyph-452af36/lib/glyph/commands.rb:44
/Users/se/.rvm/gems/ruby-1.8.7-p299@jruby_quickstart/gems/gli-1.1.1/lib/gli/command.rb:71:in `call'
/Users/se/.rvm/gems/ruby-1.8.7-p299@jruby_quickstart/gems/gli-1.1.1/lib/gli/command.rb:71:in `execute'
/Users/se/.rvm/gems/ruby-1.8.7-p299@jruby_quickstart/gems/gli-1.1.1/lib/gli.rb:117:in `run'
/Users/se/.rvm/gems/ruby-1.8.7-p299@jruby_quickstart/bundler/gems/glyph-452af36/bin/glyph:7
/Users/se/.rvm/gems/ruby-1.8.7-p299@jruby_quickstart/bin/glyph:19:in `load'
/Users/se/.rvm/gems/ruby-1.8.7-p299@jruby_quickstart/bin/glyph:19
error: can't convert nil into String
You can’t perform that action at this time.