Skip to content

Instantly share code, notes, and snippets.

@jaysephjw
jaysephjw / main.dart
Last active November 2, 2022 02:14
Eight Queens in Flutter!
import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart' show listEquals;
/// Fun with the 8 queens problem in Flutter.
/// View me online @ https://dartpad.dev/?id=07813c001233da22954038ff7263e1ff
/// -------------------------
/// Dart entry-point
/// -------------------------
@jaysephjw
jaysephjw / google_auth_helpers.dart
Created October 7, 2022 03:09
Trying to use googleapis in Dart, but having trouble connecting them to the different authentication flows out there?
import 'package:google_sign_in/google_sign_in.dart';
import 'package:googleapis_auth/auth_io.dart';
import 'package:http/http.dart' as http;
/// Trying to use googleapis, but having trouble connecting all the different libraries together?
/// These functions help get a Client from either:
/// (a) User OAuth credentials via GoogleSignIn, or
/// (b) a Service Account secret via googleapis_auth.
///
/// After that, simple pass the client into the Api object, e.g. `final driveApi = DriveApi(client)`.
@jaysephjw
jaysephjw / gist:516e43a5ab6c2549e907415d1d6c3898
Created December 2, 2020 21:29
(WIP) - Find all submodules that ref a commit not on origin/master
git config --file .gitmodules --get-regexp path | awk '{ print $2 }' | xargs -I{} bash -c '[[ $(git -C {} --no-pager branch -r --contains HEAD) != *origin/master* ]] || echo "{} NOT OK"'
@jaysephjw
jaysephjw / gist:4c58c939c96868033861798c9d57804e
Last active September 21, 2020 21:23
git - prune and delete locals
# prune remote branches from "origin". Remove --dry-run when confident.
git remote prune origin --dry-run;
# delete branches with a gone upstream. Remove last pipe to run dry.
git branch -vv | grep " \[origin" | grep gone | awk '{print $1}' | xargs -L 1 git branch -D
@jaysephjw
jaysephjw / iphone-to-gif.MD
Created May 14, 2019 00:10
Screen record an iPhone, then convert it to a gif for your PR

Screen capture your iPhone and save as a gif to embed in github. Inspired by https://gist.github.com/dergachev/4627207 : Pipe ffmpeg to gifsicle

Pre-requisites
brew install ffmpeg
brew install gifsicle
iPhone -> .gif
  1. To record the screen to a .mov:
@jaysephjw
jaysephjw / Fastfile
Created March 28, 2019 20:51
Fastlane Flutter iOS TestFlight -- build flutter first
platform :ios do
desc "Push a new beta build to TestFlight"
lane :beta do
# Build once with flutter to generate needed flutter files
sh "cd ../.. && flutter build ios --release"
# Now build the app as usual
build_app(workspace: "Runner.xcworkspace", scheme: "Runner")
upload_to_testflight