Skip to content

Instantly share code, notes, and snippets.

View jdelStrother's full-sized avatar
👋

Jonathan del Strother jdelStrother

👋
View GitHub Profile
$ git clone https://github.com/keithclark/selectivizr.git
Cloning into selectivizr...
remote: Counting objects: 131, done.
remote: Compressing objects: 100% (112/112), done.
remote: Total 131 (delta 48), reused 0 (delta 0)
Receiving objects: 100% (131/131), 28.41 KiB, done.
Resolving deltas: 100% (48/48), done.
$ cd selectivizr/
$ git config --global core.autocrlf true
$ git rm --cached -r .
@jdelStrother
jdelStrother / git-autofix
Created June 23, 2011 13:42
Auto-fixup a previous git commit with the changes from your staging area
#!/bin/sh
# Auto-applies changes from the index to a previous commit
# eg
# git add foo
# git autofix HEAD~3
#!/bin/sh
target="$(git rev-parse $1)"
require 'capybara'
require 'rack'
class IframeServer
def call(env)
r = Rack::Request.new(env)
content = case r.path
when '/container.html'
pages[0]
when '/iframe1.html'
require 'selenium-webdriver'
require 'rack'
require 'rack/handler/thin'
class IframeServer
def start
@pid = fork { Rack::Handler::Thin.run(self, :Port => 9292) }
poller = Selenium::WebDriver::SocketPoller.new("localhost", 9292, 30)
raise "could not start #{self.inspect}" unless poller.connected?
<object data="http://boos.audioboo.fm/swf/playlist_player.swf" height="350" type="application/x-shockwave-flash" width="300">
<param name="movie" value="http://boos.audioboo.fm/swf/playlist_player.swf">
<param name="scale" value="noscale"><param name="salign" value="TL">
<param name="align" value="left"><param name="allowScriptAccess" value="always">
<param name="wmode" value="transparent"><param name="quality" value="best">
<param name="FlashVars" value="rssURL=http://audioboo.fm/tag/londonriots.atom">
<param name="loop" value="false"><param name="allowFullScreen" value="false">
<a href="http://audioboo.fm/tag/londonriots">Listen on audioboo.fm!</a>
</object>
@jdelStrother
jdelStrother / env.rb
Created August 17, 2011 17:48
Insert cucumber step names into rails' test.log
class RailsLogInterpolator
def before_step(step)
@current_step = step
Rails.logger.info("{{{ #{step.name}")
end
def before_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)
Rails.logger.info(" #{@current_step.name} }}}\n")
end
end
server = Thread.new do
rack = Rack::Server.new(:Port=>8000)
# rack 1.2 ignores the :app option, force it manually:
rack.instance_variable_set('@app', Rack::Directory.new(Rails.root.join('test/javascript')))
rack.start
end
sleep(0.5)
Launchy.open("http://localhost:8000/index.html")
server.join
$ ./redis-load
PRNG seed is: 1790627319 - use the 'seed' option to reproduce the same sequence
====== Report ======
10000 requests in 14.459 seconds
691.61 requests per second
50 parallel clients
payload: 1..64 bytes
keep alive: 1
29.16% < 1 ms
server {
server_name www.foo.com;
return 301 foo.com$request_uri;
}
server {
listen [::]:80;
server_name foo.com;
return 200;
}
[0.000][INFO]: ChromeDriver 18.0.1022.0 /Users/_jenkins/chromedriver/chromedriver
[0.209][FINE]: Initializing session with capabilities {
"browserName": "chrome",
"chrome.detach": true,
"chromeOptions": {
"detach": true
},
"cssSelectorsEnabled": true,
"javascriptEnabled": true,
"nativeEvents": false,