Skip to content

Instantly share code, notes, and snippets.

View micahblu's full-sized avatar

Micah Blu micahblu

View GitHub Profile
@micahblu
micahblu / gist:5727445
Last active December 18, 2015 04:39
A media query template
/* SECTION: MEDIA QUERIES */
/* MQ: Desktop Slim */
@media only screen and (min-width: 768px) and (max-width: 984px) {
}
/* MQ: Tablet Landscape */
@media only screen and (min-width: 600px) and (max-width: 767px) {
@micahblu
micahblu / gist:5786794
Created June 15, 2013 03:43
a wordpress function that allows you to grab a page or custom post type by its slug. Originally from Matheus Eduardo http://wordpress.stackexchange.com/users/3575/matheus-eduardo
function get_page_by_slug($page_slug, $output = OBJECT, $post_type = 'page' ) {
global $wpdb;
$page = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_name = %s AND post_type= %s", $page_slug, $post_type ) );
if ( $page )
return get_page($page, $output);
return null;
}
@micahblu
micahblu / gist:5872893
Last active December 19, 2015 00:59
A simple WordPress method that lets us know if were on a blog page or not
/**
* is_blog
*
* A simple method that lets us know if were on a blog page or not
*
* @return bool
* @since 0.7
*/
function is_blog () {
global $post;
@micahblu
micahblu / gist:5980874
Created July 12, 2013 01:59
git export master as zip
git archive --format zip --output /full/path/to/zipfile.zip master
@micahblu
micahblu / index.html
Created August 10, 2013 01:11
A CodePen by Micah Blu. Fluid Navigation with evenly spaced tabs - ever have a navigation where you want the tabs to be all the same width and span the entire width of the layout? this aims at helping to do just that and is dynamic so as you add or subtract menu items, it will adjust accordingly
<nav>
<ul>
<li><span>Home</span></li>
<li><span>About</span></li>
<li><span>Our Work</span></li>
<li><span>Blog</span></li>
<li><span>Contact</span></li>
</ul>
</nav>
@micahblu
micahblu / gist:6263901
Created August 18, 2013 20:43
Awesome little prototype javascript function to Replace "ALL" occurrences in a string not just the first match by Ben Nadel http://www.bennadel.com/blog/142-Ask-Ben-Javascript-String-Replace-Method.htm
// Replaces all instances of the given substring.
String.prototype.replaceAll = function(strTarget, strSubString)
{
var strText = this;
var intIndexOfMatch = strText.indexOf( strTarget );
// Keep looping while an instance of the target string
// still exists in the string.
while (intIndexOfMatch != -1){
// Relace out the current instance.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
</body>
</html>
{"result":"true","errors":[],"data":[["{\"1\":[{\"0\":\"Hunky\"},{\"1\":\"Male\"}],\"2\":[{\"0\":\"Dory\"},{\"1\":\"727455767\"}]}",null,"{\"1\":[],\"2\":[]}"]],"fields":{}}
@micahblu
micahblu / GistList!.md
Created January 22, 2015 23:33
Try GistList for iOS! http://gistlist.io/

##alt text GistList: TODO for coders alt text

@micahblu
micahblu / gist:59b6b0e37aeb3da56c82
Created February 23, 2015 19:38
collect url params as an array of key/value objects
function getURLParams () {
var params = [];
window.location.search.substring(1).split("&").every(function (pair){
var obj = {};
pair = pair.split("=");
obj[pair[0]] = pair[1];
params.push(obj);
});
return params;
}