Skip to content

Instantly share code, notes, and snippets.

@egslava
egslava / WrapContentHeightViewPager.java
Created Aug 12, 2014
Wrap content height ViewPager (Android)
View WrapContentHeightViewPager.java
package org.cnii.layoutloader.ui;
import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.View;
/**
* Special thanks to Daniel López Lacalle for his response
* (http://stackoverflow.com/questions/8394681/android-i-am-unable-to-have-viewpager-wrap-content/20784791#20784791)
@egslava
egslava / .gitignore
Created Oct 18, 2014
.gitignore for Android Studio (Gradle) projects
View .gitignore
##### Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm #####
##### (thanks to https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore) #####
/*.iml
## Directory-based project format:
.idea/
# if you remove the above rule, at least ignore the following:
# User-specific stuff:
@egslava
egslava / CMakeLists.txt
Created Feb 14, 2019
CMake: add_custom_command OUTPUT support for generator expressions
View CMakeLists.txt
function (add_custom_sources)
set(options VERBATIM)
set(oneValueArgs TARGET OUTPUT)
set(multiValueArgs DEPENDS COMMAND)
# Problem
# -------
# CMake doesn't support generator expressions for OUTPUT directories.
# Thus, it's not gonna work:
# add_custom_command(
@egslava
egslava / keras-embedding.py
Created Apr 1, 2018
Keras Embedding explanation (in a benchmark form)
View keras-embedding.py
"""
Created on Fri Mar 30 17:23:45 2018
Embeds one-hot encoder vector
i.e. [0] -> [1 0 0 0], [1] -> [0 1 0 0], [2] -> [0 0 1 0], so on
Using three approaches:
1. Keras `Embedding` layer
2. Keras `Dense` layer
3. TensorFlow matmul
You can’t perform that action at this time.