Skip to content

Instantly share code, notes, and snippets.

View zgulde's full-sized avatar

Zach Gulde zgulde

View GitHub Profile
@zgulde
zgulde / ConsoleLogger.php
Created July 28, 2017 03:16
Pretty printer for console messages
<?php
class ConsoleLogger {
private $bold = true;
public function __construct($bold = true) {
$this->bold = $bold;
}
public function info($msg) {
@zgulde
zgulde / pretty-colors.php
Created July 28, 2017 03:11
Pretty printed console output
<?php
/*
* colorize and individual color functions adapted from
* https://kpumuk.info/ruby-on-rails/colorizing-console-ruby-script-output/
* see also http://misc.flogisoft.com/bash/tip_colors_and_formatting
*/
function colorize($text, $code, $bold) {
$preamble = "\033";

Github Pages Personal Site

  1. Create a new site

    # from ~/vagrant-lamp
    ansible-playbook ansible/playbooks/vagrant/site/php.yml
    

name it personal-site.dev

Transfer a file to a remote server (note that you need to have access to the remote server to do this)

scp <your-local-file> <user>@<ip-address>:<destination-directory>

Examples

Copy a file to the server

#!/bin/bash
# This script will replace the ansible parts of the codeup vagrant setup
#
# bash -c "$(curl https://gist.githubusercontent.com/zgulde/2ba2d5ed67fcb58dca35305bc8be8b76/raw/2f451faba1913535c724b586598fafd62254e2cc/php-update.sh)"
set -e
if [[ ! -d ~/vagrant-lamp ]]; then
echo "~/vagrant-lamp directory not found!"
  1. The following code block is syntactically correct, but will not produce the desired output. What can you change to fix this?

    function sayHello() {
      console.log('Hello, ' + name + '!');
    }
    
    sayHello("Zach");

// desired output: "Hello, Zach!"

@zgulde
zgulde / day1.md
Last active February 6, 2017 15:17

Mac 101

  • two finger click == right click
  • finder: file explorer
  • home folder: Where all of your files live
    • Documents, Downloads, Desktop, etc are in here
    • vagrant-lamp directory is in here
    • when you open a terminal you will be here

keyboard shortcuts

Deploying A Spring Boot Application

Changes To Your Application

  1. Allow the application to be packaged as a war

    In the pom.xml, change packaging from jar to war

    Change your class with a main method so that it extends SpringBootServletInitializer, and add the following method:

fallocate -l 1G /swap
mkswap /swap
echo "/swap none swap sw 0 0" >> /etc/fstab
swapon -ae

MySQL General error: 1215 Cannot add foreign key constraint

This will give you more details

echo 'show engine innodb status\G' | mysql -u homestead -p | grep -C10 -i latest

s/homestead/your username/