Instantly share code, notes, and snippets.

View readme.txt
ferrari california,2019,1000000,FALSE
toyota sienna,2019,50000,FALSE
View git_github.md

Git is referred to as a distributed version control and source code management (SCM) program. What this means is that it is a fancy way to store and share your programs with other people.

First, let's think what the problems are with regular backups? Suppose we are doing a group project. How would you share code among your teammates? You could email each other the code but it would get tedious very quickly. Also, what happens when you make some changes that turn out to be wrong and you have to go back to a previous working version? These issues can be resolved with a SCM program such as Git. Git is one of the more popular SCM's.

GitHub is a popular website that host projects using Git and it also provides other services such as project management (issues), web hosting, etc.

Okay, so where do we begin? Let's first create an account in GitHub.


View ArrayTooBig.java
public class ArrayTooBig
{
public static void main(String[] args)
{
String [] strs = new String[Integer.MAX_VALUE];
}
}
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View Core.java
public class Core {
public static void main(String[] args) {
int coreNum = Runtime.getRuntime().availableProcessors();
System.out.println("Number of cores are: " + coreNum);
long maxMemory = Runtime.getRuntime().maxMemory();
System.out.println("MAX size of the heap (MB): " + maxMemory / 1048576);
long freeMemory = Runtime.getRuntime().freeMemory();
View gist:5002643
Mr Robert Aaron
Part-time Librarian
faculty-and-staff/robert-aaron
Ms Zaynab Abdul-Razacq
Library Assistant I
faculty-and-staff/zaynab-abdul-razacq
Dr Donna Abrams
Assistant Professor
View LinkedIntList.java
public class LinkedIntList {
private ListNode front;
public LinkedIntList() {
front = null;
}
public int size() {
int count = 0;
View LinkedListFail.java
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
public class LinkedListFail {
/*
* This is slow
*/
public static ArrayList<Integer> removeEvensInArrayList(ArrayList<Integer> list) {
View ChatClient.java
import java.io.IOException;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Scanner;
public class ChatClient implements Runnable {
// why is the ChatClient Multi-threaded?
View BankAccount.java
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
A bank account has a balance that can be changed by
deposits and withdrawals.
*/
public class BankAccount
{