working on it ...

Filters

Explore Public Snippets

Sort by

Found 9,698 snippets matching: @element

    public by lbottaro  901650  60  8  1

    How to remove all checked out files in clearcase

    This cleartool command lists all the checkout files (both from the current directory and from the entire view) searching in each directory or vob path. For each element found, it invokes the command to remove the checkout.
    # Remove ALL checked out files from view in the entire vobs
    cleartool lsco -cview -me -avobs -short | xargs cleartool unco -rm 
    
    # Remove ALL checked out files from the current directory on only
    cleartool lsco -cview -me -rec -short | xargs cleartool unco -rm 

    public by lbottaro  476239  9  6  2

    JavaScript equivalent to C# String.format

    The code below is the Javascript equivalent to C# String.Format() for replacing elements like {0}, {1}, {2} with parameters. In this case the String prototype is modified, adding the new format() method to all string instances. How to use var mystring = "Hello {0}, how are you? My name is {1}. Bye {0}!" mystring.format("Alice", "Bob") //
    // First, checks if it isn't implemented yet.
    if (!String.prototype.format) {
      String.prototype.format = function() {
        var args = arguments;
        return this.replace(/{(\d+)}/g, function(match, number) { 
          return typeof args[number] != 'undefined'
            ? args[number]
            : match
          ;
        });
      };
    }            

    public by Zenitram.PRO  404447  3  5  1

    Adding an Element in an Array using a Function.

    Arrays of Objects Remember that an object is just another type, like a string or number but more complex. This means that just as we can make arrays of numbers and strings, we can also make arrays of objects. Here we have our Person constructor which should look familiar. We can use this constructor to make an array of Person objects, similar
    // Our person constructor
    function Person (name, age) {
        this.name = name;
        this.age = age;
    }
    
    // Now we can make an array of people
    var family = new Array();
    family[0] = new Person("alice", 40);
    family[1] = new Person("bob", 42);
    family[2] = new Person("michelle", 8);
    // add the last family member, "timmy", who is 6 years old
    family[3] = new Person("timmy", 6);
                                                    

    public by lbottaro  332813  2  4  0

    C# enum iteration

    This c# code allows to iterate through all element of an enum
    public enum Suit
    {
            Spades,
            Hearts,
            Clubs,
            Diamonds
    }
    
    foreach (Suit suit in Enum.GetValues(typeof(Suit)))
    {
       Console.WriteLine(suit);
    }

    public by JonahM  269795  0  6  0

    Tweak Your UI using Form Alter - Drupal

    How to identify and edit elements on a page in Drupal. This is a drupal module code
    <?php
    
    function ui_tweaka_help($path, $arg){
    	switch ($path) {
    		case 'admin/#ui_tweaka':
    			return t("Changes stuff");
    	}	
    }
    
    function ui_tweaka_form_alter(&$form, &$form_state, $form_id) {
      if (module_exists('devel')) { // Is the 'devel' module active?
         dpm($form_id); // Let's have a butchers at the form id
         dpm($form); // Ditto the form itself
    
         //$form['title']['#title'] = t('Main Heading for this page');
         //$form['title']['#access'] = FALSE;
         $form['field_image']['und'][0]['#description'] = t("Upload  nice piccy here");
      }
    }
    
    ?>
    

    public by JKCPR  257451  1  6  1

    font: CSS SHORTHAND

    Useful CSS shorthand notation of font: attribute of universal selector of all element(s) descended from the element.
    /* CSS SHORTHAND font: */
    
    body *{
          font: normal 1em/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
        }
    
    /* Equivalent Example
    
    body *{
          font-weight: normal;
          font-size: 1em;
          line-height: 1.5;
          font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
        }
          
      */

    public by sukhjinderkahlon  247636  2  4  0

    Selenium IsElementExists

    This code will find whether the element is present or not
    public static boolean isExistsElement(WebDriver driver, By by){
    		
    		    try {
    		        driver.findElement(by);
    		    } catch (NoSuchElementException e) {
    		        return false;
    		    }
    		    return true;
    			}            

    public by Geometry  156393  0  4  0

    IsZeroElim: Checks whether an expansion has been zero-eliminated. Either the expansion must have exactly one element, which is 0.0, or the expansion must have no 0.0 elements.

    Checks whether an expansion has been zero-eliminated. Either the expansion must have exactly one element, which is 0.0, or the expansion must have no 0.0 elements.
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.Linq;
    using System.Text;
    
    /// <summary>
    /// Checks whether an expansion has been zero-eliminated.
    /// Either the expansion must have exactly one element, which is 0.0, 
    /// or the expansion must have no 0.0 elements.
    /// </summary>
    /// <param name="doubles"></param>
    /// <returns></returns>
    public static bool IsZeroElim(this IEnumerable<double> doubles)
    {
        return (doubles.Count() == 1 && doubles.First() == 0.0) || !doubles.Contains(0.0);
    }

    public by cghersi  185237  1  6  1

    Use the Raw HTML content in XSLT transformations

    Usage of copy-of element allows to get the exact content of an XML node and put it as raw HTML, so that e.g. are not stripped out as instead happens with
    <myXmlNode>
    	<question>
    	Some text <br/> separated < br/> by new lines
    	</question>
    </myXmlNode>
    
    <span>
    	<xsl:copy-of select="question"/>
    </span>

    public by Geometry  112775  0  6  0

    DeepClone: Copies a collection by calling the ICloneable.Clone method for each element inside it.

    Copies a collection by calling the ICloneable.Clone method for each element inside it. yThe collection to be cloned. A copy of the collection where each element has also been copied.
    /// <summary>
    ///   Copies a collection by calling the ICloneable.Clone method for each element inside it.
    /// </summary>
    /// 
    /// <typeparam name="T"></typeparam>
    /// <param name="list">The collection to be cloned.</param>
    /// 
    /// <returns>A copy of the collection where each element has also been copied.</returns>
    /// 
    public static T DeepClone<T>(this T list)
        where T : IList<ICloneable>, ICloneable
    {
        T clone = (T)list.Clone();
        for (int i = 0; i < clone.Count; i++)
            clone[i] = (ICloneable)list[i].Clone();
        return clone;
    }
    • Public Snippets
    • Channels Snippets