Skip to content

Instantly share code, notes, and snippets.

View justinallen's full-sized avatar
🔍
Looking for it

Justin Allen justinallen

🔍
Looking for it
View GitHub Profile
@justinallen
justinallen / floating-to-fixed-el.js
Last active December 20, 2015 05:09
Floating-to-Fixed Placement Element
var topOffsetOfElement = $('#element').offset().top;
$(window).scroll(function (event) {
// get the y position of the scroll
var y = $(this).scrollTop();
// is that below the element
if (y >= top) {
// add fixed
$('#element').addClass('fixed');
@justinallen
justinallen / media-queries-common-devices.css
Last active December 20, 2015 06:49
Media Queries for Common Devices
/* Thx to csstricks.com */
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@justinallen
justinallen / html-basic-file-1.html
Last active December 20, 2015 07:29
HTML: Basic Starter Page #1
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>My Page</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
@justinallen
justinallen / .gitignore
Last active December 20, 2015 21:08
WordPress Gitignore Starter
.htaccess
wp-config.php
wp-content/uploads/
wp-content/blogs.dir/
wp-content/upgrade/
wp-content/backup-db/
wp-content/advanced-cache.php
wp-content/wp-cache-config.php
sitemap.xml
*.log
@justinallen
justinallen / just-bootstrap-media-queries.css
Last active October 16, 2017 12:45
Bootstrap's Media Queries
/* Bootstrap's Media Queries */
/* Large desktop */
@media (min-width: 1200px) { ... }
/* Portrait tablet to landscape and desktop */
@media (min-width: 768px) and (max-width: 979px) { ... }
/* Landscape phone to portrait tablet */
@media (max-width: 767px) { ... }
@justinallen
justinallen / jekyll-basic-pagination-for-posts.html
Last active August 29, 2015 14:15
jekyll - basic pagination for posts
<div class="pagination">
{% if page.previous %}
<a class="pagination-item older" href="{{page.previous.url}}">Older</a>
{% else %}
<span class="pagination-item older">Older</span>
{% endif %}
{% if page.next %}
<a class="pagination-item newer" href="{{page.next.url}}">Newer</a>
{% else %}
<span class="pagination-item newer">Newer</span>
@justinallen
justinallen / jekyll-reading-time-template.html
Last active August 29, 2015 14:19
Jekyll Reading Time Estimator - Template Snippet
<!-- drop this into your post.html or other page template -->
<div id="reading-time"></div>
<span id="wordcount" style="display:none">{{ content | number_of_words }}</span>
@justinallen
justinallen / jekyll-reading-time.js
Created April 18, 2015 15:55
Jekyll Reading Time Estimator - JavaScript
// reading time
$('#reading-time').html(function(){
var wordcount = $('#wordcount').text();
timetoread = Math.round(wordcount / 200);
readmessage = timetoread + " min read";
return readmessage;
});
@justinallen
justinallen / back-to-top.js
Last active September 30, 2015 18:33
back to top button
$("#back_to_top").click(function(e){
e.preventDefault();
$('html, body').animate({scrollTop:0}, 'slow');
});
@justinallen
justinallen / labels-to-placeholders.js
Created September 30, 2015 18:38
fancies up a form
// takes a parent el (like a li) and goes to work on its children
// assumes the parent has one label and one input
function labelsToPlaceholders(parent) {
$(parent).each( function(index){
$(this).children('label').css('display', 'none');
labelText = $(this).children('label').text();
labelText = labelText.slice(0,-1);
// console.log(labelText);
$(this).children('input').attr('placeholder', labelText);