Skip to content

Instantly share code, notes, and snippets.

View Pana's full-sized avatar
🎯
Focusing

Pana Pana

🎯
Focusing
View GitHub Profile
@justinpan0
justinpan0 / conflux-reason.js
Last active August 27, 2020 06:15
查询Conflux合约的"Error encountered during contract execution, or out of gas"失败原因
const request = require('request');
const { Conflux } = require("js-conflux-sdk");
const cfx = new Conflux({
url: "http://mainnet-jsonrpc.conflux-chain.org:12537"
});
function hex_to_ascii(str1) {
var hex = str1.toString();
var str = '';
for (var n = 0; n < hex.length; n += 2) {
@slavafomin
slavafomin / nodejs-custom-es6-errors.md
Last active May 12, 2025 03:50
Custom ES6 errors in Node.js

Here's how you could create custom error classes in Node.js using latest ES6 / ES2015 syntax.

I've tried to make it as lean and unobtrusive as possible.

Defining our own base class for errors

errors/AppError.js

@0mkara
0mkara / Ethereum_private_network.md
Last active March 30, 2025 21:48
Ethereum private network configuration guide.

Create your own Ethereum private network

Introduction

Used nodes:

Linux raspberrypi 4.9.41-v7+ #1023 SMP Tue Aug 8 16:00:15 BST 2017 armv7l GNU/Linux
Linux localhost.localdomain 4.14.5-200.fc26.x86_64 #1 SMP Mon Dec 11 16:29:08 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
@ygotthilf
ygotthilf / jwtRS256.sh
Last active May 12, 2025 12:07
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@justmoon
justmoon / custom-error.js
Last active November 19, 2024 02:40 — forked from subfuzion/error.md
Creating custom Error classes in Node.js
'use strict';
module.exports = function CustomError(message, extra) {
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = message;
this.extra = extra;
};
require('util').inherits(module.exports, Error);
@LeCoupa
LeCoupa / nodejs-cheatsheet.js
Last active February 27, 2025 20:09
Complete Node.js CheatSheet --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
/* *******************************************************************************************
* THE UPDATED VERSION IS AVAILABLE AT
* https://github.com/LeCoupa/awesome-cheatsheets
* ******************************************************************************************* */
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
# NPM CheatSheet.
# Super easy intall: npm comes with node now.
# To create your own npm package: https://www.npmjs.org/doc/misc/npm-developers.html
# More: https://www.npmjs.org/doc/
# 1. NPM Command Lines.
# Local mode is the default.
# Use --global or -g on any command to operate in global mode instead.
@airportyh
airportyh / jsconf_slides_codes_and_notes.md
Last active June 19, 2017 20:51
JSConf 2014 Slides, Codes and Notes.

JSConf Slides, Codes and Notes

These are all the JSConf 2014 slides, codes, and notes I was able to cull together from twitter. Thanks to the speakers who posted them and thanks to @chantastic for posting his wonderful notes.

Modular frontend with NPM - Jake Verbaten (@Raynos)

@jdx
jdx / boot.js
Last active August 11, 2024 13:00
zero-downtime node.js app runner
// This script will boot app.js with the number of workers
// specified in WORKER_COUNT.
//
// The master will respond to SIGHUP, which will trigger
// restarting all the workers and reloading the app.
var cluster = require('cluster');
var workerCount = process.env.WORKER_COUNT || 2;
// Defines what each worker needs to run
@rjz
rjz / nvcexploder-noderoad-pdx.md
Created March 21, 2014 02:48
Notes from Ben Acker's talk at #noderoad PDX

Ben Acker (@nvcexploder / Walmart) - Node in Production

  • Impetus: Walmart wanted a mobile presence. They built an application that looked like it was created by a giant retail operation--SOAP services, etc.
  • Started looking for other options: native apps,
  • Started with services team (worked on original app, spinning out to other mobile apps)--all of a sudden had loads of different clients consuming the services. Converting old soap/XML into something mobile-friendly?
  • High volume days (black Friday) start taking services down, and services team already distracted by mobile projects
  • Time to start building better services
  • Brought Eran Hammer over from Yahoo and gave him the go-ahead to use anything he wanted to improve mobile services. He chose node.
  • Walmart's been open-source from the start
  • But how to maintain legacy services?