This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export DISPLAY=:0 | |
ts="$(date +%Y-%m-%d_%H:%M:%S)" | |
/usr/bin/notify-send -t 5000 "Ok. hi" $ts | |
#spd-say hello_my_friend |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import UIKit | |
struct H { | |
static func showOneBtnAlert(_ ctx: UIViewController, header: String, msg: String) { | |
let alert = UIAlertController(title: header, message: msg, preferredStyle: UIAlertControllerStyle.alert) | |
alert.addAction(UIAlertAction(title: Btn.ok, style: UIAlertActionStyle.default, handler: nil)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var spinner: UIActivityIndicatorView! | |
func setupSpinner(){ | |
spinner = UIActivityIndicatorView(frame: CGRect(x: 0, y: 0, width: 40, height:40)) | |
spinner.color = UIColor.gray | |
self.spinner.center = CGPoint(x:UIScreen.main.bounds.size.width / 2, y:UIScreen.main.bounds.size.height / 2) | |
self.view.addSubview(spinner) | |
spinner.hidesWhenStopped = true | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension String { | |
subscript (i: Int) -> String? { | |
if characters.count > i && i >= 0 { | |
return String(Array(self.characters)[i]) | |
} | |
return nil | |
} | |
subscript (r: Range<Int>) -> String? { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jar { | |
manifest { | |
attributes( | |
'Class-Path': configurations.compile.collect { it.getName() }.join(' '), | |
'Main-Class': 'App' | |
) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UIView { | |
func addConstraintsWithFormat(format: String, views: UIView...) { | |
var viewsDict = [String: UIView]() | |
for (index, view) in views.enumerated() { | |
view.translatesAutoresizingMaskIntoConstraints = false | |
viewsDict["v\(index)"] = view |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<key>NSAppTransportSecurity</key> | |
<dict> | |
<key>NSAllowsArbitraryLoads</key> | |
<true/> | |
</dict> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Needed in AndroidManifest: | |
<!-- Permission for using NFC hardware --> | |
<uses-permission android:name="android.permission.NFC"/> | |
<!-- Forcing device to have NFC hardware --> | |
<uses-feature android:name="android.hardware.nfc" android:required="true"/> | |
<!-- Registering app for receiving NFC's TAG_DISCOVERED intent --> | |
<intent-filter> | |
<action android:name="android.nfc.action.TAG_DISCOVERED"/> | |
<category android:name="android.intent.category.DEFAULT"/> | |
</intent-filter> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func scrollViewDidScroll(_ scrollView: UIScrollView) { | |
if (scrollView.contentOffset.y < -250){ | |
//reach top | |
print("Topppppppppppppppppppp") | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <stdio.h> | |
typedef unsigned char *pointer; | |
void show_bytes(pointer start, int len) { | |
int i; | |
for(i = 0; i < len; i++) { | |
printf("%p\t0x%.4x\n", start + i, start[i]); |