Skip to content

Instantly share code, notes, and snippets.

View theothernt's full-sized avatar
🍜
Dreaming of ramen

Neil Turner theothernt

🍜
Dreaming of ramen
View GitHub Profile
@nielsvanvelzen
nielsvanvelzen / DreamServiceCompat.kt
Last active September 23, 2024 17:05
Extension to DreamService to allow usage of Jetpack Compose inside
import android.service.dreams.DreamService
import androidx.annotation.CallSuper
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.platform.ViewCompositionStrategy
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleRegistry
import androidx.lifecycle.ViewModelStore
import androidx.lifecycle.ViewModelStoreOwner
import androidx.lifecycle.setViewTreeLifecycleOwner
@namratachaudhary
namratachaudhary / daal-mash.md
Created November 6, 2020 19:02
Not-so-boring daal

DO NOT ADD OIL, BUTTER, GHEE OR ANY SPICES TILL THIS STEP OR YOU WILL NOT BE ABLE TO PRESERVE THIS IN THE FRIDGE

This is the mash we prepare with blend of lentils and peas, and this can be preserved in the fridge for upto 2 weeks. The quantity below makes enough 4/5 medium portion sizes (depending upon what your definition is, but for one 1 portion of daal is enough for 100gm of rice)

Ingredients -

  • 50 gm masoor daal (pink one)
  • 100 gm moong daal (yellow lentils)
  • 150 gm toor daal (yellow split pigeon peas - not oily ones)
  • 1/2 tsp tumeric
  • 2 chopped chillies (optional, but do not add more)
@JCarlosR
JCarlosR / PreferenceHelper.kt
Last active October 10, 2024 04:36 — forked from krupalshah/PreferenceHelper.kt
Helper for shared preferences management - Kotlin version
package com.programacionymas.helpers
import android.content.Context
import android.content.SharedPreferences
import android.preference.PreferenceManager
object PreferenceHelper {
fun defaultPrefs(context: Context): SharedPreferences
= PreferenceManager.getDefaultSharedPreferences(context)
@tatocaster
tatocaster / RealPathUtil.java
Last active October 25, 2024 07:18
Real Path Utility class for Android, works for all API
public class RealPathUtil {
public static String getRealPath(Context context, Uri fileUri) {
String realPath;
// SDK < API11
if (Build.VERSION.SDK_INT < 11) {
realPath = RealPathUtil.getRealPathFromURI_BelowAPI11(context, fileUri);
}
// SDK >= 11 && SDK < 19
else if (Build.VERSION.SDK_INT < 19) {
import android.opengl.GLES20;
import android.view.Surface;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLContext;
import javax.microedition.khronos.egl.EGLDisplay;
import javax.microedition.khronos.egl.EGLSurface;
public class SurfaceUtil {
@JanDeDobbeleer
JanDeDobbeleer / CircularProgressBar.xaml
Last active October 12, 2023 17:03
Circular progress bar
<UserControl
x:Class="Foo.Bar.CircularProgressBar"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="480" d:DesignWidth="480">
<Grid>
@sandrock
sandrock / FillParentBehavior.cs
Created April 11, 2013 14:37
Helps resize a control to fill its parent. Works only with a Image control but may be enhanced to work with other controls. Works in Windows Phone, may work in Silverlight/WPF. See http://stackoverflow.com/questions/13535022/windows-8-image-uniformfill-centered
namespace MyPhoneApp.Behaviors
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
@devknoll
devknoll / gist:4407479
Last active March 11, 2016 16:02
Convention for binding Caliburn.Micro action guard methods (i.e. CanExecute) to Rx IObservable<bool>.
var basePrepareContext = ActionMessage.PrepareContext;
ActionMessage.PrepareContext = (context) =>
{
ActionMessage.SetMethodBinding(context);
if (context.Target == null || context.Method == null)
return;
var guardName = "Can" + context.Method.Name;
var targetType = context.Target.GetType();