This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// based on, fixed warnings http://www.designtoday.info/removing-li-menu-from-wordpress/ | |
class Description_Walker extends Walker_Nav_Menu { | |
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { | |
$classes = empty($item->classes) ? array () : (array) $item->classes; | |
$class_names = join(' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) ); | |
!empty ( $class_names ) and $class_names = ' class="'. esc_attr( $class_names ) . '"'; | |
$output .= ""; | |
$attributes = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// http://stackoverflow.com/questions/22307013/wordpress-get-current-level-of-taxonomy-in-an-archive-page | |
function get_tax_level($id, $tax) { | |
$ancestors = get_ancestors($id, $tax); | |
return count($ancestors) + 1; | |
} | |
$current_term_level = get_tax_level(get_queried_object()->term_id, get_queried_object()->taxonomy); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* dynamically loading all stories with .stories.js extension | |
*/ | |
import { configure } from '@kadira/storybook'; | |
require('es6-promise').polyfill(); | |
import 'babel-polyfill'; | |
const stories = require.context('../app/js/components', true, /.stories.js$/); | |
function loadStories() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function initAnalytics() { | |
(function(i,s,o,g,r,a,m) {i["GoogleAnalyticsObject"]=r;i[r]=i[r]||function() { | |
(i[r].q=i[r].q ||[]).push(arguments);},i[r].l= 1*new Date();a=s.createElement(o), | |
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m); | |
})(window, document, "script", "//www.google-analytics.com/analytics.js", "ga"); | |
ga("create", "UA-XXXXXXXX-X", "auto"); | |
ga("send", "pageview"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* descructive | |
* https://github.com/lodash/lodash/issues/1677 | |
*/ | |
function toggle(collection, item) { | |
var idx = _.indexOf(collection, item); | |
if(idx !== -1) { | |
collection.splice(idx, 1); | |
} else { | |
collection.push(item); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function serializeForm($form) { | |
return $form.serializeArray().reduce( (result, input) => { | |
result[input.name] = input.value; | |
return result; | |
}, {} | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
zoomEl: false, | |
maxSpreadZoom: 1, | |
getDoubleTapZoom: function(isMouseClick, item) { | |
return item.initialZoomLevel; | |
} | |
pinchToClose: false | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const browserSync = require('browser-sync').create(); | |
const port = process.env.PORT || 8080; | |
const customDomain = environment.DEV_DOMAIN ? `${environment.DEV_DOMAIN}` : 'localhost'; | |
browserSync.init('**/*.css', { | |
logPrefix: 'Showroom:', | |
proxy: `localhost:${port}`, | |
open: false, | |
host: customDomain, | |
port: 3000, | |
ghostMode: false, /* don't mirror interactions in other browsers */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** base form */ | |
import React, { Component } from 'react'; | |
export default function(InnerComponent) { | |
class WrapperComponent extends Component { | |
render() { | |
return <InnerComponent {...this.props} /> | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this method is currently broken | |
// better use vinyl-source-stream method | |
// http://fettblog.eu/gulp-browserify-multiple-bundles/ | |
const gulp = require('gulp'); | |
const browserify = require('browserify'); | |
const transform = require('vinyl-transform'); | |
const browserSync = require('browser-sync'); | |
const reload = browserSync.reload; | |
const gutil = require('gulp-util'); |
NewerOlder