This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# width & height attributes for the original image only | |
# since style dimensions are already known | |
# | |
# Migration to add width & height attribtues for the original attachment | |
# | |
# add_column :<model>, :<attachment>_file_width, :integer | |
# add_column :<model>, :<attachment>_file_height, :integer | |
# | |
# | |
# class Document < ActiveRecord::Base |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this lives in your home directory ~/.autotest | |
# | |
Autotest.add_hook :initialize do |autotest| | |
# autotest.add_exception(%r{^\./db}) | |
# autotest.add_exception(%r{^\./log}) | |
# autotest.add_exception(%r{^\./tmp}) | |
# autotest.add_exception(%r{^\./Gemfile.lock}) | |
# autotest.add_exception(%r{^\./\.git}) | |
# autotest.add_exception(%r{^\./\.bundle}) | |
# autotest.add_exception(%r{^\./.+\.swp}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The MIT License (MIT) | |
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 WITH THE SOFTWARE OR THE USE OR OTHER DEA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PurchaseOrder < ActiveRecord::Base | |
has_many :sales_transactions, :foreign_key => "po_purchase_order_no", | |
:primary_key => "purchase_order_no" | |
before_validation :check_for_exisitng_po # maybe only on create? | |
accepts_nested_attributes_for :sales_transactions | |
private |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def intercept_alert(confirm = false) | |
begin | |
# TODO dismiss vs accept | |
# page.evaluate_script('window.confirm = function(msg) { return true; }') | |
# page.driver.browser.switch_to.alert.accept | |
page.driver.browser.switch_to.alert.dismiss | |
rescue Selenium::WebDriver::Error::NoAlertOpenError | |
# / | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def wait_for_ajax(timeout = 5) #Timeout in seconds | |
page.wait_until(timeout) { page.evaluate_script "jQuery.active == 0" } | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var script = document.createElement('script'); | |
script.type = 'text/javascript'; | |
script.src = '/javascripts/your-js.js'; | |
document.getElementsByTagName('head')[0].appendChild(script); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(F,i,r,e,b,u,g,L,I,T,E){if(F.getElementById(b))return;E= | |
F[i+'NS']&&F.documentElement.namespaceURI;E=E?F[i+'NS'](E,'script'):F[i]('sc | |
ript');E[r]('id',b);E[r]('src',I+g+T);E[r](b,u);(F[e]('head')[0]||F[e]('body | |
')[0]).appendChild(E);E=new%20Image;E[r]('src',I+L);})(document,'createEleme | |
nt','setAttribute','getElementsByTagName','FirebugLite','4','firebug-lite.js | |
','releases/lite/latest/skin/xp/sprite.png','https://getfirebug.com/','#star | |
tOpened'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery.fn.exists = function() { return jQuery(this).length>0; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function rgb2hex(rgb) { | |
rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); | |
function hex(x) { | |
return ("0" + parseInt(x).toString(16)).slice(-2); | |
} | |
return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]); | |
} |
OlderNewer