Skip to content

Instantly share code, notes, and snippets.

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

Mirjalal mirjalal

👨‍💻
Composing
View GitHub Profile
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
@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];
@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 / 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 / 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 / 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 / ScreenCapture.cs
Created June 29, 2016 08:33
Capture the screen
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace ss
{
@mirjalal
mirjalal / main-lang-by-country.json
Created May 9, 2016 15:46 — forked from arikw/main-lang-by-country.json
A single main language per country. Useful when a fallback language is needed for web visitors. The country can be extracted from their ip (e.g., using maxmind).
{
"af": {
"countryName": "Afghanistan",
"langName": "Pashto",
"countryCodes": {
"iso3166_1": "af",
"GEC": "af"
},
"langCodes": {
"iso639_1": "ps"
@mirjalal
mirjalal / example-user.js
Created March 20, 2016 16:28 — forked from nijikokun/example-user.js
Beautiful Validation... Why have I never thought of this before?!
var user = {
validateCredentials: function (username, password) {
return (
(!(username += '') || username === '') ? { error: "No Username Given.", field: 'name' }
: (!(username += '') || password === '') ? { error: "No Password Given.", field: 'pass' }
: (username.length < 3) ? { error: "Username is less than 3 Characters.", field: 'name' }
: (password.length < 4) ? { error: "Password is less than 4 Characters.", field: 'pass' }
: (!/^([a-z0-9_-]+)$/i.test(username)) ? { error: "Username contains invalid characters.", field: 'name' }
: false
);
@mirjalal
mirjalal / Mail.java
Created February 2, 2016 17:07
Class for sending mail without using built-in applications in android [working]
import java.util.Date;
import java.util.Properties;
import javax.activation.CommandMap;
import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.activation.FileDataSource;
import javax.activation.MailcapCommandMap;
import javax.mail.BodyPart;
import javax.mail.MessagingException;
import javax.mail.Multipart;