- Introduction
- Definition
- Examples
- Links
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
#!/usr/bin/env ruby | |
# Sometimes, you realize you have really rubbish songs in your library for some reason. | |
# This script allows you to get rid of them just by hitting ./mpd-delete-current-song.rb on your command line. | |
# It will backup the file to TRASH, then remove it from MPD's library and finally skip to next song. | |
# https://gist.github.com/1341895 | |
require 'socket' | |
require 'fileutils' |
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 ParamsFor | |
def params_for(model, *attributes) | |
return if method_defined? "#{model}_params" | |
define_method "#{model}_params" do | |
params.require(model).permit attributes | |
end | |
end | |
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
class ExampleCrawler < PoltergeistCrawler | |
def crawl | |
visit "https://news.ycombinator.com/" | |
click_on "More" | |
page.evaluate_script("window.location = '/'") | |
end | |
end | |
ExampleCrawler.new.crawl |
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
HTTP status code symbols for Rails | |
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings. | |
Status Code Symbol | |
1xx Informational | |
100 :continue | |
101 :switching_protocols | |
102 :processing |
Since modern.ie released vagrant boxes, it' no longer necessary to manually import the ova file to virtualbox, as mentioned here.
However, the guys at modern.ie didn't configured the box to work with WinRM. This how-to addresses that, presenting steps to proper repackage these boxes, adding WinRM support. Additionally configures chocolatey package manager and puppet provisioner.
For a tool, which executes a configurable command when a bluetooth device connects, see repository https://github.com/joleuger/bluetooth-manager. It can be used to play an icecast stream.
> apt-get install libpam-systemd
> apt-get install pulseaudio gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-tools mpv
> apt-get install bluetooth bluez bluez-tools bluez-firmware pulseaudio-module-bluetooth
> adduser audioclient
> vim /etc/shadow (remove password)
OlderNewer