Skip to content

Instantly share code, notes, and snippets.

@nkt
nkt / Results.md
Last active Nov 29, 2021
ReactPHP vs Node.js
View Results.md

wrk -t4 -c400 -d10s http://127.0.0.1:1337/

PHP

Running 10s test @ http://127.0.0.1:1337/
  4 threads and 400 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     7.02ms    6.94ms  82.86ms   85.27%
View test.rst

```plantuml @startuml

Alice -> Bob: Authentication Request Bob --> Alice: Authentication Response

Alice -> Bob: Another authentication Request Alice <-- Bob: another authentication Response

@enduml ```

View test.md

before text

  • before item
  • to do
  • done
  • after item
  • test
  • [] test after text
@nkt
nkt / server.conf
Created Nov 5, 2015
Nginx configuration for separated frontend and backend endpoints
View server.conf
upstream example-webpack {
server 127.0.0.1:8080;
}
upstream example-backend {
server 127.0.0.1:3000;
}
server {
listen 80;
@nkt
nkt / provision.sh
Created Jul 18, 2015
Ubuntu provisioning for Docker
View provision.sh
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
sudo apt-get install wget -y
wget -qO- https://get.docker.com/ | sh
View RNPhoneInput.m
#import <React/RCTBridgeModule.h>
#import <React/RCTViewManager.h>
@interface RCT_EXTERN_MODULE(RNPhoneInputSwift, RCTViewManager)
RCT_EXPORT_VIEW_PROPERTY(value, NSString);
@end
@nkt
nkt / restify-joi-validation.js
Created May 17, 2015
Restify middleware for validation using Joi package
View restify-joi-validation.js
const {BadRequestError} = require('restify/lib/errors');
const Joi = require('joi');
module.exports = function validationPlugin() {
const fields = ['params', 'query', 'body'];
return function validationMiddleware(req, res, next) {
if (!req.route || !req.route.validate) {
return next();
}
View CallVideoStream.js
/**
* Copyright 2017 dialog LLC <info@dlg.im>
* @flow
*/
import React, { PureComponent } from 'react';
type Props = {
className: string,
stream: MediaSource
View animate.js
/*
* Copyright 2017 dialog LLC <info@dlg.im>
* @flow
*/
/* eslint no-mixed-operators:0 */
type Config = {
start: number,
end: number,