Turn existing folder into git repository

First of all let me write about initial conditions:

  • I have folder on my computer’s disk with code
  • I have a new empty repository on github

Our great plan consists of following points:

  1. Navigate to project folder:
    • $ cd /path/to/project
  2. Add files to the repository:
    • $ git init
    • $ git add . (don’t forget about point sign)
    • $ git commit -m “first commit”
  3. After we have to connect to our remote repository:
    • $ git remote add origin https://github.com/mygitaccount/mynewproj.git
  4. Push files on remote server and create new branch “master” on our new github repository
    • $ git push -u origin master
  5. Last thing, type the following command:
    • $ git push

Now all your files in github repository, congratulations!
If you want to check current state type
$ git status – it shows active branch, and other useful information.
$ git branch – shows all available branches

Links:
https://git-scm.com/doc
https://wiki.epfl.ch/help-git-en/how-can-i-import-an-existing-folder-into-my-repository

Kotlin. Я учусь. setContentView

Как задать нужный экран (view) для activity?

1. В AndroidManifest.xml я должен указать имя класса, который будет отвечать за эту activity:

<activity android:name=".MainActivity">

2. В классе MainActivity в методе onCreate нужно вызвать метод setContentView:

setContentView(R.layout.activity_main)

Таймер Табата

Весна 2020. В мире пандемия короновируса, который вызвал кризис, последствия которого никто предсказать не может.

На данный момент жители многих стран вынуждены сидеть дома на карантине / в самоизоляции. Закрыты многие кафе, спортзалы, другие общественные места.

В принципе, в самоизоляции можно найти плюсы. Я например, решил, что не хочу терять физическую форму, находясь дома, поэтому занимаюсь табатой – интенсивными интервальными тренировками.

Более того, я смог с помощью этих тренировок сбросить около 5ти килограмм.

На волне такого успеха (а для меня это успех) я решил написать свой табата-таймер.
В планах:
1. добавить английский язык
2. сохранение тренировок (последовательность упражнений)
3. галерея упражнений
4. мобильное приложение (ууух!)

Сейчас же таймер может быть запущен сразу на один круг, либо можно настроить под свою индивидуальную тренировку

Medium underline style

Interesting approach to draw underline from medium by Martin Wichary
text-decoration: none;
background-repeat: repeat-x;
background-image: linear-gradient(to right,rgba(0,0,0,.84) 100%,rgba(0,0,0,0) 0);
background-image: linear-gradient(to right,currentColor 100%,currentColor 0);
background-image: url(data:image/svg+xml;utf8,);
background-size: 1px 1px;
background-position: 0 1.05em;
background-position: 0 calc(1em + 1px);

Javascript Singleton

Ссылки на хорошие материалы по реализации данного паттерна.

singletone

var Singletone = (function () {
	var instance;

	return function Construct_singletone () {
		if (instance) {
			return instance;
		}
		if (this && this.constructor === Construct_singletone) {
			instance = this;
		} else {
			return new Construct_singletone();
		}
	}
}());

И еще:
medium

SCRoulette BUG fixing

Hello everybody!

It’s great to see how you use SCRoulette! More than 60 users.  Great! I see a lot of music. But… there is no limit to perfection. And today I found a bug.

Everybody can add in roulette non-private songs. Also it is possible to delete song from SCRoulette. But when somebody adds song in roulette and delete this song from SoundCloud profile I can not manage this. Also the owner of the deleted song may forget about his/her music in SCRoulette. So, I decided that it is right to delete song if it doesn’t exist. Thankfully to SoundCloud API I can find not existing tracks.

When somebody will start session and if he/she will find not existing track, this track will be deleted, and after a second another track will be available for listening.