Skip to content

Instantly share code, notes, and snippets.

@jeffreysbrother
jeffreysbrother / contact.php
Last active October 14, 2015 04:16
Contact page with validation. This page also assumes the use of PHPMailer, a config file, and header/footer includes. In order to use, we must update the $address variable as well as other values in that section. This implementation also assumes that the site will have clean URLs with subfolders. Also, it should be obvious that many of the class…
<?php
require_once("../inc/config.php");
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = trim($_POST["name"]);
$email = trim($_POST["email"]);
$phone = trim($_POST["phone"]);
$message = trim($_POST["message"]);
@jeffreysbrother
jeffreysbrother / snippets.json
Last active October 13, 2015 23:59
a list of useful (uncustomized) snippets for emmet
//this is not a JSON file. these are emmet snippets controlled by the snippets.json file
link:css
meta:vp
btn:s
@jeffreysbrother
jeffreysbrother / scroll.js
Last active October 11, 2015 23:50
Smoothly scroll to an element with jQuery
$('html, body').animate({
scrollTop: $("#target-element").offset().top
}, 1000);
/*
Experience has shown that this function might not operate as expected if we try to scroll to the top of
some multiple elements with the same class.
For this reason, it seems best to use the id (#) selector and not the class (.) selector.
*/
@jeffreysbrother
jeffreysbrother / Gruntfile.js
Created October 5, 2015 02:16
Gruntfile.js boilerplate
module.exports = function(grunt) {
//project configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build: {
@jeffreysbrother
jeffreysbrother / header.html
Created October 3, 2015 00:49
Bootstrap navigation example
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>