Skip to content

Instantly share code, notes, and snippets.

Avatar

Dante Briones dbriones

View GitHub Profile
@dbriones
dbriones / config.clj
Created Aug 19, 2014
`reinject` doesn't seem to work in testing mode
View config.clj
(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 Aug 29, 2015
throttle unaffected by riemann.time.controlled/advance!
View throttle-not-affected-by-time.clj
(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 Aug 29, 2015
moving-time-window retains state across tests
View gist:eae041030c8834647aa6
(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 Apr 22, 2013
PhantomJS execution log
View gist:5439199
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 Apr 19, 2013
GhostDriver click() failure message
View gist:5423075
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 Sep 19, 2011
HTML tab structure
View gist:1227578
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 Sep 7, 2011
NativeDriver driving a UISearchBar
View gist:1201208
// 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();
View matcher spike.java
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)");
View Run Culerity Server in irb
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
View run_celerity_server.rb
#!/usr/bin/env jruby
STDERR.puts("celerity server running")
require File.dirname(__FILE__) << '/../lib/culerity/celerity_server'
Culerity::CelerityServer.new(STDIN, STDOUT)