working on it ...

Filters

Explore Public Snippets

Sort by

Found 75k snippets matching: html

    public by sTiLL-iLL modified Jul 18, 2014  546563  1  6  11

    Simple position tracker

    Simple position tracker: index.html
    <!Doctype html>
    <meta name="viewport" content="width=620" />
    <title>KnD-MApPA</title>
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
    <article>
        <p>Finding your location: <span id="status">checking...</span>
        </p>
    </article>
    <script>
        var map = "";
        var marker = "";
    
        function success2(position) {
            var latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
            marker = new google.maps.Marker({
                    position: latlng,
                    map: map,
                    title: "You are here @ " + getDateTime() + " - (within a " + position.coords.accuracy + " meter radius)"
                });
        }
    
        function success(position) {
            var s = document.querySelector('#status');
    
            if (s.className == 'success') {
                // not sure why we're hitting this twice in FF, I think it's to do with a cached result coming back
                return;
            }
    
            s.innerHTML = "found you!";
            s.className = 'success';
    
            var mapcanvas = document.createElement('div');
            mapcanvas.id = 'mapcanvas';
            var w = window.innerWidth - 100;
            var h = '360px';
            mapcanvas.style.height = h;
            mapcanvas.style.width = w;
            mapcanvas.style.marginLeft = 'auto';
    
            document.querySelector('article').appendChild(mapcanvas);
    
            var latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
            var myOptions = {
                zoom: 15,
                center: latlng,
                mapTypeControl: true,
                navigationControlOptions: {
                    style: google.maps.NavigationControlStyle.SMALL
                },
                mapTypeId: google.maps.MapTypeId.HYBRID
            };
            map = new google.maps.Map(document.getElementById("mapcanvas"), myOptions);
    
            marker = new google.maps.Marker({
                    position: latlng,
                    map: map,
                    title: "You are here @ " + getDateTime() + " - (at least within a " + position.coords.accuracy + " meter radius)"
                });
        }
    
        function getDateTime() {
            var now = new Date();
            var year = now.getFullYear();
            var month = now.getMonth() + 1;
            var day = now.getDate();
            var hour = now.getHours();
            var minute = now.getMinutes();
            var second = now.getSeconds();
            if (month.toString().length == 1) {
                var month = '0' + month;
            }
            if (day.toString().length == 1) {
                var day = '0' + day;
            }
            if (hour.toString().length == 1) {
                var hour = '0' + hour;
            }
            if (minute.toString().length == 1) {
                var minute = '0' + minute;
            }
            if (second.toString().length == 1) {
                var second = '0' + second;
            }
            var dateTime = month + '/' + day + '/' + year + ' ' + hour + ':' + minute + ':' + second;
            return dateTime;
        }
    
        function error(msg) {
            var s = document.querySelector('#status');
            s.innerHTML = typeof msg == 'string' ? msg : "failed";
            s.className = 'fail';
    
            // console.log(arguments);
        }
    
        var opts = {
            enableHighAccuracy: true
        }
    
        var wtch = "";
    
        if (navigator.geolocation) {
            navigator.geolocation.getCurrentPosition(success, error);
            wtch = navigator.geolocation.watchPosition(success2, error, opts)
        } else {
            error('not supported');
        }
    
        window.onbeforeunload(function(e) {
            navigator.geolocation.clearWatch(wtch);
        });
    </script>
    
    

    public by lbottaro modified Mar 12, 2014  428980  12  7  3

    HTML header - footer layout using CSS and DIV

    This code renders a HTML basic layout with header, main and footer contents. The main content has 2 columns and the right one contains two rows. Source: http://stackoverflow.com/questions/6778808
    <html>
        <head>
        <style type="text/css">
        #maincontent {
            width:950px;
            height:100%;
            margin:0 auto;
        }
        #header {
            width:946px;
            height:150px;
            border:#000 solid;
            border-width:2px 2px 1px 2px;
        }
        #leftcolumn {
            width:395px;
            height:703px;
            border:#000 solid;
            border-width:1px 1px 1px 2px;
            float:left;
        }
        #toprow {
            width:549px;
            height:351px;
            border:#000 solid;
            border-width:1px 2px 1px 1px;
            float:left;
        }
        #bottomrow {
            width:549px;
            height:350px;
            border:#000 solid;
            border-width:1px 2px 1px 1px;
            float:left;
        }
        #footer {
            width:946px;
            height:150px;
            border:#000 solid;
            border-width:1px 2px 2px 2px;
            clear:both;
        }
        </style>
        <body>
        <div id="maincontent">
            <div id="header">Header Content</div>
            <div id="leftcolumn">Leftcolumn Content</div>
            <div id="toprow">Toprow Content</div>
            <div id="bottomrow">Bottomrow Content</div>
            <div id="footer">Footer Content</div>
        </div>
        </body>
        </html>

    public by cm85 modified Nov 17, 2015  422913  11  6  1

    Living The Herbal Life

    Living The Herbal Life. Your World Revolves Around....
    <html>
    		<head>
    				<style>
    						
    						body {
    		/* The universe is black */
    		background-color: black;
    		width: 100%;
    		height: 100%;
    }
    
    #sun {
    		/* Style your sun */
    		position: absolute;
    		top: 50%;
    		left: 50%;
    
    		height: 100px;
    		width: 100px;
    		margin-top: -50px; 
    		margin-left: -50px;
    
    		border-color: #dddd00;
    		border-width: 8px;
    		border-style: solid;
    		border-radius: 50%;
    
    		box-shadow: 0 0 128px orangered;
    }
    
    #earth {
    		position: absolute;
    		top: 0;
    		left: 50%;
    
    		height: 50px;
    		width: 50px;
    		margin-left: -25px;
    		margin-top: -25px;
    }
    
    #earth-orbit {
    		position: absolute;
    		top: 50%;
    		left: 50%;
    
    		width: 300px;
    		height: 300px;
    		margin-top: -150px;
    		margin-left: -150px;
    		
    		-webkit-animation: spin-right 10s linear infinite;
    		-moz-animation: spin-right 10s linear infinite;
    		animation: spin-right 10s linear infinite;
    }
    
    @-webkit-keyframes spin-right {
    	100% {
    			-webkit-transform: rotate(360deg);
    	}
    }
    
    @-moz-keyframes spin-right {
    		100% {
    				-webkit-transform: rotate(360deg);
    		}
    }
    				</style>
    		</head>
    		
    		<body>
    		
    				<!-- Right below is an image of the sun -->
    				<img id='sun' src="https://dl.dropboxusercontent.com/u/200015521/Image%20URL%20Links/Marijuana-Leaf.png">
    				
    				<!-- Insert the 'earth' on the next line -->
    				<div id='earth-orbit'>
    						<img id='earth' src="https://dl.dropboxusercontent.com/u/200015521/Pictures/Carlo.png">
    				</div>
    				
    		</body>
    		</html>
    
                                                    

    public by divtagged modified Aug 21, 2015  395643  1  4  0

    HTML Snippet : Form Row

    HTML Snippet : Form Row: form__row.html
    <div class="form__row">
        <label class="form__label" for="">
            Label
        </label>
        <div class="form__field">
            <input id="" placeholder="" name="" required="required" type="text" value="">
            <i class="form__field-icon"></i>
        </div>
    </div>
    
    

    public by cm85 modified Nov 17, 2015  347315  5  7  0

    Useful HTML Footer

    Very Useful HTML Footer: footer.html
    <p align="center">
      <b>© Peppino's Menu's</b><br>
      <a href="https://github.com/cm85/Peppinos/wiki/Peppino's-Lunch-Menu">Lunch Menu</a> |
      <a href="https://github.com/cm85/Peppinos/wiki/Peppino's-Catering-Menu">Catering Menu</a> |
      <a href="https://github.com/cm85/Peppinos/wiki/Peppino's-Main-Menu">Main Menu</a>
      <br><br>
      <img src="https://dl.dropboxusercontent.com/u/200015521/Image%20URL%20Links/Peppino%3Bs%20Logo.png">
    </p>
    
                            

    public by f8lrebel modified Apr 24, 2013  365673  3  4  0

    Original project here: http://designitcodeit.com/i/11

    Original project here: http://designitcodeit.com/i/11: index.html script.js style.css
    CSS
    <ul class="comments">
      <li class="comment">
        <a href="#" title="View this user profile" class="photo"><img src="http://designitcodeit.com/live/45S6P0fit0nM/img/photo1.png" alt="Kasper"></a>
        <div class="meta">Kasper | 2012.07.24 14:58 <a class="reply">Reply</a></div>
        <div class="body">Cupcake ipsum dolor sit amet. Icing donut cheesecake muffin marzipan chocolate biscuit. Sweet roll chocolate marzipan.</div>
      </li>
      <li class="comment level-2">
        <a href="#" title="View this user profile" class="photo"><img src="http://designitcodeit.com/live/45S6P0fit0nM/img/photo-default.png" alt="Photo"></a>
        <div class="meta">John | 2012.07.24 15:21 <a class="reply">Reply</a></div>
        <div class="body">Candy soufflé bear claw apple pie bear claw marshmallow. Jelly brownie wafer chocolate jelly.marzipan pastry sesame snaps apple pie.</div>
      </li>
      <li class="comment level-3">
        <a href="#" title="View this user profile" class="photo"><img src="http://designitcodeit.com/live/45S6P0fit0nM/img/photo-default.png" alt="Photo"></a>
        <div class="meta">Jane | 2012.07.24 15:32 <a class="reply">Reply</a></div>
        <div class="body">Tart apple pie bonbon applicake sesame snaps sugar plum.</div>
      </li>
      <li class="comment level-4">
        <a href="#" title="View this user profile" class="photo"><img src="http://designitcodeit.com/live/45S6P0fit0nM/img/photo-default.png" alt="Photo"></a>
        <div class="meta">Jane | 2012.07.24 15:32 <a class="reply">Reply</a></div>
        <div class="body">Tart apple pie bonbon applicake sesame snaps sugar plum.</div>
      </li>
      <li class="comment">
        <a href="#" title="View this user profile" class="photo"><img src="http://designitcodeit.com/live/45S6P0fit0nM/img/photo1.png" alt="Kasper"></a>
        <div class="meta">Kasper | 2012.07.24 14:58 <a class="reply">Reply</a></div>
        <div class="body">Cupcake ipsum dolor sit amet. Icing donut cheesecake muffin marzipan chocolate biscuit.</div>
      </li>
    </ul>
    
    /* 
     * Comments thread for Design it & Code it
     * http://designitcodeit.com/i/11
     */
    
    html {
      background: #fff url(http://designitcodeit.com/live/45S6P0fit0nM/img/bg.png);
      font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
    }
    body {
      max-width: 480px;
      width: 100%;
      margin: 30px auto 0 auto;
    }
    a { cursor: pointer; }
    
    /**
     * Customs
     */
    .comments:after { border-color: #fff; }
    .comments:before { background-color: #fff; }
    .comments .comment {
      background: #fff;
      border-radius: 10px;
      font-size: 11px;
      padding: 10px 15px;
    }
    .comments [class*="level-"] .photo:before { background-color: #fff; }
    .comments .meta { color: #ccc; }
    .comments .meta a { color: inherit; }
    .comments .meta a:hover { color: #34b5d0; }
    .comments .body { color: #888; }
    
    /**
     * Comments Thread
     */
    .comments {
      list-style-type: none;
      padding: 5px 0 0 46px;
      position: relative;
      margin: 0 0 0 12px;
    }
    .comments:before,
    .comments .comment,
    .comments .comment:after,
    .comments .comment:before,
    .comments .photo img,
    .comments [class*="level-"] .photo:before {
      box-shadow: 0 1px 3px rgba(0,0,0,.4);
    }
    .comments:after,
    .comments:before {
      display: block;
      content: '';
      position: absolute;
    }
    .comments:before {
      border-radius: 0 0 5px 5px;
      height: 100%;
      width: 8px;
      left: 0;
      top: 0;
    }
    .comments:after {
      box-shadow: 0 1px 3px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.4) inset;
      border-width: 4px;
      border-style: solid;
      border-radius: 18px;
      height: 10px;
      width: 10px;
      left: -5px;
      top: -16px;
      z-index: -1;
    }
    .comments .comment {
      margin-bottom: 10px;
      position: relative;
    }
    .comments .comment:after,
    .comments .comment:before {
      border-radius: 10px;
      background-color: #fff;
      position: absolute;
      display: block;
      content: '';
    }
    .comments .comment:after {
      width: 12px;
      height: 12px;
      left: -14px;
      top: 7px;
    }
    .comments .comment:before {
      width: 5px;
      height: 5px;
      left: -22px;
      top: 16px;
    }
    .comments .photo {
      position: absolute;
      left: -60px;
      top: 2px;
    }
    .comments .photo img {
      border: 1px solid #fff;
      border-radius: 32px;
      overflow: hidden;
    }
    .comments .meta { margin-bottom: 5px; }
    .comments .meta .reply { display: none; float: right; }
    .comments .comment:hover .reply { display: block; }
    .comments [class*="level-"] .photo:before {
      display: block;
      content: '';
      position: absolute;
      margin-top: -2px;
      height: 4px;
      width: 20px;
      left: -10px;
      top: 50%;
      z-index: -1;
    }
    .comments .level-2 { margin-left: 30px; }
    .comments .level-3 { margin-left: 50px; }
    .comments .level-4 { margin-left: 70px; }
    .comments .level-5 { margin-left: 90px; }
    .comments .level-6 { margin-left: 110px; }
    .comments .level-3 .photo:before { width: 40px; left: -30px;}
    .comments .level-4 .photo:before { width: 60px; left: -50px;}
    .comments .level-5 .photo:before { width: 80px; left: -70px;}
    .comments .level-6 .photo:before { width: 100px; left: -90px;}
    
    

    public by cghersi modified Nov 4, 2014  283162  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 marksimon232 modified Jun 10, 2014  252402  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 sherazam modified Jan 13, 2016  228084  0  5  0

    How to Insert Check Boxes or HTML into Word Docs during Mail Merge inside .NET Apps

    How to Insert Check Boxes or HTML into Word Docs during Mail Merge inside .NET Apps
    // Enter here the actual content of the snippet.            
    //[C# Code Sample]
     
    using System;
    using System.IO;
    using System.Reflection;
    using Aspose.Words;
    using Aspose.Words.Fields;
    using Aspose.Words.MailMerging;
    
    namespace MailMergeFormFields
    {
        /// <summary>
        /// This sample shows how to insert check boxes and text input form fields during mail merge into a document.
        /// </summary>
        class Program
        {
            /// <summary>
            /// The main entry point for the application.
            /// </summary>
            public static void Main(string[] args)
            {
                Program program = new Program();
                program.Execute();
            }
    
            private void Execute()
            {
                string exeDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar;
                string dataDir = new Uri(new Uri(exeDir), @"../../Data/").LocalPath;
    
                // Load the template document.
                Document doc = new Document(dataDir + "Template.doc");
    
                // Setup mail merge event handler to do the custom work.
                doc.MailMerge.FieldMergingCallback = new HandleMergeField();
    
                // This is the data for mail merge.
                String[] fieldNames = new String[] {"RecipientName", "SenderName", "FaxNumber", "PhoneNumber",
                    "Subject", "Body", "Urgent", "ForReview", "PleaseComment"};
                Object[] fieldValues = new Object[] {"Josh", "Jenny", "123456789", "", "Hello",
                    "<b>HTML Body Test message 1</b>", true, false, true};
    
                // Execute the mail merge.
                doc.MailMerge.Execute(fieldNames, fieldValues);
    
                // Save the finished document.
                doc.Save(dataDir + "Template Out.doc");
            }
    
            private class HandleMergeField : IFieldMergingCallback
            {
                /// <summary>
                /// This handler is called for every mail merge field found in the document,
                ///  for every record found in the data source.
                /// </summary>
                void IFieldMergingCallback.FieldMerging(FieldMergingArgs e)
                {
                    if (mBuilder == null)
                        mBuilder = new DocumentBuilder(e.Document);
    
                    // We decided that we want all boolean values to be output as check box form fields.
                    if (e.FieldValue is bool)
                    {
                        // Move the "cursor" to the current merge field.
                        mBuilder.MoveToMergeField(e.FieldName);
    
                        // It is nice to give names to check boxes. Lets generate a name such as MyField21 or so.
                        string checkBoxName = string.Format("{0}{1}", e.FieldName, e.RecordIndex);
    
                        // Insert a check box.
                        mBuilder.InsertCheckBox(checkBoxName, (bool)e.FieldValue, 0);
    
                        // Nothing else to do for this field.
                        return;
                    }
    
                    // We want to insert html during mail merge.
                    if (e.FieldName == "Body")
                    {
                        mBuilder.MoveToMergeField(e.FieldName);
                        mBuilder.InsertHtml((string)e.FieldValue);
                    }
    
                    // Another example, we want the Subject field to come out as text input form field.
                    if (e.FieldName == "Subject")
                    {
                        mBuilder.MoveToMergeField(e.FieldName);
                        string textInputName = string.Format("{0}{1}", e.FieldName, e.RecordIndex);
                        mBuilder.InsertTextInput(textInputName, TextFormFieldType.Regular, "", (string)e.FieldValue, 0);
                    }
                }
    
                void IFieldMergingCallback.ImageFieldMerging(ImageFieldMergingArgs args)
                {
                    // Do nothing.
                }
    
                private DocumentBuilder mBuilder;
            }
        }
    }
     
    //[VB.NET Code Sample]
     
    
    Imports Microsoft.VisualBasic
    Imports System
    Imports System.IO
    Imports System.Reflection
    Imports Aspose.Words
    Imports Aspose.Words.Fields
    Imports Aspose.Words.MailMerging
    
    Namespace MailMergeFormFields
        ''' <summary>
        ''' This sample shows how to insert check boxes and text input form fields during mail merge into a document.
        ''' </summary>
        Friend Class Program
            ''' <summary>
            ''' The main entry point for the application.
            ''' </summary>
            Public Shared Sub Main(ByVal args() As String)
                Dim program As New Program()
                program.Execute()
            End Sub
    
            Private Sub Execute()
                Dim exeDir As String = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar
                Dim dataDir As String = New Uri(New Uri(exeDir), "../../Data/").LocalPath
    
                ' Load the template document.
                Dim doc As New Document(dataDir & "Template.doc")
    
                ' Setup mail merge event handler to do the custom work.
                doc.MailMerge.FieldMergingCallback = New HandleMergeField()
    
                ' This is the data for mail merge.
                Dim fieldNames() As String = {"RecipientName", "SenderName", "FaxNumber", "PhoneNumber", "Subject", "Body", "Urgent", "ForReview", "PleaseComment"}
                Dim fieldValues() As Object = {"Josh", "Jenny", "123456789", "", "Hello", "<b>HTML Body Test message 1</b>", True, False, True}
    
                ' Execute the mail merge.
                doc.MailMerge.Execute(fieldNames, fieldValues)
    
                ' Save the finished document.
                doc.Save(dataDir & "Template Out.doc")
            End Sub
    
            Private Class HandleMergeField
                Implements IFieldMergingCallback
                ''' <summary>
                ''' This handler is called for every mail merge field found in the document,
                '''  for every record found in the data source.
                ''' </summary>
                Private Sub IFieldMergingCallback_FieldMerging(ByVal e As FieldMergingArgs) Implements IFieldMergingCallback.FieldMerging
                    If mBuilder Is Nothing Then
                        mBuilder = New DocumentBuilder(e.Document)
                    End If
    
                    ' We decided that we want all boolean values to be output as check box form fields.
                    If TypeOf e.FieldValue Is Boolean Then
                        ' Move the "cursor" to the current merge field.
                        mBuilder.MoveToMergeField(e.FieldName)
    
                        ' It is nice to give names to check boxes. Lets generate a name such as MyField21 or so.
                        Dim checkBoxName As String = String.Format("{0}{1}", e.FieldName, e.RecordIndex)
    
                        ' Insert a check box.
                        mBuilder.InsertCheckBox(checkBoxName, CBool(e.FieldValue), 0)
    
                        ' Nothing else to do for this field.
                        Return
                    End If
    
                    ' We want to insert html during mail merge.
                    If e.FieldName = "Body" Then
                        mBuilder.MoveToMergeField(e.FieldName)
                        mBuilder.InsertHtml(DirectCast(e.FieldValue, String))
                    End If
    
                    ' Another example, we want the Subject field to come out as text input form field.
                    If e.FieldName = "Subject" Then
                        mBuilder.MoveToMergeField(e.FieldName)
                        Dim textInputName As String = String.Format("{0}{1}", e.FieldName, e.RecordIndex)
                        mBuilder.InsertTextInput(textInputName, TextFormFieldType.Regular, "", CStr(e.FieldValue), 0)
                    End If
                End Sub
    
                Private Sub ImageFieldMerging(ByVal args As ImageFieldMergingArgs) Implements IFieldMergingCallback.ImageFieldMerging
                    ' Do nothing.
                End Sub
    
                Private mBuilder As DocumentBuilder
            End Class
        End Class
    End Namespace
    
    

    public by cghersi @ Thotpot alumni modified May 4, 2013  302873  0  5  0

    Java: generate hprof during runtime

    To generate hprof may be interesting for debug purpose, most of all before an OutOfMemory occurs on production applications! This .ini option halps to create an hprof to be analyzed before the occurrence of memory errors. See http://docs.oracle.com/javase/7/docs/technotes/samples/hprof.html for further details
    java -Xrunhprof:heap=sites,depth=10,thread=y,doe=y ...other jvm options in ini file...
    • Public Snippets
    • Channels Snippets