Skip to content

Instantly share code, notes, and snippets.

View Palatnyi's full-sized avatar
🐏
Out sick

Andrew Palatnyi

🐏
Out sick
View GitHub Profile
//alert for operator and drone
{
alertId: '123',
detections: [{
positions: [ {},{} ]
detectionType: 'remote'
detectionId: 9977
}, {
positions: [ {}, {} ]
const alwaysRespondWithHelloWorld: RequestHandler = (req: Request, res: Response) => {
req.user = {
name: 'Andrew',
surname: 'Palatnyi',
age: 27
};
res.send('hello world');
};
@Palatnyi
Palatnyi / server.ts
Last active January 12, 2020 13:40
server.ts
import express, { Application, RequestHandler, Request, Response } from "express";
const app: Application = express();
const alwaysRespondWithHelloWorld: RequestHandler = (req: Request, res: Response) => {
res.send('hello world');
};
app.use(alwaysRespondWithHelloWorld)
@Palatnyi
Palatnyi / index.ts
Created January 7, 2020 10:09
expressjs-extend-req-object
declare namespace Express {
export interface Request {
user: {
name: string,
surname: string,
age: number
}
}
}
import 'dart:async';
import 'dart:io';
import 'dart:isolate';
import 'package:random_string/random_string.dart';
Isolate isolate;
main() {
print("running dart program");
createNewIsolate();
class Store extends Component {
constructor(props) {
super(props);
this.rootUpdater = (data = {}) => {
this.setState({
...this.state,
...data
})
};
class User {
constructor(getState, rootUpdater) {
this._getState = getState;
this._rootUpdater = rootUpdater;
this.name = '';
this.surname = '';
}
_setValue = (value = {}) => {
class Store extends Component {
/*
a lot of methods here
*/
render() {
const updaters = {/*methods what*/};
const data = {/* this.state*/};
const value = {
import React, {Component, PureComponent, createContext} from 'react';
const Context = createContext();
class User {
constructor(getState, rootUpdater) {
this._getState = getState;
this._rootUpdater = rootUpdater;
this.name = '';
class App extends Component {
static childContextTypes = {
counter: PropTypes.object
}
constructor(props) {
super(props);
this.state = {
count: 0,
increment: this.increment