Skip to content

Instantly share code, notes, and snippets.

View Nikolay995's full-sized avatar

Nikolay Kondratenko Nikolay995

  • Ukraine, Kyiv
View GitHub Profile
@Nikolay995
Nikolay995 / links.md
Created June 13, 2018 08:12
Useful links :D
@Nikolay995
Nikolay995 / git2.md
Created April 16, 2018 17:00
More Git Commands :D

A little lookup for commands I use frequently

  • Commit all edited files and add a message

git commit -a -m "My commit"

  • Add all new files

git add .

@Nikolay995
Nikolay995 / git.md
Created April 16, 2018 16:58
Git commands

Git Commands

--

Getting & Creating Projects

Command Description
git init Initialize a local Git repository
git clone ssh://git@github.com/[username]/[repository-name].git Create a local copy of a remote repository
@Nikolay995
Nikolay995 / InetWork.java
Created April 16, 2018 16:56
Save content to file using URLConnection and byte buffers
public class InetWork {
public static void saveToFile(String address, File folder) {
try {
URL url = new URL(address); //установка соединения
HttpURLConnection connection = (HttpURLConnection) url.openConnection(); //возможность доступа
InputStream is = connection.getInputStream(); //поток
int n = address.lastIndexOf("/"); //после последнего слеша будет имя файла
String fileName = address.substring(n + 1); //записываем сюда имя файла
File file = new File(folder, fileName); //сохраняем в каталоге фолдер с именем файлНейм
OutputStream os = new FileOutputStream(file);
@Nikolay995
Nikolay995 / idea_cheatsheet.md
Last active April 16, 2018 14:02
Intellij IDEA - Cheat Sheet

Intellij IDEA - Cheat Sheet (aka my most used shortcuts)

Search/Replace

  • Double-press Shift - Search everywhere

Editing

  • Alt + J - Select the next occurrence (Sublime Text Style)
  • Shift + Ctrl + Alt + J - Select all occurrences
@Nikolay995
Nikolay995 / sublime-text-3-windows-shortcuts.md
Created April 16, 2018 14:00
Sublime Text 3 - Useful Shortcuts (Windows)

Sublime Text 3 - Useful Shortcuts (Windows)

General

Shortcut Description
Ctrl+Shift+P command prompt
Ctrl+Alt+P switch project
Ctrl+P go to file
Ctrl+G go to line
@Nikolay995
Nikolay995 / FindFactorial.java
Created April 2, 2018 16:08
The simplest factorial algorithm in Java
public class FindFactorial {
public static void main(String[] args) {
System.out.println(factorial(5));
}
private static int factorial(int x){
return (x == 1 ? 1 : x*factorial(x-1));
}
}
@Nikolay995
Nikolay995 / PrintfExample.java
Last active March 30, 2018 15:06
Java Printf Example
public class PrintfExample {
public static void main(String[] args) {
int a = 5;
String b = "five";
System.out.printf("A equals %d, and B equals %s", a , b);
}
}