Skip to content

Instantly share code, notes, and snippets.

Avatar

Liew Jun Tung LiewJunTung

View GitHub Profile
View MainActivity.kt
animation_button.setOnClickListener {
it.apply {
val transition = ChangeBounds()
transition.duration = 2000L
TransitionManager.beginDelayedTransition(constraint_parent_view, transition)
when {
translationX == 0f -> translationX = 450f
translationX < 0f -> translationX = 0f
translationX > 0f -> translationX = -450f
}
View AppDelegate.swift
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let json = "{\n \"a\": \"a\",\n \"a_\": \"a_\",\n \"a_a\": \"a_a\",\n \"a_a_\": \"a_a_\",\n \"a_a_a\": \"a_a_a\",\n \"a_a_a_\": \"a_a_a_\",\n \"a_a_a_a\": \"a_a_a_a\",\n \"a_a_a_a_\": \"a_a_a_a_\",\n \"a_a_a_a_a\": \"a_a_a_a_a\",\n \"a_a_a_a_a_\": \"a_a_a_a_a_\",\n \"a_a_a_a_a_a\": \"a_a_a_a_a_a\",\n \"a_a_a_a_a_a_\": \"a_a_a_a_a_a_\",\n \"a_a_a_a_a_a_a\": \"a_a_a_a_a_a_a\",\n \"a_a_a_a_a_a_a_\": \"a_a_a_a_a_a_a_\",\n \"a_a_a_a_a_a_a_a\": \"a_a_a_a_a_a_a_a\",\n \"a_a_a_a_a_a_a_a_\": \"a_a_a_a_a_a_a_a_\",\n \"a_a_a_a_a_a_a_a_a\": \"a_a_a_a_a_a_a_a_a\",\n \"a_a_a_a_a_a_a_a_a_\": \"a_a_a_a_a_a_a_a_a_\",\n \"a_a_a_a_a_a_a_a_a_a\": \"a_a_a_a_a_a_a_a_a_a\",\n \"a_a_a_a_a_a_a_a_a_a_\": \"a_a_a_a_a_a_a_a_a_a_\",\n \"a_a_a_a_a_a_a
View cond.dart
class Dog {
String name;
int age;
Dog(this.name, this.age);
}
class DogHouse {
Dog dog;
DogHouse(this.dog);
View spread.dart
void main(){
var map = {"a": "b"};
var map2 = {"b": "c"};
print({...map, ...map2, "c": "d"});
var list = ["a", "b"];
var list2 = ["c", "d"];
print([...list, ...list2, "f", "g"]);
}
View gist:42cdd3db454cf13dd11353b4d1dd2c81
import 'package:flutter/material.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
View dog.dart
class Dog {
String name;
int age;
Dog(this.name, this.age);
}
class Cat {
String name;
int age;
View async.dart
import 'dart:async';
Future<String> networkCallGetString() async {
await Future.delayed(Duration(seconds: 5));
return "Simulated Network Call";
}
doNetworkCall() async {
var result = networkCallGetString();
print(result);
View main.dart
extension NumberParsing on String {
int parseInt() {
return int.parse(this);
}
double parseDouble() {
return double.parse(this);
}
}
View CiImageResize.kt
package com.netvirta.ci_image_resize_plugin
import javax.imageio.ImageIO
import java.awt.image.BufferedImage;
import java.io.File
import javax.imageio.stream.ImageInputStream
class CiImageResize {
fun resize(inputJpgFilePath: String, outputJpgFilePath: String, outputWidth: Int, outputHeight: Int) {
View SymbolicLink.kt