Skip to content

Instantly share code, notes, and snippets.

View yrezgui's full-sized avatar

Yacine Rezgui yrezgui

View GitHub Profile
@yrezgui
yrezgui / HomeViewModel.kt
Created November 30, 2022 22:46
ViewModel with Factory
package com.example.app
import android.app.Application
import android.content.Context
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.ViewModelProvider.AndroidViewModelFactory.Companion.APPLICATION_KEY
import androidx.lifecycle.createSavedStateHandle
@yrezgui
yrezgui / gist:2a710cbd32a29133cb31f575fbbaee2d
Created October 7, 2022 16:20 — forked from phhusson/gist:662af3573ad4fc91bb62e5fe7cde7250
Add rickroll Dialer option. Add rick.webm in assets
From f07ca2a26dcb0cc797dcc6fc0d2d4f16b89c481e Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson <phh@phh.me>
Date: Mon, 14 Mar 2022 09:09:28 -0400
Subject: [PATCH] Add a rickroll button in heads-up notification to rickroll
caller
Change-Id: Ibe72535fb3e93f69a531723dc96ede05663ee251
---
assets/rick.webm | Bin 0 -> 1232413 bytes
.../NotificationBroadcastReceiver.java | 145 ++++++++++++++++++
@yrezgui
yrezgui / Storage.kt
Created November 19, 2020 17:45
Storage utilities for Android
package com.yrezgui.videoplayer
import android.annotation.SuppressLint
import android.content.Context
import android.os.Build.VERSION
import android.os.Build.VERSION_CODES
import android.os.Environment
import android.os.storage.StorageManager
import android.os.storage.StorageVolume
import androidx.annotation.RequiresApi
@yrezgui
yrezgui / MainActivity.kt
Created June 2, 2020 18:51
FileProvider for Meghan
package com.android.samples.fileprovidertest
import android.os.Bundle
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import com.android.samples.fileprovidertest.databinding.ActivityMainBinding
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import okhttp3.OkHttpClient
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
@yrezgui
yrezgui / execute.sh
Created May 1, 2020 16:14
Android 11 Wifi debugging
# 🤖Android 11 WiFi debugging
# Connect your device to the same WiFi as your computer
# Enable WiFi debugging in developer settings of your device
# Disable USB debugging if it's already enabled
# Plug your device to computer via USB
# You may have to kill adb server
adb kill-server
adb tcpip 5555
@yrezgui
yrezgui / clients.json
Last active February 14, 2018 14:17
Redux Mock data
[
{
"id": 1,
"name": "Lucas"
},
{
"id": 2,
"name": "Jérôme"
},
{
import React, { Component } from 'react'
import classnames from 'classnames'
import TaskItem from './TaskItem'
import { addTask } from './actions/tasks-actions'
import { connect } from 'react-redux'
class TasksList extends Component {
constructor(props) {
super(props)
# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
export PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export NVM_DIR="/Users/yacinerezgui/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
export PATH=/opt/local/bin:/opt/local/sbin:${PATH}
export PS1="\W \$ "
{
"name": "Airline",
"created": "2017-04-24T12:12:47.665Z",
"intents": [
{
"intent": "book-flight",
"created": "2017-04-24T12:16:15.214Z",
"updated": "2017-04-24T12:16:15.214Z",
"examples": [
{