This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
postgres: | |
image: postgres | |
environment: | |
POSTGRES_PASSWORD: test1234 | |
POSTGRES_USER: noud | |
restart: always | |
ports: | |
- 5432:5432 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const filteredArray = arr => arr.filter((item, idx, arr) => arr.indexOf(item) === idx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getSplittedArray(arr) { | |
const first = arr.length % 2 === 0 | |
? arr.splice(0, (arr.length/2)) | |
: arr.splice(0, (arr.length/2 + 1)) | |
const second = arr | |
return [first, second] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT [email_column], SUBSTRING([email_column], POSITION('@' IN [email_column]) + 1) AS domain_name | |
FROM [table] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- delete | |
drop table message; | |
drop table email; | |
drop table product; | |
drop table feed; | |
drop table account; | |
create table account ( | |
account_id SERIAL PRIMARY KEY not null, | |
name varchar(255) not null, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// INTERFACE: | |
public interface ILogger { | |
public static void error(String msg, Object obj) { | |
System.out.println(msg + " " + obj.toString()); | |
} | |
public static void warning(String msg, Object obj) { | |
System.out.println(msg + " " + obj.toString()); | |
} | |
public static void info(String msg, Object obj) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// INTERFACE: | |
public interface ILogger { | |
public static void error(String msg, Object obj) { | |
System.out.println(msg + " " + obj.toString()); | |
} | |
public static void warning(String msg, Object obj) { | |
System.out.println(msg + " " + obj.toString()); | |
} | |
public static void info(String msg, Object obj) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getRandomString(wishedIdLength) { | |
var result = ''; | |
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789=-[]\|'; | |
var charactersLength = characters.length; | |
for (let i = 0; i < wishedIdLength; i++ ) { | |
result += characters.charAt(Math.floor(Math.random() * charactersLength)); | |
} | |
return result; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Math.floor(Math.random() * 16777215).toString(16) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const timestamp = (new Date().getTime() / 1000 | 0).toString(16); | |
const uniqueTimeStampId = (stamp) => stamp + 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, () => (Math.random() * 16 | 0).toString(16)).toLowerCase() |