Skip to content

Instantly share code, notes, and snippets.

@pibby
pibby / jekyll-bash-new-post
Last active May 16, 2021 23:16
This bash script will setup a new Jekyll blog post in Markdown and open it for editing in Sublime Text 2
#!/bin/bash
# Katie Harron - @pibby
# This bash script will setup a new Jekyll blog post in Markdown and open it for editing in Sublime Text 2
echo "Post Title: "
read title
echo "Post Description: "
read desc
echo "Post Tags: "
read tags
@pibby
pibby / critcss.snippet.js
Last active August 23, 2020 16:22 — forked from james-Ballyhoo/critcss.snippet.js
Critical CSS Finder w/media query support for those of us who write mobile-first CSS; will output to console; configurable viewport height on line 12.
/* Critical CSS Finder w/media query support and output to console
by Katie Harron - https://github.com/pibby - https://pibby.com
forked from james-Ballyhoo (https://gist.github.com/james-Ballyhoo/04761ed2a5778c505527) who forked from PaulKinlan (https://gist.github.com/PaulKinlan/6284142)
I don't know why this isn't keeping my 2 space indents :(
*/
(function() {
function findCriticalCSS(w, d) {
// Pseudo classes formatting
var formatPseudo = /([^\s,\:\(])\:\:?(?!not)[a-zA-Z\-]{1,}(?:\(.*?\))?/g;
@pibby
pibby / JS: Highlight current menu item on fixed nav as user scrolls
Last active May 29, 2018 15:05
JS: Highlight current menu item on fixed nav as user scrolls
// Highlight current page menu item as user scrolls
var lastId,
pageMenu = $(".nav"),
pageMenuHeight = pageMenu.outerHeight() + 126,
// All list items
menuItems = pageMenu.find("a"),
// Anchors corresponding to menu items
scrollItems = menuItems.map(function(){
var item = $($(this).attr("href"));
if (item.length) { return item; }
@pibby
pibby / rem-mixins-margin-padding.less
Last active January 1, 2016 00:19
LESS CSS mixins for margin and padding in rem units with pixel fallback
// This assumes that the font-size on your <html> is 100% (1rem = 16px)
@font-size: 16;
// Margin mixin - enter pixel values in order: margin-top, margin-right, margin-bottom, margin-left
// Usage: .mar(10, 30, 15, 20);
.mar(@mt: 0; @mr: 0; @mb: 0; @ml: 0;) {
@mtv: @mt / @font-size;
@mrv: @mr / @font-size;
@mbv: @mb / @font-size;
@mlv: @ml / @font-size;
@pibby
pibby / new-project.sh
Created December 5, 2013 00:08
This bash script will ask for a Project Name and Directory name to create in Sites folder, clone my boilerplate repo, create a README with the project name and date this script was run, and open the directory in Sublime Text 2 (save as a project once opened)
#!/bin/bash
# Katie Harron - @pibby
# This bash script will ask for a Project Name and Directory name to create in Sites folder, clone my boilerplate repo, create a README with the project name and date this script was run, and open the directory in Sublime Text 2 (save as a project once opened)
echo "Project name: "
read name
echo "Project directory in ~/Sites: "
read directory
created=`date +%Y-%m-%d` # create date as Year-Month-Date
@pibby
pibby / Preferences.sublime-settings
Created October 11, 2013 23:50
My Sublime Text User Preferences
{
"auto_complete": true,
"auto_complete_commit_on_tab": true,
"auto_indent": true,
"auto_match_enabled": true,
"bold_folder_labels": true,
"caret_style": "smooth",
"color_scheme": "Packages/User/Flatland Dark.tmTheme",
"detect_indentation": true,
"draw_minimap_border": true,
@pibby
pibby / JS: Convert navigation to select dropdown on mobile
Created September 20, 2013 18:37
JS: Convert navigation to select dropdown on mobile
// Convert page navigation to dropdown menu on smaller screens
$(function() {
$("<select />").appendTo("#navigation .wrapper");
$("<option />",
{
"selected": "selected",
"value" : "",
"text" : "Page Menu" // default <option> to display in dropdown
@pibby
pibby / JS: Smooth Scroll Hashed Links
Last active December 23, 2015 13:19
JS: Smooth scroll from links with hashed href with fixed header
@pibby
pibby / gulpfile.js
Created July 5, 2015 02:29
Livereload via Gulp and Jekyll build
var gulp = require('gulp');
var cp = require('child_process');
var shell = require('gulp-shell');
var express = require('express');
var livereload = require('gulp-livereload');
gulp.task('default', ['watch']);
// Run static file server
gulp.task('serve', function () {
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master