Skip to content

Instantly share code, notes, and snippets.

View abbath0767's full-sized avatar

Nikita Gusarov abbath0767

View GitHub Profile
@abbath0767
abbath0767 / gist:11b9c1b79c20ed4188c9
Created February 24, 2016 15:32
7 kyu Sort the Gift Code
import java.util.Arrays;
public class GiftSorter{
public String sortGiftCode(String code){
String[] arrayOfSymbol = code.split("");
Arrays.sort(arrayOfSymbol);
StringBuilder sb = new StringBuilder();
for (String oneSymbol: arrayOfSymbol)
sb.append(oneSymbol);
@abbath0767
abbath0767 / gist:d42830a89ca651f9df2f
Created February 24, 2016 15:32
Beginner Series #2 Clock
import java.util.*;
public class Clock
{
public static int Past(int h, int m, int s)
{
Date d = new Date();
int year = d.getYear();
int month = d.getMonth();
int day = d.getDate();
public class DivisibleNb {
public static Boolean isDivisible(long n, long x, long y) {
return (n % x == 0 && n % y == 0);
}
}
public class Vowels {
public static int getCount(String str) {
int vowelsCount = 0;
vowelsCount = str.length() - str.replaceAll("a|e|i|o|u", "").length();
return vowelsCount;
}
@abbath0767
abbath0767 / ExampleActivity.class
Last active May 31, 2017 14:35
Stopwatch classes for android
public class ExampleActivity extends AppCompatActivity implements SmartTimer.OnSecondTickListener {
private static final String TAG = TimerActivity.class.getSimpleName();
private TextView mTextViewTime;
private Button mButtonStart;
private Button mButtonStop;
private Button mButtonClear;
private SmartTimer mSmartTimer = new SmartTimer(this, this);
override fun intercept(chain: Interceptor.Chain): Response {
val request = chain.request()
val response: Response?
try {
response = chain.proceed(request)
val responseBody = response.body()
# By default, the flags in this file are appended to flags specified
# in /usr/share/android-studio/data/sdk/tools/proguard/proguard-android.txt
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
##---------------Begin: proguard configuration common for all Android apps ----------
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
#retrofit
# Platform calls Class.forName on types which do not exist on Android to determine platform.
-dontnote retrofit2.Platform
# Platform used when running on Java 8 VMs. Will not be used at runtime.
-dontwarn retrofit2.Platform$Java8
# Retain generic type information for use by reflection by converters and adapters.
-keepattributes Signature
# Retain declared checked exceptions for use by a Proxy instance.
-keepattributes Exceptions
class A {
val b: B
val c: String = ""
fun a(value: Int) {
b.doSomething(
value,
{
c = it + "result good"
Метод класса B
fun reserveBadCaseDevice(workerId: Int,
condition: DeviceCondition,
result: (Unit) -> Unit,
errorText: (String) -> Unit,
errorId: (Int) -> Unit) {
val data = ReservedWorkerData(
DeviceState.TAKE,
condition, null,