Skip to content

Instantly share code, notes, and snippets.

Orhan Obut orhanobut

Block or report user

Report or block orhanobut

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View LineBackgroundSpanSampleActivity.java
public class MainActivity extends Activity {
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
SpannableString spannable = new SpannableString("aasdfasasdfasdfasdf span span");
spannable.setSpan(
new LineBackgroundSpan() {
@Override public void drawBackground(Canvas c, Paint p, int left, int right, int top, int baseline, int bottom,
View google_form_3.rb
// Send email with attachment
var pdfdocument = response.getBlob().setName('YourFilledTravelExpenseForm.pdf');
var email = sheet.getRange(line, 2).getValue();
var subject = "Travel Expense Sheet for " + sheet.getRange(line, 13).getValue();
var message = "Please print the attached PDF, check for correctness, sign it and hand it in along with the invoice.\n\nThank you!"
MailApp.sendEmail(email, subject, message, {attachments:[pdfdocument]});
}
View google_form_2.rb
var url_ext = 'export?exportFormat=pdf&format=pdf' // export as pdf
+ '&size=A4' // paper size
+ '&portrait=false' // orientation, false for landscape
+ '&sheetnames=false&printtitle=false' // hide optional headers and footers
+ '&pagenumbers=false&gridlines=false' // hide page numbers and gridlines
+ '&fzr=false' // do not repeat row headers (frozen rows) on each page
+ '&gid='; // the sheet's Id
DriveApp.getRootFolder();
var token = ScriptApp.getOAuthToken();
View google_form.rb
function sendFormByEmail(e) {
// Initialize
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheets = ss.getSheets();
var sheet = SpreadsheetApp.getActiveSheet();
var line = sheet.getLastRow();
// Fill in form template
sheets[1].getRange("C5").setValue(sheet.getRange(line, 3).getValue());
View MyApplication.java
class MyApplication extends Application {
Override public void onCreate(){
super.onCreate();
Stetho.initializeWithDefaults(this);
}
}
View StethoUtils.java
public class StethoUtils {
private StethoUtils() {
// no instance
}
public static void init(Context context) {
// no-op
}
View MyApplication.java
public class MyApplication extends Application {
@Override public void onCreate(){
super.onCreate();
StethoUtils.init(this);
}
}
View StethoUtils.java
public class StethoUtils {
private StethoUtils() {
// no instance
}
public static void init(Context context) {
Stetho.initializeWithDefaults(context);
}
View Handler1.java
Thread thread = new Thread(new Runnable() {
@Override public void run() {
// your long task
textView.setText("Task 4 Result"); //update view
}
});
thread.start();
View GooglePlacesApiTest3.java
@Test public void shouldReturnPredictionsSuccessfully() throws Exception {
String queryToAutoComplete = "berlin";
PendingResult<AutocompletePredictionBuffer> result =
Places.GeoDataApi.getAutocompletePredictions(apiClient, queryToAutoComplete, null, null);
AutocompletePredictionBuffer predictions = result.await(3, SECONDS);
Status status = predictions.getStatus();
assertThat(status.isSuccess()).isTrue();
// more assertions
You can’t perform that action at this time.