This file contains 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
<?php defined('SYSPATH') or die('No direct script access.'); | |
/** | |
* Admin controller: | |
* | |
* @author | |
* @package | |
* @version | |
*/ | |
class Controller_Admin_Statistic extends Controller_Admin_Abstract |
This file contains 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
createCommand: function(name, runner) { | |
var commandTimeout = ref(settings, 'config.indexer.' + name + '.timeout'); | |
return new Command({ | |
name: name, | |
runner: runner, | |
url: baseAddress, | |
prepare: prepares.indexer, | |
ssl: sslOptions, | |
timeout: commandTimeout || backendTimeout, |
This file contains 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
// ES6 9.2.3.2 Function.prototype.bind(thisArg , ...args) | |
function FunctionBind(this_arg) { // Length is 1. | |
if (!IS_CALLABLE(this)) throw MakeTypeError(kFunctionBind); | |
var boundFunction = function () { | |
// Poison .arguments and .caller, but is otherwise not detectable. | |
"use strict"; | |
// This function must not use any object literals (Object, Array, RegExp), | |
// since the literals-array is being used to store the bound data. | |
if (!IS_UNDEFINED(new.target)) { | |
return %NewObjectFromBound(boundFunction); |
This file contains 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
const http2 = require('http2'); | |
const fs = require('fs'); | |
const url = require('url'); | |
const path = require('path'); | |
const options = { | |
key: fs.readFileSync('key.pem'), | |
cert: fs.readFileSync('cert.pem') | |
}; | |
const mimeType = { | |
'.ico': 'image/x-icon', |
This file contains 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
const server = http2.createSecureServer(options); | |
const commonCSS = fs.readFileSync('common.css'); | |
server.on('stream', (stream, headers) => { | |
console.log(`${headers[':method']} ${headers[':path']}`); | |
const parsedUrl = url.parse(headers[':path']); | |
let pathname = `.${parsedUrl.pathname}`; | |
const ext = path.parse(pathname).ext; | |
if (headers[':path'] === '/index.html') { | |
stream.pushStream({ ':path': 'common.css' }, |
This file contains 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
const cacheName = 'v1'; | |
this.addEventListener('install', function(event) { | |
event.waitUntil( | |
caches.open(cacheName).then(function(cache) { | |
return cache.addAll([ | |
'index.html', | |
'common.css' | |
].map(u => new Request(u, { credentials: 'include' }))) | |
}).then(()=> console.log('done')) | |
); |
This file contains 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
// Определяем состояние и методы для его обновления | |
class MobxState { | |
@observable items = [] | |
addItem (item) { | |
this.items.push(item) | |
} | |
} | |
// Компоненты | |
@observer | |
class Items extends Component { |
This file contains 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 ReduxState (state = Immutable.fromJS({items: []}), action) { | |
switch (actions.type) { | |
case 'addItem': | |
return state.push('items', action.item) | |
} | |
return state | |
} | |
// Компоненты | |
const Items = connect( |
This file contains 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
const controller = Controller({ | |
state: { | |
items: [] | |
}, | |
signals: { | |
itemAdded: push(state`items`, props`item`) | |
} | |
}) | |
// Компоненты | |
const Items = connect({ |
This file contains 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
@observer | |
class Items extends Component { | |
render() { | |
return ( | |
<div> | |
<ul> | |
{this.props.store.items.map((item) => <li>{item}</li>)} | |
</ul> | |
<button onClick={() => this.props.store.addItem('foo')}> | |
Add foo |
OlderNewer