Skip to content

Instantly share code, notes, and snippets.

View oneblackcrayon's full-sized avatar

Frederick Polk oneblackcrayon

View GitHub Profile
# ----------------------- #
# Main Configs #
# ----------------------- #
url: http://samueldowens.github.io
title: Traversing the Internets
subtitle: Web Development in NYC
author: Samuel Owens
simple_search: http://google.com/search
description:
@oneblackcrayon
oneblackcrayon / wp-custom-super-loop.php
Created September 25, 2014 20:34
A custom WordPress loop from somewhere on the Internet.
<?php if (have_posts()) : ?>
<?php if (($wp_query->post_count) > 1) : ?>
<?php while (have_posts()) : the_post(); ?>
<!-- Do your post header stuff here for excerpts-->
<?php the_excerpt() ?>
<!-- Do your post footer stuff here for excerpts-->
<?php endwhile; ?>
<?php else : ?>
@oneblackcrayon
oneblackcrayon / cm-styles-multiline-workaround.html
Last active August 29, 2015 14:03
Work-around for updating styles to a template that is imported into Campaign Monitor.
<multiline label="styles-override">
<style type="text/css">
.class {color: red;}
@media screen and (max-width: 479px) {
[class="class"] {color: blue;}
}
</style>
</multiline>
<p>or</p>
@oneblackcrayon
oneblackcrayon / main-html5-text.md
Last active August 29, 2015 14:02
Deciding which is semantically correct

One

    <header>
      <!-- stuff -->
    </header><!-- end /header -->
    <main>
      <header>
        <!-- main header stuff -->
 
@oneblackcrayon
oneblackcrayon / find-replace-grep-regex.md
Created May 7, 2014 19:08
Find content between an HTML tag pair and replace everything outside of them.

In TextWrangler (GREP based):

Find field:

.*?<article>(.*?)</article>.*

Replace field:

\1\n
@oneblackcrayon
oneblackcrayon / jquery.scrollTo.and.highlight.anchor.js
Created April 18, 2014 22:54
When you want to highlight a navigation anchor with scrollTo
$(document).ready(function() {
$('nav.primary a').click(function(event) { // the elements you click to scroll
event.preventDefault();
var link = this; // you need this if you are using hash links on ex: a href="#link" to id="link"
$.smoothScroll({
offset: -160, // adjusts where the scroll will stop so the height of the scrolling element plus the height of the element you are scrolling to.
speed: 2000,
scrollTarget: link.hash
});
});
//NOTE: this uses fancybox 2
// found here: http://scottgale.com/blogsamples/fancybox-pinterest/index.html
// from: http://scottgale.com/blogsamples/fancybox-pinterest/index.html
$(document).ready(function () {
$('.fancybox')
.fancybox({
//set the next and previous effects so that they make sense
//the elastic method is confusing to the user
nextEffect: 'fade',
prevEffect: 'fade',

One Black Crayon logo

One Black Crayon

A very brief presentation on email services for RubyGems and businesses.

ActionMailer

Action Mailer is a framework for designing email service layers. These layers are used to consolidate code for sending out forgotten passwords, welcome wishes on signup, invoices for billing, and any other use case that requires a written notification to either a person or another system.

/**
* Filter out hard-coded width, height attributes on all images in WordPress.
* https://gist.github.com/4557917
*
* This version applies the function as a filter to the_content rather than send_to_editor.
* Changes made by filtering send_to_editor will be lost if you update the image or associated post
* and you will slowly lose your grip on sanity if you don't know to keep an eye out for it.
* the_content applies to the content of a post after it is retrieved from the database and is "theme-safe".
* (i.e., Your changes will not be stored permanently or impact the HTML output in other themes.)
*
@oneblackcrayon
oneblackcrayon / semantic-blog-entry-and-comments-code.html
Last active August 29, 2015 13:57
Semantic blog entry code for coding a blog entry page
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="content-language" content="en">
<link rel="stylesheet" href="assets/style.css">
<title>&nbsp;</title>
</head>
<body class="" role="document" aria-labelledby="document-desc">