Skip to content

Instantly share code, notes, and snippets.

View gaaclarke's full-sized avatar
💮

gaaclarke

💮
View GitHub Profile
@gaaclarke
gaaclarke / impeller_context_mock.cc
Created November 3, 2023 20:29
impeller context mock
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/testing/testing.h"
#include "gmock/gmock.h"
#include "impeller/entity/contents/content_context.h"
#include "impeller/entity/contents/filters/directional_gaussian_blur_filter_contents.h"
#include "impeller/renderer/testing/mocks.h"
@gaaclarke
gaaclarke / jumptable.dart
Last active May 5, 2022 01:13
Generates a jump table from a map for Dart
const Map<String, String> _deprecatedLanguageSubtagMap = <String, String>{
'in': 'id', // Indonesian; deprecated 1989-01-01
'iw': 'he', // Hebrew; deprecated 1989-01-01
'ji': 'yi', // Yiddish; deprecated 1989-01-01
'jw': 'jv', // Javanese; deprecated 2001-08-13
'mo': 'ro', // Moldavian, Moldovan; deprecated 2008-11-22
'aam': 'aas', // Aramanik; deprecated 2015-02-12
'adp': 'dz', // Adap; deprecated 2015-02-12
'aue': 'ktz', // ǂKxʼauǁʼein; deprecated 2015-02-12
'ayx': 'nun', // Ayi (China); deprecated 2011-08-16
@gaaclarke
gaaclarke / bidirectional_oop_pigeon.dart
Last active May 29, 2020 17:08
An example of wrapping a host object instance with pigeon with bidirectional communication.
///////////////////////////////////////////////////////////////////////////////
/// Pigeon
///////////////////////////////////////////////////////////////////////////////
class VideoPlayerInstance {
int ident;
}
class PlayMessage {
int ident;
String url;
@gaaclarke
gaaclarke / scoped_nsobject_arc.mm
Created May 12, 2020 16:59
shows arc working with scoped_nsobject
// Compile with: clang++ -fobjc-arc scoped_nsobject_arc.mm
#import <Foundation/Foundation.h>
#import <cstdio>
#if !__has_feature(objc_arc)
#error must use ARC
#endif
//////////////////////////////////////////////////////////////////////////////////////////////
@gaaclarke
gaaclarke / future_deadlock.cpp
Last active May 6, 2020 22:13
shows how to create deadlock with futures and event loops
#include <atomic>
#include <deque>
#include <future>
#include <iostream>
#include <thread>
#include <unistd.h>
#include <condition_variable>
class EventLoop {
public:
#include "include/core/SkM44.h"
#include <Accelerate/Accelerate.h>
#include <chrono>
#include <iostream>
#include <string>
namespace {
class LA44 {
public:
double m_[16];
@gaaclarke
gaaclarke / main.dart
Created October 24, 2019 17:54
Scroll to Index ListView
import 'package:flutter/material.dart';
/// An interface for representing the contents of a ListView.
class ListViewDataSource {
/// The number of items that will be displayed in the ListView.
int get numItems => 0;
/// The height of the widget at [index].
double itemHeight(int index) => 0;
@gaaclarke
gaaclarke / gist:aa1f2512bb41c0972e381d06f610c4a0
Created June 14, 2019 17:34
FlutterViewController dealloc after retain cycle fix
#import "NavController.h"
#import <Flutter/Flutter.h>
#import "AppDelegate.h"
#import "ViewController.h"
#import "GeneratedPluginRegistrant.h"
@interface NavController ()
@property (nonatomic, strong) FlutterMethodChannel* setCountChannel;
@end
@gaaclarke
gaaclarke / gist:0154fe1ff966617fde07b9ecccd05999
Created June 14, 2019 17:16
dealloc FlutterViewController (use FlutterEngine as messenger)
#import "NavController.h"
#import <Flutter/Flutter.h>
#import "AppDelegate.h"
#import "ViewController.h"
#import "GeneratedPluginRegistrant.h"
@interface NavController ()
@property (nonatomic, strong) FlutterMethodChannel* setCountChannel;
@end
@gaaclarke
gaaclarke / gist:dd650342fba18ea640c7b3923995cc7d
Last active July 22, 2019 01:44
Forcing FlutterViewController to dealloc
#import "NavController.h"
#import <Flutter/Flutter.h>
#import "AppDelegate.h"
#import "ViewController.h"
#import "GeneratedPluginRegistrant.h"
@interface NavController ()
@property (nonatomic, strong) FlutterMethodChannel* setCountChannel;
@end