Skip to content

Instantly share code, notes, and snippets.

View ajays97's full-sized avatar
🌎
Ethereum FTW! Period.

Ajay Srinivas ajays97

🌎
Ethereum FTW! Period.
View GitHub Profile
@ajays97
ajays97 / FindPath.ts
Created March 21, 2023 09:23
Find paths to consume all tickets
const data: Record<string, Set<string>> = {
MUM: new Set(['CHEN']),
BLR: new Set(['JAI']),
DEL: new Set(['BLR', 'AGRA']),
JAI: new Set(['MUM']),
AGRA: new Set(['DEL'])
};
function findStart(data: Record<string, Set<string>>) {
const source: Record<string, number> = {};
@ajays97
ajays97 / DAOLaunchPad.sol
Created December 5, 2022 16:01
DAO LaunchPad Solidity 0.8.0
pragma solidity ^0.8.0;
contract DAOLaunchpad {
// the name of the launchpad
string public name;
// the address of the owner of the launchpad
address public owner;
// the mapping of members of the launchpad
@ajays97
ajays97 / DAOLaunchPad.sol
Created December 5, 2022 16:00
DAOLaunchPad Solidity 0.5.0
pragma solidity ^0.5.0;
contract DAOLaunchpad {
// the name of the launchpad
string public name;
// the address of the owner of the launchpad
address public owner;
// the mapping to track which addresses are members of the launchpad
@ajays97
ajays97 / LaunchpadDAO.sol
Created December 5, 2022 15:22
Solidity Smart Contract to manage a DAO
pragma solidity ^0.8.0;
contract LaunchpadDAO {
// The address of the owner of this contract
address public owner;
// The list of projects currently managed by this DAO
Project[] public projects;
// The struct representing a project
@ajays97
ajays97 / PublishBulkNFTS.sol
Created December 5, 2022 15:02
Solidity Smart Contract to publish Bulk NFTs
pragma solidity ^0.5.0;
// ERC-721 token interface
interface IERC721 {
function totalSupply() external view returns (uint256);
function balanceOf(address _owner) external view returns (uint256);
function ownerOf(uint256 _tokenId) external view returns (address);
function safeTransferFrom(address _from, address _to, uint256 _tokenId) external payable;
function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes memory _data) external payable;
function approve(address _approved, uint256 _tokenId) external payable;
@ajays97
ajays97 / gist:d20f9a96d517900b72bba70a90b9a16d
Created October 13, 2022 11:17 — forked from carlos8f/gist:b09a734cf626ffb9bb3bcb1ca35f3db4
zenbot sim result, BTC-USD, 90 days, 195.45% profit, 61.06% over buy/hold
2017-05-11 16:00:00 1832.97 USD -0.06% 619.75 + 0.0447 null 1.91% 0.031060 BTC 2897.41 USD 195.43% +61.48%
{ days: 90,
profit_stop_enable_pct: 10,
profit_stop_pct: 1,
sell_rate: -0.006,
trend_ema: 36,
period: '1h',
strategy: 'trend_ema_rate',
sell_stop_pct: 4,
buy_stop_pct: 0,
@ajays97
ajays97 / memorySizeOfObject.js
Created January 21, 2020 10:27
calculate memory size of javascript object, it is not a accurate value!
function memorySizeOf(obj) {
var bytes = 0;
function sizeOf(obj) {
if(obj !== null && obj !== undefined) {
switch(typeof obj) {
case 'number':
bytes += 8;
break;
case 'string':
@ajays97
ajays97 / ios_setup.js
Created July 10, 2019 07:45
React Native Facebook SDK setup script for iOS Configuration
/*
Copyright 2004-present Facebook. All Rights Reserved.
A node script to help set up FBSDK frameworks for use with https://github.com/facebook/react-native-fbsdk
after you have already run `rnpm install react-native-fbsdk`.
Note that you need to create a Facebook App in https://developers.facebook.com/
and get the Facebook APP ID and Facebook APP Name in order to set up the Info.plist.
Usage: