Skip to content

Instantly share code, notes, and snippets.

View YanSte's full-sized avatar
🌎
Working from Zurich

Yannick Stephan YanSte

🌎
Working from Zurich
View GitHub Profile
@KennethanCeyer
KennethanCeyer / open_zshrc_on_mac.sh
Created February 3, 2017 17:29
Open zshrc file to note on Mac
open ~/.zshrc
@rwoloszyn
rwoloszyn / SettingsTest.java
Created October 3, 2016 11:45
Reset singleton field during JUnit tests, roboelectric junit tests
@After
public void teaddown() {
setting.clear();
resetSingleton(ErgoSettings.class, "sInstance");
}
public static void resetSingleton(Class clazz, String fieldName) {
Field instance;
try {
extension String {
var localized: String {
return NSLocalizedString(self, comment: "")
}
}
// Which allows for:
"Hello world".localized
import UIKit
extension UIImage {
// colorize image with given tint color
// this is similar to Photoshop's "Color" layer blend mode
// this is perfect for non-greyscale source images, and images that have both highlights and shadows that should be preserved
// white will stay white and black will stay black as the lightness of the image is preserved
func tint(tintColor: UIColor) -> UIImage {
@macguru
macguru / gist:b7a01e3f0e9ae6f350d5
Last active May 10, 2020 20:58
Interface sizes a regular Universal app must support with iOS 11 when supporting all devices. Starts with iPhone 5 and goes up to iPad Pro 12.9".
COMPACT WIDTH (stacked view)
- 320 x 568 pt
-> iPhone 5, 5s
- 320 x 768 pt
-> iPad 9.7" Split Landscape 2/3 right
- 320 x 834 pt
-> iPad 10.5" Split Landscape 2/3 right
- 320 x 1024 pt
-> iPad 9.7" Split Portrait right
Project # of Top 100 Free Apps (US)
facebook-ios-sdk 67
Bolts-iOS 48
AFNetworking 39
Google-Mobile-Ads-SDK 38
Reachability (Apple) 38
Crashlytics 37
Flurry-iOS-SDK 31
CocoaPods 30
GoogleConversionTracking 29
@pyrtsa
pyrtsa / Random.example.swift
Last active March 23, 2017 11:51
Sampling random numbers in Swift
import Random
random(0 ..< 10) // Int
random(1 ... 1000_000) // Int
random(-1000_000 ... 1000_000) // Int
random(Int.min ... Int.max) // Int
randomMax(UInt64.max) // UInt64
random(0 ... UInt64.max) // UInt64
random(1 ... UInt(10)) // UInt
func encode<T>(var value: T) -> NSData {
return withUnsafePointer(&value) { p in
NSData(bytes: p, length: sizeofValue(value))
}
}
func decode<T>(data: NSData) -> T {
let pointer = UnsafeMutablePointer<T>.alloc(sizeof(T.Type))
data.getBytes(pointer)
@rxaviers
rxaviers / gist:7360908
Last active June 6, 2024 22:35
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
ACTION
AD_HOC_CODE_SIGNING_ALLOWED
ALTERNATE_GROUP
ALTERNATE_MODE
ALTERNATE_OWNER
ALWAYS_SEARCH_USER_PATHS
ALWAYS_USE_SEPARATE_HEADERMAPS
APPLE_INTERNAL_DEVELOPER_DIR
APPLE_INTERNAL_DIR
APPLE_INTERNAL_DOCUMENTATION_DIR