Skip to content

Instantly share code, notes, and snippets.

@Abdallah-Abdelazim
Abdallah-Abdelazim / drawablegen.sh
Last active November 30, 2023 22:16 — forked from Kishanjvaghela/converter.sh
drawablegen - A shell script to resize icon images and generate the alternative drawables with the proper screen pixel densities (dip) for Android.
#!/bin/sh
# A shell script to resize icon images and generate the alternative drawables with the proper screen pixel densities (dip) for Android.
# The passed icon image would be the xxxhdpi drawable & the other drawables (xxhdpi, xhdpi, hdpi & mdpi) would be scaled down from that.
# How to use:
# ./drawablegen.sh <icon image file relative path>
# Example:
# ./drawablegen.sh my_image.png
# This will create all the drawable folders, if not has already, in a res folder inside the current directory (as returned by pwd).
# Use only with PNG images.
# Requires ImageMagick to be installed & added to the path environment variable. Install with: sudo apt install imagemagick
@ikayz
ikayz / temp_fix.js
Last active April 22, 2022 06:39
React Native Metro Bundler Closing After Starting App
// Copy the code below and replace in [project_name]\node_modules\metro-config\src\defaults\blacklist.js
// Solution by https://github.com/tusharojha
// Note you'd have to do this for every project
var sharedBlacklist = [
/node_modules[\/\\]react[\/\\]dist[\/\\].*/,
/website\/node_modules\/.*/,
/heapCapture\/bundle.js /,
/.*\/__tests__\/.*/
]
@oneWaveAdrian
oneWaveAdrian / converter.sh
Last active November 8, 2020 15:14 — forked from Kishanjvaghela/converter.sh
Create Image drawable for all resolutions
if [ $# -eq 0 ]; then
echo "No arguments supplied"
else if [ -f "$1" ]; then
echo " Creating different dimensions (dips) of "$1" ..."
mkdir -p drawable-xxxhdpi
mkdir -p drawable-xxhdpi
mkdir -p drawable-xhdpi
mkdir -p drawable-hdpi
mkdir -p drawable-mdpi
mkdir -p drawable-ldpi
import React from 'react';
import useFriendStatus from './useFriendStatus';
export default function FriendListItem(props) {
const isOnline = useFriendStatus(props.friend.id);
return (
<li style={{ color: isOnline ? 'green' : 'black' }}>
{props.friend.name}
</li>
@sturmenta
sturmenta / firestore2json.js
Last active October 28, 2022 19:03
firestore to json & json to firestore
const admin = require('firebase-admin');
const fs = require('fs');
const serviceAccount = require('../../../../../../Private/myschool-data_transfer-key.json');
admin.initializeApp({ credential: admin.credential.cert(serviceAccount) });
const schema = require('./schema').schema;
const firestore2json = (db, schema, current) => {
pragma solidity ^0.4.10;
import './SafeMath.sol';
interface ERC20 {
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
@Kishanjvaghela
Kishanjvaghela / opacity.txt
Created December 8, 2017 09:00 — forked from alvinthen/opacity.txt
Convert opacity values in percentage to hexadecimal
0% - 00
1% - 03
2% - 05
3% - 08
4% - 0A
5% - 0D
6% - 0F
7% - 12
8% - 14
9% - 17
@Kishanjvaghela
Kishanjvaghela / ExamplePeopleAdapter.java
Last active January 14, 2021 03:02
Custom Filterable FirebaseRecyclerAdapter
import android.databinding.DataBindingUtil;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.app.wanna.android.R;
import com.app.wanna.android.data.User;
import com.app.wanna.android.databinding.LayoutItemPeopleBinding;
import com.app.wanna.android.utils.firebaseadapter.FirebaseRecyclerAdapter;
@itmammoth
itmammoth / start_emulator.sh
Last active September 21, 2020 07:33
Start an android emulator with changing DNS server to Google public DNS
#!/bin/bash
EMULATOR=~/Library/Android/sdk/tools/emulator
if [ $# -ne 1 ]; then
echo "ERROR: Please specify the target AVD from the list below" 1>&2
$EMULATOR -list-avds 1>&2
exit 1
fi
$EMULATOR -avd $1 -dns-server "8.8.8.8,8.8.4.4"
@Kishanjvaghela
Kishanjvaghela / converter.sh
Last active November 17, 2022 11:26
Create Image drawable for all resolutions
if [ $# -eq 0 ]; then
echo "No arguments supplied"
else if [ -f "$1" ]; then
echo " Creating different dimensions (dips) of "$1" ..."
mkdir -p drawable-xxhdpi
mkdir -p drawable-xhdpi
mkdir -p drawable-hdpi
mkdir -p drawable-mdpi
if [ $1 = "ic_launcher.png" ]; then