Skip to content

Instantly share code, notes, and snippets.

View saturov's full-sized avatar

Eugene Saturov saturov

View GitHub Profile
@saturov
saturov / gist:0df023cc4f859af0d06d225afb84a6e2
Last active April 19, 2017 14:37
Рассчёт идеального прямоугольника
1111 идеальный прямоугольник = IdealRect{sideType=A, widthInCells=4, heightInSmallRacks=1, isGumBags=false, planGum=29, lowestRackPositionYInMm=1690, sectionList=[Section{width=CELLS_4, height=H_1800, racks=[], toperAbsent=false, carcass=null, startOffset=0}], smallRacksAboveThreadmill=9, squareIndex=0.6, aboveThreadmillIndex=1.0, rationalIndex=1.0, planAccordanceIndex=1.8620689655172413}
1111 индекс = 4.462068965517242
1111 идеальный прямоугольник = IdealRect{sideType=A, widthInCells=4, heightInSmallRacks=2, isGumBags=false, planGum=29, lowestRackPositionYInMm=1581, sectionList=[Section{width=CELLS_4, height=H_1800, racks=[], toperAbsent=false, carcass=null, startOffset=0}], smallRacksAboveThreadmill=9, squareIndex=0.2, aboveThreadmillIndex=1.0, rationalIndex=1.0, planAccordanceIndex=1.7241379310344827}
1111 индекс = 3.924137931034483
1111 идеальный прямоугольник = IdealRect{sideType=A, widthInCells=4, heightInSmallRacks=3, isGumBags=false, planGum=29, lowestRackPositionYInMm=1471, sectionList=[Section{width
@Data
@NoArgsConstructor
public class ToolbarConfig {
private
@IdRes
int toolbarId = R.id.toolbar;
private boolean setDisplayHomeAsUpEnabled = true;
/** Возвращает описание про благотворительность в информации о заказе */
- (NSString *)orderInfoCharityDescription:(LABCharity *)charity {
NSString *resultString = [NSString stringWithFormat:@"%@\u00a0р.", [LABUtils priceSeparateBySpace:charity.sum]];
NSString *location = nil;
NSArray<LABOrphanage *> *orphanages = [charity.orphanage allObjects];
if (orphanages && orphanages.count > 0) {
location = [orphanages firstObject].orphanageName;
resultString = [resultString stringByAppendingString:[NSString stringWithFormat:@" в %@", location]];
}
return resultString;
if (order.deliveryMethod.deliveryType.deliveryTypeName) {
NSString *deliveryValue = order.deliveryMethod.deliveryType.deliveryTypeName; // Курьер: Пермь
NSString *deliveryAddress = order.deliveryMethod.address; // Улица, дом
NSString *deliveryPrice = NSLocalizedString(@"ORDER_PARAMETER_FREE_DELIVERY_COST", nil); // "Бесплатно"
if ([order.deliveryMethod.price integerValue] > 0) {
deliveryPrice = [NSString stringWithFormat:@"%@\u00a0р.", [LABUtils priceSeparateBySpace:order.deliveryMethod.price]]; // 200 р.
}
//НЕ НУЖНО ДОБАВЛЯТЬ В СТРОКУ NSString *title = NSLocalizedString(@"ORDER_PARAMETER_DELIVERY_TITLE", nil); // "Доставка", слово, которое слева серым
NSString *value = [NSString stringWithFormat:@"%@, %@", deliveryPrice, deliveryValue]; // Сборная строка "200 р., Курьер: Пермь"
if ([LABUtils notEmptyString:deliveryAddress]) {
This file has been truncated, but you can view the full file.
surf@vladUbuntu:~/AndroidStudioProjects/wrigley/WrigleyLayout$ ./gradlew clean build --debug
11:57:13.645 [INFO] [org.gradle.BuildLogger] Starting Build
11:57:13.653 [DEBUG] [org.gradle.BuildLogger] Gradle user home: /home/surf/.gradle
11:57:13.654 [DEBUG] [org.gradle.BuildLogger] Current dir: /home/surf/AndroidStudioProjects/wrigley/WrigleyLayout
11:57:13.655 [DEBUG] [org.gradle.BuildLogger] Settings file: null
11:57:13.656 [DEBUG] [org.gradle.BuildLogger] Build file: null
11:57:13.669 [DEBUG] [org.gradle.initialization.buildsrc.BuildSourceBuilder] Starting to build the build sources.
11:57:13.672 [DEBUG] [org.gradle.initialization.buildsrc.BuildSourceBuilder] Gradle source dir does not exist. We leave.
11:57:13.676 [DEBUG] [org.gradle.initialization.DefaultGradlePropertiesLoader] Found env project properties: []
11:57:13.677 [DEBUG] [org.gradle.initialization.DefaultGradlePropertiesLoader] Found system project properties: []
fun eval(expr: Expr): Double = when(expr) {
is Expr.Const -> expr.number
is Expr.Sum -> eval(expr.e1) + eval(expr.e2)
Expr.NotANumber -> Double.NaN
// ветка else не требуется, так как покрыты все возможные сценарии
}
sealed class Expr {
class Const(val number: Double) : Expr()
class Sum(val e1: Expr, val e2: Expr) : Expr()
object NotANumber : Expr()
}
open class Base {
open fun f() {}
}
abstract class Derived : Base() {
override abstract fun f()
}
open class A {
open fun f() { print("A") }
fun a() { print("a") }
}
interface B {
fun f() { print("B") } // члены интерфейса открыты по-умолчанию
fun b() { print("b") }
}
open class AnotherDerived() : Base() {
final override fun v() {}
}