Skip to content

Instantly share code, notes, and snippets.

@cbojar
cbojar / Gunman.java
Last active August 29, 2015 14:03
100 Gunmen
public class Gunman
{
private int number;
public Gunman(int number) {
this.number = number;
}
public int getNumber() {
return number;
@cbojar
cbojar / fizzbuzz.rb
Created December 11, 2012 16:50
FizzBuzz in Ruby
#!/usr/bin/ruby
1.upto(100) do |i|
div3 = (i%3).zero?
div5 = (i%5).zero?
print "Fizz" if div3
print "Buzz" if div5
print i unless div3 or div5
puts ""
end
@cbojar
cbojar / yt-channel-time.rb
Created December 10, 2012 18:49
A ruby script to calculate the total amount of time of all videos on a YouTube channel.
#!/usr/bin/ruby
##
# This script will calculate the total time for all videos on a user's channel
# It pulls from the channel's RSS feeds automatically, but is not particularly
# robust as it semi-scrapes out the time from the content area.
#
# (c) CBojar 2012, This is licensed under the MIT license.
##
require 'optparse'