Skip to content

Instantly share code, notes, and snippets.

View filletofish's full-sized avatar
😈

Filipp Fediakov filletofish

😈
View GitHub Profile
@filletofish
filletofish / BlurredStatusBarView.swift
Created November 23, 2017 09:17
🌫️ Blurred Status Bar View
//
// BlurredStatusBarView.swift
//
// Created by Filipp Fediakov on 23.11.17.
// Copyright © 2017 filletofish. All rights reserved.
//
import UIKit
class BlurredStatusBarView: UIView {
@filletofish
filletofish / FixedSafeAreaLayoutConstraint.swift
Last active July 18, 2018 12:32
Constraint that can be updated with safe area but only once
import UIKit
/// Work around problem described here: https://stackoverflow.com/questions/47223680/safe-area-changes-in-parent-vc-when-presenting-modally-vc-in-landscape
/// When presenting screen with another orientation safe area changes on first screen
/// that affects constraints and all layout that depends on safe area.
/// To avoid this bug one should use UCFixedSafeAreaLayoutConstraint that can be updated with safe
/// area inset using `updateAllFixedSafeAreaConstraints(newSafeAreaInsets:)` in UIViewController
///
///
///
@filletofish
filletofish / block.swift
Last active May 18, 2018 09:12
Swift chaining completion Blocks
import Foundation
protocol Performable {
associatedtype Input
associatedtype Output
var action: (Input) -> (Output) { get }
var completion: (Output) -> () { get }
func perform(data: Input)
}
@filletofish
filletofish / file.cpp
Last active June 7, 2017 18:54
SSA Form build algorithm description
// вызывается для каждой переменой
void SSAFormer::RenameVarToSSAForm(std::string varName) {
counter = 0;
stack.clear();
TraverseBBWithVar(cfg->basicBlocks.front(), varName);
}
// метод для обхода всех использований переменой, на вход принимает энтри поинт CFG
void SSAFormer::TraverseBBWithVar(BasicBlock *bb, std::string varName) {
// цикл по всем выражениям
import UIKit
import TableKit
class WSTeamsTableViewController: UITableViewController {
var tableDirector:TableDirector!
override func viewDidLoad() {
super.viewDidLoad()
tableDirector = TableDirector(tableView: tableView, shouldUseAutomaticCellRegistration: true)
def my_int(x):
if len(x) == 0:
return -1
res = 0
exp = len(x) - 1
for c in x:
digit = ord(c) - ord('0')
user_inp = input("Введите числа через пробелы: ")
user_list = user_inp.split()
res = []
i = len(user_list) - 1
while i >= 0:
res.append(user_list[i])
i -= 1
print("Введите арифметическое выражение, например 4+5−3−5+2 и нажмите Enter:")
expression = input("-> ") # ввод
res = None
operation = ""
for e in expression: # смотрим что на каждый элемент из ввода
if e == '+':
operation = '+'# запоминаем операцию
elif e == '-':