Skip to content

Instantly share code, notes, and snippets.

@jeffreysbrother
jeffreysbrother / header.html
Created Oct 3, 2015
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 Oct 5, 2015
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 Oct 11, 2015
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 Oct 13, 2015
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 Oct 14, 2015
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 Feb 10, 2016
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
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 Mar 2, 2016
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 Mar 19, 2016
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: {