This file contains 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 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
# Run: curl https://gist.github.com/raw/719970/locale_diff.rb | ruby - en fi | |
require 'rubygems' | |
require 'yaml' | |
l1 = ARGV[0] | |
l2 = ARGV[1] | |
first = YAML.load_file(l1 + ".yml") | |
second = YAML.load_file(l2 + ".yml") | |
def diff(root, compared, structure = []) |
This file contains 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) | |
Copyright (c) 2016 Stuart Powers | |
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: |
This file contains 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 'net/http' | |
def require_web_font(o={}) | |
o = {:family=>"Open Sans",:weights=>["500","500italic"],:url=>"http://fonts.googleapis.com/css"}.merge(o) | |
url = URI.parse(URI::encode("#{o[:url]}?family=#{o[:family]}:#{o[:weights] * ','}")) | |
Net::HTTP.start(url.host,url.port){|http| http.request(Net::HTTP::Get.new(url.to_s))}.body | |
end | |
%> | |
<%= require_web_font({ :family => "Droid Sans", |
This file contains 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 'rack_directory_index.rb' | |
$documentRoot = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'build')) | |
Capybara.app = Rack::Builder.new do |builder| | |
puts "Creating static rack server serving #{$documentRoot}" | |
use Rack::DirectoryIndex | |
run Rack::Directory.new($documentRoot) | |
end |
This file contains 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
module Selenium | |
module WebDriver | |
module Firefox | |
class Profile | |
def layout_on_disk | |
firefox_profile = File.expand_path(File.join(File.dirname(__FILE__),'firefox_profile')) | |
profile_dir = create_tmp_copy(firefox_profile) | |
FileReaper << profile_dir | |
install_extensions(profile_dir) |
This file contains 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 MyDirective | |
constructor: (myService) -> | |
@controller = MyController | |
@controllerAs = myCtrl | |
restrict: 'E' | |
replace: true | |
scope: | |
attributeStuff: '=' | |
link: (scope, element, attr) -> | |
// Link stuff |
This file contains 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 WifiNetworksFragment : TonalFragment(R.layout.wifi_networks_fragment) { | |
// This automatically creates and clears the binding in a lifecycle-aware way. | |
private val binding: WifiNetworksFragmentBinding by viewBinding() | |
... | |
} | |
class WifiNetworkView @JvmOverloads constructor( | |
context: Context, | |
attrs: AttributeSet? = null, |
This file contains 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
import timber.log.Timber | |
import kotlin.properties.ReadOnlyProperty | |
import kotlin.reflect.KProperty | |
class MyClass { | |
// This will automatically have the TAG "MyClass" | |
private val log by timber() | |
fun logSomething() { | |
log.i("Hello") |