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
| # Sticky Sidebar | |
| $(document).ready () -> | |
| if (!!$('.sticky').offset()) | |
| stickyTop = $('.sticky').offset().top | |
| $(window).scroll () -> | |
| windowTop = $(window).scrollTop() | |
| if (stickyTop < windowTop) | |
| $('.sticky').css({ position: 'fixed', top: 0 }); | |
| else |
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 download_remote_image | |
| if io = do_download_remote_image | |
| self.image = io | |
| self.image_remote_url = image_url | |
| io.close # Already copied to a Tempfile. | |
| 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
| after "deploy:symlink", "deploy:restart_workers" | |
| ## | |
| # Rake helper task. | |
| # http://pastie.org/255489 | |
| # http://geminstallthat.wordpress.com/2008/01/27/rake-tasks-through-capistrano/ | |
| # http://ananelson.com/said/on/2007/12/30/remote-rake-tasks-with-capistrano/ | |
| def run_remote_rake(rake_cmd) | |
| rake_args = ENV['RAKE_ARGS'].to_s.split(',') | |
| cmd = "cd #{fetch(:latest_release)} && #{fetch(:rake, "rake")} RAILS_ENV=#{fetch(:rails_env, "production")} #{rake_cmd}" |
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
| desc "tail production log files" | |
| task :tail_p, :roles => :app do | |
| run "tail -f #{shared_path}/log/production.log" do |channel, stream, data| | |
| puts # for an extra line break before the host name | |
| puts "#{channel[:host]}: #{data}" | |
| break if stream == :err | |
| 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
| require 'json' | |
| Hash.from_xml('<variable type="product_code">5</variable>').to_json # => "{\"variable\":\"5\"}" | |
| require 'net/http' | |
| s = Net::HTTP.get_response(URI.parse('http://stackoverflow.com/feeds/tag/ruby/')).body | |
| Hash.from_xml(s).to_json | |
| # for pretty output | |
| JSON.pretty_generate(Hash.from_xml('<variable type="product_code">5</variable>')) |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>My title is here</title> | |
| <!--[if lt IE 9]> | |
| <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> | |
| <![endif]--> | |
| </head> | |
| <body> |
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
| =Navigating= | |
| visit('/projects') | |
| visit(post_comments_path(post)) | |
| =Clicking links and buttons= | |
| click_link('id-of-link') | |
| click_link('Link Text') | |
| click_button('Save') | |
| click('Link Text') # Click either a link or a button | |
| click('Button Value') |
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
| # Copyright Camptocamp SA 2012 | |
| # License: AGPL (GNU Affero General Public License)[http://www.gnu.org/licenses/agpl-3.0.txt] | |
| # Author Guewen Baconnier | |
| require "xmlrpc/client" | |
| require 'pp' | |
| XMLRPC::Config::ENABLE_NIL_PARSER = true | |
| XMLRPC::Config::ENABLE_NIL_CREATE = true | |
| class MagentoAPI |
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
| #!/usr/bin/env bash | |
| apt-get -y update | |
| apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev | |
| cd /tmp | |
| wget ftp://ftp.fu-berlin.de/unix/languages/ruby/1.9/ruby-1.9.3-p448.tar.gz | |
| tar -xvzf ruby-1.9.3-p448.tar.gz | |
| cd ruby-1.9.3-p448/ | |
| ./configure --prefix=/usr/local | |
| make | |
| make install |
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
| ruby -e'a=0x1F311;loop{8.times{|i|print(("\b"*6)+[a+i].pack("U")+(" "*5));sleep(0.1)}}' |