This file contains 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 'package:flutter/material.dart'; | |
class CurvePainter extends CustomPainter { | |
final Color paintColor; | |
CurvePainter(this.paintColor); | |
@override | |
void paint(Canvas canvas, Size size) { | |
final paint = Paint(); |
This file contains 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 | |
final class Box<T> { | |
typealias Listener = (T) -> Void | |
var listener: Listener? | |
var value: T { | |
didSet { | |
listener?(value) | |
} |
This file contains 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 'dart:convert'; | |
import 'dart:io'; | |
import 'package:flutter/material.dart'; | |
import 'package:http/http.dart' as http; | |
import '../../utils/constants.dart'; | |
import '../../utils/error/failure.dart'; | |
import '../../utils/extensions/extensions.dart'; | |
import '../../utils/injection_container.dart'; |
This file contains 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
/* | |
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp | |
server, but for some reason omit a client connecting to it. I added an | |
example at the bottom. | |
Save the following server in example.js: | |
*/ | |
var net = require('net'); |
This file contains 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() async { | |
//Dynamic List | |
var list = []; | |
list.add(1); | |
list.add('2'); | |
print(list); | |
// Callbacks | |
void downloadImage(Function(int) callback) { | |
int progress = 0; |
This file contains 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
{ | |
"triple_a_test": { | |
"prefix": "aaa", | |
"description": "AAA test", | |
"body": [ | |
"test(", | |
"\t'should $1',", | |
"\t() async {", | |
"\t\t// arrange", | |
"\t\t$2", |
This file contains 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
# Type a script or drag a script file from your workspace to insert its path. | |
environment=${ASSET_PREFIX} | |
# Name and path of the resource we're copying | |
GOOGLESERVICE_INFO_PLIST=GoogleService-Info.plist | |
GOOGLESERVICE_INFO_FILE=${PROJECT_DIR}/Google/${environment}/${GOOGLESERVICE_INFO_PLIST} | |
# Make sure GoogleService-Info.plist exists | |
echo "Looking for ${GOOGLESERVICE_INFO_PLIST} in ${GOOGLESERVICE_INFO_FILE}" |
This file contains 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 | |
struct Task: Codable { | |
var title: String | |
var isDone: Bool | |
} | |
enum Errors: Error { | |
case encodeError | |
case decodeError |
This file contains 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 | |
@propertyWrapper | |
struct UserDefaultsWrapper<Value: Codable> { | |
let key: String | |
let defaultValue: Value | |
let userDefaults = UserDefaults(suiteName: Constants.kGroupIdentifier) | |
var wrappedValue: Value { | |
get { |
This file contains 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
struct Contact: Decodable, CustomStringConvertible { | |
var id: String | |
@NestedKey | |
var firstname: String | |
@NestedKey | |
var lastname: String | |
@NestedKey | |
var address: String | |
enum CodingKeys: String, NestableCodingKey { |
NewerOlder