Skip to content

Instantly share code, notes, and snippets.

View SpectralDragon's full-sized avatar
🎯
Focusing

Vladislav Prusakov SpectralDragon

🎯
Focusing
View GitHub Profile
@douglashill
douglashill / KeyboardTableView.swift
Last active March 30, 2023 22:01
A UITableView that allows navigation and selection using a hardware keyboard.
// Douglas Hill, December 2018
// Made for https://douglashill.co/reading-app/
// Find the latest version of this file at https://github.com/douglashill/KeyboardKit
import UIKit
/// A table view that allows navigation and selection using a hardware keyboard.
/// Only supports a single section.
class KeyboardTableView: UITableView {
// These properties may be set or overridden to provide discoverability titles for key commands.
@cmf028
cmf028 / aabb_transform.comp
Last active May 24, 2025 15:06
Optimized matrix transforms of an AABB to an AABB
// The MIT License (MIT)
// Copyright (c) 2018 cmf028
// 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 furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
@yycking
yycking / JavaScriptCore+fetch.swift
Last active March 19, 2025 13:32
add fetch, console.log and Promise.then/catch to JavaScriptCore on iOS/Mac
import JavaScriptCore
extension JSContext {
subscript(key: String) -> Any {
get {
return self.objectForKeyedSubscript(key) as Any
}
set{
self.setObject(newValue, forKeyedSubscript: key as NSCopying & NSObjectProtocol)
}
@nidx
nidx / swifterRange.swift
Created May 22, 2018 18:58
My Hack around range headers with swifter
import Foundation
import Swifter
public func fileHttpResponseWithRange(r: HttpRequest, data: Data) -> HttpResponse {
powerRanger:if let rangeHeader = r.headers["range"] {
let rangeExpression = try! NSRegularExpression(pattern: "bytes=(\\d*)-(\\d*)", options: .caseInsensitive)
let matches = rangeExpression.matches(in: rangeHeader, options: .anchored, range: NSRange(location: 0, length: rangeHeader.characters.count))
guard let match = matches.first, match.numberOfRanges == 3 else {
break powerRanger
@holzschu
holzschu / LLVM_for_iOS.sh
Last active December 19, 2024 20:17
Cross-compiling LLVM for iOS
#! /bin/bash
curl http://releases.llvm.org/6.0.0/llvm-6.0.0.src.tar.xz -O
tar xvzf llvm-6.0.0.src.tar.xz
rm llvm-6.0.0.src.tar.xz
cd llvm-6.0.0.src
# get clang
pushd tools
curl http://releases.llvm.org/6.0.0/cfe-6.0.0.src.tar.xz -O

General

  • Что такое "Project Purple"?
  • Каких Русских/Иностранных iOS программистов/медийных личностей вы знаете? (Steve Voznyak, Chris Eidhof, Florian Kugler, Mattt Thompson, Ray Wenderlich, Егор Толстой, Андрей Панов, Александр Зимин)
  • Какие сайты читаете?
  • NSRunLoop: что это? как работает? для чего нужно?
  • Что такое UIApplication? UIApplication delegate? Каким образом вызываются методы делегата?
@inamiy
inamiy / SwiftElmFrameworkList.md
Last active March 11, 2024 10:20
React & Elm inspired frameworks in Swift
@NikAshanin
NikAshanin / CopyPasteDetection
Created April 14, 2017 19:01
CopyPasteDetection
# Running CPD
pmd cpd --files ${EXECUTABLE_NAME} --minimum-tokens 50 --language swift --encoding UTF-8 --format net.sourceforge.pmd.cpd.XMLRenderer > cpd-output.xml --failOnViolation true
# Running script
php ./common_strings/cpd_script.php -cpd-xml cpd-output.xml
@JadenGeller
JadenGeller / Cluster.swift
Created March 13, 2017 01:27
Class Cluster
class Number /* class cluser */ {
class Int8: Number {
var value: Swift.Int8
init(_ value: Swift.Int8) { self.value = value }
}
class Int: Number {
var value: Swift.Int
init(_ value: Swift.Int) { self.value = value }
}
@moflo
moflo / MFBadgeButton
Created February 3, 2017 17:59
Swift add badge to UIButton - MFBadgeButton.swift
class MFBadgeButton : UIButton {
var badgeValue : String! = "" {
didSet {
self.layoutSubviews()
}
}
override init(frame :CGRect) {