Skip to content

Instantly share code, notes, and snippets.

View ericyork's full-sized avatar

Eric J York ericyork

  • Iowa State University of Science and Technology
  • Ames, IA
View GitHub Profile
<!--Build the HTML -->
<form action="index.php" method="post">
<input type="text" name="dbname">
<input type="submit" value="Submit">
</form>
<!--Use JS to prevent form resubmission on refresh/back button -->
<script>
if ( window.history.replaceState ) {
window.history.replaceState( null, null, window.location.href );
}
@ericyork
ericyork / Vagrantfile
Last active September 19, 2018 12:08
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# uses scotch/box from https://app.vagrantup.com/scotch/boxes/box
config.vm.box = "scotch/box"
# port-forwarding to my local only
config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
@ericyork
ericyork / starter.html
Created September 26, 2018 12:03
The starter template for Bootstrap 4
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavDropdown">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<form>
<div class="form-row">
<div class="form-group col-md-6">
<label for="inputEmail4">Email</label>
<input type="email" class="form-control" id="inputEmail4" placeholder="Email">
</div>
<div class="form-group col-md-6">
<label for="inputPassword4">Password</label>
<input type="password" class="form-control" id="inputPassword4" placeholder="Password">
</div>
/*
Theme Name: Your New Child Theme Name
Description: A child of parent theme
Author: Your Name
Author URI: http://your.website.web/
Template: parent-theme-name
Version: n.n.n
*/
add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
function enqueue_parent_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
}
function my_load_fa() {
wp_enqueue_style( 'my-fa', 'https://use.fontawesome.com/releases/v5.4.1/css/all.css' );
}
add_action( 'wp_enqueue_scripts', 'my_load_fa' );
function my_add_google_fonts() {
wp_enqueue_style( 'my-google-fonts',
// Replace the link below with the one you get from google:
'http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,400,700,300', false );
}
add_action( 'wp_enqueue_scripts', 'my_add_google_fonts' );
// Registers new home page widget
add_action( 'widgets_init', 'my_widgets_init' );
function my_widgets_init() {
register_sidebar( array(
'name' => 'My Homepage Widget',
'id' => 'my-homepage-widget',
'before_widget' => '<div class="homepage-widget">',
'after_widget' => '</div>',
'before_title' => '<h3>',