Rss Feed
  1. HTML CSS Box Container

    Friday, 4 April 2014

    <!DOCTYPE html>
    <html>
    <head>
    <script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
      <script class="jsbin" src="http://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js"></script>
    <meta charset=utf-8 />
    <title>JS Bin</title>
    <!--[if IE]>
      <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <style>
      article, aside, figure, footer, header, hgroup,
      menu, nav, section { display: block; }
      #modal {
        width: 600px;
        border: 1px solid #CCC;
        box-shadow: 0 1px 5px #CCC;
        border-radius: 5px;
        font-family: verdana;
        margin: 25px auto;
        overflow: hidden;
      }
      #modal header {
        background: #f1f1f1;
        background-image: -webkit-linear-gradient( top, #f1f1f1, #CCC );
        background-image: -ms-linear-gradient( top, #f1f1f1, #CCC );
        background-image: -moz-linear-gradient( top, #f1f1f1, #CCC );
        background-image: -o-linear-gradient( top, #f1f1f1, #CCC );
        box-shadow: 0 1px 2px #888;
        padding: 10px;
      }
      #modal h1 {
        padding: 0;
        margin: 0;
        font-size: 16px;
        font-weight: normal;
        text-shadow: 0 1px 2px white;
        color: #888;
        text-align: center;
      }
      #modal section {
        padding: 10px 30px;
        font-size: 12px;
        line-height: 175%;
        color: #333;
      }
    </style>
    </head>
    <body>
     
      <div id="modal">
        <header><h1>Something Here</h1></header>
        <section>
          <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
          <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
          <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
        </section>
      </div>
     
    </body>
    </html>

    Demo:
    http://jsbin.com/ogesuf/5/edit

  2. Increase and Test Page Speed

    Thursday, 3 April 2014

    To test page speed and optimization

    https://developers.google.com/speed/pagespeed/
    https://developers.google.com/speed/docs/insights/MinifyResources

    Tips to increase website speed

    http://sixrevisions.com/web-development/decrease-webpage-load-times/

    http://moz.com/blog/15-tips-to-speed-up-your-website

    http://www.webdesignerdepot.com/2013/02/how-to-speed-up-your-website-load-times/

    YUI compressor Usage

    http://chris-barr.com/2008/12/how_to_use_the_yui_compressor/

  3. <ifModule mod_gzip.c>
    mod_gzip_on Yes
    mod_gzip_dechunk Yes
    mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
    mod_gzip_item_include handler ^cgi-script$
    mod_gzip_item_include mime ^text/.*
    mod_gzip_item_include mime ^application/x-javascript.*
    mod_gzip_item_exclude mime ^image/.*
    mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
    </ifModule>

    Add this code in .htaccess file to enablr Gzip compression

    Links:

    http://www.feedthebot.com/pagespeed/enable-compression.html
    http://gtmetrix.com/enable-gzip-compression.html
    http://checkgzipcompression.com/


  4. CSS browser selector

    Friday, 17 May 2013


    For Firefox
    <style type="text/css">
    @-moz-document url-prefix() {
      .example {
       
        width: 960px;
    }
    }
    .ie .main_navi ul {
       width: 965px;
    }
    </style>

    For ie
    <!--[if IE]>
    <style type="text/css">
    .example {
       
        width: 965px;
    }
    </style>
    <![endif]-->


  5. Treat mysql longtext as integer in query

    SELECT  * FROM    mytable ORDER BY  myfield + 0


  6. <script>
      // A jQuery based placeholder polyfill
    $(document).ready(function(){
      function add() {
        if($(this).val() === ''){
          $(this).val($(this).attr('placeholder')).addClass('placeholder');
        }
      }

      function remove() {
        if($(this).val() === $(this).attr('placeholder')){
          $(this).val('').removeClass('placeholder');
        }
      }

      // Create a dummy element for feature detection
      if (!('placeholder' in $('<input>')[0])) {

        // Select the elements that have a placeholder attribute
        $('input[placeholder], textarea[placeholder]').blur(add).focus(remove).each(add);

        // Remove the placeholder text before the form is submitted
        $('form').submit(function(){
          $(this).find('input[placeholder], textarea[placeholder]').each(remove);
        });
      }
    });
     
      </script>

  7. Rewrite URL in cakephp core.php

    Friday, 3 May 2013

    Add this code in core.php

    Configure::write('baseUrl', 'http://localhost:9090/cakefoodnew/');