Skip to content

Instantly share code, notes, and snippets.

View scott-riley's full-sized avatar
🎯
Focusing

Scott Riley scott-riley

🎯
Focusing
View GitHub Profile
import React, { Component, PropTypes } from 'react';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import s from './ProgressBar.scss';
class ProgressBar extends Component {
render() {
const {completed} = this.props;
var items = "",
data = ["your json data"]
$.each(json, function(i, item){
items += data[i] ; // simplest example
});
// this is fine because a .each is synchronous and doesn't need a callback
$('[data-json-container]').append(items);
$list = $('.collections__list');
$item = $list.find('.list__item--is-selected');
$prev = $item.prev();
$prepended = false;
if ($(window).width() < 700 && $item.index() != 0 && !prepended) {
$list.prependTo('.collections__list');
prepended = true;
}
else if ($(window).width() > 700 && prepended) {
function clean_custom_footer_menus() {
$menu_name = 'footer-links'; // specify custom menu slug
if (($locations = get_nav_menu_locations()) && isset($locations[$menu_name])) {
$menu = wp_get_nav_menu_object($locations[$menu_name]);
$menu_items = wp_get_nav_menu_items($menu->term_id);
$menu_list = '';
foreach ((array) $menu_items as $key => $menu_item) {
$title = $menu_item->title;
$url = $menu_item->url;
@scott-riley
scott-riley / gist:9599668
Last active August 29, 2015 13:57
Changing placeholder via media query
// Nice way, using matchMedia, no IE9 or below support
var media = "screen and (min-width: 720px)",
placeholderShort = "Short holder",
placeholderLong = "My quite long placeholder";
$(window).resize(function(){
if(window.matchMedia(media).matches) {
$('.element').attr('placeholder', placeholderLong);
}
else {
$('.element').attr('placeholder', placeholderShort);