Skip to content

Instantly share code, notes, and snippets.

@alvinthen
alvinthen / settings.json
Last active February 20, 2018 08:46
VSCode config
// Place your settings in this file to overwrite the default settings
{
"editor.fontFamily": "Fira Code",
"editor.fontLigatures": true,
"editor.fontSize": 16,
"editor.fontWeight": "400",
"editor.renderControlCharacters": false,
"editor.renderWhitespace": "all",
"editor.rulers": [100],
"editor.scrollBeyondLastLine": false,
@alvinthen
alvinthen / .eslintrc
Created October 25, 2017 06:21
eslint config
{
"parser": "babel-eslint",
"plugins":[
"flowtype"
],
"extends": [
"airbnb",
"plugin:flowtype/recommended"
],
"rules": {
@alvinthen
alvinthen / index.js
Created April 2, 2018 15:39
Kurento browser
var ws = new WebSocket('ws://localhost:8080');
var videoInput;
var videoOutput;
var webRtcPeer;
var state = null;
const I_CAN_START = 0;
const I_CAN_STOP = 1;
const I_AM_STARTING = 2;
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: MyWidget(),
);
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: ListViewBuilder(),
);
@alvinthen
alvinthen / main.dart
Created August 26, 2024 01:35
useEffect example
// Copyright 2019 the Dart project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file.
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
void main() => runApp(const MyApp());
@alvinthen
alvinthen / main.dart
Created September 11, 2025 13:46
Clean Code workshop
// BAD CODE FOR LIVE REFACTORING DEMO (DartPad console)
void main() {
final o1 = Order(id: "A100", amount: 120.0, customerType: "VIP", status: 1);
final o2 = Order(
id: "A101",
amount: 45.0,
customerType: "REGULAR",
status: 1,
);