Skip to content

Instantly share code, notes, and snippets.

View btforsythe's full-sized avatar

Brian T Forsythe btforsythe

View GitHub Profile
@btforsythe
btforsythe / run-app-instructions.md
Last active January 12, 2019 19:02
Downloading a repo then running a Java app class with a main method.

First, you must have gradle installed. (Use brew.)

git clone <repository_url>
cd <repository_name>
curl https://raw.githubusercontent.com/WeCanCodeIT/gradle-scripts/master/application-plugin/simple.gradle --output build.gradle
gradle run -Papp=<main_class_name>

<main_class_name> must include the package, if any.

@btforsythe
btforsythe / menus.md
Last active January 12, 2019 19:04
For practicing and understandings Maps
  1. Create a map for the restaurants menu with the menu items and prices for the items as entries. Your menu should include the following entries.
  • Spaghetti: $8.97
  • Lasagna: $10.98
  • Pizza: $15.50
  • Caesar Salad: $7.00
  • Kale Salad: $7.00
  1. Exploring the commonly used map methods:

#Bank Account Project ##Directions You will be designing a console application to manage a client’s bank account. For now, the application will have only one client that is hard-coded into the system.

##Tasks ###Menu Items

  • View Client Information
  • View Account Balance
    • Checking Account Balance
  • Reserve Account Balance

Creating a GitHub repository from an existing Eclipse project (or simply an existing folder)

Create your Java project as usual in Eclipse, do your work, add files, etc. When you are ready to push to GitHub, take the following steps:

  • create a repository with the appropriate name in your GitHub account (do not initialize it with a README)

Then from Git Bash (remember to do git status often -- it will tell you what's going on!):

  • navigate to your project folder (if it is in the default location, the command would be cd default-workspace/<project-name>, where <project-name> is the name of your Eclipse project)
  • initialize your repository with the git init command
  • add your files to staging using git add , where `` is the file or folder you would like to add. Here are some examples:
public class BeerSong {
public static void main(String[] args) {
int numberOfBottles = 100;
singStanza(numberOfBottles);
/**
@btforsythe
btforsythe / Dog.java
Last active January 12, 2019 19:09
Simple code lesson created for newbies
public class Dog {
private String name;
private int age;
public final static String FAMILY = "Canine";
// constructors create objects (instances of classes)
@btforsythe
btforsythe / ArrayIterableFactory.java
Created December 27, 2016 18:55
nested classes example code
package org.wecancodeit.examples.nestedClasses;
import java.util.Arrays;
import java.util.Iterator;
public class ArrayIterableFactory {
public static class StaticNestedIterable implements Iterable<String> {
private String[] elements;
@btforsythe
btforsythe / ReviewApplication.java
Last active November 22, 2018 11:22
Example of populating temporary database with Spring Boot + JPA for WCCI Review Site exercise.
package review;
import java.util.Date;
import javax.annotation.Resource;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
@btforsythe
btforsythe / BuilderMethod
Created April 4, 2015 03:15
Lambdas to invoke builder methods
@FunctionalInterface
interface BuilderMethod<B, V> {
Builder invoke(B builder, V value);
}