Skip to content

Instantly share code, notes, and snippets.

View xslim's full-sized avatar

Taras Kalapun xslim

View GitHub Profile
- (void)startPayment {
if (seld.device.status == notBoarded) {
[self boardDevice]
return;
}
if (self.device.status != initialized) {
[self showError];
return;
}
startTransaction
@xslim
xslim / MockChain.m
Last active August 29, 2015 14:15
execute synchroniously all blocks on main thread and sleep `X` seconds between them
@implementation MockChain
// execute synchroniously all blocks on main thread and sleep `X` seconds between them
+ (void)sleep:(NSTimeInterval)ti chain:(MockChainBlock)firstBlock, ... NS_REQUIRES_NIL_TERMINATION
{
NSMutableArray *arr = [NSMutableArray array];
va_list args;
va_start(args, firstBlock);
Feb 12 16:59:25 iPad-van-Adyen FastQueue[2212] <Error>: Could not successfully update network info during initialization.
Feb 12 16:59:27 iPad-van-Adyen FastQueue[2212] <Notice>: RCOrderManager::initializePaymentProvider:withCallback:: OrderService > Will initialize for current customer with payment provider <RCAdyenProvider: 0x15771870>
Feb 12 16:59:27 iPad-van-Adyen FastQueue[2212] <Notice>: RCAdyenProvider::initializeForCurrentCustomerWithCallback::
Feb 12 16:59:27 iPad-van-Adyen FastQueue[2212] <Notice>: RCAdyenProvider::setCurrentState:: 1
Feb 12 16:59:27 iPad-van-Adyen FastQueue[2212] <Notice>: RCAdyenProvider::initializeForCurrentCustomerWithCallback:: Trying to connect to Adyen with code MKEMOTOPOS
Feb 12 16:59:27 iPad-van-Adyen FastQueue[2212] <Notice>: RCAdyenProvider::loginChangedStatus:: Adyen login status changed to: 0
Feb 12 16:59:27 iPad-van-Adyen FastQueue[2212] <Notice>: RCAdyenProvider::loginChangedStatus:: Adyen login status changed to: 1
Feb 12 16:59:27 iPad-van-Adyen FastQueue[2212] <Not
@xslim
xslim / gist:1e120c370944f2ca9eeb
Created February 12, 2015 15:39
Device boarding
- (void)transactionComplete:(ADYTransactionData *)transaction {
// let super handle the interface changes
[super transactionComplete:transaction];
// specific Alerts
if (transaction.finalState == ADYFinalTenderStateError &&
[transaction.rawFailureReason.domain isEqualToString:ADYErrorDomain] &&
transaction.rawFailureReason.code == ADYErrorCodeInvalidCredentialsForPaymentDevice)
{
Verifying that +xslim is my openname (Bitcoin username). https://onename.com/xslim
@xslim
xslim / objc.supp
Created December 5, 2014 10:19
Valgring suppressions for Objective-C
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: possible
fun:malloc_zone_calloc
fun:_read_images
fun:map_images_nolock
fun:map_images
}
{
@xslim
xslim / quick.js
Created November 25, 2014 15:55
Appium WebdriverIO
var util = require('util');
var assert = require("assert");
var webdriverio = require('webdriverio');
var driverOptions = require('../config').driverOptions;
describe('App integration tests', function(){
this.timeout(99999999);
@xslim
xslim / receiver
Created October 28, 2014 14:42
NodeJS app on CentOS
curl -v --proxy proxy:3128 -O https://raw.githubusercontent.com/progrium/gitreceive/master/gitreceive
mv gitreceive /usr/local/bin/
chmod +x /usr/local/bin/gitreceive
gitreceive init
yum install -y mongodb-org
vi /etc/group......
yum install git
@xslim
xslim / AES_CCM_Encrypt.m
Created October 20, 2014 16:20
AES CCM Encryption using OpenSSL
+ (NSData *)aesEncrypt:(NSData *)plainText withKey:(NSData *)key nonce:(NSData *)nonce error:(NSError **)error
{
#define FAIL(X) NSLog(@"Error: %@", cause); goto cleanup
NSMutableData* cipherText = ([[NSMutableData alloc] init]);
NSMutableData* tag = ([[NSMutableData alloc] init]);
unsigned char* outbuf = NULL;
// create and initialise the cipher context
EVP_CIPHER_CTX* cipherCtx = NULL;
@xslim
xslim / hmac.js
Created September 29, 2014 15:07
NodeJS HMAC
var express = require('express');
var port = process.env.PORT || 9000;
var key = 'xxx';
var app = express();
app.all('/hmac', function(req, res){
var text = req.query.text;
hash = hmacsha1(text, key);
res.end(hash)