Skip to content

Instantly share code, notes, and snippets.

@jesg
jesg / hello.nim
Created June 13, 2015 10:10
embed nim in ruby
# nim c --app:lib --noMain --header:hello.h hello.nim
proc foo*(a: cint): cint {. exportc .} =
result = a
@jesg
jesg / conf
Created March 17, 2016 02:42
i3wm
# file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout somewhen, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test
SUCCESS for test shouldUsePageTimeoutToWaitForPageLoadOnInput(ghostdriver.ElementMethodsTest) in test class ghostdriver.ElementMethodsTest
SUCCESS for test shouldSwitchToTheRightFrame(ghostdriver.FrameSwitchingTest) in test class ghostdriver.FrameSwitchingTest
SUCCESS for test shouldNotHandleCasesWhenAsyncJavascriptInitiatesAPageLoadFarInTheFuture(ghostdriver.ElementMethodsTest) in test class ghostdriver.ElementMethodsTest
@jesg
jesg / diff 2_1_1 1)9)16
Last active April 12, 2016 03:31
ghostdiver phantomjs npm 1.9.16 vs 2.1.1 via selenium core tests
> diff failures_and_error_2_1_1.txt failures_and_error_1_9_16.txt
8a9
> org.openqa.selenium.CorrectEventFiringTest#testClickPartiallyOverlappingElements
22a24
> org.openqa.selenium.FrameSwitchingTest#testShouldSelectChildFramesByChainedCalls
28a31
> org.openqa.selenium.interactions.BasicKeyboardInterfaceTest#canGenerateKeyboardShortcuts
35a39
> org.openqa.selenium.interactions.CombinedInputActionsTest#testHoldingDownShiftKeyWhileClicking
37d40
@jesg
jesg / lock_with_timeout.py
Created April 27, 2016 15:24
lock with timeout for python 2.7
class LockWithTimeout(object):
def __init__(self):
self.queue = Queue(1)
self.queue.put(1, block=False)
def aquire(self, timeout=None):
try:
self.queue.get(block=True, timeout=timeout)
return True
@jesg
jesg / .xmodmap-hhk
Last active May 11, 2016 14:00
swap esc and tilde with xmodmap
clear Control
clear Lock
keycode 9 = grave asciitilde
keycode 49 = Escape
keycode 37 = Control_L
keycode 66 = Control_L
add Control = Control_L
@jesg
jesg / hello-async-javascript.py
Created May 12, 2016 14:18
selenium async javascript
from __future__ import print_function
from selenium import webdriver as wd
driver = wd.Chrome()
driver.get('http://www.jquery-tutorial.net/introduction/hello-world')
print(driver.title)
driver.set_script_timeout(30)
result = driver.execute_async_script("""
@jesg
jesg / ghostdriver
Last active December 6, 2016 12:57
phantomjs wrapper for ghostdriver
#!/usr/bin/env bash
<<License
Copyright (c) 2016 Jason Gowan
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WI