Skip to content

Instantly share code, notes, and snippets.

View krabello's full-sized avatar

Kevin Rabello krabello

  • Stetson University
  • DeLand, Florida
View GitHub Profile
'use strict';
var gulp = require('gulp');
var sass = require('gulp-sass');
var browserSync = require('browser-sync').create();
// Static Server + watching scss/html files
gulp.task('serve', ['sass'], function() {
browserSync.init({
@krabello
krabello / head-template.txt
Last active August 29, 2015 14:27
HTML Head Template
<!-- Behavioral Meta Data -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<!-- Core Meta Data -->
<meta name="author" content="">
<meta name="description" content="">
<meta name="keywords" content="">
<!-- Open Graph Meta Data -->
@krabello
krabello / gist:10ba1b2c7a9336a5eb56
Created June 26, 2015 13:19
CSS Media Queries Template
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
@krabello
krabello / gist:389935ea0bac297011e7
Created June 25, 2015 19:44
Javascript Media Query Event Handler
// media query event handler
if (matchMedia) {
var mq = window.matchMedia("(min-width: 500px)");
mq.addListener(WidthChange);
WidthChange(mq);
}
// media query change
function WidthChange(mq) {
@krabello
krabello / gist:d5e4bb713efa44abf21b
Created December 31, 2014 18:55
htaccess rewrite URL
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
#RewriteBase /path/to/app
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
</IfModule>
@krabello
krabello / dynamic_text_color
Created October 3, 2014 20:28
Dynamically change text color based on background color
/*
Usage: color: set-text-color($colorVar);
*/
@function set-text-color($color) {
@if (lightness($color) > 50) {
@return darken($color, 40%); // lighter bg
} @else {
@return lighten($color, 40%); // darker bg
}
}
@krabello
krabello / mysqlDumpAll
Last active August 29, 2015 14:02
Dump all MySQL databases into individual archived files
#! /bin/bash
TIMESTAMP=$(date +"%F")
BACKUP_DIR="/tmp/$TIMESTAMP/mysqldump"
MYSQL_USER="*********"
MYSQL=/usr/bin/mysql
MYSQL_PASSWORD="*********"
MYSQLDUMP=/usr/bin/mysqldump
mkdir -p $BACKUP_DIR
@krabello
krabello / media_queries.css
Created May 13, 2014 16:36
Bootstrap 3 Media Queries
/*==================================================
= Bootstrap 3 Media Queries =
==================================================*/
/*========== Mobile First Method ==========*/
/* Custom, iPhone Retina */
@media only screen and (min-width : 320px) {
@krabello
krabello / dropdown_categories.js
Last active August 29, 2015 14:01
Dropdown categories
function Categories(outputElement, outputID) {
this.outputElement = outputElement;
this.outputID = outputID;
}
Categories.prototype.getOptionLinks = function() {
var catListEl = document.getElementsByClassName(this.outputElement)[0];
var items = catListEl.childNodes[1].children;
var html = '';
for (var i = 0; i < items.length; ++i) {
var link = items[i].childNodes[0].href;