Skip to content

Instantly share code, notes, and snippets.

@PavelPolyakov
PavelPolyakov / index.js
Created November 24, 2015 16:55
module.exports overwrite
require('./rand')()();
require('./rand')()();
require('./rand')()();
require('./rand')()();
require('./rand')()();
require('./rand')()();
require('./rand')()();
@PavelPolyakov
PavelPolyakov / javascript-credit-app-prototype.md
Last active January 24, 2019 05:40
javascript-credit-app-prototype.md

You need to design and prototype a simple project (source code) which serves the process of a customer applying the credit.

The process consists from next steps:

  1. A customer comes to the decision engine in order to apply for the credit. To apply for the credit the next information should be passed:
    • firstname
    • lastname
    • id number
    • amount applied
  2. Decision engine starts from the scoring process. Depending on the results it decides what type of a credit customer can receive.
const Web3 = require('web3');
const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
const lightwallet = require('eth-lightwallet');
const {txutils, signing} = lightwallet;
const fs = require('fs');
const Tx = require('ethereumjs-tx');
const Web3 = require('web3');
const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
const lightwallet = require('eth-lightwallet');
const {txutils, signing} = lightwallet;
const fs = require('fs');
const Tx = require('ethereumjs-tx');
const webpack = require('webpack');
const paths = require('./paths');
var autoprefixer = require('autoprefixer');
module.exports = function (storybookBaseConfig, configType) {
storybookBaseConfig.module.rules.push(...[
{
include: paths.appStory,
@PavelPolyakov
PavelPolyakov / create-wallet.js
Last active June 19, 2017 17:23
testrpc@beta transaction
const lightwallet = require('eth-lightwallet');
const fs = require('fs');
const Promise = require('bluebird');
var password = 'hello';
// You can change this to your seed
var seed = 'unhappy nerve cancel reject october fix vital pulse cash behind curious bicycle';
console.log('====================');
mkdir my-project-ts
cd my-project-ts
npm init -y
npx gitignore node
npm i typescript fastify fastify-plugin ts-node fastify-blipp
{
"compilerOptions": {
"baseUrl": ".",
"lib": ["es2016"],
"paths": {
"*": ["src/*"]
},
"allowJs": true,
"target": "es2016",
"module": "commonjs",
import * as fastify from "fastify";
import * as fastifyBlipp from "fastify-blipp";
import { Server, IncomingMessage, ServerResponse } from "http";
import statusRoutes from "./modules/routes/status";
const server: fastify.FastifyInstance<
Server,
IncomingMessage,
ServerResponse
> = fastify();
import * as fp from "fastify-plugin";
export default fp(async (server, opts, next) => {
server.route({
url: "/status",
logLevel: "warn",
method: ["GET", "HEAD"],
handler: async (request, reply) => {
return reply.send({ date: new Date(), works: true });
}