Skip to content

Instantly share code, notes, and snippets.

View elseloop's full-sized avatar

Dan Manchester elseloop

View GitHub Profile
@elseloop
elseloop / shortcode-hunter.php
Created March 7, 2018 22:01
WordPress function to print all instances of a passed shortcode, using built-in WP search
function turn_find_shortcode($atts, $content=null) {
ob_start();
extract( shortcode_atts( array(
'find' => '',
), $atts ) );
$string = $atts['find'];
$args = array(
's' => $string,
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
<snippet>
<content><![CDATA[
import React, { PropTypes } from 'react';
import styles from './${1}.css';
export const ${1} = (props) => {
const {
tagName:Tag,
className,
@elseloop
elseloop / SassMeister-input-HTML.html
Created February 27, 2015 20:29
Generated by SassMeister.com.
<div class="thing"></div>
<div class="other-thing"></div>
<div class="thing-three"></div>
@elseloop
elseloop / ghost
Last active August 29, 2015 14:03
Ghost Element mixin
// @include on parent element
// $child should be a selector passed as a string, ie: ".child"
// example usage: http://codepen.io/elseloop/pen/Kkhmo/
@mixin ghost( $child, $child-width ) {
&:before {
content: '';
display: inline-block;
vertical-align: middle;
height: 100%;
@elseloop
elseloop / retina-sprite-mixin.scss
Created May 2, 2014 18:01
Retina-ready sprite maps with Compass. Adapted from this comment https://gist.github.com/thulstrup/2140082#comment-378557.
/*
Example usage in _example.scss:
// set up sprite maps for mixin
$sprites: sprite-map("icons/*.png");
$sprites2x: sprite-map("icons-2x/*.png");
// load up icon list for looping...
$icon-names: ( aws, byod, cloud, intel, key, lock, organize, serve, store, wan );
@elseloop
elseloop / gist:9fd515da010a57bee113
Last active August 29, 2015 14:00
Example added WYSIWYG styles in WP
/**
* Add Styles dropdown to visual editor
*/
function themename_mce_styles_drop( $buttons ) {
array_unshift( $buttons, 'styleselect' );
return $buttons;
}
add_filter( 'mce_buttons_2', 'themename_mce_styles_drop' );
@elseloop
elseloop / unstyled-nav.extend.scss
Created February 18, 2014 18:49
Unstyled List silent class example
%unstyled {
list-style: none;
margin-left: 0;
padding-left: 0;
}
@elseloop
elseloop / horiz-nav.extends.scss
Last active August 29, 2015 13:56
Horizontal navigation silent class example
%nav-horiz {
@extend %unstyled;
@extend %cf;
li,
a {
display:inline-block;
*display:inline;
zoom:1;
}
// Make elements align in a grid, regardless of height
// Apply to elements you want as grid items
// $cols = how many columns you want
// $margin-right = margin-right, should be in percent
// $ie8-height = an explicit height for all the elements, "off" by default, only applied to IE
@mixin gridify($cols, $margin-right: 5%, $ie8-height: auto) {
// Math for widths, margins, and clears
$width: (100% / $cols) - $margin-right + ($margin-right / $cols);
$ie-width: (100% / $cols) - $margin-right;
$clearnum: $cols + 1;