Skip to content

Instantly share code, notes, and snippets.

View DimaRU's full-sized avatar
🏠

Dmitriy Borovikov DimaRU

🏠
  • Lúnaturco, Dor Daedeloth
View GitHub Profile
@DimaRU
DimaRU / gist:89384b284ce2df0feec3784e7c0c3e4c
Created September 26, 2016 11:25 — forked from vladimirtsyupko/gist:10964772
Git force pull to overwrite local files
git fetch --all
git reset --hard origin/master
git pull origin master
// Swift's untyped errors are a goddam PiTA. Here's the pattern I use to try to work around this.
// The goal is basically to try to guarantee that every throwing function in the app throws an
// ApplicationError instead of some unknown error type. We can't actually enforce this statically
// But by following this convention we can simplify error handling
enum ApplicationError: Error, CustomStringConvertible {
// These are application-specific errors that may need special treatment
case specificError1
case specificError2(SomeType)
@DimaRU
DimaRU / MD5.swift
Created November 22, 2017 14:45 — forked from 0xWDG/MD5.swift
//
// md5.swift
// PHPFramework
//
// Created by Wesley de Groot on 28-02-16.
// Copyright © 2016 WDGWV. All rights reserved.
//
import Foundation
@DimaRU
DimaRU / HOWTODMG.md
Created January 13, 2018 21:37 — forked from jadeatucker/HOWTODMG.md
How to create a "DMG Installer" for Mac OS X

Creating a "DMG installer" for OS X

A DMG Installer is convenient way to provide end-users a simple way to install an application bundle. They are basically a folder with a shortcut to the Applications directory but they can be customized with icons, backgrounds, and layout properties. A DMG file (.dmg) is a Mac OS X Disk Image file and it is used to package files or folders providing compression, encryption, and read-only to the package.

##Creating the DMG file #Disk Utility

@DimaRU
DimaRU / Podfile
Created February 3, 2018 14:21 — forked from JohnSundell/Podfile
A Podfile that demonstrates how to use Swift 3 dependencies in a Swift 4 project
target 'MyTarget' do
use_frameworks!
# Post installation script that enables the Swift 4 compiler's
# legacy 3.2 mode for Swift 4-incompatible pods
post_install do |installer|
incompatiblePods = ['PodA', 'PodB']
installer.pods_project.targets.each do |target|
if incompatiblePods.include? target.name
@DimaRU
DimaRU / TestSwiftKEyPatch.swift
Created July 5, 2018 18:33
Swift keyPath playground
import Cocoa
class AppData {
var iDict1: [Int:Int] = [1:1, 2:2]
var iDict2: [Int:Int] = [1:11, 2:22]
var sDict1: [Int:String] = [1: "One", 2: "Two"]
var sDict2: [Int:String] = [1: "One2", 2: "Two2"]
static let propPath: [String: PartialKeyPath<AppData>] = [
@DimaRU
DimaRU / osx_defaults.sh
Created May 12, 2019 18:21 — forked from vraravam/osx-defaults.sh
OSX Defaults to setup a brand new machine
#!/usr/bin/env bash
# TODO: Need to figure out the settings for the following:
# 1) Finder: Left nav, favorite items with their order
# 2) Dock: Items with order
# 3) Security & Privacy Preferences: Full Disk Access, Camera, Microphone
# 4) Login items for my user (i.e. apps started when I login)
# 5) Global Keyboard shortcuts: Cmd+Shift+/ (Help menu)
# 6) Retina displays
@DimaRU
DimaRU / CMDeviceMotion.swift
Created October 10, 2019 14:54 — forked from travisnewby/CMDeviceMotion.swift
Determine the direction of "gaze" of the device in any orientation
extension CMDeviceMotion {
func gaze(atOrientation orientation: UIInterfaceOrientation) -> SCNVector4 {
let attitude = self.attitude.quaternion
let aq = GLKQuaternionMake(Float(attitude.x), Float(attitude.y), Float(attitude.z), Float(attitude.w))
let final: SCNVector4
switch orientation {
@DimaRU
DimaRU / README-Template.md
Created October 19, 2019 15:10 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@DimaRU
DimaRU / telegram_notification.sh
Created November 2, 2019 22:06 — forked from anson-vandoren/telegram_notification.sh
Travis-Telegram notification script
#!/bin/sh
##########################################################################
# Note: you must have set up your Travis CI environment variables for this
# project to include both TELEGRAM_TOKEN and TELEGRAM_CHAT_ID
# For more details, see the Telegram documentation at:
# - https://core.telegram.org/bots/api
# and the blog posts at:
# - https://ansonvandoren.com/posts/telegram-notification-on-deploy/
# - https://ansonvandoren.com/posts/travis-telegram-integration/