Skip to content

Instantly share code, notes, and snippets.

View mehdin13's full-sized avatar

Mehdi Negahban mehdin13

View GitHub Profile
@mahmoud-eskandari
mahmoud-eskandari / README.md
Last active April 16, 2025 09:38
Install v2ray on Bridge:(Ubuntu +18 via systemd) - Upstream (Ubuntu +18/CentOS +7 via docker)

پنل x-ui

پنل تحت وب مدیریت V2ray و ساخت کاربر و مدیریت سرور

mkdir x-ui && cd x-ui
docker run -itd --network=host \
    -v $PWD/db/:/etc/x-ui/ \
 -v $PWD/cert/:/root/cert/ \
@IanKeen
IanKeen / Storage.swift
Last active June 11, 2024 08:35
PropertyWrapper: Storage to extend support for more types using `@AppStorage`
@propertyWrapper
struct Storage<T: AppStorageConvertible>: RawRepresentable {
var rawValue: String { wrappedValue.storedValue }
var wrappedValue: T
init?(rawValue: String) {
guard let value = T.init(rawValue) else { return nil }
self.wrappedValue = value
}
init(wrappedValue: T) {
#!/bin/bash
set -e
# !!!ONLY FOR MACOS!!!
# This script helps you to bypass VPN for specific CIDRs and domain names by adding a direct route to the default gateway for them.
# It also can be used to setup a killswitch. When killswitch is enabled, Only IP traffic to the VPN server (and other bypassed CIDRs) is allowed, All other packets would be dropped.
# Killswitch is powered by MacOS internal packet filter (PF) firewall.
# How to use?
import SwiftUI
import MapKit
import PlaygroundSupport
struct Location {
var title: String
var latitude: Double
var longitude: Double
}
import SwiftUI
import PlaygroundSupport
// NOTE: this example currently only works with US-based coordinates
// constants
// New York
let latitude = 40.709335
let longitude = -73.956558
@tadeha
tadeha / MapViewController.swift
Last active July 20, 2022 14:47
🗺Map View with Bottom Components for each Marker // Using Google Maps and written in Swift 5
//
// MapViewController.swift
//
// Created by Tadeh Alexani on 7/14/19.
// Copyright © 2019 Tadeh Alexani. All rights reserved.
//
import UIKit
import GoogleMaps
@SergLam
SergLam / UIDevice+Ext.swift
Created June 14, 2019 11:02
Detect iOS device model
public extension UIDevice {
enum DeviceModelName: String {
case undefined
case iPodTouch5
case iPodTouch6
case iPhone4
case iPhone4s
case iPhone5
@SergLam
SergLam / UIImageView+Ext.swift
Created April 17, 2019 12:44
Round image view with gradient border color
import UIKit
extension UIImageView {
func addCircleGradiendBorder(_ width: CGFloat) {
let gradient = CAGradientLayer()
gradient.frame = CGRect(origin: CGPoint.zero, size: bounds.size)
let colors: [CGColor] = [UIColor.supSoftGreenThree.cgColor, UIColor.supSoftGreenTwo.cgColor,
UIColor.supSoftGreen.cgColor, UIColor.supTea.cgColor,
UIColor.supAquaMarineTwo.cgColor, UIColor.supAquaMarineThree.cgColor,
@makzan
makzan / ViewController.swift
Created April 9, 2019 05:13
Demo on uploading image to PHP from Alamofire
//
// ViewController.swift
// Upload Image Example
//
import UIKit
import Alamofire
class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
@vikaskore
vikaskore / RecordAudioViewController.swift
Last active April 30, 2024 11:05
Record and Play audio in iOS Swift
//
// RecordAudioViewController.swift
// Samples
//
// Created by VikasK on 11/02/19.
// Copyright © 2019 Vikaskore Software. All rights reserved.
//
import UIKit
import AVFoundation