Skip to content

Instantly share code, notes, and snippets.

View Austinate's full-sized avatar

Ostap Austinate

View GitHub Profile
@jboner
jboner / latency.txt
Last active June 27, 2024 02:47
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@steipete
steipete / PSPDFThreadSafeMutableDictionary.m
Last active December 10, 2022 09:37
Simple implementation of a thread safe mutable dictionary. In most cases, you want NSCache instead, but it can be useful in situations where you want to manually control what is evicted from the cache in low memory situations.**Warning:** I only use this for setting/getting keys. Enumeration is not thread safe here and will still throw exception…
//
// PSPDFThreadSafeMutableDictionary.m
//
// Copyright (c) 2013 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
@cliss
cliss / organize-photos.py
Created October 6, 2013 14:43
Photo management script. This script will copy photos from "~/Pictures/iPhone Incoming" into a tree the script creates, with folders representing month and years, and photo names timestamped. Completely based on the work of the amazing Dr. Drang; see here: http://www.leancrew.com/all-this/2013/10/photo-management-via-the-finder/ You can see more…
#!/usr/bin/python
import sys
import os, shutil
import subprocess
import os.path
from datetime import datetime
######################## Functions #########################
@arturlector
arturlector / ios-test-task-1.md
Last active October 26, 2018 13:08
Тестовое задание на позицию iOS-разработчика в Flatstack

Написать простой клиент для VK.

Минимальные требования:

###Скрины:

  • Авторизация пользователя (Oauth 2.0). (Контроллер LoginController - содержит кнопку [Login with VK] для перехода на страницу авторизации).
  • Cписок постов: отображение постов из новостной ленты. (по желанию количество лайков и репостов). (Контроллер NewsController - появляется после авторизации пользователя, содержит список постов со следующими полями: имя пользователя, дата поста, аватар, текст поста, прикрепленная картинка: 1-2). (* Отображать видео и аудио файлы не нужно).
@omz
omz / Dropbox File Picker.py
Last active May 17, 2020 21:47
Dropbox File Picker.py
# IMPORTANT SETUP INSTRUCTIONS:
#
# 1. Go to http://www.dropbox.com/developers/apps (log in if necessary)
# 2. Select "Create App"
# 3. Select the following settings:
# * "Dropbox API app"
# * "Files and datastores"
# * "(No) My app needs access to files already on Dropbox"
# * "All file types"
# * (Choose any app name)
@pbock
pbock / buergerbot.rb
Last active April 22, 2024 10:58
Bürgerbot: Refreshes the Berlin Bürgeramt page until an appointment becomes available, then notifies you.
#!/usr/bin/env ruby
require 'watir-webdriver'
def log (message) puts " #{message}" end
def success (message) puts "+ #{message}" end
def fail (message) puts "- #{message}" end
def notify (message)
success message.upcase
system 'osascript -e \'Display notification "Bürgerbot" with title "%s"\'' % message
rescue StandardError => e
@arturlector
arturlector / ios-task-racoonsgroup.md
Last active January 29, 2016 12:07
ios-task-racoonsgroup

Написать простой клиент для Instagram.

Минимальные требования:

  • Авторизация пользователя (Oauth 2.0). (Контроллер LoginController - содержит кнопку [Login with Instagram] для перехода на страницу авторизации).
  • Отображаем список фотографий аккаунта http://instagram.com/racoonsgroup. (Контроллер HomeController - появляется после авторизации пользователя, фотографии отображаются в виде CollectionView
  • Поиск фотографий по тегу. (контроллер SearchController - выводит найденные картинки по введенному тегу).
@arturlector
arturlector / project-evaluation.md
Last active September 13, 2016 10:55
project-evaluation

Схема оценки iOS проекта:

##1. Deploy. Основа проекта (ios-base).

  • Настройка репозитория.
  • Настройка проекта и подготовка основы для проекта. (Адаптация ios-base для нового проекта).
  • Настройка сервисов для проекта: (Crash reports, Analytics, Performance analyzing etc.).
  • Настройка Continuous Integration. Continuous Testing.
@ShingoFukuyama
ShingoFukuyama / objective-c-ripple-effect.m
Last active December 11, 2017 02:14
Ripple Effect for iOS Objective-C
// @property (nonatomic, strong) NSArray *colors;
// macro from https://gist.github.com/uechi/7688152
//RGB color macro
#define UIColorFromRGB(rgbValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
@jonathan-beebe
jonathan-beebe / AppDelegate.swift
Last active November 1, 2023 19:11
Detect if a Swift iOS app delegate is running unit tests
import UIKit
// Detect if the app is running unit tests.
// Note this only detects unit tests, not UI tests.
func isRunningUnitTests() -> Bool {
let env = NSProcessInfo.processInfo().environment
if let injectBundle = env["XCInjectBundle"] {
return NSString(string: injectBundle).pathExtension == "xctest"
}
return false