Skip to content

Instantly share code, notes, and snippets.

View RomanTruba's full-sized avatar

Roman Truba RomanTruba

View GitHub Profile
include ':vksdk_library',':my_project'
project(":vksdk_library").projectDir = file("Library/vk-android-sdk/vksdk_library")
@RomanTruba
RomanTruba / VKDownload.java
Created September 22, 2015 22:40
Download music from VK
import com.sun.istack.internal.Nullable;
import org.apache.commons.lang.StringUtils;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import java.io.BufferedReader;
import java.io.File;
import XCTest
final class LockingTests: XCTestCase {
func testSpinLock() {
var spinLock = OS_SPINLOCK_INIT
executeLockTest { (block) in
OSSpinLockLock(&spinLock)
block()
OSSpinLockUnlock(&spinLock)
@RomanTruba
RomanTruba / Synchronization_test_iOS_SDK10
Last active December 28, 2017 13:06
Swift 3, Xcode 8 updated. Also test os_unfair_lock. Much more real life example: working with an array
import XCTest
final class LockingTests: XCTestCase {
// Unsafe in iOS, may cause priority inversion
// But fastest
func testSpinLock() {
var spinLock = OS_SPINLOCK_INIT
executeLockTest { (block) in
OSSpinLockLock(&spinLock)