Skip to content

Instantly share code, notes, and snippets.

View heitara's full-sized avatar
💻
Swift & SwiftUI

Emil Atanasov heitara

💻
Swift & SwiftUI
View GitHub Profile
@heitara
heitara / swift_swipe_detect.swift
Created October 17, 2019 10:21
Swift Swipe Guester detector. Detect all four swipe directions. Swift 4
//more info on https://stackoverflow.com/questions/24215117/how-to-recognize-swipe-in-all-4-directions
class BaseViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let swipeRight = UISwipeGestureRecognizer(target: self, action: #selector(swiped))
swipeRight.direction = UISwipeGestureRecognizerDirection.right
self.view.addGestureRecognizer(swipeRight)
let swipeLeft = UISwipeGestureRecognizer(target: self, action: #selector(swiped))
swipeLeft.direction = UISwipeGestureRecognizerDirection.left
@heitara
heitara / UIShowHideTextField_iOS13.swift
Created September 27, 2019 10:23
Password Text Field on iOS 13+ with an icon on the right to reveal the password
class UIShowHideTextField: UnderlinedTextField {
let rightButton = UIButton(type: .custom)
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
commonInit()
}
required override init(frame: CGRect) {
@heitara
heitara / UIShowHideTextField_iOS12.swift
Created September 27, 2019 10:20
Password Text Field on iOS 12 with an icon on the right to reveal the password
class UIShowHideTextField: UnderlinedTextField {
let rightButton = UIButton(type: .custom)
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
commonInit()
}
required override init(frame: CGRect) {
@heitara
heitara / GridLayout.swift
Created April 30, 2018 14:59 — forked from smswz/GridLayout.swift
A simple custom grid UICollectionViewLayout
// MIT License
//
// Copyright (c) 2016 stable|kernel
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@heitara
heitara / record_video_stream
Last active August 5, 2016 07:05
Record video using ffmpeg
@echo off
rem batch file which starts video recording
for /f "skip=1" %%x in ('wmic os get localdatetime') do if not defined MyDate set MyDate=%%x
rem echo %MyDate%
set today=%MyDate:~0,4%-%MyDate:~4,2%-%MyDate:~6,2%
set time=%MyDate:~8,2%-%MyDate:~10,2%
set filename=%today%_%time%.mp4
echo %today%
@heitara
heitara / mp3_splitter
Created July 21, 2016 08:23
MP3 Splitter using ffmpeg
#!/bin/bash
#slice mp3 file to 30 sec or less starting from the passed begginning
if [ "$#" -eq 2 ] && [ -n "$1" ]
then
DURATION=30
ffmpeg -ss $2 -i "$1" -t $DURATION -acodec copy "$1.output.mp3"
else
echo
echo
AT Austria
BE Belgium
BG Bulgaria
HR Croatia (Hrvatska)
CZ Czech Republic
DK Denmark
FI Finland
FR France
DE Germany
GB Great Britain (UK)
#target Illustrator
// script.name = exportLayersAsCSS_PNGs.jsx;
// script.description = mimics the Save for Web, export images as CSS Layers (images only);
// script.requirements = an open document; tested with CS5 on Windows.
// script.parent = carlos canto // 05/24/13; All rights reseved
// script.elegant = false;
/**
<inputsourcedef>
<name>MY_BULGARIAN_PHONETIC</name>
<inputsourceid_prefix>com.apple.keylayout.Bulgarian-Phonetic</inputsourceid_prefix>
</inputsourcedef>
<item>
<name>Bulgarian Phonetic map 'ч' to ± </name>
<appendix>Bulgarian Phonetic map 'ч' from '`' to ±. This is valid when you get used with US layout and then switch to UK</appendix>
<identifier>private.bulgarina.phonetic</identifier>
<inputsource_only><MY_BULGARIAN_PHONETIC<name /></MY_BULGARIAN_PHONETIC></inputsource_only>