Skip to content

Instantly share code, notes, and snippets.

View ohmrefresh's full-sized avatar

Ohm ohmrefresh

  • Bangkok, Thailand
View GitHub Profile
@ohmrefresh
ohmrefresh / gist:55149f68c41a148ae673
Created April 30, 2014 02:52
How to Server-side verification of Google Play subscriptions
1.create google app (google console)
Example:
Client ID xxx.apps.googleusercontent.com
Email address [email protected]
Client secret xxx
Redirect URIs
https://localhost/oauth2callback
Javascript Origins
https://localhost
@ohmrefresh
ohmrefresh / TopCropImageView.java
Last active August 29, 2015 14:03
TopCropImageView
import android.content.Context;
import android.graphics.Matrix;
import android.util.AttributeSet;
import android.widget.ImageView;
public class TopCropImageView extends ImageView {
public TopCropImageView(Context context, AttributeSet attrs) {
super(context, attrs);
setScaleType(ScaleType.MATRIX);
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.ImageView;
public class ScalableImageView extends ImageView {
public boolean isMeasured = true;
public ScalableImageView(Context context) {
super(context);
@ohmrefresh
ohmrefresh / gist:85328554cb3cd7b6a6f5
Created September 30, 2014 03:46
Fix Composer Update[Cannot allocate memory]
PHP Fatal error: Uncaught exception 'ErrorException' with message 'proc_open(): fork failed - Cannot allocate memory
1.Delete composer cache:
sudo rm -R ~/.composer
2.Delete vendor folder:
sudo rm -R vendor
3.Rebuild the vendor packages:
composer update
@ohmrefresh
ohmrefresh / gist:5440c598fa95e77bb2f1
Created October 6, 2014 10:50
CSS Max line in DIV
.text {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
line-height: 16px;
max-height: 32px;
-webkit-line-clamp: 2; /* number of lines to show */
-webkit-box-orient: vertical;
}
@ohmrefresh
ohmrefresh / gist:ddd8e2e9f662e6cbf33e
Created October 16, 2014 08:09
Drawable Backgroud Android [exclude Left Border]
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape
android:shape="rectangle">
<stroke android:width="1dp" android:color="#FF000000" />
<solid android:color="#FFFFFF" />
</shape>
</item>
@ohmrefresh
ohmrefresh / gist:a415dcc7bd1fd38506ca
Created November 10, 2014 03:28
[Solve] unknown architecture armv5
./compile-ffmpeg.sh all
====================
[*] check archs
====================
FF_ALL_ARCHS = armv5 armv7a x86
====================
[*] check env armv5
====================
NDKr10c (64-bit) detected
@ohmrefresh
ohmrefresh / gist:eec95a19e22a6adc9b48
Created January 30, 2015 04:03
Nginx & Laravel
apt-get install nginx php5-fpm php5-cli php5-mcrypt git
mkdir /var/www
mkdir /var/www/laravel
nano /etc/nginx/sites-available/default
------------------------------------------------------------------------
server {
listen 80 default_server;
@ohmrefresh
ohmrefresh / WekaEvaluationAndroid
Last active August 29, 2015 14:21
Weka Evaluation Classify #RandomForest #Android
InputStream is =getResources().openRawResource(R.raw.r4_reference); //arff
BufferedReader datafile = new BufferedReader(new InputStreamReader(is));
try {
Instances m_Training = new Instances(datafile);
m_Training.setClassIndex(m_Training.numAttributes() - 1);
Filter m_Filter = ((Filter)Class.forName("weka.filters.unsupervised.instance.Randomize").newInstance());
m_Filter.setInputFormat(m_Training);
Instances localInstances = Filter.useFilter(m_Training, m_Filter);
Classifier m_Classifier = Classifier.forName("weka.classifiers.trees.RandomForest", null);
m_Classifier.buildClassifier(localInstances);
@ohmrefresh
ohmrefresh / AttTest
Last active August 29, 2015 14:21
Create ARFF File
import java.io.File;
import weka.core.Attribute;
import weka.core.FastVector;
import weka.core.Instance;
import weka.core.Instances;
import weka.core.converters.ArffSaver;
import weka.filters.Filter;
import weka.filters.unsupervised.instance.NonSparseToSparse;