Skip to content

Instantly share code, notes, and snippets.

Mirko Stocker misto

Block or report user

Report or block misto

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
@misto
misto / gist:1758655
Created Feb 7, 2012
Scala Trait linearization
View gist:1758655
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
View gist:3938337
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");
View gist:3938488
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 = ...
View gist:3945882
/**
* 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
View gist:3945957
while ((audioTrack.getPlaybackHeadPosition() < duration * sampleRate)) {
try {
Thread.sleep(50 /*milliseconds*/);
} catch (InterruptedException e) {
}
}
View gist:4016494
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;
View gist:4016595
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/*");
View gist:4673334
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
View osm.java
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);
View keybase.md

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:

You can’t perform that action at this time.