Skip to content

Instantly share code, notes, and snippets.

Avatar

Roman Truba RomanTruba

View GitHub Profile
@RomanTruba
RomanTruba / Synchronization_test_iOS_SDK10
Last active Dec 28, 2017
Swift 3, Xcode 8 updated. Also test os_unfair_lock. Much more real life example: working with an array
View Synchronization_test_iOS_SDK10
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)
View Synchronization_test_iOS_SDK9
import XCTest
final class LockingTests: XCTestCase {
func testSpinLock() {
var spinLock = OS_SPINLOCK_INIT
executeLockTest { (block) in
OSSpinLockLock(&spinLock)
block()
OSSpinLockUnlock(&spinLock)
@RomanTruba
RomanTruba / VKDownload.java
Created Sep 22, 2015
Download music from VK
View VKDownload.java
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;
View gist:11141990
include ':vksdk_library',':my_project'
project(":vksdk_library").projectDir = file("Library/vk-android-sdk/vksdk_library")
You can’t perform that action at this time.