Skip to content

Instantly share code, notes, and snippets.

View BlackHC's full-sized avatar

Andreas Kirsch BlackHC

View GitHub Profile
@BlackHC
BlackHC / SassMeister-input-HTML.html
Created October 29, 2014 09:11
Generated by SassMeister.com.
<table class="mytable">
<tfoot>
<tr>
<td class="mytd">
Hello
</td>
</tr>
</tfoot>
</table>
@BlackHC
BlackHC / 0_reuse_code.js
Last active August 29, 2015 14:11
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@BlackHC
BlackHC / scope.dart
Created January 14, 2017 17:56
Dynamic fields in Dart
// Copyright (c) 2016, Andreas 'blackhc' Kirsch. All rights reserved. Use of
// this source code is governed by a BSD-style license that can be found in the
// LICENSE file.
import 'dart:mirrors';
Scope currentScope;
@proxy
class Scope {
final _scope = <Symbol, dynamic>{};
@BlackHC
BlackHC / cell_type.dart
Created January 14, 2017 18:15
Determining the code type: expression or statement?
// Copyright (c) 2016, Andreas 'blackhc' Kirsch. All rights reserved. Use of
// this source code is governed by a BSD-style license that can be found in the
// LICENSE file.
import 'dart:io';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/error/listener.dart';
import 'package:analyzer/src/dart/scanner/reader.dart';
import 'package:analyzer/src/dart/scanner/scanner.dart';
@BlackHC
BlackHC / merge_package_configs.dart
Created January 14, 2017 18:29
Merging package configs
import 'package:package_resolver/package_resolver.dart';
Future<PackageResolver> mergePackageConfigs(String otherPackageRoot) async {
final currentConfig = await PackageResolver.current.packageConfigMap;
final otherConfig =
(await SyncPackageResolver.loadConfig(otherPackageRoot + '/.packages'))
.packageConfigMap;
// We do something horrible here: We simply merge the current config with
// the other. Hoping it will still work..
final config = <String, Uri>{};
@BlackHC
BlackHC / a.dart
Created April 16, 2017 09:46
Shadowing of imported symbols
class MyClass {
static final value = 1;
}
@BlackHC
BlackHC / example.dart
Created April 16, 2017 09:49
Shadowing of a global variable
float a;
void func() {
float a; // This `a` shadows global `a`.
}
@BlackHC
BlackHC / import_1.dart
Created April 16, 2017 09:54
Import spike
class A {
int f() => 1;
}
@BlackHC
BlackHC / pubspec.yaml
Created April 16, 2017 10:02
PubSpec Snippet
[...]
vm_service_client:
git:
url: git://github.com/BlackHC/vm_service_client.git
ref: reload_sources_poc
[...]
@BlackHC
BlackHC / cell_generator.dart
Created April 16, 2017 10:43
Code generator for cells to support top-level declarations
import 'dart:io';
class DartTemplate {
final String content;
DartTemplate(this.content);
void instantiate(String targetPath,
{String source, String library, String imports}) {
final instanceSource = content