Skip to content

Instantly share code, notes, and snippets.

View li9ht's full-sized avatar

li9ht li9ht

  • Kuala Lumpur , Malaysia
View GitHub Profile
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel
class MyFlutterActivity : FlutterActivity() {
private val CHANNEL = "com.example.myflutterapp/data"
val token = "dummy123"
override fun getCachedEngineId(): String {
class UserView extends StatefulWidget {
const UserView({Key? key}) : super(key: key);
@override
State<UserViewState> createState() => _UserViewState();
}
class _UserViewState extends State<UserViewState> {
var _token = "";
static const channelName = 'com.myflutterapp/data';
import UIKit
import Flutter
import FlutterPluginRegistrant
class ShowFlutterViewControler: UIViewController{
let userToken = "dummy123"
func showFlutter(){
let flutterEnggine = (UIApplication.shared.delegate as! AppDelegate).flutter_engine
import UIKit
import Flutter
import FlutterPluginRegistrant
class ShowFlutterViewControler: UIViewController{
func showFlutter(){
let flutterEnggine = (UIApplication.shared.delegate as! AppDelegate).flutter_engine
let flutterController = FlutterViewController(engine:flutterEnggine,nibName:nil,bundle:nil)
import FlutterPluginRegistrant
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
lazy var flutter_engine = FlutterEngine(name: "flutter_engine")
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
flutter_engine.run()
GeneratedPluginRegistrant.register(with: self.flutter_engine)
@li9ht
li9ht / gist:1b0cd827ada3a5c599dadab283440509
Last active September 14, 2016 09:15
letsencrypt and dokku
git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt
service nginx stop
./letsencrypt-auto certonly -d www.yourdomain.com
cert file location
/etc/letsencrypt/live/www.yourdomain.com/
cat fullchain.pem > server.crt
cat privkey.pem > server.key
@li9ht
li9ht / OnMukaUpdateListener.java
Last active August 29, 2015 14:21
android fragment listener
public interface OnMukaUpdateListener {
public void onMukaUpdate(String text);
}
@li9ht
li9ht / create-swap
Last active May 3, 2020 12:56
configure virtual memory on debian 7x64 digital ocean
#!/bin/sh
sudo fallocate -l 1G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo "/swapfile none swap sw 0 0" >> /etc/fstab
sysctl -w vm.swappiness=30
free