Skip to content

Instantly share code, notes, and snippets.

View ThasianX's full-sized avatar
🚀
Greatness is coming

Kevin ThasianX

🚀
Greatness is coming
View GitHub Profile
@jonidelv
jonidelv / Computed Properties in React.md
Last active March 11, 2023 17:14
Computed Properties in React

Computed Properties in React

Achieving Computed Properties the right way


React does not have computed properties out of the box like others frameworks do (Ember, Vue, etc.) so, how can we achieve this behaviour the right way ? The most common practice is to "compute" things in the render method if is a class component or just in the body if is a function component.

@welbesw
welbesw / PushManager.swift
Created March 7, 2018 23:56
A simple push notification manager.
import UIKit
import UserNotifications
protocol PushManagerDelegate {
func pushManagerUpdated()
}
class PushManager: NSObject {
static let sharedInstance = PushManager()
enum DateStride {
case year(Int)
case month(Int)
case day(Int)
var component: Calendar.Component {
switch self {
case .year(_):
return .year
@bizz84
bizz84 / ICloudUserIDProvider.swift
Created February 7, 2017 10:35
Code to get iCloud unique user ID or prompt user to sign in to iCloud
import CloudKit
enum ICloudUserIDResponse {
case success(record: CKRecordID)
case failure(error: Error)
case notSignedIn(accountStatus: CKAccountStatus)
}
class ICloudUserIDProvider: NSObject {
@rnapier
rnapier / pointvector.swift
Created September 14, 2016 17:07
Point and vector operations
// Vectors can be inverted
private prefix func - (operand: CGVector) -> CGVector {
return CGVector(dx: -operand.dx, dy: -operand.dy)
}
// Vectors can be added and subtracted
private func + (lhs: CGVector, rhs: CGVector) -> CGVector {
return CGVector(dx: lhs.dx + rhs.dx, dy: lhs.dy + rhs.dy)
}
private func - (lhs: CGVector, rhs: CGVector) -> CGVector {
@steipete
steipete / ios-xcode-device-support.sh
Last active May 11, 2025 13:30
Using iOS 15 devices with Xcode 12.5 (instead of Xcode 13)
# The trick is to link the DeviceSupport folder from the beta to the stable version.
# sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)
# Support iOS 15 devices (Xcode 13.0) with Xcode 12.5:
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/15.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
# Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions
# (A similar approach works for older versions too, just change the version number after DeviceSupport)
@briancroom
briancroom / Swift.md
Last active February 6, 2024 18:26
How to create a Swift modular library

I am trying to determine if it is possible to build a Swift dynamic library which is itself composed of one of more private modules, without needing to expose to that fact to outside users. My hope was that I could build the private module as a static library, which would be linked into the primary (dynamic) library. The dylib could then be deployed together with its swiftmodule and swiftdoc and be imported, with the private module and its symbols not being exposed at all.

Unfortunately, what I'm currently observing seems to indicate that the private module's swiftmodule also has to be available for the primary library to be successfully imported.

This can be reproduced as follows. I have the following directory structure:

./Greeter/Logger/Logger.swift:

public func log(_ message: String) {
@zacwest
zacwest / ios-font-sizes.swift
Last active July 24, 2025 22:08
iOS default font sizes - also available on https://www.iosfontsizes.com
let styles: [UIFont.TextStyle] = [
// iOS 17
.extraLargeTitle, .extraLargeTitle2,
// iOS 11
.largeTitle,
// iOS 9
.title1, .title2, .title3, .callout,
// iOS 7
.headline, .subheadline, .body, .footnote, .caption1, .caption2,
]

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Pull Request Process

  1. Ensure any install or build dependencies are removed before the end of the layer when doing a
@tsaqib
tsaqib / ideas.md
Last active August 30, 2025 01:39
Ideas that you can use for hackathons, competitions and research.

Ideas

I have collected and moderated these ideas from various public sources and put into one place so that problem solvers and solution developers may find inspirations. Because I wish to update it regularly, I have setup as a single page wiki. You may try these ideas on hackathons/competitions/research; some are quite intense problems and some are not. Many of the problems were prepared keeping Dhaka/Bangladesh in mind, but of course can be applied to just about any underdeveloped/developing and sometimes developed countries.

Categories:
  • Eradicate Extreme Poverty and Hunger
  • Education
  • Healthcare
  • Governance