Skip to content

Instantly share code, notes, and snippets.

@jeffreysbrother
jeffreysbrother / header.html
Created October 3, 2015 00:49
Bootstrap navigation example
View header.html
<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>
@jeffreysbrother
jeffreysbrother / Gruntfile.js
Created October 5, 2015 02:16
Gruntfile.js boilerplate
View Gruntfile.js
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 / scroll.js
Last active October 11, 2015 23:50
Smoothly scroll to an element with jQuery
View scroll.js
$('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 / snippets.json
Last active October 13, 2015 23:59
a list of useful (uncustomized) snippets for emmet
View snippets.json
//this is not a JSON file. these are emmet snippets controlled by the snippets.json file
link:css
meta:vp
btn:s
@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…
View contact.php
<?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"]);
View clearfix.css
/*
add the clearfix class to the parent element.
In my case, the border of a div was collapsing into a child button. This was caused by adding the "float": "left" rule to the button
(this occurs even when "clear": "right" is not added)
*/
.clearfix:after {
content: "";
display: table;
@jeffreysbrother
jeffreysbrother / .vimrc
Created February 10, 2016 23:19
this is my functioning .vimrc file (before updating it according to the ctrlpvim suggestions)
View .vimrc
set runtimepath+=~/.vim_runtime
source ~/.vim_runtime/vimrcs/basic.vim
source ~/.vim_runtime/vimrcs/filetypes.vim
source ~/.vim_runtime/vimrcs/plugins_config.vim
source ~/.vim_runtime/vimrcs/extended.vim
try
source ~/.vim_runtime/my_configs.vim
catch
@jeffreysbrother
jeffreysbrother / styles.less
Last active February 17, 2016 00:53
Atom stylesheet
View styles.less
/*
* Your Stylesheet
*
* This stylesheet is loaded when Atom starts up and is reloaded automatically
* when it is changed and saved.
*
* Add your own CSS or Less to fully customize Atom.
* If you are unfamiliar with Less, you can read more about it here:
* http://lesscss.org
*/
@jeffreysbrother
jeffreysbrother / Gruntfile.js
Created March 2, 2016 23:15
Automatically inline all the CSS in an HTML email (using the grunt-inline-css plugin by jgallen23)
View Gruntfile.js
module.exports = function(grunt) {
grunt.initConfig({
inlinecss: {
main: {
options: {
removeStyleTags: false,
preserveImportant: true,
preserveMediaQueries: true,
webResources: {
@jeffreysbrother
jeffreysbrother / Gruntfile.js
Created March 19, 2016 06:53
grunt-contrib-imagemin with additional plugin
View Gruntfile.js
module.exports = function(grunt) {
//additional plugin installed:
var mozjpeg = require('imagemin-mozjpeg');
//project configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
imagemin: {