Skip to content

Instantly share code, notes, and snippets.

View zgulde's full-sized avatar

Zach Gulde zgulde

View GitHub Profile

Updating cods from 1.0 to 1.2

  1. brew upgrade cods

    This updates the cods command to the newest version.

  2. cods update

    This updates your myserver (or whatever you named it) command to the newer version.

@zgulde
zgulde / validation.md
Last active April 10, 2018 16:24
a strategy for user input validation in a servlet/jsp application

In the servlet

usersDao = DaoFactory.getUsersDao();
// Create a user based on the submitted information
User newUser = new User(
    request.getParameter("username"),
    request.getParameter("email"),
    request.getParameter("password")
);
@zgulde
zgulde / StackTraceExample.java
Created April 3, 2018 20:58
Example of Java Stack Traces
public class StackTraceExample {
private static void a() throws Exception {
b();
}
private static void b() throws Exception {
c();
}
private static void c() throws Exception {

Bonus DB Setup

  1. Download the sql file

    wget http://downloads.mysql.com/docs/world.sql.gz
    
  2. Uncompress the file

Extra function drills

For each of the problems below, write your function and console.log to check your work. While it is good to console.log to help debug, console.logs should not be in the completed function, unless otherwise explicitly stated.

  • Write a function named identity that defines one parameter and returns the argument it was called with.

  • Write a function named isOdd that accepts a number and returns true if the

public class PrettyPrinter {
private static boolean bold = true;
public static void main(String[] args) {
System.out.println("Bold");
PrettyPrinter.red("red");
PrettyPrinter.green("green");
PrettyPrinter.yellow("yellow");
PrettyPrinter.blue("blue");
PrettyPrinter.purple("purple");

Deployment Post Script

  • [Enable Https for your site and setup the certificates to automatically be renewed][1]
  • Wrt troubleshooting deployment issues Steps:
    1. Does it work locally? Try running/packaging/debugging your app locally (i.e. on your mac) first before worrying about issues in production.
  1. Have you pushed? Inspect the output when you push, are there any errors?
@zgulde
zgulde / order-pizza-bs4.html
Last active January 18, 2018 15:26
Codeup Pizza Ordering form exercise with Bootstrap v4
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>Order Online</title>
<!-- Styles -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css" integrity="sha384-Zug+QiDoJOrZ5t4lssLdxGhVrurbmBWopoEl+M6BdEfwnCJZtKxi1KgxUyJq13dy" crossorigin="anonymous" />
curl -Ss https://gist.githubusercontent.com/zgulde/e38f818c5222293e94fa78d8540330ae/raw/514eb6ae088c0b7467186bf2141684623528d868/print-tomcat-version.sh | bash
# sudo apt-get install -y imagemagick pngquant
for jpg in $(ls *.JPG) ; do
png=${jpg/%.JPG/.png}
echo "converting and compressing '$jpg' to '$png'..."
convert $jpg -strip -resize 15% $png
echo "optimizing '$png'..."
pngquant --output $png --force --quality 0-25 $png
done