Skip to content

Instantly share code, notes, and snippets.

View shershen08's full-sized avatar

Mikhail Kuznetcov shershen08

View GitHub Profile
@shershen08
shershen08 / Android-studio-app-development.md
Last active November 10, 2016 17:24
Android app development for frontend developers

UI

Showing Toast
  Button linkBtn = (Button) findViewById(R.id.button_toast);
        linkBtn.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Toast.makeText(GolfcourseDetailActivity.this, "Here's your toast!",
                        Toast.LENGTH_LONG).show();
            }
@shershen08
shershen08 / basics.java.md
Last active January 9, 2019 20:37
Java basics

Array and List Array

 //Initializing Boolean array;
 Boolean[] BooleanArray;

 //Initializing Boolean array list;
 List<Boolean> BooleanArrayList = new ArrayList<>();

//add items in list
@shershen08
shershen08 / Holland-links-RU.md
Last active June 14, 2016 11:36
Ссылки по голландии
@shershen08
shershen08 / angular-filter-utils.js
Created August 13, 2016 08:39
Angular1 custom filters
angular.module('myApp', [])
/**
* concat
* transforms array [a,b,c] to a template string list 'a,b,c'
* */
.filter('concat', function() {
return function(input, property) {
var out = '';
for (var i = 0; i < input.length; i++) {
out += input[i][property] ? input[i][property] : input[i];
@shershen08
shershen08 / typescript-strategy-and-factory-patterns.ts
Last active October 19, 2022 17:08
Strategy and factory patterns in TypeScript
// see article with examples in JAVA here: https://dzone.com/articles/design-patterns-the-strategy-and-factory-patterns
// example for educational purposes shownig close and mature syntax of modern TypeScript
enum AccountTypes {CURRENT, SAVINGS, HIGH_ROLLER_MONEY_MARKET, STANDARD_MONEY_MARKET}
////////////////////////////////////////
/// the interface that is used by the strategy
////////////////////////////////////////
interface InterestCalculationStrategy {
@shershen08
shershen08 / index.js
Created January 7, 2017 22:05
Weather forecast from IP recipe
const request = require('request');
const APIKEY = require('./weather_apikey'); //file with '{"key": "XXX"}'
const ip = '208.67.222.222';
const getLatLng = (ip) => {
const url = `https://ipapi.co/${ip}/latlong/`;
request.get(url)
.on('response', function (response) {
if (response.statusCode == 200) getWeather(response.body);
@shershen08
shershen08 / vuejs-component-style-guide-russian.md
Last active March 5, 2017 20:16
Правила разработки компонетов Vue
  • Модульная разработка
  • Наименование копонентов vue
  • Выражения в компонентах должны быть простыми
  • Оставляйте свойства простыми
  • Правильно используйте свойства компонента
  • Определяйте this как component
  • Структура компонента
  • Именование событий
  • Избегайте this.$parent
  • Используйте this.$refs осторожно
@shershen08
shershen08 / yandex-rss-to-read.py
Created March 6, 2017 16:36
Читалка ленты новостей Яндекс
#!/usr/bin/python
# -*- coding: UTF-8 -*-
from time import gmtime, strftime
import locale
import feedparser
from gtts import gTTS
from time import sleep
import os
import pyglet
@shershen08
shershen08 / rss-reader-v2.py
Created March 6, 2017 17:02
Class-based RSS reader in Python
#!/usr/bin/python
# -*- coding: UTF-8 -*-
from time import gmtime, strftime
import locale
import feedparser
from gtts import gTTS
from time import sleep
import os
import pyglet
@shershen08
shershen08 / done-in-x-sec-plugin.js
Created March 15, 2017 10:28
Uber-simple webpack plugin that prints how fast the sources were done recompiling
function DoneInXSecPlugin() {
this.chunkVersions = {};
}
DoneInXSecPlugin.prototype.apply = function (compiler) {
compiler.plugin("done", (stats) => {
console.log("Done in %s sec", (stats.endTime - stats.startTime)/1000);
});
};