save_and_open_page
have_button(locator)| Below are the Big O performance of common functions of different Java Collections. | |
| List | Add | Remove | Get | Contains | Next | Data Structure | |
| ---------------------|------|--------|------|----------|------|--------------- | |
| ArrayList | O(1) | O(n) | O(1) | O(n) | O(1) | Array | |
| LinkedList | O(1) | O(1) | O(n) | O(n) | O(1) | Linked List | |
| CopyOnWriteArrayList | O(n) | O(n) | O(1) | O(n) | O(1) | Array | |
| [ | |
| { | |
| "RegiaoId": 13, | |
| "Nome": "MG", | |
| "Descricao": "Minas gerais" | |
| } | |
| ] |
| import UIKit | |
| class SwiftKeyboardAvoiderHelper: NSObject, UITextFieldDelegate { | |
| private let durationTime: Double! = 0.2 | |
| private var viewController: UIViewController! | |
| private var originalFrame: CGRect! | |
| private var necessaryShift: CGFloat! = 0 | |
| var shift: CGFloat! | |
| var target: UIView! |
| $(document).ready(function() { | |
| $form = $("#signup-form"); | |
| $form.bind("ajax:beforeSend", function(evt, xhr, settings){ | |
| var $submitButton = $form.find('.btn-submit'); | |
| $submitButton.attr("disabled", true); | |
| $submitButton.data('origText', $submitButton.text()); | |
| $submitButton.text("Cadastrando..." ); | |
| }) |
| =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') |
| == last commit that changed a specific file | |
| git rev-list -n 1 HEAD -- <file_path> | |
| == checkout file from commit | |
| git checkout <deleting_commit>^ -- <file_path> | |
| == list files changed in one specific commit |
| public static String getIPAddress() throws SocketException { | |
| for (Enumeration<?> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) { | |
| NetworkInterface intf = (NetworkInterface) en.nextElement(); | |
| for (Enumeration<?> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) { | |
| InetAddress inetAddress = (InetAddress) enumIpAddr.nextElement(); | |
| if (!inetAddress.isLoopbackAddress()) { | |
| return inetAddress.getHostAddress().toString(); | |
| } | |
| } | |
| } |
| private static byte[] intToLittleEndian(long numero) { | |
| ByteBuffer bb = ByteBuffer.allocate(4); | |
| bb.order(ByteOrder.LITTLE_ENDIAN); | |
| bb.putInt((int) numero); | |
| return bb.array(); | |
| } | |
| // OR ... | |
| private static byte[] intToLittleEndian(long numero) { |
| public static void installApk(Context context, File apkFile) { | |
| Intent intent = new Intent(Intent.ACTION_VIEW); | |
| intent.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive"); | |
| context.startActivity(intent); | |
| } |