Skip to content

Instantly share code, notes, and snippets.

View dbriones's full-sized avatar

Dante Briones dbriones

View GitHub Profile
@dbriones
dbriones / config.clj
Created August 19, 2014 00:16
`reinject` doesn't seem to work in testing mode
(streams
prn
(where (service "digital")
(with :service "analog" reinject)))
(tests
(deftest reinject-test
(inject! [{:service "digital"}])))
@dbriones
dbriones / throttle-not-affected-by-time.clj
Last active August 29, 2015 14:04
throttle unaffected by riemann.time.controlled/advance!
(streams
(throttle 1 10
(tap :throttle
#(info %))))
(tests
(let [input {:service "some-service"}]
(deftest throttle-should-allow-events-after-window-passes
(is (= (inject! [input])
{:throttle [input]}))
@dbriones
dbriones / gist:eae041030c8834647aa6
Last active August 29, 2015 14:04
moving-time-window retains state across tests
(streams
(moving-time-window 10
(tap :mtw
#(info %))))
(tests
(let [input {:service "some-service"}]
(deftest moving-time-window-should-not-retain-state-between-tests
(is (= (inject! [input])
{:mtw [[input]]})))
@dbriones
dbriones / gist:5439199
Created April 22, 2013 22:39
PhantomJS execution log
Apr 22, 2013 3:22:22 PM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: executable: /usr/local/bin/phantomjs
Apr 22, 2013 3:22:22 PM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: port: 43987
Apr 22, 2013 3:22:22 PM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: arguments: [--ignore-ssl-errors=true, --webdriver=43987, --webdriver-logfile=REDACTED]
Apr 22, 2013 3:22:22 PM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: environment: {}
PhantomJS is launching GhostDriver...
[INFO - 2013-04-22T22:22:23.793Z] GhostDriver - Main - running on port 43987
@dbriones
dbriones / gist:5423075
Created April 19, 2013 20:39
GhostDriver click() failure message
org.openqa.selenium.WebDriverException: Error Message => 'Click failed: SyntaxError: Parse error'
caused by Request => {"headers":{"Accept":"application/json, image/png","Connection":"Keep-Alive","Content-Length":"27","Content-Type":"application/json; charset=utf-8","Host":"localhost:38251"},"httpVersion":"1.1","method":"POST","post":"{\"id\":\":wdc:1366402983954\"}","url":"/click","urlParsed":{"anchor":"","query":"","file":"click","directory":"/","path":"/click","relative":"/click","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/click","queryKey":{},"chunks":["click"]},"urlOriginal":"/session/ede93690-a92e-11e2-a192-6127e00545f9/element/%3Awdc%3A1366402983954/click"}
Command duration or timeout: 427 milliseconds
Build info: version: '2.31.0', revision: '1bd294d185a80fa4206dfeab80ba773c04ac33c0', time: '2013-02-27 13:51:26'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.3', java.version: '1.7.0_09'
Session ID: ede93690-a92e-11e2-a192-6
@dbriones
dbriones / gist:1227578
Created September 19, 2011 20:51
HTML tab structure
table <-- contains the tabs
+ tr
+ td <-- first tab, onclick defined here
+ table
+ tr
+ td
+ a
+ td <-- second tab, onclick defined here
+ table
+ tr
@dbriones
dbriones / gist:1201208
Created September 7, 2011 17:35
NativeDriver driving a UISearchBar
// launches keyboard and list of results
driver.findElement(By.placeholder("Search")).click();
// does nothing
driver.findElement(By.placeholder("Search")).sendKeys("flat panel lcd");
// returns UISearchBar
driver.findElement(By.placeholder("Search")).getTagName();
private Matcher<? super FavoritesTab> hasCount(final int i) {
final int[] result = new int[1];
return new TypeSafeMatcher<FavoritesTab>() {
protected boolean matchesSafely(FavoritesTab favoritesTab) {
result[0] = favoritesTab.getCountDisplayedOnTab();
return result[0] == i;
}
protected void describeMismatchSafely(FavoritesTab item, Description mismatchDescription) {
mismatchDescription.appendText("it contained " + i + " card(s)");
ruby-1.8.7-p302 > require 'rubygems'
=> true
ruby-1.8.7-p302 > require 'culerity'
=> true
ruby-1.8.7-p302 > server=Culerity::run_server
#<IO:0x60f554>
=> #<IO:0x60f554>
ruby-1.8.7-p302 > celerity server running
#!/usr/bin/env jruby
STDERR.puts("celerity server running")
require File.dirname(__FILE__) << '/../lib/culerity/celerity_server'
Culerity::CelerityServer.new(STDIN, STDOUT)