Skip to content

Instantly share code, notes, and snippets.

View chrisgate's full-sized avatar

Chris Godwin chrisgate

View GitHub Profile
@chrisgate
chrisgate / forward_wsl2_ports.ps1
Created February 23, 2024 07:05 — forked from kendallroth/forward_wsl2_ports.ps1
Forward WSL2 ports to host
# Forward WSL2 ports to host machine/platform (handles Windows Firewall)
#
# NOTE: 'iex' is a shortform for 'Invoke-Expression'
# Ports that should be forwarded to WSL2 and allowed through firewall (comma-separated)
$ports = @(8081);
# WSL IP address changes whenever WSL restarts
$wsl_ip = $(wsl hostname -I).Trim();

Build a flutter app in WSL2

Install, build and debug a flutter app in WSL2 (Windows Subsystem for Linux).

Linux setup

Install Java

To install the JDK, execute the following command, which will also install the JRE:

sudo apt install default-jdk

Add the following two lines to /etc/profile (setting the JAVA_HOME environment variable):

@chrisgate
chrisgate / react-native-app-in-wsl2.md
Created September 15, 2023 04:35 — forked from piouson/react-native-app-in-wsl2.md
Building a react native app in WSL2
@chrisgate
chrisgate / launch.json
Created November 15, 2022 05:39 — forked from nickovchinnikov/launch.json
vscode jest debug config
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest single run all tests",
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
"args": [
"--verbose",
@chrisgate
chrisgate / launch.json
Created November 15, 2022 05:39 — forked from nickovchinnikov/launch.json
vscode jest debug config
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest single run all tests",
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
"args": [
"--verbose",
@chrisgate
chrisgate / nativeJavaScript.js
Created October 27, 2022 08:17 — forked from alexhawkins/nativeJavaScript.js
Implementation of Native JavaScript Methods (forEach, Map, Filter, Reduce, Every, Some)
'use strict';
/*****************NATIVE forEACH*********************/
Array.prototype.myEach = function(callback) {
for (var i = 0; i < this.length; i++)
callback(this[i], i, this);
};
//tests
public class TslReaderManager
: ReactiveObject, IReaderManager
{
private readonly IAsciiTransportsManager transportsManager;
private readonly List<AsciiReader> readers;
public TslReaderManager(IAsciiTransportsManager transportsManager)
{
this.Readers = this.readers = new List<AsciiReader>();
private void TransportUpdated(IAsciiTransport transport)
{
if (transport.State == ConnectionState.Available)
{
var viewModel = this.Transports.Where(vm => vm.Id == transport.Id).FirstOrDefault();
if (viewModel == null)
{
viewModel = new TransportModel(this.transportsManager, transport);
this.Transports.Add(viewModel);
}
@chrisgate
chrisgate / SyncManager.cs
Created April 23, 2018 23:35 — forked from phenomx2/SyncManager.cs
MobileServiceSQLiteStore Handler
public class SyncManager : IDisposable
{
private readonly MobileServiceClient _client;
private readonly MobileServiceSQLiteStore _store;
public SyncManager()
{
_client = Locator.Current.GetService<MobileServiceClient>();
_store = new MobileServiceSQLiteStore(Constants.OfflineDbPath);
}