Skip to content

Instantly share code, notes, and snippets.

Avatar

Nick Fisher nmfisher

View GitHub Profile
View Standard AuthenticationBloc for Flutter Firebase authentication
// MIT licence
import 'dart:async';
import 'dart:io';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:fluent_academy_app/blocs/initializable_cubit.dart';
import 'package:fluent_academy_app/widgets/user/auth/signin/sign_in_providers.dart';
import 'package:flutter/widgets.dart';
import 'package:firebase_auth/firebase_auth.dart' as auth;
import 'package:google_sign_in/google_sign_in.dart';
@nmfisher
nmfisher / UnityPlayerUtils.kt
Last active Mar 17, 2021
Modified UnityPlayerUtils to fix layering of Unity View inside Flutter
View UnityPlayerUtils.kt
package com.xraph.plugin.flutter_unity_widget
import android.app.Activity
import android.graphics.PixelFormat
import android.os.Build
import android.os.Handler
import android.os.Looper
import android.util.Log
import android.view.ViewGroup
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
View notched_container
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
class NotchedContainer extends StatelessWidget {
final Widget child;
final Widget notchContent;
final double notchPadding;
final double notchOffsetRight;
final EdgeInsets contentPadding;
final Alignment notchPosition;
View main.dart
import 'dart:typed_data';
import 'dart:io';
class Half {
static Float32List ToFloat32(ByteData buffer) {
var f32Buffer = ByteData(buffer.lengthInBytes * 2);
for(int i = 0; i < buffer.lengthInBytes; i+=2) {
View gist:467f7a3d441147b9c3829988b151ca0d
private static void unzipLibs(AssetManager am, String nativeLibraryDir) {
try {
File complete = Paths.get(appDir, "mono_libs_complete").toFile();
if(complete.exists() && !BuildConfig.DEBUG) {
Log.e(TAG, "Libs have already been unzipped to data directory, skipping unzip...");
return;
}
@nmfisher
nmfisher / sample.dart
Created Aug 1, 2019
JsonObjectLite failing to handle nested list-type JsonObjectLite
View sample.dart
final dynamic obj = new JsonObjectLite();
obj.foo = JsonObjectLite.fromJsonString("[1,2,3]");
print(obj);
View gist:c901254c1612bdef8fda406658690c84
let L2Norm:Func<double[],double[],float> = Func<double[],double[],float>(fun (x:double[]) (y:double[]) ->
let mutable dist = 0.
for i in 0..x.Length-1 do
dist <- (x.[i] - y.[i]) * (x.[i] - y.[i]);
dist)
View gist:dc2f9412cb6f844d6336bbc19c663ba3
Powershell:
([system.reflection.assembly]::loadfile({filename})).FullName
View scrape docracy before it shuts down
import urllib
from bs4 import BeautifulSoup
save_folder = "/home/hydroxide/data/legal/docracy/"
base_url = "http://www.docracy.com"
doc_urls = []
for i in range(1,110):
tag = "lease"
#list_page_url = base_url + "/doc/showalltagged?page=" + str(i) + "&tag=" + tag
#search_term = "\"consulting+services\""
View DialogStateBuilder.cs
using Lexico.DataModel;
using Lexico.DataModel.Questionnaire;
using Lexico.Search.NETStandard;
using Lexico.Web.Multitenancy.NET461;
using Lexico.Web.Multitenancy.NET461.User;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;