Skip to content

Instantly share code, notes, and snippets.

// Copyright (c) 2015, <your name>. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.
/// The powerhat library.
library powerhat;
int calculate() {
return 6 * 7;
var no = "yes";
}
// Container class! Ick! >:(
class AppActions {
final ProjectActions projectActions = new ProjectActions();
}
@radicaled
radicaled / my_code_snippet.dart
Last active August 29, 2015 14:07
dart:js interop problems.
void map(doc, emit) {
emit(doc); // emit all documents
}
var db = new JsObject(context['PouchDB'], ['test_db']);
var jsPromise = db.callMethod('query', [map]);
// map ends up being wrapped like this:
// function () { return func(Array.prototype.slice.apply(arguments)); }
@radicaled
radicaled / hats.dart
Created August 31, 2014 18:34
analysis.getSuggestiosn
var hats = ['Fedora'];
void main() {
ha
}
Exception: Bad state: No element
Uncaught SyntaxError: Failed to execute 'querySelector' on 'Element': '#packages/test/menu' is not a valid selector. (http://127.0.0.1:8080/index.html:1558)
Exception caught during observer callback: Error: Failed to execute 'querySelector' on 'Element': '#packages/test/menu' is not a valid selector.
at Error (native)
at core-iconset-svg.Polymer.iconById (http://127.0.0.1:8080/index.html:1558:59)
at core-iconset-svg.Polymer.cloneIcon (http://127.0.0.1:8080/index.html:1562:25)
at core-iconset-svg.Polymer.applyIcon (http://127.0.0.1:8080/index.html:1606:24)
at core-icon.Polymer.updateIcon (http://127.0.0.1:8080/index.html:1510:17)
at core-icon.g.invokeMethod (http://127.0.0.1:8080/packages/polymer/src/js/polymer/polymer.js:12:13320)
at core-icon.g.notifyPropertyChanges (http://127.0.0.1:8080/packages/polymer/src/js/polymer/polymer.js:12:11606)
@radicaled
radicaled / gauge.dart
Created April 28, 2014 03:35
shadow_dom breaks Google Visualizations, but only under Dartium
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. 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:html';
import 'dart:async';
import 'dart:js';
class Gauge {
var jsOptions;
// Still incorrect, but less incorrect.
var itemOne : GameObject;
var itemTwo : GameObject;
var objects : new Array();
objects.Push(itemOne);
objects.Push(itemTwo);
// Make one of each object.
for(var i : int; i < objects.length; i++) {
@radicaled
radicaled / Gulpfile.coffee
Created April 15, 2014 00:06
e2e with AngularDart
# Note: replace with Grunt before I have an aneurysm.
# What kind of fucked-up cli doesn't respond to --help?
gulp = require('gulp')
spawn = require('child_process').spawn
gulp.task 'default', ['specs'], ->
gulp.task 'specs', (done)->
jasmine = spawn 'jasmine-node', ['--coffee', 'spec'],
stdio: 'inherit'
@radicaled
radicaled / gist:8483477
Last active January 3, 2016 15:29
64-bit Dartium under Fedora 20
Install deps listed @ http://code.google.com/p/chromium/wiki/LinuxBuildInstructionsPrerequisites#Fedora_Setup
Install the following required deps that weren't installed in the previous step:
- sudo yum install pulseaudio-libs-devel
- sudo yum install libgcrypt-devel
- sudo yum install pciutils-devel
- sudo yum install libudev-devel
- sudo yum install libcap-devel
Install depot_tools @ http://dev.chromium.org/developers/how-tos/install-depot-tools
Follow instructions @ http://code.google.com/p/dart/wiki/BuildingDartium#Subversion_checkout_for_non-committers
Follow instructions @ http://code.google.com/p/dart/wiki/BuildingDartium#Build
@radicaled
radicaled / lazy.dart
Created January 8, 2014 00:40
Dart's lazy initialization in action.
var potatoSack = [];
var potato = buildPotato();
String buildPotato() {
var tater = 'a delicious potato';
potatoSack.add(tater);
return tater;
}
void main() {