Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
SERVER_URL="your.server.name"
PASSWORD="yourpass"
COUNTRY="UA"
STATE="Kyiv"
LOCALITY="Kyiv"
ORGANIZATION="ORG"
ORGANIZATION_UNIT="ORG"
//
// Car+Extensions.swift
// SomeExampleApp
//
// Created by Oleksii Horishnii on 11/14/17.
// Copyright © 2017 Oleksii Horishnii. All rights reserved.
//
import Foundation
import CoreData
//Example of turning structs into Createable & Updateable
struct SomeStruct: CreateableDefault {
var someInt = 12
var someString = "asdf"
}
let a = SomeStruct.create {
$0.someInt = 10
$0.someString = "abcd"
@NeedMoreDesu
NeedMoreDesu / TwoPilesMTG.md
Last active October 8, 2016 22:54
Two Piles MTG: casual MTG rules to have no manascrew or manaflood

#Two Piles MTG v0.4

##Introduction

This is casual MTG rules that was created to defeat manascrew or manaflood in MTG.

Unfortunately, we have plenty of those happen in real tournaments, making the game totally unwinnable to some player that just got "bad luck". While luck is essential in card games, being unable to play your spells at all is just horribly wrong. There is also a problem with playing second in MTG. It's never good to start second, because constant tempo loss isn't worth a single card difference.

Instead, this system tries to copy Hearthstone mulligan and mana gain system. It also address "playing second" issue.

class GeneralVC: ParentVC, UIActionSheetDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
@IBAction func customPickerButtonPressed(sender: AnyObject) {
let picker = UIImagePickerController()
picker.delegate = self
picker.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
picker.allowsEditing = true
self.presentViewController(picker, animated: true, completion: nil)
}
+ (void)customizeBackButton {
[[UINavigationBar appearance] setBackIndicatorImage:[[UIImage imageNamed:@"back_button"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
[[UINavigationBar appearance] setBackIndicatorTransitionMaskImage:[[UIImage imageNamed:@"back_button"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
}
override func viewDidLoad() {
super.viewDidLoad()
self.leftItem = LeftItem.backFn(visibilityFn: { true },
backFn: { [unowned self] in self.navigationController?.dismissViewControllerAnimated(true, completion: nil) })
}
class SystemDefaultVC: ParentVC {
override func viewDidLoad() {
super.viewDidLoad()
self.leftItem = LeftItem.backSystemDefault
// do something with self.navigationItem.leftBarButtonItem
}
}
import UIKit
class BlockBarButtonItem : UIBarButtonItem {
private var actionHandler: ((Void) -> Void)?
convenience init(image: UIImage?, actionHandler: ((Void) -> Void)?) {
self.init(image: image, style: UIBarButtonItemStyle.Plain, target: nil, action: nil)
self.target = self
self.action = #selector(BlockBarButtonItem.barButtonItemPressed(_:))
import UIKit
class ParentVC: UIViewController {
enum LeftItem {
case none
case backSystemDefault
case backGeneral
case backCustom(image: UIImage?, title: String?, leftSpaceCloseToDefault:Bool)
case backFn(visibilityFn:(() -> Bool), backFn:(() -> ()))