Java.Lang.Class has a special method for managed types:
Java | C# (Xamarin.Android)
private T FindSpan<T>(TextView textView, ISpannable spannable, MotionEvent e) | |
where T : Java.Lang.Object | |
{ | |
var x = (int)e.GetX() - textView.TotalPaddingLeft + textView.ScrollX; | |
var y = (int)e.GetY() - textView.TotalPaddingTop + textView.ScrollY; | |
var layout = textView.Layout; | |
int position = layout.GetOffsetForHorizontal(layout.GetLineForVertical(y), x); | |
var links = spannable.GetSpans(position, position, Java.Lang.Class.FromType(typeof(T))); |
using System; | |
public static class StringExtensions | |
{ | |
public static string Format(this string str, params object[] parameters) | |
{ | |
return string.Format(str, parameters); | |
} | |
import admin from 'firebase-admin'; | |
/** | |
* Firestore does not accept more than 500 writes in a transaction or batch write. | |
*/ | |
const MAX_TRANSACTION_WRITES = 499; | |
type WriteBigBatchOperationType = (batch: admin.firestore.WriteBatch) => void; | |
type WriteBigBatchCallbackType = (operation: WriteBigBatchOperationType) => void; |
#!/bin/bash | |
PP="$HOME/Library/MobileDevice/Provisioning Profiles" | |
echo $PP | |
echo "All Provisioning Profiles:" | |
ls -al "$PP" | |
echo "Decoded Provisioning Profiles:" |
#!/usr/bin/env node | |
// How to | |
// wget http://gist.github.com/... | |
// chmod +x ya.js | |
// ./ya.js download_url path/to/directory | |
const https = require('https'); | |
const { URL } = require('url'); | |
const { spawn } = require('child_process'); |
#!/bin/bash | |
DOC_ID='' | |
SHEET_ID=0 | |
TMP_FILE='temp.csv' | |
OUTPUT_FILE='result.json' | |
# export csv | |
curl -L "https://docs.google.com/spreadsheets/d/$DOC_ID/export?format=csv&gid=$SHEET_ID" -o $TMP_FILE |