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
@RequestMapping(value = "/change/text", method = RequestMethod.POST) | |
public OutputMessage changeText(@RequestBody InputMessage msg) { | |
String fileName = "/home/a/temp/writtenByJava.txt"; | |
System.out.println("Writing to file " + fileName); | |
writeToFileHelper(fileName, msg.getText()); | |
return new OutputMessage(msg.getFrom(), msg.getText() + " - this is response!", new Date().toString()); |
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
// MARK: TextViewDelegate methods for hiding keyboard by tapping anywhere and restrincting 500 chars | |
extension UIViewController { | |
@objc func textViewDidBeginEditing(_ textView: UITextView) { | |
} | |
@objc func textViewDidEndEditing(_ textView: UITextView) { | |
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
^(?!.*(Choreographer)).*$ |
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]); |
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
// 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
<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
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
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 String { | |
subscript (i: Int) -> String? { | |
if characters.count > i && i >= 0 { | |
return String(Array(self.characters)[i]) | |
} | |
return nil | |
} | |
subscript (r: Range<Int>) -> String? { |