Skip to content

Instantly share code, notes, and snippets.

Ivan V nikartm

View GitHub Profile
View FooterBarLayout.java
package ru.dasreda.dasreda;
import android.content.Context;
import android.support.design.widget.CoordinatorLayout;
import android.util.AttributeSet;
import android.widget.FrameLayout;
/**
* @author Ivan V on 06.03.2018.
* @version 1.0
View FooterBarBehavior.java
package ru.dasreda.dasreda;
import android.content.Context;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CoordinatorLayout;
import android.util.AttributeSet;
import android.view.View;
/**
* @author Ivan V on 06.03.2018.
@nikartm
nikartm / Java declination age method
Last active Dec 11, 2017
Склонение возраста (ru)
View Java declination age method
public static String getAgeWithDeclination(double age){
String result;
List<Double> units = Arrays.asList(2d, 3d, 4d);
List<Double> dozens = Arrays.asList(11d, 12d, 13d, 14d);
if(age != 11 && age % 10 == 1) {
result = age + " год";
} else if(age % 1 != 0d || (units.contains(age % 10) && !dozens.contains(age % 100))) {
result = age + " года";
} else {
@nikartm
nikartm / ru_cities.xml
Created Apr 29, 2017
All Russian Cities xml
View ru_cities.xml
<?xml version="1.0"?>
<string-array name="cities">
<item>Абаза, Хакасия</item>
<item>Абакан, Хакасия</item>
<item>Абдулино, Оренбургская область</item>
<item>Абинск, Краснодарский край</item>
<item>Агидель, Башкортостан</item>
<item>Агрыз, Татарстан</item>
<item>Адыгейск, Адыгея</item>
<item>Азнакаево, Татарстан</item>
@nikartm
nikartm / gitignore file
Created Apr 27, 2017
Gitignore for Android
View gitignore file
# Android Studio
.gradle
/local.properties
.DS_Store
/build
/captures
app/build/
gradle/
*.iml
.idea
@nikartm
nikartm / ImgRedactor
Created Jan 13, 2017
Get bitmap shader circle img
View ImgRedactor
// Get bitmap shader circle img
public static Bitmap getCircleMaskedBitmapShader(Bitmap source, int radius) {
if (source == null) { return null; }
int diam = radius << 1;
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
Bitmap scaledBitmap = scaleTo(source, diam);
final Shader shader = new BitmapShader(scaledBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
View Add new contact without confirmation
try {
String DisplayName = "XYZ";
String MobileNumber = "123456";
String HomeNumber = "1111";
String WorkNumber = "2222";
String emailID = "email@nomail.com";
String company = "bad";
String jobTitle = "abcd";
ArrayList<ContentProviderOperation> ops = new ArrayList < ContentProviderOperation > ();
@nikartm
nikartm / menu_hide.js
Created Feb 23, 2016
JS hide menu and open on click
View menu_hide.js
//Hide products blocks
$(document).ready(function() {
$('.btn').click(function() { //Click on button
$(".cont").not(this).slideUp().prev().removeClass("active"); //Hide all open blocks
$(this).next().find(".cont").not(":visible").slideDown().prev().addClass("active"); //Open current block
});
});
<!-- Start products menu -->
<div class="container prod_block">
@nikartm
nikartm / JS_setTimeout
Created Feb 5, 2016
JS timeout for hover over an element
View JS_setTimeout
//Set timeout if hover over an element
$(document).ready(function() {
$('#slider').hover(
// if hover over an element
function(){
setTimeout(function() {
$('i.arrows').css({"opacity":"1"});
},
300);
@nikartm
nikartm / DatePHP
Created Aug 29, 2015
Print by php in the russian locale - date, month, week day and time
View DatePHP
<?php
// Вывод даты на русском
$monthes = array(
1 => 'Января', 2 => 'Февраля', 3 => 'Марта', 4 => 'Апреля',
5 => 'Мая', 6 => 'Июня', 7 => 'Июля', 8 => 'Августа',
9 => 'Сентября', 10 => 'Октября', 11 => 'Ноября', 12 => 'Декабря'
);
echo(date('d ') . $monthes[(date('n'))] . date(' Y, H:i'));
// Вывод дня недели
You can’t perform that action at this time.