Skip to content

Instantly share code, notes, and snippets.

View pizza_stores.cpp
[{"id":2060,"name":"Pizza Dracula","street":"Turystyczna","number":"2","plz":"31-213","telephone":"124312668","email":"zprzewoznik@interia.pl","locationName":"Kraków","locationId":9454,"stateId":6,"status":0,"isOnline":1,"isnew":false,"paymentbar":1,"preorder":"day","url":"pizza-dracula-krakow","onlycash":0,"specialComment":"Polaczenie uszkodzone, przlaczam na dyktowane","imageUrl":"https://image.yourdelivery.de/pyszne.pl/service/2060/Pizza+Dracula-0-0.jpg","ratingCount":1199,"ratingAdviceCount":1137,"ratingAverage":4.62,"tags":"Dania rybne, Dania z grilla, Pizza","openings":[{"from":"10:00","until":"22:30","day":0},{"from":"10:00","until":"22:30","day":1},{"from":"10:00","until":"22:30","day":2},{"from":"10:00","until":"22:30","day":3},{"from":"10:00","until":"22:30","day":4},{"from":"10:00","until":"22:30","day":5},{"from":"10:00","until":"22:30","day":6}],"openingSpecial":{},"mealTypes":null,"restaurantCategory":"Włoska","franchiseTypeId":1,"franchiseType":"normal","holidays":null,"sms":true,"favouriteCoun
@Marchuck
Marchuck / Loop.java
Created Aug 3, 2015
how to invoke the same method in a loop
View Loop.java
public class Loop {
private static boolean isStarted = false;
private static Handler handler = new Handler();
private static ConcreteActivity activity;
public static boolean isActive = true;
private static Runnable stepTimer = new Runnable() {
@Override
View links.h
@Marchuck
Marchuck / Splitter.java
Created Aug 8, 2015
Get query value used with observables response.getUrl() extracter
View Splitter.java
String getQuery(String url, String field){
String[] divider = url.split(field+"=");
String[] spliter = divider[1].split("&");
return spliter[0];
}
View servis.java
package pl.sointeractive.smartcity.service;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.support.annotation.NonNull;
import android.support.design.widget.Snackbar;
import android.util.Log;
import android.view.View;
@Marchuck
Marchuck / marquee.java
Last active Sep 4, 2015
horyzontalna markiza MarqueeTextView needs textView.setSelected(true) at onBindViewHolder()
View marquee.java
<TextView
android:id="@+id/draggable_list_swipe_item_stops_stop_name_data"
android:layout_width="100sp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/fragment_timetable_padding"
android:layout_marginTop="@dimen/fragment_text_margin"
android:text="@string/draggable_list_item_stops_stop_name"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#e0000000"
android:singleLine="true"
@Marchuck
Marchuck / compiles.c
Last active Sep 26, 2015
gradle essentials
View compiles.c
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.1'
compile 'com.android.support:support-annotations:23.0.1'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'io.reactivex:rxandroid:0.25.0'
compile 'io.reactivex:rxjava:1.0.10'
compile 'io.reactivex:rxjava-math:0.21.0'
View HashCodeUniversal.java
@Override
public int hashCode(){
int result = 17;
result = 31 * result + someBoolean ? 1:0;
result = 31 * result + someByte;
result = 31 * result + someChar;
result = 31 * result + someShort;
result = 31 * result + someInt;
result = 31 * result + someLong ^ someLong >>> 32 ;
result = 31 * result + Float.floatToIntBits(someFloat);
@Marchuck
Marchuck / Deserializer.java
Created Oct 4, 2015
Generic deserializers with Retrofit & rxJava
View Deserializer.java
public abstract class Deserializer<T> implements JsonDeserializer<T> {
public abstract Class<T> setDestinationClass();
@Override
public T deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
Log.d("Deserializer", "deserialize json: " + json);
return new Gson().fromJson(json, setDestinationClass());
}
View Request.java
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
public class Request{
public void post(String data){