Skip to content

Instantly share code, notes, and snippets.

View poulter7's full-sized avatar

Jonathan Poulter poulter7

View GitHub Profile
@poulter7
poulter7 / setup
Created March 1, 2012 20:39
setup an environment quickly
#!/bin/bash
mkdir ~/poulter7setup
cd ~/poulter7setup
git clone https://github.com/poulter7/dotfiles
git clone https://github.com/poulter7/Vim-files
cd ~
ln -s ~/poulter7setup/Vim-files/.vimrc
ln -s ~/poulter7setup/dotfiles/.bash_tweaks
ln -s ~/poulter7setup/dotfiles/.bash_aliases
echo '
@poulter7
poulter7 / common_steps.rb
Created November 25, 2011 02:15
Parent visibility
Then /^I should see the parent $/ do
assert find(:xpath, //input[@id="child"]/..').visible?
end
@poulter7
poulter7 / common_steps.rb
Created November 25, 2011 01:51
Detecting flashes in Ruby
# A generic step to detect for a flash, currently either an alert or a notice (called a notification)
# Usage should be:
# I should see [notification title] [titletype]
#
# Notification titles are defined within $ROOT/features/support/flashes.rb
Then /^I should see ([^"]*) (alert|notification)$/ do |name, type|
within "div#flash-#{type}" do
page.should have_content flash_of(name)
end
end
@poulter7
poulter7 / gist:842405
Created February 24, 2011 16:37
uRL connection stuff!
URLConnection connection = url.openConnection();
// setup connection to be polite
// connection.setRequestProperty("Accept", "image/*"); // image of any type
connection.setRequestProperty("Accept", "text/html");
connection.setRequestProperty("Accept-Charset","utf-8");
// connection.setRequestProperty("Accept-Encoding","gzip, deflate");
connection.setRequestProperty("Accept-Language", "en-GB, en-US, en-CA, en");
connection.setRequestProperty("Cache-Control","no-cache");
connection.setRequestProperty("Connection","Keep-Alive");
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
@poulter7
poulter7 / sharkZapper bug
Created February 18, 2011 22:54
The first javascript script line returns a string of 59 and the second 60
var i = (((59499/ 1000) % 60)).toFixed();
var i = (((59500/ 1000) % 60)).toFixed();