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
| final _textEditingController = TextEditingController(); | |
| int _maxLines; | |
| @override | |
| void initState() { | |
| super.initState(); | |
| _textEditingController.addListener(_textEditListener); | |
| } |
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
| // ref) https://gist.github.com/bmcbride/62600e48274961819084 | |
| var token = "your gitlab api token"; | |
| function onFormSubmit(e) { | |
| var title = e.values[2]; | |
| var email = e.values[1]; | |
| var detail = e.values[3]; | |
| var body = " From: "+email+"\n\n" + detail; | |
| var labels = "お問い合わせフォームから" |
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
| void main() { | |
| // サンプルデータ | |
| Map<String, bool> members = Map<String, bool>() | |
| ..putIfAbsent("userID1", () => true) | |
| ..putIfAbsent("userID2", () => true); | |
| print(members); | |
| var transMember = members.entries.map((member) { | |
| return <String, dynamic>{member.key: member.value}; | |
| }); |
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
| enum Type { Hoge, Fuga } | |
| void main() { | |
| print(Type.Hoge.toString()); | |
| print(Type.Hoge.toString().split('.')[1]); | |
| // output: | |
| // Type.Hoge | |
| // Hoge | |
| } |
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
| class ScalableImageScreen extends StatelessWidget { | |
| final List<String> imageUrls; | |
| final int position; | |
| ScalableImageScreen({Key key, this.imageUrls, this.position}) | |
| : super(key: key); | |
| @override | |
| Widget build(BuildContext context) { |
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
| echo "GoogleService start" | |
| #rm -rf "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist" | |
| echo "-----${CONFIGURATION}-----" | |
| echo "-----${SRCROOT}-----" | |
| if [ "${CONFIGURATION}" = "Debug" ] || [ "${CONFIGURATION}" = "Debug-development" ] || [ "${CONFIGURATION}" = "Release-development" ]; then | |
| cp "$SRCROOT/Runner/GoogleService-Info-development.plist" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist" | |
| echo "Development GoogleService-Info copied." | |
| elif [ "${CONFIGURATION}" = "Release" ] || [ "${CONFIGURATION}" = "Release-production" ] || [ "${CONFIGURATION}" = "Debug-production" ]; then |
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
| let required = "1.0.10" | |
| let current = "1.0.2" | |
| let result = required.compare(current, options: .numeric) | |
| print(result.rawValue) |
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 PlaygroundSupport | |
| PlaygroundPage.current.needsIndefiniteExecution = true | |
| let url = URL(string: "https://jsonplaceholder.typicode.com/posts/1")! | |
| func fetch(callback:( (String) -> Void)? = nil) { | |
| let task = URLSession.shared.dataTask(with: url) { (data, response, error) in | |
| guard error == nil else { | |
| callback?(error?.localizedDescription ?? "エラーです") |
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
| enum FromNagative: Int { | |
| case a = -1 | |
| case b | |
| case c | |
| } | |
| print(FromNagative.a.rawValue) // -1 | |
| print(FromNagative.b.rawValue) // 0 | |
| print(FromNagative.c.rawValue) // 1 |