Skip to content

Instantly share code, notes, and snippets.

@flomotlik
flomotlik / update_firefox
Last active January 10, 2017 17:23
Update Firefox version on Codeship
#!/bin/bash
# Add the following commands to your setup commands to update firefox
# git clone https://gist.github.com/9525133.git update_firefox
# bash ./update_firefox/update_firefox 28
# firefox --version
set -e
if [ -z "$1" ]; then
@michael-harrison
michael-harrison / test_multi_select.rb
Created November 18, 2012 00:37
jQuery Chosen Testing with Capybara
=begin
Notes
=====
Labels: On the label you should put a "for" attribute if you're not using something like simple_form
This helps capybara to find your field
e.g. <label for="my_field_id">Some label</label>
=end
field = "Label on my field"
value = "existing option in list"
@mcbhenwood
mcbhenwood / environment.py
Created November 8, 2012 15:50
Simple Behave environment file to start Selenium webdriver
"""
Hooking up Selenium to Behave.
For details, see:
http://pyuseful.wordpress.com/2012/11/08/running-cucumber-style-tests-in-django-using-behave/
"""
import logging
from selenium import webdriver
@toolmantim
toolmantim / 1 Readme.md
Created July 26, 2012 19:39
Minification with newlines using the Rails 3 asset pipeline

Retaining line numbers with the Rails asset pipeline

By default the Rails 3 asset pipeline uses the Uglifier gem to optimize and minify your Javascript. One of its many optimisations is to remove all whitespace, turning your Javascript into one very long line of code.

Whist removing all the newlines helps to reduce the file size, it has the disadvantage of making your Javascript harder to debug. If you've tried to track down Javascript errors in minified Javascript files you'll know the lack of whitespace does make life harder.

Luckily there is a simple solution: to configure Uglifier to add newlines back into the code after it performs its optimisations. And if you're serving your files correctly gzip'd, the newlines add only a small increase to the final file size.

You can configure Uglifier to add the newlines by setting the following in your Rails 3 config/production.rb file:

@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@thijsc
thijsc / gist:1391107
Created November 24, 2011 11:08
Select item from chosen js select with Capybara and Selenium
def select_from_chosen(item_text, options)
field = find_field(options[:from])
option_value = page.evaluate_script("$(\"##{field[:id]} option:contains('#{item_text}')\").val()")
page.execute_script("$('##{field[:id]}').val('#{option_value}')")
end
var custom_wymeditor_boot_options = {
skin: 'refinery'
, containersItems: [
{'name': 'h3', 'title':'Heading_3', 'css':'wym_containers_h3'}
, {'name': 'h4', 'title':'Heading_4', 'css':'wym_containers_h4'}
, {'name': 'h5', 'title':'Heading_5', 'css':'wym_containers_h5'}
, {'name': 'p', 'title':'Paragraph', 'css':'wym_containers_p'}
]
, classesItems: [