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 […]
git checkout theirs [file]
Remove a file from the repo via your branch and commit git rm [file]
ctrl + u erases entire line ctrl + c quits a binary execution and gets you back to the prompt
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
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
Add this for smooth, elastic scrolling on mobile… #s4-workspace { -webkit-overflow-scrolling: touch; }
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, […]
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”) + […]
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 […]
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 […]
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 […]
You can view an object’s bound events in the console with… $._data( $(‘.element’)[0], ‘events’ );
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 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
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 […]
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 […]
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 […]
The standard is to use this CSS… .hidden { height: 1px; left: -10000px; overflow: hidden; position: absolute; top: auto; width: 1px; }
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
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
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 […]
@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 */ }