working on it ...

Filters

Explore Public Snippets

Sort by

Found 2.9M snippets

    public by sukhjinderkahlon modified Thursday at 11:57:27 AM  24  1  3  0

    Convert Milliseconds to Time hours, minutes and seconds as String.

    public class Main {
        public static void main(String[] args) {
            long totalTimeInMils=6003000;
            convertMillisToTime(totalTimeInMils);
            
            //Covert from Dates
            String strStartDate = "2018/08/16 17:10:00";
            String strEndDate = "2018/08/16 17:20:01";
    
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
            Date date = sdf.parse(strStartDate);
            Date endDate = sdf.parse(strEndDate);
            
            long millis = (endDate.getTime()- date.getTime());
            convertMillisToTime(millis);
    
        }
    
        public static String convertMillisToTime(long Millis){
            String convert = String.format("Total Time Taken: %d hour(s), %d minute(s), and %d second(s)",
                    Millis/(1000*60*60), (Millis%(1000*60*60))/(1000*60), ((Millis%(1000*60*60))%(1000*60))/1000);
            System.out.println(convert);
            return convert;
        }
    }
    						

    public by DinhoPutz modified Tuesday at 7:27:18 PM  33  0  2  0

    Remover caracteres especiais e quebra-linhas de um resultado em uma tabela

    Substituir o texto, na verdade, por outra coisa, seja por nada ou por um espaço vazio, talvez. Ideal para resolver aqueles problema na exportação de um resultado para CSV para deve ser aberto no Excel e aquele maldito ponto e vírgula (;) acaba levando parte do texto para outra coluna. Aqui também removemos tabulações, quebralinhas e outros.
    SELECT
    REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(nomeDaColuna,CHAR(13) + Char(10) ,''), CHAR(10), ''), CHAR(13), ''), CHAR(9), ''),';','-'),'  ', ' ') as 'Um nome novo e legal' 
    FROM NOMEDATABELA

    public by Hlinh modified Aug 8, 2018  115  0  3  0

    Frontend Cms Page Builder Magento 2 Extension

    New Front-end CMS Page builder is an extension allowing you to edit CMS pages effortlessly and visually at front-end. With drag and drop interface & 30 + builder elements supported, everything has become very visual. Our Cms page builder is created to work with any kind of magento 2 theme, regardless of it is free or commercial theme. Get details:
    https://www.magesolution.com/front-end-cms-page-builder.html					

    public by Hlinh modified Aug 7, 2018  133  0  3  0

    Magento Shop by Brand extension

    Magento Shop by Brand extension allows administrator to create a brand listing page and brand details pages that show/ filter all products of a brand. Moreover, the admin obtains another opportunity to decorate the home page by adding a brands slider using ready-to-use widget... Get details: https://www.magesolution.com/shop-by-brands.html
    https://www.magesolution.com/shop-by-brands.html				

    public by marceloviana modified Aug 4, 2018  173  0  2  0

    Percorrer json

    foreach (var keyvalue in context_id)
            {
    
                
                text = text + "</br><b>" + keyvalue.Name + "</b>  " + keyvalue.Value;
            }

    public by Hlinh modified Aug 3, 2018  162  0  3  0

    Magento product questions extension

    Magento product questions extension allows customers to ask questions and receive answers on product pages, like or dislike questions and answers. Customers can also search and see all questions, answers on FAQs page. Get details: https://www.magesolution.com/product-questions.html
    https://www.magesolution.com/product-questions.html				

    public by gwarah modified Aug 1, 2018  354  1  4  0

    Is a file in a directory tree?

    This script is a shell function that performs exactly this, even if the parameters are symbolic links and/or relative directories. See "How to Use" section to install this snippet
    #!/bin/bash
    # /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    # * File       : dircontains.sh
    # * Goal       : checks if <parent> direcory contains <file>
    # * Requisites :
    # *     1. SHELL=bash
    # * History    :
    # *   #version;date;description
    # *   0.2.0; 29/07/2018; now can check if any kind of file is in <parent>
    # *   0.1.0; 27/07/2018; first release (tested in bash environment)
    # */
    
    #
    # Tested in: ubuntu 16.04/bash
    #
    
    #
    # How to use
    #
    # 1. put this script into a directory (Ex: ~/scripts)
    #
    # 2. insert this code in your ~/.bashrc:
    # . ~/scripts/dircontains.sh
    #
    # 3. open a new shell session and test it:
    #
    # dircontains <dir_parent> <file>
    #
    # 4.
    # the result is in $? var
    # $1=0, <file> is in <dir_parent>
    # $1=1, <file> is not in <dir_parent>
    # $1=2, error
    #
    
    function dircontains_syntax {
        local msg=$1
        echo "${msg}" >&2
        echo "syntax: dircontains <parent> <file>" >&2
        return 1
    }
    
    function dircontains {
        local result=1
        local parent=""
        local parent_pwd=""
        local child=""
        local child_dir=""
        local child_pwd=""
        local curdir="$(pwd)"
        local v_aux=""
    
        # parameters checking
        if [ $# -ne 2 ]; then
            dircontains_syntax "exactly 2 parameters required"
            return 2
        fi
        parent="${1}"
        child="${2}"
        
        # exchange to absolute path
        parent="$(readlink -f "${parent}")"
        child="$(readlink -f "${child}")"
        dir_child="${child}"
    
        # file/directory checking
        if [ ! -d "${parent}" ];  then
            dircontains_syntax "parent dir ${parent} not a directory or doesn't exist"
            return 2
        elif [ ! -e "${child}" ];  then
            dircontains_syntax "file ${child} not found"
            return 2
        elif [ ! -d "${child}" ];  then
            # not directory? get the path of file
            dir_child=`dirname "${child}"`
        fi
    
        # get directories from $(pwd)
        cd "${parent}"
        parent_pwd="$(pwd)"
        cd "${curdir}"  # to avoid errors due relative paths
        cd "${dir_child}"
        child_pwd="$(pwd)"
    
        # checking if is parent
        [ "${child_pwd:0:${#parent_pwd}}" = "${parent_pwd}" ] && result=0
    
        # return to current directory
        cd "${curdir}"
        return $result
    }

    public by Hlinh modified Jul 30, 2018  236  0  4  0

    Magento Advanced Reports

    Magento Advanced Reports brings 8 report options for you. With this Magento extension you can easily check reports of products, customers, orders... in the back-end of your Magento site. It's designed and developed to help you have the perfect solutions for your reporting with visual charts and tables. Get details: https://www.magesolution.com/mag
    https://www.magesolution.com/magento-advanced-reports.html					

    public by fernandopetryy modified Jul 29, 2018  578  0  4  0

    Save Valuation

    valuation[rating]:1
    valuation[goal]:1
    valuation[valuation_date]:1470970800
    valuation[valuer_id]:1
    valuation[user_id]:1
    valuation[user_id]:1
    valuation[valuation_value]:48500
    valuation[proposed_value]:100
    valuation[fipe_value]:49237.00
    valuation[sales_avg_entitie]:0.00
    valuation[valuation_obs]:teste
    vehicle[plate]:GBE1039
    vehicle[renavam]:01067097993
    vehicle[kind]:Carro
    vehicle[manufacture_year]:2015
    vehicle[year]:2015
    vehicle[month]:2
    vehicle[origin]:NACIONAL
    vehicle[transmission]:Automático
    vehicle[version]:1.6 PREMIUM 16V FLEX 4P AUTOMÁTICO
    vehicle[model]:HB20
    vehicle[make]:HYUNDAI
    vehicle[fuel]:FLEX
    vehicle[doors]:4
    vehicle[color]:BRANCO
    vehicle[mileage]:10000
    vehicle[engine]:1.6
    vehicle[vin]:9BHBH51DBFP488638
    client[name]:Cliente Costa
    client[email]:nome@hotmail.com
    client[phone_number]:4891200620
    items[0][rating]:3
    items[0][expenses_value]:0.00
    items[0][item]:Motor
    items[1][rating]:2
    items[1][expenses_value]:0.00
    items[1][item]:Ar Condicionado
    items[2][rating]:2
    items[2][expenses_value]:100.00
    items[2][item]:Lataria
    items[3][rating]:3
    items[3][obs]:teste
    items[3][expenses_value]:0.00
    items[3][item]:Luz de Injeção
    optionals[0]:Acendedor de Cigarros
    optionals[1]:Aerofólio
    optionals[2]:Air Bag Duplo
    optionals[3]:Air bag
    optionals[4]:Air bags
    optionals[5]:Airbag (Só Motorista)
    optionals[6]:Alarme
    optionals[7]:Alarme a Distância
    optionals[8]:Ar Condicionado
    optionals[9]:Ar Quente
    optionals[10]:Banco do motorista com ajuste de altura
    optionals[11]:Bancos de Couro
    optionals[12]:Blindagem
    optionals[13]:Bloqueador a Distância
    optionals[14]:Calotas
    optionals[15]:Camera de Re
    optionals[16]:Capota Maritima
    optionals[17]:CD Player
    optionals[18]:CD Player MP3
    optionals[19]:Chave de Roda
    optionals[20]:Chave Reserva
    optionals[21]:Computador de Bordo
    optionals[22]:Controle de tração
    optionals[23]:Desembaçador Traseiro
    optionals[24]:Direção Elétrica
    optionals[25]:Direção Hidráulica
    optionals[26]:Disqueteira
    optionals[27]:DVD
    optionals[28]:Engate
    optionals[29]:Espelhos Elétricos
    optionals[30]:Estepe
    optionals[31]:Extintor
    optionals[32]:Farol de Milha / Neblina
    optionals[33]:Farol de Xenon
    optionals[34]:Freios ABS
    optionals[35]:Insulfilm
    optionals[36]:Kit Gas(GNV)
    optionals[37]:Kit Multimídia (GPS DVD)
    optionals[38]:Kit SOS
    optionals[39]:Limpador e Desembaçador Traseiro
    optionals[40]:Limpador Traseiro
    optionals[41]:Lona Marítima
    optionals[42]:Macaco
    optionals[43]:Manual
    optionals[44]:Piloto Automático
    optionals[45]:Pneu Reserva 0 Km
    optionals[46]:Protetor de Motor e Cárter
    optionals[47]:Protetor de caçamba
    optionals[48]:Rastreador
    optionals[49]:Rodas de Liga Leve
    optionals[50]:Rádio AM/FM
    optionals[51]:Sensor De Ré
    optionals[52]:Santo Antônio
    optionals[53]:Sensor de chuva
    optionals[54]:Spoilers
    optionals[55]:Tacogafro
    optionals[56]:Teto Solar
    optionals[57]:Toca Fitas
    optionals[58]:Trava Central
    optionals[59]:Trava Elétrica
    optionals[60]:Travamento Portas
    optionals[61]:Tração 4x4
    optionals[62]:Triangulo
    optionals[63]:Vidro Eletrico Dianteiro
    optionals[64]:Vidro Eletrico Traseiro
    optionals[65]:Vidros Verdes
    optionals[66]:Volante com regulagem de altura
    references[0][reference]:AutoAvaliar Compra
    references[0][type]:1
    references[0][flag_optionals]:1
    references[0][min_value]:34300
    references[0][avg_value]:42557
    references[0][max_value]:50000
    references[1][reference]:Loja
    references[1][type]:1
    references[1][flag_optionals]:1
    references[2][reference]:Grupo
    references[2][type]:1
    references[2][flag_optionals]:1
    references[3][reference]:AutoAvaliar Compra
    references[3][type]:1
    references[3][min_value]:34300
    references[3][avg_value]:42557
    references[3][max_value]:50000
    references[4][reference]:Loja
    references[4][type]:1
    references[5][reference]:Grupo
    references[5][type]:1
    references[6][reference]:Web
    references[6][type]:2
    references[6][flag_optionals]:1
    references[6][min_value]:49990
    references[6][avg_value]:49990
    references[6][max_value]:49990
    references[7][reference]:AutoAvaliar Venda
    references[7][type]:2
    references[7][flag_optionals]:1
    references[7][min_value]:28000
    references[7][avg_value]:28000
    references[7][max_value]:28000
    references[8][reference]:Loja
    references[8][type]:2
    references[8][flag_optionals]:1
    references[9][reference]:Grupo
    references[9][type]:2
    references[9][flag_optionals]:1
    references[10][reference]:Web
    references[10][type]:2
    references[10][min_value]:46900
    references[10][avg_value]:50140
    references[10][max_value]:54900
    references[11][reference]:AutoAvaliar Venda
    references[11][type]:2
    references[11][min_value]:28000
    references[11][avg_value]:28000
    references[11][max_value]:28000
    references[12][reference]:Loja
    references[12][type]:2
    references[13][reference]:Grupo
    references[13][type]:2
    questions[1][id]:31
    questions[1][answer]:0
    questions[2][id]:32
    questions[2][answer]:1

    public by Hlinh modified Jul 28, 2018  294  0  4  0

    Mega Menu For Magento

    Magento Mega Menu changes the way main menu displays. It allows you to have multiple options to show what you want on the main navigation. Magento Mega Menu is developed and optimized to allow both user and admin who don’t need to be developers themselves to manage effortlessly all information which they want to show on main navigation of a Magent
    https://www.magesolution.com/mgs-mega-menu.html	
    • Public Snippets
    • Channels Snippets