Skip to content

Instantly share code, notes, and snippets.

Andrew Zakordonets azakordonets

Block or report user

Report or block azakordonets

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@azakordonets
azakordonets / dummyXCUITest.swift
Created Apr 25, 2018
This is an example of how to use XCTContext.runActivity method in page object patter for XCUITest. This allows to get nice reports with Allure in the future.
View dummyXCUITest.swift
class LoginPage {
func login(with userName: String, and password: String): SomeOtherPage {
return XCTContext.runActivity("Login as existing user") {
this.enter(userName: userName)
this.enter(password: password)
this.submit()
return new SomeOtherPage(app: this.app);
}
}
View arrayExtension.swift
import Foundation
public extension Array {
public func randomItem() -> Element? {
guard self.count > 0 else {
return nil
}
let index = Int(arc4random_uniform(UInt32(self.count)))
@azakordonets
azakordonets / a_countries.py
Last active Apr 2, 2018
World counties details
View a_countries.py
import json
capitals = json.load(open('capital.json'))
currency = json.load(open('currency.json'))
iso3 = json.load(open('iso3.json'))
names = json.load(open('names.json'))
phone = json.load(open('phone.json'))
countries = {}
@azakordonets
azakordonets / PercentEncoder
Created Jul 7, 2017 — forked from penland365/PercentEncoder
A Scala Object to do simple RFC3986 URL encoding.
View PercentEncoder
package com.sabrelabs.twitter.auth
import scala.collection.BitSet
import scala.annotation.tailrec
import scala.runtime.RichInt
import scala.collection.mutable.ListBuffer
object PercentEncoder {
def encodeRFC3986(str: String): String = {
View numberToWords.kt
class NumberToWordConverter {
private val specialNames = arrayOf("", " thousand", " million", " billion", " trillion", " quadrillion", " quintillion")
private val tensNames = arrayOf("", " ten", " twenty", " thirty", " forty", " fifty", " sixty", " seventy", " eighty", " ninety")
private val numNames = arrayOf("", " one", " two", " three", " four", " five", " six", " seven", " eight", " nine", " ten", " eleven", " twelve", " thirteen", " fourteen", " fifteen", " sixteen", " seventeen", " eighteen", " nineteen")
private fun convertLessThanOneThousand(number: Int): String {
var number = number
var current: String
View backup-homebrew.sh
#!/bin/bash
brew_command=/usr/local/bin/brew
brew_cask_command="$brew_command cask"
echo '#!/bin/bash'
echo ''
echo 'trap ctrl_c INT'
echo 'function ctrl_c() {'
echo 'echo "** Trapped CTRL-C"'
View docker_cleanup.sh
//remove old unused containers
docker rm -f $(docker ps -a -q)
// remove untagged images
docker rmi $(docker images | grep "^<none>" | awk '{print $3}')
@azakordonets
azakordonets / ohMyZshHistoryCleanUp.regex
Created Aug 29, 2016
This regular expression allows to remove from .zhs_history all the "trashy" commands that are used commonly and reduce the size of the file
View ohMyZshHistoryCleanUp.regex
: \d+:0;(gd|gst|gaa|ga|gc|irb|git reset|git stash|newzsh|glg|gb|git push|git init|grm|gl|mc|top|git rebase|ember|rake|rackup|git rm|sensors|rails s|tree|ls|ember install|rubocop|reboot|pry|gitg|gitk|man|unity|bower install|npm install|bundle install|bundle update|git pull|node|jekyll|kill|bin\/console|tmux|la|cd ~/code|nvm|fm|ruby).*\n
View run_es6_code_in_sublime.js
{
"cmd": ["babel-node", "$file"],
"selector": "source.js",
"path": "/usr/local/bin:$PATH", // ENV setting for mac users
"quiet": true // get rid of annoying `[Finished in %fs]`
}
View iban.json
{
"values": [
{
"country": "Albania",
"length": "28",
"code": "AL",
"format": "AL2!n8!n16!c"
},
{
"country": "Andorra",
You can’t perform that action at this time.