Skip to content

Instantly share code, notes, and snippets.

sajad sajadshokri

Block or report user

Report or block sajadshokri

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ScheduleRetrofitRxEasily
public static <T> Observable<T> schedule(Observable<T> observable) {
return observable
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}
View UsingRetrofitInterfaces
public static <T> T using(Class<T> aClass) {
if (!aClass.isInterface()) {
throw new IllegalArgumentException("API declarations must be interfaces.");
}
if (repository == null) {
repository = new NetworkRepo();
}
return repository.getRetrofit().create(aClass);
View GhostAdapterUsage.java
GhostAdapter ghostAdapter = new GhostAdapter();
recycler.setAdapter(ghostAdapter);
View TextItem.java
@BindItem(layout = R.layout.layout, holder = TextHolder.class)
public class TextItem {
@Binder
public void bind(TextHolder textHolder) {
}
}
View OldFashionedAdapter.java
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
RecyclerView.ViewHolder viewHolder;
LayoutInflater inflater = LayoutInflater.from(viewGroup.getContext());
switch (viewType) {
case USER:
View v1 = inflater.inflate(R.layout.layout_viewholder1, viewGroup, false);
viewHolder = new ViewHolder1(v1);
@sajadshokri
sajadshokri / workspace.sh
Created Jul 24, 2016
Change Unity desktop workspaces
View workspace.sh
#man:
# ./workspace.sh [horizontal size] [vertical size]
if [ "$1" -gt "0" ]; then
if [ "$1" -le "10" ]; then
dconf write /org/compiz/profiles/unity/plugins/core/hsize $1
fi
fi
if [ "$2" -gt "0" ]; then
if [ "$2" -le "10" ]; then
View numbers
/*
** numbers
** 1
** 121
** 12321
** 121
** 1
*/
#include <iostream>
You can’t perform that action at this time.