Skip to content

Instantly share code, notes, and snippets.

View shakemno's full-sized avatar

Manolis Pahlke shakemno

View GitHub Profile

Keybase proof

I hereby claim:

  • I am shakemno on github.
  • I am shakemno (https://keybase.io/shakemno) on keybase.
  • I have a public key ASDvn_QA3367neXL2hIJbJwWgw2JabJGyCIMCfXyt_l07wo

To claim this, I am signing this object:

@shakemno
shakemno / gracefully_ctrl-c_shell_bg_task.sh
Last active October 8, 2017 22:49
gracefully ctrl-c shell bg_task
#!/bin/sh
echo "starting background workflow..."
trap 'trap - SIGINT SIGTERM EXIT; $(kill $BGPID; exit 255)' SIGINT SIGTERM EXIT
eval 'gulp workflow &'
BGPID=$!
wait $BGPID
echo "\workflow stopped..."
exit
//:
//: UIView Animation Syntax Sugar
//:
//: Created by Andyy Hope on 18/08/2016.
//: Twitter: @andyyhope
//: Medium: Andyy Hope, https://medium.com/@AndyyHope
import UIKit
extension UIView {
import Dispatch
private var throttleWorkItems = [AnyHashable: DispatchWorkItem]()
private var lastDebounceCallTimes = [AnyHashable: DispatchTime]()
private let nilContext: AnyHashable = arc4random()
public extension DispatchQueue {
/**
- parameters:
- deadline: The timespan to delay a closure execution
@shakemno
shakemno / NSAttributtedString+Extension.swift
Last active April 27, 2018 11:28
NSAttributtedString get attribute value
func attributeValue<T>(_ key: NSAttributedStringKey) -> T? {
let attributes = self.attributes(at: 0, effectiveRange: nil)
guard attributes.keys.contains(key), let val = attributes[key] else {
return nil
}
return val as? T
}
@shakemno
shakemno / encrypt_xor1.swift
Created November 1, 2018 11:10 — forked from alskipp/encrypt_xor1.swift
Swift encrypt/decrypt string using XOR
import Foundation
extension Character {
func utf8() -> UInt8 {
let utf8 = String(self).utf8
return utf8[utf8.startIndex]
}
}
func encrypt(c:Character, key:Character) -> String {
@shakemno
shakemno / check_plist.sh
Created November 13, 2018 16:36
Check if plist is OK
plutil NAME.plist
@shakemno
shakemno / AllNotifications.swift
Last active November 11, 2020 16:46
Get all NotificationCenter events (example using ReactiveSwift) #debug
NotificationCenter
.default.reactive.notifications(forName: nil, object: nil)
.take(duringLifetimeOf: self)
.observeValues { (note) in
print("👻 \(note.description)")
}
@shakemno
shakemno / SKStoreReviewDummyClass.m
Created December 6, 2018 08:56 — forked from username0x0a/SKStoreReviewDummyClass.m
Dummy class easing detection whether the native StoreKit in-app Review alert has been fired or not. Useful as a callback when firing the limited system rating alert.
@interface SKStoreReviewDummyClass : NSObject @end
@implementation SKStoreReviewDummyClass
+ (void)load
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
Class class = [self class];
@shakemno
shakemno / InAppReviewRequest.swift
Created December 6, 2018 09:15
Untested idea to handle the native StoreKit in-app Review alert presentation
NotificationCenter
.default.reactive.notifications(forName: nil, object: nil)
.take(duringLifetimeOf: self)
.observe(on: UIScheduler())
.filter { note in
return note.name == Notification.Name.init("UITextEffectsWindowDidRotateNotification")
}
.observeValues { (note) in