Skip to content

Instantly share code, notes, and snippets.

View ggface's full-sized avatar
🏠
Working from home

Ivan Novikov ggface

🏠
Working from home
View GitHub Profile
@ggface
ggface / README.md
Created January 26, 2021 19:18 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

package io.totalcoin.ui.widget.currencylistview;
import android.app.Activity;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.util.Pair;
import android.support.v7.widget.GridLayoutManager;
public static void executeMultipartPost(String url, String imgPath, String field1, String field2){
try {
HttpClient client = new DefaultHttpClient();
HttpPost poster = new HttpPost(url);
File image = new File(imgPath); //get the actual file from the device
MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
entity.addPart("field1", new StringBody(field1));
entity.addPart("field2", new StringBody(field2));
entity.addPart("image", new FileBody(image));
// formatting numbers
// => "1.2"
String.format("%s", new DecimalFormat("#.##").format(1.2))
// => "1.20"
String.format("%.2f", 1.2)
@ggface
ggface / gist:9e59d60f5c512239328e
Created October 27, 2014 09:44
Generate keystore
keytool -genkey -alias myKey -keystore store.jks
keytool -selfcert -alias myKey -keystore store.jks
keytool -list -v -keystore store.jks
go to https://console.developers.google.com
PROFIT
@ggface
ggface / gist:d683d0011e221bea9a78
Created October 10, 2014 12:21
Dialog position
final Dialog dialog = new Dialog(this);
Window window = dialog.getWindow();
window.setGravity(Gravity.CENTER);
window.setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
dialog.setTitle(null);
dialog.setContentView(R.layout.selectpic_dialog);
dialog.setCancelable(true);
@ggface
ggface / eclipse.ini
Created May 8, 2014 05:12
Eclipse settings
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20140224-1459.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20140303-1747
-product
org.eclipse.epp.package.standard.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
@ggface
ggface / ExampleOne.java
Created December 10, 2013 09:36
Java singleton #1
public class ExampleOne {
public static final ExampleOne INSTANCE = new ExampleOne();
public String getText() {
return "Sample text.";
}
}
@ggface
ggface / gist:6374439
Created August 29, 2013 05:02
Отображение километража. Три знака после запятой.
, REPLACE(ltrim(str([BEGKM],200,3)),'.',',') AS [BEGKM]
, REPLACE(ltrim(str([ENDKM],200,3)),'.',',') AS [ENDKM]
PROFIT
@ggface
ggface / gist:5882825
Created June 28, 2013 06:20
Проверка на регистр
SELECT [LOGIN] FROM [D_USER] WHERE [LOGIN]= @lParam COLLATE Latin1_General_CS_AS