This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Password{ | |
public static void main(String args[]){ | |
log(isValidPassword("Cookies123%");//Should print true | |
log(isValidPassword("Cookies");//Should print false | |
log(isValidPassword("Cookies12");//Should print false | |
log(isValidPassword("");//Should print false | |
log(isValidPassword(null);//Should print false | |
log(isValidPassword("c");//Should print false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int one = 1; //int = integer(datatype) one = name of varible | |
int two = 2; // ^^ | |
// = is how you assign a value to a varible | |
// boolean = datatype(true or false) whichIsGreater is the name | |
// one > two = expression that will evaulate to true or false | |
boolean whichIsGreater = (one > two); | |
System.out.println(whichIsGreater); // will print false | |
// I wrapped the expression in parens because that's the order of ops thing (PEMDAS) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int temp = 100; //This value could be read in from a GUI | |
if(temp >= 90){ | |
System.out.println("It's pretty hot it's greater than 90 degrees"); | |
}else if(temp <= 90 && temp >= 75){ | |
System.out.println("It's under 90 but over 75"); | |
}else if(temp <= 75 && temp >= 50){ | |
System.out.println("It's under 75 but over 50"); | |
}else if(temp <= 50 && temp >= 33){ | |
System.out.println("It's under 50 but over 33"); | |
}else{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yell(){ | |
n=$(( $RANDOM % 5 )); | |
case $n in | |
0) | |
echo "WHEATIESSSS BOX" | |
;; | |
1) | |
echo "BISCUITTSSSSSS" | |
;; | |
2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Summary summaryData; | |
AsyncHttpClient client = new AsyncHttpClient(); | |
client.get("http://i.tv/getmesomesuperawesomedata", new AsyncHttpResponseHandler() { | |
@Override | |
public void onSuccess(String response) { | |
Type listType = new TypeToken<Summary>() {}.getType(); | |
summaryData = (Summary) new Gson().fromJson(response, listType); | |
//now summary data will be in memory from a json string | |
//no more traversing json objects to get the data we need this call does all that magic |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.List; | |
public class Test { | |
public static void main(String args[]) { | |
System.out.println(getC(2)); | |
System.out.println(getC(3)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
items = new ArrayList<Item>(); | |
for(String s : lines){ | |
String[] data = s.split("|"); | |
items.add(new Item(Integer.parseInt(data[0]), data[1],data[2], new ArrayList<Item>())); | |
} | |
for(int i =0; i< lines.size(); i++){ | |
String[] temp = lines.get(i).split("|"); | |
List<Integer> ids = new ArrayList<Integer>(); | |
String[] temp2 = temp[3].split(","); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// main.cpp | |
// HashMap | |
// | |
// Created by Jacob Wilson on 2/28/12. | |
// Copyright (c) 2012 Weber State. All rights reserved. | |
// | |
#include <iostream> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// main.cpp | |
// Trees | |
// | |
// Created by Jacob Wilson on 3/27/12. | |
// Copyright (c) 2012 Weber State. All rights reserved. | |
// | |
#include <iostream> | |
#include <string> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stdlib.h> | |
#include <time.h> | |
using namespace std; | |
class ArraySort { | |
public: | |
ArraySort(int size); |