working on it ...

Filters

Explore Public Snippets

Sort by

Found 2,989 snippets matching: tags

    public by cghersi modified Nov 4, 2014  283331  2  6  1

    Remove HTML tags from text

    Removes the given tag (and all its content) from the specified text.
    static public string RemoveHtmlTag(string pageString, string tagName)
    {
      string output = pageString;
      int exprIni = 0;
      int firstChar = 0;
      int lastChar = 0;
    
      // find html element
      exprIni = output.IndexOf("<" + tagName, 0, output.Length,
                                      StringComparison.InvariantCultureIgnoreCase);
      while (exprIni >= 0)
      {
        // extract the html
        firstChar = exprIni;
    
        // find <tag ... />
        lastChar = output.IndexOf("/>", (firstChar + 1)) + 1;
        int nextCloseTag = output.IndexOf('>', (firstChar + 1));
    
        // closed with </tag> marker..
        if ((lastChar <= 0) || (nextCloseTag < lastChar))
        {
          // find </tag>
          lastChar = output.IndexOf("</" + tagName, (firstChar + 1), (output.Length - firstChar - 1),
                                                          StringComparison.InvariantCultureIgnoreCase);
          lastChar = output.IndexOf('>', (lastChar + 1));
        }
    
        if ((firstChar < 0) || (lastChar <= 0) || (firstChar == lastChar))
          return output.Substring(0, firstChar);
        else
        {
          output = String.Format("{0} {1}",
                      output.Substring(0, firstChar).Trim(),
                      output.Substring((lastChar + 1), (output.Length - lastChar - 1)).Trim());
        }
        exprIni = output.IndexOf("<" + tagName, 0, output.Length,
                                    StringComparison.InvariantCultureIgnoreCase);
      }
    
      return output;
    }
    

    public by lbottaro modified Feb 17, 2014  341226  3  7  1

    How to checkout the latest tag of a Git repository

    This simple bash script allows to automatically checkout your local git repository on the latest tagged version available on the remote repository. The script assumes to be run from your local repo. The command 'git rev-list --tags' lists the tags IDs in reverse chronological order, getting the very last one on top. The command 'git describe
    # Get new tags from the remote
    git fetch --tags
     
    # Get the latest tag name
    latestTag=$(git describe --tags `git rev-list --tags --max-count=1`)
     
    # Checkout the latest tag
    git checkout $latestTag  

    public by marksimon232 modified Jun 10, 2014  252575  1  6  0

    translate messages with html tags - Code snippets for symfony 1.x

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xliff PUBLIC "-//XLIFF//DTD XLIFF//EN" "http://www.oasis-open.org/committees/xliff/documents/xliff.dtd">
    <xliff version="1.0">
        <file original="global" source-language="en" datatype="plaintext" date="2009-08-12T12:32:00Z">
            <header/>
            <body>
                ...
                <trans-unit>
                    <source>from %from_date%<br/>to %to_date%</source>
                    <target>de %from_date%<br/>até %to_date%</target>
                </trans-unit>
            </body>
        </file>
    </xliff>
    
    

    public by JonahM modified May 19, 2014  275493  4  7  4

    Fluid CSS Rows

    I've realised in my coding experience that I need to To allow for space in the div or row tags when using text. Because everything is responsive on a web page, it's a good idea to use these classes. They work really well. Example: http://j.mp/1oilINn
    
    
    .strip-md{
    	padding-top:80px;
    	padding-bottom:80px;
    	position:relative;
    	overflow:hidden;
    }
    
    .strip-sm{
    	padding-top:30px;
    	padding-bottom:30px;
    }
    
    

    public by DanteNex modified Oct 27, 2015  3804  2  6  1

    Meta tags HTML de SEO

    Meta Tags HTML de SEO necessárias para uma boa indexação em buscadores como Google, Bing, e até mesmo indexação em facebook.
    <meta name="Author" content="Autor"/>
    
    <meta name="Keywords" content="palavras, chave, separadas, por, virgula"/>
    
    <meta name="Description" content="Descrição da página."/>
    
    <meta name="ROBOTS" content="INDEX, FOLLOW" />
    
    <!--<meta name="viewport" content="width=device-width, user-scalable=no"> Tag para responsividade -->
    
    <meta name="revisit-after" content="1" />
    
    <meta name="robots" content="noydir" />
    
    <meta name="slurp" content="noydir" />
    
    <meta name="RATING" content="GENERAL" />
    
    <meta http-equiv="expires" content="0">
    
    <meta http-equiv="cache-control" content="no-cache, must-revalidate">
    
    <meta http-equiv="pragma" content="no-cache">
    
    <meta name="revisit" content="1 day">
    
    <meta name="googlebot" content="all">
    
    <meta name="distribution" content="global">
    
    <meta name="classification" content="Classificação do Site">
    
    <meta name="rating" content="general">
    
    <meta name="language" content="pt-br">
    
    <meta name="doc-class" content="completed">
    
    <meta name="doc-rights" content="public">
    
    <meta name="doc-type" content="public">
    
    <meta name="language" content="português (brasil)">
    
    <meta name="doc-type" content="public">
    
    <meta name="doc-class" content="published">
    
    <meta name="doc-rights" content="public domain">
    
    <meta property="og:site_name" content="Nome do site"/>
    
    <meta property="og:description" content="Descrição do Site"/>            

    public by viveklucky1848 modified Jul 9, 2015  2321  2  6  0

    Life-saver regex to remove desired html tags completely with their contents

    Remove html tags with their contents, useful when you want to remove certain frequently occurring tags from page, for designer to set design with css. (eg. label tag)
    Find: <label.*?>(.|\s)*?</label>
    Replace with: ''(nothing :) not even quotes)
    
    
    Dare to try below example with my devilish remover;)
    
    <label class="email" for="email">
    	<span>New Email</span>
    	<p>New email 2</p>
    	NEW EMAIL3
    </label>                                    

    public by Geometry modified Jul 28, 2016  1395  0  4  0

    GetDevicesOfService: Retrieves a list of devices which offer the service specified with the Uuid. In case of a sensor tag service (e.g. temperature), this lists all Sensor Tags.

    Retrieves a list of devices which offer the service specified with the Uuid. In case of a sensor tag service (e.g. temperature), this lists all Sensor Tags. Uuid for the type of service u're looking for. List of DeviceInformation
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using Windows.Devices.Bluetooth.GenericAttributeProfile;
    using Windows.Devices.Enumeration;
    using Windows.Storage.Streams;
    using X2CodingLab.SensorTag.Exceptions;
    using X2CodingLab.Utils;
    
    /// <summary>
    /// Retrieves a list of devices which offer the service specified with the Uuid. In case of a sensor tag service (e.g. temperature),
    /// this lists all Sensor Tags.
    /// </summary>
    /// <param name="serviceUuid">Uuid for the type of service u're looking for.</param>
    /// <returns>List of DeviceInformation</returns>
    public static async Task<List<DeviceInformation>> GetDevicesOfService(string serviceUuid)
    {
        Validator.RequiresNotNullOrEmpty(serviceUuid);
    
        string selector = GattDeviceService.GetDeviceSelectorFromUuid(new Guid(serviceUuid));
        var devices = await DeviceInformation.FindAllAsync(selector);
        return devices.ToList<DeviceInformation>();
    }

    public by MarcoDeMagistris modified Apr 5, 2013  2727  4  5  0

    My First Snippet: How to create a singleton in C#

    This is the first example of a snippet: - the title represents in few words which is the exact issue the snippet resolves; it can be something like the name of a method; - the description (this field) is an optional field where you can add interesting information regarding the snippet; something like the comment on the head of a method; - the c
    public class MyClass 
    { 
       private static MyClass s_current; 
       private static object s_objSync = new object(); 
    
       private MyClass() {} 
    
       public static MyClass Instance 
       { 
           get 
           { 
               if (s_current == null) 
               { 
                   lock (s_objSync) 
                   { 
                       if (s_current == null) 
                           s_current = new MyClass(); 
                   } 
               } 
               return s_current; 
           } 
       } 
    } 

    public by snip2code modified Aug 13, 2017  490  3  4  0

    First Snippet: How to play with Snip2Code

    This is the first example of a snippet: - the title represents in few words which is the exact issue the snippet resolves; it can be something like the name of a method; - the description (this field) is an optional field where you can add interesting information regarding the snippet; something like the comment on the head of a method; - the c
    /* place here the actual content of your snippet. 
       It should be code or pseudo-code. 
       The less dependencies from external stuff, the better! */

    public by brsgrlr modified Mar 5, 2018  731  3  4  0

    phptags

    opening and closing php tags
    PHP
    <?php  ?>
    • Public Snippets
    • Channels Snippets