Skip to content

Instantly share code, notes, and snippets.

View gonaumov's full-sized avatar
💭
a status

George Naumov gonaumov

💭
a status
View GitHub Profile
// Optional chaining
const test = {
x: {
x: 1
}
}
// undefined
console.log(test?.x?.z?.z);
// TypeError: test.x.z is undefined
/**
* Ох боже. Защо се налага да се правят подобни извратени
* врътки само и само да угодиш на някой дизаинер ...
* В 2:30ч през ноща ..
**/
.starter {
background-color: darkred;
}
.starter ~ tr:not([class=starter]):nth-child(even) {
background-color: blue;
(function() {
const winners = document.querySelector('._54_6._4-ss._4-sv').querySelectorAll('a[data-hovercard]');
winners[10].style.backgroundColor = 'coral';
})()
(function() {
const winners = document.querySelector('._54_6._4-ss._4-sv').querySelectorAll('a[data-hovercard]');
winners[999].style.backgroundColor = 'coral';
})()
public class Main {
/**
* Because it is possible to initialize a char with a
* positive integer number we can made funny things
* with it. For example we can show all letters from
* an alphabet with loop. This example lists all
* hebrew letters. They are between U+05D0 and
* U+05EA.
**/
public static void main(String[] args) {
@gonaumov
gonaumov / push.ps1
Created June 15, 2020 05:14
If you want to push in private repo with another username but you are lazy to do alternative git setup ..
$username = Read-Host "Enter a user name"
$password = Read-Host "Enter a Password" -AsSecureString
$requestPassword = ConvertFrom-SecureString -SecureString $password -AsPlainText
$command = -join(
"git push https://",
[uri]::EscapeDataString($username),
":",
[uri]::EscapeDataString($requestPassword),
"@github.com/userName/projectName.git master"
)
@gonaumov
gonaumov / extractor.sh
Created July 7, 2020 14:21
Email extractor from .txt files
#!/usr/bin/env bash
test -f resuls.json && rm resuls.json ;egrep --include="*.txt" -rwoih '[^[:space:]@]+@[^@[:space:]]+\.[^[:space:]]{2,4}' . | uniq | awk 'BEGIN {printf "There are the following emails found\n"; count=0; print "[" > "resuls.json";out=""} { print $0; count++; out = out "\"" $0 "\",\n" } END {printf "Total %d\n", count; out=substr(out, 1, length(out) - 2); printf "%s\n]",out > "resuls.json"; printf "There are generated json file with them - resuls.json"}'
class User {
String login;
String firstName;
String lastName;
public User(String login, String firstName, String lastName) {
this.login = login;
this.firstName = firstName;
this.lastName = lastName;
}
}
class Car {
int yearModel;
String make;
int speed = 0;
public void accelerate() {
this.speed += 5;
}
public void brake() {
@gonaumov
gonaumov / Main.java
Created September 3, 2020 09:00
The star figure
import java.util.Arrays;
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int size = scanner.nextInt();
char[][] matrix = new char[size][size];
int center = (int) Math.ceil(size / 2.0) - 1;
for (char[] chars : matrix) {