<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Snipplr</title>
<link>http://snipplr.com/tags/defaults</link>
<description>Recent snippets posted on Snipplr.com</description>
<language>en-us</language>
<pubDate>Sun, 19 May 2013 15:14:16 GMT</pubDate>
<item>
<title>(JavaScript) JavaScript Function Default Arguments (Full Object Merge) - viskenxp</title>
<link>http://snipplr.com/view/63636/javascript-function-default-arguments-full-object-merge/</link>
<description><![CDATA[ <p>This snippet uses jQuery.extend() to merge the objects.</p> ]]></description>
<pubDate>Wed, 29 Feb 2012 21:05:06 GMT</pubDate>
<guid>http://snipplr.com/view/63636/javascript-function-default-arguments-full-object-merge/</guid>
</item>
<item>
<title>(PHP) Mask Array Function - for setting default array structures and masking - RobertWHurst</title>
<link>http://snipplr.com/view/45767/mask-array-function--for-setting-default-array-structures-and-masking/</link>
<description><![CDATA[ <p>Summary
=======
A useful function for masking arrays. Very useful if you have a function or method that takes arguments in an array, and you would like to force that array to have a specific structure.

Its also great for setting defaults due to the fact that whatever structure or variables that are missing from the arguments array, and are present in the default (mask) array will be copied from the default array and merged into the returned array.

Description
========

**mask_array**( array $defaults , array $arguments [, bool $keep_unset ] )

Accepts two arrays. The first array is used as a mask on the second array.


Parameters
========

**$defaults** - An array of defaults to use as a mask.
**$arguments** - An array of arguments to be filtered by the mask array.
**$keep_unset** - Setting this to true disables discarding variables and structure that will not fit within the mask.

Example
======

    /* 
      * Basic use case
      */
     
    $defaults = array(
        'colour' => 'red',
        'shape' => 'circle'
        'size' => 'large'
    );

    $arguments = array(
        'colour' => 'blue'
        'wooden' => true
    );

    $filtered = mask_array($defaults, $arguments) ;

Result
====

**$filtered** will look like this:

    array(
        color => blue,
        shape => circle,
        size => large
    )

Note that the key 'broken' is discarded, while the color is carried over.

If the third argument is set to true the result would be the following:

    array(
        color => blue,
        shape => circle,
        size => large,
        wooden => true
    )

Note that because keep unset is true the mask does not cut out the key 'broken' is included.

Hope that you find this useful

~Robert Hurst</p> ]]></description>
<pubDate>Wed, 15 Dec 2010 12:41:52 GMT</pubDate>
<guid>http://snipplr.com/view/45767/mask-array-function--for-setting-default-array-structures-and-masking/</guid>
</item>
<item>
<title>(Python) changing default version when updating Python on Mac - magicrebirth</title>
<link>http://snipplr.com/view/39372/changing-default-version-when-updating-python-on-mac/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Sat, 21 Aug 2010 05:07:48 GMT</pubDate>
<guid>http://snipplr.com/view/39372/changing-default-version-when-updating-python-on-mac/</guid>
</item>
<item>
<title>(JavaScript) Javascript Select Dropdown Box (Defaults To Last Option Selected) - karlhorky</title>
<link>http://snipplr.com/view/22001/javascript-select-dropdown-box-defaults-to-last-option-selected/</link>
<description><![CDATA[ <p>This javascript creates and writes out an HTML  dropdown box that defaults to the last option parameter passed to page. Could be used as part of a form.</p> ]]></description>
<pubDate>Tue, 27 Oct 2009 21:41:49 GMT</pubDate>
<guid>http://snipplr.com/view/22001/javascript-select-dropdown-box-defaults-to-last-option-selected/</guid>
</item>
<item>
<title>(CSS) Element specific CSS reset - marcusrosentrater</title>
<link>http://snipplr.com/view/7438/element-specific-css-reset/</link>
<description><![CDATA[ <p>This will reset your style properties to the default values, specific to an element and its children.
Here are the all the properties that need to be set to default that also don't break modern browsers.... or less then modern, like IE 4/5.</p> ]]></description>
<pubDate>Tue, 22 Jul 2008 11:32:03 GMT</pubDate>
<guid>http://snipplr.com/view/7438/element-specific-css-reset/</guid>
</item>
<item>
<title>(TYPO3) sample TCAdefaults for tt_content - maddesigns</title>
<link>http://snipplr.com/view/6128/sample-tcadefaults-for-ttcontent/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Tue, 06 May 2008 05:15:06 GMT</pubDate>
<guid>http://snipplr.com/view/6128/sample-tcadefaults-for-ttcontent/</guid>
</item>
<item>
<title>(Other) Tag Cloud in Ruby - jnunemaker</title>
<link>http://snipplr.com/view/1036/tag-cloud-in-ruby/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Thu, 07 Sep 2006 17:08:40 GMT</pubDate>
<guid>http://snipplr.com/view/1036/tag-cloud-in-ruby/</guid>
</item>
</channel>
</rss>