Dad to a weapons-grade face-licker dog,
Partner to a hyper-energetic, monica-esque girl,
Hiker,
| @file:Suppress("NOTHING_TO_INLINE") | |
| import kotlin.experimental.and // Used for Byte | |
| import kotlin.experimental.inv // Used for Byte | |
| import kotlin.experimental.or // Used for Byte | |
| inline fun Int.hasFlag(flag: Int) = flag and this == flag | |
| inline fun Int.withFlag(flag: Int) = this or flag | |
| inline fun Int.minusFlag(flag: Int) = this and flag.inv() |
| protected String[] doInBackground(String... credentials) { | |
| String consumer_secret = mActivity.getString(R.string.oauth_consumer_secret); | |
| HttpClient client = new DefaultHttpClient(); | |
| HttpPost request = new HttpPost("https://www.instapaper.com/api/1/oauth/access_token"); | |
| CommonsHttpOAuthConsumer consumer = new CommonsHttpOAuthConsumer(mActivity.getString(R.string.oauth_consumer_key), | |
| consumer_secret); | |
| List<BasicNameValuePair> params = Arrays.asList( | |
| new BasicNameValuePair("x_auth_username", credentials[0]), | |
| new BasicNameValuePair("x_auth_password", credentials[1]), | |
| new BasicNameValuePair("x_auth_mode", "client_auth")); |
| const selection = getSelection(); | |
| const isALink = selection.type.toLowerCase() == "range") && // Selection is a range, and | |
| selection.anchorNode == selection.focusNode && // Starts & finishes in the same node, and | |
| selection.anchorOffset == 0 && // Starts at beginning of the node, and | |
| selection.focusOffset == selection.focusNode.textContent.length && // Finishes at end of the node, and | |
| (selection.anchorNode.nodeName.toLowerCase() == 'a' || // Node is of type 'a' (link/anchor), or | |
| selection.anchorNode.parentElement.nodeName.toLowerCase() == 'a') // Node parent is of type 'a' (link/anchor) | |
I hereby claim:
To claim this, I am signing this object: