Skip to content

Instantly share code, notes, and snippets.

View sajadshokri's full-sized avatar
🦖

Sajad Shokri sajadshokri

🦖
View GitHub Profile
/*
** numbers
** 1
** 121
** 12321
** 121
** 1
*/
#include <iostream>
@sajadshokri
sajadshokri / workspace.sh
Created July 24, 2016 19:54
Change Unity desktop workspaces
#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
@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);
@BindItem(layout = R.layout.layout, holder = TextHolder.class)
public class TextItem {
@Binder
public void bind(TextHolder textHolder) {
}
}
GhostAdapter ghostAdapter = new GhostAdapter();
recycler.setAdapter(ghostAdapter);
ghostAdapter.addItem(new TextItem());
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);
public static <T> Observable<T> schedule(Observable<T> observable) {
return observable
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}