Skip to content

Instantly share code, notes, and snippets.

@samedhi
samedhi / gist:5166870
Last active December 14, 2015 23:39
On the line with "then((srv_val) => (SearchResults) srv_val);" I am getting a "Expected ',' or ')', but got 'IDENTIFIER" Error. I just don't know how to cast. I am attempting to cast a Future<ServerValue> into a Future<SearchResults>.
library searchresults;
import 'quiz.dart';
import 'guid.dart';
import 'dart:async';
import 'dart:json';
import 'servervalue.dart';
import 'servervalueinterface.dart';
const String _my_type = "searchresults";
@samedhi
samedhi / gist:5225693
Created March 23, 2013 00:05
Since upgrading to the newest dartium editor, I am getting a errors of the form... "Concrete class AnswerComponent has unimplemented member(s) # From Node: Node $dom_appendChild(Node) # From Element: List<Node> $dom_getElementsByClassName(String) Element $dom_querySelector(String)" That is a lot of errors! Surely I am not expected to implement e…
library xanswer;
import 'dart:html';
import 'package:web_ui/watcher.dart' as watchers;
import 'package:web_ui/web_ui.dart';
import 'resources/card.dart';
class AnswerComponent extends WebComponent {
String next;
String value;
@samedhi
samedhi / gist:5340681
Last active December 15, 2015 23:29
I am trying to grab a id="search-box" element and give it focus. I do get "I was able to grab it!" with the code below. Unfortunately, the search-box element in question does not get focus. To be clear, the search-box is on the initial (on-load) page. The search-box element is in template code. Is on-load too early for elements that are rendered…
window.onLoad.listen((Event e){
Element elem = query("#search-box");
if(elem != null){
print("I was able to grab it!");
elem.focus();
}else{
print("I was not able to grab the element");
}
});
@samedhi
samedhi / designer.html
Last active August 29, 2015 14:14
designer
<link rel="import" href="../google-map/google-map-search.html">
<link rel="import" href="../topeka-elements/category-images.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icons/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<link rel="import" href="../topeka-elements/category-icons.html">
<link rel="import" href="../paper-item/paper-item.html">
<link rel="import" href="../topeka-elements/theme.html">
<link rel="import" href="../topeka-elements/topeka-resources.html">
@samedhi
samedhi / crontab
Last active August 29, 2015 14:17
This is a really easy way to avoid distractions. Anything that drives you to distraction put in /etc/hosts.modified . Modify your crontab so that it replaces the modified with the original after work is done for the day (10PM in my case). It will then restore again after you go to sleep. Modify crontab periodicity or use anacron if you actually …
0 22 * * * /bin/cp /etc/hosts.original /etc/hosts
0 2 * * * /bin/cp /etc/hosts.modified /etc/hosts
(set-env!
:source-paths #{"src/clj" "src/cljs" "test/clj"}
:resource-paths #{"html"}
:dependencies '[[adzerk/boot-cljs "0.0-3308-0"]
[adzerk/boot-cljs-repl "0.1.10-SNAPSHOT"]
[adzerk/boot-reload "0.3.1"]
[adzerk/boot-test "1.0.4"]
[cljsjs/hammer "2.0.4-4"]
[cljsjs/media-stream-recorder "1.2.6-0"]
[compojure "1.1.6"]
(set-env!
:source-paths #{"src/clj" "src/cljs" "test/clj"}
:resource-paths #{"html"}
:dependencies '[[adzerk/boot-cljs "0.0-3308-0"]
[adzerk/boot-cljs-repl "0.1.10-SNAPSHOT"]
[adzerk/boot-reload "0.3.1"]
[adzerk/boot-test "1.0.4"]
[cljsjs/hammer "2.0.4-4"]
[cljsjs/media-stream-recorder "1.2.6-0"]
[compojure "1.1.6"]
@samedhi
samedhi / profile.boot
Created August 10, 2015 01:02
My current profile.boot
(require 'boot.repl)
(swap! boot.repl/*default-dependencies*
concat '[[cider/cider-nrepl "0.10.0-SNAPSHOT"]
[refactor-nrepl "1.1.0"]])
(swap! boot.repl/*default-middleware*
conj 'cider.nrepl/cider-middleware)
(ns vidiot.listener.paths
(:require
[cljs.spec :as s]
[cljs.spec.impl.gen :as gen]
[cljs.spec.test :as stest]))
(def path (s/coll-of (s/with-gen string? #(s/gen #{"a" "b" "c" "d"}))
:min-count 1
:kind vector?
@samedhi
samedhi / build.boot
Created November 14, 2016 17:29
Example of short circuiting on test failures.
(deftask build
"Builds cljs and code for production"
[]
(comp
(cljs :optimizations :advanced)
(target)))
(deftask testing []
(merge-env! :source-paths #{"test"})
identity)