Skip to content

Instantly share code, notes, and snippets.

Open a terminal window and cd into a folder under the repository. Then:
git fsck | awk '{print $3}' > tmp.txt
cat tmp.txt | xargs git show > tmp2.txt
Now open tmp2.txt in editor, locate your lost code, and find the commit-id on top of it. Then apply the code:
git stash apply <commit id>
rm tmp.txt tmp2.txt
//
// Usage :
// recyclerView.setLayoutManager(new SmoothScrollingLayoutManager(getContext()));
// recyclerView.smoothScrollToPosition(0);
//
//
// SmoothScrollingLayoutManager
// Makersphere
//
@BenDLH
BenDLH / PaddingItemDecoration.java
Last active July 28, 2024 11:13
Item decoration to add padding vertically and horizontally to RecyclerViews using Linear and Grid layout managers.
//
// Created by Ben on 28/09/2016.
// Copyright (c) 2016 SHAPE A/S. All rights reserved.
//
public class PaddingItemDecoration extends RecyclerView.ItemDecoration {
private final Context _context;
private Resources _resources;
private Paint _paint = new Paint(Paint.ANTI_ALIAS_FLAG);
@BenDLH
BenDLH / CenteredTitleToolbar.java
Last active November 18, 2020 08:14
The Joy of Custom Views: How to make a centered title Toolbar in Android
//
// CenteredTitleToolbar
//
// Created by Ben De La Haye on 25/05/2016.
//
public class CenteredTitleToolbar extends Toolbar {
private TextView _titleTextView;
private int _screenWidth;
private boolean _centerTitle = true;