save_and_open_page
have_button(locator)
public static String getPropSystem(String key) throws IOException { | |
BufferedReader bis = null; | |
try { | |
Process ifc = Runtime.getRuntime().exec("getprop " + key); | |
bis = new BufferedReader(new InputStreamReader(ifc.getInputStream())); | |
return bis.readLine(); | |
} finally { | |
bis.close(); | |
} | |
} |
private void settingDeviceDateTime(Date date) { | |
Calendar c = Calendar.getInstance(); | |
c.setTime(date); | |
SystemClock.setCurrentTimeMillis(c.getTimeInMillis()); | |
Log.d(TAG, "Setting time to: " + new SimpleDateFormat("MM/dd/yyyy hh:mm:ss").format(c.getTime())); | |
} |
public static String getSystemProp(String key) throws Exception { | |
Class<?> c = Class.forName("android.os.SystemProperties"); | |
Class<?>[] types = new Class[] {String.class}; | |
Method method = c.getMethod("get", types); | |
return (String) method.invoke(null, new Object[] {key}); | |
} |
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); | |
} |
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 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(); | |
} | |
} | |
} |
== 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 |
=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') |
$(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..." ); | |
}) |