Skip to content

Instantly share code, notes, and snippets.

@tomconte
tomconte / web3-solc-contract-compile-deploy.js
Created December 13, 2016 09:32
Compiling and deploying an Ethereum Smart Contract, using solc and web3.
const fs = require('fs');
const solc = require('solc');
const Web3 = require('web3');
// Connect to local Ethereum node
const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
// Compile the source code
const input = fs.readFileSync('Token.sol');
const output = solc.compile(input.toString(), 1);
@boxgames1
boxgames1 / observable-pattern-pizza.js
Last active April 22, 2022 06:40
Observable pattern - Pizza Maker
const EventEmitter = require("events").EventEmitter;
class Pizza extends EventEmitter {
constructor(size = 1) {
super();
this.ovenTime = this._ovenTime(size);
this.maxIngredients = this._maxIngredients(size);
this.ingredients = [];
this.timeToReleasePizza = 5;
}
@Antoniozinchenko
Antoniozinchenko / config.lua
Last active September 19, 2024 13:57
Lunarvim configuration with flutter support
-- Read the docs: https://www.lunarvim.org/docs/configuration
-- Video Tutorials: https://www.youtube.com/watch?v=sFA9kX-Ud_c&list=PLhoH5vyxr6QqGu0i7tt_XoVK9v-KvZ3m6
-- Forum: https://www.reddit.com/r/lunarvim/
-- Discord: https://discord.com/invite/Xb9B4Ny
--
lvim.format_on_save.enabled = false
lvim.log.level = "warn"
lvim.colorscheme = "tokyonight-night"
vim.opt.relativenumber = true
@rubpy
rubpy / rpc_fetch_pump_token_price.ts
Created June 20, 2024 18:39
Fetching Pump.fun bonding curve state and calculating price of token/SOL.
import * as web3 from "@solana/web3.js";
//////////////////////////////////////////////////
function readBytes(buf: Buffer, offset: number, length: number): Buffer {
const end = offset + length;
if (buf.byteLength < end) throw new RangeError("range out of bounds");
return buf.subarray(offset, end);
}