Skip to content

Instantly share code, notes, and snippets.

View sagaratalatti's full-sized avatar
🏠
Working from home

Sagar Atalatti sagaratalatti

🏠
Working from home
  • India
View GitHub Profile
@sagaratalatti
sagaratalatti / FirebaseRecyclerAdapter.java
Created January 17, 2017 14:51
Firebase GeoFire Android RecyclerView
public abstract class FirebaseRecyclerAdapter<T, VH extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<VH > implements Filterable {
private static final String LOG_TAG = FirebaseRecyclerAdapter.class.getSimpleName();
private Query mRef;
private Class<T> mModelClass;
private int mLayout;
private LayoutInflater mInflater;
protected Class<VH> mViewHolderClass;
private List<T> mModels;
private List<T> mFilteredModels;
@sagaratalatti
sagaratalatti / AndroidManifest.xml
Created January 26, 2017 16:54 — forked from daichan4649/AndroidManifest.xml
show Fragment on LockScreen (for Android)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="daichan4649.lockoverlay"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="17" />
@sagaratalatti
sagaratalatti / Readme.md
Created March 26, 2017 08:23 — forked from gabrielemariotti/Readme.md
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example:

Keybase proof

I hereby claim:

  • I am sagaratalatti on github.
  • I am ibitcoinist (https://keybase.io/ibitcoinist) on keybase.
  • I have a public key ASBjsyJfcpPl9aBGsD6FgvXBBKPhyqLxJnez2kjhJi6FBwo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am sagaratalatti on github.
  • I am ibitcoinist (https://keybase.io/ibitcoinist) on keybase.
  • I have a public key ASBjsyJfcpPl9aBGsD6FgvXBBKPhyqLxJnez2kjhJi6FBwo

To claim this, I am signing this object:

@sagaratalatti
sagaratalatti / Address.sol
Created May 13, 2021 13:22
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.6.12+commit.27d51765.js&optimize=false&runs=200&gist=
pragma solidity ^0.6.12;
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
@sagaratalatti
sagaratalatti / Address.sol
Created May 13, 2021 13:23
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.6.12+commit.27d51765.js&optimize=false&runs=200&gist=
pragma solidity ^0.6.12;
// SPDX-License-Identifier: Unlicensed
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly { codehash := extcodehash(account) }
@sagaratalatti
sagaratalatti / Safecum.sol
Created June 5, 2021 10:52
Safecum Protocol is a decentralized finance (DeFi) token. Safecum has three functions that take place during each trade: Reflection, LP Acquisition and Burn
pragma solidity ^0.6.12;
// SPDX-License-Identifier: Unlicensed
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
@sagaratalatti
sagaratalatti / Partners.sol
Last active June 8, 2022 10:46
Partnership Smartcontract
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.6;
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to