This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const backend = { | |
| echo: async (message: string) => message, | |
| }; | |
| export type Backend = typeof backend; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type PrefixParser = (prefix?: string) => string; | |
| interface RoutePrefixSettings { | |
| parse: PrefixParser; | |
| defaultPrefix: string; | |
| } | |
| interface RoutePrefixConsumerProps { | |
| routePath: (path: string) => string; | |
| linkPath: (path: string) => string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as React from 'react'; | |
| import { DocumentNode } from 'graphql'; | |
| import { graphql as _graphql, OperationOption } from 'react-apollo'; | |
| type CompositeComponent<P> = | |
| | React.ComponentClass<P> | |
| | React.StatelessComponent<P>; | |
| interface InferableComponentDecorator<TOwnProps> { | |
| <T extends CompositeComponent<TOwnProps>>(component: T): T; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import fortune from 'fortune'; | |
| import fortuneJSONApi from 'fortune-json-api'; | |
| import extend from './fortune-serializer-middleware'; | |
| import Scope from './fortune-serializer-scope'; | |
| import defineTypes from './define-types'; | |
| const scope = new Scope(); | |
| function api(Serializer) { | |
| const ApiSerializer = fortuneJSONApi(Serializer); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.get('/', function(req, res, next) { | |
| if (typeof req.body.foo !== 'boolean') { | |
| return next (new TypeError()); | |
| } | |
| next() | |
| }, function(req, res, next) { | |
| mysql.query('select 1', function(err, result) { | |
| if (err) { return next(err); } | |
| res.send(result); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>fileTypes</key> | |
| <array> | |
| <string>html</string> | |
| </array> | |
| <key>name</key> | |
| <string>HTML (Angular)</string> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Update user by manager | |
| router.put('/users/:id') | |
| .use(access.perm('manager')) | |
| .use(schema.validate({ | |
| type: 'object', | |
| properties: { | |
| password: { | |
| type: 'string', | |
| minLength: 6, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.use( | |
| // меняет токен на user | |
| // создает в req объект user: | |
| // req.user = { id: 1, roles: [...] } | |
| exchangePassportToken | |
| ) | |
| app | |
| .put('/users/:uid') | |
| .use(roles('manager')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Promise = require('bluebird'); | |
| var fs = require('fs'); | |
| var util = require('util'); | |
| var memwatch = require('/usr/lib/node_modules/memwatch'); | |
| var prReadFile = Promise.promisify(fs.readFile); | |
| var _ = require('lodash'); | |
| console.log(process.pid); | |
| show('start memory:'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function initA(cb) { | |
| setTimeout(function() { | |
| var a = 1; | |
| cb(a); | |
| }, Math.random() * 3000); | |
| } | |
| function initB(cb) { | |
| setTimeout(function() { |
NewerOlder