Skip to content

Instantly share code, notes, and snippets.

View raekul's full-sized avatar
💭
✨Magic ✨

Luke Roberts raekul

💭
✨Magic ✨
View GitHub Profile
@raekul
raekul / gist:65befc66888b7e0f763b
Last active August 29, 2015 14:19
[Shopify] Combine all variant quantities from product json.
(function($) {
// get json data from product
var totalStock = function(json, selector) {
// caching
var $el = typeof(selector) ? $(selector) : 'undefined',
i = 0,
qty = 0,
product_json = json,
variant,
variants,
/*
BigVideo - The jQuery Plugin for Big Background Video (and Images)
by John Polacek (@johnpolacek)
Dual licensed under MIT and GPL.
Dependencies: jQuery, jQuery UI (Slider), Video.js, ImagesLoaded
*/
(function (factory) {
'use strict';
<?php
get_header();
// Used for the subnav bar so it knows what to pull through
$catArgs = ['hide_empty' => 1, 'type' => 'post'];
$categories = get_categories($catArgs);
// used for managing the display of categories
$curCat = get_the_category();
$curCategoryName = single_cat_title("", false);
.billboard {
@include vcenter(-0.25rem, article, div);
height: 15.625rem;
height: 100vh;
position: relative;
width: 100%;
text-align: center;
background-color: $white;
background-size: cover;
background-repeat: no-repeat;
@raekul
raekul / custom-post-taxonomy-permalinks.php
Created April 26, 2016 15:20 — forked from kasparsd/custom-post-taxonomy-permalinks.php
Create permalink structure URLs for custom post types that include all parent terms from a custom taxonomy
<?php
/*
Term Archive Pages:
- http://example.com/recipes/dinner/
- http://example.com/recipes/breakfast,brunch/
Single Recipe Pages:
- http://example.com/recipes/dinner/soup-title/
<?php
// Register Custom Post Type - Hardware
function adaptive_hardware_post_type() {
$labels = array(
'name' => _x( 'Hardware', 'Post Type General Name', 'hardware_post_type' ),
'singular_name' => _x( 'Hardware', 'Post Type Singular Name', 'hardware_post_type' ),
'menu_name' => __( 'Hardware', 'hardware_post_type' ),
'name_admin_bar' => __( 'Hardware', 'hardware_post_type' ),
'archives' => __( 'Hardware Archives', 'hardware_post_type' ),
'parent_item_colon' => __( 'Parent Hardware:', 'hardware_post_type' ),
@raekul
raekul / docker-inspect.sh
Created November 7, 2016 11:48
Inspect ips of a running container by its ID
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name_or_id
// The mixin
@mixin set-ratio($width, $height, $selectors...) {
// needed on the parent so the absolute childs reference it
position: relative;
// create our ratio with the psuedo before
&:before {
display: block;
content: "";
/**
* Fix for uploads specifically in our case (svg) files
* See here - https://wordpress.org/support/topic/wp-4-7-1-kills-svg/
*
* This corrects a bug in WP 4.7.1 which tries to enforce agressive
* mimetype checking which is too verbose.
*/
add_filter('wp_check_filetype_and_ext', function($data, $file, $filename, $mimes) {
$wp_filetype = wp_check_filetype($filename, $mimes);
$ext = $wp_filetype['ext'];
// Dependencies
import React, { Component, PropTypes } from 'react';
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux';
import Waypoint from 'react-waypoint';
import ReactCSSTransitionGroup from 'react-addons-css-transition-group';
// Functional
import * as postActionCreators from '../actions/postsActionCreators';
import { responseImage, responseImageAlt, responseImageTitle } from '../helpers/images/';