Skip to content

Instantly share code, notes, and snippets.

@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=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')

Transactions

As your business logic gets complex you may need to implement transactions. The classic example is a bank funds transfer from account A to account B. If the withdrawal from account A fails then the deposit to account B should either never take place or be rolled back.

Basics

All the complexity is handled by ActiveRecord::Transactions. Any model class or instance has a method named .transaction. When called and passed a block, that block will be executed inside a database transaction. If there's an exception raised, the transaction will automatically be rolled back.

Example

@chetan
chetan / yardoc_cheatsheet.md
Last active May 10, 2024 02:53
YARD cheatsheet
@codespore
codespore / Active_Admin_Cheats.rb
Last active August 30, 2022 14:17
Quick reference to useful ActiveAdmin customizations
# Add Action button on the top navigation menu. Useful for resource with nested resources
action_item :only => :show do
link_to('Show Users', admin_group_users_path(resource))
end
# Custom show page with children items
show do
@vparihar01
vparihar01 / nokogiri_libxml_homebrew_lion_installation.sh
Created June 25, 2013 07:01
How to fix: Nokogiri Incompatible library version: nokogiri.bundle requires version 11.0.0 or later, but libxml2.2.dylib provides version 10.0.0. dlopen bundle.open. Using homebrew on lion to install nokogiri and lixml
FIXME:
WARNING: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.7.8
or
ERROR -: Incompatible library version: nokogiri.bundle requires version 11.0.0 or later, but libxml2.2.dylib provides version 10.0.0
gem uninstall nokogiri libxml-ruby
brew update
brew uninstall libxml2
@bradmontgomery
bradmontgomery / install-comodo-ssl-cert-for-nginx.rst
Last active June 10, 2024 15:37
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@dior001
dior001 / protocol.md
Created May 31, 2014 19:47
Chuck fatback pastrami corned beef, tenderloin pork loin shankle sirloin frankfurte

Bacon ipsum dolor sit amet kevin pancetta jowl short loin chuck tail swine short ribs ham capicola porchetta. Salami capicola ground round venison chuck. T-bone biltong doner rump shankle. T-bone pig meatball shoulder, cow pork belly drumstick short ribs pastrami chuck frankfurter pork rump jerky beef ribs. Drumstick flank pork chop tri-tip beef. Capicola chicken turducken doner meatball t-bone kevin, meatloaf jerky pork belly pancetta.

Fatback capicola meatball shankle ham hock pig chuck strip steak brisket. Drumstick capicola hamburger, spare ribs andouille tri-tip strip steak fatback chuck. Meatloaf landjaeger filet mignon, chuck meatball pork loin ground round ball tip sirloin cow corned beef prosciutto. Landjaeger ribeye turducken, short loin tail pork tri-tip fatback swine pork belly leberkas ball tip sirloin chuck. Kielbasa short loin leberkas, biltong pork loin pork belly jowl capicola.

Chuck fatback pastrami corned beef, tenderloin pork loin shankle sirloin frankfurter landjaeger short loin jowl. S

@scientificprotocols
scientificprotocols / protocol.md
Last active August 29, 2015 14:04
High-Magnification In Vivo Imaging of Xenopus Embryos for Cell and Developmental Biology
Authors: Esther K. Kieserman, Chanjae Lee, Ryan S. Gray, Tae Joo Park and John B. Wallingford

Corresponding author (wallingford@mail.utexas.edu).

INTRODUCTION

Embryos of the frog Xenopus laevis are an ideal model system for in vivo imaging of dynamic biological processes, from the inner workings of individual cells to the reshaping of tissues during embryogenesis. Their externally developing embryos are more amenable to in vivo analysis than internally developing mammalian embryos, and the large size of the embryos make them particularly suitable for time-lapse analysis of tissue-level morphogenetic events. In addition, individual cells in Xenopus embryos are larger than those in other vertebrate models, making them ideal for imaging cell behavior and subcellular processes (e.g., following the dynamics of fluorescent fusion proteins in living or fixed cells and tissues). Xenopus embryos are amenable to simple manipulations of gene function, including knockdown a

@scientificprotocols
scientificprotocols / protocol.md
Last active August 29, 2015 14:04
The Genus Antirrhinum (Snapdragon): A Flowering Plant Model for Evolution and Development
Authors: Andrew Hudson, Joanna Critchley and Yvette Erasmus

Corresponding author (andrew.hudson@ed.ac.uk)

INTRODUCTION

The Antirrhinum species group comprises approximately 20 morphologically diverse members that are able to form fertile hybrids. It includes the cultivated snapdragon Antirrhinum majus, which has been used as a model for biochemical and developmental genetics for more than 75 yr. The research infrastructure for A. majus, together with the interfertility of the species group, allows Antirrhinum to be used to examine the genetic basis for plant diversity.

RELATED INFORMATION

@dior001
dior001 / protocol.md
Last active August 29, 2015 14:05
Bacon ipsum dolor sit amet tail filet mignon

Bacon ipsum dolor sit amet tail filet mignon frankfurter doner shankle pork ham hock jerky cow fatback turkey. Doner kielbasa tongue t-bone bacon ball tip shankle drumstick prosciutto turkey capicola meatloaf. Frankfurter ham hock sausage pig, spare ribs tenderloin fatback venison doner leberkas short ribs boudin tongue hamburger rump. Sausage pork chop filet mignon ribeye porchetta. Meatloaf strip steak pork loin, venison ground round short ribs bacon.

Rump sausage shankle, landjaeger venison kielbasa capicola chuck pork loin short loin ball tip pig. Ham strip steak tenderloin bacon prosciutto pork loin swine beef landjaeger ham hock turkey pig salami. Tongue salami bresaola, jowl frankfurter porchetta fatback tenderloin bacon jerky beef ribs strip steak. Bresaola drumstick kevin chuck, andouille turkey swine pork meatloaf corned beef. Pork belly cow sirloin swine drumstick shank fatback. Fatback porchetta kielbasa meatball pork loin.

Ground round drumstick pork, jerky prosciutto sirloin spare ribs capicol