Skip to content

Instantly share code, notes, and snippets.

View amorenew's full-sized avatar
🎯
Focusing

Amr Abd El Wahab El Desouky amorenew

🎯
Focusing
View GitHub Profile
@jdvp
jdvp / Utils.java
Created August 2, 2017 21:47
RxJava Fibonacci Sequence
public class Utils {
public static Observable<Integer> fibonacci(int f1, int f2) {
return Observable.range(1, 1).
repeat().
scan(new ArrayList<>(Arrays.asList(f1, f2)),
(list, tick) -> {
list.add(list.get(list.size() - 2) + list.get(list.size() - 1));
list.remove(0); //or else this becomes pretty memory inefficient eventually, right?
return list;
@garrettmac
garrettmac / example.js
Last active January 14, 2022 19:11
react native congressmen floating bubble heads example
import React, { Component } from 'react';
import { StyleSheet, View,Text, Image, Animated, Dimensions } from 'react-native';
import Interactable from 'react-native-interactable';
const widthFactor = Dimensions.get('window').width / 375;
const heightFactor = (Dimensions.get('window').height - 75) / 667;
const showSecondFace = true;
const showThirdFace = true;
const showFourthFace = true;
@TheReprator
TheReprator / CircleArcProgress
Last active July 28, 2017 02:31
Double Arc progressbar with text inside
package com.singh.daman.proprogressviews;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Typeface;
@aquaflamingo
aquaflamingo / deployApks.groovy
Last active May 13, 2019 18:25
Gradle task to archive APKs once built through android studio by running ./gradlew deployApks
task deployApks(type:Copy) {
description = "Copies APKs and Proguard mappings to the deploy directory"
def appName = "posture";
def versionDir = android.defaultConfig.versionName+"_"+android.defaultConfig.versionCode;
println("Copies APK and Proguard to " + versionDir)
from 'build/outputs/mapping/release/'
include '**/mapping.txt'
into '../.admin/deploy/' + versionDir
@faruktoptas
faruktoptas / KeyboardSensitiveRelativeLayout.java
Last active November 3, 2023 17:50
A layout that detects Soft Keyboard is visible or not.
public class KeyboardSensitiveRelativeLayout extends RelativeLayout {
private OnKeyboardShowHideListener listener;
public KeyboardSensitiveRelativeLayout(Context context) {
super(context);
}
public KeyboardSensitiveRelativeLayout(Context context, AttributeSet attrs) {
super(context, attrs);
@sheharyarn
sheharyarn / request.js
Last active August 24, 2023 14:55
Axios Request Wrapper for React (https://to.shyr.io/axios-requests)
/**
* Axios Request Wrapper
* ---------------------
*
* @author Sheharyar Naseer (@sheharyarn)
* @license MIT
*
*/
import axios from 'axios'
@jemshit
jemshit / BaseFragment.java
Created December 1, 2016 12:21
Do something when Fragment is visible
public class BaseFragment extends Fragment {
private boolean fragmentResume=false;
private boolean fragmentVisible=false;
private boolean fragmentOnCreated=false;
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
@alexsasharegan
alexsasharegan / .htaccess
Created September 7, 2016 00:36
Apache Config for React Router
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]
@vxhviet
vxhviet / matrixScaling.md
Last active June 14, 2022 10:04
Android scale bitmap with the highest quality

Source: StackOverflow

Question: How to scale Bitmap without losing much quality

Answer: Use Matrix instead of Bitmap.createScaledBitmap()

    /**
     * @param bitmap the Bitmap to be scaled
     * @param threshold the maxium dimension (either width or height) of the scaled bitmap
@munim
munim / youtube-dl-download-pluralsight.md
Last active July 28, 2022 21:19
youtube-dl to download pluralsight videos

Download Plural Sight videos

Software required:

youtube-dl

After installation and putting the youtube-dl in PATH

youtube-dl \