Skip to content

Instantly share code, notes, and snippets.

View Sjahriyar's full-sized avatar

Shahriyar Sjahriyar

  • Netherland, Rotterdam
View GitHub Profile
@Sjahriyar
Sjahriyar / zsh Pro
Last active July 20, 2020 09:58
Zsh configuration file, includes showing git branch name, case-insensitive completion, aliases, showing only the directory name on PS1, Python environment initialisation. Replace the USER_NAME and FAVORITE_PROJECT_DIR to your Mac username and your favourite project directory
# Created by Shahriyar Soheytizadeh
alias bl="cd .. && ls -al"
alias dump="~/class-dump"
alias FAVORITE_PROJECT_DIR="cd ~/Developer/FAVORITE_PROJECT_DIR"
alias py="python3"
# Load version control information
autoload -Uz vcs_info
precmd() { vcs_info }
@Sjahriyar
Sjahriyar / CSBlurEffect
Created February 28, 2020 09:49
UIVisualBlurEffect with adjustable radius
//
// CSBlurEffect.swift
// SHS
//
// Created by Shahriyar Soheili on 28/02/2020.
// Copyright © 2020 Shahriyar Soheili. All rights reserved.
//
import UIKit
class SomeClass: UIViewController
{
var firstResponder: UIView? /// To handle textField position when keyboard is visible.
var isKeyboardVisible = false /// You can handle tap on view by checking if keyboard is visible.
override func viewDidLoad() {
super.viewDidLoad()
/*
Register notifications for when keyboard appears/disappears
@Sjahriyar
Sjahriyar / _CollectionViewFlowLayout
Created December 19, 2019 14:57
CollectionView Snap to the next cell
//
// TransactionsCollectionViewFlowLayout.swift
//
// Created by Shahriyar Soheilizadeh on 19/12/2019.
// Copyright © 2019 Shahriyar Soheilizadeh. All rights reserved.
//
import UIKit
class TransactionsCollectionViewFlowLayout: UICollectionViewFlowLayout
@Sjahriyar
Sjahriyar / CustomUITextField.swift
Created December 19, 2019 09:39
Custom UITextField with padding
//
// CustomTextField.swift
//
// Created by Shahriyar Soheilizadeh on 18/12/2019.
// Copyright © 2019 Shahriyar Soheilizadeh. All rights reserved.
//
import UIKit
class CustomTextField: UITextField
@Sjahriyar
Sjahriyar / CameraController.swift
Last active May 8, 2019 12:14
If you need to setup AVCaptureSession for capturing Photos/Videos in Swift, you can download this file and import to your project. Usage is very easy. Create an instance of CameraController and fill the required arguments for you use-case. then in viewDidLoad() method call: yourInstanceVariable.start(on: self.view)
//
// CameraController.swift
//
// Created by Shahriyar on 5/8/19.
//
import UIKit
import AVKit
/**