Skip to content

Instantly share code, notes, and snippets.

View defHLT's full-sized avatar
🐔

Artem Kholodnyi defHLT

🐔
View GitHub Profile
PROCESS STATE CODES
Here are the different values that the s, stat and state output specifiers (header "STAT" or "S") will display to describe the state of a process:
D uninterruptible sleep (usually IO)
R running or runnable (on run queue)
S interruptible sleep (waiting for an event to complete)
T stopped, either by a job control signal or because it is being traced
W paging (not valid since the 2.6.xx kernel)
X dead (should never be seen)
Z defunct ("zombie") process, terminated but not reaped by its parent
(on-ui
(set-content-view! this
[:linear-layout {}
[:button {:id ::mybtn
:text "A button"
:on-click (fn [w]
(let [edit (find-view this ::myedit)]
(config edit :text "Clicked!")))}]
[:edit-text {:id ::myedit}]]))
public void invokePicker(Integer requestCode) {
Intent intentGetContent = new Intent(Intent.ACTION_GET_CONTENT,
MediaStore.Images.Media.INTERNAL_CONTENT_URI);
intentGetContent.setType("image/*");
final PackageManager pm = getPackageManager();
final Intent i = new Intent(intentGetContent);
final List list = pm.queryIntentActivities(i, PackageManager.MATCH_DEFAULT_ONLY);
if (list.size() > 0) {
startActivityForResult(intentGetContent, requestCode);
} else {
private Sensor getDefaultSensor() {
Sensor gravitySensor = mSensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY);
Sensor accelSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
if (gravitySensor != null)
return gravitySensor;
else if (accelSensor != null)
return accelSensor;
else {
throw new RuntimeException("It seems device has neither gravity nor accelerometer sensor");
}
<uses-feature android:required="true" android:name="android.hardware.sensor.accelerometer" />
<uses-feature android:required="false" android:name="android.hardware.sensor.gyroscope" />
if (mServiceConn != null) {
if (mContext != null) mContext.unbindService(mServiceConn);
}
mRatingView = view.findViewById(R.id.rating_view);
mRatingClip = (ClipDrawable) mRatingView.getBackground();
BitmapDrawable star = (BitmapDrawable) getResources().getDrawable(R.drawable.ic_fab_star);
Bitmap bitmap = star.getBitmap();
int side = bitmap.getHeight();
ViewGroup.LayoutParams lp = mRatingView.getLayoutParams();
lp.width = side * 10;
lp.height = side;
package com.mlatu.tv.ui.views;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Path;
import android.util.AttributeSet;
import android.widget.FrameLayout;
public class ClipRevealFrame extends FrameLayout {
t.search(query) // Retrofit
.subscribeOn(Schedulers.io())
.retry(3)
.observeOn(Schedulers.io())
.subscribe(new Observer<List<SearchResult>>() {
@Override
public void onCompleted() {
}
@Override
@Override
public void onAttach(final Activity activity) {
super.onAttach(activity);
mContextStream.onNext(activity);
}
// ......