Skip to content

Instantly share code, notes, and snippets.

View dougshults's full-sized avatar

Doug Shults dougshults

  • DSCO
  • Boston, MA
View GitHub Profile
@dougshults
dougshults / gist:8e945ff4a5f80a8cba4f70b85526cde4
Last active May 2, 2017 17:42
Loop outputs the property names and values of an object:
var property;
for ( property in object ) {
console.log ( "Name: " + property );
console.log ( "Value: " + object [ property ]);
}
// Reset each select option to default when a new option is selected
$('select.filter').on('change', function(){
($('select.filter').not(this).prop('selectedIndex',0));
});
// Console log message when the isotope library is ready for use
// Create our ".grid" variable to attach isotope
if($().isotope) {
console.log("isotope is loaded and ready");
@dougshults
dougshults / scripts.js
Last active December 1, 2016 18:56
Contextual Loop for Converting Menus into Select Options - not full code
$('ul.pipeline li').each(function(i, obj) {
var listText = ($(this).text());
var trimmedListText = littleBits.trim();
($(this).parent().append("<option value=\"" + trimmedListText +"\">" + listText + "</option>"));
});
@dougshults
dougshults / router.js
Created November 15, 2016 19:33
Ember.js refactor Router.map to remove depricated router.resource
// Old route using route.resource with nested Edit and Delete views
Router.map(function() {
this.resource('events', function() {
this.route('new');
this.route('edit', {path: '/edit/:event_id'});
});
});
// Refactored route
// Mobile Menu New
function toggleMenu(elem, menu, inactive, icon){
$(elem).click(function(){
$(menu).slideToggle('400');
$(elem).toggleClass('active');
if($(inactive).css('display') == 'block'){
$(inactive).slideToggle();
$(icon).toggleClass('active');
}
})
@dougshults
dougshults / gist:191852a2386f297539ef
Last active August 29, 2015 14:16
Mobile Toggle Search Field for Northland
// Search
function toggleSearch(elem, search){
$(elem).click(function(){
$(search).toggleClass('show');
})
};
toggleSearch('.search-icon', '#searchform');
jQuery(document).ready(function(){
jQuery('input[type="text"]').addClass('textfield');
jQuery('input[type="submit"]').addClass('fancy_button');
jQuery('textarea').addClass('textarea');
});