Skip to content

Instantly share code, notes, and snippets.

View ImDevinC's full-sized avatar
🏡
Building tools!

Devin Collins ImDevinC

🏡
Building tools!
View GitHub Profile
@ImDevinC
ImDevinC / gist:9283418
Created March 1, 2014 01:29
Bad Nested If Statements
if (tempToken != null) {
loginToken = parseToken(tempToken);
if (loginToken != null) {
// This creates our login information
List<NameValuePair> parameters = createParams();
// Here we send the information to the server and login
String postResults = conn.postData("https://mytlc.bestbuy.com/etm/login.jsp", parameters);
// If we logged in properly, then we download the schedule
if (postResults.contains("etmMenu.jsp")) {
// Here is the actual call for the schedule
@ImDevinC
ImDevinC / gist:9283435
Created March 1, 2014 01:30
Better if statements
String tempToken = conn.getData(url + "/etm/login.jsp");
if (tempToken != null) {
loginToken = parseToken(tempToken);
} else {
String error = parseError(tempToken);
if (error != null) {
showError(error);
} else {
showError("Error retrieving your login token, make sure you have a valid network connection");
}
@ImDevinC
ImDevinC / gist:9283524
Last active August 29, 2015 13:56
One string!
'Validate first name
Dim passenger As String
If strFirstName.Length <= 30 Then
passenger = strFirstName + " "
Else : MessageBox.Show("First name must be less than 30 characters")
End If
'Validate middle initial
If strMiddleName Like "[aA-zZ]" Then
Dim PassengerData As String
If strSSN.Length = 11 Then
PassengerData = strSSN + " "
Else
MessageBox.Show("Please enter a valid SSN")
Return
End If
If strFirstName.Length <= 30 Then
@ImDevinC
ImDevinC / Main.java
Created May 1, 2014 20:06
Fragment replace issue
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
if (savedInstanceState == null) {
ssf = new StartStopFragment();
tkf = new TimeKeeperFragment();
rf = new ResetFragment();
lcf = new LapCounterFragment();
if ($success) {
// DO SUCCESS STUFF
} else {
$errorInfo = $dbh->errorInfo();
if ($errorInfo[1] == 1062) {
// DUPLICATE PIN
}
}
@ImDevinC
ImDevinC / GameRenderer.java
Created December 4, 2014 20:21
LibGdx Sprite
public class GameRenderer {
private OrthographicCamera camera;
private SpriteBatch batch;
private SoundSprite sound;
private int score;
public GameRenderer() {
camera = new OrthographicCamera();
camera.setToOrtho(true, 800, 600);
@ImDevinC
ImDevinC / Invoice
Last active August 29, 2015 14:14
Test
public class Invoice {
private String partNumber = "";
private String partDescription = "";
private int quantity = 0;
private double pricePerItem = 0;
public Invoice(String partNumber, String partDescription, int quantity) {
this.partNumber = partNumber;
this.partDescription = partDescription;
this.quantity = quantity;
//File Name: SourceCh3.cpp
//Author: Brandon Cabael
//Assignment : Chapter 3
//Description: Create Rock Paper Scissors Game
//Last Changed: March 3, 2015
//Including string for the P_1 and P_2 variables
#include‬<iostream>
#include<string>
using namespace std;
int main()
Random r = new Random();
int selectedCard = r.nextInt(52) + 1; // 51 is the maximum, 1 is the minimum
String suit = "";
String card = "";
int cardNum = 0;
if (selectedCard <= 13) {
suit = "Hearts";
} else if (selectedcard <= 26) {