Skip to content

Instantly share code, notes, and snippets.

@mars
mars / capybara_reset_patch.rb
Created August 13, 2014 19:09
Capybara patch to avoid `@browser.navigate.to('about:blank')` which hangs sometimes.
# Monkey-patch on Capybara!!!
#
class Capybara::Selenium::Driver < Capybara::Driver::Base
# Patch to avoid `@browser.navigate.to('about:blank')` which hangs sometimes.
#
def reset!
# Use instance variable directly so we avoid starting the browser just to reset the session
if @browser
begin @browser.manage.delete_all_cookies

Keybase proof

I hereby claim:

  • I am mars on github.
  • I am marsi (https://keybase.io/marsi) on keybase.
  • I have a public key whose fingerprint is DFC9 5BAD 42CF D15F 589A 9436 7F70 7FA1 F236 B857

To claim this, I am signing this object:

@mars
mars / react-router-1.0.0-pass-router-in-props.js
Created August 27, 2015 22:20
Pass the `router` instance down to Route children; React 0.13.3, React Router 1.0.0beta-4, ES2015, ES6
import React from 'react';
// Top-level Route component receives the router in context and passes it onto each child's props
export default class AppView extends React.Component {
render() {
return (
<div className="container">
{
// Add `props.router` to each route component
React.Children.map(this.props.children, c => {