Javascript snippets

For break Classical for loop.. nothing to talk about it. Some loop The some() method tests whether at least one element in the array passes the test implemented by the provided function. It returns true if, in the array, it finds an element for which the provided function returns true; Read more…

Splice

The splice() method changes the contents of an array by removing or replacing existing elements and/or adding new elements in place. More info: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice

Clean files content

Useful command to clean all files content of a directory without removing it… Use cases: you have an application running and you don’t want to stop you don’t want to think about reset file permission that somebody else has configured in a bad way

SQL server

Select query for production (nolock) Table lock simulation Backup Command line database backup using SqlCmd tool (localhost database) Restore Command line database restore using SqlCmd tool (localhost database) Link tablespace to filegroup Get active connection Try catch block Ram by database Ram by tables Shrink database Table count and dimensions Read more…

Postgres

Clone a database with an existing local one Connect to the database with a user with proper right and make sure that the sourcedb does not have opened connection. Database dump Database restore Get table fields Try catch block

Git cherry pic

Sometimes you need to move your develop from a branch to another; in this case the cherry pick command is your friend. Definition: given one or more existing commits, apply the change each one introduces, recording a new commit for each. This requires your working tree to be clean (no Read more…