Skip to content

Instantly share code, notes, and snippets.

View MihaelIsaev's full-sized avatar
⌨️
developing Swift for Web

Mikhail Isaev aka iMike MihaelIsaev

⌨️
developing Swift for Web
View GitHub Profile
@MihaelIsaev
MihaelIsaev / throttle-SourceKitService
Created February 13, 2017 16:15 — forked from pyrtsa/throttle-SourceKitService
Script to keep SourceKitService from eating up all OS resources
#!/bin/bash
limit="${1-10000000}";
echo "Keeping SourceKitService below $limit KiB of virtual memory."
echo "Hit ^C to quit."
while true; do
sleep 1;
p=`pgrep ^SourceKitService$`
if [ -n "$p" ]; then
vsz=`ps -o vsz -p "$p" | tail -1`
@MihaelIsaev
MihaelIsaev / OffsetStringFromGMT.swift
Created May 3, 2015 14:49
iOS Swift extension to get GMT time offset string
extension NSTimeZone {
func offsetStringFromGMT() -> String {
var offsetSeconds = secondsFromGMT
var offsetString = "+00:00"
var offsetSymbol = "+"
var offsetHoursLeadString = "0"
var offsetMinutesLeadString = "0"
if offsetSeconds < 0 {
offsetSymbol = "-"
offsetSeconds = (offsetSeconds * -1)
@MihaelIsaev
MihaelIsaev / CountryCodes.json
Last active August 29, 2015 14:20 — forked from krmrn42/CountryCodes.json
Remove spaces
{
"countries":[
{
"name":"Afghanistan",
"phoneCode":"93",
"iso":"AF"
},
{
"name":"Albania",
"phoneCode":"355",
@MihaelIsaev
MihaelIsaev / HMAC.swift
Last active December 4, 2019 04:51
Easy to use Swift implementation of CommonCrypto HMAC. You can easily hash your String to: md5, sha1, sha224, sha256, sha384, sha512 with pure Swift.
//
// HMAC.swift
//
// Created by Mihael Isaev on 21.04.15.
// Copyright (c) 2014 Mihael Isaev inc. All rights reserved.
//
// ***********************************************************
//
// How to import CommonCrypto in Swift project without Obj-c briging header
//
@MihaelIsaev
MihaelIsaev / CameraViewController.swift
Created April 16, 2015 19:30
This is the example of camera view for iOS written in Swift
import UIKit
import AVFoundation
class ViewController: UIViewController, AVCaptureMetadataOutputObjectsDelegate {
@IBOutlet weak var myView: UIView!
var session: AVCaptureSession?
var device: AVCaptureDevice?
var input: AVCaptureDeviceInput?
//
// TableViewController.swift
// RSSParser
//
// Created by mihael on 14/04/15.
// Copyright (c) 2015 Mihael Isaev inc. All rights reserved.
//
import UIKit