Skip to content

Instantly share code, notes, and snippets.

View claraj's full-sized avatar

Clara claraj

  • Minneapolis College
  • Minneapolis, MN
View GitHub Profile
System.out.println("Dates with SimpleDateFormat\n");
SimpleDateFormat format = new SimpleDateFormat("MM/dd/yy hh:mm:ss"); // Use whatever pattern you like.
//Examples and reference here https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html
Date exampleDate = new Date(); // test date
String dateStr = format.format(exampleDate); // use format to turn it into a String
System.out.println(dateStr); // e.g. 10/14/17 10:12:43
try {
@claraj
claraj / canvasdownloader.html
Created October 5, 2017 22:48
download canvas as image
<canvas id=canvas height=150 width=150></canvas>
<a id='download' onClick='downloadImg()'>download!</a>
<script>
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
ctx.fillStyle = "#123456";
ctx.fillRect(0,0,150, 300);
ctx.fillStyle = "#006600";

Git Lab DRAFT FINISH ME

Pre-requisites

Install git on your computer.

Windows Users install from https://git-scm.com/

Mac Users should have it already. Verify install by opening a terminal and typing git --version and verify a version number is shown. If error, install from link above

package week_6.q1_course;
import org.junit.Test;
import test_utils.ArrayListUtils;
import test_utils.MethodUtil;
import test_utils.PrintUtils;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
package week_5;
/**
*
*
Write a program that creates a sales report for a coffee shop.
The coffee shop will use this at the end of every day to calculate sales, expenses, and profit.
The coffee shop sells 12 different drinks. The name of each drink, the price the shop
charges the customer, and how much it costs to make each drink, are saved in the file
// TODO make books for this hand. Remove cards from the hand, and add one entry to the books list.
// example: hand has 4 "6" values in, so a book of 6s. Remove all "6" from hand, and add one "6" to books.
// example: hand starts as ["6","6","6","2","6","7"], books starts as ["4", "Q"]
// After transfer, hand = ["2","7"] and books = ["4","Q","6"]
// TODO comment your code!!!
ArrayList<String> cardsToRemove = new ArrayList<>();
for (String cardType : hand) {
@claraj
claraj / Question_5_Add_Exception_HandlingTest
Last active September 27, 2017 18:33
Q5 Test Corrections
package week_5;
import com.google.common.base.Joiner;
import org.junit.Test;
import test_utils.PrintUtils;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.NoSuchElementException;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Your Turn</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<style>
.visited {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Your Turn</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
package week_4;
import input.InputUtils;
import junit.framework.TestCase;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import java.util.ArrayList;