Skip to content

Instantly share code, notes, and snippets.

View 4xes's full-sized avatar

Alexey 4xes

  • Mail.Ru Group
  • Moscow
View GitHub Profile
@4xes
4xes / DmobiClient.java
Last active April 13, 2016 07:40
Answer for stackoverflow and change this code http://pastebin.com/HWedUNye
package in.dmoby;
import android.os.StrictMode;
import android.util.Log;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.entity.UrlEncodedFormEntity;
@4xes
4xes / install_bootable.sh
Last active March 15, 2016 14:23
Bootable
sudo /Applications/Install\ OS\ X\ El\ Capitan.app/Contents/Resources/createinstallmedia --volume /Volumes/Install\ OS\ X\ El\ Capitan/ --applicationpath /Applications/Install\ OS\ X\ El\ Capitan.app
@4xes
4xes / VisibleStates.java
Created February 5, 2016 09:30
Simple util for showing one android view and hide others
package svk.vk.market.base;
import android.os.Parcel;
import android.os.Parcelable;
import android.view.View;
import java.util.Collection;
public class VisibleStates implements Parcelable {
@4xes
4xes / tablayout.java
Created February 2, 2016 13:40
fix tablayout
if (ViewCompat.isLaidOut(mTabLayout)) {
mTabLayout.setupWithViewPager(mViewPager);
} else {
mTabLayout.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
mTabLayout.setupWithViewPager(mViewPager);
mTabLayout.removeOnLayoutChangeListener(this);
}
@4xes
4xes / tablayout.java
Created February 2, 2016 13:40
fix tablayout
if (ViewCompat.isLaidOut(mTabLayout)) {
mTabLayout.setupWithViewPager(mViewPager);
} else {
mTabLayout.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
mTabLayout.setupWithViewPager(mViewPager);
mTabLayout.removeOnLayoutChangeListener(this);
}
@4xes
4xes / log.text
Created March 18, 2015 11:35
Exception
03-18 14:29:29.314 8164-8164/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.google.android.GoogleCamera, PID: 8164
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.android.GoogleCamera/com.android.camera.CameraActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.android.camera.util.PhotoSphereHelper$PanoramaViewHelper.onStart()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
package com.petrushin.views;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.EditText;
import com.petrushin.tastyclub.R;
/**
@author Alexey Petrushin, 2014
*/
package com.petrushin.tastyclub.adapters;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
@4xes
4xes / gist:a530ad0a116f1508115a
Last active August 29, 2015 14:08
cheat votes
function getRandom(min, max)
{
return Math.random() * (max - min) + min;
}
var url = 'http://photo.missmiet.ru/rate.php';
var id_save = 2352;
var id_loser = 2255;
var id_winner = 2325;
var winner;
describe('api ', function(){
describe('GET /api/users', function(){
it('respond with an array of users')
})
})
describe('app', function(){
describe('GET /users', function(){
it('respond with an array of users')
})