Skip to content

Instantly share code, notes, and snippets.

View androidovshchik's full-sized avatar
😺

Vlad androidovshchik

😺
View GitHub Profile
@arriolac
arriolac / TopCropImageView.java
Last active October 1, 2024 10:40
Custom Android ImageView for top-crop scaling of the contained drawable.
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Matrix;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.ImageView;
/**
* Created by chris on 7/27/16.
@madan712
madan712 / ReadWriteExcelFile.java
Created October 18, 2012 14:35
Read / Write Excel file (.xls or .xlsx) using Apache POI
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
@lukehorvat
lukehorvat / NumberPickerDialogPreference.java
Last active June 17, 2021 14:06
An Android preference class that provides a user with the means to select an integer from a NumberPicker and persist it. (License: MIT License)
package com.lukehorvat;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Parcel;
import android.os.Parcelable;
import android.preference.DialogPreference;
import android.util.AttributeSet;
import android.view.View;
import android.widget.NumberPicker;
@fedir
fedir / google-font-dl.py
Last active January 30, 2024 05:20 — forked from kevinoid/google-font-dl.py
Script to download google fonts locally (for web development off-line, for example). Use : python getAllGoogleFonts.py Dosis
#!/usr/bin/env python
#
# Downloader for Google Web Fonts
#
# For usage information run with "--help"
#
# Works on Python 2.6 and later, 3 and later
# Requires tinycss (and argparse for Python 2.6) from pip
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@lukaszgrolik
lukaszgrolik / font-weights.md
Last active October 30, 2024 01:52
Commonly used names for CSS font-weight values

unknown source

value name
100 extralight/ultralight
200 light/thin
300 book/demi/light
400 regular/normal
500 medium
600 semibold/demibold

Static Site Generators

A Static Site Generator is a program, that generates an HTML website as an output. ThisHTML website is then served through your web server, just like the old’n’days. This is usually achieved using template languages and code that separates out the layout of the website from its content and styles.

Advantages of a Static Site Generator?

  • Security – There’s no database layer, or rails/pylons layer of code so security excellent.
  • Performance – Under load, less memory / cpu usage to serve your website, so your website stays up longer
  • Have a copy of your content separate from your server
  • Easily move your website to another host – Copy and paste the HTML and re-route the domain name should you have one.
@unrarp
unrarp / GridLineView.java
Created November 6, 2013 14:27
Custom Android view that divides its layout into a grid by drawing equally spaced lines both horizontally and vertically
package com.rahul.view;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;
public class GridLineView extends View {
@artem-zinnatullin
artem-zinnatullin / MyApp.java
Last active January 15, 2023 13:04
If you need to set one font for all TextViews in android application you can use this solution. It will override ALL TextView's typefaces, includes action bar and other standard components, but EditText's password font won't be overriden.
public class MyApp extends Application {
@Override
public void onCreate() {
TypefaceUtil.overrideFont(getApplicationContext(), "SERIF", "fonts/Roboto-Regular.ttf"); // font from assets: "assets/fonts/Roboto-Regular.ttf
}
}
package com.lukehorvat;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Parcel;
import android.os.Parcelable;
import android.preference.DialogPreference;
import android.util.AttributeSet;
import android.view.View;
import android.widget.NumberPicker;
@eeaslan
eeaslan / Arduino_Uno_Digital_Port_Control_SW.ino
Created May 6, 2014 06:08
This software is the Arduino Uno firmware of a project called "Arduino Uno Port Control". The aim of this project is to control the digital I/O pins of Arduino Uno from an Android device. The android app can be downloaded from Google Play Store.
byte lineEnding = 0x0A;
//Data array that the received info from android app is recorded. Every byte corresponds to a digital pin.
byte readBuffer[15]; //For example readBuffer[5] is for digital pin 5.
byte defaultByte = 0x10; //On start all arduino digital pins must be input for electrical protection.
//Pins 0 and 1 are used for serial comminations. So read
void setup() {
for (int i=0; i < sizeof(readBuffer)-1 ; ++i) {