Club 15CC
  • Subscribe
  • Twitter
  • Facebook
  • AppDev
  • WebDev
  • Music
  • Snippets
  • The best iOS singleton approach yet – thread safe, no locks!

    http://lukeredpath.co.uk/blog/a-note-on-objective-c-singletons.html

    Posted: 29th January 2012 ˑ 
    Tags: coding, design patterns, ios, singleton
  • Handy category for sampling pixel data from UIImage…

    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.

    Posted: 4th January 2012 ˑ 
    Tags: byte arrays, colour, images, ios, links, pixels
  • Latest Code Snippets...

    Linux Search and replace on files from the BASH command line…...

    Mathematics Elliptical Decay Formula (eg. in ADSR envelopes)...

    General Linearly scale/project a value in one range onto another range...

    iOS Create your own NSNotification paradigm for passing specifically typed data...

    iOS Common Cocoa Exceptions List...

    Git Update latest commit with some things you forgot (or update the commit message)...

    iOS Implode / concat NSArray elements into a string...

    iOS Add a pulsating image to a new CALayer centred on an existing view....

    iOS Hide the status bar...

    iOS Concatenate multiple path components safely...

  • Pure CSS3 Lighting Technique Example

    http://attasi.com/labs/ipad/

    Posted: 21st December 2011 ˑ 
    Tags: cool, css3, inspiration, lighting, shadow
  • A big weakness in Objective-C’s weak typing

    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…

    Posted: 18th December 2011 ˑ 
    Tags: ARC, compiling, ios, objective-c, troubleshooting, type
  • Notes on coding…

    Objective-C’s “categories” (and the ability to have them in separate files) removes the need for dividing a large set of tasks into multiple classes just for the sake of organisation.

    Posted: 16th December 2011 ˑ 
    Tags: coding, ios, meta, objective-c, oop, organisation, structure
  • Mysterious Appearance of Duplicate Symbol Error for Objective-C Class

    Check that you aren’t importing the “.m” file: `#import “DuplicateClass.m”` Thanks to the second answer on this SO post!

    Posted: 12th December 2011 ˑ 
    Tags: compiling, errors, objective-c, symbols, troubleshooting
  • 11 Fairly Random Tips and Stumbling Blocks to Help with Your Next iPhone Friendly, HTML5/CSS3 Website

    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 ...

    Posted: 5th December 2011 ˑ 
    Tags: coding, css3, html5, iphone, responsive design, tips, troubleshooting
  • CanvasDemos.com: 3D, Particles, Physics and Other Advanced Graphics on the Web

    http://www.canvasdemos.com/

    Posted: 5th December 2011 ˑ 
    Tags: 3d, canvas, examples, inspiration, webgl
  • A Crash Course in the HTML5/CSS3/JS Techniques of the Modern Front-End Maestro

    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 ...

    Posted: 3rd December 2011 ˑ 
    Tags: analytics, coding, css3, front-end, html5, javascript, jquery, lightboxes, polyfills, tools, webdev
  • The Tale of a Responsive Design, HTML5, CSS3, iPad3 Future Proof Photography Website

    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 ...

    Posted: 3rd December 2011 ˑ 
    Tags: css3, html5, inspiration, jquery, responsive design, websites, wordpress
  • Get All Attachments to a Post [WordPress]

    Sometimes you need to get a list of all the attachments to a post, some of which may not be accessible any other way (eg an image attached via media_side_load() which you wish to make the thumbnail). Here’s a useful snippet which grabs all the image attachments…

    Posted: 25th November 2011 ˑ 
    Tags: attachments, coding, snippets, wordpress
  • How To: Upload Media via URL Programmatically in WordPress

    How To: Upload Media via URL Programmatically in WordPress Discover the useful media_sideload_image() and download_url() functions. Much abliged Konstantin!

    Posted: 25th November 2011 ˑ 
    Tags: coding, howto, links, media, snippets, uploads, urls, wordpress
  • Set Post Parent for Media Set via a Custom Fields [WordPress]

    While creating a podcast website I discovered a fantastic plugin by Steve Taylor called Developer’s Custom Fields. I used it to add the podcast as custom fields which allowed me to easily handle the custom placement of the item in the layout while still giving the end-user the convenience of the Media Library to select ...

    Posted: 25th November 2011 ˑ 
    Tags: attachments, coding, custom fields, posts, snippets, wordpress
  • Bulk Remove Categories from Posts [WordPress]

    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… ...

    Posted: 22nd November 2011 ˑ 
    Tags: admin, bulkedit, coding, functions.php, snippets, themes, wordpress
  • iOS5 & ARC – A Clear, Comprehensive Tutorial… [iOS]

    iOS5 & ARC – A Clear, Comprehensive Tutorial… [iOS]

    Posted: 18th November 2011 ˑ 
  • Singleton Design Patterns Reference [Objective-C]

    Singleton Design Patterns Reference [Objective-C] A good discussion on StackOverflow which covers multi-threading and high-efficiency options…

    Posted: 18th November 2011 ˑ 
    Tags: ios, objective-c, reference, threading
  • Learn by Example with these Python Generator Expressions [Python]

    Learn by Example with these Python Generator Expressions [Python]

    Posted: 11th November 2011 ˑ 
    Tags: examples, generators, howto, python, reference
  • 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.

    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 ...

    Posted: 11th November 2011 ˑ 
  • Set Fade on Multiple Items Simultaneously [Reaper]

    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

    Posted: 7th November 2011 ˑ 
    Tags: audioproduction, how-to, reaper, sampling
  • Absolute Positioned A Tag Block Not Clickable in IE [Problems & Solutions, CSS]

    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); }

    Posted: 5th November 2011 ˑ 
    Tags: css, hacks, ie, links, troubleshooting
  • WordPress Sub-queries – The Many Options and Best Practices [WordPress]

    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, ...

    Posted: 5th November 2011 ˑ 
    Tags: globals, scope, sub-queries, wordpress
  • HTML5 Saves You More Javascript Hackery with Prefetching/Prerendering

    HTML5 Saves You More Javascript Hackery with Prefetching/Prerendering

    Posted: 2nd November 2011 ˑ 
    Tags: html5, optimisation, prefetching, prerendering, wordpress
  • Removing Unnecessary Admin Menu Items [WordPress]

    Removing Unnecessary Admin Menu Items [WordPress]

    Posted: 2nd November 2011 ˑ 
    Tags: admin, menu, snippets, wordpress
  • WordPress – Give “subscribers” access to private posts & pages

    Anywhere should do for this. I’ve got mine in a hook into the ‘after_setup_theme’ action. $sub_role = get_role( ‘subscriber’ ); $sub_role->add_cap( ‘read_private_posts’ ); $sub_role->add_cap( ‘read_private_pages’ );

    Posted: 30th October 2011 ˑ 
    Tags: permissions, private posts, snippets, wordpress
  • WordPress – Determine whether 404 was *actually* a private page view…

    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 ...

    Posted: 30th October 2011 ˑ 
    Tags: 404s, private posts, query, snippets, wordpress
  • Cross Browser User-Select Reset [CSS3]

    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 ...

    Posted: 25th October 2011 ˑ 
    Tags: css3, html5, selection, snippets
  • WordPress: Convert Post Date Format to More Human Friendly Version

    Converts MySQL Datetime formats… mysql2date( get_option(‘date_format’), $your_post->post_date ); (source: /wp-includes/functions.php)

    Posted: 25th October 2011 ˑ 
    Tags: datetime, snippets, strings, wordpress
  • WordPress: Better Verions for Built-in PHP Functions

    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 ...

    Posted: 25th October 2011 ˑ 
    Tags: coding, escaping, functions, html, reference, wordpress
  • An Improved Version of the jQuery Plugin Template

    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 ...

    Posted: 20th October 2011 ˑ 
    Tags: coding, design patterns, javascript, jquery, plugins, templates
  • WordPress: Get Custom Posts by Tag on the Tag Page

    You want to grab the posts for a custom post type for the current tag whose page is being viewed… $page_tag_name = single_tag_title( ”, false ); $tag = array_pop(get_tags( array(‘name__like’ => $page_tag_name) )); query_posts(array( ‘post_type’ => array($my_custom_post_type), ‘tag’ => $tag->slug )) Then continue with The Loop as normal…

    Posted: 18th October 2011 ˑ 
    Tags: coding, query, snippets, tags, themes, wordpress
  • WordPress: Get post by title

    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 ...

    Posted: 18th October 2011 ˑ 
    Tags: coding, database, posts, snippets, wordpress
  • WordPress: Check user capabilities on a post

    … $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.’ ) ); }

    Posted: 18th October 2011 ˑ 
    Tags: capabilities, coding, security, snippets, wordpress
  • WordPress: Add IPTC keywords and category metadata to uploaded images

    Add IPTC keywords and category to image… function fifteenccgal_add_additional_image_meta( $meta, $file, $sourceImageType ) { $image_file_types = apply_filters( ‘wp_read_image_metadata_types’, array( IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM ) ); // Check that it’s an image type if ( in_array( $sourceImageType, $image_file_types ) && function_exists(‘iptcparse’) ) { getimagesize($file, $info); $iptc = iptcparse($info['APP13']); $meta['category'] = $iptc['2#015']; $meta['keywords'] = $iptc['2#025']; } return $meta; ...

    Posted: 17th October 2011 ˑ 
    Tags: coding, hooks, metadata, snippets, wordpress
  • WordPress: Adding a form parameter to media uploads

    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” ...

    Posted: 17th October 2011 ˑ 
    Tags: hacks, hooks, howto, medialibrary, mediauploader, wordpress
  • WordPress: Secret, Undocumented, Hard to Find & Very Useful Hooks

    an ongoing list…feel free to contribute! Media Library pre-upload-ui | post-upload-ui | pre-html-upload-ui | post-html-upload-ui | pre-flash-upload-ui | post-flash-upload-ui (media.php: ~1488) Parameters: None Inserts html into the media library uploader form. The html and flash work for their versions only and the general two work for both. Media Uploading wp_handle_upload Occurs when file is first ...

    Posted: 17th October 2011 ˑ 
    Tags: actions, filters, hooks, list, reference, wordpress
  • WordPress: Run a query loop without interfering with the global $post

    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 = ...

    Posted: 16th October 2011 ˑ 
    Tags: query, snippets, the_loop, wordpress, WP_query
  • WordPress: Add custom image thumbnail sizes to the media library’s insert size choices

    /** * 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 ...

    Posted: 15th October 2011 ˑ 
    Tags: coding, snippets, wordpress
  • WordPress: Enqueuing Javascript File Dependencies Correctly

    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. // ...

    Posted: 22nd September 2011 ˑ 
    Tags: codesnippets, javascript, wordpress
  • © 2011 Club 15CC. All images are copyrighted by their respective authors.
    Powered by Wordpress.