working on it ...

Filters

Explore InChannel Snippets

Sort by

Found 500 snippets

    public by pleabargain modified 8 hours ago  9  2  3  0

    javascript output to console current full date as text

    // Enter here the actual content of the snippet.
    // Array of day names
    let dayNames = new Array("Sunday","Monday","Tuesday","Wednesday",
    				"Thursday","Friday","Saturday");
    
    // Array of month Names
    let monthNames = new Array(
    "January","February","March","April","May","June","July",
    "August","September","October","November","December");
    
    let now = new Date();
    console.log(dayNames[now.getDay()] + ", " +
    monthNames[now.getMonth()] +
    " " + now.getDate() +
    ", " + now.getFullYear());
    //output ~ Sunday, February 19, 2017
    

    public by hamidmousavi modified 20 hours ago  8  0  3  0

    This method will return WebElement After Given wait

    // This method will return WebElement After Given wait           
    public static WebElement FindWithWait(WebDriver driver,By locator, int seconds) throws Exception{
    		// Sleep until the Element we want is visible or n seconds is over
    		WebElement element=null;
    		
    		//Because if implict wait is set then fluint wait will not work
    		driver.manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
    		try{
    					FluentWait<WebDriver> fluentWait = new FluentWait<WebDriver>(driver)
    							.withTimeout(seconds, TimeUnit.SECONDS)
    							.pollingEvery(200, TimeUnit.MILLISECONDS)
    							.ignoring(NoSuchElementException.class)
    							.ignoring(StaleElementReferenceException.class)
    							.ignoring(WebDriverException.class);
    									 
    				element=fluentWait.until(
    							
    							ExpectedConditions.visibilityOfElementLocated(locator)
    							
    							);
    				return element;
    					
    		} catch(Exception e){
    			
    			throw new Exception("Timeout reached when searching for element! Time: " + seconds+" seconds " +"\n" +e.getMessage());
    			
    		}
    		finally {
    			driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    		}
    		
    	}

    public by pleabargain modified yesterday at 3:46:06 PM  7  0  3  0

    add all function arguments together

    function sum(){
    	let result =0;
    	//loop through all of the values in func args
      for (i =0; i < arguments.length;i++){
        //now add them toghether
    		result += arguments[i];	
    	
    	}
    	return result;
    }
    sum(34,34,236,32);

    public by maholtz modified Wednesday at 2:12:16 PM  12  0  3  0

    Wert einer Zelle relativ zur aktuellen Zelle

    Mit der folgenden Formel kann in Google Tabellen ein Wert aus einer anderen Zelle verwendet werden, die um X-Zeilen und Y-Spalten von der aktuellen Zelle versetzt sind.
    // ROW() Gibt die aktuelle Zeile zurück
    // COLUMN() die aktuelle Spalte zurück, allerdings als Zahl, nicht als Buchstaben
    //
    // Der Wert der gewünschten Zelle, die also eine bestimmte Anzahl
    // an Zeilen und Spalten versetzt ist, kann entsprechend mit 
    // ROW()-2 und COLUMN()-4 gewählt werden
    // 
    // via concatenate wird ein Sting in der Form "R41C4" erzeugt,
    // die Schreibweise kann dann an die Funktion indirect übergeben 
    // werden (Parameter FALSE!) und gibt dann den Wert aus.
    //
    // Der Wert kann dann weiter verarbeitet werden.
    indirect(concatenate("R";ROW()-2;"C";COLUMN()-4);FALSE)

    public by JavierSalazar modified Tuesday at 7:31:39 PM  18  3  2  0

    Pasar varios datos con ajax (Metodo POST)

    Pasar varios datos con ajax (Metodo POST)y es recibido por archivo php con la variable $_POST
    $.ajax(
    {
            url: "<?=resApi;?>procesarProducto.php",
            type: "post",
            dataType: "html",
            data: ({accion: "transferir",subaccion: "buscarStockSucursal", codigoprod: producto, sucursal: sucursal}),
            cache: false,
    })
        .done(function(res)
        {alert(res);}  

    public by maholtz modified Feb 9, 2017  14  0  3  0

    Bestimmte Zeile im CSV finden

    Für Notepad++ - Zeilen mit bestimmten Inhalt in CSV Suchen bzw. Zeile löschen (Ersetzen durch nichts)
    // Für Notepad++
    // Regulärer Ausdruck um in einer CSV-Datei eine Zeile mit dem Wert 'abcd' zu finden
    // Spalte ist dabei egal, Zeilenende mit Windows-Umbruch \r\n
    
    // Reguläre Ausdrücke aktivieren und [x] findet \r und \n aktivieren
    ^[^\r]*'abcd';[^\r]*\r\n

    public by waxmiguel modified Feb 1, 2017  39  0  3  1

    tortouise

    # TortoiseGit 
    
    $Global:TortoiseGitSettings = new-object PSObject -Property @{
      TortoiseGitPath = "C:\Program Files\TortoiseGit\bin\TortoiseProc.exe"
    }
    
    function tgit {
       if($args) {
        if($args[0] -eq "help") {
          # Replace the built-in help behaviour with just a list of commands
          $tortoiseGitCommands
          return    
        }
    
        $newArgs = @()
        $newArgs += "/command:" + $args[0]
        
        $cmd = $args[0]
        
        if($args.length -gt 1) {
          $args[1..$args.length] | % { $newArgs += $_ }
        }
          
        & $Global:TortoiseGitSettings.TortoiseGitPath $newArgs
      }
    }
    
    $tortoiseGitCommands = @(
    "about",
    "log",
    "commit",
    "add",
    "revert",
    "cleanup" ,
    "resolve",
    "switch",
    "export",
    "merge",
    "settings",
    "remove",
    "rename",
    "diff",
    "conflicteditor",
    "help",
    "ignore",
    "blame",
    "cat",
    "createpatch",
    "pull",
    "push",
    "rebase",
    "stashsave",
    "stashapply",
    "subadd",
    "subupdate",
    "subsync",
    "reflog",
    "refbrowse",
    "sync"
    ) | sort
    

    public by Tech_JA modified Jan 30, 2017  59  1  4  1

    Log file

    Create a log fle
    var util = require('util');
    
    var writeToLog;
    
    var logFile = fs.createWriteStream('./NomeDoFicheiro.log', { flags: 'a+' });
    
    writeToLog = function () {
        logFile.write( util.format.apply(null, arguments) + '\r\n');
    };
    
    writeToLog("teste");         

    public by Tech_JA modified Jan 30, 2017  54  2  4  1

    Detects if enter key was pressed

    Detects if enter key was pressed
    $(document).keypress(function (e) {
        if (e.which === 13) {
            if (eventEnter === 'addCategory') {
               // alert('You pressed Add Category!');
                categories_add_btn();
            }
            if (eventEnter === 'editCategory') {
                //alert('You pressed Edit Category!');
                categories_edit_btn();
            }
            if (eventEnter === 'addManufacturer') {
                //alert('You pressed Add Manufacturer!');
                manufacturers_add_btn();
            }
            if (eventEnter === 'editManufacturer') {
                //alert('You pressed Edit Manufacturer!');
                manufacturers_edit_btn();
            }
            if (eventEnter === 'addSupplier') {
                //alert('You pressed Add Supplier!');
                suppliers_add_btn();
            }
            if (eventEnter === 'editSupplier') {
                //alert('You pressed Edit Supplier!');
                suppliers_edit_btn();
            }
            if (eventEnter === 'addPart') {
                //alert('You pressed Add Part!');
                parts_add_btn();
            }
            if (eventEnter === 'editPart') {
                //alert('You pressed Edit Part!');
                parts_edit_btn();
            }
        }
    });            

    public by Tech_JA modified Jan 30, 2017  23  1  3  1

    Delay function

    Function to wait xxx ms
    //function to wait xxx ms
    function wait(ms) {
        'use strict';
        var start = new Date().getTime();
        var end = start;
        while (end < start + ms) {
            end = new Date().getTime();
        }
    }
    
    //example for 1s
    wait(1000);           
    • Public Snippets
    • Channels Snippets