Skip to content

Instantly share code, notes, and snippets.

View artemsmikh's full-sized avatar

Artem Mikhailov artemsmikh

View GitHub Profile
@csknns
csknns / sort_sources.rb
Last active October 18, 2022 12:18
Script to sort the files in the 'Compile Sources', 'Copy Bundle Resources' and 'Copy files' sections under Build Phase in Xcode
#!/usr/bin/env ruby
require 'xcodeproj'
require 'set'
project_file, target_name = ARGV
# open the project
project = Xcodeproj::Project.open(project_file)
# find the target
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
As of iOS 11/macOS High Sierra, and only including ones in Foundation and CoreFoundation
Strings:
_NSCFString - a CFStringRef or CFMutableStringRef. This is the most common type of string object currently.
- May have 8 bit (ASCII) or 16 bit (UTF-16) backing store
_NSCFConstantString - a compile time constant CFStringRef, like you'd get with @"foo"
- May also be generated by dynamic string creation if matches a string in a pre-baked table of common strings called the StringROM
NSBigMutableString - an NSString backed by a CFStorage (https://github.com/opensource-apple/CF/blob/master/CFStorage.h) for faster handling of very large strings
NSCheapMutableString - a very limited NSMutableString that allows for zero-copy initialization. Used in NSFileManager for temporarily wrapping stack buffers.
@AlexKMDev
AlexKMDev / script.sh
Created February 21, 2017 17:40
Carthage Build Phase
for framework in $(find $SRCROOT/Carthage/Build/iOS/ -name "*.framework"); do
SCRIPT_INPUT_FILE_0=$framework SCRIPT_INPUT_FILE_COUNT=1 carthage copy-frameworks
done
@starhoshi
starhoshi / observer.swift
Created January 12, 2017 16:47
Swift observer pattern.
import Foundation
protocol Observer {
var id: String { get }
func update(_ string: String)
}
extension Observer {
func update(_ string: String) {
print("\(type(of: self)) に届いた新しい値は \(string) です。")
@Shou
Shou / discord_webm.user.js
Last active July 10, 2022 20:02
Discord WebM embedder
// ==UserScript==
// @name Discord WebM embed
// @description Embeds uploaded and linked WebM files
// @namespace Shou
// @include https://discordapp.com/channels/*
// @version 1
// ==/UserScript==
var styleElem;
@seangenabe
seangenabe / kasi-time.user.js
Last active November 18, 2017 16:56
kasi-time enabler
// ==UserScript==
// @name kasi-time enabler
// @namespace http://example.com/
// @version 0.2
// @description
// @match http://www.kasi-time.com/*
// @copyright 2012+, You
// @downloadUrl https://gist.github.com/seangenabe/cc7cd26c791d16d244d7/raw/kasi-time.user.js
// @updateUrl https://gist.github.com/seangenabe/cc7cd26c791d16d244d7/raw/kasi-time.user.js
// ==/UserScript==
@danielesegato
danielesegato / .gitignore
Last active May 5, 2017 01:06
Android development Git Ignores
# Android
gen/
build/
local.properties
# Old Android
bin/
proguard/
# suggestion: also ignore libs/*.properties files for old eclipse project
# can't be added here because multiple libs/ directory can be around in different paths
@kristopherjohnson
kristopherjohnson / locking.swift
Last active June 5, 2021 03:04
Simple synchronization functions for Swift, wrapping the Cocoa NSLocking classes
import Foundation
/// Protocol for NSLocking objects that also provide tryLock()
public protocol TryLockable: NSLocking {
func tryLock() -> Bool
}
// These Cocoa classes have tryLock()
extension NSLock: TryLockable {}
extension NSRecursiveLock: TryLockable {}
@mbinna
mbinna / podforceupdate.sh
Created December 4, 2012 09:43
Clear CocoaPods cache, re-download and re-install all pods
#!/usr/bin/env bash
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update