Skip to content

Instantly share code, notes, and snippets.

View mirjalal's full-sized avatar
👨‍💻
Composing

Mirjalal mirjalal

👨‍💻
Composing
View GitHub Profile
@mirjalal
mirjalal / createWordDocAndSaveAsPDF.cs
Created August 11, 2016 07:29
Programmatically create Word document & save it as PDF document in C#
// before compiling the code please add the following library to your project references:
// Microsoft Word 15.0 Object Library
// in my case I'm using Office 2013 as well.
// then add following line to your program:
using Word = Microsoft.Office.Interop.Word;
// make sure Word was not opened
foreach (System.Diagnostics.Process item in System.Diagnostics.Process.GetProcesses())
{
@mirjalal
mirjalal / LabelledSpinner.java
Created January 2, 2017 21:21 — forked from paolorotolo/ LabelledSpinner.java
A Spinner component with a floating label for Android, similar to EditText components wrapped in a TextInputLayout.
/*
* Copyright 2015 Farbod Salamat-Zadeh
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@mirjalal
mirjalal / rds2redshift.sh
Created February 3, 2017 21:18 — forked from erincerys/rds2redshift.sh
Loads a MySQL data dump into a Redshift table. Useful for AWS RDS instances. Dependent on external script to stream MySQL data to file, and postgres psql command line client.
PYTHON_PATH=$(which python)
PSQL_PATH=$(which psql)
MYSQL_SCRIPT='mysql2file.py'
MYSQL_SERVER=
MYSQL_PORT=3306
MYSQL_DATABASE=
MYSQL_USER=
MYSQL_PASSWORD=
@mirjalal
mirjalal / robocopy.txt
Created March 4, 2017 19:14
How to use Robocopy tool in Windows
Problem:
The source file name(s) are larger than is supported by the file system. Try moving to a location which has a shorter path name, or try renaming to shorter name(s) before attempting this operation.
Solution:
1. Create a new empty folder, e.g. c:\empty
2. Then copy that empty folder onto the folder which contains the long filenames which you're trying to delete, e.g. c:\myannoyingfolder. Do this like so in the command prompt:
robocopy /MIR c:\empty c:\myannoyingfolder
@mirjalal
mirjalal / hexStr2Bin.java
Created April 10, 2017 16:37
Convert hex to binary
/**
* Converts hex string to byte array.
*
* @param hex hex string. if invalid, return null.
* @return binary data.
*/
private static byte[] hexStr2Bin(String hex) {
int sz = hex.length()/2;
byte[] b = new byte[hex.length()/2];
https://material.io/color/#!/?view.left=0&view.right=0&primary.color=1976D2&primary.text.color=ffffff
https://material.uplabs.com/posts/trello-app-on-boarding-redesign
https://material.uplabs.com/posts/search-close-icon-transition-freebie
https://material.uplabs.com/posts/zeta-onboarding-gif
https://material.uplabs.com/posts/free-music-player-ui
https://material.uplabs.com/posts/vertical-onboarding
https://material.uplabs.com/posts/user-onboarding-ui
https://material.uplabs.com/posts/app-onboarding-0ae1167c-319a-424e-9f5e-fc5432d4c812
https://material.uplabs.com/posts/my-contribution-to-uplabs-materialup-onboarding-ch
https://material.uplabs.com/posts/onboarding-or-walkthrough-screeen
http://alvinalexander.com/java/jwarehouse/apps-for-android/RingsExtended/src/com/example/android/rings_extended/
@mirjalal
mirjalal / OkHttpProgressGlideModule.java
Created June 28, 2017 08:05 — forked from TWiStErRob/OkHttpProgressGlideModule.java
Full POC for showing progress of loading in Glide v3 via OkHttp v2
// TODO add <meta-data android:value="GlideModule" android:name="....OkHttpProgressGlideModule" />
// TODO add <meta-data android:value="GlideModule" tools:node="remove" android:name="com.bumptech.glide.integration.okhttp.OkHttpGlideModule" />
// or not use 'okhttp@aar' in Gradle depdendencies
public class OkHttpProgressGlideModule implements GlideModule {
@Override public void applyOptions(Context context, GlideBuilder builder) { }
@Override public void registerComponents(Context context, Glide glide) {
OkHttpClient client = new OkHttpClient();
client.networkInterceptors().add(createInterceptor(new DispatchingProgressListener()));
glide.register(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(client));
}
@mirjalal
mirjalal / find_missing_translations.py
Created May 30, 2019 13:12 — forked from kmansoft/find_missing_translations.py
A simple script to find missing translations in an Android project
#!/usr/bin/python
'''
This script finds missing string translations in Android applicaitons.
Author: Kostya Vasilyev. License: Creative Commons Attribution.
The output format is, I believe, more suitable to working with external
translators than the output of Lint from the Android SDK.
@mirjalal
mirjalal / Activity Lifecycle States and Callbacks Summary.txt
Created June 4, 2019 07:39
Activity Lifecycle States and Callbacks Summary
General Definitions
Visible Lifecycle: The part of the Lifecycle between onStart and onStop when the Activity is visible.
Focus: An Activity is said to have focus when it's the activity the user can interact with.
Foreground: When the activity is on screen.
Background: When the activity is fully off screen, it is considered in the background.
Lifecycle States