Skip to content

Instantly share code, notes, and snippets.

David King oodavid

Block or report user

Report or block oodavid

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
oodavid / main.dart
Created Jan 22, 2020
Dart > Sort List<Map> by multiple keys
View main.dart
extension SortBy on List {
sortBy(List<String> keys) {
this.sort((a, b) {
for(int k=0; k<keys.length; k++) {
String key = keys[k];
int comparison =[key]??""), (b[key]??""));
if(comparison != 0){
return comparison;
View From StreamBuilder to MultiProvider.dart
/// 0 - Example `Streams`
Stream<MyUserModel> userStream => FirebaseAuth
.map((user) => MyUserModel.fromFirebase(user));
String documentPath = 'my/document';
Stream<MyDocumentModel> documentStream = Firestore.instance
View .editorconfig
root = true
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
oodavid /
Created Jun 22, 2017
Create a new repo from a directory within an existing repo

Make sure you have this git alias

git config --global alias.clone-branches '! git branch -a | sed -n "/\/HEAD /d; /\/master$/d; /remotes/p;" | xargs -L1 git checkout -t'

Clone the remote, pull all branches, change the remote, filter your directory, push

git clone new-repo
cd new-repo
git clone-branches
git remote rm origin
oodavid / package.json
Last active Sep 19, 2016
Scraper Example
View package.json
"name": "scraper",
"version": "1.0.0",
"description": "Scraper",
"main": "scraper.js",
"dependencies": {
"node-horseman": "^3.1.1",
"random-useragent": "^0.3.0"
oodavid /
Last active Aug 11, 2018
Automatically renew letsencrypt SSL certificates via cron.
# Source
# Adapted from
# Make sure this is added to the crontab, ie:
# sudo crontab -e
# 30 2 * * 1 /home/ubuntu/khan-draw/ >> /var/log/ssl-letsencrypt-auto-renew.log
# Config
oodavid /
Last active Nov 29, 2015
Execute this file from a local git repo to create repos on your webserver to act as a remote AND working master branch
# This script is no good for servers with multiple-users, I simply
# designed it to quickly push my git tinkerings to my EC2 test server.
# Use at your own risk!
# cd to a local directory under git control and execute this script, it will:
# create repos on your server
# modify your local remotes to push to the server
oodavid / Application.js
Last active Aug 29, 2015
GC > New Groups Paradigm Bug
View Application.js
import ui.TextView as TextView;
import ui.View as View;
import device;
import animate;
var gx = Math.ceil(device.width/20);
exports = Class(GC.Application, function () {
this.initUI = function () {
// A note
new TextView({
superview: this.view,
oodavid / gist:65d0f5ca76b8cd8bd9e1
Last active Aug 29, 2015
devkit v3 upgrade - android build issues - IRC fix
View gist:65d0f5ca76b8cd8bd9e1
oodavid morning jdwilm
oodavid jdwilm: do you have a moment to look at issues building for android?
jdwilm oodavid: can you check that you have the core folder in native-android?
jdwilm seems like there might be a missing sym link or submodule
oodavid shall do :)
jdwilm I think there is a missing symlink in native-android/TeaLeaf/jni named 'core' which should point to native-android/native-core submodule
jdwilm Incidentally, we could probably just move the submodule and obviate the need for such a link
oodavid jdwilm: yeah, that looks like the case
oodavid just trying to figure out where npm has installed native-android/native-core
jdwilm It should be on $GAME/modules/devkit-core/modules/native-android
oodavid / Particles.js
Created Dec 16, 2014
GameClosure > Particles
View Particles.js
/** MOLECULE MATCH - Particles
* Utility View for GameClosure DevKit to add an
* explosion of Particles anywhere on the screen.
* Modified for github
* @author David "oodavid" King
* @copyright Copyright (c) 2014 +
You can’t perform that action at this time.