Skip to content

Instantly share code, notes, and snippets.

View notxcain's full-sized avatar
🏠
Working from home

Denis Mikhaylov notxcain

🏠
Working from home
View GitHub Profile
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
@notxcain
notxcain / gist:7803873
Last active December 30, 2015 08:39
Разница
- (void)updateWithCompletion:(void (^)(BOOL success, NSError *))completion
{
[API executeRequest:request completion:^(id result, NSError *error) {
if (!result) {
completion(NO, error);
return;
}
[Importer importFromResult:result completion:^(BOOL result, NSError *error) {
if (!result) {
//
// QWListChange.h
//
// Created by Denis Mikhaylov on 04/12/13.
// Copyright (c) 2013 QIWI. All rights reserved.
//
// Header
@notxcain
notxcain / gist:7889347
Last active December 30, 2015 21:39
QWTableViewModel
@class RACSignal;
@class RACCommand;
@protocol QWTableViewModel <NSObject>
/// Returns a signal sending QWSectionedListChange objects
@property (nonatomic, strong, readonly) RACSignal *changesSignal;
- (NSUInteger)numberOfSections;
- (NSUInteger)numberOfItemsInSection:(NSUInteger)section;
@notxcain
notxcain / gist:8929734
Created February 11, 2014 05:31
Data I/O
Written data
<62706c69 73743030 d4000100 02000300 04000500 0603ed03 ee582476 65727369 6f6e5824 6f626a65 63747359 24617263 68697665 72542474 6f701200 0186a0af 1101ed00 07000800 15001600 17001800 1901ff02 00020102 02020302 04020502 06020702 08020902 0a020b02 0c020d02 0e020f02 10021102 12021302 14021502 16021702 18021902 1a021b02 1c021d02 1e021f02 20022102 22022302 24022502 26022702 28022902 2a022b02 2c022d02 2e022f02 30023102 32023302 34023502 36023702 38023902 3a023b02 3c023d02 3e023f02 40024102 42024302 44024502 46024702 48024902 4a024b02 4c024d02 4e024f02 50025102 52025302 54025502 56025702 58025902 5a025b02 5c025d02 5e025f02 60026102 62026302 64026502 66026702 68026902 6a026b02 6c026d02 6e026f02 70027102 72027302 74027502 76027702 78027902 7a027b02 7c027d02 7e027f02 80028102 82028302 84028502 86028702 88028902 8a028b02 8c028d02 8e028f02 90029102 92029302 94029502 96029702 98029902 9a029b02 9c029d02 9e029f02 a002a102 a202a302 a402a502 a602a702 a802a902 aa02ab02 ac02ad02 ae02af02 b002b102 b202b302 b402b502 b
<elements id="2">
<enumerationField name="account_type" title="Тип счета">
<values>
<value title="Номер счета" value="1" />
<value title="Номер карты" value="2" />
</values>
<dependancy>
<targets>
<target name="account_type" regularExpression="^1$" />
</targets>
@notxcain
notxcain / FormatCompanion.scala
Last active January 15, 2019 13:34
play.api.libs.json.Format[A] automatic derivation using LabelledTypeClass from shapeless
/*
* Copyright (c) 2014-15 Denis Mikhaylov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@notxcain
notxcain / Example.scala
Last active February 10, 2016 09:57
Simple akka stream based eventsourcing
sealed trait Ack[+R]
object Ack {
def accepted[R]: Ack[R] = Accepted
def rejected[R](rejection: R): Ack[R] = Rejected(rejection)
case object Accepted extends Ack[Nothing]
case class Rejected[+R](rejection: R) extends Ack[R]
}
sealed trait Message
{
"id": "464",
"content": {
"terms": {
"type": "DefaultQWTerms",
"id": "464",
"commission": {
"ranges": [
{
"bound": 0,
@notxcain
notxcain / OrderedAtLeastOnceDelivery.scala
Created April 24, 2016 18:10
Ordered At-Least-Once delivery for Akka
trait OrderedAtLeastOnceDelivery extends AtLeastOnceDelivery {
type DeliveryId = Long
private case class Delivery(destination: ActorPath, deliveryIdToMessage: (DeliveryId) => Any)
private val deliveryQueue = scala.collection.mutable.Queue.empty[Delivery]
override def deliver(destination: ActorPath)(deliveryIdToMessage: (DeliveryId) => Any): Unit = {
if (super.numberOfUnconfirmed == 0) {
super.deliver(destination)(deliveryIdToMessage)