Skip to content

Instantly share code, notes, and snippets.

View TramPamPam's full-sized avatar

Oleksandr Bezpalchuk TramPamPam

View GitHub Profile
import UIKit
@IBDesignable
class GradientView: RoundedView {
@IBInspectable var from: UIColor! = UIColor.init(colorLiteralRed: 255.0/64.0, green: 255.0/164.0, blue: 255.0/196.0, alpha: 1)
@IBInspectable var to: UIColor! = UIColor.init(colorLiteralRed: 255.0/59.0, green: 255.0/88.0, blue: 255.0/152.0, alpha: 1)
@IBInspectable var vertical: Bool = false
@IBInspectable var rounded: Bool = false {
didSet {
@TramPamPam
TramPamPam / CorneredButton.swift
Created September 11, 2017 08:21
Rounded with mask
@IBDesignable
class CorneredButton: UIButton {
@IBInspectable var radius: CGFloat = 2.0
@IBInspectable var border: CGFloat = 0.0
var corners: UIRectCorner? = .allCorners
override func layoutSubviews() {
super.layoutSubviews()
@TramPamPam
TramPamPam / RepeatingAlphabeth.py
Last active November 24, 2016 10:00
Getting acquaintance with 'def' in Python
alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
alphabetLength = len(alphabet)
def get_alphabet_till(length):
# Validate input
# 1) Check for type:
if not (type(length) is int): #type of length must be int
return "Sorry, I expect int"
# 2) Check range:
if length > alphabetLength: #length should be equal or less of letters count
@TramPamPam
TramPamPam / TypeConvertions.py
Last active August 23, 2016 19:14
Python hints
# type checks
# Hello World program in Python
from datetime import datetime, date, time
print("Hello World!\n")
today = datetime.now()
#this is func that prints "Awesome"
def print_me():
print("Awesome")
f = print_me