Skip to content

Instantly share code, notes, and snippets.

#
# Original version by Grant Parnell is offline (http://digitaldj.net/2011/07/21/trim-enabler-for-lion/)
# Update July 2014: no longer offline, see https://digitaldj.net/blog/2011/11/17/trim-enabler-for-os-x-lion-mountain-lion-mavericks/
#
# Looks for "Apple" string in HD kext, changes it to a wildcard match for anything
#
# Alternative to http://www.groths.org/trim-enabler-3-0-released/
# Method behind this madness described: http://forums.macrumors.com/showthread.php?t=1409151&page=4
# See discussion in comments here: https://www.macupdate.com/app/mac/39654/lion-tweaks
# And here: http://forums.macrumors.com/showthread.php?t=1410459
#
# Original version by Grant Parnell is offline (http://digitaldj.net/2011/07/21/trim-enabler-for-lion/)
# Update July 2014: no longer offline, see https://digitaldj.net/blog/2011/11/17/trim-enabler-for-os-x-lion-mountain-lion-mavericks/
#
# Looks for "Apple" string in HD kext, changes it to a wildcard match for anything
#
# Alternative to http://www.groths.org/trim-enabler-3-0-released/
# Method behind this madness described: http://forums.macrumors.com/showthread.php?t=1409151&page=4
# See discussion in comments here: https://www.macupdate.com/app/mac/39654/lion-tweaks
# And here: http://forums.macrumors.com/showthread.php?t=1410459
@interface myViewController: UIViewController <CLLocationManagerDelegate>
CLLocationManager *locationManager;
CLLocation *currentLocation;
@end
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let urlpath = Bundle.main.path(forResource: "Info", ofType: "plist")
let url = NSURL.fileURL(withPath: urlpath!)
let test = FileSysytemUrl(url as NSURL)
if (test == nil) {
@AlexZverusha
AlexZverusha / gist:ef3fc4ce4525316f8460180fc8a51b57
Last active July 24, 2017 19:32
Localized string extension
extension String {
var localized: String {
return NSLocalizedString(self, tableName: nil, bundle: Bundle.main, value: "", comment: "")
}
}
//example
//"test".localized
// "test " = "тест";
@AlexZverusha
AlexZverusha / gist:2000e78db6b3ae00e46048068ad5022c
Created July 26, 2017 04:39
Custom TextField with validation and animation
import UIKit
enum typeTextField {
case email
case password
case text
}
UIView.animate(withDuration: 1.0, animations: { [weak self] in
self?.view.layoutIfNeeded()
})
UIView.animate(withDuration: 0.0, delay: 0.0, options: [.curveEaseOut], animations: {
//self.calendarHeight.constant = self.minCalendarHeight
self.view.layoutIfNeeded()
self.calendarView.layoutIfNeeded()
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
struct GenericDictionary<Key: Hashable, Value> {
private var data: [Key: Value]
init(data: [Key: Value]) {
self.data = data
}
subscript<T>(key: Key) -> T? {
return data[key] as? T
}
@AlexZverusha
AlexZverusha / MBCheckBox.h
Created August 8, 2017 08:01
CheckBox by Vladimir Kalinichenko
#import "MBButton.h"
@interface MBCheckBox : MBButton
@property (nonatomic) BOOL isActive;
- (void)setActivated:(BOOL)activated animated:(BOOL)animated;
@end