# Anchor
click_link 'Save'
# Button
click_button 'awesome'
# Both above
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
| // hasClass, takes two params: element and classname | |
| function hasClass(el, cls) { | |
| return el.className && new RegExp("(\\s|^)" + cls + "(\\s|$)").test(el.className); | |
| } | |
| /* use like below */ | |
| // Check if an element has class "foo" | |
| if (hasClass(element, "foo")) { |
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
| # List all databases | |
| sudo -u postgres psql --list | |
| # Create backup file | |
| sudo -u postgres pg_dump [database_name] > dumpl.sql | |
| # Drop the database | |
| sudo -u prostgres dropdb [database_name] | |
| # Create a new database |
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
| defmodule Chat.Client do | |
| # In all of the following functions 'server' stands for the server's pid | |
| def join(server) do | |
| send server, :join | |
| end | |
| def say(server, message) do | |
| send server, { :say, message } | |
| 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
| <?php | |
| /* From https://www.usps.com/send/official-abbreviations.htm */ | |
| $us_state_abbrevs_names = array( | |
| 'AL'=>'ALABAMA', | |
| 'AK'=>'ALASKA', | |
| 'AS'=>'AMERICAN SAMOA', | |
| 'AZ'=>'ARIZONA', | |
| 'AR'=>'ARKANSAS', |
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
| // Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible). | |
| // Tweak the makePrettyJSON_ function to customize what kind of JSON to export. | |
| var FORMAT_ONELINE = 'One-line'; | |
| var FORMAT_MULTILINE = 'Multi-line'; | |
| var FORMAT_PRETTY = 'Pretty'; | |
| var LANGUAGE_JS = 'JavaScript'; | |
| var LANGUAGE_PYTHON = 'Python'; |
NewerOlder