Skip to content

Instantly share code, notes, and snippets.

View avdyushin's full-sized avatar

Grigory Avdyushin avdyushin

View GitHub Profile
@avdyushin
avdyushin / DisplayLink.swift
Last active June 4, 2019 08:08 — forked from CanTheAlmighty/DisplayLink.swift
DisplayLink for OSX
@avdyushin
avdyushin / convert_books.py
Created April 30, 2019 10:55
Conver Unbound Bible format into SQL
#!/usr/bin/python
import fileinput
version = "kjv"
header = """--
--
--
@avdyushin
avdyushin / UnitTests.swift
Created February 5, 2019 10:44
Unit Tests in Swift Playground
class Tests: XCTestCase {
override func setUp() {
super.setUp()
}
override func tearDown() {
super.tearDown()
}
}
@avdyushin
avdyushin / hasPrefix.swift
Last active August 24, 2021 08:15
Swift 4 hasPrefix in switch
let string = "www."
func hasPrefix(_ prefix: String) -> (String) -> Bool {
return { value in value.hasPrefix(prefix) }
}
func ~=(block: (String) -> Bool, string: String) -> Bool {
return block(string)
}
@avdyushin
avdyushin / GIF-Screencast-OSX.md
Created September 19, 2018 08:08 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@avdyushin
avdyushin / reorder_photos.py
Last active June 20, 2018 19:52
Reorder photos by Exif date
#!/usr/bin/python
# coding: utf8
import io
import re
import time
import shutil
import os.path
import hashlib
import argparse
@avdyushin
avdyushin / XCTestCase+Expectation.swift
Last active December 1, 2016 10:59 — forked from cgoldsby/XCTestCase+Expectation.swift
XCTestCase extension with boilerplate code for unit testing async functions (waiting for expectations)
//
// AsyncTests.swift
//
import XCTest
// MARK: Async Helper Extension
extension XCTestCase {
@avdyushin
avdyushin / convert.sh
Created July 11, 2016 13:51
Covert paymentfont.css to Swift cases
#!/bin/sh
if [ -z $1 ]; then
echo "Usage: ${0} file"
exit -1
fi
cat $1 | \
grep .pf- | \
sed -e 's/.pf-//g' | \
@avdyushin
avdyushin / storage.swift
Last active August 28, 2023 14:35
CoreData stack for iOS 9 and iOS 10 using Swift 3
//
// Storage.swift
//
// Created by Grigory Avdyushin on 30.06.16.
// Copyright © 2016 Grigory Avdyushin. All rights reserved.
//
import UIKit
import CoreData
@avdyushin
avdyushin / swift-kvo-example.swift
Created June 21, 2016 14:37 — forked from correia/swift-kvo-example.swift
A quick example for how to use Foundation style KVO from Swift. (Official documentation from Apple is forthcoming.)
//
// Swift-KVO
//
// Created by Jim Correia on 6/5/14.
// Copyright (c) 2014-2015 Jim Correia. All rights reserved.
//
// Update: 6/17/2014
//
// KVOContext has gone away; use the same idiom you'd use from Objective-C for the context
//