Skip to content

Instantly share code, notes, and snippets.

View yrezgui's full-sized avatar

Yacine Rezgui yrezgui

View GitHub Profile
@yrezgui
yrezgui / gist:c01f76f39e46b954aad1cc5dce34638a
Created August 2, 2024 13:46 — forked from levelsio/gist:5bc87fd1b1ffbf4a705047bebd9b4790
Secret of Monkey Island: Amsterdam (by @levelsio) or how to create your own ChatGPT image+text-based adventure game
# 2023-11-27 MIT LICENSE
Here's the open source version of my ChatGPT game MonkeyIslandAmsterdam.com.
It's an unofficial image+text-based adventure game edition of Monkey Island in Amsterdam, my home town.
Please use it however you want. It'd be nice to see more ChatGPT-based games appear from this. If you get inspired by it, please link back to my X https://x.com/levelsio or this Gist so more people can do the same!
Send me your ChatGPT text adventure game on X, I'd love to try it!
@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 / drive.js
Created August 12, 2012 16:27
Upload a file to Google Drive using their SDK and HTML5
var bb, reader;
var meta = {
"title": "mozilla.png",
"mimeType": "image/png",
"description": "Mozilla Official logo"
};
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://developer.mozilla.org/media/img/mdn-logo-sm.png', true);
@yrezgui
yrezgui / countries.yml
Created May 9, 2017 12:04
Hashmap of countries with name as key and iso code as value
Afghanistan: af
Albania: al
Algeria: dz
Andorra: ad
Angola: ao
Antigua and Barbuda: ag
Argentina: ar
Armenia: am
Aruba: aw
Australia: au
@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 / filesize-filter.js
Created May 26, 2013 18:22
This is a custom filter to show a bytes filesize in better way.
// add the filter to your application module
angular.module('myApp', ['filters']);
/**
* Filesize Filter
* @Param length, default is 0
* @return string
*/
angular.module('filters', [])
.filter('Filesize', function () {