Archive for the “Web Shots” Category

Common IE Bugs

Posted on June 23rd, 2014 by webninjataylor

Use _.each(myArray,function) in place of .forEach() myRegex.test(myString) in place of .indexOf() var filter = /0{3}/; if(filter.test(orgInfo.get(‘payeeIdentifier’)) !== false){ … } Use envt.target in place of evnt.currentTarget IE doesn’t understand .trim() method, so add this… /******** FIX FOR IE TO USE TRIM() METHOD ********/ if(typeof String.prototype.trim !== ‘function’){ String.prototype.trim = function(){ return this.replace(/^\s+|\s+$/g, ”); } } IE’s […]

Terminal Shortcuts

Posted on June 23rd, 2014 by webninjataylor

ctrl + u erases entire line ctrl + c quits a binary execution and gets you back to the prompt

Override WordPress Tag Cloud Defaults

Posted on June 18th, 2014 by webninjataylor

Add this to functions.php… function my_widget_tag_cloud_args( $args ) { // Your extra arguments go here $args[‘number’] = 999; return $args; } add_filter( ‘widget_tag_cloud_args’, ‘my_widget_tag_cloud_args’ ); Resources Tag Cloud Defaults

Tags:
Posted in Web ShotsComments Off on Override WordPress Tag Cloud Defaults

Number of WordPress Search Results

Posted on June 18th, 2014 by webninjataylor

Control the number of search or post tag results in WordPress by adding the following just before “<?php if (have_posts()) : ?>” in search.php and/or archive.php… <?php query_posts($query_string . ‘&showposts=25’); ?> Resources WordPress Codex: Tag Templates

Tags:
Posted in Web ShotsComments Off on Number of WordPress Search Results

Smooth, Elastic Scrolling on Mobile

Posted on June 13th, 2014 by webninjataylor

Add this for smooth, elastic scrolling on mobile… #s4-workspace { -webkit-overflow-scrolling: touch; }

Tags: ,
Posted in Web ShotsComments Off on Smooth, Elastic Scrolling on Mobile

Custom Links in WordPress Admin Bar

Posted on June 11th, 2014 by webninjataylor

Add to the theme’s functions.php file… function admin_bar_custom_links(){ global $wp_admin_bar; if(!is_super_admin() || !is_admin_bar_showing()){ return; } $wp_admin_bar->add_menu(array( ‘id’ => ‘all_posts’, ‘title’ => __(‘All Posts’), ‘href’ => __(‘http://webninjataylor.com/library/wp-admin/edit.php’), )); // Add sub menu link $wp_admin_bar->add_menu( array( ‘parent’ => ‘all_posts’, ‘id’ => ‘all_pages’, ‘title’ => __( ‘All Pages’), ‘href’ => __(‘http://webninjataylor.com/library/wp-admin/edit.php?post_type=page’), )); } add_action(‘admin_bar_menu’,’admin_bar_custom_links’,25); Change parent, id, title, […]

Tags:
Posted in Web ShotsComments Off on Custom Links in WordPress Admin Bar

JavaScript Partials

Posted on June 11th, 2014 by webninjataylor

Gratuitously copied from John Resig’s blog… Partially applying a function is a technique in which you can pre-fill-in arguments to a function before it is ever executed. In effect, partially applying a function returns a new function which you can call… String.prototype.csv = String.prototype.split.partial(/,\s*/); var results = “John, Resig, Boston”.csv(); alert( (results[1] == “Resig”) + […]

JavaScript Functions are First-class Objects

Posted on June 10th, 2014 by webninjataylor

This means that javascript functions are just a special type of object that can do all the things that regular objects can do.  Just like any other variable… A function is an instance of the Object type A function can have properties and has a link back to its constructor method You can store the […]

Tags:
Posted in Web ShotsComments Off on JavaScript Functions are First-class Objects

JavaScript Prototypes and Inheritance

Posted on June 10th, 2014 by webninjataylor

Objects have a built-in attribute called prototype who’s value is a pointer to another object, and can be declared when creating a new object with Object.create(myPrototypeReference). If an object is created using the convenience of an object literal var newObject = {property: ‘value‘} then the prototype is defaulted to Object.prototype. Overview Objects are pairs of keys and […]

Tags:
Posted in Web ShotsComments Off on JavaScript Prototypes and Inheritance

Event Binding Woes

Posted on June 9th, 2014 by webninjataylor

In addition to viewing current events bound to an object with … $._data( $(‘SELECTOR’)[0], ‘events’ ); …in the console.  I’ve discovered it is sometimes necessary to bind the event to a parent which already exists on the page as some scenarios don’t have all objects ready when the .ready() method is fired (*ahem* SharePoint, I’m […]

Adaptive vs. Responsive

Posted on June 3rd, 2014 by webninjataylor

Web developers have their panties all up in a twist over this issue.  Here is the boiled-down comparison… Responsive: The distilled definition of a responsive web design is that it will fluidly change and respond to fit any screen or device size. Coined several years ago by Ethan Marcotte and first introduced in his A List Apart article, […]

$PATH in Terminal

Posted on June 3rd, 2014 by webninjataylor

$PATH is a variable used by Terminal for scanning through a colon-delineated list of paths to binaries.  For example, when typing ls, sudo, npm, etc., Terminal searches through the paths for a match to the alias; when it finds a match it executes that binary. Resources The PATH Variable

PhoneGap in 60 Seconds

Posted on June 2nd, 2014 by webninjataylor

Install Node.js Open Terminal and install PhoneGap followed by Cordova… $ sudo npm install -g phonegap $ sudo npm install -g cordova Install SDK’s for targeted environments Create a New Project In Terminal, navigate to where you want to create the new project directory, and then run Cordova’s create command, passing in 1) The directory name […]

Xamarin 3 Overview

Posted on May 30th, 2014 by webninjataylor

Two products Xamarin Platform – NATIVE apps for iOS, Android, Mac, and Windows Native = Native user interfaces + Native API access + Native performance (can’t get with JavaScript) Facebook’s first app was NOT native, making it slow and choppy; Mark Z. labeled it a failure and they rebuilt it as native Xamarin Test Cloud […]

Designing for iOS and Android

Posted on May 30th, 2014 by webninjataylor

iOS Notes From Apple’s iOS Human Interface Guidelines)… Defer to content Take advantage of the whole screen Reconsider visual indicators of physicality and realism Let translucent UI elements hint at the content behind them Provide clarity Use plenty of negative space Let color simplify the UI Ensure legibility by using the system fonts Embrace borderless buttons […]

Tags:
Posted in Web ShotsComments Off on Designing for iOS and Android

508: Hidden Supporting Text

Posted on November 13th, 2013 by webninjataylor

The standard is to use this CSS… .hidden { height: 1px; left: -10000px; overflow: hidden; position: absolute; top: auto; width: 1px; }

Sort Lists with JavaScript

Posted on September 18th, 2013 by webninjataylor

This solution requires jQuery and Underscore. var wnt = {}; wnt.sortList = { asc: function(sList){ sListItems = $(sList).find(‘li’); sListItems = _.sortBy(sListItems, function(item){ return $(item).text(); }); $(sList).html(sListItems); }, desc: function(sList){ sListItems = $(sList).find(‘li’); sListItems = _.sortBy(sListItems, function(item){ return $(item).text(); }).reverse(); $(sList).html(sListItems); } }; wnt.sortToggle = “asc”; $(‘ul’).click(function(){ wnt.sortList[wnt.sortToggle]($(this)); wnt.sortToggle===’asc’ ? wnt.sortToggle=”desc” : wnt.sortToggle=”asc”; }); Fiddle

Chrome Developer Tools: Saving JavaScript Edits

Posted on September 5th, 2013 by webninjataylor

You must do a right-click “Save As…” for saving to work locally. Then, subsequent edits may be saved with just “Save” or the keyboard shortcut https://developers.google.com/chrome-developer-tools/docs/authoring-development-workflow#save-as

JavaScript Prototyping Techniques

Posted on September 3rd, 2013 by webninjataylor

Prototyping via Constructor Functions /* Old way – awkward – exists for people used to classes */ // Create constructor function function Greeter(name){ this.name = name || ‘JohnDoe’; } // Attach to that constructor function’s prototype property Greeter.prototype.hello = function hello(){ return ‘Old Way = Hello, my name is ‘ + this.name; } // Instantiate […]

Retina Media Queries

Posted on July 24th, 2013 by webninjataylor

@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min–moz-device-pixel-ratio: 2), only screen and (-moz-min-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) { /* styles for Retina-type displays */ }