Skip to content

Instantly share code, notes, and snippets.

View 1997roylee's full-sized avatar
💭
Coding

0xRoy 1997roylee

💭
Coding
View GitHub Profile
@MarkMurphy
MarkMurphy / README.md
Last active February 5, 2024 19:59
Cursor based pagination for Rails models.

Example Usage

Users

id name
1 Jane
2 Max
3 John
4 Scott
@diachedelic
diachedelic / deep-link-from-browser.js
Last active July 5, 2024 15:09
Deep link to a native app from a browser, with a fallback
@tomholford
tomholford / install_pg_gem.md
Last active June 13, 2024 06:43
Install postgresql gem `pg` on macOS

Installing pg gem on macOS

If you're trying to install the postgresql gem pg and it is failing with the following error message:

Installing pg 1.2.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: ~/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/pg-1.2.3/ext
~/.rbenv/versions/3.0.0/bin/ruby -I ~/.rbenv/versions/3.0.0/lib/ruby/3.0.0 -r ./siteconf20210125-97201-pycpo.rb extconf.rb
@endrsmar
endrsmar / index.ts
Created January 9, 2024 12:11
Raydium new pool listener
import { LiquidityPoolKeysV4, MARKET_STATE_LAYOUT_V3, Market, TOKEN_PROGRAM_ID } from "@raydium-io/raydium-sdk";
import { Connection, Logs, ParsedInnerInstruction, ParsedInstruction, ParsedTransactionWithMeta, PartiallyDecodedInstruction, PublicKey } from "@solana/web3.js";
const RPC_ENDPOINT = 'https://api.mainnet-beta.solana.com';
const RAYDIUM_POOL_V4_PROGRAM_ID = '675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8';
const SERUM_OPENBOOK_PROGRAM_ID = 'srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX';
const SOL_MINT = 'So11111111111111111111111111111111111111112';
const SOL_DECIMALS = 9;
const connection = new Connection(RPC_ENDPOINT);
@phijfry
phijfry / PointsDeposits.sol
Created February 16, 2024 17:37
points-deposits.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import { Ownable } from "@openzeppelin/contracts-0.6/access/Ownable.sol";
import { ERC20 } from "@openzeppelin/contracts-0.6/token/ERC20/ERC20.sol";
import { IERC20 } from "@openzeppelin/contracts-0.6/token/ERC20/IERC20.sol";
import { ERC721 } from "@openzeppelin/contracts-0.6/token/ERC721/ERC721.sol";
import { INonfungiblePositionManager } from "../nfp/INonfungiblePositionManager.sol";
import { INonfungiblePositionManagerStruct } from "../nfp/INonfungiblePositionManagerStruct.sol";