Skip to content

Instantly share code, notes, and snippets.

@nezhyborets
nezhyborets / mergegenstrings.py
Created March 20, 2018 16:23 — forked from yoichitgy/mergegenstrings.py
A script to generate .strings file for .swift, .m, .storyboard and .xib files by genstrings and ibtool commands, and merge them with existing translations.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Localize.py - Incremental localization on XCode projects
# João Moreno 2009
# http://joaomoreno.com/
# Modified by Steve Streeting 2010 http://www.stevestreeting.com
# Changes
# - Use .strings files encoded as UTF-8
@nezhyborets
nezhyborets / AssignmentAtomicity.m
Created March 27, 2017 10:30
AssignmentAtomicity
@implementation Test1 {
NSString *stringProp;
}
- (instancetype)init {
self = [super init];
if (self) {
[self test];
}
@nezhyborets
nezhyborets / cornerRadiusInspectable.swift
Last active February 16, 2017 12:00
Inspectable corner radius for all UIViews
//Inspectable corner radius for all UIViews
extension UIView {
@IBInspectable var cornerRadius: CGFloat {
get {
return layer.cornerRadius
}
set {
layer.cornerRadius = newValue
layer.masksToBounds = newValue > 0
}
if let controller = s.feedbackDisplayController, controller.feedbackFormShouldShow() {
let controller = FeedbackViewController(controlsAB: controller.controlsAB(), name: controller.userName)
controller.modalTransitionStyle = .crossDissolve
controller.modalPresentationStyle = .overCurrentContext
if s.presentingViewController != nil {
s.present(controller, animated: true, completion: nil)
} else {
s.parent?.present(controller, animated: true, completion: nil)
}
static func login(completion: (Result<(User, Bool)>) -> ()) {
let digits = Digits.sharedInstance()
let oauthSigning = DGTOAuthSigning(authConfig:digits.authConfig, authSession:digits.session())
let authHeaders = oauthSigning.OAuthEchoHeadersToVerifyCredentials()
print(authHeaders)
UIPasteboard.generalPasteboard().string = authHeaders.description
guard let urlString = authHeaders[TWTROAuthEchoRequestURLStringKey] as? String else {
let error = ErrorGenerator.customErrorWithMessage("TWTROAuthEchoRequestURLStringKey not found in auth headers")
@nezhyborets
nezhyborets / PushManager.swift
Created June 20, 2015 12:10
ONXPushManager subclass example
//
// PushManager.swift
// Debts
//
// Created by Alexei on 13.04.15.
// Copyright (c) 2015 Onix. All rights reserved.
//
import UIKit
import AudioToolbox