Skip to content

Instantly share code, notes, and snippets.

Avatar

Tate Johnson tatey

View GitHub Profile
@tatey
tatey / Account.java
Created Aug 13, 2008
Solution to Lab 3 for 1005ICT
View Account.java
/**
* Write a description of class Account here.
*
* @author Tate Johnson
* @version 2008-08-07
*/
public class Account {
@tatey
tatey / AccountTester.java
Created Aug 13, 2008
Solution to Lab 3 test class for 1005ICT
View AccountTester.java
/**
* Write a description of class AccountTester here.
*
* @author Tate Johnson
* @version 2008-07-08
*/
public class AccountTester {
@tatey
tatey / Lab5.java
Created Aug 27, 2008
Solution to Lab 5 for 1005ICT
View Lab5.java
/**
* @author Tate Johnson
* @version 2008-08-20
*/
public class Lab5 {
// Instance variable
private double[] data;
@tatey
tatey / GameBoard.java
Created Sep 2, 2008
Solution to Lab 7 for 1005ICT
View GameBoard.java
import java.util.Random;
/**
* Class GameBoard for Lab7
*
* @author Tate Johnson
* @version 2008-09-02
*/
public class GameBoard {
@tatey
tatey / GameBoard.rb
Created Sep 3, 2008
Solution to Lab 7 for 1005ICT in Ruby
View GameBoard.rb
# Ruby implementation of Lab 7 for 1005ICT (Java Programming) at Griffith Univeristy.
# Why? To practice learning Ruby
class GameBoard
attr_accessor :board
def initialize(row, col)
@board = Array.new(row) { |row| Array.new(col, 0) }
end
View gist:17135
def get_response_from_remote(url, retry_count, timeout_in_seconds)
begin
url = URI.parse(url)
timeout(timeout_in_seconds) do
Net::HTTP.start(url.host) do |session|
if url.query
response = session.get(url.path + "?" + url.query)
else
response = session.get(url.path)
end
View social_services.rb
require "ftools"
require "net/http"
require "rexml/document"
require "timeout"
require "uri"
# Methods for retrieving social data from services including Flickr, Last.fm and Twitter.
module SocialServices
def get_recently_uploaded_from_flickr(limit)
recently_uploaded = []
View gist:21288
/**
* Charges annual fee on all accounts if an annual fee is applicable. Returns
* total amount of revenue collected by summing the rates of all annual fees charged
*
* @return Sum of annual fees charged
*/
public int chargeAnnualFees()
{
int totalAnnualFees = 0;
for (Account account : accounts)
View lastfm.pl
# Now playing script for Irssi which retrieves your currently listened to song from the Last.fm API
#
# 1) Define your last.fm username and api account key
# 2) Load script in to Irssi "/script load lastfm" (Assuming you've placed the script in .irssi/scripts)
# 3) Execute script from witin Irssi "/np"
my $user = "<USERNAME>";
my $api_key = "<API_KEY>";
##### DO NOT EDIT BELOW THIS LINE #####
View gist:23223
// Enhanced for loop (For each)
public int sum(int[] nums)
{
int sum = 0;
for (int num : nums)
{
sum += num * num
}
return sum;
}
You can’t perform that action at this time.