Skip to content

Instantly share code, notes, and snippets.

View misto's full-sized avatar

Mirko Stocker misto

  • OST – Ostschweizer Fachhochschule
  • Switzerland
View GitHub Profile
@misto
misto / gist:1758655
Created February 7, 2012 09:27
Scala Trait linearization
Welcome to Scala version 2.9.1.r0-b20120125223512 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_02).
Type in expressions to have them evaluated.
Type :help for more information.
scala> trait A
defined trait A
scala> trait C extends A
defined trait C
private static final int SCAN_QR_CODE_REQUEST_CODE = 0;
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuItem menuItem = menu.add("Log");
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
private void log(String qrCode) {
Intent intent = new Intent("ch.appquest.intent.LOG");
if (getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY).isEmpty()) {
Toast.makeText(this, "Logbook App not Installed", Toast.LENGTH_LONG).show();
return;
}
// Achtung, je nach App wird etwas anderes eingetragen
String logmessage = ...
/**
* Für die Erzeugung der Töne brauchen wir zwei Parameter: die Länge eines
* Tons sowie die Sampling Rate, also die Abtastrate, mit der wir die Töne
* erstellen: http://en.wikipedia.org/wiki/Sampling_rate
*/
private final int duration = 1; // seconds
private final int sampleRate = 8000;
/**
* Erstellt einen Byte-Array mit den Soundinformationen die wir für das
while ((audioTrack.getPlaybackHeadPosition() < duration * sampleRate)) {
try {
Thread.sleep(50 /*milliseconds*/);
} catch (InterruptedException e) {
}
}
package ch.appquest.imagepuzzle;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
Uri uri = /*URI an der die Kamera-App das Foto abgelegt hat*/
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setDataAndType(uri, "image/*");
overloaded method value tuple with alternatives: [A1(in method tuple)(in method tuple)(in method tuple)(in method tuple)(in method tuple)(in
method tuple)(in method tuple)(in method tuple)(in method tuple)(in method tuple)(in method tuple)(in method tuple)(in method tuple)(in method
tuple), A2(in method tuple)(in method tuple)(in method tuple)(in method tuple)(in method tuple)(in method tuple)(in method tuple)(in method
tuple)(in method tuple)(in method tuple)(in method tuple)(in method tuple)(in method tuple)(in method tuple)(in method tuple)(in method tuple),
A3(in method tuple)(in method tuple)(in method tuple)(in method tuple)(in method tuple)(in method tuple)(in method tuple)(in method tuple)(in
method tuple)(in method tuple), A4(in method tuple)(in method tuple)(in method tuple)(in method tuple)(in method tuple)(in method tuple)(in
method tuple)(in method tuple), A5(in method tuple)(in method tuple)(in method tuple)(in method tuple)(in method tuple)(in method tuple)(in
method tuple)(in met
@misto
misto / osm.java
Last active November 4, 2017 11:17
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Context ctx = getApplicationContext();
Configuration.getInstance().load(ctx, PreferenceManager.getDefaultSharedPreferences(ctx));
setContentView(R.layout.activity_main);
map = findViewById(R.id.map);
map.setTileSource(TileSourceFactory.MAPNIK);
map.setMaxZoomLevel(20);

Keybase proof

I hereby claim:

  • I am misto on github.
  • I am misto (https://keybase.io/misto) on keybase.
  • I have a public key whose fingerprint is 5D1F E697 A21D F974 76B7 B8A2 8201 C199 A362 981A

To claim this, I am signing this object: