• nginx + apache

    http://devkardia.com/easyblog/virtualmin-apache-and-nginx-reverse-proxy.html

    Read the rest of this entry »


  • GA event tracking

    ga('send','event','lapa','facebook','clicked')
    ga('send','event','title','title2',{'nonInteraction': 1});


  • Fixed Menu

    var nav = jQuery('.secondary-navigation');
    jQuery(window).scroll(function () {
    if (jQuery(this).scrollTop() > 136) {
    nav.css("position","fixed");
    nav.css({"width":(jQuery('#header').width()+'px')}); //header compensation
    jQuery('#header').css("height","136px");
    } else {
    nav.css("position","");
    jQuery('#header').css("height","");
    }
    });


  • Facebook User ID photo

    Large size photo https://graph.facebook.com/{facebookId}/picture?type=large

    Medium size photo https://graph.facebook.com/{facebookId}/picture?type=normal

    Small size photo https://graph.facebook.com/{facebookId}/picture?type=small

    Square photo https://graph.facebook.com/{facebookId}/picture?type=square


  • Scrollable background

    CSS
    html, body{
    height:100%;
    min-height:100%;
    margin:0;
    padding:0;
    }
    .bg{
    width:100%;
    height:100%;
    background: #fff url(..) no-repeat fixed 0 0;
    overflow:auto;
    }
    <div class="bg">
    < span >..< /span >
    </div>

    Javascript
    $('.bg').scroll(function() {
    var x = $(this).scrollTop();
    $(this).css('background-position', '0% ' + parseInt(-x / 10) + 'px');
    });

    Check working example at http://jsfiddle.net/Vbtts/
    Click this link for the full screen example: http://jsfiddle.net/Vbtts/embedded/result/


  • kj

    grep -R 'htaccess' *


  • icecast on 80

    iptables -A PREROUTING -t nat –dst 8.8.8.8/32 -p tcp –dport 80 -j DNAT –to 8.8.8.8:8080

    iptables -A INPUT -p tcp -m state –state NEW –dport 80 –dst 8.8.8.8/32 -j ACCEPT


  • WP shortcode to php output

    functions.php
    function jv($atts){
    $atts = shortcode_atts( array(
    'file' => ''
    ), $atts, 'akcija' );
    ob_start();
    include(ABSPATH.'wp-content/akcija/'.$atts['file'].'.php');
    $content = ob_get_clean();
    return $content;
    }
    add_shortcode('akcija', 'jv');


  • Saglābāt array datubāzē

    <?
    $array = array("foo", "bar", "hello", "world");
    $conn=mysql_connect('localhost', 'mysql_user', 'mysql_password');
    mysql_select_db("mysql_db",$conn);
    $array_string=mysql_escape_string(serialize($array));
    mysql_query("insert into table (column) values($array_string)",$conn);
    ?>
    <?
    $conn=mysql_connect('localhost', 'mysql_user', 'mysql_password');
    mysql_select_db("mysql_db",$conn);
    $q=mysql_query("select column from table",$conn);
    while($rs=mysql_fetch_assoc($q))
    {
    $array= unserialize($rs['column']);
    print_r($array);
    }
    ?>


  • Form Camera Upload

    Image:
    <input type="file" accept="image/*" capture="camera" />
    Video:
    <input type="file" accept="video/*" capture="camera" />