Skip to content

Instantly share code, notes, and snippets.

View alxhub's full-sized avatar

Alex Rickabaugh alxhub

  • Google, Inc.
  • San Francisco, CA
View GitHub Profile
@alxhub
alxhub / nsm_benchmarks.dart
Last active December 18, 2015 09:29
Benchmarks of native method dispatch, noSuchMethod dispatch, MirrorSystem.getName and InstanceMirror.delegate.
import 'package:benchmark_harness/benchmark_harness.dart';
import 'dart:mirrors';
/// Contains a basic method call.
class Foo {
method() => 1 + 1;
}
/// No different than [Foo] except Bar.method() is resolved via [noSuchMethod].
class Bar {
@alxhub
alxhub / rze_test.dart
Created August 14, 2013 21:53
An isolated test showing failure of runZonedExperimental on a checked mode exception.
import 'package:unittest/unittest.dart';
import 'dart:async';
main() {
/*
* In checked mode: Crashes with: 'dart:async/zone.dart': Failed assertion: line 115 pos 12: '! _children.isEmpty' is not true.
* In unchecked mode: hangs because runZonedExperimental() swallows the completion of the future
* (due to the fact that an error appears on the Stream, I believe).
*/
test('Isolated runZonedExperimental failure test.', () {
@alxhub
alxhub / stream-coupler.dart
Created October 15, 2013 17:33
Initial version of a StreamCoupler<T>
// Copyright 2013 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
var x = 1;
function foo() {
print("x is: " + x);
}
function bar() {
var x = 2;
foo();
}
// What you have
x = 1;
function foo() {
x = 2;
}
foo();
return x; // Gives 1
// What he wants
Current tableau:
DenseMatrix 3x5-Double
-1 -1 0 0 0
2 1 1 0 4
1 2 0 1 3
Entering variable: 0
Pivot row: 1
Current tableau:
DenseMatrix 3x5-Double
//Make sure we're using all available stuff
using System;
using UnityEngine;
namespace PraiseTheSun
{
//Inherit ModuleScienceExperiment stuff
public class SolarExperiment : ModuleScienceExperiment{
// Check if you're around the Sun, and check height from the Surface, then post the m
library main;
import 'dart:async';
void main() {
var zs = new ZoneSpecification(print: onPrint);
var zs2 = new ZoneSpecification(print: onPrint2);
var sc;
sc = new StreamController();
The 'astronomy' program at UT Is heavily partnered with the physics department. Astronomy is decently small, so not many students are accepted, which causes it to be decently prestigious. Also, the heavy partnership with the physics department, really makes most of the projects at UT's Astronomy department are exclusively astrophysics and spectroscopy problems. However, UT has a strong partnership with McDonald observatory, so some of the best observational data you can get, can be gotten within the department.
TL;DR Astronomy == Astrophysics, hard to get accepted, lots of groundbreaking research and unique coursework
userSearchTactic(req:UserSeachRequest, ctx: Context): Rx.Observable<UserSearch> {
return ctx
.localDataStore
.objectsByType(User) // Rx.Observable<User>
.filter((user: User) => user.matches(req))
.reduce((user: User, results: UserSearch) => results.users.push(user), new UserSearch());
}