http://lukeredpath.co.uk/blog/a-note-on-objective-c-singletons.html
https://github.com/Club15CC/Marshmallows/tree/master/Lib/UIKit A UIImage category for Getting pixel byte data into an NSData object Sampling pixel colour data at a point Sampling an even selection of pixels from a range (for using gradients swatches as colour profiles). Many thanks to the help in this SO questions.
http://attasi.com/labs/ipad/
http://cocoawithlove.com/2011/06/big-weakness-of-objective-c-weak-typing.html Keeping this one in the back of your mind might save you some serious headache…
Check that you aren’t importing the “.m” file: `#import “DuplicateClass.m”` Thanks to the second answer on this SO post!
1. In HTML5, there is no predefined hierarchy for <header>, <section> and <article> tags. Each can be nested within the other. It’s not one section per page or one article per page. Post stubs can be wrapped in <article> tags. Comments can be a <section> with each comment being an <article> with the author/date/time in ...
http://www.canvasdemos.com/
For the rebuild of the photographer Nick Fleming’s website, I was pleased to discover this treasure chest of incredible tools which have come about in recent years. The site employs many modern front-end web development techniques such as responsive design via media queries, font embedding, the HTML5 History API, HTML5 elements, and many CSS3 techniques ...
For the recent re-design of the photographer Nick Fleming’s website, I decided to make a bold decision to forgo worry about compatibility with the Ghosts of IE Past and focus on leveraging many of the modern tools of HTML5, CSS3 and other areas which many of us have been patiently window shopping but in-the-end, avoiding for ...
How To: Upload Media via URL Programmatically in WordPress Discover the useful media_sideload_image() and download_url() functions. Much abliged Konstantin!
It’s a slight drawback to the bulk post editor in WP at the moment that you may only add categoires to the selected posts but not remove them. I came across this post on the forum to which I had to make a few tweaks to get things working in WP3.2. Below is the result… ...
iOS5 & ARC – A Clear, Comprehensive Tutorial… [iOS]
Singleton Design Patterns Reference [Objective-C] A good discussion on StackOverflow which covers multi-threading and high-efficiency options…
Learn by Example with these Python Generator Expressions [Python]
Need to know the type of an object? Let me make a brief argument: No, you don’t. Just use the object as if it was whatever you expect it to be, and handle any errors that result. Thanks for the reminder: http://www.siafoo.net/article/56 Debating whether and how to check that variables type to ensure it’s used ...
Hold CTRL+ALT to fade multiple items on the same [or seperate] tracks Thanks Ollie: http://forum.cockos.com/archive/index.php/t-54989.html
Credit to @Justin http://stackoverflow.com/questions/1663919/how-to-make-an-empty-anchor-tag-clickable-in-ie7 .ie .myelementclass { background-image:url(about:blank); }
Recently, while doing the new build for www.nickfleming.com, I had a situation where I wanted to show excerpts for my related post stubs on the Tag templates but not on the Single templates. Doing an is_tag() strangely returned true for all contexts. Upon investigating I realised I was overriding the global $wp_query and with it, ...
HTML5 Saves You More Javascript Hackery with Prefetching/Prerendering
WordPress WP_Query’s get_posts() method takes a somewhat draconian approach to private posts on single and page views and strips them from the results even if you specify you want them with the query parameters. With it, goes the ability to distinguish between private pages and those which are true 404s. The snippet below overcomes this ...
This snippet disables content selection on all elements and then re-enables it for common text elements in ASIDE or ARTICLE (and a few other) contexts. If you want images to be selected, change : text; to : all; [EDIT] Mozilla blocks all children from overriding unless you use -moz-none for the value. Even so I ...
Converts MySQL Datetime formats… mysql2date( get_option(‘date_format’), $your_post->post_date ); (source: /wp-includes/functions.php)
One issue with starting in a new framework is learning and remembering all the functions implemented which are improved versions of, and therefore preferred over, their PHP built-in siblings. They are most commonly the ones associated with escaping and UTF-8, i18n, etc. This is another ongoing list for your and my general reference. In preference ...
I can’t seem to find it now, but there was a very helpful article on public/private methods for jQuery plugins – an improvement/extension over the one jQuery recommends at the bottom of http://docs.jquery.com/Plugins/Authoring. After writing a couple of plugins, I’ve re-vamped, tweaked and pimped it a bit to improve and simplify things. One key feature ...
Not entirely obvious from what’s our there… $sql = sprintf( “SELECT * from {$wpdb->posts} WHERE post_title=’%s’ AND ( post_status <> ‘trash’ AND post_status <> ‘inherit’ AND post_status <> ‘auto-draft’ )”, addslashes( $title ) ); $matching_post = get_object_vars( $wpdb->get_row($sql) ); I chose to use get_object_vars rather than passing the ARRAY_A second param as the later misses ...
… $ptype = get_post_type_object($post_type); // eg. ‘post’, ‘page’ if ( !current_user_can( $ptype->cap->edit_posts ) ) { wp_die( __( ‘You are not allowed to create posts or drafts on this site.’ ) ); }
Say you want to get a form parameter to pass to the media uploader so you can test for it in the $_POST on your wp_handle_upload filter… /** * Add checkbox to set autocreate on upload */ function fifteenccgal_autocreate_post_on_image_upload_form_tweaks() { ?> <label style=”display: inline-block; padding: 5px 8px; border: 3px solid lightgrey; border-radius: 1em”> <input type=”checkbox” ...
This example runs a query with some (prearranged) arguments to get related post thumbnails. More importantly, it’s an example of how to run a WP_Query in WordPress without affecting the global data. Notice the get_the_ID() call which checks the current scope’s post id… $wpq = new WP_Query($args); $thumbs = array(); while ($wpq->have_posts()) : $post = ...
/** * Add intermediate image sizes to media gallery modal dialog */ function nf_add_image_sizes_to_editor( $form_fields, $post ) { if ( !is_array( $imagedata = wp_get_attachment_metadata( $post->ID ) ) ) return $form_fields; if ( is_array($imagedata['sizes']) ) { foreach ( $imagedata['sizes'] as $size => $val ) { if ( $size == ‘teaser-image’ ) { // put your thumbnail ...
Mod of the MailChimp WP widget to include Placeholders jQuery Plugin. Notice the first function is wp_register_script. This doesn’t load it unless something later depends on it. Also if another plugin has it’s own version and uses the same handle name then this will prevent duplicate loads even if the script sources are different. // ...