Skip to content

Instantly share code, notes, and snippets.

View williamdodson's full-sized avatar
🏠
Working from home

William Dodson williamdodson

🏠
Working from home
View GitHub Profile
@williamdodson
williamdodson / index.php
Created April 10, 2012 18:46
Array examples for Chapter 6
<?php
/**
* Chapter 6 Array Examples
*/
// A one-dimensional indexed array
$arr_1 = array('Value 1', 'Value 2', 'Value 3');
// A one-dimensional associative array
$arr_2 = array(
@williamdodson
williamdodson / index.html
Created August 22, 2012 18:44
A pretty cool technique which allows to position elements side by side. Kind of absolute positioning but with rows which are aware of each other.
<h1>Container-relative floats</h1>
<p><small>Forked from <a href="http://codepen.io/edge0703/pen/KkIcg">this pen</a></small></p>
<p>The value of <code>margin-right: -100%</code> makes sure that every subsequent element starts right at the left edge of the container and isn't aware of its preceding sibling. This way the order of the elements within each row in the HTML code doesn't matter (try to move .item2 to the top or delete it). Furthermore you just need to assign <code>clear: left</code> to start a new row. Kind of absolute positioning but with rows which are aware of each other.</p>
<div class="wrapper">
<!-- first row -->
<div class="item item1">Element<br><br><br></div>
<div class="item item2">Element<br><br></div>
@williamdodson
williamdodson / functions.php
Last active December 12, 2015 01:29
My default functions.php for WordPress projects
<?php
// Get rid of those pesky HEAD links to prevent bots from sniffing for WP vulnerabilities (place in functions.php)
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
function remove_generator() {
return '';
}
add_filter('the_generator', 'remove_generator');
@williamdodson
williamdodson / placeholder.scss
Last active December 18, 2015 12:48
A Sass mixin to easily style placeholder text
// placeholder styling (use: @include placeholder(#e5e5e5);)
@mixin placeholder($color){
&::-webkit-input-placeholder {
color: $color;
}
&:-moz-placeholder { /* Firefox < 18 */
color: $color;
opacity: 1;
}
&::-moz-placeholder { /* Firefox >= 19 */
@williamdodson
williamdodson / wp-custom-query-pagination.php
Created August 2, 2013 17:45
WordPress custom query pagination. Source: http://pastebin.com/jGxXVbbF
<?php
/**
*
* This module demonstrates pagination for a Custom Query in
* WordPress. It should work as a template in the default theme.
* Most of the formatting has been left out to make the core
* coding stand out.
*
* Author: Mac McDonald
* Contact using About->Contact Us at BluegrassMiataClub.com
@williamdodson
williamdodson / _flash.scss
Last active January 4, 2016 17:09
Refactored _flash.scss mixin for Bitters to allow for customizable text darkening amounts on text and links
/* replaces /bitters/mixins/_flash.scss */
@mixin flash(
$color,
$darken-text-amount: 50,
$darken-link-text-amount: 60,
$darken-link-text-hover-amount: 70
) {
background: $color;
color: darken($color, $darken-text-amount);
font-weight: bold;
@williamdodson
williamdodson / git-subtree-merge.sh
Last active January 4, 2016 17:59
Git subtree instead of submodule
# Alternative to Git Submodules using Git Subtree: http://git-scm.com/book/en/Git-Tools-Subtree-Merging
# Remember to replace 'subtree-repo' with the repo name
# --prefix can be whatever you want to call your local copy
$ git remote add -f subtree-repo /path/to/subtree-repo
$ git merge --squash -s ours --no-commit subtree-repo/master
$ git read-tree --prefix=subtree-repo/ -u subtree-repo/master
$ git commit -m "Merge subtree-repo as a subtree."
# Then to update the external subtree repo:
$ git pull -s subtree subtree-repo master
/**
* Vertically center anything via Z63:
* http://zerosixthree.se/vertical-align-anything-with-just-3-lines-of-css/
* //////////////////////////////////////////////////
* Example:
*
* .element p {
* @include vertical-align;
* }
*/
@williamdodson
williamdodson / 8-sass-mixins.md
Last active October 14, 2015 17:32
8 Sass mixins you must have in your toolbox (via Z63: http://zerosixthree.se/8-sass-mixins-you-must-have-in-your-toolbox/)