Skip to content

Instantly share code, notes, and snippets.

daveharris / Challenge
Last active May 11, 2020
Coding Challenge
View Challenge

In the programming language of your choice, write a program that accepts an array of words, and calculates the number of vowels. For example, Given:

['hello', 'world']


a: 0
e: 1
i: 0
daveharris / bashmarks-homebrew.rb
Created Nov 24, 2014
Bashmarks Homebrew Install Formula
View bashmarks-homebrew.rb
require "formula"
class Bashmarks < Formula
homepage ""
url ""
sha1 "53010ce4f613e5e30070ceae01eee5526f3063b2"
version "1.0"
def install
system "make", "install"
daveharris / modularise.rb
Created Feb 19, 2014
Add "Module MyModule" to all ruby files
View modularise.rb
Dir["**/*.rb"].each do |file|
contents = IO.readlines(file)
open(file, "w") do |f|
f.puts "module MyModule\n"
contents.each { |line| f.write " #{line}" }
f.puts "\nend"
daveharris /
Created Oct 23, 2013
Ruby and Java comparisons for taking a file of results and calculating average, minimum and maximum scores and whether the test should be scaled or not
import java.util.ArrayList;
import java.util.Scanner;
public class TestResults {
public static void main(String[] args) throws FileNotFoundException {
ArrayList<Integer> scores = new ArrayList<Integer>();
Scanner scanner = new Scanner(new File("test_results.txt")).useDelimiter("\\n");;
daveharris / Java
Last active Dec 14, 2015
Differences between Java and Ruby
View Java
Set<Kitten> kittens = KittenDaoImpl.all();
Iterator iter = kittens.iterator();
while(iter.hasNext()) {
Kitten kitten =;
if (kitten.isCuteAndAdorable()) {
View gist:581816

I have found the layout of SWT rather esoteric, and the javadoc is really bad, it doesn't say what the meaning of the argument is, so you have stuff like: GridLayout gridLayout = new GridLayout(2, true); which means you have 2 columns and they are each of equal width. To make this more readable/understandable, I propose two otions...

Option 1 - Use named paramaters

We can name the parameters like so;

int numColumns = 2;

boolean makeColumnsEqualWidth = false;