hexsha
string
size
int64
ext
string
lang
string
max_stars_repo_path
string
max_stars_repo_name
string
max_stars_repo_head_hexsha
string
max_stars_repo_licenses
list
max_stars_count
int64
max_stars_repo_stars_event_min_datetime
string
max_stars_repo_stars_event_max_datetime
string
max_issues_repo_path
string
max_issues_repo_name
string
max_issues_repo_head_hexsha
string
max_issues_repo_licenses
list
max_issues_count
int64
max_issues_repo_issues_event_min_datetime
string
max_issues_repo_issues_event_max_datetime
string
max_forks_repo_path
string
max_forks_repo_name
string
max_forks_repo_head_hexsha
string
max_forks_repo_licenses
list
max_forks_count
int64
max_forks_repo_forks_event_min_datetime
string
max_forks_repo_forks_event_max_datetime
string
content
string
avg_line_length
float64
max_line_length
int64
alphanum_fraction
float64
027d872b55655200bda67400a856127724a9bc58
1,457
js
JavaScript
joybao-meteor/imports/helpers/WechatHelper.js
MarsCWD/joybao
6dae7021ecd3e3c51f250cdcb4491d1fd90bbbcc
[ "Apache-2.0" ]
null
null
null
joybao-meteor/imports/helpers/WechatHelper.js
MarsCWD/joybao
6dae7021ecd3e3c51f250cdcb4491d1fd90bbbcc
[ "Apache-2.0" ]
null
null
null
joybao-meteor/imports/helpers/WechatHelper.js
MarsCWD/joybao
6dae7021ecd3e3c51f250cdcb4491d1fd90bbbcc
[ "Apache-2.0" ]
null
null
null
const crypto = require("crypto"); class WXBizDataCryptHelper { constructor(appId, sessionKey) { this.appId = appId; this.sessionKey = sessionKey; } decryptData(encryptedDataOrign, ivOrgin) { // base64 decode const sessionKey = new Buffer(this.sessionKey, "base64"), encryptedData = new Buffer(encryptedDataOrign, "base64"), iv = new Buffer(ivOrgin, "base64"); let decoded; try { // 解密 const decipher = crypto.createDecipheriv("aes-128-cbc", sessionKey, iv); // 设置自动 padding 为 true,删除填充补位 decipher.setAutoPadding(true); decoded = decipher.update(encryptedData, "binary", "utf8"); decoded += decipher.final("utf8"); decoded = JSON.parse(decoded); } catch (err) { throw new Error("Illegal Buffer"); } if (decoded.watermark.appid !== this.appId) { throw new Error("Illegal Buffer"); } return decoded; } /** * 检查签名是否有效 * @param {[type]} orign [加密对象] * @param {[type]} signature [校验签名] * @return {[type]} [description] */ static checkSignature(rawData, signature) { const shaSum = crypto.createHash("sha1"); shaSum.update(rawData); const res = shaSum.digest("hex"); return res === signature; } } export default WXBizDataCryptHelper;
28.019231
84
0.562114
027dbbf84c3091e27e1130f6bc911bf8424cd1d8
196
js
JavaScript
webapp/app/helpers/exists.js
yaelmi3/backslash
edf39caf97af2c926da01c340a83648f4874e97e
[ "BSD-3-Clause" ]
17
2015-11-25T13:02:38.000Z
2021-12-14T20:18:36.000Z
webapp/app/helpers/exists.js
yaelmi3/backslash
edf39caf97af2c926da01c340a83648f4874e97e
[ "BSD-3-Clause" ]
533
2015-11-24T12:47:13.000Z
2022-02-12T07:59:08.000Z
webapp/app/helpers/exists.js
parallelsystems/backslash
577cdd18d5f665a8b493c4b2e2a605b7e0f6e11b
[ "BSD-3-Clause" ]
15
2015-11-22T13:25:54.000Z
2022-02-16T19:23:11.000Z
import { helper } from "@ember/component/helper"; export function exists(params /*, hash*/) { let arg = params[0]; return arg !== null && arg !== undefined; } export default helper(exists);
21.777778
49
0.658163
027ec45f8637ec458c4b2fba403409fa953bebfc
1,790
js
JavaScript
encryption/encryption.js
Charmant101/algorithms
a115ee8f1c25940b42af949f87a18ca426b1c91b
[ "MIT" ]
null
null
null
encryption/encryption.js
Charmant101/algorithms
a115ee8f1c25940b42af949f87a18ca426b1c91b
[ "MIT" ]
null
null
null
encryption/encryption.js
Charmant101/algorithms
a115ee8f1c25940b42af949f87a18ca426b1c91b
[ "MIT" ]
null
null
null
'use strict'; const fs = require('fs'); process.stdin.resume(); process.stdin.setEncoding('utf-8'); let inputString = ''; let currentLine = 0; process.stdin.on('data', inputStdin => { inputString += inputStdin; }); process.stdin.on('end', _ => { inputString = inputString.replace(/\s*$/, '') .split('\n') .map(str => str.replace(/\s*$/, '')); main(); }); function readLine() { return inputString[currentLine++]; } // Complete the encryption function below. function encryption(s) { s = s.replace(/ /g, ''); let result = [], arr = []; let count = 0; let rows = Math.floor(Math.sqrt(s.length)); let columns = Math.ceil(Math.sqrt(s.length)); if ((rows * columns) < s.length) { rows++; } for (let i = 0; i < Math.ceil(s.length / columns); i++) { for (let j = 0; j < columns; j++) { if (s[count]) { arr.push(s[count++]); } } result.push(arr); arr = []; } return displayEncryption(result, rows, columns); } function displayEncryption(arr, rows, columns) { let i = 0, j = 0; let stri = '', res = ''; for (let a = 0; a < columns; a++) { while (i < rows) { if (arr[i][j]) { stri += arr[i][j]; } i++; } res += stri + ' '; stri = ''; i = 0; j++; } return res.trim(); } function main() { const ws = fs.createWriteStream(process.env.OUTPUT_PATH); const s = readLine(); let result = encryption(s); ws.write(result + "\n"); ws.end(); }
20.574713
65
0.449162
027ece9117be4800803516046800cd8024851039
2,652
js
JavaScript
core-ui/src/components/Predefined/Details/DNSEntries.details.js
Sawthis/busola
cbb9693a9103021fccbca1f9fbec7c04fcf996dc
[ "Apache-2.0" ]
null
null
null
core-ui/src/components/Predefined/Details/DNSEntries.details.js
Sawthis/busola
cbb9693a9103021fccbca1f9fbec7c04fcf996dc
[ "Apache-2.0" ]
null
null
null
core-ui/src/components/Predefined/Details/DNSEntries.details.js
Sawthis/busola
cbb9693a9103021fccbca1f9fbec7c04fcf996dc
[ "Apache-2.0" ]
null
null
null
import React from 'react'; import { useTranslation } from 'react-i18next'; import { LayoutPanel, FormItem, FormLabel } from 'fundamental-react'; import { StatusBadge } from 'react-shared'; const RowComponent = ({ name, value }) => value ? ( <FormItem className="item-wrapper"> <div style={{ display: 'grid', gridTemplateColumns: '1fr 3fr' }}> <FormLabel className="form-label">{name}:</FormLabel> <div>{value}</div> </div> </FormItem> ) : null; const Provider = resource => { const { t } = useTranslation(); return ( <LayoutPanel key="provider-panel" className="fd-margin--md"> <LayoutPanel.Header> <LayoutPanel.Head title={t('dnsentries.headers.provider')} /> </LayoutPanel.Header> <LayoutPanel.Body> <RowComponent name={t('dnsentries.headers.provider')} value={resource.status?.provider} /> <RowComponent name={t('dnsentries.headers.provider-type')} value={resource.status?.providerType} /> </LayoutPanel.Body> </LayoutPanel> ); }; const Spec = resource => { const { t } = useTranslation(); if (!(resource.spec.dnsName || resource.spec.targets || resource.spec.ttl)) { return null; } const targets = (resource.spec?.targets || []) .toString() .replaceAll(',', ', '); return ( <LayoutPanel key="specification-panel" className="fd-margin--md"> <LayoutPanel.Header> <LayoutPanel.Head title={t('dnsentries.headers.spec')} /> </LayoutPanel.Header> <LayoutPanel.Body> {resource.spec.dnsName && ( <RowComponent name={t('dnsentries.headers.dns-name')} value={resource.spec.dnsName} /> )} {resource.spec.targets && ( <RowComponent name={t('dnsentries.headers.targets')} value={targets} /> )} {resource.spec.ttl && ( <RowComponent name={t('dnsentries.headers.ttl')} value={resource.spec.ttl} /> )} </LayoutPanel.Body> </LayoutPanel> ); }; export const DNSEntriesDetails = ({ DefaultRenderer, ...otherParams }) => { const { t } = useTranslation(); const customColumns = [ { header: t('dnsentries.headers.status'), value: dnsentry => ( <StatusBadge autoResolveType> {dnsentry.status?.state || 'UNKNOWN'} </StatusBadge> ), }, ]; return ( <DefaultRenderer customComponents={[Provider, Spec]} customColumns={customColumns} {...otherParams} ></DefaultRenderer> ); };
26.787879
79
0.574284
027f0bba04162df96d99e50d4b43ef4db5027037
2,481
js
JavaScript
src/components/MainSidebar.js
gauravsavanur07/spruik
29ad42083d5017278a920c59484abd22619a687c
[ "MIT" ]
5
2018-12-28T18:11:38.000Z
2019-01-08T15:59:04.000Z
src/components/MainSidebar.js
SpruikNet/spruik
29ad42083d5017278a920c59484abd22619a687c
[ "MIT" ]
null
null
null
src/components/MainSidebar.js
SpruikNet/spruik
29ad42083d5017278a920c59484abd22619a687c
[ "MIT" ]
null
null
null
import React, { Component } from 'react' import './MainSidebar.css' import adchainLogo from './assets/ad_chain_logo_white_text.png' import metaxLogo from './assets/metax_logo_white_text.png' class MainSidebar extends Component { componentDidMount() { /* window.$('.ui.sidebar') .sidebar({ dimPage:false }) */ } render () { const Link = this._link return ( <div className='MainSidebar ui sidebar inverted vertical menu visible'> <div className='adChainLogo ui image'> <a href='/'> <img src={adchainLogo} alt='adChain' /> </a> </div> <div className='ListTitle ui header'> adChain Registry </div> <div className="SidebarList overflow-y"> <ul className='ui list'> <li className='item'> <li className='item'><a href='#/domains?approved=true'>Domains in registry</a></li> <Link to='/domains' activeClassName='active'>All domains</Link> <li className='item'><a href='#/domains?pending=true'>Domains in application</a></li> </li> <li className='item'><a href='#/domains?in_voting=true'>Domains in voting</a></li> <li className='item'> <li className='item'><a href='#/domains?rejected=true'>Rejected domains</a></li> <Link to='/domains?approved=true'>Domains in registry</Link> <li className='item ApplyLink'><a href='#/apply'>Apply now</a></li> </li> <li className='item'> <Link to='/domains?pending=true'>Domains in application</Link> </li> <li className='item'> <Link to='/domains?in_voting=true'>Domains in voting</Link> </li> <li className='item'> <Link to='/domains?rejected=true'>Rejected domains</Link> </li> <li className='item ApplyLink'> <Link to='/apply'>Apply now</Link> </li> </div> <div className="SidebarFooter"> <div className='metaxLogo ui image'> <a href='https://metax.io' target='_blank' rel='noopener noreferrer'> <img src={metaxLogo} alt='MetaX' /> </a> </div> <div className='Copyright'> <p>© Copyright 2017 MetaXchain, Inc.<br /> All rights reserved.</p> </div> </div> </div> ) } } export default MainSidebar
35.442857
173
0.550181
0280e0fba4952429bcab436e9089ab57be3f19bc
1,289
js
JavaScript
test/components/models.js
gohkokboon/Review_Platform_Swagger
6b30578f6bbc88568a1c0d2b619118d95f83b6b7
[ "Apache-2.0" ]
1
2018-08-29T08:55:10.000Z
2018-08-29T08:55:10.000Z
test/components/models.js
gohkokboon/Review_Platform_Swagger
6b30578f6bbc88568a1c0d2b619118d95f83b6b7
[ "Apache-2.0" ]
2
2018-05-04T14:25:16.000Z
2019-08-14T21:05:36.000Z
test/components/models.js
gohkokboon/Review_Platform_Swagger
6b30578f6bbc88568a1c0d2b619118d95f83b6b7
[ "Apache-2.0" ]
3
2018-05-09T08:48:31.000Z
2019-03-18T11:25:48.000Z
/* eslint-env mocha */ import React from "react" import expect, { createSpy } from "expect" import { shallow } from "enzyme" import { fromJS } from "immutable" import Models from "components/models" import ModelCollpase from "components/model-collapse" import ModelComponent from "components/model-wrapper" describe("<Models/>", function(){ // Given let components = { Collapse: ModelCollpase, ModelWrapper: ModelComponent } let props = { getComponent: (c) => { return components[c] }, specSelectors: { isOAS3: () => false, definitions: function() { return fromJS({ def1: {}, def2: {} }) } }, layoutSelectors: { isShown: createSpy() }, layoutActions: {}, getConfigs: () => ({ docExpansion: "list", defaultModelsExpandDepth: 0 }) } it("passes defaultModelsExpandDepth to ModelWrapper", function(){ // When let wrapper = shallow(<Models {...props}/>) // Then should render tabs expect(wrapper.find("ModelCollapse").length).toEqual(1) expect(wrapper.find("ModelWrapper").length).toBeGreaterThan(0) wrapper.find("ModelComponent").forEach((modelWrapper) => { expect(modelWrapper.props().expandDepth).toBe(0) }) }) })
24.320755
67
0.623739
0280f4b1ff901cd80a7c10a59ccb63cb2f384f90
617
js
JavaScript
students/studentServices.js
Buildweek-Better-Professor/Backend
5bc7b477c38c0645aaa779c62c15d4465e9073bc
[ "MIT" ]
null
null
null
students/studentServices.js
Buildweek-Better-Professor/Backend
5bc7b477c38c0645aaa779c62c15d4465e9073bc
[ "MIT" ]
6
2020-12-13T05:07:45.000Z
2021-05-11T22:12:51.000Z
students/studentServices.js
jduell12/Backend_Build_Week
1d713819ad26e610a698285bd53aa926c5e7007a
[ "MIT" ]
null
null
null
const db = require("../data/dbConfig"); const Students = require("./studentsModel"); const Tasks = require("../tasks/tasksModel"); module.exports = { validTask, validEditTask, validTaskId, }; //checks if task has all required fields function validTask(task) { return Boolean(task.name && task.due_date); } //checks that at least one task field is provided function validEditTask(task) { return Boolean( task.name || task.due_date || task.description || task.completed, ); } //checks that a task with the id exists async function validTaskId(taskId) { return db("tasks").where({ id: taskId }); }
22.851852
69
0.703404
0281041101406ed9182cf34fee80fcd0fee69823
42,336
js
JavaScript
test/unit/controller/skill-metadata-controller-test.js
hideokamoto/ask-cli
869ee8c84c425529c6034514f9723d9a106855b9
[ "Apache-2.0" ]
null
null
null
test/unit/controller/skill-metadata-controller-test.js
hideokamoto/ask-cli
869ee8c84c425529c6034514f9723d9a106855b9
[ "Apache-2.0" ]
null
null
null
test/unit/controller/skill-metadata-controller-test.js
hideokamoto/ask-cli
869ee8c84c425529c6034514f9723d9a106855b9
[ "Apache-2.0" ]
null
null
null
const { expect } = require('chai'); const sinon = require('sinon'); const path = require('path'); const fs = require('fs-extra'); const jsonView = require('@src/view/json-view'); const CLiError = require('@src/exceptions/cli-error'); const ResourcesConfig = require('@src/model/resources-config'); const httpClient = require('@src/clients/http-client'); const SkillMetadataController = require('@src/controllers/skill-metadata-controller'); const AuthorizationController = require('@src/controllers/authorization-controller'); const Manifest = require('@src/model/manifest'); const Messenger = require('@src/view/messenger'); const zipUtils = require('@src/utils/zip-utils'); const hashUtils = require('@src/utils/hash-utils'); const CONSTANTS = require('@src/utils/constants'); describe('Controller test - skill metadata controller test', () => { const FIXTURE_RESOURCES_CONFIG_FILE_PATH = path.join(process.cwd(), 'test', 'unit', 'fixture', 'model', 'regular-proj', 'ask-resources.json'); const FIXTURE_MANIFEST_FILE_PATH = path.join(process.cwd(), 'test', 'unit', 'fixture', 'model', 'manifest.json'); const TEST_PROFILE = 'default'; // test file contains 'default' profile const TEST_ROOT_PATH = 'root'; const TEST_VENDOR_ID = 'vendorId'; const TEST_SKILL_ID = 'skillId'; const TEST_STAGE = 'stage'; const TEST_PATH = 'path'; const TEST_PACKAGE_URL = 'packageUrl'; const TEST_CURRENT_HASH = 'currentHash'; const TEST_UPLOAD_URL = 'uploadUrl'; const TEST_EXPIRES_AT = 'expiresAt'; const TEST_LOCATION_URL = 'locationUrl'; const TEST_IMPORT_ID = 'importId'; const TEST_EXPORT_ID = 'exportId'; const TEST_FILE_CONTENT = 'fileContent'; const TEST_CONFIGURATION = { profile: TEST_PROFILE, doDebug: false }; describe('# inspect correctness for constructor', () => { it('| initiate as a SkillMetadataController class', () => { const skillMetaController = new SkillMetadataController(TEST_CONFIGURATION); expect(skillMetaController).to.be.instanceOf(SkillMetadataController); }); }); describe('# test class method: deploySkillPackage', () => { const skillMetaController = new SkillMetadataController(TEST_CONFIGURATION); beforeEach(() => { new ResourcesConfig(FIXTURE_RESOURCES_CONFIG_FILE_PATH); }); afterEach(() => { ResourcesConfig.dispose(); sinon.restore(); }); it('| skill package src is empty in ask-resources.json', (done) => { // setup ResourcesConfig.getInstance().setSkillMetaSrc(TEST_PROFILE, null); // call skillMetaController.deploySkillPackage(TEST_VENDOR_ID, (err, res) => { // verify expect(res).equal(undefined); expect(err).equal('Skill package src is not found in ask-resources.json.'); done(); }); }); it('| skill package src is not a valid file path', (done) => { // setup ResourcesConfig.getInstance().setSkillMetaSrc(TEST_PROFILE, TEST_PATH); sinon.stub(fs, 'existsSync').withArgs(TEST_PATH).returns(false); // call skillMetaController.deploySkillPackage(TEST_VENDOR_ID, (err, res) => { // verify expect(res).equal(undefined); expect(err).equal(`File ${TEST_PATH} does not exist.`); done(); }); }); it('| getHash fails with error', (done) => { // setup ResourcesConfig.getInstance().setSkillMetaSrc(TEST_PROFILE, TEST_PATH); sinon.stub(fs, 'existsSync').withArgs(TEST_PATH).returns(true); sinon.stub(hashUtils, 'getHash').callsArgWith(1, 'hashError', null); // call skillMetaController.deploySkillPackage(TEST_VENDOR_ID, (err, res) => { // verify expect(res).equal(undefined); expect(err).equal('hashError'); done(); }); }); it('| getHash result same as lastDeployHash, expect quit with warn message', (done) => { // setup const LAST_DEPLOY = 'lastDeploy'; ResourcesConfig.getInstance().setSkillMetaSrc(TEST_PROFILE, TEST_PATH); sinon.stub(fs, 'existsSync').withArgs(TEST_PATH).returns(true); ResourcesConfig.getInstance().setSkillMetaLastDeployHash(TEST_PROFILE, LAST_DEPLOY); sinon.stub(hashUtils, 'getHash').callsArgWith(1, null, LAST_DEPLOY); // call skillMetaController.deploySkillPackage(TEST_VENDOR_ID, (err, res) => { // verify expect(err).equal('The hash of current skill package folder does not change compared to the ' + 'last deploy hash result, CLI will skip the deploy of skill package.'); expect(res).equal(undefined); done(); }); }); it('| hash does change, skillId exists and putSkillPackage passes, expect resourcesConfig updated correctly', (done) => { // setup ResourcesConfig.getInstance().setSkillMetaSrc(TEST_PROFILE, TEST_PATH); sinon.stub(fs, 'existsSync').withArgs(TEST_PATH).returns(true); sinon.stub(hashUtils, 'getHash').callsArgWith(1, null, TEST_CURRENT_HASH); sinon.stub(SkillMetadataController.prototype, 'putSkillPackage').callsArgWith(2, null, TEST_SKILL_ID); ResourcesConfig.getInstance().setSkillId(TEST_PROFILE, TEST_SKILL_ID); // call skillMetaController.deploySkillPackage(TEST_VENDOR_ID, (err, res) => { // verify expect(ResourcesConfig.getInstance().getSkillMetaLastDeployHash(TEST_PROFILE)).equal(TEST_CURRENT_HASH); expect(err).equal(undefined); expect(res).equal(undefined); done(); }); }); it('| hash does change, skillId not exists and putSkillPackage passes, expect resourcesConfig updated correctly', (done) => { // setup ResourcesConfig.getInstance().setSkillMetaSrc(TEST_PROFILE, TEST_PATH); sinon.stub(fs, 'existsSync').withArgs(TEST_PATH).returns(true); sinon.stub(hashUtils, 'getHash').callsArgWith(1, null, TEST_CURRENT_HASH); sinon.stub(SkillMetadataController.prototype, 'putSkillPackage').callsArgWith(2, null, TEST_SKILL_ID); ResourcesConfig.getInstance().setSkillId(TEST_PROFILE, ''); // call skillMetaController.deploySkillPackage(TEST_VENDOR_ID, (err, res) => { // verify expect(ResourcesConfig.getInstance().getSkillMetaLastDeployHash(TEST_PROFILE)).equal(TEST_CURRENT_HASH); expect(ResourcesConfig.getInstance().getSkillId(TEST_PROFILE)).equal(TEST_SKILL_ID); expect(err).equal(undefined); expect(res).equal(undefined); done(); }); }); it('| putSkillPackage fails, expect callback put error message', (done) => { // setup ResourcesConfig.getInstance().setSkillMetaSrc(TEST_PROFILE, TEST_PATH); sinon.stub(fs, 'existsSync').withArgs(TEST_PATH).returns(true); sinon.stub(hashUtils, 'getHash').callsArgWith(1, null, TEST_CURRENT_HASH); sinon.stub(SkillMetadataController.prototype, 'putSkillPackage').callsArgWith(2, 'putErr'); ResourcesConfig.getInstance().setSkillId(TEST_PROFILE, TEST_SKILL_ID); // call skillMetaController.deploySkillPackage(TEST_VENDOR_ID, (err, res) => { // verify expect(err).equal('putErr'); expect(res).equal(undefined); done(); }); }); }); describe('# test class method enableSkill', () => { const skillMetaController = new SkillMetadataController(TEST_CONFIGURATION); beforeEach(() => { new Manifest(FIXTURE_MANIFEST_FILE_PATH); new ResourcesConfig(FIXTURE_RESOURCES_CONFIG_FILE_PATH); sinon.stub(AuthorizationController.prototype, 'tokenRefreshAndRead').callsArgWith(1); }); afterEach(() => { ResourcesConfig.dispose(); Manifest.dispose(); sinon.restore(); }); it('| callback error when skillId is not provided', (done) => { // setup ResourcesConfig.getInstance().setSkillId(TEST_PROFILE, ''); // call skillMetaController.enableSkill((err, res) => { // verify expect(err).equal(`[Fatal]: Failed to find the skillId for profile [${TEST_PROFILE}], please make sure the skill metadata deployment has succeeded with result of a valid skillId.`); expect(res).equal(undefined); done(); }); }); it('| return error when dominInfo is not provided', () => { // setup Manifest.getInstance().setApis({}); const expectedErrMessage = '[Error]: Skill information is not valid. Please make sure "apis" field in the skill.json is not empty.'; // call expect(() => skillMetaController.validateDomain()).to.throw(CLiError, expectedErrMessage); }); it('| return error when dominInfo contains more than one domain', () => { // setup Manifest.getInstance().setApis({ custom: {}, smartHome: {} }); const expectedErrMessage = '[Warn]: Skill with multiple api domains cannot be enabled. Skip the enable process.'; // call expect(() => skillMetaController.validateDomain()).to.throw(CLiError, expectedErrMessage); }); it('| return error when domain cannot be enabled', () => { // setup Manifest.getInstance().setApis({ smartHome: {} }); const expectedErrMessage = '[Warn]: Skill api domain "smartHome" cannot be enabled. Skip the enable process.'; // call expect(() => skillMetaController.validateDomain()).to.throw(CLiError, expectedErrMessage); }); it('| callback error when getSkillEnablement return error', (done) => { // setup sinon.stub(httpClient, 'request').callsArgWith(3, 'getSkillEnablementError'); // stub smapi request skillMetaController.enableSkill((err, res) => { // verify expect(err).equal('getSkillEnablementError'); expect(res).equal(undefined); done(); }); }); it('| callback error when getSkillEnablement return error', (done) => { // setup const responseBody = { Message: 'somehow fails' }; const response = { statusCode: 300, body: responseBody }; sinon.stub(httpClient, 'request').callsArgWith(3, null, response); // stub smapi request skillMetaController.enableSkill((err, res) => { // verify expect(err).equal(jsonView.toString(responseBody)); expect(res).equal(undefined); done(); }); }); it('| when skill already enabled, can callback skip enablement message', (done) => { // setup const response = { statusCode: 200, }; sinon.stub(httpClient, 'request').callsArgWith(3, null, response); // stub smapi request sinon.stub(Messenger.getInstance(), 'info'); skillMetaController.enableSkill((err, res) => { // verify expect(err).equal(undefined); expect(res).equal(undefined); expect(Messenger.getInstance().info.args[0][0]).equal('Skill is already enabled, skip the enable process.'); done(); }); }); it('| when skill is not enabled, can callback error when enalbe skill fail', (done) => { // setup const getEnablementResponse = { statusCode: 404, body: {} }; sinon.stub(httpClient, 'request') .withArgs(sinon.match.any, 'get-skill-enablement') .callsArgWith(3, null, getEnablementResponse); // stub smapi request httpClient.request .withArgs(sinon.match.any, 'enable-skill') .callsArgWith(3, 'enableSkillError'); // stub smapi request skillMetaController.enableSkill((err, res) => { // verify expect(err).equal('enableSkillError'); expect(res).equal(undefined); done(); }); }); it('| when skill is not enabled, can callback error when statusCode >= 300', (done) => { // setup const getEnablementResponse = { statusCode: 404, body: {} }; const enableSkillResponseBody = { Message: 'somehow fail' }; const enableSkillResponse = { statusCode: 300, body: enableSkillResponseBody }; sinon.stub(httpClient, 'request') .withArgs(sinon.match.any, 'get-skill-enablement') .callsArgWith(3, null, getEnablementResponse); // stub smapi request httpClient.request .withArgs(sinon.match.any, 'enable-skill') .callsArgWith(3, null, enableSkillResponse); // stub smapi request skillMetaController.enableSkill((err, res) => { // verify expect(err).equal(jsonView.toString(enableSkillResponseBody)); expect(res).equal(undefined); done(); }); }); it('| when skill is not enabled, can callback success enable skill message', (done) => { // setup const getEnablementResponse = { statusCode: 404, body: {} }; const enableSkillResponse = { statusCode: 200, }; sinon.stub(Messenger.getInstance(), 'info'); sinon.stub(httpClient, 'request') .withArgs(sinon.match.any, 'get-skill-enablement') .callsArgWith(3, null, getEnablementResponse); // stub smapi request httpClient.request .withArgs(sinon.match.any, 'enable-skill') .callsArgWith(3, null, enableSkillResponse); // stub smapi request skillMetaController.enableSkill((err, res) => { // verify expect(err).equal(undefined); expect(res).equal(undefined); expect(Messenger.getInstance().info.args[0][0]).equal('Skill is enabled successfully.'); done(); }); }); }); describe('# test class method: putSkillPackage', () => { const skillMetaController = new SkillMetadataController(TEST_CONFIGURATION); beforeEach(() => { new ResourcesConfig(FIXTURE_RESOURCES_CONFIG_FILE_PATH); }); afterEach(() => { ResourcesConfig.dispose(); sinon.restore(); }); it('| upload of skill package fails, expect callback with error', (done) => { // setup ResourcesConfig.getInstance().setSkillMetaSrc(TEST_PROFILE, TEST_PATH); sinon.stub(SkillMetadataController.prototype, 'uploadSkillPackage').callsArgWith(1, 'uploadErr'); // call skillMetaController.putSkillPackage(TEST_SKILL_ID, TEST_VENDOR_ID, (err, res) => { // verify expect(SkillMetadataController.prototype.uploadSkillPackage.args[0][0]).equal(TEST_PATH); expect(res).equal(undefined); expect(err).equal('uploadErr'); done(); }); }); it('| import skill pacakge faild, expect callback with error', (done) => { // setup ResourcesConfig.getInstance().setSkillMetaSrc(TEST_PROFILE, TEST_PATH); sinon.stub(SkillMetadataController.prototype, 'uploadSkillPackage').callsArgWith(1, null, { uploadUrl: TEST_UPLOAD_URL }); sinon.stub(SkillMetadataController.prototype, '_importPackage').callsArgWith(3, 'importErr'); // call skillMetaController.putSkillPackage(TEST_SKILL_ID, TEST_VENDOR_ID, (err, res) => { // verify expect(SkillMetadataController.prototype._importPackage.args[0][0]).equal(TEST_SKILL_ID); expect(SkillMetadataController.prototype._importPackage.args[0][1]).equal(TEST_VENDOR_ID); expect(SkillMetadataController.prototype._importPackage.args[0][2]).equal(TEST_UPLOAD_URL); expect(res).equal(undefined); expect(err).equal('importErr'); done(); }); }); it('| poll skill pacakge faild, expect callback with error', (done) => { // setup ResourcesConfig.getInstance().setSkillMetaSrc(TEST_PROFILE, TEST_PATH); sinon.stub(SkillMetadataController.prototype, 'uploadSkillPackage').callsArgWith(1, null, { uploadUrl: TEST_UPLOAD_URL }); sinon.stub(SkillMetadataController.prototype, '_importPackage').callsArgWith(3, null, { headers: { location: TEST_LOCATION_URL } }); sinon.stub(SkillMetadataController.prototype, '_pollImportStatus').callsArgWith(1, 'pollErr'); // call skillMetaController.putSkillPackage(TEST_SKILL_ID, TEST_VENDOR_ID, (err, res) => { // verify expect(SkillMetadataController.prototype._pollImportStatus.args[0][0]).equal(TEST_LOCATION_URL); expect(res).equal(undefined); expect(err).equal('pollErr'); done(); }); }); it('| poll skill pacakge replies with non succeed result, expect callback with error response', (done) => { // setup ResourcesConfig.getInstance().setSkillMetaSrc(TEST_PROFILE, TEST_PATH); sinon.stub(SkillMetadataController.prototype, 'uploadSkillPackage').callsArgWith(1, null, { uploadUrl: TEST_UPLOAD_URL }); sinon.stub(SkillMetadataController.prototype, '_importPackage').callsArgWith(3, null, { headers: { location: TEST_LOCATION_URL } }); sinon.stub(SkillMetadataController.prototype, '_pollImportStatus').callsArgWith(1, null, { body: { status: CONSTANTS.SKILL.PACKAGE_STATUS.FAILED } }); // call skillMetaController.putSkillPackage(TEST_SKILL_ID, TEST_VENDOR_ID, (err, res) => { // verify expect(SkillMetadataController.prototype._pollImportStatus.args[0][0]).equal(TEST_LOCATION_URL); expect(res).equal(undefined); expect(err).equal(jsonView.toString({ status: CONSTANTS.SKILL.PACKAGE_STATUS.FAILED })); done(); }); }); it('| poll skill pacakge finished, expect callback skillId', (done) => { // setup ResourcesConfig.getInstance().setSkillMetaSrc(TEST_PROFILE, TEST_PATH); sinon.stub(SkillMetadataController.prototype, 'uploadSkillPackage').callsArgWith(1, null, { uploadUrl: TEST_UPLOAD_URL }); sinon.stub(SkillMetadataController.prototype, '_importPackage').callsArgWith(3, null, { headers: { location: TEST_LOCATION_URL } }); sinon.stub(SkillMetadataController.prototype, '_pollImportStatus').callsArgWith(1, null, { body: { status: CONSTANTS.SKILL.PACKAGE_STATUS.SUCCEEDED, skill: { skillId: TEST_SKILL_ID } } }); // call skillMetaController.putSkillPackage(TEST_SKILL_ID, TEST_VENDOR_ID, (err, res) => { // verify expect(SkillMetadataController.prototype._pollImportStatus.args[0][0]).equal(TEST_LOCATION_URL); expect(err).equal(null); expect(res).equal(TEST_SKILL_ID); done(); }); }); }); describe('# test class method: getSkillPackage', () => { const skillMetaController = new SkillMetadataController(TEST_CONFIGURATION); beforeEach(() => { }); afterEach(() => { sinon.restore(); }); it('| export package request fails, expect callback with error', (done) => { // setup sinon.stub(SkillMetadataController.prototype, '_exportPackage').callsArgWith(2, 'exportErr'); // call skillMetaController.getSkillPackage(TEST_ROOT_PATH, TEST_SKILL_ID, TEST_STAGE, (err, res) => { // verify expect(SkillMetadataController.prototype._exportPackage.args[0][0]).equal(TEST_SKILL_ID); expect(SkillMetadataController.prototype._exportPackage.args[0][1]).equal(TEST_STAGE); expect(res).equal(undefined); expect(err).equal('exportErr'); done(); }); }); it('| export package returns exportId but poll status fails, expect callback with error', (done) => { // setup sinon.stub(SkillMetadataController.prototype, '_exportPackage').callsArgWith(2, null, { statusCode: 202, headers: { location: `${TEST_EXPORT_ID}` } }); sinon.stub(SkillMetadataController.prototype, '_pollExportStatus').callsArgWith(1, 'polling error'); // call skillMetaController.getSkillPackage(TEST_ROOT_PATH, TEST_SKILL_ID, TEST_STAGE, (err, res) => { // verify expect(SkillMetadataController.prototype._pollExportStatus.args[0][0]).equal(TEST_EXPORT_ID); expect(res).equal(undefined); expect(err).equal('polling error'); done(); }); }); it('| package exported successfully but unzip fails, expect callback zip error', (done) => { // setup sinon.stub(SkillMetadataController.prototype, '_exportPackage').callsArgWith(2, null, { statusCode: 202, headers: { location: `${TEST_EXPORT_ID}` } }); sinon.stub(SkillMetadataController.prototype, '_pollExportStatus').callsArgWith(1, null, { statusCode: 200, body: { skill: { location: TEST_PACKAGE_URL } } }); sinon.stub(zipUtils, 'unzipRemoteZipFile').callsArgWith(3, 'unzip error'); // call skillMetaController.getSkillPackage(TEST_ROOT_PATH, TEST_SKILL_ID, TEST_STAGE, (err, res) => { // verify expect(SkillMetadataController.prototype._pollExportStatus.args[0][0]).equal(TEST_EXPORT_ID); expect(res).equal(undefined); expect(err).equal('unzip error'); done(); }); }); it('| package exported successfully and unzip works, expect no error returned', (done) => { // setup sinon.stub(SkillMetadataController.prototype, '_exportPackage').callsArgWith(2, null, { statusCode: 202, headers: { location: `${TEST_EXPORT_ID}` } }); sinon.stub(SkillMetadataController.prototype, '_pollExportStatus').callsArgWith(1, null, { statusCode: 200, body: { skill: { location: TEST_PACKAGE_URL } } }); sinon.stub(zipUtils, 'unzipRemoteZipFile').callsArgWith(3, null); // call skillMetaController.getSkillPackage(TEST_ROOT_PATH, TEST_SKILL_ID, TEST_STAGE, (err, res) => { // verify expect(SkillMetadataController.prototype._pollExportStatus.args[0][0]).equal(TEST_EXPORT_ID); expect(res).equal(undefined); expect(err).equal(null); done(); }); }); }); describe('# test class method: uploadSkillPackage', () => { const skillMetaController = new SkillMetadataController(TEST_CONFIGURATION); beforeEach(() => { new ResourcesConfig(FIXTURE_RESOURCES_CONFIG_FILE_PATH); }); afterEach(() => { ResourcesConfig.dispose(); sinon.restore(); }); it('| create upload url fails, expect callback error', (done) => { // setup sinon.stub(SkillMetadataController.prototype, '_createUploadUrl').callsArgWith(0, 'createUploadErr'); // call skillMetaController.uploadSkillPackage(TEST_PATH, (err, res) => { // verify expect(res).equal(undefined); expect(err).equal('createUploadErr'); done(); }); }); it('| create zip fails, expect callback error', (done) => { // setup sinon.stub(SkillMetadataController.prototype, '_createUploadUrl').callsArgWith(0, null, { uploadUrl: TEST_UPLOAD_URL }); sinon.stub(zipUtils, 'createTempZip').callsArgWith(1, 'zipErr'); // call skillMetaController.uploadSkillPackage(TEST_PATH, (err, res) => { // verify expect(zipUtils.createTempZip.args[0][0]).equal(TEST_PATH); expect(res).equal(undefined); expect(err).equal('zipErr'); done(); }); }); it('| upload zip file fails, expect callback error', (done) => { // setup sinon.stub(fs, 'readFileSync').withArgs(TEST_PATH).returns(TEST_FILE_CONTENT); sinon.stub(SkillMetadataController.prototype, '_createUploadUrl').callsArgWith(0, null, { uploadUrl: TEST_UPLOAD_URL }); sinon.stub(zipUtils, 'createTempZip').callsArgWith(1, null, TEST_PATH); sinon.stub(fs, 'removeSync'); sinon.stub(httpClient, 'putByUrl').callsArgWith(4, 'uploadErr'); // call skillMetaController.uploadSkillPackage(TEST_PATH, (err, res) => { // verify expect(httpClient.putByUrl.args[0][0]).equal(TEST_UPLOAD_URL); expect(httpClient.putByUrl.args[0][1]).equal(TEST_FILE_CONTENT); expect(httpClient.putByUrl.args[0][2]).equal('upload-skill-package'); expect(httpClient.putByUrl.args[0][3]).equal(false); expect(res).equal(undefined); expect(err).equal('uploadErr'); done(); }); }); it('| upload zip file meets error, expect callback error', (done) => { // setup sinon.stub(zipUtils, 'createTempZip').callsArgWith(1, null, TEST_PATH); sinon.stub(fs, 'readFileSync').withArgs(TEST_PATH).returns(TEST_FILE_CONTENT); sinon.stub(SkillMetadataController.prototype, '_createUploadUrl').callsArgWith(0, null, { uploadUrl: TEST_UPLOAD_URL }); sinon.stub(fs, 'removeSync'); sinon.stub(httpClient, 'putByUrl').callsArgWith(4, null, { statusCode: 401 }); // call skillMetaController.uploadSkillPackage(TEST_PATH, (err, res) => { // verify expect(httpClient.putByUrl.args[0][0]).equal(TEST_UPLOAD_URL); expect(httpClient.putByUrl.args[0][1]).equal(TEST_FILE_CONTENT); expect(httpClient.putByUrl.args[0][2]).equal('upload-skill-package'); expect(httpClient.putByUrl.args[0][3]).equal(false); expect(res).equal(undefined); expect(err).equal('[Error]: Upload of skill package failed. Please try again with --debug to see more details.'); done(); }); }); it('| upload skill package succeeds, expect callback upload result', (done) => { // setup sinon.stub(zipUtils, 'createTempZip').callsArgWith(1, null, TEST_PATH); sinon.stub(fs, 'readFileSync').withArgs(TEST_PATH).returns(TEST_FILE_CONTENT); sinon.stub(SkillMetadataController.prototype, '_createUploadUrl').callsArgWith(0, null, { uploadUrl: TEST_UPLOAD_URL }); sinon.stub(fs, 'removeSync'); sinon.stub(httpClient, 'putByUrl').callsArgWith(4, null, { statusCode: 202 }); // call skillMetaController.uploadSkillPackage(TEST_PATH, (err, res) => { // verify expect(httpClient.putByUrl.args[0][0]).equal(TEST_UPLOAD_URL); expect(httpClient.putByUrl.args[0][1]).equal(TEST_FILE_CONTENT); expect(httpClient.putByUrl.args[0][2]).equal('upload-skill-package'); expect(httpClient.putByUrl.args[0][3]).equal(false); expect(err).equal(null); expect(res).deep.equal({ uploadUrl: TEST_UPLOAD_URL }); done(); }); }); }); describe('# test class method: _createUploadUrl', () => { const skillMetaController = new SkillMetadataController(TEST_CONFIGURATION); beforeEach(() => { new ResourcesConfig(FIXTURE_RESOURCES_CONFIG_FILE_PATH); sinon.stub(AuthorizationController.prototype, 'tokenRefreshAndRead').callsArgWith(1); }); afterEach(() => { ResourcesConfig.dispose(); sinon.restore(); }); it('| skillPackageSrc create upload fails, expect callback error', (done) => { // setup sinon.stub(httpClient, 'request').callsArgWith(3, 'createUploadErr'); // stub smapi request // call skillMetaController._createUploadUrl((err, res) => { // verify expect(res).equal(undefined); expect(err).equal('createUploadErr'); done(); }); }); it('| skillPackageSrc create upload returns error response, expect callback error', (done) => { // setup sinon.stub(httpClient, 'request').callsArgWith(3, null, { statusCode: 403, body: { error: 'message' } }); // stub smapi request // call skillMetaController._createUploadUrl((err, res) => { // verify expect(res).equal(undefined); expect(err).equal(jsonView.toString({ error: 'message' })); done(); }); }); it('| skillPackageSrc create upload succeeds, expect callback with createUpload response', (done) => { // setup sinon.stub(httpClient, 'request').callsArgWith(3, null, { statusCode: 200, headers: {}, body: { uploadUrl: TEST_UPLOAD_URL, expiresAt: TEST_EXPIRES_AT } }); // stub smapi request // call skillMetaController._createUploadUrl((err, res) => { // verify expect(err).equal(null); expect(res).deep.equal({ uploadUrl: TEST_UPLOAD_URL, expiresAt: TEST_EXPIRES_AT }); done(); }); }); }); describe('# test class method: _importPackage', () => { const skillMetaController = new SkillMetadataController(TEST_CONFIGURATION); beforeEach(() => { new ResourcesConfig(FIXTURE_RESOURCES_CONFIG_FILE_PATH); sinon.stub(AuthorizationController.prototype, 'tokenRefreshAndRead').callsArgWith(1); }); afterEach(() => { ResourcesConfig.dispose(); sinon.restore(); }); it('| import package fails, expect callback error', (done) => { // setup sinon.stub(httpClient, 'request').callsArgWith(3, 'importErr'); // stub smapi request // call skillMetaController._importPackage(TEST_SKILL_ID, TEST_VENDOR_ID, TEST_LOCATION_URL, (err, res) => { // verify expect(res).equal(undefined); expect(err).equal('importErr'); done(); }); }); it('| import package returns error response, expect callback error', (done) => { // setup sinon.stub(httpClient, 'request').callsArgWith(3, null, { statusCode: 403, body: { error: 'message' } }); // stub smapi request // call skillMetaController._importPackage(TEST_SKILL_ID, TEST_VENDOR_ID, TEST_LOCATION_URL, (err, res) => { // verify expect(res).equal(undefined); expect(err).equal(jsonView.toString({ error: 'message' })); done(); }); }); it('| import package succeeds, expect callback with createUpload response', (done) => { // setup sinon.stub(httpClient, 'request').callsArgWith(3, null, { statusCode: 200, headers: {}, body: { response: 'response' } }); // stub smapi request // call skillMetaController._importPackage(TEST_SKILL_ID, TEST_VENDOR_ID, TEST_LOCATION_URL, (err, res) => { // verify expect(err).equal(null); expect(res).deep.equal({ statusCode: 200, headers: {}, body: { response: 'response' } }); done(); }); }); }); describe('# test class method: _exportPackage', () => { const skillMetaController = new SkillMetadataController(TEST_CONFIGURATION); beforeEach(() => { sinon.stub(AuthorizationController.prototype, 'tokenRefreshAndRead').callsArgWith(1); }); afterEach(() => { sinon.restore(); }); it('| export package fails, expect callback error', (done) => { // setup sinon.stub(httpClient, 'request').callsArgWith(3, 'exportErr'); // stub smapi request // call skillMetaController._exportPackage(TEST_SKILL_ID, CONSTANTS.SKILL.STAGE.DEVELOPMENT, (err, res) => { // verify expect(res).equal(undefined); expect(err).equal('exportErr'); done(); }); }); it('| export package returns error response, expect callback error', (done) => { // setup sinon.stub(httpClient, 'request').callsArgWith(3, null, { statusCode: 403, body: { error: 'message' } }); // stub smapi request // call skillMetaController._exportPackage(TEST_SKILL_ID, CONSTANTS.SKILL.STAGE.DEVELOPMENT, (err, res) => { // verify expect(res).equal(undefined); expect(err).equal(jsonView.toString({ error: 'message' })); done(); }); }); it('| export package succeeds, expect callback with export response', (done) => { // setup sinon.stub(httpClient, 'request').callsArgWith(3, null, { statusCode: 200, headers: {}, body: { response: 'response' } }); // stub smapi request // call skillMetaController._exportPackage(TEST_SKILL_ID, CONSTANTS.SKILL.STAGE.DEVELOPMENT, (err, res) => { // verify expect(err).equal(null); expect(res).deep.equal({ statusCode: 200, headers: {}, body: { response: 'response' } }); done(); }); }); }); describe('# test class method: _pollImportStatus', () => { const skillMetaController = new SkillMetadataController(TEST_CONFIGURATION); beforeEach(() => { new ResourcesConfig(FIXTURE_RESOURCES_CONFIG_FILE_PATH); sinon.stub(AuthorizationController.prototype, 'tokenRefreshAndRead').callsArgWith(1); }); afterEach(() => { ResourcesConfig.dispose(); sinon.restore(); }); it('| poll status with getImportStatus fails, expect callback error', (done) => { // setup sinon.stub(httpClient, 'request').callsArgWith(3, 'pollErr'); // stub smapi request // call skillMetaController._pollImportStatus(TEST_IMPORT_ID, (err, res) => { // verify expect(res).equal(null); expect(err).equal('pollErr'); done(); }); }).timeout(20000); it('| poll status with getImportStatus return error response, expect callback error', (done) => { // setup sinon.stub(httpClient, 'request').callsArgWith(3, null, { statusCode: 403, body: { error: 'message' } }); // stub smapi request // call skillMetaController._pollImportStatus(TEST_IMPORT_ID, (err, res) => { // verify expect(res).equal(null); expect(err).equal(jsonView.toString({ error: 'message' })); done(); }); }).timeout(20000); it('| poll status with getImportStatus return success, expect callback with getImportStatus response', (done) => { // setup sinon.stub(httpClient, 'request').callsArgWith(3, null, { statusCode: 200, body: { status: CONSTANTS.SKILL.PACKAGE_STATUS.SUCCEEDED }, headers: {} }); // stub smapi request // call skillMetaController._pollImportStatus(TEST_IMPORT_ID, (err, res) => { // verify expect(err).equal(null); expect(res).deep.equal({ statusCode: 200, body: { status: CONSTANTS.SKILL.PACKAGE_STATUS.SUCCEEDED }, headers: {} }); done(); }); }).timeout(20000); }); describe('# test class method: _pollExportStatus', () => { const skillMetaController = new SkillMetadataController(TEST_CONFIGURATION); beforeEach(() => { sinon.stub(AuthorizationController.prototype, 'tokenRefreshAndRead').callsArgWith(1); }); afterEach(() => { sinon.restore(); }); it('| poll status with getExportStatus fails, expect callback error', (done) => { // setup sinon.stub(httpClient, 'request').callsArgWith(3, 'pollErr'); // stub smapi request // call skillMetaController._pollExportStatus(TEST_EXPORT_ID, (err, res) => { // verify expect(res).equal(null); expect(err).equal('pollErr'); done(); }); }); it('| poll status with getExportStatus return error response, expect callback error', (done) => { // setup sinon.stub(httpClient, 'request').callsArgWith(3, null, { statusCode: 403, body: { error: 'message' } }); // stub smapi request // call skillMetaController._pollExportStatus(TEST_EXPORT_ID, (err, res) => { // verify expect(res).equal(null); expect(err).equal(jsonView.toString({ error: 'message' })); done(); }); }); it('| poll status with getExportStatus return success, expect callback with getExportStatus response', (done) => { // setup sinon.stub(httpClient, 'request').callsArgWith(3, null, { statusCode: 200, body: { status: CONSTANTS.SKILL.PACKAGE_STATUS.SUCCEEDED }, headers: {} }); // stub smapi request // call skillMetaController._pollExportStatus(TEST_EXPORT_ID, (err, res) => { // verify expect(err).equal(null); expect(res).deep.equal({ statusCode: 200, body: { status: CONSTANTS.SKILL.PACKAGE_STATUS.SUCCEEDED }, headers: {} }); done(); }); }); }); });
42.378378
146
0.542281
02815816ec4e6f551376e5f7cf4c586f03ff0425
149
js
JavaScript
react-ui/src/views/Project/index.js
DmytroLysenko/artStudioApp
3f4ea6280d8fc2e0ca2f8de5386c7b950940893e
[ "MIT" ]
null
null
null
react-ui/src/views/Project/index.js
DmytroLysenko/artStudioApp
3f4ea6280d8fc2e0ca2f8de5386c7b950940893e
[ "MIT" ]
null
null
null
react-ui/src/views/Project/index.js
DmytroLysenko/artStudioApp
3f4ea6280d8fc2e0ca2f8de5386c7b950940893e
[ "MIT" ]
null
null
null
import React from "react"; export default function Project(props) { return <h1>One Project with id: {props.match.params.projectId}</h1>; }
21.285714
71
0.697987
02815d7ec4e10cc670f05c9d9708dec61645253c
27,318
js
JavaScript
routes/devices.js
ulidev/PTIN_VisInt
7316afeb0be3ae8a8a53fc1b436cfc5325f0abb7
[ "MIT" ]
1
2018-05-28T06:34:50.000Z
2018-05-28T06:34:50.000Z
routes/devices.js
ulidev/PTIN_VisInt
7316afeb0be3ae8a8a53fc1b436cfc5325f0abb7
[ "MIT" ]
null
null
null
routes/devices.js
ulidev/PTIN_VisInt
7316afeb0be3ae8a8a53fc1b436cfc5325f0abb7
[ "MIT" ]
null
null
null
express = require('express') url = require('url'); Device = require('../models/Device') DeviceInformation = require('../models/Device-Information') router = express.Router() socket = require("../handlers/socket-handler") service = require("../handlers/token-service") router.get('/temp', function(req, res, next){ // array per guardar els diccionaris var array = []; // mitjana de temperatura, igual per a tots els diccionaris var mitjana = 0; var resultat = []; var resultat_temp = []; var resultat_hores = ["8:00","10:00","12:00","14:00","16:00","18:00","20:00","22:00"]; var compta8 = 0; var compta10 = 0; var compta12 = 0; var compta14 = 0; var compta16 = 0; var compta18 = 0; var compta20 = 0; var compta22 = 0; let data_avui = new Date(); var dia = data_avui.getDate(); var mes = data_avui.getMonth()+1; //January is 0! var any = data_avui.getFullYear(); var now = data_avui.getHours(); var minut = data_avui.getMinutes(); // tenim 8 diccionaris, dic8 = 8 del mati, dic10 = 10 del mati, etc var dic8 = { x:mitjana, y:"8:00" }; var dic10 = { x:mitjana, y:"10:00" }; var dic12 = { x:mitjana, y:"12:00" }; var dic14 = { x:mitjana, y:"14:00" }; var dic16 = { x:mitjana, y:"16:00" }; var dic18 = { x:mitjana, y:"18:00" }; var dic20 = { x:mitjana, y:"20:00" }; var dic22 = { x:mitjana, y:"22:00" }; // get de tots els dispositius de temperatura Device.find({}, function(err, devices) { devices.forEach(function(dev){ // ok, torna tots els tipus 5 if(dev.type == 5){ dia_mod = dev.modificationDate.getDate(); mes_mod = dev.modificationDate.getMonth()+1; any_mod = dev.modificationDate.getFullYear(); // hem modificat avui, comparem dia mes i any if(dia == dia_mod && mes == mes_mod && any == any_mod){ if(dev.lastInfo!=null && dev.enabled == true) { if(dev.lastInfo.temperature!=null){ // ara tenim un dispositiu enabled que te temperatura i s'ha modificat avui // si s'ha modificat abans de les 8 sumem la temperatura al diccionari de les 8 hora = dev.modificationDate.getHours(); minuts = dev.modificationDate.getMinutes(); // augmentem tots els diccionaris sino despres al fer la mitja no u fa be if(hora < 8) { compta8++ dic8.x = dic8.x + parseFloat(dev.lastInfo.temperature) dic10.x = dic10.x + parseFloat(dev.lastInfo.temperature) dic12.x = dic12.x + parseFloat(dev.lastInfo.temperature) dic14.x = dic14.x + parseFloat(dev.lastInfo.temperature) dic16.x = dic16.x + parseFloat(dev.lastInfo.temperature) dic18.x = dic18.x + parseFloat(dev.lastInfo.temperature) dic20.x = dic20.x + parseFloat(dev.lastInfo.temperature) dic22.x = dic22.x + parseFloat(dev.lastInfo.temperature) } // la darrera modificacio sa fet entre les 8 i les 10 else if((hora >= 8 && minuts <= 59) && hora < 10) { compta10++ dic10.x = dic10.x + parseFloat(dev.lastInfo.temperature) dic12.x = dic12.x + parseFloat(dev.lastInfo.temperature) dic14.x = dic14.x + parseFloat(dev.lastInfo.temperature) dic16.x = dic16.x + parseFloat(dev.lastInfo.temperature) dic18.x = dic18.x + parseFloat(dev.lastInfo.temperature) dic20.x = dic20.x + parseFloat(dev.lastInfo.temperature) dic22.x = dic22.x + parseFloat(dev.lastInfo.temperature) } // 10 a 12 else if((hora >= 10 && minuts <= 59) && hora < 12) { compta12++ dic12.x = dic12.x + parseFloat(dev.lastInfo.temperature) dic14.x = dic14.x + parseFloat(dev.lastInfo.temperature) dic16.x = dic16.x + parseFloat(dev.lastInfo.temperature) dic18.x = dic18.x + parseFloat(dev.lastInfo.temperature) dic20.x = dic20.x + parseFloat(dev.lastInfo.temperature) dic22.x = dic22.x + parseFloat(dev.lastInfo.temperature) } // 12 a 14 else if((hora >= 12 && minuts <= 59) && hora < 14) { compta14++ dic14.x = dic14.x + parseFloat(dev.lastInfo.temperature) dic16.x = dic16.x + parseFloat(dev.lastInfo.temperature) dic18.x = dic18.x + parseFloat(dev.lastInfo.temperature) dic20.x = dic20.x + parseFloat(dev.lastInfo.temperature) dic22.x = dic22.x + parseFloat(dev.lastInfo.temperature) } // 14 a 16 else if((hora >= 14 && minuts <= 59) && hora < 16) { compta16++ dic16.x = dic16.x + parseFloat(dev.lastInfo.temperature) dic18.x = dic18.x + parseFloat(dev.lastInfo.temperature) dic20.x = dic20.x + parseFloat(dev.lastInfo.temperature) dic22.x = dic22.x + parseFloat(dev.lastInfo.temperature) } // 16 a 18 else if((hora >= 16 && minuts <= 59) && hora < 18) { compta18++ dic18.x = dic18.x + parseFloat(dev.lastInfo.temperature) dic20.x = dic20.x + parseFloat(dev.lastInfo.temperature) dic22.x = dic22.x + parseFloat(dev.lastInfo.temperature) } // 18 a 20 else if((hora >= 18 && minuts <= 59) && hora < 20) { compta20++ dic20.x = dic20.x + parseFloat(dev.lastInfo.temperature) dic22.x = dic22.x + parseFloat(dev.lastInfo.temperature) } // 20 a 22 else if((hora >= 20 && minuts <= 59) && hora < 22) { compta22++ dic22.x = dic22.x + parseFloat(dev.lastInfo.temperature) } } } } } }) // calculem mitjanes // fer mitjana a cada diccionari dic8.x = dic8.x/compta8 dic10.x = dic10.x/(compta8+compta10) dic12.x = dic12.x/(compta8+compta10+compta12) dic14.x = dic14.x/(compta8+compta10+compta12+compta14) dic16.x = dic16.x/(compta8+compta10+compta12+compta14+compta16) dic18.x = dic18.x/(compta8+compta10+compta12+compta14+compta16+compta18) dic20.x = dic20.x/(compta8+compta10+compta12+compta14+compta16+compta18+compta20) dic22.x = dic22.x/(compta8+compta10+compta12+compta14+compta16+compta18+compta20+compta22) // 8 if(now >= 8) { array.push(dic8) } else { dic8.x = null array.push(dic8) } // 10 if(now >= 10) { array.push(dic10) } else { dic10.x = null array.push(dic10) } // 12 if(now >= 12) { array.push(dic12) } else { dic12.x = null array.push(dic12) } // 14 if(now >= 14) { array.push(dic14) } else { dic14.x = null array.push(dic14) } // 16 if(now >= 16) { array.push(dic16) } else { dic16.x = null array.push(dic16) } // 18 if(now >= 18) { array.push(dic18) } else { dic18.x = null array.push(dic18) } // 20 if(now >= 20) { array.push(dic20) } else { dic20.x = null array.push(dic20) } // 22 if(now >= 22) { array.push(dic22) } else { dic22.x = null array.push(dic22) } resultat_temp[0] = dic8.x resultat_temp[1] = dic10.x resultat_temp[2] = dic12.x resultat_temp[3] = dic14.x resultat_temp[4] = dic16.x resultat_temp[5] = dic18.x resultat_temp[6] = dic20.x resultat_temp[7] = dic22.x resultat.push(resultat_temp) resultat.push(resultat_hores) }) .then(doc => { res.status(200).send(resultat) }) .catch(e => { res.status(500).send('Something went wrong') }) }) // mateix codi que adalt, canviant tipus i en ves de temperatura no2 (nitrogen) router.get('/hum', function(req, res, next){ // array per guardar els diccionaris var array = []; // mitjana de temperatura, igual per a tots els diccionaris var mitjana = 0; var resultat = []; var resultat_temp = []; var resultat_hores = ["8:00","10:00","12:00","14:00","16:00","18:00","20:00","22:00"]; var compta8 = 0; var compta10 = 0; var compta12 = 0; var compta14 = 0; var compta16 = 0; var compta18 = 0; var compta20 = 0; var compta22 = 0; let data_avui = new Date(); var dia = data_avui.getDate(); var mes = data_avui.getMonth()+1; //January is 0! var any = data_avui.getFullYear(); var now = data_avui.getHours(); var minut = data_avui.getMinutes(); // tenim 8 diccionaris, dic8 = 8 del mati, dic10 = 10 del mati, etc var dic8 = { x:mitjana, y:"8:00" }; var dic10 = { x:mitjana, y:"10:00" }; var dic12 = { x:mitjana, y:"12:00" }; var dic14 = { x:mitjana, y:"14:00" }; var dic16 = { x:mitjana, y:"16:00" }; var dic18 = { x:mitjana, y:"18:00" }; var dic20 = { x:mitjana, y:"20:00" }; var dic22 = { x:mitjana, y:"22:00" }; // get de tots els dispositius de temperatura Device.find({}, function(err, devices) { devices.forEach(function(dev){ // ok, torna tots els tipus 6 if(dev.type == 6){ dia_mod = dev.modificationDate.getDate(); mes_mod = dev.modificationDate.getMonth()+1; any_mod = dev.modificationDate.getFullYear(); // hem modificat avui, comparem dia mes i any if(dia == dia_mod && mes == mes_mod && any == any_mod){ if(dev.lastInfo!=null && dev.enabled == true) { if(dev.lastInfo.no2!=null){ // ara tenim un dispositiu enabled que te temperatura i s'ha modificat avui // si s'ha modificat abans de les 8 sumem la temperatura al diccionari de les 8 hora = dev.modificationDate.getHours(); minuts = dev.modificationDate.getMinutes(); // augmentem tots els diccionaris sino despres al fer la mitja no u fa be if(hora < 8) { compta8++ dic8.x = dic8.x + parseFloat(dev.lastInfo.no2) dic10.x = dic10.x + parseFloat(dev.lastInfo.no2) dic12.x = dic12.x + parseFloat(dev.lastInfo.no2) dic14.x = dic14.x + parseFloat(dev.lastInfo.no2) dic16.x = dic16.x + parseFloat(dev.lastInfo.no2) dic18.x = dic18.x + parseFloat(dev.lastInfo.no2) dic20.x = dic20.x + parseFloat(dev.lastInfo.no2) dic22.x = dic22.x + parseFloat(dev.lastInfo.no2) } // la darrera modificacio sa fet entre les 8 i les 10 else if((hora >= 8 && minuts <= 59) && hora < 10) { compta10++ dic10.x = dic10.x + parseFloat(dev.lastInfo.no2) dic12.x = dic12.x + parseFloat(dev.lastInfo.no2) dic14.x = dic14.x + parseFloat(dev.lastInfo.no2) dic16.x = dic16.x + parseFloat(dev.lastInfo.no2) dic18.x = dic18.x + parseFloat(dev.lastInfo.no2) dic20.x = dic20.x + parseFloat(dev.lastInfo.no2) dic22.x = dic22.x + parseFloat(dev.lastInfo.no2) } // 10 a 12 else if((hora >= 10 && minuts <= 59) && hora < 12) { compta12++ dic12.x = dic12.x + parseFloat(dev.lastInfo.no2) dic14.x = dic14.x + parseFloat(dev.lastInfo.no2) dic16.x = dic16.x + parseFloat(dev.lastInfo.no2) dic18.x = dic18.x + parseFloat(dev.lastInfo.no2) dic20.x = dic20.x + parseFloat(dev.lastInfo.no2) dic22.x = dic22.x + parseFloat(dev.lastInfo.no2) } // 12 a 14 else if((hora >= 12 && minuts <= 59) && hora < 14) { compta14++ dic14.x = dic14.x + parseFloat(dev.lastInfo.no2) dic16.x = dic16.x + parseFloat(dev.lastInfo.no2) dic18.x = dic18.x + parseFloat(dev.lastInfo.no2) dic20.x = dic20.x + parseFloat(dev.lastInfo.no2) dic22.x = dic22.x + parseFloat(dev.lastInfo.no2) } // 14 a 16 else if((hora >= 14 && minuts <= 59) && hora < 16) { compta16++ dic16.x = dic16.x + parseFloat(dev.lastInfo.no2) dic18.x = dic18.x + parseFloat(dev.lastInfo.no2) dic20.x = dic20.x + parseFloat(dev.lastInfo.no2) dic22.x = dic22.x + parseFloat(dev.lastInfo.no2) } // 16 a 18 else if((hora >= 16 && minuts <= 59) && hora < 18) { compta18++ dic18.x = dic18.x + parseFloat(dev.lastInfo.no2) dic20.x = dic20.x + parseFloat(dev.lastInfo.no2) dic22.x = dic22.x + parseFloat(dev.lastInfo.no2) } // 18 a 20 else if((hora >= 18 && minuts <= 59) && hora < 20) { compta20++ dic20.x = dic20.x + parseFloat(dev.lastInfo.no2) dic22.x = dic22.x + parseFloat(dev.lastInfo.no2) } // 20 a 22 else if((hora >= 20 && minuts <= 59) && hora < 22) { compta22++ dic22.x = dic22.x + parseFloat(dev.lastInfo.no2) } } } } } }) // calculem mitjanes // fer mitjana a cada diccionari dic8.x = dic8.x/compta8 dic10.x = dic10.x/(compta8+compta10) dic12.x = dic12.x/(compta8+compta10+compta12) dic14.x = dic14.x/(compta8+compta10+compta12+compta14) dic16.x = dic16.x/(compta8+compta10+compta12+compta14+compta16) dic18.x = dic18.x/(compta8+compta10+compta12+compta14+compta16+compta18) dic20.x = dic20.x/(compta8+compta10+compta12+compta14+compta16+compta18+compta20) dic22.x = dic22.x/(compta8+compta10+compta12+compta14+compta16+compta18+compta20+compta22) // 8 if(now >= 8) { array.push(dic8) } else { dic8.x = null array.push(dic8) } // 10 if(now >= 10) { array.push(dic10) } else { dic10.x = null array.push(dic10) } // 12 if(now >= 12) { array.push(dic12) } else { dic12.x = null array.push(dic12) } // 14 if(now >= 14) { array.push(dic14) } else { dic14.x = null array.push(dic14) } // 16 if(now >= 16) { array.push(dic16) } else { dic16.x = null array.push(dic16) } // 18 if(now >= 18) { array.push(dic18) } else { dic18.x = null array.push(dic18) } // 20 if(now >= 20) { array.push(dic20) } else { dic20.x = null array.push(dic20) } // 22 if(now >= 22) { array.push(dic22) } else { dic22.x = null array.push(dic22) } resultat_temp[0] = dic8.x resultat_temp[1] = dic10.x resultat_temp[2] = dic12.x resultat_temp[3] = dic14.x resultat_temp[4] = dic16.x resultat_temp[5] = dic18.x resultat_temp[6] = dic20.x resultat_temp[7] = dic22.x resultat.push(resultat_temp) resultat.push(resultat_hores) }) .then(doc => { res.status(200).send(resultat) }) .catch(e => { res.status(500).send('Something went wrong') }) }) router.get('/stadistics', function(req, res, next){ //Inicialitzem Arrays a 0 var ArrayA = []; var ArrayB = []; var ArrayNea = []; var ArrayExterior = []; for (i=0;i<9;i++){ ArrayA[i] = 0 ArrayB[i] = 0; ArrayNea[i] = 0; ArrayExterior[i] = 0; } Device.find({}, function(err, devices) { devices.forEach(function(dev){ if (dev.lastInfo!=null){ if(dev.lastInfo.edificio == "A"){ ArrayA[0]++; if(dev.active) ArrayA[1]++; ArrayA[dev.type+1]++ } else if(dev.lastInfo.edificio == "B") { ArrayB[0]++; if(dev.active) ArrayB[1]++; ArrayB[dev.type+1]++ } else if(dev.lastInfo.edificio == "Neapolis") { ArrayNea[0]++; if(dev.active) ArrayNea[1]++; ArrayNea[dev.type+1]++ } else { console.log("elseee") ArrayExterior[0]++; if(dev.active) ArrayExterior[1]++; ArrayExterior[dev.type+1]++ } } }) var edificiA = { total: ArrayA[0], actius: ArrayA[1], 1: ArrayA[2], 2: ArrayA[3], 3: ArrayA[4], 4: ArrayA[5], 5: ArrayA[6], 6: ArrayA[7], 7: ArrayA[8] }; var edificiB = { total: ArrayB[0], actius: ArrayB[1], 1: ArrayB[2], 2: ArrayB[3], 3: ArrayB[4], 4: ArrayB[5], 5: ArrayB[6], 6: ArrayB[7], 7: ArrayB[8] }; var edificiNea = { total: ArrayNea[0], actius: ArrayNea[1], 1: ArrayNea[2], 2: ArrayNea[3], 3: ArrayNea[4], 4: ArrayNea[5], 5: ArrayNea[6], 6: ArrayNea[7], 7: ArrayNea[8] }; var exterior = { total: ArrayExterior[0], actius: ArrayExterior[1], 1: ArrayExterior[2], 2: ArrayExterior[3], 3: ArrayExterior[4], 4: ArrayExterior[5], 5: ArrayExterior[6], 6: ArrayExterior[7], 7: ArrayExterior[8] }; let result = { "Edifici A": edificiA, "Edifici B": edificiB, "Neàpolis": edificiNea, "Exterior": exterior } res.status(200).send(result) }) .catch(e => { res.status(500).send('Internal server error') }) }) router.get('/:id', function(req, res, next){ if(req.params.id == 'count') { next() return } let query = url.parse(req.url, true).query let dict = {} let filter = '' if (query.fields) { let arr = query.fields.replace("[",'').replace("]",'').split(',') //TODO: Improve it, this is a shit filter = arr.join('') } Device.findById(req.params.id).select(filter) .then(dev => { if (!dev) res.status(404).send({message: "device doesn't exists"}) else res.status(200).send(dev) }) .catch(e => { res.status(500).send({message: 'Internal server error'}) }) }) router.get('/count', (req, res, next) => { let size = req.query.size || 20 console.log(size) Device.find().count() .then(doc => { res.status(200).send({count: Math.round(doc/size)}) }) .catch(e => { res.status(500).send('Internal server errorxw') }) }) router.get('/', function(req, res, next){ let query = url.parse(req.url, true).query let size = parseInt(query.size || 20) let page = parseInt(query.page || 1) let paginated = query.paginated || 'true' query.deleted = false query.enabled = true delete query.size delete query.page delete query.paginated if (query.name) { let regexp = new RegExp("^"+ query.name, "i"); query.name = regexp } let filter = '' if (query.fields) { let arr = query.fields.replace("[",'').replace("]",'').split(',') //TODO: Improve it, this is a shit filter = arr.join('') delete query.fields } let prom; if (paginated == 'true') { prom = Device.paginate(query, {page: page, limit: size, sort: { modificationDate: -1}, select: filter}) } else { prom = Device.find(query).sort({modificationDate: -1}).select(filter) } prom.then(docs => { console.log(docs) res.status(200).send(docs) }) .catch(e => { console.log(e) res.send({"status": "400"}) }) }) router.post('/', function(req, res, next) { let name = req.body.name let creationDate = new Date() let modificationDate = new Date() let type = req.body.type if (!name || !type) { res.status(400).send({"message": 'ERROR Fields missing'}) return } let device = new Device({ name: name, active: false, type: type, creationDate: creationDate, modificationDate: modificationDate, deleted: false, enabled: false }) device.save() .then(device => { let tok = service.createToken(device) device.token = tok device.save() res.send({"status": 201, "id": device._id, "token": device.token}) socket.deviceWasUpdated() }).catch(e => { res.send({"status": 400}) }) }) router.put('/:id/info', service.ensureDeviceAuthenticated, function(req, res, body) { if (!req.body) { res.status(400).send({"message": 'ERROR Fields missing'}) return } let modificationDate = new Date() req.body.date = modificationDate Device.findByIdAndUpdate(req.params.id,{ $set: { modificationDate: modificationDate } }) .then(device => { // if (!device.enabled){ // res.status(400).send({"message": 'Device is not enabled'}) // return // } DeviceInformation.findOneAndUpdate({'id_device': device._id}, { $push: { info: req.body } }) .then(doc => { if (!doc) { let schema = new DeviceInformation({ id_device: req.params.id, info: [ req.body ] }) schema.save() .then(doc => { device.lastInfo = req.body; device.save() res.status(201).send({'message': 'Information added to device'}) socket.deviceWasUpdated() }) .catch(e => { res.status(500).send({'message': 'Internal server error'}) }) } else { device.lastInfo = req.body; device.save() res.status(200).send({'message': 'Device information updated'}) socket.deviceWasUpdated() } }) .catch(e => { res.status(500).send({'message': 'Internal server error'}) }) }) .catch(e => { res.status(500).send({'message': 'Internal server error'}) }) }) router.put('/:id', service.ensureDeviceAuthenticated, function(req, res, body) { if (!req.body ) { res.status(400).send({"message": 'ERROR Fields missing'}) return } req.body.modificationDate = new Date().toISOString() Device.findByIdAndUpdate(req.params.id,{ $set: req.body }) .then(doc => { socket.deviceWasUpdated() res.status(200).send({"message": 'OK: Device Changed '}) }) .catch(e => { res.status(400).send({"message": 'ERROR Something went wrong'}) return }) }) router.get('/:id/delete', function(req, res, next){ Device.findByIdAndRemove(req.params.id) .then(doc => { res.send({'status': 200}) }) .catch(e => { res.send({'status': 400}) }) }) router.post('/:id/shutdown', (req, res, next) => { socket.emitShutdown(req.params.id) res.status(200).send({message: 'shutdown sent'}) }) module.exports = router
32.794718
111
0.458159
0281df3308715f715bb113385d3c491f8b9618ab
336
js
JavaScript
src/babel/transformation/transformers/es6/regex.sticky.js
pivotal-cf/babel
6564f1ff768a05837d477ca738a862b974174a33
[ "MIT" ]
null
null
null
src/babel/transformation/transformers/es6/regex.sticky.js
pivotal-cf/babel
6564f1ff768a05837d477ca738a862b974174a33
[ "MIT" ]
null
null
null
src/babel/transformation/transformers/es6/regex.sticky.js
pivotal-cf/babel
6564f1ff768a05837d477ca738a862b974174a33
[ "MIT" ]
2
2021-02-09T11:19:03.000Z
2021-10-19T03:55:59.000Z
import * as regex from "../../helpers/regex"; import t from "../../../types"; export function check(node) { return regex.is(node, "y"); } export function Literal(node) { if (!regex.is(node, "y")) return; return t.newExpression(t.identifier("RegExp"), [ t.literal(node.regex.pattern), t.literal(node.regex.flags) ]); }
22.4
50
0.636905
028320c6c7195aaa33424c517592021818c3cf2a
1,286
js
JavaScript
src/reducers/auth.js
petetnt/harvest-balance
e7fd3704843e783b5a5cc1bfb6e72a71dc8e380e
[ "ISC" ]
null
null
null
src/reducers/auth.js
petetnt/harvest-balance
e7fd3704843e783b5a5cc1bfb6e72a71dc8e380e
[ "ISC" ]
null
null
null
src/reducers/auth.js
petetnt/harvest-balance
e7fd3704843e783b5a5cc1bfb6e72a71dc8e380e
[ "ISC" ]
null
null
null
/** * Reducer for authenticating through Harvestapp. * Keeps the harvest_token and authentication state * and errors. */ import { LOGIN, LOGIN_SUCCESS, LOGIN_ERROR, LOGOUT, AUTH_URL_FETCH, AUTH_URL_SUCCESS, AUTH_URL_ERROR, } from "../actions" const auth = (state = {}, action) => { switch (action.type) { case LOGIN: return Object.assign({}, state, { status: "pending", token: null, errorDescription: null, authUrl: null, }) case LOGIN_SUCCESS: return Object.assign({}, state, { status: "success", token: action.payload, errorDescription: null, authUrl: null, }) case LOGIN_ERROR: return Object.assign({}, state, { status: "error", token: null, errorDescription: action.payload, authUrl: null, }) case AUTH_URL_FETCH: return Object.assign({}, state, { status: null, authUrl: null, }) case AUTH_URL_SUCCESS: return Object.assign({}, state, { status: null, authUrl: action.payload, }) case AUTH_URL_ERROR: return Object.assign({}, state, { status: "error", authUrl: null, errorDescription: action.payload, }) case LOGOUT: return {} default: return state } } export default auth
20.412698
51
0.612753
0283ac18da6a33c96cd041ca0ec730d0a518cc71
973
js
JavaScript
src/pages/contact.js
TahsinProduction/EliteAnswers
028612cb248af7e1a329834cb533807b81ee83f6
[ "MIT" ]
null
null
null
src/pages/contact.js
TahsinProduction/EliteAnswers
028612cb248af7e1a329834cb533807b81ee83f6
[ "MIT" ]
7
2021-05-10T12:51:06.000Z
2022-02-26T17:32:17.000Z
src/pages/contact.js
TahsinProduction/EliteAnswers
028612cb248af7e1a329834cb533807b81ee83f6
[ "MIT" ]
null
null
null
import React from 'react' import Layout from '../components/layout' import SEO from '../components/seo' const AboutPage = () => ( <Layout pageTitle="Contact Us"> <SEO title="ContactUS" keywords={[`gatsby`, `application`, `react`]} /> <div className="col-md-3"></div> <img src = "https://lh3.googleusercontent.com/9liGmQurv_ClCtUes9BVsfaFrpuODInWPKSvO_KbyBCBqq8Zub6JU8tJL5CK_zvJTqyUN9Uy6Hhd6GPcNAJ8JvXyMjjrlUE8V1EfzWj8usCdnyIJAyWDGke8LU0xwBKIu_mqUkeq" width="100%" height="auto" margin="0 auto" alt="embed" /> <center><h1>If you have any query or problem or want to say something to us then please fill the form below</h1><h1>You will receive reply shortly</h1></center> <iframe src="https://docs.google.com/forms/d/e/1FAIpQLSce1xHd5ZL2qiJzL6MBL9cguPg-4-wamSDp2wSHQPE2ZnTWEQ/viewform?embedded=true" title="TahsinProduction" width="100%" height="1450" frameborder="0" marginheight="100%" marginwidth="100%">Loading…</iframe> </Layout>) export default AboutPage
74.846154
252
0.76259
0283d3ade1deb9581e0fefa648b38c242898e5b4
1,170
js
JavaScript
src/plugins/nui-button.js
netherjs/nui
ae3363b2aaa65833e575acd05c40885071e18970
[ "BSD-3-Clause" ]
2
2019-07-25T06:05:52.000Z
2020-10-09T06:50:25.000Z
src/plugins/nui-button.js
netherjs/nui
ae3363b2aaa65833e575acd05c40885071e18970
[ "BSD-3-Clause" ]
null
null
null
src/plugins/nui-button.js
netherjs/nui
ae3363b2aaa65833e575acd05c40885071e18970
[ "BSD-3-Clause" ]
null
null
null
/*// NUI.Button /////////////////////////////////////////////////////////////// This provides a button widget that can do stuff when clicked. Amazing. /////////////////////////////////////////////////////////////////////////////*/ NUI.Button = function(opt) { var Property = { Label: 'Button', Class: null, OnClick: null }; NUI.Util.MergeProperties(opt,Property); //////////////////////// //////////////////////// this.Struct = { Root: ( jQuery('<button />') .addClass('NUI-Widget NUI-Button') .text(Property.Label) ) }; if(Property.OnClick) { this.Struct.Root .on('click',Property.OnClick); } if(Property.Class) { this.Struct.Root .addClass(Property.Class); } //////////////////////// //////////////////////// this.GetProperty = function(Key){ if(typeof Property[Key] !== "undefined") return Property[Key]; else return Property; }; this.Destroy = NUI.Traits.DestroyFromStruct; this.Get = NUI.Traits.GetFromStruct; this.Hide = NUI.Traits.HideFromStruct; this.Show = NUI.Traits.ShowFromStruct; }; NUI.Button.prototype.valueOf = NUI.Traits.GetFromStruct;
22.075472
80
0.510256
02840ba91435a5d2f4945496b6bee5b1b01f109c
1,994
js
JavaScript
src/routes.js
krgt/TBDenuncia
89470fc2a4a1e80e3c8bb775569c10e8ab3a8fb2
[ "MIT" ]
null
null
null
src/routes.js
krgt/TBDenuncia
89470fc2a4a1e80e3c8bb775569c10e8ab3a8fb2
[ "MIT" ]
null
null
null
src/routes.js
krgt/TBDenuncia
89470fc2a4a1e80e3c8bb775569c10e8ab3a8fb2
[ "MIT" ]
null
null
null
/*! ========================================================= * Material Dashboard React - v1.7.0 ========================================================= * Product Page: https://www.creative-tim.com/product/material-dashboard-react * Copyright 2019 Creative Tim (https://www.creative-tim.com) * Licensed under MIT (https://github.com/creativetimofficial/material-dashboard-react/blob/master/LICENSE.md) * Coded by Creative Tim ========================================================= * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. */ // @material-ui/icons import LocationOn from "@material-ui/icons/LocationOn"; import HomeIcon from "@material-ui/icons/Home"; // my views import Home from "views/Home/Home.jsx"; import MapaCriminal from "views/MapaCriminal/MapaCriminal.jsx"; import Estatisticas from "views/Estatisticas/Estatisticas.jsx"; import Timeline from "views/Timeline/Timeline.jsx"; import Denuncie from "views/Denuncie/Denuncie.jsx"; // my icons import { TimelineOutline, PlaylistEdit } from 'mdi-material-ui'; import ShowChart from "@material-ui/icons/ShowChart"; const dashboardRoutes = [ { path: "/home", name: "Home", rtlName: "خرائط", icon: HomeIcon, component: Home, layout: "/admin" }, { path: "/mapacriminal", name: "Mapa Criminal", rtlName: "خرائط", icon: LocationOn, component: MapaCriminal, layout: "/admin" }, { path: "/estatisticas", name: "Estatisticas", rtlName: "لوحة القيادة", icon: ShowChart, component: Estatisticas, layout: "/admin" }, { path: "/timeline", name: "Timeline", rtlName: "لوحة القيادة", icon: TimelineOutline, component: Timeline, layout: "/admin" }, { path: "/denuncie", name: "Denuncie Aqui", rtlName: "لوحة القيادة", icon: PlaylistEdit, component: Denuncie, layout: "/admin" }, ]; export default dashboardRoutes;
25.896104
128
0.626881
028423a876821eebfc17c522f1655110d1f45624
2,252
js
JavaScript
scripts/iOS/Crypto/CCHmac.js
ChD1/appmon
66616a27a65acff1fc0e665f7a6d11f5433301dd
[ "Apache-2.0" ]
null
null
null
scripts/iOS/Crypto/CCHmac.js
ChD1/appmon
66616a27a65acff1fc0e665f7a6d11f5433301dd
[ "Apache-2.0" ]
null
null
null
scripts/iOS/Crypto/CCHmac.js
ChD1/appmon
66616a27a65acff1fc0e665f7a6d11f5433301dd
[ "Apache-2.0" ]
null
null
null
/** * Copyright (c) 2016 Nishant Das Patnaik. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. **/ 'use strict'; var hexify = function (hexdump_output) { var hexified = " "; var raw_array = hexdump_output.split("\n"); for (var a = 0; a < raw_array.length; a++) { var line_array = raw_array[a].split(" "); for (var b = 1; b < line_array.length - 1; b++) { if(line_array[b].length === 2){ hexified += line_array[b]; hexified = hexified.trim() } } }; return hexified; }; Interceptor.attach(Module.findExportByName('libcommonCrypto.dylib', 'CCHmac'), { onEnter: function(args) { /* --- Payload Header --- */ var send_data = {}; send_data.time = new Date(); send_data.txnType = 'HMAC'; send_data.lib = 'libcommonCrypto.dylib'; send_data.method = 'CCHmac'; send_data.trace = trace(); send_data.artifact = []; /* --- Payload Body --- */ var data = {}; data.name = "Key"; var keyLength = args[2].toInt32(); var raw_key = hexify(hexdump(args[1], { length: keyLength })); data.value = raw_key; data.argSeq = 2; send_data.artifact.push(data); /* --- Payload Body --- */ var data = {}; data.name = "Data"; var dataLength = args[4].toInt32(); var raw_data = hexify(hexdump(args[3], { length: dataLength })); data.value = raw_data; data.argSeq = 4; send_data.artifact.push(data); send(JSON.stringify(send_data)); } /** Omitting onLeave due to performance overhead **/ /** ,onLeave: function (retval) { //console.log('Return Value: ' + Memory.readUtf8String(retval)); } **/ });
30.432432
80
0.601687
0284abd41fdc378e8b67443d0986c9281d6a67fa
14,283
js
JavaScript
test/spec/modules/zemantaBidAdapter_spec.js
optimon/Prebid.js
2d23cbc4291336050a675b061adf90b8d5063cf6
[ "Apache-2.0" ]
1
2021-07-03T02:07:16.000Z
2021-07-03T02:07:16.000Z
test/spec/modules/zemantaBidAdapter_spec.js
optimon/Prebid.js
2d23cbc4291336050a675b061adf90b8d5063cf6
[ "Apache-2.0" ]
4
2022-02-15T03:32:11.000Z
2022-03-03T22:17:14.000Z
test/spec/modules/zemantaBidAdapter_spec.js
optimon/Prebid.js
2d23cbc4291336050a675b061adf90b8d5063cf6
[ "Apache-2.0" ]
1
2021-02-12T16:57:15.000Z
2021-02-12T16:57:15.000Z
import {expect} from 'chai'; import {spec} from 'modules/zemantaBidAdapter.js'; import {config} from 'src/config.js'; import {server} from 'test/mocks/xhr'; describe('Zemanta Adapter', function () { describe('Bid request and response', function () { const commonBidRequest = { bidder: 'zemanta', params: { publisher: { id: 'publisher-id' }, }, bidId: '2d6815a92ba1ba', auctionId: '12043683-3254-4f74-8934-f941b085579e', } const nativeBidRequestParams = { nativeParams: { image: { required: true, sizes: [ 120, 100 ], sendId: true }, title: { required: true, sendId: true }, sponsoredBy: { required: false } }, } const displayBidRequestParams = { sizes: [ [ 300, 250 ] ] } describe('isBidRequestValid', function () { before(() => { config.setConfig({ zemanta: { bidderUrl: 'https://bidder-url.com', } } ) }) after(() => { config.resetConfig() }) it('should fail when bid is invalid', function () { const bid = { bidder: 'zemanta', params: { publisher: { id: 'publisher-id', } }, } expect(spec.isBidRequestValid(bid)).to.equal(false) }) it('should succeed when bid contains native params', function () { const bid = { bidder: 'zemanta', params: { publisher: { id: 'publisher-id', } }, ...nativeBidRequestParams, } expect(spec.isBidRequestValid(bid)).to.equal(true) }) it('should succeed when bid contains sizes', function () { const bid = { bidder: 'zemanta', params: { publisher: { id: 'publisher-id', } }, ...displayBidRequestParams, } expect(spec.isBidRequestValid(bid)).to.equal(true) }) it('should fail if publisher id is not set', function () { const bid = { bidder: 'zemanta', ...nativeBidRequestParams, } expect(spec.isBidRequestValid(bid)).to.equal(false) }) it('should succeed with outbrain config', function () { const bid = { bidder: 'zemanta', params: { publisher: { id: 'publisher-id', } }, ...nativeBidRequestParams, } config.resetConfig() config.setConfig({ outbrain: { bidderUrl: 'https://bidder-url.com', } }) expect(spec.isBidRequestValid(bid)).to.equal(true) }) it('should fail if bidder url is not set', function () { const bid = { bidder: 'zemanta', params: { publisher: { id: 'publisher-id', } }, ...nativeBidRequestParams, } config.resetConfig() expect(spec.isBidRequestValid(bid)).to.equal(false) }) }) describe('buildRequests', function () { before(() => { config.setConfig({ zemanta: { bidderUrl: 'https://bidder-url.com', } } ) }) after(() => { config.resetConfig() }) const commonBidderRequest = { refererInfo: { referer: 'https://example.com/' } } it('should build native request', function () { const bidRequest = { ...commonBidRequest, ...nativeBidRequestParams, } const expectedNativeAssets = { assets: [ { required: 1, id: 3, img: { type: 3, w: 120, h: 100 } }, { required: 1, id: 0, title: {} }, { required: 0, id: 5, data: { type: 1 } } ] } const expectedData = { site: { page: 'https://example.com/', publisher: { id: 'publisher-id' } }, device: { ua: navigator.userAgent }, source: { fd: 1 }, cur: [ 'USD' ], imp: [ { id: '1', native: { request: JSON.stringify(expectedNativeAssets) } } ] } const res = spec.buildRequests([bidRequest], commonBidderRequest) expect(res.url).to.equal('https://bidder-url.com') expect(res.data).to.deep.equal(JSON.stringify(expectedData)) }); it('should build display request', function () { const bidRequest = { ...commonBidRequest, ...displayBidRequestParams, } const expectedData = { site: { page: 'https://example.com/', publisher: { id: 'publisher-id' } }, device: { ua: navigator.userAgent }, source: { fd: 1 }, cur: [ 'USD' ], imp: [ { id: '1', banner: { format: [ { w: 300, h: 250 } ] } } ] } const res = spec.buildRequests([bidRequest], commonBidderRequest) expect(res.url).to.equal('https://bidder-url.com') expect(res.data).to.deep.equal(JSON.stringify(expectedData)) }) it('should pass optional tagid in request', function () { const bidRequest = { ...commonBidRequest, ...nativeBidRequestParams, } bidRequest.params.tagid = 'test-tag' const res = spec.buildRequests([bidRequest], commonBidderRequest) const resData = JSON.parse(res.data) expect(resData.imp[0].tagid).to.equal('test-tag') }); it('should pass bidder timeout', function () { const bidRequest = { ...commonBidRequest, ...nativeBidRequestParams, } const bidderRequest = { ...commonBidderRequest, timeout: 500 } const res = spec.buildRequests([bidRequest], bidderRequest) const resData = JSON.parse(res.data) expect(resData.tmax).to.equal(500) }); it('should pass GDPR consent', function () { const bidRequest = { ...commonBidRequest, ...nativeBidRequestParams, } const bidderRequest = { ...commonBidderRequest, gdprConsent: { gdprApplies: true, consentString: 'consentString', } } const res = spec.buildRequests([bidRequest], bidderRequest) const resData = JSON.parse(res.data) expect(resData.user.ext.consent).to.equal('consentString') expect(resData.regs.ext.gdpr).to.equal(1) }); it('should pass us privacy consent', function () { const bidRequest = { ...commonBidRequest, ...nativeBidRequestParams, } const bidderRequest = { ...commonBidderRequest, uspConsent: 'consentString' } const res = spec.buildRequests([bidRequest], bidderRequest) const resData = JSON.parse(res.data) expect(resData.regs.ext.us_privacy).to.equal('consentString') }); it('should pass coppa consent', function () { const bidRequest = { ...commonBidRequest, ...nativeBidRequestParams, } config.setConfig({coppa: true}) const res = spec.buildRequests([bidRequest], commonBidderRequest) const resData = JSON.parse(res.data) expect(resData.regs.coppa).to.equal(1) config.resetConfig() }); }) describe('interpretResponse', function () { it('should return empty array if no valid bids', function () { const res = spec.interpretResponse({}, []) expect(res).to.be.an('array').that.is.empty }); it('should interpret native response', function () { const serverResponse = { body: { id: '0a73e68c-9967-4391-b01b-dda2d9fc54e4', seatbid: [ { bid: [ { id: '82822cf5-259c-11eb-8a52-f29e5275aa57', impid: '1', price: 1.1, nurl: 'http://example.com/win/${AUCTION_PRICE}', adm: '{"ver":"1.2","assets":[{"id":3,"required":1,"img":{"url":"http://example.com/img/url","w":120,"h":100}},{"id":0,"required":1,"title":{"text":"Test title"}},{"id":5,"data":{"value":"Test sponsor"}}],"link":{"url":"http://example.com/click/url"},"eventtrackers":[{"event":1,"method":1,"url":"http://example.com/impression"}]}', adomain: [ 'example.co' ], cid: '3487171', crid: '28023739', cat: [ 'IAB10-2' ] } ], seat: 'acc-5537' } ], bidid: '82822cf5-259c-11eb-8a52-b48e7518c657', cur: 'USD' }, } const request = { bids: [ { ...commonBidRequest, ...nativeBidRequestParams, } ] } const expectedRes = [ { requestId: request.bids[0].bidId, cpm: 1.1, creativeId: '28023739', ttl: 360, netRevenue: false, currency: 'USD', mediaType: 'native', nurl: 'http://example.com/win/${AUCTION_PRICE}', native: { clickTrackers: undefined, clickUrl: 'http://example.com/click/url', image: { url: 'http://example.com/img/url', width: 120, height: 100 }, title: 'Test title', sponsoredBy: 'Test sponsor', impressionTrackers: [ 'http://example.com/impression', ] } } ] const res = spec.interpretResponse(serverResponse, request) expect(res).to.deep.equal(expectedRes) }); it('should interpret display response', function () { const serverResponse = { body: { id: '6b2eedc8-8ff5-46ef-adcf-e701b508943e', seatbid: [ { bid: [ { id: 'd90fe7fa-28d7-11eb-8ce4-462a842a7cf9', impid: '1', price: 1.1, nurl: 'http://example.com/win/${AUCTION_PRICE}', adm: '<div>ad</div>', adomain: [ 'example.com' ], cid: '3865084', crid: '29998660', cat: [ 'IAB10-2' ], w: 300, h: 250 } ], seat: 'acc-6536' } ], bidid: 'd90fe7fa-28d7-11eb-8ce4-13d94bfa26f9', cur: 'USD' } } const request = { bids: [ { ...commonBidRequest, ...displayBidRequestParams } ] } const expectedRes = [ { requestId: request.bids[0].bidId, cpm: 1.1, creativeId: '29998660', ttl: 360, netRevenue: false, currency: 'USD', mediaType: 'banner', nurl: 'http://example.com/win/${AUCTION_PRICE}', ad: '<div>ad</div>', width: 300, height: 250 } ] const res = spec.interpretResponse(serverResponse, request) expect(res).to.deep.equal(expectedRes) }); }) }) describe('getUserSyncs', function () { before(() => { config.setConfig({ zemanta: { usersyncUrl: 'https://usersync-url.com', } } ) }) after(() => { config.resetConfig() }) it('should return user sync if pixel enabled', function () { const ret = spec.getUserSyncs({pixelEnabled: true}) expect(ret).to.deep.equal([{type: 'image', url: 'https://usersync-url.com'}]) }) it('should return user sync if pixel enabled with outbrain config', function () { config.resetConfig() config.setConfig({ outbrain: { usersyncUrl: 'https://usersync-url.com', } }) const ret = spec.getUserSyncs({pixelEnabled: true}) expect(ret).to.deep.equal([{type: 'image', url: 'https://usersync-url.com'}]) }) it('should not return user sync if pixel disabled', function () { const ret = spec.getUserSyncs({pixelEnabled: false}) expect(ret).to.be.an('array').that.is.empty }) it('should not return user sync if url is not set', function () { config.resetConfig() const ret = spec.getUserSyncs({pixelEnabled: true}) expect(ret).to.be.an('array').that.is.empty }) }) describe('onBidWon', function () { it('should make an ajax call with the original cpm', function () { const bid = { nurl: 'http://example.com/win/${AUCTION_PRICE}', cpm: 2.1, originalCpm: 1.1, } spec.onBidWon(bid) expect(server.requests[0].url).to.equals('http://example.com/win/1.1') }); }) })
27.680233
351
0.453196
9ef995a9d911dc0f6327c822567cc7083db914a9
589
js
JavaScript
src/components/SugarValue.js
colw/cappy
56eb568d3bbaa7b2a5c9ce4a6534d348d8a81fcd
[ "MIT" ]
null
null
null
src/components/SugarValue.js
colw/cappy
56eb568d3bbaa7b2a5c9ce4a6534d348d8a81fcd
[ "MIT" ]
11
2020-06-23T16:46:10.000Z
2022-02-27T07:38:21.000Z
src/components/SugarValue.js
colw/cappy
56eb568d3bbaa7b2a5c9ce4a6534d348d8a81fcd
[ "MIT" ]
null
null
null
import React from "react"; import "./SugarValue.css"; const directionGlyph = { NONE: "⇼", TripleUp: "⤊", DoubleUp: "⇈", SingleUp: "↑", FortyFiveUp: "↗", Flat: "→", FortyFiveDown: "↘", SingleDown: "↓", DoubleDown: "⇊", TripleDown: "⤋", "NOT COMPUTABLE": "-", "RATE OUT OF RANGE": "⇕", }; const SugarValue = function ({ sgv = 0, direction = "NONE" }) { return ( <div className="main-sugar-display"> <span className="sugar">{sgv}</span> <span className="direction">{directionGlyph[direction]}</span> </div> ); }; export default SugarValue;
19.633333
68
0.585739
9ef9cb9edd27479ad96dc6658790897069cc4719
2,619
js
JavaScript
client/store/reducers/orderBookReducer.js
krisburtoft/ss
c8a6dd7a5a1452348b481228ab45964c889067ad
[ "MIT" ]
null
null
null
client/store/reducers/orderBookReducer.js
krisburtoft/ss
c8a6dd7a5a1452348b481228ab45964c889067ad
[ "MIT" ]
null
null
null
client/store/reducers/orderBookReducer.js
krisburtoft/ss
c8a6dd7a5a1452348b481228ab45964c889067ad
[ "MIT" ]
null
null
null
import Immutable from 'seamless-immutable'; import actions from 'shared/actions.json'; import _ from 'lodash'; export const name = 'orderBook'; const PAGE_SIZE = 10; // ------------------------------------ // Selectors // ------------------------------------ export const getOrderBookState = state => _.get(state, name, initialState); // ------------------------------------ // Actions // ------------------------------------ export const changePage = (pageIndex, list) => ({ type: actions.CHANGE_PAGE, payload: { list, pageIndex } }); export const loadMarket = (data) => { return (dispatch, getState) => { dispatch({ type: actions.JOIN, data }); dispatch({ type: actions.GET_MARKET_INFO, data }); } }; export const unsubscribe = (data) => ({ type: actions.UNSUBSCRIBE, data }) // ------------------------------------ // Helpers // ------------------------------------ const pageList = (list, pageIndex) => { return list.slice(pageIndex * PAGE_SIZE, (pageIndex + 1) * PAGE_SIZE); } // ------------------------------------ // Action Handlers // ------------------------------------ const ACTION_HANDLERS = { [actions.ORDERBOOKS]: (state, action) => { const { bids, asks, asksTotalPages, bidsTotalPages, asksPageIndex, bidsPageIndex } = action.payload; return state.set('orderBook', action.payload) .set('asks', asks) .set('bids', bids) .set('asksTotalPages', asksTotalPages) .set('bidsTotalPages', bidsTotalPages) .set('loading', false); }, [actions.CHANGE_PAGE]: (state, action) => { const { list, pageIndex } = action.payload; return state.set(`${list}PageIndex`, pageIndex).set(list, []).set('loading', true); }, [actions.UNSUBSCRIBE]: (state, action) => initialState, [actions.RECEIVE_MARKET_INFO]: (state, action) => state.set('marketSummary', action.payload) }; // ------------------------------------ // Reducer // ------------------------------------ const initialState = Immutable.from({ orderBook: {}, asks: [], bids: [], asksPageIndex: 0, bidsPageIndex: 0, asksTotalPages: 0, bidsTotalPages: 0, marketSummary: { id: '', name: '', baseCurrency: '' }, loading: true }); export default function orderBooksReducer(state = initialState, action) { const handler = ACTION_HANDLERS[action.type]; return handler ? handler(state, action) : state; }
27
108
0.504009
9efa292fa750d8e49eab33887608e46ecdec113e
384
js
JavaScript
src/box/animated/PositionBox.js
rhaldkhein/react-ui
963b5ab8e9926e6aac1cd0bce2930be23768dc42
[ "MIT" ]
2
2019-06-26T10:01:58.000Z
2020-09-15T00:32:59.000Z
src/box/animated/PositionBox.js
rhaldkhein/react-ui
963b5ab8e9926e6aac1cd0bce2930be23768dc42
[ "MIT" ]
null
null
null
src/box/animated/PositionBox.js
rhaldkhein/react-ui
963b5ab8e9926e6aac1cd0bce2930be23768dc42
[ "MIT" ]
1
2019-09-20T05:57:23.000Z
2019-09-20T05:57:23.000Z
import styled from 'styled-components/native' import BorderBox from './BorderBox' import { compose, position, zIndex, width, top, right, bottom, left, } from 'styled-system' const Box = styled(BorderBox)( compose( position, zIndex, width, top, right, bottom, left ) ) Box.defaultProps = { position: 'absolute' } export default Box
12.387097
45
0.640625
9efa42526e88c35baa19a3905bf90f0610ee742e
1,383
js
JavaScript
src/Persons.js
abalbi/vision
c19d9e16bed484758f56658961c2097725c05aa8
[ "MIT" ]
null
null
null
src/Persons.js
abalbi/vision
c19d9e16bed484758f56658961c2097725c05aa8
[ "MIT" ]
null
null
null
src/Persons.js
abalbi/vision
c19d9e16bed484758f56658961c2097725c05aa8
[ "MIT" ]
null
null
null
function Persons () { this.items = []; } Persons.prototype.posibility = function () { var hour = Ownb.date().getHours(); var xx = hour > 12 ? -(24 - hour) : hour; xx -= 2; var posibility; var yy = (.10 * (xx*xx))-1; if(yy < 0) yy = yy*-1; rand = Math.floor(Math.random() * 100); posibility = rand < yy; return posibility; } Persons.prototype.add = function (item) { var is_new_person; if(this.posibility()) { var person = this.new(); if(person.animation_current.constructor.name == 'WalkRightAnimation') { person.position.x = -person.position.width + 10; } if(person.animation_current.constructor.name == 'WalkLeftAnimation') { person.position.x = Saga.canvas().width; } this.items.push(person); } } Persons.prototype.new = function () { return new Person().reset(); } Persons.prototype.clean = function (persons_delete) { for (i in persons_delete) { var elem = persons_delete[i]; persons_delete.splice(i,1); this.items.splice(elem,1); } } Persons.prototype.update = function () { this.add(); var persons_delete = [] for(var i in this.items) { var person = this.items[i]; person.update(); if(Saga.canvas().width < person.position.x) { persons_delete.push(i); } if(person.position.x < 0 - 50){ persons_delete.push(i); } } this.clean(persons_delete); }
23.844828
75
0.626898
9efa4d6974bb5c09b7d6ee3490d68adaba064e5a
13,049
js
JavaScript
lib/mixins/popover.js
JeryHu2/bootstrap-vue
81dde2b3a0231daefe430fe6ce3dbdae950d5551
[ "MIT" ]
1
2019-10-09T12:57:09.000Z
2019-10-09T12:57:09.000Z
lib/mixins/popover.js
JeryHu2/bootstrap-vue
81dde2b3a0231daefe430fe6ce3dbdae950d5551
[ "MIT" ]
null
null
null
lib/mixins/popover.js
JeryHu2/bootstrap-vue
81dde2b3a0231daefe430fe6ce3dbdae950d5551
[ "MIT" ]
null
null
null
import Tether from 'tether'; import listenOnRootMixin from './listen-on-root' import { isArray, arrayIncludes } from '../utils/array'; import { keys } from '../utils/object'; // Controls which events are mapped for each named trigger, and the expected popover behavior for each. const TRIGGER_LISTENERS = { click: {click: 'toggle'}, hover: {mouseenter: 'show', mouseleave: 'hide'}, focus: {focus: 'show', blur: 'hide'} }; const PLACEMENT_PARAMS = { top: 'bottom center', bottom: 'top center', left: 'middle right', right: 'middle left' }; const TETHER_CLASS_PREFIX = 'bs-tether'; const TETHER_CLASSES = { element: false, enabled: false }; const TRANSITION_DURATION = 150; export default { mixins: [listenOnRootMixin], props: { constraints: { type: Array, default() { return []; } }, debounce: { type: [Number], default: 300, validator(value) { return value >= 0; } }, delay: { type: [Number, Object], default: 0, validator(value) { if (typeof value === 'number') { return value >= 0; } else if (value !== null && typeof value === 'object') { return typeof value.show === 'number' && typeof value.hide === 'number' && value.show >= 0 && value.hide >= 0; } return false; } }, offset: { type: String, default: '0 0', validator(value) { // Regex test for a pair of units, either 0 exactly, px, or percentage return /^((0\s?)|([+-]?[0-9]+(px|%)\s?)){2}$/.test(value); } }, placement: { type: String, default: 'top', validator: value => arrayIncludes(keys(PLACEMENT_PARAMS), value) }, popoverStyle: { type: Object, default: null }, show: { type: Boolean, default: null }, targetOffset: { type: String, default: '0 0', // Regex test for a pair of units, either 0 exactly, px, or percentage validator: value => /^((0\s?)|([+-]?[0-9]+(px|%)\s?)){2}$/.test(value) }, triggers: { type: [Boolean, String, Array], default: () => ['click', 'focus'], validator(value) { // Allow falsy value to disable all event triggers (equivalent to 'manual') in Bootstrap 4 if (value === false || value === '') { return true; } else if (typeof value === 'string') { return keys(TRIGGER_LISTENERS).indexOf(value) !== -1; } else if (isArray(value)) { const triggerKeys = keys(TRIGGER_LISTENERS); value.forEach(item => { if (arrayIncludes(triggerKeys, item)) { return false; } }); return true; } return false; } } }, data() { return { triggerState: this.show, classState: this.show, lastEvent: null }; }, computed: { /** * Arrange event trigger hooks as array for all input types. * * @return Array */ normalizedTriggers() { if (this.triggers === false) { return []; } else if (typeof this.triggers === 'string') { return [this.triggers]; } return this.triggers; }, /** * Class property to be used for Popover rendering * * @return String */ popoverAlignment() { return !this.placement || this.placement === `default` ? `popover-top` : `popover-${this.placement}`; }, /** * Determine if the Popover should be shown. * * @return Boolean */ showState() { return this.show !== false && (this.triggerState || this.show); } }, watch: { /** * Refresh Tether display properties */ constraints() { this.setOptions(); }, /** * Refresh Popover event triggers * @param {Array} newTriggers * @param {Array} oldTriggers */ normalizedTriggers(newTriggers, oldTriggers) { this.updateListeners(newTriggers, oldTriggers); }, /** * Refresh Tether display properties */ offset() { this.setOptions(); }, /** * Refresh Tether display properties */ placement() { this.setOptions(); }, /** * Affect 'show' state in response to status change * @param {Boolean} val */ showState(val) { const delay = this.getDelay(val); clearTimeout(this.$data._timeout); if (delay) { this.$data._timeout = setTimeout(() => this.togglePopover(val), delay); } else { this.togglePopover(val); } } }, methods: { /** * Add all event hooks for the given trigger * @param {String} trigger */ addListener(trigger) { // eslint-disable-next-line guard-for-in for (const item in TRIGGER_LISTENERS[trigger]) { this.$data._trigger.addEventListener(item, e => this.eventHandler(e)); } }, /** * Tidy removal of Tether object from the DOM */ destroyTether() { if (this.$data._tether && !this.showState) { this.$data._tether.destroy(); this.$data._tether = null; const regx = new RegExp('(^|[^-]\\b)(' + TETHER_CLASS_PREFIX + '\\S*)', 'g'); if (this.$data._trigger && this.$data._trigger.className) { this.$data._trigger.className = this.$data._trigger.className.replace(regx, ''); } } }, /** * Handle multiple event triggers * @param {Object} e */ eventHandler(e) { // If this event is right after a previous successful event, ignore it (debounce) if (this.normalizedTriggers.length > 1 && this.debounce > 0 && this.lastEvent !== null && e.timeStamp <= this.lastEvent + this.debounce) { return; } // Look up the expected popover action for the event // eslint-disable-next-line guard-for-in for (const trigger in TRIGGER_LISTENERS) { for (const event in TRIGGER_LISTENERS[trigger]) { if (event === e.type) { const action = TRIGGER_LISTENERS[trigger][event]; // If the expected event action is the opposite of the current state, allow it if (action === 'toggle' || (this.triggerState && action === 'hide') || (!this.triggerState && action === 'show')) { this.triggerState = !this.triggerState; this.lastEvent = e.timeStamp; } return; } } } }, /** * Get the currently applicable popover delay * * @returns Number */ getDelay(state) { if (typeof this.delay === 'object') { return state ? this.delay.show : this.delay.hide; } return this.delay; }, /** * Tether construct params for each show event. * * @return Object */ getTetherOptions() { return { attachment: PLACEMENT_PARAMS[this.placement], element: this.$data._popover, target: this.$data._trigger, classes: TETHER_CLASSES, classPrefix: TETHER_CLASS_PREFIX, offset: this.offset, constraints: this.constraints, targetOffset: this.targetOffset }; }, /** * Hide popover and fire event */ hidePopover() { this.classState = false; clearTimeout(this.$data._timeout); this.$data._timeout = setTimeout(() => { this.$data._popover.style.display = 'none'; this.destroyTether(); }, TRANSITION_DURATION); }, /** * Refresh the Popover position in order to respond to changes */ refreshPosition() { if (this.$data._tether) { this.$nextTick(() => { this.$data._tether.position(); }); } }, /** * Remove all event hooks for the given trigger * @param {String} trigger */ removeListener(trigger) { // eslint-disable-next-line guard-for-in for (const item in TRIGGER_LISTENERS[trigger]) { this.$data._trigger.removeEventListener(item, e => this.eventHandler(e)); } }, /** * Update tether options */ setOptions() { if (this.$data._tether) { this.$data._tether.setOptions(this.getTetherOptions()); } }, /** * Display popover and fire event */ showPopover() { clearTimeout(this.$data._timeout); if (!this.$data._tether) { this.$data._tether = new Tether(this.getTetherOptions()); } this.$data._popover.style.display = 'block'; // Make sure the popup is rendered in the correct location this.refreshPosition(); this.$nextTick(() => { this.classState = true; }); }, /** * Handle Popover show or hide instruction */ togglePopover(newShowState) { this.$emit('showChange', newShowState); if (newShowState) { this.showPopover(); this.emitOnRoot('shown::popover'); } else { this.hidePopover(); this.emitOnRoot('hidden::popover'); } }, /** * Study the 'triggers' component property and apply all selected triggers * @param {Array} triggers * @param {Array} appliedTriggers */ updateListeners(triggers, appliedTriggers = []) { const newTriggers = []; const removeTriggers = []; // Look for new events not yet mapped (all of them on first load) triggers.forEach(item => { if (appliedTriggers.indexOf(item) === -1) { newTriggers.push(item); } }); // Disable any removed event triggers appliedTriggers.forEach(item => { if (triggers.indexOf(item) === -1) { removeTriggers.push(item); } }); // Apply trigger mapping changes newTriggers.forEach(item => this.addListener(item)); removeTriggers.forEach(item => this.removeListener(item)); } }, created() { this.listenOnRoot('hide::popover', () => { this.triggerState = false; }); }, mounted() { // Configure tether this.$data._trigger = this.$refs.trigger.children[0] || this.$refs.trigger; this.$data._popover = this.$refs.popover; this.$data._popover.style.display = 'none'; this.$data._tether = new Tether(this.getTetherOptions()); this.$data._timeout = 0; // Add listeners for specified triggers and complementary click event this.updateListeners(this.normalizedTriggers); // Display popover if prop is set on load if (this.showState) { this.showPopover(); } }, updated() { this.refreshPosition(); }, beforeDestroy() { this.normalizedTriggers.forEach(item => this.removeListener(item)); clearTimeout(this.$data._timeout); this.destroyTether(); }, destroyed() { // Tether is moving the popover element outside of Vue's control and leaking dom nodes if (this.$data._popover.parentElement === document.body) { document.body.removeChild(this.$data._popover); } } };
33.718346
150
0.477738
9efa614aac1ec6a9ff8bc16550ede6e21625e7c9
1,054
js
JavaScript
src/views/login/index.js
guowenfh/react-cnode
4084769e126882acda55bf61b2eb2f3a279bc318
[ "MIT" ]
1
2018-06-27T14:32:11.000Z
2018-06-27T14:32:11.000Z
src/views/login/index.js
guowenfh/react-cnode
4084769e126882acda55bf61b2eb2f3a279bc318
[ "MIT" ]
null
null
null
src/views/login/index.js
guowenfh/react-cnode
4084769e126882acda55bf61b2eb2f3a279bc318
[ "MIT" ]
null
null
null
'use strict'; import React, { Component } from 'react'; import { RaisedButton } from 'material-ui'; import { AppBar } from 'material-ui'; import './login.scss'; class Login extends Component { constructor(props) { super(props); this.state = {}; } Touch() { fetch('https://cnodejs.org/api/v1/topic/5433d5e4e737cbe96dcef312', { method: 'get', dataType: 'json' }) .then(response => { return response.json(); // => 返回一个 `Promise` 对象 }) .then(data => { console.log(data); // 真正地数据结果 }) .catch(error => { console.log(error); }); } render() { return ( <div> <h1 className="login">这里是helDefaultlo组件! </h1> <AppBar title="Title" iconClassNameRight="muidocs-icon-navigation-expand-more" /> <RaisedButton label="Default" onTouchTap={ this .Touch .bind(this) } /> </div> ); } } export default Login
25.707317
89
0.508539
9efbca45a07fe07246d58d5340c9451c941d6703
3,117
js
JavaScript
src/scene/lighting/lighting-params.js
rafern/engine
a25d5163345af9812cd991213870ba33bfc0af7f
[ "BSD-3-Clause" ]
null
null
null
src/scene/lighting/lighting-params.js
rafern/engine
a25d5163345af9812cd991213870ba33bfc0af7f
[ "BSD-3-Clause" ]
null
null
null
src/scene/lighting/lighting-params.js
rafern/engine
a25d5163345af9812cd991213870ba33bfc0af7f
[ "BSD-3-Clause" ]
null
null
null
import { Vec3 } from '../../math/vec3.js'; import { math } from '../../math/math.js'; import { SHADOW_PCF3 } from '../constants.js'; class LightingParams { constructor(supportsAreaLights, maxTextureSize, dirtyLightsFnc) { this._maxTextureSize = maxTextureSize; this._supportsAreaLights = supportsAreaLights; this._dirtyLightsFnc = dirtyLightsFnc; this._areaLightsEnabled = false; this._cells = new Vec3(10, 3, 10); this._maxLightsPerCell = 255; this._shadowsEnabled = true; this._shadowType = SHADOW_PCF3; this._shadowAtlasResolution = 2048; this._cookiesEnabled = false; this._cookieAtlasResolution = 2048; // atlas split strategy // null: per frame split atlas into equally sized squares for each shadowmap needed // array: first number specifies top subdivision of the atlas, following numbers split next level (2 levels only) this.atlasSplit = null; // Layer ID of a layer for which the debug clustering is rendered this.debugLayer = undefined; } set cells(value) { this._cells.copy(value); } get cells() { return this._cells; } set maxLightsPerCell(value) { this._maxLightsPerCell = math.clamp(value, 1, 255); } get maxLightsPerCell() { return this._maxLightsPerCell; } set cookieAtlasResolution(value) { this._cookieAtlasResolution = math.clamp(value, 32, this._maxTextureSize); } get cookieAtlasResolution() { return this._cookieAtlasResolution; } set shadowAtlasResolution(value) { this._shadowAtlasResolution = math.clamp(value, 32, this._maxTextureSize); } get shadowAtlasResolution() { return this._shadowAtlasResolution; } set shadowType(value) { if (this._shadowType !== value) { this._shadowType = value; // lit shaders need to be rebuilt this._dirtyLightsFnc(); } } get shadowType() { return this._shadowType; } set cookiesEnabled(value) { if (this._cookiesEnabled !== value) { this._cookiesEnabled = value; // lit shaders need to be rebuilt this._dirtyLightsFnc(); } } get cookiesEnabled() { return this._cookiesEnabled; } set areaLightsEnabled(value) { // ignore if not supported if (this._supportsAreaLights) { if (this._areaLightsEnabled !== value) { this._areaLightsEnabled = value; // lit shaders need to be rebuilt this._dirtyLightsFnc(); } } } get areaLightsEnabled() { return this._areaLightsEnabled; } set shadowsEnabled(value) { if (this._shadowsEnabled !== value) { this._shadowsEnabled = value; // lit shaders need to be rebuilt this._dirtyLightsFnc(); } } get shadowsEnabled() { return this._shadowsEnabled; } } export { LightingParams };
25.54918
121
0.604748
9efbe6ab9fced6955c88e63ee18eb626848d9a32
96,719
js
JavaScript
dist/main.e28aaa441375a793ced2.bundle.js
Team-Directive16/VirtEx
fc090feec904d37f37dc22963ac76f78d431d86b
[ "MIT" ]
null
null
null
dist/main.e28aaa441375a793ced2.bundle.js
Team-Directive16/VirtEx
fc090feec904d37f37dc22963ac76f78d431d86b
[ "MIT" ]
null
null
null
dist/main.e28aaa441375a793ced2.bundle.js
Team-Directive16/VirtEx
fc090feec904d37f37dc22963ac76f78d431d86b
[ "MIT" ]
null
null
null
webpackJsonp([0,3],{161:function(t,e,n){"use strict";n.d(e,"a",function(){return r});var r;!function(t){t[t.BID=0]="BID",t[t.ASK=1]="ASK"}(r||(r={}))},20:function(t,e,n){"use strict";var r=n(233),o=n(350),i=n(560),a=n(561),s=n(562),c=n(563),l=n(564);n.d(e,"e",function(){return r.a}),n.d(e,"g",function(){return o.a}),n.d(e,"f",function(){return i.a}),n.d(e,"b",function(){return a.a}),n.d(e,"c",function(){return s.a}),n.d(e,"a",function(){return c.a}),n.d(e,"d",function(){return l.a})},233:function(t,e,n){"use strict";var r=n(0),o=n(112),i=n(19);n.d(e,"a",function(){return c});var a=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},s=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},c=function(){function t(t,e){var n=this;this._af=t,this._router=e,this.authenticatedUser={email:null},this._af.auth.subscribe(function(t){null!=t?(n.authenticatedUser.email=t.auth.email.toString(),console.log(n.authenticatedUser.email+" signed-in")):console.log(n.authenticatedUser.email+" signed-out")})}return t.prototype.getUser=function(){return this._af.auth},t.prototype.signUp=function(t){var e=this;return this._af.auth.createUser({email:t.email,password:t.password}).then(function(n){return e._af.database.object("/profiles/"+n.auth.uid).set({username:null!=t.username?t.username:"",email:n.auth.email,displayName:t.firstName+" "+t.lastName,birth:null!=t.birthDate?t.birthDate:"",gender:null!=t.gender?t.gender:"",photoURL:null!=t.photoURL?t.photoURL:""})},function(t){return console.trace(t),Promise.reject(t)}).then(function(){return e._router.navigate(["/profile"]),Promise.resolve(!0)},function(t){return e._router.navigate(["/signup"]),Promise.resolve(!1)})},t.prototype.login=function(t){var e=this;return this._af.auth.login({email:t.email,password:t.password},{provider:i.b.Password,method:i.c.Password}).then(function(){return e._router.navigate(["/exchange"]),Promise.resolve(!0)},function(t){return console.log(t.message),e._router.navigate(["/login"]),Promise.resolve(!1)})},t.prototype.logout=function(){this._af.auth.logout(),this.authenticatedUser.email=null,this._router.navigate(["/exchange"])},t.prototype.providerSet=function(t){switch(t){case"Google":return i.b.Google;case"Facebook":return i.b.Facebook}},t=a([n.i(r.R)(),s("design:paramtypes",["function"==typeof(e="undefined"!=typeof i.a&&i.a)&&e||Object,"function"==typeof(c="undefined"!=typeof o.a&&o.a)&&c||Object])],t);var e,c}()},234:function(t,e,n){"use strict";var r=n(0),o=n(19),i=n(565),a=n(566),s=n(567),c=n(161),l=n(568);n.d(e,"a",function(){return f});var d=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},u=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},f=function(){function t(t){this._afDB=t,this.orderID=0,this.data={privateOrderBook:new a.a,tradeHistory:{}},this.bidOrders=[],this.askOrders=[],this.aggregatedOrderBookBidsList=this._afDB.list("/aggregated-order-book/bids"),this.aggregatedOrderBookAsksList=this._afDB.list("/aggregated-order-book/asks"),this.bidOrdersList=this._afDB.list("/bid-orders"),this.askOrdersList=this._afDB.list("/ask-orders"),this.tradesHistoryList=this._afDB.list("/trades-history")}return t.prototype.onOrder=function(t,e,n,r){this.matcherOnNewOrder(new s.a(++this.orderID,t,e,n,r,t))},t.prototype.matcherOnNewOrder=function(t){var e=this.match(t,t.isBid()?this.askOrders:this.bidOrders);if(e){for(var n=0,r=e.isBid()?this.bidOrders:this.askOrders;r[n]&&r[n].hasBetterPrice(e);)n++;this.onNewOrder(e),r.splice(n,0,e)}},t.prototype.match=function(t,e){console.log("match (toMatch: Order, ...");for(var n=t;e[0]&&n.canMatch(e[0]);){var r=e[0],o=Math.min(n.quantity,r.quantity);if(this.onNewTrade(new l.a(o,r.priceRate,n.action)),!(n.quantity>=r.quantity))return e[0]=r.reduceQuantity(n.quantity),null;if(this.onMatchedOrder(r),e.splice(0,1),n.quantity===r.quantity)return null;n=n.reduceQuantity(r.quantity)}return n},t.prototype.onNewTrade=function(t){console.log("matcher: new trade",t),this.tradesHistoryList.push(t)},t.prototype.onNewOrder=function(t){console.log("matcher: new order: ",t.id,t.quantity,t.priceRate,c.a[t.action],t.userUID,t.initialQuantity),this.data.privateOrderBook.add(t);t.isBid()?i.a.add(this.aggregatedOrderBookBidsList,t):i.a.add(this.aggregatedOrderBookAsksList,t)},t.prototype.onMatchedOrder=function(t){console.log("matcher: matched order",t.id,t.priceRate,t.quantity),this.data.privateOrderBook.remove(t);t.isBid()?i.a.reduce(this.aggregatedOrderBookBidsList,t.quantity,t.priceRate):i.a.reduce(this.aggregatedOrderBookAsksList,t.quantity,t.priceRate)},t=d([n.i(r.R)(),u("design:paramtypes",["function"==typeof(e="undefined"!=typeof o.d&&o.d)&&e||Object])],t);var e}()},349:function(t,e,n){"use strict";var r=n(0),o=n(406),i=(n.n(o),n(20));n.d(e,"a",function(){return c});var a=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},s=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},c=function(){function t(t){this.auth=t,this.defaultUserPhotoURL="http://www.freeiconspng.com/uploads/profile-icon-9.png"}return t.prototype.ngOnInit=function(){var t=this;this.subscription=this.auth.getUser().map(function(t){return t.auth.providerData[0]}).subscribe(function(e){return t.user=e}),console.log(this.user)},t.prototype.ngOnDestroy=function(){this.subscription.unsubscribe()},t=a([n.i(r.G)({selector:"app-profile",template:n(756),styles:[n(741)]}),s("design:paramtypes",["function"==typeof(e="undefined"!=typeof i.e&&i.e)&&e||Object])],t);var e}()},350:function(t,e,n){"use strict";var r=n(0),o=n(112),i=n(233),a=n(406),s=(n.n(a),n(780));n.n(s);n.d(e,"a",function(){return d});var c=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},l=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},d=function(){function t(t,e){this._authService=t,this._router=e}return t.prototype.canActivate=function(t,e){var n=this;return this._authService.getUser().map(function(t){return!!t||void n._router.navigate(["/login"])}).first()},t=c([n.i(r.R)(),l("design:paramtypes",["function"==typeof(e="undefined"!=typeof i.a&&i.a)&&e||Object,"function"==typeof(a="undefined"!=typeof o.a&&o.a)&&a||Object])],t);var e,a}()},351:function(t,e,n){"use strict";var r=n(0);n.d(e,"a",function(){return a});var o=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},i=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=function(){function t(){}return t.prototype.ngOnInit=function(){},t=o([n.i(r.G)({selector:"app-exchange",template:n(762)}),i("design:paramtypes",[])],t)}()},352:function(t,e,n){"use strict";var r=n(0),o=n(20),i=n(551);n.d(e,"a",function(){return c});var a=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},s=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},c=function(){function t(t){this.faqService=t,this.question={title:"",body:""}}return t.prototype.create=function(){this.faqService.create(this.question)},a([n.i(r.B)(),s("design:type","function"==typeof(e="undefined"!=typeof i.Faq&&i.Faq)&&e||Object)],t.prototype,"question",void 0),t=a([n.i(r.G)({selector:"app-ask",template:n(764),styles:[n(744)]}),s("design:paramtypes",["function"==typeof(c="undefined"!=typeof o.c&&o.c)&&c||Object])],t);var e,c}()},353:function(t,e,n){"use strict";var r=n(0),o=n(20);n.d(e,"a",function(){return s});var i=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},a=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},s=function(){function t(t){this.faqService=t}return t.prototype.ngOnInit=function(){var t=this;this.subscription=this.faqService.getFaq().subscribe(function(e){return t.faq=e})},t.prototype.ngOnDestroy=function(){this.subscription.unsubscribe()},t=i([n.i(r.G)({selector:"app-faq",template:n(765),styles:[n(745)]}),a("design:paramtypes",["function"==typeof(e="undefined"!=typeof o.c&&o.c)&&e||Object])],t);var e}()},354:function(t,e,n){"use strict";var r=n(0),o=n(19);n.d(e,"a",function(){return s});var i=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},a=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},s=function(){function t(t){this._af=t}return t.prototype.ngOnInit=function(){},t=i([n.i(r.G)({selector:"app-home",template:n(766),styles:[n(746)]}),a("design:paramtypes",["function"==typeof(e="undefined"!=typeof o.a&&o.a)&&e||Object])],t);var e}()},355:function(t,e,n){"use strict";var r=n(0),o=n(81),i=n(86),a=(n.n(i),n(70)),s=n(20);n.d(e,"a",function(){return d});var c=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},l=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},d=function(){function t(t,e,n,r){this._authService=t,this._title=e,this._fb=n,this._notificationsService=r}return t.prototype.onSignIn=function(t){var e=this;return this.myForm.invalid||!this.myForm.value?void this._notificationsService.error("Incorrect email or password","Please, try again"):void this._authService.login(t).then(function(t){t?e._notificationsService.success("Success","User: "+e._authService.authenticatedUser.email+" successfully signed-in"):e._notificationsService.error("Error","Incorrect email, password or connection problems")})},t.prototype.ngOnInit=function(){this._title.setTitle("Sign in"),this.myForm=this._fb.group({email:["",[o.a.required,o.a.minLength(3)]],password:["",[o.a.required,o.a.minLength(6)]]})},t=c([n.i(r.G)({selector:"app-login",template:n(767),styles:[n(747)]}),l("design:paramtypes",["function"==typeof(e="undefined"!=typeof s.e&&s.e)&&e||Object,"function"==typeof(d="undefined"!=typeof a.c&&a.c)&&d||Object,"function"==typeof(u="undefined"!=typeof o.b&&o.b)&&u||Object,"function"==typeof(f="undefined"!=typeof i.NotificationsService&&i.NotificationsService)&&f||Object])],t);var e,d,u,f}()},356:function(t,e,n){"use strict";var r=n(0),o=n(112),i=n(20);n.d(e,"a",function(){return c});var a=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},s=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},c=function(){function t(t,e,n){this.newsService=t,this.route=e,this.router=n,this.detail={title:"",body:"",createdOn:"",byUser:""}}return t.prototype.ngOnInit=function(){var t,e=this;this.route.params.subscribe(function(e){return t=e.id}),this.subscription=this.newsService.getById(t).subscribe(function(t){return e.detail=t})},t.prototype.ngOnDestroy=function(){this.subscription.unsubscribe()},t=a([n.i(r.G)({selector:"app-news-details",template:n(769),styles:[n(749)]}),s("design:paramtypes",["function"==typeof(e="undefined"!=typeof i.a&&i.a)&&e||Object,"function"==typeof(c="undefined"!=typeof o.b&&o.b)&&c||Object,"function"==typeof(l="undefined"!=typeof o.a&&o.a)&&l||Object])],t);var e,c,l}()},357:function(t,e,n){"use strict";var r=n(0),o=n(20);n.d(e,"a",function(){return s});var i=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},a=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},s=function(){function t(t,e){this.newsService=t,this.commentsService=e}return t.prototype.ngOnInit=function(){var t=this;this.subscription=this.newsService.getNews().subscribe(function(e){return t.news=e})},t.prototype.delete=function(t){this.newsService.remove(t)},t.prototype.ngOnDestroy=function(){this.subscription.unsubscribe()},t=i([n.i(r.G)({selector:"app-news",template:n(770),styles:[n(750)]}),a("design:paramtypes",["function"==typeof(e="undefined"!=typeof o.a&&o.a)&&e||Object,"function"==typeof(s="undefined"!=typeof o.b&&o.b)&&s||Object])],t);var e,s}()},358:function(t,e,n){"use strict";var r=n(0),o=n(81),i=n(86),a=(n.n(i),n(70)),s=n(20);n.d(e,"a",function(){return d});var c=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},l=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},d=function(){function t(t,e,n,r){this._fb=t,this._title=e,this._authService=n,this._notificationsService=r}return t.prototype.onSignUp=function(){var t=this;return this.myForm.invalid?void this._notificationsService.error("Incorrect email or password","Please, try again"):void this._authService.signUp(this.myForm.value).then(function(e){e?t._notificationsService.success("Welcome!","User: "+t._authService.authenticatedUser.email+" registered successfully"):t._notificationsService.error("Error","Duplicate user or connection problems")})},t.prototype.ngOnInit=function(){this.myForm=this._fb.group({email:["",o.a.compose([o.a.required,this.isEmail])],password:["",o.a.required],confirmPassword:["",o.a.compose([o.a.required,this.isEqualPassword.bind(this)])]}),this._title.setTitle("Sign up")},t.prototype.isEmail=function(t){if(!t.value.match(/^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$/))return{noEmail:!0}},t.prototype.isEqualPassword=function(t){return this.myForm?t.value!==this.myForm.controls.password.value?{passwordsNotMatch:!0}:void 0:{passwordsNotMatch:!0}},t=c([n.i(r.G)({selector:"app-signup",template:n(771),styles:[n(751)]}),l("design:paramtypes",["function"==typeof(e="undefined"!=typeof o.b&&o.b)&&e||Object,"function"==typeof(d="undefined"!=typeof a.c&&a.c)&&d||Object,"function"==typeof(u="undefined"!=typeof s.e&&s.e)&&u||Object,"function"==typeof(f="undefined"!=typeof i.NotificationsService&&i.NotificationsService)&&f||Object])],t);var e,d,u,f}()},359:function(t,e,n){"use strict";var r=n(0),o=n(112),i=n(20);n.d(e,"a",function(){return c});var a=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},s=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},c=function(){function t(t,e,n){this.supportService=t,this.route=e,this.router=n,this.ticket={title:"",body:"",by:"",createdOn:""}}return t.prototype.ngOnInit=function(){var t,e=this;this.route.params.subscribe(function(e){return t=e.id}),this.subscription=this.supportService.getTicket(t).subscribe(function(t){return e.ticket=t})},t.prototype.ngOnDestroy=function(){this.subscription.unsubscribe()},t=a([n.i(r.G)({selector:"app-ticket-detail",template:n(772)}),s("design:paramtypes",["function"==typeof(e="undefined"!=typeof i.d&&i.d)&&e||Object,"function"==typeof(c="undefined"!=typeof o.b&&o.b)&&c||Object,"function"==typeof(l="undefined"!=typeof o.a&&o.a)&&l||Object])],t);var e,c,l}()},360:function(t,e,n){"use strict";var r=n(0),o=n(86),i=(n.n(o),n(20));n.d(e,"a",function(){return c});var a=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},s=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},c=function(){function t(t,e,n){this.supportService=t,this.auth=e,this.notif=n}return t.prototype.ngOnInit=function(){this.ticket={title:"",body:"",createdOn:(new Date).toJSON().slice(0,10),by:this.auth.authenticatedUser.email}},t.prototype.create=function(){return this.ticket.title&&this.ticket.body?(this.supportService.addSupportTicket(this.ticket),void(this.ticket={title:"",body:"",createdOn:(new Date).toJSON().slice(0,10),by:this.auth.authenticatedUser.email})):void this.notif.error("Title or content missing!","You left some fields empty.")},t=a([n.i(r.G)({selector:"app-submit-ticket",template:n(773),styles:[n(752)]}),s("design:paramtypes",["function"==typeof(e="undefined"!=typeof i.d&&i.d)&&e||Object,"function"==typeof(c="undefined"!=typeof i.e&&i.e)&&c||Object,"function"==typeof(l="undefined"!=typeof o.NotificationsService&&o.NotificationsService)&&l||Object])],t);var e,c,l}()},361:function(t,e,n){"use strict";var r=n(0),o=n(20);n.d(e,"a",function(){return s});var i=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},a=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},s=function(){function t(t){this.supportService=t,this.defaultAvatar="http://www.freeiconspng.com/uploads/profile-icon-9.png"}return t.prototype.ngOnInit=function(){var t=this;this.subscription=this.supportService.getSupportTickets().subscribe(function(e){return t.supportTickets=e})},t.prototype.ngOnDestroy=function(){this.subscription.unsubscribe()},t=i([n.i(r.G)({selector:"app-support",template:n(774),styles:[n(753)]}),a("design:paramtypes",["function"==typeof(e="undefined"!=typeof o.d&&o.d)&&e||Object])],t);var e}()},362:function(t,e,n){"use strict";var r=n(0);n.d(e,"a",function(){return a});var o=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},i=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=function(){function t(){}return t.prototype.ngOnInit=function(){},t=o([n.i(r.G)({selector:"app-terms",template:n(775),styles:[n(754)]}),i("design:paramtypes",[])],t)}()},402:function(t,e){t.exports="\n.col{\n width:33%;\n margin:15px 10px 0 15px;\n float:left;\n border:1px solid #91abac;\n}\n\n.col .head{\n background-color:#f3f7f7;\n height:80px;\n position:relative;\n border-bottom:2px solid #52a058;\n}\n\n.col .head .name{\n text-transform:uppercase;\n font-size:22px;\n float:left;\n margin:10px 10px;\n}\n\n.col .head .info{\n float:left;\n clear:left;\n font-size:12px;\n margin-left:10px;\n}\n\n.col .head .info .desc{\n float:left;\n width:100px;\n}\n\n.col .head .info .details{\n float:left;\n}\n\n.col .head .info .details .num{\n border-bottom:1px dotted;\n border-right:1px solid transparent;\n display:inline-block;\n cursor:pointer;\n line-height:13px;\n}\n\n.col .head .info .details .currency{\n display:inline;\n}\n\n.col .head .linkContainer{\n font-size:10px;\n position:absolute;\n top:10px;\n right:12px;\n}\n\n.col .head .link{\n float:right;\n}\n\n.col .head .link2{\n float:right;\n}\n\n.col .data{\n background-color:#dcecec;\n background-image:-webkit-linear-gradient(#dcecec, #fff);\n background-image:linear-gradient(#dcecec, #fff);\n width:100%;\n height:195px;\n font-size:12px;\n}\n\n.col .data .top{\n margin:15px 10% 0;\n float:left;\n width:80%;\n}\n\n@media only screen and (max-width: 1300px){\n .col .data .top{\n width:90%;\n margin:15px 5% 0;\n }\n}\n\n.col .data .stopLimitWarning{\n clear:both;\n padding:5px 10% 0;\n font-size:10px;\n height:34px;\n box-sizing:border-box;\n}\n\n@media only screen and (max-width: 1300px){\n .col .data .stopLimitWarning{\n padding:5px 5% 0;\n }\n}\n\n.col .data .row{\n float:left;\n clear:left;\n margin-bottom:10px;\n width:100%;\n display:table-row;\n min-height:24px;\n}\n\n.col .data .row .desc{\n display:table-cell;\n float:left;\n margin-top:3px;\n}\n\n@media only screen and (max-width: 1300px){\n .col .data .row .desc{\n font-size:11px;\n }\n}\n\n.col .data .row .details{\n display:table-cell;\n width:70%;\n float:right;\n border:1px solid #91abac;\n border-radius:5px;\n background-clip:padding-box;\n box-shadow:inset 0 0 0 #eeeeee;\n font-size:13px;\n background-color:#e2e5e6;\n color:#728186;\n}\n\n.col .data .row .details .num{\n float:right;\n padding:2px 5px 0 0;\n width:70%;\n text-align:right;\n line-height:initial;\n}\n\n.col .data .row .details .num input{\n float:right;\n border:none;\n width:100%;\n text-align:right;\n margin:0;\n padding:0;\n background-color:transparent;\n box-shadow:inset 0 0 0 transparent;\n}\n\n.col .data .row .details .currency{\n float:right;\n color:#fff;\n background:#76848b;\n font-weight:700;\n padding:3px 0;\n width:42px;\n text-align:center;\n border-radius:0 5px 5px 0;\n font-size:11px;\n margin:-1px;\n}\n\n.col .data .row .details.grey{\n background-color:#e2e5e6;\n color:#43575e;\n box-shadow:inset 0 0 0 #eeeeee;\n}\n\n.col .data .bottom{\n float:left;\n clear:left;\n padding-top:10px;\n width:80%;\n margin:0 10% 15px;\n border-top:1px dotted #b1b1b1;\n border-right:1px solid transparent;\n}\n\n@media only screen and (max-width: 1300px){\n .col .data .bottom{\n width:90%;\n margin:0 5% 15px;\n }\n}\n\n.col .data .bottom .cta{\n float:right;\n}\n\n.col .data .bottom .cta button{\n padding:4px 13px;\n}\n\n.col .data .bottom .cta.left{\n margin-right:10px;\n}"},403:function(t,e){t.exports="\nli span.desc{\n font-weight:bold;\n}\n\ntable{\n border-collapse:separate;\n border-spacing:4px;\n}\n\ntable.orderBook td:last-child{\n border-right:none;\n}\n\ntable.orderBook td.currency{\n text-align:right;\n}\n\n.mainBox{\n width:33%;\n float:left;\n margin:30px 10px 0 15px;\n}\n\n.mainBox .loading p{\n margin-top:130px;\n color:#0b7076;\n}\n\n.mainBox .head{\n height:30px;\n float:left;\n width:100%;\n}\n\n.mainBox .head .name{\n font-size:22px;\n float:left;\n text-transform:uppercase;\n}\n\n.mainBox .head .info{\n float:right;\n font-size:12px;\n margin-top:4px;\n}\n\n.mainBox .head .info div{\n display:inline;\n}\n\n.mainBox .head .info .num{\n font-weight:700;\n}\n\n.mainBox .data{\n float:left;\n width:100%;\n height:383px;\n border:1px solid #91abac;\n box-sizing:border-box;\n overflow:hidden;\n}\n\n.mainBox .data table{\n width:100%;\n font-size:12px;\n border-bottom:none;\n}\n\n.mainBox .data table th{\n cursor:default;\n}\n\n.mainBox .lendingBalances{\n height:auto;\n}\n\ntable.dataTable{\n border-collapse:collapse;\n border-spacing:0;\n width:100%;\n}\n\ntable.dataTable thead tr{\n text-align:left;\n border-bottom:none;\n}\n\ntable.dataTable thead, table.dataTable th{\n white-space:nowrap;\n text-align:left;\n background-color:#b3d5d6;\n}\n\ntable.dataTable th{\n cursor:pointer;\n border-left:1px solid #e0eeee;\n}\n\ntable.dataTable th.sorting .fa-caret-down{\n color:#b3d5d6;\n display:inline;\n}\n\ntable.dataTable th.sorting_desc .fa-caret-down{\n color:#1e2324;\n display:inline;\n}\n\ntable.dataTable td{\n text-align:right;\n border-left:1px solid #e0eeee;\n}\n\ntable.dataTable tr{\n border-bottom:1px solid #e0eeee;\n}\n\ntable.dataTable tr:nth-child(even){\n background-color:#f3f7f7;\n}\n"},420:function(t,e){function n(t){throw new Error("Cannot find module '"+t+"'.")}n.keys=function(){return[]},n.resolve=n,t.exports=n,n.id=420},421:function(t,e,n){"use strict";var r=n(574),o=(n.n(r),n(508)),i=n(0),a=n(573),s=n(544);a.a.production&&n.i(i._40)(),n.i(o.a)().bootstrapModule(s.a)},537:function(t,e,n){"use strict";n.d(e,"a",function(){return r});var r={apiKey:"AIzaSyAra35ie7SFEZpExoQmYAuFAY-gXDfwngU",authDomain:"virtex-d95cd.firebaseapp.com",databaseURL:"https://virtex-d95cd.firebaseio.com",storageBucket:"virtex-d95cd.appspot.com",messagingSenderId:"521546189377"}},543:function(t,e,n){"use strict";var r=n(0);n.d(e,"a",function(){return a});var o=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},i=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=function(){function t(){}return t=o([n.i(r.G)({selector:"app-root",template:n(755),styles:[n(740)]}),i("design:paramtypes",[])],t)}()},544:function(t,e,n){"use strict";var r=n(70),o=n(0),i=n(81),a=n(504),s=n(86),c=(n.n(s),n(19)),l=n(537),d=n(543),u=n(354),f=n(357),p=n(356),h=n(362),b=n(352),m=n(353),y=n(361),g=n(359),v=n(360),x=n(351),w=n(355),R=n(358),O=n(349),k=n(547),_=n(569),j=n(546),S=n(559),B=n(571),T=n(570),C=n(572),P=n(20),q=n(234),D=n(556),I=n(545);n.d(e,"a",function(){return U});var F=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},L=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},U=function(){function t(){}return t=F([n.i(o.I)({declarations:[d.a,k.a,u.a,f.a,p.a,h.a,m.a,b.a,y.a,g.a,v.a,x.a,w.a,R.a,_.a,j.a,S.a,B.a,T.a,C.a,O.a,D.a,D.b,D.c],imports:[r.d,s.SimpleNotificationsModule,i.e,a.a,i.f,I.a,c.e.initializeApp(l.a)],providers:[P.g,P.e,P.c,P.a,P.b,P.f,P.d,q.a],bootstrap:[d.a]}),L("design:paramtypes",[])],t)}()},545:function(t,e,n){"use strict";var r=n(112),o=n(354),i=n(351),a=n(357),s=n(356),c=n(362),l=n(353),d=n(352),u=n(361),f=n(359),p=n(360),h=n(355),b=n(358),m=n(349),y=n(350);n.d(e,"a",function(){return v});var g=[{path:"",component:o.a,pathMatch:"full"},{path:"exchange",component:i.a,pathMatch:"full"},{path:"news",component:a.a},{path:"news/:id",component:s.a},{path:"terms",component:c.a},{path:"faq",component:l.a},{path:"ask",component:d.a,canActivate:[y.a]},{path:"support",component:u.a,canActivate:[y.a]},{path:"support/:id",component:f.a,canActivate:[y.a]},{path:"submit",component:p.a,canActivate:[y.a]},{path:"login",component:h.a},{path:"signup",component:b.a},{path:"profile",component:m.a,canActivate:[y.a]}],v=r.c.forRoot(g)},546:function(t,e,n){"use strict";var r=n(0),o=n(81),i=n(19),a=n(234),s=n(161);n.d(e,"a",function(){return d});var c=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},l=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},d=function(){function t(t,e){this._af=t,this._tradeService=e,this.amount=2,this.rate=3}return t.prototype.ngOnInit=function(){this.buyForm=new o.c({buyAmount:new o.d("0",o.a.compose([o.a.required,this.isValidNumber])),buyRate:new o.d("0",o.a.compose([o.a.required,this.isValidNumber])),buyTotal:new o.d({value:"0",disabled:!0},o.a.compose([o.a.required,this.isValidNumber]))})},t.prototype.ngDoCheck=function(){this.total=this.amount*this.rate},t.prototype.placeBidOrder=function(){return console.log("amount: ",this.amount),console.log("rate: ",this.rate),console.log("total: ",this.total),console.log(this.buyForm.value),this._tradeService.onOrder(this.amount,this.rate,s.a.BID,this._af.auth.getAuth().uid),!1},t.prototype.isValidNumber=function(t){ if(isNaN(+t.value)||+t.value<=0)return{notAPositiveNumber:!0}},t=c([n.i(r.G)({selector:"app-buy-box",template:n(757),styles:[n(402)]}),l("design:paramtypes",["function"==typeof(e="undefined"!=typeof i.a&&i.a)&&e||Object,"function"==typeof(d="undefined"!=typeof a.a&&a.a)&&d||Object])],t);var e,d}()},547:function(t,e,n){"use strict";var r=n(0),o=n(19),i=n(86),a=(n.n(i),n(233));n.d(e,"a",function(){return l});var s=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},c=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},l=function(){function t(t,e,n){this._af=t,this._authService=e,this._notificationsService=n,this.options={timeOut:4e3,position:["top","left"],showProgressBar:!1,preventDuplicates:!0}}return t.prototype.onLogout=function(){this._authService.logout(),this._notificationsService.success("Success","User: "+this._authService.authenticatedUser.email+" successfully signed-out")},t=s([n.i(r.G)({selector:"app-header",template:n(758),styles:[n(742)]}),c("design:paramtypes",["function"==typeof(e="undefined"!=typeof o.a&&o.a)&&e||Object,"function"==typeof(l="undefined"!=typeof a.a&&a.a)&&l||Object,"function"==typeof(d="undefined"!=typeof i.NotificationsService&&i.NotificationsService)&&d||Object])],t);var e,l,d}()},548:function(t,e){},549:function(t,e){},550:function(t,e){},551:function(t,e,n){"use strict";var r=n(549),o=(n.n(r),n(550)),i=(n.n(o),n(552)),a=(n.n(i),n(554)),s=(n.n(a),n(548)),c=(n.n(s),n(553));n.n(c);n.o(r,"Faq")&&n.d(e,"Faq",function(){return r.Faq}),n.o(o,"Faq")&&n.d(e,"Faq",function(){return o.Faq}),n.o(i,"Faq")&&n.d(e,"Faq",function(){return i.Faq}),n.o(a,"Faq")&&n.d(e,"Faq",function(){return a.Faq}),n.o(s,"Faq")&&n.d(e,"Faq",function(){return s.Faq}),n.o(c,"Faq")&&n.d(e,"Faq",function(){return c.Faq})},552:function(t,e){},553:function(t,e){},554:function(t,e){},555:function(t,e,n){"use strict";var r=n(0);n.d(e,"a",function(){return a});var o=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},i=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=function(){function t(){}return t.prototype.transform=function(t,e){return""===e?t:t.filter(function(t){return t.name.toLowerCase().includes(e.toLowerCase())})},t=o([n.i(r.J)({name:"filterPosts"}),i("design:paramtypes",[])],t)}()},556:function(t,e,n){"use strict";var r=n(555),o=n(557),i=n(558);n.d(e,"a",function(){return r.a}),n.d(e,"c",function(){return o.a}),n.d(e,"b",function(){return i.a})},557:function(t,e,n){"use strict";var r=n(0);n.d(e,"a",function(){return a});var o=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},i=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=function(){function t(){}return t.prototype.transform=function(t,e,n){return e?"Ascending"===n?t.sort(function(t,n){return t[e].toString().localeCompare(n[e].toString())}):t.sort(function(t,n){return n[e].toString().localeCompare(t[e].toString())}):t.sort()},t=o([n.i(r.J)({name:"orderNews"}),i("design:paramtypes",[])],t)}()},558:function(t,e,n){"use strict";var r=n(0);n.d(e,"a",function(){return a});var o=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},i=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=function(){function t(){}return t.prototype.transform=function(t,e){return e?t.sort(function(t,n){return t[e].toString().localeCompare(n[e].toString())}):t.sort()},t=o([n.i(r.J)({name:"sortApp"}),i("design:paramtypes",[])],t)}()},559:function(t,e,n){"use strict";var r=n(0),o=n(81),i=n(19),a=n(234),s=n(161);n.d(e,"a",function(){return d});var c=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},l=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},d=function(){function t(t,e){this._af=t,this._tradeService=e,this.amount=2,this.rate=3,this.sellForm=new o.c({sellAmount:new o.d("0",o.a.compose([o.a.required,this.isValidNumber])),sellRate:new o.d("0",o.a.compose([o.a.required,this.isValidNumber])),sellTotal:new o.d({value:"0",disabled:!0},o.a.compose([o.a.required,this.isValidNumber]))})}return t.prototype.ngOnInit=function(){},t.prototype.ngDoCheck=function(){this.total=this.amount*this.rate},t.prototype.placeAskOrder=function(){return console.log("amount: ",this.amount),console.log("rate: ",this.rate),console.log("total: ",this.total),console.log(this.sellForm.value),this._tradeService.onOrder(this.amount,this.rate,s.a.ASK,this._af.auth.getAuth().uid),!1},t.prototype.isValidNumber=function(t){if(isNaN(+t.value)||+t.value<=0)return{notAPositiveNumber:!0}},t=c([n.i(r.G)({selector:"app-sell-box",template:n(759),styles:[n(402)]}),l("design:paramtypes",["function"==typeof(e="undefined"!=typeof i.a&&i.a)&&e||Object,"function"==typeof(d="undefined"!=typeof a.a&&a.a)&&d||Object])],t);var e,d}()},560:function(t,e,n){"use strict";var r=n(0),o=n(19);n.d(e,"a",function(){return s});var i=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},a=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},s=function(){function t(t){this.af=t,this.chat=this.af.list("/chat")}return t.prototype.getChat=function(){return this.af.list("/chat")},t.prototype.create=function(t){this.chat.push(t)},t.prototype.remove=function(t){this.chat.remove(t)},t=i([n.i(r.R)(),a("design:paramtypes",["function"==typeof(e="undefined"!=typeof o.d&&o.d)&&e||Object])],t);var e}()},561:function(t,e,n){"use strict";var r=n(0),o=n(19);n.d(e,"a",function(){return s});var i=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},a=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},s=function(){function t(t){this.af=t,this.comments=this.af.list("/comments")}return t.prototype.getComments=function(){return this.af.list("/comments")},t.prototype.create=function(t){this.comments.push(t)},t.prototype.remove=function(t){this.comments.remove(t)},t.prototype.update=function(t,e){this.comments.update(t,e)},t.prototype.getCount=function(){return this.af.list("/comments").map(function(t){return t.length})},t=i([n.i(r.R)(),a("design:paramtypes",["function"==typeof(e="undefined"!=typeof o.d&&o.d)&&e||Object])],t);var e}()},562:function(t,e,n){"use strict";var r=n(0),o=n(19);n.d(e,"a",function(){return s});var i=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},a=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},s=function(){function t(t){this.af=t,this.faq=this.af.list("/faq")}return t.prototype.getFaq=function(){return this.af.list("/faq")},t.prototype.create=function(t){this.faq.push(t)},t.prototype.remove=function(t){this.faq.remove(t)},t.prototype.update=function(t,e){this.faq.update(t,e)},t=i([n.i(r.R)(),a("design:paramtypes",["function"==typeof(e="undefined"!=typeof o.d&&o.d)&&e||Object])],t);var e}()},563:function(t,e,n){"use strict";var r=n(0),o=n(19);n.d(e,"a",function(){return s});var i=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},a=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},s=function(){function t(t){this.af=t,this.newsList=this.af.list("/news")}return t.prototype.getNews=function(){return this.af.list("/news")},t.prototype.getById=function(t){return this.af.object("/news/"+t)},t.prototype.create=function(t){this.newsList.push(t)},t.prototype.update=function(t,e){this.newsList.update(t,e).then(function(){return console.log("news updated")})},t.prototype.remove=function(t){this.newsList.remove(t).then(function(){return console.log("news deleted")})},t=i([n.i(r.R)(),a("design:paramtypes",["function"==typeof(e="undefined"!=typeof o.d&&o.d)&&e||Object])],t);var e}()},564:function(t,e,n){"use strict";var r=n(0),o=n(19);n.d(e,"a",function(){return s});var i=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},a=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},s=function(){function t(t){this.af=t,this.supportList=this.af.list("/support")}return t.prototype.getSupportTickets=function(){return this.af.list("/support")},t.prototype.addSupportTicket=function(t){this.supportList.push(t)},t.prototype.getTicket=function(t){return this.af.object("/support/"+t)},t.prototype.removeSupportTicket=function(t){this.supportList.remove(t)},t.prototype.updateSupportTicket=function(t,e){this.supportList.update(t,e)},t=i([n.i(r.R)(),a("design:paramtypes",["function"==typeof(e="undefined"!=typeof o.d&&o.d)&&e||Object])],t);var e}()},565:function(t,e,n){"use strict";n.d(e,"a",function(){return r});var r=function(){function t(){}return t.add=function(t,e){var n,r=Number(e.quantity),o=(e.priceRate+"").replace(".","p");return t.$ref.ref.child(o).once("value",function(i){if(i.exists()){var a=Number(i.exportVal());r+=a,console.log("1: prevQuantity: ",a),console.log("2: quantity: ",r),n="change"}else console.log("2: quantity: ",r),n="new";return t.$ref.ref.child(o).set(r),{type:n,data:{price:e.priceRate,quantity:r}}})},t.reduce=function(t,e,n){var r,o=(n+"").replace(".","p");return t.$ref.ref.child(o).once("value",function(i){return r=Number(i.exportVal()),r-=Number(e),t.$ref.ref.child(o).set(r),0===r?(t.$ref.ref.child(o).remove(),{type:"removal",data:{price:n}}):{type:"change",data:{price:n,quantity:r}}})},t}()},566:function(t,e,n){"use strict";n.d(e,"a",function(){return r});var r=function(){function t(){this.orderBookMap={}}return t.prototype.get=function(t){return this.orderBookMap[t]||[]},t.prototype.add=function(t){this.orderBookMap[t.userUID]||(this.orderBookMap[t.userUID]=[]),this.orderBookMap[t.userUID].push(t)},t.prototype.change=function(t,e){var n=this.orderBookMap[t.userUID].indexOf(e);this.orderBookMap[t.userUID].splice(n,1,t)},t.prototype.remove=function(t){var e=this.orderBookMap[t.userUID].indexOf(t);this.orderBookMap[t.userUID].splice(e,1)},t}()},567:function(t,e,n){"use strict";var r=n(161);n.d(e,"a",function(){return o});var o=function(){function t(t,e,n,r,o,i){this.id=t,this.quantity=e,this.priceRate=n,this.action=r,this.userUID=o,this.initialQuantity=i,null==this.initialQuantity&&(this.initialQuantity=this.quantity),this.created=-1*Date.now(),Object.freeze(this)}return t.prototype.isBid=function(){return this.action===r.a.BID},t.prototype.canMatch=function(t){return this.isBid()!==t.isBid()&&(this.isBid()?this.priceRate>=t.priceRate:this.priceRate<=t.priceRate)},t.prototype.hasBetterPrice=function(t){if(this.isBid()!==t.isBid())throw new Error("Cannot compare prices between orders with different actions");return this.isBid()?this.priceRate>=t.priceRate:this.priceRate<=t.priceRate},t.prototype.reduceQuantity=function(e){return new t(this.id,this.quantity-e,this.priceRate,this.action,this.userUID,this.initialQuantity)},t}()},568:function(t,e,n){"use strict";n.d(e,"a",function(){return r});var r=function(){function t(t,e,n){this.quantity=t,this.priceRate=e,this.aggressor=n,this.created=-1*Date.now(),Object.freeze(this)}return t}()},569:function(t,e,n){"use strict";var r=n(0),o=n(19),i=n(20);n.d(e,"a",function(){return c});var a=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},s=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},c=function(){function t(t,e,n){this.chatService=t,this.auth=e,this._af=n}return t.prototype.ngOnInit=function(){var t=this;this.chat={text:"",username:""},this.subscription=this.chatService.getChat().subscribe(function(e){return t.chats=e})},t.prototype.send=function(){this.chat.username=this.auth.authenticatedUser.email||"No one",this.chatService.create(this.chat),this.chat={text:"",username:""}},t.prototype.clear=function(){this.chatService.remove()},t.prototype.ngOnDestroy=function(){this.subscription.unsubscribe()},t=a([n.i(r.G)({selector:"app-trollbox",template:n(760),styles:[n(743)]}),s("design:paramtypes",["function"==typeof(e="undefined"!=typeof i.f&&i.f)&&e||Object,"function"==typeof(c="undefined"!=typeof i.e&&i.e)&&c||Object,"function"==typeof(l="undefined"!=typeof o.a&&o.a)&&l||Object])],t);var e,c,l}()},570:function(t,e,n){"use strict";var r=n(0);n.d(e,"a",function(){return a});var o=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},i=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=function(){function t(){}return t.prototype.ngOnInit=function(){},t=o([n.i(r.G)({selector:"app-buy-orders",template:n(761),styles:[n(403)]}),i("design:paramtypes",[])],t)}()},571:function(t,e,n){"use strict";var r=n(0);n.d(e,"a",function(){return a});var o=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},i=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=function(){function t(){}return t.prototype.ngOnInit=function(){},t=o([n.i(r.G)({selector:"app-sell-orders",template:n(763),styles:[n(403)]}),i("design:paramtypes",[])],t)}()},572:function(t,e,n){"use strict";var r=n(0),o=n(86),i=(n.n(o),n(19)),a=n(20);n.d(e,"a",function(){return l});var s=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},c=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},l=function(){function t(t,e,n){this.commentsService=t,this.notif=e,this.af=n,this.comment={title:"",body:""}}return t.prototype.ngOnInit=function(){var t=this;this.subscription=this.commentsService.getComments().subscribe(function(e){return t.comments=e})},t.prototype.createComment=function(){return this.comment.title&&this.comment.body?(this.commentsService.create(this.comment),void(this.comment={title:"",body:""})):void this.notif.error("Title or content missing!","You left some fields blank. Please, fill them up.")},t.prototype.ngOnDestroy=function(){this.subscription.unsubscribe()},t=s([n.i(r.G)({selector:"app-comment",template:n(768),styles:[n(748)]}),c("design:paramtypes",["function"==typeof(e="undefined"!=typeof a.b&&a.b)&&e||Object,"function"==typeof(l="undefined"!=typeof o.NotificationsService&&o.NotificationsService)&&l||Object,"function"==typeof(d="undefined"!=typeof i.a&&i.a)&&d||Object])],t);var e,l,d}()},573:function(t,e,n){"use strict";n.d(e,"a",function(){return r});var r={production:!0}},574:function(t,e,n){"use strict";var r=n(597),o=(n.n(r),n(590)),i=(n.n(o),n(586)),a=(n.n(i),n(592)),s=(n.n(a),n(591)),c=(n.n(s),n(589)),l=(n.n(c),n(588)),d=(n.n(l),n(596)),u=(n.n(d),n(585)),f=(n.n(u),n(584)),p=(n.n(f),n(594)),h=(n.n(p),n(587)),b=(n.n(h),n(595)),m=(n.n(b),n(593)),y=(n.n(m),n(598)),g=(n.n(y),n(798));n.n(g)},740:function(t,e){t.exports=".container{\r\n margin:0;\r\n padding:0;\r\n}\r\n"},741:function(t,e){t.exports=".userPhoto img{\r\n width:200px;\r\n height:200px;\r\n}\r\n"},742:function(t,e){t.exports='*{\n box-sizing:content-box;\n}\n\n*:focus{\n outline:0;\n}\n\n::-moz-selection{\n color:#ffffff;\n background:#0b7076;\n}\n\n::selection{\n color:#ffffff;\n background:#0b7076;\n}\n\n::-moz-selection{\n color:#ffffff;\n background:#0b7076;\n}\n\na{\n text-decoration:none;\n color:inherit;\n}\n\n.header{\n width:100%;\n height:48px;\n float:left;\n background-color:#0a6970;\n background-image:-webkit-linear-gradient(#0a6970, #086066 10%, #06595e 65%);\n background-image:linear-gradient(#0a6970, #086066 10%, #06595e 65%);\n border-bottom:1px solid #031e21;\n}\n\n.header:after{\n content:"";\n display:table;\n clear:both;\n}\n\n@media only screen and (max-width: 955px){\n .header{\n height:38px;\n }\n}\n\n.header .logo{\n float:left;\n height:100%;\n background-color:#042f32;\n background-image:-webkit-radial-gradient(#042f32, #04272a 90%);\n background-image:-webkit-radial-gradient( #042f32, #04272a 90%);\n background-image:radial-gradient( #042f32, #04272a 90%);\n}\n\n.header .logo a img{\n padding:11px 30px;\n width:161px;\n height:27px;\n -webkit-transition-duration:0.4s;\n transition-duration:0.4s;\n}\n\n@media only screen and (max-width: 955px){\n .header .logo a img{\n width:107px;\n height:17px;\n }\n}\n\n.header .tabs.right{\n float:right;\n border-right:none;\n}\n\n.header .tabs.right.loggedOut{\n border-left:0;\n}\n\n.header .tabs.right.loggedOut li.message{\n border-left:0;\n text-transform:none;\n font-weight:normal;\n}\n\n.header .tabs.right.loggedOut li.message:hover{\n background-color:transparent;\n}\n\n.header .tabs.right.loggedOut li.message .title{\n cursor:default;\n}\n\n.header .tabs.right.loggedOut li.message a{\n padding:0;\n float:none;\n text-decoration:underline;\n}\n\n.header .tabs.right.loggedOut li.message a:hover{\n color:#ffab06;\n}\n\n.header .tabs{\n float:left;\n border-left:1px solid #06393b;\n border-right:1px solid #0b6e74;\n}\n\n.header .tabs ul{\n list-style:none;\n padding:0;\n margin:0;\n}\n\n.header .tabs ul > li{\n position:relative;\n border-left:1px solid #0b6e74;\n border-right:1px solid #06393b;\n font-weight:bold;\n text-transform:uppercase;\n font-size:14px;\n text-shadow:0 1px 1px #06393b;\n display:table-cell;\n}\n\n.header .tabs ul > li .beta{\n color:#e39706;\n font-size:10px;\n display:block;\n position:absolute;\n top:6px;\n right:16px;\n}\n\n@media only screen and (max-width: 955px){\n .header .tabs ul > li{\n font-size:11px;\n }\n}\n\n.header .tabs ul > li:hover{\n background-color:#07494c;\n border-left:1px solid #07494c;\n}\n\n.header .tabs ul > li a, .header .tabs ul > li .title{\n color:#e3eced;\n padding:15px;\n float:left;\n white-space:nowrap;\n}\n\n@media only screen and (max-width: 955px){\n .header .tabs ul > li a, .header .tabs ul > li .title{\n padding:13px 8px 11px 8px;\n }\n}\n\n.header .tabs ul > li.icon a, .header .tabs ul > li.icon .title{\n padding:15px 12px;\n}\n\n@media only screen and (max-width: 955px){\n .header .tabs ul > li.icon a, .header .tabs ul > li.icon .title{\n padding:13px 6px 11px 12px;\n }\n}\n\n.header .tabs ul > li .title{\n cursor:default;\n}\n\n.header .tabs ul > li a.title{\n cursor:pointer;\n}\n\n.header .tabs ul > li .fa.dim{\n color:#a1c3c5;\n}\n\n.header .tabs ul > li .fa-caret-down{\n margin-left:2px;\n}\n\n.header .tabs ul > li > ul{\n clear:left;\n display:none;\n position:absolute;\n z-index:100;\n top:100%;\n left:-2px;\n background-color:#07494c;\n margin-top:-1px;\n min-width:110px;\n right:-1px;\n left:auto;\n}\n\n.header .tabs ul > li > ul > li{\n float:left;\n border-top:1px solid #042728;\n border-left:none;\n border-right:none;\n font-size:12px;\n color:#fff;\n width:100%;\n}\n\n@media only screen and (max-width: 955px){\n .header .tabs ul > li > ul > li{\n font-size:11px;\n }\n}\n\n.header .tabs ul > li > ul > li:hover{\n border-left:0;\n background-color:#06393b;\n}\n\n.header .tabs ul > li > ul > li a{\n width:80%;\n}\n\n.header .tabs ul > li > ul > li .info{\n color:#789091;\n text-transform:none;\n padding:13px 13px 0;\n}\n\n.header .tabs ul > li > ul > li.active{\n border-left:0;\n background-color:#06393b;\n}\n\n.header .tabs ul > li > ul > li > ul{\n display:none;\n position:absolute;\n z-index:99;\n top:0px;\n right:108px;\n left:auto;\n border-right:1px solid #042728;\n box-shadow:2px 2px 3px rgba(0, 0, 0, 0.6);\n}\n\n.header .tabs ul > li > ul > li > ul > li{\n background-color:#06393b;\n}\n\n.header .tabs ul > li > ul > li > ul > li:hover{\n background-color:#052c2d;\n}\n\n.header .tabs ul .mobileNav{\n display:none;\n}\n\n@media only screen and (max-width: 1015px){\n .header .tabs ul .desktopNav{\n display:none;\n }\n .header .tabs ul .mobileNav{\n display:table-cell;\n }\n}\n\n.header .tabs ul li.alerts > ul{\n margin-top:0;\n}\n\n.header .tabs ul > li:hover > ul{\n display:block;\n}\n\n.header .tabs ul li.active{\n background-color:#07494c;\n border-left:1px solid #07494c;\n}\n\n.header .tabs ul li.active a{\n color:#fff;\n}\n\n.header .tabs ul .icon{\n color:#e3eced;\n cursor:pointer;\n width:40px;\n box-shadow:inset 1 2 2 #CCC;\n}\n\n.header .tabs ul .icon ul{\n left:auto;\n right:0;\n}\n\n.header .tabs ul .themeSwitch ul{\n border-radius:8px;\n background-clip:padding-box;\n box-shadow:1px 1px 3px rgba(0, 0, 0, 0.8);\n margin-top:8px;\n right:6px;\n cursor:default;\n}\n\n.header .tabs ul .themeSwitch ul li{\n text-transform:none;\n white-space:nowrap;\n padding:5px 9px;\n border:none;\n}\n\n.header .tabs ul .themeSwitch ul li:hover{\n cursor:default;\n background:none;\n}\n\n.header .tabs ul .themeSwitch ul .fa-caret-up{\n position:absolute;\n top:-12px;\n right:34px;\n color:#07494c;\n font-size:18px;\n text-shadow:none;\n}\n\n.header .tabs ul .alerts{\n border-right:none;\n}\n\n.header .tabs ul .alerts .title{\n cursor:default;\n}\n\n.header .tabs ul .alerts:hover{\n background-color:#e9d457;\n border-left:1px solid #ab9834;\n}\n\n.header .tabs ul .alerts:hover .title{\n text-shadow:0 1px 1px #ab9834;\n}\n\n.header .tabs ul .alerts:hover .fa{\n color:#1e2324;\n}\n\n.header .tabs ul .alerts .alert{\n color:#1e2324;\n text-shadow:none;\n background-color:#e9d457;\n border-left:6px solid #ffab06;\n width:600px;\n font-weight:400;\n border-top:none;\n padding:14px 20px 20px;\n cursor:default;\n box-shadow:3px 3px 3px rgba(0, 0, 0, 0.4);\n}\n\n@media only screen and (max-width: 955px){\n .header .tabs ul .alerts .alert{\n width:500px;\n }\n}\n\n.header .tabs ul .alerts .alert .head{\n font-size:22px;\n float:left;\n}\n\n.header .tabs ul .alerts .alert .dismiss{\n float:right;\n cursor:pointer;\n font-size:13px;\n text-transform:none;\n}\n\n.header .tabs ul .alerts .alert .dismiss span{\n text-decoration:underline;\n}\n\n.header .tabs ul .alerts .alert .msg{\n clear:both;\n float:left;\n font-size:14px;\n text-transform:none;\n}\n\n.header .tabs ul .alerts .alert .date{\n clear:both;\n float:left;\n font-size:10px;\n text-transform:none;\n color:#a49229;\n}\n\n.header .tabs ul .alerts .alert a{\n padding:0;\n float:none;\n text-decoration:underline;\n color:#1e2324;\n}\n\n.header .tabs ul .alerts.closed{\n background-color:#e9d457;\n border-left:1px solid #ab9834;\n}\n\n.header .tabs ul .alerts.closed .title{\n text-shadow:0 1px 1px #ab9834;\n}\n\n.header .tabs ul .alerts.closed .fa{\n color:#1e2324;\n}\n\n.header .tabs ul .alerts.closed.notice{\n background-color:#fbf4c8;\n}\n\n.header .tabs ul .alerts.dismissed .dismiss{\n display:none;\n}\n\n.header .tabs ul .alerts .dismiss:hover, .header .tabs ul .alerts .dismiss:hover .fa{\n color:#6c5e0c;\n}\n\n.header .tabs ul .alerts.notice .alert{\n background-color:#fbf4c8;\n border-color:#e39706;\n}\n\n.header .tabs ul .alerts.notice:hover{\n background-color:#fbf4c8;\n border-color:#e39706;\n}\n\n.header .tabs ul .alerts.inactive:hover{\n background-color:#E3ECED;\n border-left:1px solid #86989A;\n}\n\n.header .tabs ul .alerts.inactive:hover .title{\n text-shadow:0 1px 1px #86989A;\n}\n\n.header .tabs ul .alerts.inactive:hover .fa{\n color:#1B5356;\n}\n\n.header .tabs ul .alerts.inactive .alert{\n color:#1B5356;\n background-color:#E3ECED;\n border-left:6px solid #608082;\n width:400px;\n padding:20px;\n}\n\n.header .tabs ul .alerts.inactive .alert .head, .header .tabs ul .alerts.inactive .alert .date{\n display:none;\n}\n\n.header .tabs ul .alerts.inactive .alert .date{\n color:#608082;\n}'},743:function(t,e){t.exports=".side{\n float:right;\n margin:15px;\n min-width:1px;\n}\n\n.side .box,\nbody.trollboxPage .trollbox{\n border:1px solid #b3d5d6;\n margin-bottom:15px;\n}\n\n.side .box .head,\nbody.trollboxPage .trollbox .head{\n height:40px;\n background-color:#b3d5d6;\n border-bottom:1px solid #0b7076;\n font-size:22px;\n line-height:40px;\n}\n\n.side .box .head .name,\nbody.trollboxPage .trollbox .head .name{\n margin:0 10px;\n color:#3a4449;\n text-transform:uppercase;\n}\n\n.side .messageBox{\n font-size:13px;\n background-color:#f3f7f7;\n border-top:1px solid #b3d5d6;\n max-height:1000px;\n padding:10px;\n}\n\n#TrollboxContainer .trollbox .trollboxTable a,\nbody.trollboxPage .trollbox .trollboxTable a{\n cursor:pointer;\n}\n\n#TrollboxContainer .trollbox .trollboxTable,\nbody.trollboxPage .trollbox .trollboxTable{\n font-size:12px;\n}\n\n#TrollboxContainer .trollbox .trollboxTable td,\nbody.trollboxPage .trollbox .trollboxTable td{\n padding:3px 13px 3px 10px;\n word-wrap:break-word;\n line-height:initial;\n word-break:break-word;\n}\n\n#TrollboxContainer .trollbox .data,\nbody.trollboxPage .trollbox .data{\n background:#f9fbfb;\n height:270px;\n max-height:2500px;\n}\n\na:hover{\n text-decoration:underline;\n}\n\n#trollbox-scroll{\n overflow:scroll;\n}\n\na.standard:hover,\n.matchLink:hover,\n.matchlink:hover,\np>a:hover{\n color:#e39706;\n}\n\n.send,\n.clear{\n padding:6px;\n margin:0;\n border-radius:0;\n color:#fff;\n background-color:#0b7076;\n}\n"},744:function(t,e){t.exports="*{\r\n margin-left:50px;\r\n text-align:justify;\r\n}\r\n\r\nh4{\r\n color:#0b7076;\r\n}\r\n\r\n.ask{\r\n border-radius:0;\r\n color:#fff;\r\n background-color:#0b7076;\r\n}\r\n\r\n.title{\r\n width:860px;\r\n}\r\n"},745:function(t,e){t.exports="*{\r\n margin-left:50px;\r\n text-align:justify;\r\n}\r\n\r\nh3{\r\n color:#0b7076;\r\n}\r\n\r\n.container{\r\n margin-top:15px;\r\n font-size:16px;\r\n}\r\n\r\n#ask{\r\n float:right;\r\n}\r\n"},746:function(t,e){t.exports='.bg{\r\n margin:0;\r\n padding:0;\r\n width:1350px;\r\n height:650px;\r\n background:url("http://www.noobpreneur.com/wp-content/uploads/2016/03/trade-online.jpg") no-repeat center center fixed;\r\n background-size:cover;\r\n background-color:transparent;\r\n}\r\n\r\nul{\r\n list-style-type:none;\r\n}\r\n\r\n#page-wrap{\r\n position:relative;\r\n top:100px;\r\n width:400px;\r\n margin:50px auto;\r\n padding:20px;\r\n color:white;\r\n background:#0b7076;\r\n opacity:0.9;\r\n box-shadow:0 0 20px black;\r\n}\r\n\r\nli{\r\n display:inline-block;\r\n}\r\n\r\nli{\r\n font:15px/2 Georgia, Serif;\r\n margin:0 0 30px 0;\r\n text-indent:40px;\r\n}\r\n\r\nh4{\r\n font:19px/2 Georgia, Serif;\r\n margin:0 0 10px 0;\r\n text-indent:30px;\r\n}\r\n\r\nh5{\r\n font:17px/2 Georgia, Serif;\r\n margin:0 0 30px 0;\r\n text-indent:30px;\r\n}\r\n\r\n.login-link{\r\n color:white;\r\n}\r\n'},747:function(t,e){t.exports=".container{\r\n margin-top:50px;\r\n}\r\n\r\nh3{\r\n padding-bottom:15px;\r\n}\r\n\r\n.sign-in{\r\n margin-top:10px;\r\n border-radius:0;\r\n float:right;\r\n}\r\n"},748:function(t,e){t.exports=".box,\r\n.comment-collapse{\r\n margin-left:50px;\r\n}\r\n\r\n.comment-collapse{\r\n display:block;\r\n padding-top:40px;\r\n}\r\n\r\n.comment-box{\r\n margin-left:50px;\r\n}\r\n\r\n.comment-box input{\r\n width:860px;\r\n}\r\n\r\n.create-comment{\r\n margin-top:5px;\r\n border-radius:0;\r\n color:#fff;\r\n background-color:#0b7076;\r\n}\r\n"; },749:function(t,e){t.exports=".news-content,\r\n.news-body{\r\n margin-left:50px;\r\n}\r\n\r\n.news-content{\r\n margin-top:50px;\r\n margin-bottom:20px;\r\n}\r\n"},750:function(t,e){t.exports="h3{\r\n padding-top:50px;\r\n margin-left:50px;\r\n color:#0b7076;\r\n}\r\n\r\n.news{\r\n margin-top:5px;\r\n}\r\n\r\nstrong{\r\n font-size:14px;\r\n}\r\n\r\n.wrapper{\r\n margin-left:75px;\r\n margin-top:30px;\r\n}\r\n\r\n.comments-count>span{\r\n padding:5px;\r\n}\r\n"},751:function(t,e){t.exports=".container{\r\n margin-top:50px;\r\n}\r\n\r\nh3{\r\n padding-bottom:10px;\r\n}\r\n\r\n.sign-up{\r\n margin-top:10px;\r\n float:right;\r\n border-radius:0;\r\n color:#fff;\r\n background-color:#0b7076;\r\n}\r\n"},752:function(t,e){t.exports="*{\r\n margin-left:50px;\r\n text-align:justify;\r\n}\r\n\r\n.header{\r\n margin-top:50px;\r\n margin-bottom:20px;\r\n}\r\n\r\n.header a:hover{\r\n color:#e39706;\r\n}\r\n\r\nh4{\r\n color:#0b7076;\r\n}\r\n\r\n.row{\r\n margin-left:0;\r\n}\r\n\r\n.support-link{\r\n margin-left:0;\r\n}\r\n\r\n.submit-ticket{\r\n border-radius:0;\r\n color:#fff;\r\n background-color:#0b7076;\r\n}\r\n\r\n.title{\r\n width:860px;\r\n}\r\n"},753:function(t,e){t.exports="*{\r\n margin-left:50px;\r\n text-align:justify;\r\n}\r\n\r\ninput{\r\n width:926px;\r\n height:48px;\r\n padding:0px 12px;\r\n margin:15px 0px;\r\n}\r\n\r\nbutton{\r\n border-radius:0;\r\n margin:0;\r\n}\r\n\r\n.submit{\r\n border-radius:0;\r\n color:#fff;\r\n background-color:#0b7076;\r\n}\r\n\r\n.list-posts{\r\n margin-top:50px;\r\n margin-left:0px;\r\n}\r\n\r\nimg{\r\n display:block;\r\n width:50px;\r\n height:50px;\r\n}\r\n\r\n.troll-box-parent{\r\n position:absolute;\r\n}\r\n\r\n#troll-box{\r\n position:fixed;\r\n top:150px;\r\n right:100px;\r\n z-index:100;\r\n}\r\n"},754:function(t,e){t.exports="*{\r\n margin-left:75px;\r\n text-align:justify;\r\n}\r\n\r\nh4{\r\n color:#0b7076;\r\n}\r\n\r\na{\r\n margin-top:5px;\r\n}\r\n"},755:function(t,e){t.exports='<app-header></app-header>\n<div class="container">\n <router-outlet></router-outlet>\n</div>'},756:function(t,e){t.exports='<h1 class="text-center">MY PROFILE</h1>\r\n<div class="row">\r\n <div class="col-md-2 userPhoto" [ngSwitch]="user.photoURL">\r\n <img *ngSwitchCase="true" src="{{user.photoURL}}" alt="Profile Pic">\r\n <img *ngSwitchDefault src="{{defaultUserPhotoURL}}" alt="Profile Pic">\r\n </div>\r\n <div class="col-md-2">\r\n <strong>Email: </strong><small>{{user.email}}</small>\r\n </div>\r\n</div>\r\n'},757:function(t,e){t.exports='<div class="col buyCol">\n\n <div class="head">\n <div class="name">BUY BTC</div>\n <div class="info loginRequired" *ngIf="_af.auth | async">\n <div class="desc">You have:</div>\n <div class="details">\n <div class="num" id="primaryBalance">10000.15</div>\n <div class="currency primaryCurrency">USD</div>\n </div>\n </div>\n <!--<div class="info loginRequired" *ngIf="_af.auth | async">\n <div class="desc">Lowest Ask:</div>\n <div class="details">\n <div class="num" id="lowestAsk">960.32000000</div>\n <div class="currency primaryCurrency">USD</div>\n </div>\n </div>-->\n <div class="linkContainer">\n <div class="link loginRequired" *ngIf="_af.auth | async">\n <a href="/balances#USD" class="standard">Deposit USD</a>\n </div>\n </div>\n <!-- end head -->\n </div>\n\n <div class="data">\n <form [formGroup]="buyForm" (ngSubmit)="placeBidOrder()" id="buyForm">\n <div class="top">\n <div class="row">\n <div class="desc">Amount BTC:</div>\n <div class="details">\n <div class="currency secondaryCurrency">BTC</div>\n <div class="num">\n <input formControlName="buyAmount" type="text" name="buyAmount" id="buyAmount" [(ngModel)]="amount" required />\n </div>\n </div>\n </div>\n <div class="row">\n <div class="desc">Price per BTC:</div>\n <div class="details">\n <div class="currency primaryCurrency">USD</div>\n <div class="num">\n <input formControlName="buyRate" type="text" name="buyRate" id="buyRate" [(ngModel)]="rate" required />\n </div>\n </div>\n </div>\n </div>\n\n <div class="bottom">\n <div class="row">\n <div class="desc">Total:</div>\n <div class="details">\n <div class="currency primaryCurrency">USD</div>\n <div class="num">\n <input formControlName="buyTotal" type="text" name="buyTotal" id="buyTotal" [ngModel]="total.toFixed(8)" required />\n </div>\n </div>\n </div>\n <!--<div class="row">\n <div class="desc">\n <span class="loginRequired" *ngIf="_af.auth | async">\n Fee: <a href="#" class="standard"><span class="makerFee">0.20</span>/<span class="takerFee">0.20</span>%</a>\n </span>\n </div>\n </div>-->\n <!--<input type="hidden" name="buyCommand" id="buyCommand" value="buy">-->\n <div class="loginRequired" *ngIf="_af.auth | async">\n <div class="cta">\n <button type="button" class="theButton" type="submit" [disabled]="!buyForm.valid">Buy BTC</button>\n </div>\n </div>\n <div class="loginMessage" *ngIf="!(_af.auth | async)">\n <hr>\n <a [routerLink]="[\'/login\']" class="standard">Sign In</a> or\n <a [routerLink]="[\'/signup\']" class="standard">Create an Account</a> to trade.\n </div>\n </div>\n\n </form>\n <!-- end data -->\n </div>\n <!-- end buy col -->\n</div>'},758:function(t,e){t.exports='<div class="header">\n <div class="logo">\n <a [routerLink]="[\'\']"><img src="../../assets/virtex.png" alt="VirtEx Cryptocurrency Exchange"></a>\n </div>\n <simple-notifications [options]="options"></simple-notifications>\n\n <div class="tabs">\n <ul>\n <li><a [routerLink]="[\'exchange\']">Exchange</a></li>\n <li><a [routerLink]="[\'news\']">News</a></li>\n <li><a [routerLink]="[\'terms\']">Terms</a></li>\n <li><a [routerLink]="[\'faq\']">FAQ</a></li>\n <li><a [routerLink]="[\'support\']">Support</a></li>\n </ul>\n </div>\n\n <div class="tabs right loggedOut" *ngIf="!(_af.auth | async)">\n <ul>\n <li class="message">\n <span class="title"><a [routerLink]="[\'login\']">Sign in</a> or <a [routerLink]="[\'signup\']">Create an Account</a><span class="desktopNav"> to start trading.</span></span>\n </li>\n </ul>\n </div>\n\n <div class="tabs right" *ngIf="_af.auth | async">\n <ul>\n <li>\n <span class="title">Balances</span>\n <ul>\n <li><a href="#">Mine</a></li>\n <li><a href="#">Transfer Balances</a></li>\n <li><a href="#">Deposits &amp; Withdrawals</a></li>\n <li><a href="#">History</a></li>\n </ul>\n </li>\n <li>\n <span class="title">Orders</span>\n <ul>\n <li><a href="#">My Open Orders</a></li>\n <li><a href="#">My Trade History</a></li>\n </ul>\n </li>\n <li><a [routerLink]="[\'/profile\']">My Profile</a></li>\n <li>\n <a (click)="onLogout()" style=\'cursor: pointer\'>Logout</a>\n</li>\n</ul>\n</div>\n</div>'},759:function(t,e){t.exports='<div class="col sellCol">\n\n <div class="head">\n <div class="name">SELL BTC</div>\n <div class="info loginRequired" *ngIf="_af.auth | async">\n <div class="desc">You have:</div>\n <div class="details">\n <div class="num" id="secondaryBalance">11.48360</div>\n <div class="currency secondaryCurrency">BTC</div>\n </div>\n </div>\n <!--<div class="info loginRequired" *ngIf="_af.auth | async">\n <div class="desc">Highest Bid:</div>\n <div class="details">\n <div class="num" id="highestBid">959.27000000</div>\n <div class="currency primaryCurrency">USD</div>\n </div>\n </div>-->\n <div class="linkContainer" *ngIf="_af.auth | async">\n <div class="link loginRequired"><a href="/balances#BTC" class="standard">Deposit BTC</a></div>\n </div>\n </div>\n\n <div class="data">\n <form [formGroup]="sellForm" (ngSubmit)="placeAskOrder()" id="sellForm">\n <div class="top">\n <div class="row">\n <div class="desc">Amount BTC:</div>\n <div class="details">\n <div class="currency secondaryCurrency">BTC</div>\n <div class="num">\n <input formControlName="sellAmount" type="text" name="sellAmount" id="sellAmount" [(ngModel)]="amount" required />\n </div>\n </div>\n </div>\n <div class="row">\n <div class="desc">Price per BTC:</div>\n <div class="details">\n <div class="currency primaryCurrency">USD</div>\n <div class="num">\n <input formControlName="sellRate" type="text" name="sellRate" id="sellRate" [(ngModel)]="rate" required />\n </div>\n </div>\n </div>\n </div>\n\n <div class="bottom">\n <div class="row">\n <div class="desc">Total:</div>\n <div class="details">\n <div class="currency primaryCurrency">USD</div>\n <div class="num">\n <input formControlName="sellTotal" type="text" name="sellTotal" id="sellTotal" [ngModel]="total.toFixed(8)" required />\n </div>\n </div>\n </div>\n <!--<div class="row">\n <div class="desc">\n <span class="loginRequired" *ngIf="_af.auth | async">\n Fee: <a href="#" class="standard"><span class="makerFee">0.20</span>/<span class="takerFee">0.20</span>%</a>\n </span>\n </div>\n </div>-->\n <!--<input type="hidden" name="sellCommand" id="sellCommand" value="buy">-->\n <div class="loginRequired" *ngIf="_af.auth | async">\n <div class="cta">\n <button type="button" class="theButton" type="submit" [disabled]="!sellForm.valid">Sell BTC</button>\n </div>\n </div>\n <div class="loginMessage" *ngIf="!(_af.auth | async)">\n <div class="loginMessage" *ngIf="!(_af.auth | async)">\n <hr>\n <a [routerLink]="[\'/login\']" class="standard">Sign In</a> or\n <a [routerLink]="[\'/signup\']" class="standard">Create an Account</a> to trade.\n </div>\n </div>\n </div>\n </form>\n <!-- end data -->\n </div>\n <!-- end sell col -->\n</div>'},760:function(t,e){t.exports='<div id="TrollboxContainer" class="side">\n <div class="box trollbox">\n <div class="head">\n <div class="name">Trollbox</div>\n </div>\n <div class="data" id="trollbox-scroll">\n <div class="trollContainer">\n <div id="trollbox" class="trollbox">\n <table id="trollboxTable" class="trollboxTable">\n <tbody *ngFor="let ch of chats">\n <tr id={{ch.$key}}>\n <td><strong><a><span>{{ch.username}}: </span></a>\n </strong>{{ch.text}}</td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n </div>\n <div class="messageBox">\n <form *ngIf="_af.auth | async">\n <input type="text" name="chat.text" [(ngModel)]="chat.text">\n <button type="submit" class="btn btn-primary send" (click)="send()">Send</button>\n <button type="submit" class="btn btn-primary clear" (click)="clear()">Clear</button>\n </form>\n <div class="loginMessage" *ngIf="!(_af.auth | async)">\n <a [routerLink]="[\'/login\']" class="standard" id="loginLink">Sign In</a> or <a [routerLink]="[\'/signup\']"\n class="standard">Create an Account</a> to chat.\n </div>\n </div>\n </div>\n</div>'},761:function(t,e){t.exports='<div class="buyOrders mainBox">\n <div class="head">\n <div class="name">Buy Orders</div>\n <div class="info">\n <div class="desc">Total:</div>\n <div class="details">\n <div class="num" id="bidsTotal">1819.67280262</div>\n <div class="currency">BTC</div>\n </div>\n </div>\n </div>\n <div class="data">\n <table class="dataTable">\n <thead>\n <tr>\n <th>BTC/USD</th>\n <th>USD</th>\n <th>BTC</th>\n <th>Sum(BTC)</th>\n </tr>\n </thead>\n </table>\n <table id="buyOrderBookTable" class="dataTable">\n <tbody id="bidsTableBody">\n <tr id="0.00745355bids" class="odd">\n <td class="orderRate">0.00745355</td>\n <td class="orderAmount">0.20124619</td>\n <td class="orderTotal">0.00150000</td>\n <td class="orderSum">0.00150000</td>\n </tr>\n <tr id="0.00745041bids" class="even">\n <td class="orderRate">0.00745041</td>\n <td class="orderAmount">40.61100000</td>\n <td class="orderTotal">0.30256860</td>\n <td class="orderSum">0.30406860</td>\n </tr>\n <tr id="0.00745036bids" class="odd">\n <td class="orderRate">0.00745036</td>\n <td class="orderAmount">40.26651061</td>\n <td class="orderTotal">0.30000000</td>\n <td class="orderSum">0.60406860</td>\n </tr>\n <tr id="0.00744774bids" class="even">\n <td class="orderRate">0.00744774</td>\n <td class="orderAmount">0.23672416</td>\n <td class="orderTotal">0.00176306</td>\n <td class="orderSum">0.60583166</td>\n </tr>\n <tr id="0.00744533bids" class="odd">\n <td class="orderRate">0.00744533</td>\n <td class="orderAmount">0.08776057</td>\n <td class="orderTotal">0.00065341</td>\n <td class="orderSum">0.60648507</td>\n </tr>\n </tbody>\n </table>\n </div>\n</div>'},762:function(t,e){t.exports="<app-buy-box></app-buy-box>\n<app-sell-box></app-sell-box>\n<app-trollbox></app-trollbox>\n<app-sell-orders></app-sell-orders>\n<app-buy-orders></app-buy-orders>"},763:function(t,e){t.exports='<div class="sellOrders mainBox">\n <div class="head">\n <div class="name">Sell Orders</div>\n <div class="info">\n <div class="desc">Total:</div>\n <div class="details">\n <div class="num" id="asksTotal">3312.56278246</div>\n <div class="currency">USD</div>\n </div>\n </div>\n </div>\n <div class="data">\n <table class="dataTable">\n <thead>\n <tr>\n <th>BTC/USD</th>\n <th>BTC</th>\n <th>USD</th>\n <th>Sum(USD)</th>\n </tr>\n </thead>\n </table>\n <table id="sellOrderBookTable" class="dataTable">\n <tbody id="asksTableBody">\n <tr id="0.00746996asks" class="odd">\n <td class="orderRate">967.00746996</td>\n <td class="orderAmount">1.46862901</td>\n <td class="orderTotal">1418.85800000</td>\n <td class="orderSum">1418.85800000</td>\n </tr>\n <tr id="0.00746997asks" class="even">\n <td class="orderRate">0.00746997</td>\n <td class="orderAmount">535.51211644</td>\n <td class="orderTotal">4.00025944</td>\n <td class="orderSum">7.85825944</td>\n </tr>\n <tr id="0.00747000asks" class="odd">\n <td class="orderRate">0.00747000</td>\n <td class="orderAmount">215.33470000</td>\n <td class="orderTotal">1.60855021</td>\n <td class="orderSum">9.46680965</td>\n </tr>\n <tr id="0.00747597asks" class="even">\n <td class="orderRate">0.00747597</td>\n <td class="orderAmount">40.94440027</td>\n <td class="orderSum">62.43205242</td>\n <td class="orderSum">9.46680965</td>\n </tr>\n </tbody>\n </table>\n </div>\n</div>'},764:function(t,e){t.exports='<h4>Write your question</h4>\r\n<form>\r\n <input type="text" class="title" name="question.title" [(ngModel)]="question.title">\r\n <br>\r\n <button type="submit" (click)="create()" class="btn btn-lg btn-default ask">Ask</button>\r\n</form>\r\n'},765:function(t,e){t.exports='<h3>Frequently asked questions(FAQ)</h3>\n<div *ngFor="let f of faq; let i=index">\n <div class="container">\n <a role="button" data-toggle="collapse" href="#{{i}}" aria-expanded="false" aria-controls="collapseExample">{{f.title}}</a>\n <p class="collapse" id="{{i}}">{{f.body}}</p>\n </div>\n</div>\n<a id="ask" [routerLink]="[\'/ask\']">Ask Question</a>\n'},766:function(t,e){t.exports='<div class="bg">\n <div id="page-wrap">\n <section class="clearfix">\n <div class="container clearfix">\n <header>\n <h4>Serving bitcoin industry since 2016.</h4>\n <h5>Welcome to Virtex</h5>\n <div>\n <ul>\n <li><span>BTC/USD</span>\n <div><span><span id="dollar-sign-front" class="fa fa-usd"></span> 968.21</span>\n </div>\n </li>\n <li><span>BTC/EUR</span>\n <div><span> <span id="euro-sign-front" class="fa fa-euro">978.21</span></span>\n </div>\n </li>\n </ul>\n <a *ngIf="!(_af.auth | async)" class="login-link" [routerLink]="[\'/login\']">Login</a>\n <a *ngIf="_af.auth | async" class="login-link" [routerLink]="[\'/exchange\']">Trade</a>\n </div>\n </header>\n </div>\n </section>\n </div>\n</div>\n'},767:function(t,e){t.exports='<div class="container">\n <h3 class="text-center header">Please sign in to use all features</h3>\n <div class="row">\n <form [formGroup]="myForm" (ngSubmit)="onSignIn(myForm.value); myForm.reset()">\n <div class="col-md-6 col-md-offset-3">\n <div class="form-group col-md-6">\n <label for="email">E-Mail</label>\n <input formControlName="email" type="email" id="email" class="form-control">\n </div>\n <div class="input-group col-md-6">\n <label for="password">Password</label>\n <input formControlName="password" type="password" id="password" class="form-control">\n </div>\n <button type="submit" class="btn btn-primary sign-in">Sign In</button>\n </div>\n </form>\n </div>\n</div>\n'},768:function(t,e){t.exports='<div class="container">\r\n <a id="comment-collapse" role="button" data-toggle="collapse" href="#comments" aria-expanded="false" aria-controls="collapseExample">Comments</a>\r\n <div class="box collapse" id="comments">\r\n <div *ngFor="let comment of comments">\r\n <div class="container">\r\n <small class="comment-title">{{comment.title}}</small>\r\n <div>{{comment.body}}</div>\r\n <hr>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n<form *ngIf="af.auth | async">\r\n <h4>Leave comment</h4>\r\n <div class="comment-box">\r\n <input type="text" name="comment.title" [(ngModel)]="comment.title">\r\n <br>\r\n <textarea name="comment.body" [(ngModel)]="comment.body" rows="20" cols="120"></textarea>\r\n <br>\r\n <button type="submit" class="btn btn-primary create-comment" (click)="createComment()">Send</button>\r\n </div>\r\n</form>\r\n<div *ngIf="!(af.auth | async)">You should <a [routerLink]="[\'/login\']">sign in</a> to leave comments</div>\r\n'},769:function(t,e){t.exports='<div class="row news-content">\r\n <h4>{{detail.title}}</h4>\r\n <div class="col-md-12">\r\n <small>Created on {{detail.createdOn}} from <a href="">{{detail.byUser}}</a></small>\r\n </div>\r\n</div>\r\n<hr>\r\n<div class="row news-body">\r\n <div class="col-md-8">\r\n {{detail.body}}\r\n </div>\r\n</div>\r\n'},770:function(t,e){t.exports='<h3>Latest news</h3>\n<div class="wrapper">\n <div class="row news" *ngFor="let n of news">\n <div class="col-md-12">\n <a [routerLink]="[\'/news\', n.$key]">{{n.title}}</a>\n <br>\n <small>Created on </small><strong>{{n.createdOn}}</strong>\n </div>\n <!--<button type="button" (click)="delete(n.$key)">Delete</button>-->\n </div>\n</div>\n<app-comment></app-comment>\n'},771:function(t,e){t.exports='<div class="container">\n <h3 class="text-center">Please sign up to use all features</h3>\n <div class="row">\n <form [formGroup]="myForm" (ngSubmit)="onSignUp()">\n <div class="col-md-6 col-md-offset-3">\n <div class="form-group row col-md-8 col-md-offset-2">\n <label for="email">E-Mail</label>\n <input formControlName="email" type="email" id="email" #email class="form-control">\n <span *ngIf="!email.pristine && email.errors != null && email.errors[\'noEmail\']">Invalid mail address</span>\n </div>\n <div class="form-group row col-md-8 col-md-offset-2">\n <label for="password">Password</label>\n <input formControlName="password" type="password" id="password" class="form-control">\n </div>\n <div class="form-group row col-md-8 col-md-offset-2">\n <label for="confirm-password">Confirm Password</label>\n <input formControlName="confirmPassword" type="password" id="confirm-password" #confirmPassword class="form-control">\n <span *ngIf="!confirmPassword.pristine && confirmPassword.errors != null && confirmPassword.errors[\'passwordsNotMatch\']">Passwords do not match</span>\n <button type="submit" [disabled]="!myForm.valid" class="btn btn-primary sign-up">Sign Up</button>\n </div>\n </div>\n </form>\n </div>\n</div>'},772:function(t,e){t.exports='<div class="content">\r\n <h4 class="header">{{ticket.title}}</h4>\r\n <small>Issued on {{ticket.createdOn}} by <a href="#">{{ticket.by}}</a></small>\r\n <div>\r\n {{ticket.body}}\r\n </div>\r\n</div>\r\n'},773:function(t,e){t.exports='<div class="header">\r\n <h4 class="text-center">Sumbit a ticket</h4>\r\n <small>Before submitting a ticket, please try looking for solution in our <a class="support-link" [routerLink]="[\'/support\']">support page</a></small>\r\n</div>\r\n<div class="row">\r\n <form>\r\n <input type="text" class="title" placeholder="Write title" name="ticket.title" [(ngModel)]="ticket.title">\r\n <textarea placeholder="Write content" id="submit-ticket" name="ticket.body" [(ngModel)]="ticket.body" rows="20" cols="120"></textarea>\r\n <br>\r\n <button type="submit" (click)="create()" class="btn btn-lg btn-default submit-ticket">Submit</button>\r\n </form>\r\n</div>\r\n'},774:function(t,e){t.exports='<div class="row">\n <div class="col-md-12">\n <form>\n <input type="text" placeholder="What can we help you with?" name="search" value="">\n <button type="button" class="btn btn-lg btn-success">Search</button>\n </form>\n </div>\n</div>\n<div class="row">\n <div class="col-md-12"><a class="btn btn-default submit" [routerLink]="[\'/submit\']">Submit a ticket</a></div>\n</div>\n<div class="row list-posts" *ngFor="let sp of supportTickets">\n <div class="row">\n <div class="col-md-6">\n <a [routerLink]="[\'/support\', sp.$key]">{{sp.title}}</a>\n <br>\n <small>Posted by {{sp.by}} on {{sp.createdOn}}</small>\n </div>\n <div class="col-md-2">\n <img src="{{defaultAvatar}}" alt="Avatar">\n </div>\n <div class="col-md-6">\n <div>{{sp.body}}</div>\n <hr>\n </div>\n </div>\n</div>\n<div class="row troll-box-parent">\n <app-trollbox id="troll-box"></app-trollbox>\n</div>\n'},775:function(t,e){t.exports="<h4>Terms & Conditions</h4>\n\n<h4>Introduction</h4>\n\n<p>BTC-e provides an online tool that allows users to freely trade Bitcoins for a number of different currencies worldwide. The Terms of Use described here apply to all transactions and activities engaged by the users of this website, data gathered, private\n messeges, online chat between the users and support BTC-e. Is operated by the company ALWAYS EFFICIENT LLP.</p>\n\n<h4>Changes to Website</h4>\n\n<p>BTC-e will always attempt to keep its users informed of any changes to the website. However, BTC-e may terminate, change, suspend or discontinue any aspect of this website, including the availability of features of the site, at any time. BTC-e may also\n impose limits on certain features and services or restrict your access to part or the entire website without prior notice or liability.</p>\n\n<h4>Proprietary Rights</h4>\n\n<p>All contents of the BTC-e website, including, but not limited to, text, names, data, logos, buttons, icons, code, methods, techniques, models, graphics and the underlying software (the \"Components\"), are proprietary of BTC-e and are protected by the patent,\n copyright, trademark. Nothing contained in this website shall be used in any form unless expressly stated by BTC-e.</p>\n\n<h4>Privacy</h4>\n\n<p>BTC-e will not share, publish, or sell any user data contained in its databases. However, BTC-e may be requested at any time to share trade data including, but not restricted to, emails, user transactions, and trade data by government authorities. BTC-e\n will not deny such requests and cannot be held responsible for the leakage of information by third parties whether the action was performed intentionally or not. We are prohibited from using multiple accounts.</p>\n\n<h4>Fees and Comissions</h4>\n\n<p>In order to pay for server space, bandwidth, programmers, designers, and other costs, BTC-e imposes a standard: Fee – 0.2% - 0.5%. fee on every transaction performed by all users of the website. This transaction may vary and may be different for each\n individual account.</p>\n\n<h4>Limitation of Liability</h4>\n\n<p>BTC-e does not provide advice for its users on trading techniques, models, algorithms or similar. Occasionally, BTC-e may publish best practices or recommendations publicly to all its users or privately to users expressly requesting assistance. Users\n of this website are responsible for the outcome of their actions with their account balances. Users are also responsible for protecting access information to the Website including, but not limited to, user names, passwords, and bank account details.\n BTC-e is not responsible for the outcome, whether positive or negative, of any action performed by any of its users within or related to the Website. Some withdraw methods require BTC-e to use personal details of the user including, but not limited\n to, name, address, email, phone number, and bank account number for which BTC-e has the capability to send and receive encrypted emails. The usage of encryption is left entirely at the discretion of the user.</p>\n\n<h4>BTC-e Terms of Use</h4>\n\n<p>By opening an account at BTC-e you agree to the Terms of Use stated in this page. BTC-e reserves the right, at its discretion, to add, remove, or modify portions of these Terms of Agreement at any time. Your continued use of BTC-e following the implementation\n of changes to these Terms of Agreement implies that you accept such changes. Please note the funds will be on hold untill the identity is verified. We don't accept any more international wire transfers from US Citizens or from US Bank As of 11.28.2014\n we will not accept any claims about account hacking or fraudulent activities in your account carried out by third parties if Google 2-Factor authentication is not enabled. Claims about third party fraudulent activities on accounts with disabled 2FA\n will not be taken into consideration. BTC-e codes are non-refundable in case of exchange through third party services or users. The user assumes all risks associated with the exchange of BTC-e codes with third parties. If your account has been inactive\n for 2 calendar years, its status will be changed to “locked”. Please contact Support to unlock your account https://support.btc-e.com/ If you change the email through the support of withdrawal will be disabled for two weeks. All newly registered users\n can't withdraw money from an account within 3 working days.</p>\n\n<h4>Identity verification</h4>\n\n<p>Required in case you choose to load your account by wire transfer. To comply with AML/CTF recommendations, we require our clients to verify identity by providing scanned copy of ID and scanned copy of utility bill or a bank statement which should not\n be older then 6 month. Copy should be in good resolution and colored.</p>\n\n<h4>Jurisdiction</h4>\n\n<p>Laws in the country where the user resides may not allow the usage of an online tool with the characteristics of BTC-e or any of its features. BTC-e does not encourage the violation of any laws and cannot be held responsible for violation of such laws.\n For all legal purposes, these Terms of Use shall be governed by the laws applicable in the Cyprus. You agree and hereby submit to the exclusive personal jurisdiction and venue of the Cyprus for the resolution of any disputes arising from these Terms\n of Use.</p>\n\n<h4>Contact us</h4>\n\n<p>At BTC-e, we want to provide the best service while keeping everyone informed of the existing features and limitations. Please do not hesitate to contact us in case you have any questions at:</p>\n<h4>Chat rules for users</h4>\n<div>\n 1. Obscene words in any type (swearing, hidden and veiled swearing) are prohibited in our chat 2. Abusing other users is prohibited 3. Pronouncements that incite ethnic hatred, advocating violence in any form, insulting religious feelings of other users\n are not allowed. 4. Flooding (flood is the posting of similar information, same repeating phrase or identical graphic files), flaming and spamming are prohibited. 5. Obscene words (both in obvious and veiled forms) in a user’s nick are not allowed.\n 6. Distribution of maleficent links, links to third party online projects and advertising links is prohibited. 7. Abusing statements addressed to the administration, moderators, hard-hitting pronouncements about the chat are prohibited. 8. Discussing\n moderators’ actions is inadmissible. If you believe you have been treated unfairly, write to the administrator, he will take care of that. 9. Users must not beg for the moderator status or any other status from the administration. 10. Writing only\n capitals is prohibited. 11. If you respond to abuses by abusing, you are treated as the one violating the rules, and a relevant punishment will be applied to you.\n</div>\n<h4>Chat rules for moderators</h4>\n<div>\n 1. Moderator, being a representative of the administrator, must strictly obey all user rules and be a reference for everyone. 2. Before applying a punishment, the moderator must warn the user that he/she has violated the rules (this does not refer to\n the situations with obvious abuse of a user/users and flood). In case of a repeated violation of the chat rules the user will not be warned. 3. Banning for longer than 60 days is admitted only in case of repeated major chat rules violations by a user.\n 4. For violation of the chat rules upon the decision of the administration a moderator can be deprived of his/her authority without the right to recover.\n</div>\n<h4>Have questions? Contact us!</h4>\n<a [routerLink]=\"['/support']\">Chat: support</a>\n<br>\n<a [routerLink]=\"['/support']\">Ticket system</a>\n"; },799:function(t,e,n){t.exports=n(421)}},[799]); //# sourceMappingURL=main.e28aaa441375a793ced2.bundle.map
19,343.8
32,523
0.658102
9efce030e79630900252330a5dc50ef1eaafd7b0
9,636
js
JavaScript
src/API.js
ulitol97/rdfshape-client
ac9668ae19eb80e0bbe3c9bdd3d0a02526934f39
[ "MIT" ]
null
null
null
src/API.js
ulitol97/rdfshape-client
ac9668ae19eb80e0bbe3c9bdd3d0a02526934f39
[ "MIT" ]
null
null
null
src/API.js
ulitol97/rdfshape-client
ac9668ae19eb80e0bbe3c9bdd3d0a02526934f39
[ "MIT" ]
null
null
null
/** This class contains global definitions */ import environmentConfiguration from "./EnvironmentConfig"; class API { // Routes static rootApi = environmentConfiguration.apiHost + "/api/"; static routes = { // Routes in server server: { root: this.rootApi, health: this.rootApi + "health", dataInfo: this.rootApi + "data/info", dataConvert: this.rootApi + "data/convert", dataQuery: this.rootApi + "data/query", dataExtract: this.rootApi + "data/extract", dataFormatsInput: this.rootApi + "data/formats/input", dataFormatsOutput: this.rootApi + "data/formats/output", dataVisualFormats: this.rootApi + "data/formats/visual", schemaInfo: this.rootApi + "schema/info", schemaConvert: this.rootApi + "schema/convert", schemaValidate: this.rootApi + "schema/validate", shExFormats: this.rootApi + "schema/formats?schemaEngine=shex", shaclFormats: this.rootApi + "schema/formats?schemaEngine=shaclex", schemaShaclEngines: this.rootApi + "schema/engines/shacl", shapeMapInfo: this.rootApi + "shapemap/info", shapeMapFormats: this.rootApi + "shapemap/formats", endpointInfo: this.rootApi + "endpoint/info", endpointQuery: this.rootApi + "endpoint/query", inferenceEngines: this.rootApi + "data/inferenceEngines", serverPermalinkEndpoint: this.rootApi + "permalink/generate", serverOriginalLinkEndpoint: this.rootApi + "permalink/get", fetchUrl: this.rootApi + "fetch", wikidataEntityLabel: this.rootApi + "wikidata/entityLabel", wikidataSearchEntity: this.rootApi + "wikidata/searchEntity", wikidataLanguages: this.rootApi + "wikidata/languages", wikidataSchemaContent: this.rootApi + "wikidata/schemaContent", }, // Routes in client client: { dataInfoRoute: "/dataInfo", dataConvertRoute: "/dataConvert", dataVisualizeGraphvizRoute: "/dataVisualizeGraphviz", dataVisualizeGraphvizRouteRaw: "/dataVisualizeGraphvizRaw", dataVisualizeCytoscapeRoute: "/dataVisualizeCytoscape", dataVisualizeCytoscapeRouteRaw: "/dataVisualizeCytoscapeRaw", dataExtractRoute: "/dataExtract", dataMergeRoute: "/dataMerge", dataMergeVisualizeRoute: "/dataMergeVisualize", dataMergeVisualizeRouteRaw: "/dataMergeVisualizeRaw", dataQueryRoute: "/dataQuery", endpointInfoRoute: "/endpointInfo", endpointExtractRoute: "/endpointExtract", endpointQueryRoute: "/endpointQuery", shexInfoRoute: "/shexInfo", shexConvertRoute: "/shexConvert", shexVisualizeUmlRoute: "/shexVisualizeUml", shexVisualizeUmlRouteRaw: "/shexVisualizeUmlRaw", shex2ShaclRoute: "/shex2Shacl", shexValidateRoute: "/shexValidate", shexValidateEndpointRoute: "/shexValidateEndpoint", shex2XmiRoute: "/shex2Xmi", shapeFormRoute: "/shapeForm", shaclInfoRoute: "/shaclInfo", shaclConvertRoute: "/shaclConvert", shacl2ShExRoute: "/shacl2ShEx", shaclValidateRoute: "/shaclValidate", jenaShaclValidateRoute: "/jenaShaclValidate", shapeMapInfoRoute: "/shapemapInfo", wikidataQueryRoute: "/wikidataQuery", wikidataValidateRoute: "/wikidataValidate", wikidataExtractRoute: "/wikTURTLEidataExtract", permalinkRoute: "/link/:urlCode", aboutRoute: "/about", }, // Other useful routes utils: { wikidataUrl: "https://query.wikidata.org/sparql", dbpediaUrl: "https://dbpedia.org/sparql", testInputTabsWithFormatRoute: "/test/inputTabsWithFormat", }, }; // Dictionary with the names used for query parameters // Centralized point to change them and keep them in sync with what the server expects static queryParameters = { data: { data: "data", source: "dataSource", format: "dataFormat", targetFormat: "dataTargetFormat", inference: "dataInference", compound: "dataCompound", nodeSelector: "nodeSelector", layout: "dataLayout", // Client only }, schema: { schema: "schema", source: "schemaSource", format: "schemaFormat", engine: "schemaEngine", inference: "schemaInference", targetFormat: "schemaTargetFormat", targetEngine: "schemaTargetEngine", triggerMode: "triggerMode", }, shapeMap: { shapeMap: "shapeMap", source: "shapeMapSource", format: "shapeMapFormat", }, query: { query: "query", source: "querySource", }, endpoint: { endpoint: "endpoint", }, uml: { uml: "uml", source: "umlSource", format: "umlFormat", }, }; // Information sources / tabs static sources = { byText: "byText", byUrl: "byUrl", byFile: "byFile", bySchema: "bySchema", default: "byText", }; static tabs = { xmi: "XMI", uml: "UML", }; // Formats (most formats come from server but we need defaults for data initialization) static formats = { turtle: "turtle", triG: "TriG", compact: "Compact", shexc: "ShExC", shexj: "ShExJ", sparql: "SPARQL", xml: "XML", rdfXml: "RDF/XML", rdfJson: "RDF/JSON", svg: "SVG", png: "PNG", html: "HTML", htmlMicrodata: "html-microdata", htmlRdf: "html-rdfa11", json: "JSON", jsonld: "JSON-LD", dot: "DOT", ps: "PS", uml: "UML", txt: "txt", defaultData: "turtle", defaultShex: "ShExC", defaultShacl: "turtle", defaultShacl: "turtle", defaultShapeMap: "Compact", defaultQuery: "SPARQL", defaultGraphical: "SVG", }; // Mime types static mimeTypes = { shex: "text/shex", svg: "image/svg+xml", png: "image/png", }; // Inferences static inferences = { default: "None", none: "None", }; // Engines static engines = { default: "ShEx", defaultShex: "ShEx", defaultShacl: "SHACLex", shex: "ShEx", shaclex: "SHACLex", jenaShacl: "JenaSHACL", shacl_tq: "SHACL_TQ", xml: "xml", }; // Trigger modes static triggerModes = { default: "shapeMap", shapeMap: "shapeMap", targetDecls: "targetDecls", }; // By text limitations static limits = { byTextCharacterLimit: 2200, }; // Text constants static texts = { pageHeaders: { dataInfo: "Data analysis", dataConversion: "Data conversion", dataVisualization: "Data visualization", dataMergeConvert: "Data merge & convert", dataMergeVisualize: "Data merge & visualize", dataQuery: "Data query", dataShexExtraction: "Extract ShEx from Data", endpointInfo: "Endpoint information", endpointQuery: "Endpoint query", shexInfo: "ShEx analysis", shexConversion: "ShEx conversion", shexValidation: "ShEx validate user data", shexValidationEndpoint: "ShEx validate endpoint data", shexVisualization: "ShEx visualization", shexToShacl: "ShEx conversion to Shacl", shexToForm: "Create form from ShEx", shexToUml: "ShEx conversion to UML", umlToShex: "UML conversion to ShEx", shaclValidation: "SHACL validate user data", shaclConversion: "SHACL conversion", shaclToShex: "SHACL conversion to ShEx", shapeMapInfo: "ShapeMap analysis", }, dataTabs: { dataHeader: "Data (RDF)", shexHeader: "Shapes Graph (ShEx)", shaclHeader: "Shapes Graph (SHACL)", shapeMapHeader: "ShapeMap", queryHeader: "Query (SPARQL)", umlHeader: "UML (XMI)", formatHeader: "Format", }, placeholders: { sparqlQuery: "SELECT...", rdf: "RDF...", url: "http://...", shex: "ShEx...", shacl: "SHACL...", shapeMap: "<node>@<Shape>...>", xmi: "XMI...", }, validationResults: { allValid: "Validation successfull", nodeValid: "Valid", nodeInvalid: "Invalid", someValid: "Partially invalid data: check the details of each node to learn more", noneValid: "Invalid data: check the details of each node to learn more", noData: "Validation was completed but no results were obtained, check if the input data is coherent", }, networkError: "Network error", errorParsingUrl: "Could not parse URL information", noProvidedRdf: "No RDF data provided", noProvidedSchema: "No schema provided", noProvidedShapeMap: "No shapeMap provided", noProvidedQuery: "No query provided", noProvidedEndpoint: "No endpoint provided", noProvidedUml: "No UML provided", errorResponsePrefix: "Error response", responseSummaryText: "Full response", noPrefixes: "No prefixes", operationInformation: "Operation information", visualizationsWillAppearHere: "Visualizations will appear here", dataInfoWillAppearHere: "Data info will appear here", schemaInfoWillAppearHere: "Schema info will appear here", conversionResultsWillAppearHere: "Conversion results will appear here", extractionResultsWillAppearHere: "Extraction results will appear here", mergeResultsWillAppearHere: "Merge results will appear here", queryResultsWillAppearHere: "Query results will appear here", validationResultsWillAppearHere: "Validation results will appear here", noPermalinkManual: "Can't generate links for long manual inputs, try inserting data by URL", noPermalinkFile: "Can't generate links for file-based inputs, try inserting data by URL", embeddedLink: "Embedded link", permalinkCopied: "Link copied to clipboard!", }; } export default API;
30.1125
101
0.654628
9efcfef6360036f9a6eb575be27789db76c94f01
599
js
JavaScript
scripts/server/logger.js
gitzhaochen/acli
f5c3de5ff44cfdcc727ce54722fb24ad1c7792f5
[ "MIT" ]
null
null
null
scripts/server/logger.js
gitzhaochen/acli
f5c3de5ff44cfdcc727ce54722fb24ad1c7792f5
[ "MIT" ]
null
null
null
scripts/server/logger.js
gitzhaochen/acli
f5c3de5ff44cfdcc727ce54722fb24ad1c7792f5
[ "MIT" ]
null
null
null
const chalk = require('chalk') const ip = require('ip') const divider = chalk.gray('-----------------------------------') const logger = { error: (err) => { console.error(chalk.red(err)) }, start: (port, host) => { console.log(`Server started! ${chalk.green('✓')}`) console.log(` ${chalk.bold('App running at:')} ${divider} - Local: ${chalk.blue(` http://${host}:${port}`)} - Network: ${chalk.blue(`http://${ip.address()}:${port}`)} ${divider} ${chalk.magenta(`Press ${chalk.italic('Ctrl+c')} to stop`)} `) } } module.exports = logger
24.958333
65
0.51586
9efd4ad94b1e883b874c8bf425f90ca3894c25e7
279
js
JavaScript
node_modules/dom-helpers/cjs/childElements.js
starmarke/starmarke
98b63e0407f5fc5e927e8575fe3f3a560e8289ba
[ "MIT" ]
4
2022-01-04T15:21:45.000Z
2022-01-06T23:50:27.000Z
node_modules/dom-helpers/cjs/childElements.js
starmarke/starmarke
98b63e0407f5fc5e927e8575fe3f3a560e8289ba
[ "MIT" ]
71
2022-02-09T04:40:51.000Z
2022-03-25T07:28:16.000Z
node_modules/dom-helpers/cjs/childElements.js
starmarke/starmarke
98b63e0407f5fc5e927e8575fe3f3a560e8289ba
[ "MIT" ]
6
2021-11-17T13:22:40.000Z
2022-02-01T16:27:33.000Z
"use strict"; exports.__esModule = true; exports.default = childElements; /** * Collects all child elements of an element. * * @param node the element */ function childElements(node) { return node ? Array.from(node.children) : []; } module.exports = exports["default"];
18.6
47
0.695341
9efd983ab59f54b77491e99862647c40971a14cc
64
js
JavaScript
packages/checkbox-group/index.js
michellangeveld/lion
5ad88b506c7bfc0994602d11dfe53a44b454e18e
[ "MIT" ]
1
2020-02-18T16:49:13.000Z
2020-02-18T16:49:13.000Z
packages/checkbox-group/index.js
michellangeveld/lion
5ad88b506c7bfc0994602d11dfe53a44b454e18e
[ "MIT" ]
null
null
null
packages/checkbox-group/index.js
michellangeveld/lion
5ad88b506c7bfc0994602d11dfe53a44b454e18e
[ "MIT" ]
1
2020-04-23T09:42:18.000Z
2020-04-23T09:42:18.000Z
export { LionCheckboxGroup } from './src/LionCheckboxGroup.js';
32
63
0.765625
9efd9c1b61762a6b5c3022ed7f76c691116353dc
1,607
js
JavaScript
examples/router.js
skynj/v-charts
775fe4d1c0d72620bb64dfa6ccbdf4a7696345ae
[ "MIT" ]
null
null
null
examples/router.js
skynj/v-charts
775fe4d1c0d72620bb64dfa6ccbdf4a7696345ae
[ "MIT" ]
null
null
null
examples/router.js
skynj/v-charts
775fe4d1c0d72620bb64dfa6ccbdf4a7696345ae
[ "MIT" ]
1
2018-06-29T03:13:33.000Z
2018-06-29T03:13:33.000Z
/* eslint-disable comma-dangle */ import Vue from 'vue' import Router from 'vue-router' Vue.use(Router) export const TEST_ROUTES = [ { path: '/columns-rows', name: 'data', component: () => import('./test/columns-rows.vue') }, { path: '/custom-props', name: 'options', component: () => import('./test/custom-props.vue') }, { path: '/events', name: 'events', component: () => import('./test/events.vue') }, { path: '/extend', name: 'extend', component: () => import('./test/extend.vue') }, { path: '/hook', name: 'hook', component: () => import('./test/hook.vue') }, { path: '/init', name: 'init', component: () => import('./test/init.vue') }, { path: '/judge-width', name: 'judge-width', component: () => import('./test/judge-width.vue') }, { path: '/loading-empty', name: 'loading-empty', component: () => import('./test/loading-empty.vue') }, { path: '/mark', name: 'mark', component: () => import('./test/mark.vue') }, { path: '/resize', name: 'resize', component: () => import('./test/resize.vue') }, { path: '/set-option', name: 'set-option', component: () => import('./test/set-option.vue') }, { path: '/number-format', name: 'number', component: () => import('./test/number-format.vue') }, ] export default new Router({ routes: [ { path: '/', name: '安装', component: () => import('./pages/install') }, { path: '/chart/:type', name: '图表', component: () => import('./pages/chart') }, { path: '/bmap', name: '百度地图', component: () => import('./pages/bmap') }, { path: '/amap', name: '高德地图', component: () => import('./pages/amap') }, ].concat(TEST_ROUTES) })
53.566667
105
0.580585
9efde809beb6da2f07afcb8aa528ad4295f98119
2,873
js
JavaScript
test/util/util.test.js
Strilanc/multiplication-algorithm-examples-js
43acd8ce0238d9b3cbc0ff225b45185cd0594195
[ "Apache-2.0" ]
1
2019-12-05T15:41:01.000Z
2019-12-05T15:41:01.000Z
test/util/util.test.js
Strilanc/multiplication-algorithm-examples-js
43acd8ce0238d9b3cbc0ff225b45185cd0594195
[ "Apache-2.0" ]
null
null
null
test/util/util.test.js
Strilanc/multiplication-algorithm-examples-js
43acd8ce0238d9b3cbc0ff225b45185cd0594195
[ "Apache-2.0" ]
null
null
null
import { Suite, assertThat } from "test/testing/Test.js" import { floor_lg2, ceil_lg2, reversed_list, swap_index_bit_orders, splice_bit, repeat, proper_mod, exact_lg2 } from "src/util/util.js" let suite = new Suite("util"); suite.test("floor_lg2", () => { assertThat(floor_lg2(1)).isEqualTo(0); assertThat(floor_lg2(2)).isEqualTo(1); assertThat(floor_lg2(3)).isEqualTo(1); assertThat(floor_lg2(4)).isEqualTo(2); assertThat(floor_lg2(5)).isEqualTo(2); assertThat(floor_lg2(6)).isEqualTo(2); assertThat(floor_lg2(7)).isEqualTo(2); assertThat(floor_lg2(8)).isEqualTo(3); assertThat(floor_lg2(9)).isEqualTo(3); }); suite.test("ceil_lg2", () => { assertThat(ceil_lg2(1)).isEqualTo(0); assertThat(ceil_lg2(2)).isEqualTo(1); assertThat(ceil_lg2(3)).isEqualTo(2); assertThat(ceil_lg2(4)).isEqualTo(2); assertThat(ceil_lg2(5)).isEqualTo(3); assertThat(ceil_lg2(6)).isEqualTo(3); assertThat(ceil_lg2(7)).isEqualTo(3); assertThat(ceil_lg2(8)).isEqualTo(3); assertThat(ceil_lg2(9)).isEqualTo(4); }); suite.test("exact_lg2", () => { assertThat(exact_lg2("abc")).isEqualTo(undefined); assertThat(exact_lg2(1)).isEqualTo(0); assertThat(exact_lg2(2)).isEqualTo(1); assertThat(exact_lg2(3)).isEqualTo(undefined); assertThat(exact_lg2(4)).isEqualTo(2); assertThat(exact_lg2(5)).isEqualTo(undefined); assertThat(exact_lg2(6)).isEqualTo(undefined); assertThat(exact_lg2(7)).isEqualTo(undefined); assertThat(exact_lg2(8)).isEqualTo(3); assertThat(exact_lg2(9)).isEqualTo(undefined); }); suite.test("swap_index_bit_orders", () => { assertThat(swap_index_bit_orders([0, 1, 2, 3, 4, 5, 6, 7])).isEqualTo([0, 4, 2, 6, 1, 5, 3, 7]); }); suite.test("reversed_list", () => { assertThat(reversed_list([0, 1, 2, 3, 4, 5, 6, 7])).isEqualTo([7, 6, 5, 4, 3, 2, 1, 0]); }); suite.test("splice_bit", () => { assertThat(splice_bit(0xFFFF, 4, false)).isEqualTo(0x1FFEF); assertThat(splice_bit(0xFFFF, 4, true)).isEqualTo(0x1FFFF); assertThat(splice_bit(0, 5, true)).isEqualTo(32); assertThat(splice_bit(0, 5, false)).isEqualTo(0); }); suite.test("repeat", () => { assertThat(repeat("a", 0)).isEqualTo([]); assertThat(repeat("a", 1)).isEqualTo(["a"]); assertThat(repeat("a", 2)).isEqualTo(["a", "a"]); }); suite.test("proper_mod", () => { assertThat(proper_mod(-10, 3)).isEqualTo(2); assertThat(proper_mod(-9, 3)).isEqualTo(0); assertThat(proper_mod(-2, 3)).isEqualTo(1); assertThat(proper_mod(-1, 3)).isEqualTo(2); assertThat(proper_mod(0, 3)).isEqualTo(0); assertThat(proper_mod(1, 3)).isEqualTo(1); assertThat(proper_mod(2, 3)).isEqualTo(2); assertThat(proper_mod(3, 3)).isEqualTo(0); assertThat(proper_mod(4, 3)).isEqualTo(1); assertThat(proper_mod(111, 11)).isEqualTo(1); });
33.406977
100
0.658197
9efe50b01854a9307c721f56e0a4cef5f7d15984
740
js
JavaScript
packages/tangem-server/documentLoader.js
OR13/nfc.did.ai
a1fa4ba0638c6a35f08f23d899f4f1df106abe4c
[ "Apache-2.0" ]
null
null
null
packages/tangem-server/documentLoader.js
OR13/nfc.did.ai
a1fa4ba0638c6a35f08f23d899f4f1df106abe4c
[ "Apache-2.0" ]
5
2021-03-10T18:38:57.000Z
2022-01-22T12:10:37.000Z
packages/tangem-server/documentLoader.js
OR13/nfc.did.ai
a1fa4ba0638c6a35f08f23d899f4f1df106abe4c
[ "Apache-2.0" ]
1
2020-10-29T09:46:47.000Z
2020-10-29T09:46:47.000Z
const { resolver } = require('@transmute/did-key.js'); const jsonld = require('jsonld'); const documentLoader = async (url) => { // console.log(url); if (url.indexOf('did:') === 0) { const didDoc = await resolver.resolve(url.split('#')[0]); return { contextUrl: null, // this is for a context via a link header document: didDoc, // this is the actual document that was loaded documentUrl: url, // this is the actual context URL after redirects }; } try { let data = await jsonld.documentLoader(url); return data; } catch (e) { console.error('No remote context support for ' + url); throw new Error('No custom context support for ' + url); } }; module.exports = documentLoader;
27.407407
73
0.639189
9eff561f595afd80e14e3bd5ad6c6d7d64b9aa83
1,438
js
JavaScript
test/DogCacheTests.js
adenflorian/random.dog
fb92469f3b7fafe781a23baf509c59082798d696
[ "MIT" ]
67
2017-04-08T04:46:42.000Z
2021-10-14T19:26:57.000Z
test/DogCacheTests.js
adenflorian/random.dog
fb92469f3b7fafe781a23baf509c59082798d696
[ "MIT" ]
26
2016-11-11T13:38:45.000Z
2021-12-20T03:52:55.000Z
test/DogCacheTests.js
adenflorian/random.dog
fb92469f3b7fafe781a23baf509c59082798d696
[ "MIT" ]
15
2016-11-11T12:23:16.000Z
2021-05-06T17:12:55.000Z
import {expect} from 'chai' import sinon from 'sinon' import {List} from 'immutable' import {DogCache} from '../src/DogCache' import * as utils from '../src/utils' describe('DogCache', () => { it('should throw a TypeError when passed undefined', () => { expect(() => new DogCache(undefined)).to.throw(TypeError, /^dogs must be a List$/) }) it('should throw an Error when passed empty List', () => { expect(() => new DogCache(new List())).to.throw(Error, /^dogs must have dogs in it$/) }) it('should throw an Error when passed List of numbers', () => { expect(() => new DogCache(new List([1]))).to.throw(Error, /^only dog strings allowed$/) }) it('should throw an Error when passed array of numbers and strings', () => { expect(() => new DogCache(new List(['1', 1, '1']))).to.throw(Error, /^only dog strings allowed$/) }) describe('random', () => { afterEach(() => utils.randomInt.restore && utils.randomInt.restore()) it('should return 1st dog when randomInt returns 0', () => { sinon.stub(utils, 'randomInt').returns(0) expect(new DogCache(new List(['dog1'])).random()).to.equal('dog1') }) it('should return 2nd dog when randomInt returns 1', () => { sinon.stub(utils, 'randomInt').returns(1) expect(new DogCache(new List(['dog1', 'dog2'])).random()).to.equal('dog2') }) }) })
46.387097
105
0.587622
9effd1b52baa2a63ffedc47e8d1cd2e41a64d1d8
1,748
js
JavaScript
cli.js
rudolfoborges/alfred-cli
c59fbe1989b3eb78643cfb996f45abb2db3cc02c
[ "Apache-2.0" ]
1
2015-04-12T00:13:54.000Z
2015-04-12T00:13:54.000Z
cli.js
rudolfoborges/alfred-cli
c59fbe1989b3eb78643cfb996f45abb2db3cc02c
[ "Apache-2.0" ]
null
null
null
cli.js
rudolfoborges/alfred-cli
c59fbe1989b3eb78643cfb996f45abb2db3cc02c
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env node 'use strict'; var CommandBuilder = require('./bin/command.builder'), program = require('commander'), inquirer = require("inquirer"); var commandBuilder = new CommandBuilder(); program .version('0.0.1') .usage('[command]') .option('init', 'Starts a new Alfred project in the current PATH.') .option('model <option> <name>', 'Add or remove a model. \n\t\t\t\t\t -> [add] Add a new model \n\t\t\t\t\t -> [rm] Remove a model') //.option('model-template <option> <name>', 'Add or remove a model template. \n\t\t\t\t\t -> [add] Add a new model template. \n\t\t\t\t\t -> [rm] Remove a model template') .option('app-template <option> <name>', 'Add or remove an application template. \n\t\t\t\t\t -> [add] Add a new application template. \n\t\t\t\t\t -> [rm] Remove an application template') .option('generate <model> <task>', 'Generate model') program.on('-h, --help', function(){ program.help(); }); program.on('init', function(){ var question = { type: 'list', name: 'platform', message: 'What kind of application platform?', choices: [ 'Java', 'Ruby', 'Node', '.Net', 'Python', 'Other'], } inquirer.prompt([question], function(answers){ commandBuilder.build('init').execute(program.init, answers); }); }); program.on('model', function(){ var name = program.rawArgs[program.rawArgs.length - 1]; var arg = program.rawArgs[program.rawArgs.length - 2]; commandBuilder.build('model').execute(name, arg); }); program.on('template', function(){ var name = program.rawArgs[program.rawArgs.length - 1]; var arg = program.rawArgs[program.rawArgs.length - 2]; commandBuilder.build('template').execute(name, arg); }); program.parse(process.argv);
35.673469
191
0.646453
7300bb38fa3cebe48fd5e63f9e08fabe565a71d7
378
js
JavaScript
client/src/scripts/util/createPureClass.js
rileyjshaw/challenger
02a8fce5339a19ec665c237366e8b89ee8918d5b
[ "MIT" ]
120
2015-04-28T14:02:00.000Z
2021-01-15T05:01:58.000Z
client/src/scripts/util/createPureClass.js
rileyjshaw/challenger
02a8fce5339a19ec665c237366e8b89ee8918d5b
[ "MIT" ]
4
2015-04-28T09:00:54.000Z
2016-08-27T14:24:44.000Z
client/src/scripts/util/createPureClass.js
rileyjshaw/challenger
02a8fce5339a19ec665c237366e8b89ee8918d5b
[ "MIT" ]
13
2015-05-06T06:36:10.000Z
2020-03-24T00:35:07.000Z
var React = require('react'); var PureRenderMixin = require('react/addons').addons.PureRenderMixin; function createPureClass (specification) { if (!specification.mixins){ specification.mixins = []; } specification.mixins.push(PureRenderMixin); return React.createClass(specification); } // allow for single-line require module.exports = {React, createPureClass};
25.2
69
0.751323
7300ca4b2accc6780bfaaf7a02ca9a243ad47e36
2,929
js
JavaScript
plugins/inputex/lib/inputex/js/widgets/listCustom.js
simonschaufi/wireit
83b93bace0c5b9b8c41136ef08021e24f75384ac
[ "MIT" ]
2
2015-11-05T21:44:29.000Z
2016-07-23T16:31:32.000Z
inputex/js/widgets/listCustom.js
couchone/Cicada
d563f08eee2d427149d1f355fc1f01331474baa1
[ "Apache-2.0" ]
null
null
null
inputex/js/widgets/listCustom.js
couchone/Cicada
d563f08eee2d427149d1f355fc1f01331474baa1
[ "Apache-2.0" ]
null
null
null
(function() { var lang = YAHOO.lang; var inputEx = YAHOO.inputEx; inputEx.widget.ListCustom = function(options) { this.listSelectOptions = options.listSelectOptions; this.maxItems = options.maxItems; this.maxItemsAlert = options.maxItemsAlert; inputEx.widget.ListCustom.superclass.constructor.call(this,options); this.selects = []; }; YAHOO.lang.extend(inputEx.widget.ListCustom,inputEx.widget.DDList,{ /** * Add an item to the list * @param {String|Object} item Either a string with the given value or an object with "label" and "value" attributes */ addItem: function(item) { if (this.maxItems && this.items.length >= this.maxItems){ this.maxItemsAlert ? this.maxItemsAlert.call() : alert("You're limited to "+this.maxItems+" items"); return; } var label = (typeof item == "object") ? item.label : item ; var li = inputEx.cn('li', {className: 'inputEx-DDList-item'}); var span = inputEx.cn('span', null, null, label) if(this.listSelectOptions){ var select = new inputEx.SelectField(this.listSelectOptions); this.selects.push(select); li.appendChild(select.el); item.getValue = function(){ return {select: select.getValue(), label: this.label, value: this.value}; } item.setValue = function(obj){ span.innerHTML = obj.label; this.label = obj.label; this.value = obj.value; select.setValue(obj.select); } } else { item.getValue = function(){ result = {}; if(this.value) result.value = this.value; if(this.label) result.label = this.label; return result; } item.setValue = function(obj){ span.innerHTML = obj.label; this.label = obj.label; this.value = obj.value; } } li.appendChild(span); // Option for the "remove" link (default: true) if(!!this.options.allowDelete){ var removeLink = inputEx.cn('div', {className:"removeButton"}, null, ""); li.appendChild( removeLink ); Event.addListener(removeLink, 'click', function(e) { var a = Event.getTarget(e); var li = a.parentNode; this.removeItem( inputEx.indexOf(li,this.ul.childNodes) ); }, this, true); } // Don't want any drag and drop //var dditem = new inputEx.widget.DDListItem(li); // this.items.push( item ); this.ul.appendChild(li); }, getValue: function(){ var results = []; for(var i in this.items){ results.push(this.items[i].getValue()); } return results; }, setValue: function(objs){ if(this.items.length > objs.length){ for (var i = 0; i< this.items.length -objs.length; i++){ this.removeItem(this.items.length-1-i); } } for (i in objs){ if (this.items[i]){ this.items[i].setValue(objs[i]); } else { this.addItem(objs[i]); } } } }); })();
28.436893
119
0.609764
73010e2576cc15b759f4134cf433fe0e646e8e4d
744
js
JavaScript
src/components/Router/AdminRoute.js
ics-codebase/ics-frontend
0b26526454b6ecec919789d814a53af248b78751
[ "MIT" ]
2
2021-06-09T16:31:43.000Z
2021-06-10T20:59:38.000Z
src/components/Router/AdminRoute.js
ics-codebase/ics-frontend
0b26526454b6ecec919789d814a53af248b78751
[ "MIT" ]
1
2021-11-08T11:06:11.000Z
2021-11-08T11:06:11.000Z
src/components/Router/AdminRoute.js
ics-codebase/ics-frontend
0b26526454b6ecec919789d814a53af248b78751
[ "MIT" ]
2
2021-07-08T18:12:14.000Z
2021-11-03T10:50:28.000Z
import React, { useEffect } from 'react'; import { Route, Redirect } from 'react-router-dom'; import { useStores } from '../../hooks/use-stores'; import { useCookies } from 'react-cookie'; import userService from '../../services/user'; import Cookies from 'js-cookie'; const AdminRoute = ({ component: Component, ...rest }) => { const { userStore } = useStores(); const [ cookies, setCookie ] = useCookies([ 'token' ]); return ( <Route {...rest} render={(props) => userStore.isAuthenticated && userStore.user.role ==='admin' ? ( <Component {...props} /> ) : ( <Redirect to={{ pathname: '/login', state: { from: props.location } }} /> )} /> ); }; export default AdminRoute;
23.25
67
0.58871
730193003cebb6adba27a2af24f3ae1408410f4c
975
js
JavaScript
example/auth.js
noffle/materialized-group-auth
173c756aae002d64a759f99b14be497e31774a89
[ "BSD-2-Clause" ]
null
null
null
example/auth.js
noffle/materialized-group-auth
173c756aae002d64a759f99b14be497e31774a89
[ "BSD-2-Clause" ]
null
null
null
example/auth.js
noffle/materialized-group-auth
173c756aae002d64a759f99b14be497e31774a89
[ "BSD-2-Clause" ]
null
null
null
var mauth = require('../') var db = require('level')('/tmp/auth.db') var auth = mauth(db) var minimist = require('minimist') var argv = minimist(process.argv.slice(2)) if (argv._[0] === 'write') { var doc = { type: argv.type, key: argv.key, by: argv.by || null, role: argv.role, group: argv.group, id: argv.id } auth.batch([doc], function (err) { if (err) console.error(err) }) } else if (argv._[0] === 'groups') { auth.getGroups(function (err, groups) { if (err) return console.error(err) groups.forEach((group) => console.log(group)) }) } else if (argv._[0] === 'members') { auth.getMembers(argv._[1], function (err, members) { if (err) return console.error(err) members.forEach((member) => console.log(member)) }) } else if (argv._[0] === 'membership') { auth.getMembership(argv._[1], function (err, groups) { if (err) return console.error(err) groups.forEach((groups) => console.log(groups)) }) }
27.083333
56
0.607179
7301f35e9da2c0df7a6bc48d144853ad2f583c8c
1,431
js
JavaScript
test/setup.js
rstacruz/navstack
2f25863182a5013f0f2589823ae79e1b1239b234
[ "MIT" ]
83
2015-01-05T15:11:31.000Z
2022-03-25T20:24:11.000Z
test/setup.js
rstacruz/navstack
2f25863182a5013f0f2589823ae79e1b1239b234
[ "MIT" ]
6
2015-01-26T20:32:07.000Z
2016-11-17T01:00:25.000Z
test/setup.js
rstacruz/navstack
2f25863182a5013f0f2589823ae79e1b1239b234
[ "MIT" ]
13
2015-01-05T15:11:31.000Z
2017-05-11T23:45:29.000Z
var cov = (!! process.env.cov); // Deps global.chai = require('chai'); global.expect = require('chai').expect; chai.use(require('chai-fuzzy')); chai.should(); var fs = require('fs'); var scripts = { 'jq': fs.readFileSync('vendor/jquery-2.0.2.js'), 'navstack': fs.readFileSync('navstack.js') }; function myEnv() { var jsdom = require('jsdom'); return function(done) { jsdom.env({ html: '<!doctype html>', src: [ scripts.jq, scripts.navstack ], done: function(errors, window) { if (errors) { errors.forEach(function (e) { console.error(e.data); }); return done(errors[0].data.error); } window.navigator.test = true; window.console = console; global.window = window; global.$ = window.$; global.jQuery = window.jQuery; global.Ractive = window.Ractive; global.Navstack = window.Navstack; global.document = window.document; // window._$jscoverage = global._$jscoverage; global._$jscoverage = window._$jscoverage; chai.use(require('chai-jquery')); done(); } }); }; } before(myEnv()); global.testSuite = describe; beforeEach(function () { global.sinon = require('sinon').sandbox.create(); }); afterEach(function () { global.sinon.restore(); }); // Reset when needed beforeEach(function () { $('body').html(''); Navstack.flushQueue(); });
23.080645
66
0.59399
7301f8c2eb76a57aacf8a387d82af4b9ecd8238c
1,916
js
JavaScript
Realization/frontend/czechidm-core/src/components/advanced/Form/DateTimeFormAttributeRenderer.js
piougy/CzechIdMng
41b5220c1aa0189dbad17d91aee776f564aa1217
[ "MIT" ]
null
null
null
Realization/frontend/czechidm-core/src/components/advanced/Form/DateTimeFormAttributeRenderer.js
piougy/CzechIdMng
41b5220c1aa0189dbad17d91aee776f564aa1217
[ "MIT" ]
null
null
null
Realization/frontend/czechidm-core/src/components/advanced/Form/DateTimeFormAttributeRenderer.js
piougy/CzechIdMng
41b5220c1aa0189dbad17d91aee776f564aa1217
[ "MIT" ]
null
null
null
import React from 'react'; // import * as Basic from '../../basic'; import AbstractFormAttributeRenderer from './AbstractFormAttributeRenderer'; /** * DateTime form value component * - based on DateTimePicker - mode (date / datetime) is supported * * @author Radek Tomiška */ export default class DateTimeFormAttributeRenderer extends AbstractFormAttributeRenderer { /** * Fill form value field by persistent type from input value * * @param {FormValue} formValue - form value * @param {[type]} formComponent * @return {FormValue} */ fillFormValue(formValue, rawValue) { formValue.dateValue = rawValue; // common value can be used without persistent type knowlege (e.g. conversion to properties object) formValue.value = formValue.dateValue; // return formValue; } /** * Returns value to ipnut from given (persisted) form value * * @param {FormValue} formValue * @return {object} value by persistent type */ getInputValue(formValue) { return formValue.dateValue ? formValue.dateValue : formValue.value; } renderSingleInput(originalValues) { const { attribute, values, validationErrors, className, style } = this.props; const showOriginalValue = !!originalValues; // return ( <Basic.DateTimePicker ref={ AbstractFormAttributeRenderer.INPUT } mode={ attribute.persistentType.toLowerCase() } required={ this.isRequired() } label={ this.getLabel(null, showOriginalValue) } placeholder={ this.getPlaceholder() } value={ this.toInputValue(showOriginalValue ? originalValues : values) } helpBlock={ this.getHelpBlock() } readOnly={ showOriginalValue ? true : this.isReadOnly() } validationErrors={ validationErrors } validationMessage={ attribute.validationMessage } className={ className } style={ style}/> ); } }
31.409836
103
0.682672
7302477cf95261fb841d7d900a8f982414f7d4df
781
js
JavaScript
bootstrapOperation/getMiddleware/security/index.js
chrisdostert/koa-open-api-js
87fb718c5c7525a172df708b269ff128d321c6ed
[ "MIT" ]
1
2018-08-10T02:47:58.000Z
2018-08-10T02:47:58.000Z
bootstrapOperation/getMiddleware/security/index.js
chrisdostert/koa-open-api-js
87fb718c5c7525a172df708b269ff128d321c6ed
[ "MIT" ]
null
null
null
bootstrapOperation/getMiddleware/security/index.js
chrisdostert/koa-open-api-js
87fb718c5c7525a172df708b269ff128d321c6ed
[ "MIT" ]
null
null
null
const http = require('./http') const oauth2 = require('./oauth2') /** * gets middleware which handles security */ function getSecurityMiddleware ({ api, operation }) { const middleware = [] // security can be declared at api &/or operation levels. const security = [...(api.security || []), ...(operation.security || [])] security.forEach(securityItem => { Object.entries(securityItem) .forEach(([name]) => { const {scheme, type} = api.components.securitySchemes[name] switch (type) { case 'http': middleware.push(...http({name, scheme})) return case 'oauth2': middleware.push(...oauth2({name})) } }) }) return middleware } module.exports = getSecurityMiddleware
23.666667
75
0.59411
7302d795e3b082412cdb18f86e76efe82f8ef4e5
24,254
js
JavaScript
src/static/js/fantom_ryuinu.js
polyfalcon/vfat-tools
71ae1bba639411e7d63cc70d550c732a8dea311e
[ "MIT" ]
null
null
null
src/static/js/fantom_ryuinu.js
polyfalcon/vfat-tools
71ae1bba639411e7d63cc70d550c732a8dea311e
[ "MIT" ]
null
null
null
src/static/js/fantom_ryuinu.js
polyfalcon/vfat-tools
71ae1bba639411e7d63cc70d550c732a8dea311e
[ "MIT" ]
null
null
null
$(function() { consoleInit(main) }); const RYUINU_MASTERCHEF_ABI = [{"inputs":[{"internalType":"contract IERC20Mintable","name":"_farmToken","type":"address"},{"internalType":"address","name":"_devAddress","type":"address"},{"internalType":"address","name":"_feeAddress","type":"address"},{"internalType":"uint256","name":"_startBlock","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldBp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBp","type":"uint256"}],"name":"ReferralBonusBpChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"userTo","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"ReferralPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint32","name":"role","type":"uint32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint32","name":"role","type":"uint32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"send","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"newAddress","type":"address"}],"name":"SetDevAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"newAddress","type":"address"}],"name":"SetFeeAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"contract IReferral","name":"newAddress","type":"address"}],"name":"SetReferralAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"farmTokenPerBlock","type":"uint256"}],"name":"UpdateEmissionRate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint224","name":"maxSupply","type":"uint224"}],"name":"UpdateMaxSupply","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"ADMINS","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[],"name":"BONUS_MULTIPLIER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[],"name":"GUESTS","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[],"name":"MAXIMUM_DEPOSIT_FEE_BP","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[],"name":"MAXIMUM_REFERRAL_BP","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[],"name":"OPERATORS","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[],"name":"devAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[],"name":"farmToken","outputs":[{"internalType":"contract IERC20Mintable","name":"","type":"address"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[],"name":"farmTokenPerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[],"name":"feeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[],"name":"getAllMembers","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[{"internalType":"uint32","name":"_role","type":"uint32"},{"internalType":"address","name":"_address","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"role","type":"uint32"},{"internalType":"address","name":"_address","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint224","name":"","type":"uint224"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"name":"poolExistence","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"name":"poolIdForLpAddress","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"contract IERC20","name":"lpToken","type":"address"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"lastRewardBlock","type":"uint256"},{"internalType":"uint256","name":"accFarmTokenPerShare","type":"uint256"},{"internalType":"uint16","name":"depositFeeBP","type":"uint16"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[],"name":"refBonusBP","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[],"name":"referral","outputs":[{"internalType":"contract IReferral","name":"","type":"address"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[{"internalType":"uint32","name":"_role","type":"uint32"},{"internalType":"address","name":"_address","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_role","type":"uint32"},{"internalType":"address","name":"_address","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[],"name":"totalAllocPoint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[{"internalType":"contract IERC20","name":"_lpToken","type":"address"}],"name":"getPoolIdForLpToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"contract IERC20","name":"_lpToken","type":"address"},{"internalType":"uint16","name":"_depositFeeBP","type":"uint16"},{"internalType":"bool","name":"_withUpdate","type":"bool"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"uint16","name":"_depositFeeBP","type":"uint16"},{"internalType":"bool","name":"_withUpdate","type":"bool"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"multiplierNumber","type":"uint256"}],"name":"updateMultiplier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_from","type":"uint256"},{"internalType":"uint256","name":"_to","type":"uint256"}],"name":"getMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"pendingFarmToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function","constant":true},{"inputs":[],"name":"massUpdatePools","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"updatePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_referrer","type":"address"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_devAddress","type":"address"}],"name":"setDevAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeAddress","type":"address"}],"name":"setFeeAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_farmTokenPerBlock","type":"uint256"},{"internalType":"bool","name":"_withUpdate","type":"bool"}],"name":"updateEmissionRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint224","name":"_maxSupply","type":"uint224"}],"name":"updateMaxSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IReferral","name":"_referral","type":"address"}],"name":"setReferralAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_newRefBonusBp","type":"uint16"}],"name":"updateReferralBonusBp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_startBlock","type":"uint256"}],"name":"updateStartBlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"migrateFarmToken","outputs":[],"stateMutability":"nonpayable","type":"function"}] async function main() { const App = await init_ethers(); _print(`Initialized ${App.YOUR_ADDRESS}\n`); _print("Reading smart contracts...\n"); const RYUINU_MASTERCHEF_ADDR = "0xf87430778eaCfAfD19824542879aCbb0BF3f0881"; const rewardTokenTicker = "RYUINU"; const RYUINU_MASTERCHEF = new ethers.Contract(RYUINU_MASTERCHEF_ADDR, RYUINU_MASTERCHEF_ABI, App.provider); const startBlock = await RYUINU_MASTERCHEF.startBlock(); const currentBlock = await App.provider.getBlockNumber(); let rewardsPerWeek = 0 if(currentBlock < startBlock){ _print(`Rewards start at block ${startBlock}\n`); }else{ rewardsPerWeek = await RYUINU_MASTERCHEF.farmTokenPerBlock() /1e18 * 604800 / 2.1; } const tokens = {}; const prices = await getFantomPrices(); // changed await loadRyuInuChefContract(App, tokens, prices, RYUINU_MASTERCHEF, RYUINU_MASTERCHEF_ADDR, RYUINU_MASTERCHEF_ABI, rewardTokenTicker, "farmToken", null, rewardsPerWeek, "pendingFarmToken", [1]); hideLoading(); } /** * loadChefContract from fantom_helpers.js */ async function loadRyuInuChefContract(App, tokens, prices, chef, chefAddress, chefAbi, rewardTokenTicker, rewardTokenFunction, rewardsPerBlockFunction, rewardsPerWeekFixed, pendingRewardsFunction, deathPoolIndices) { const chefContract = chef ?? new ethers.Contract(chefAddress, chefAbi, App.provider); const poolCount = parseInt(await chefContract.poolLength(), 10); const totalAllocPoints = await chefContract.totalAllocPoint(); _print(`Found ${poolCount} pools.\n`) _print(`Showing incentivized pools only.\n`); var tokens = {}; const rewardTokenAddress = await chefContract.callStatic[rewardTokenFunction](); const rewardToken = await getFantomToken(App, rewardTokenAddress, chefAddress); const rewardsPerWeek = rewardsPerWeekFixed ?? await chefContract.callStatic[rewardsPerBlockFunction]() / 10 ** rewardToken.decimals * 604800 / 3 const poolInfos = await Promise.all([...Array(poolCount).keys()].map(async (x) => await getFantomPoolInfo(App, chefContract, chefAddress, x, pendingRewardsFunction))); var tokenAddresses = [].concat.apply([], poolInfos.filter(x => x.poolToken).map(x => x.poolToken.tokens)); await Promise.all(tokenAddresses.map(async (address) => { tokens[address] = await getFantomToken(App, address, chefAddress); })); if (deathPoolIndices) { //load prices for the deathpool assets deathPoolIndices.map(i => poolInfos[i]) .map(poolInfo => poolInfo.poolToken ? getPoolPrices(tokens, prices, poolInfo.poolToken, "fantom") : undefined); } const poolPrices = poolInfos.map(poolInfo => poolInfo.poolToken ? getPoolPrices(tokens, prices, poolInfo.poolToken, "fantom") : undefined); _print("Finished reading smart contracts.\n"); let aprs = [] for (i = 0; i < poolCount; i++) { if (poolPrices[i]) { // changed const apr = printRyuInuChefPool(App, chefAbi, chefAddress, prices, tokens, poolInfos[i], i, poolPrices[i], totalAllocPoints, rewardsPerWeek, rewardTokenTicker, rewardTokenAddress, pendingRewardsFunction, null, null, "fantom", poolInfos[i].depositFee, poolInfos[i].withdrawFee) aprs.push(apr); } } let totalUserStaked=0, totalStaked=0, averageApr=0; for (const a of aprs) { if (!isNaN(a.totalStakedUsd)) { totalStaked += a.totalStakedUsd; } if (a.userStakedUsd > 0) { totalUserStaked += a.userStakedUsd; averageApr += a.userStakedUsd * a.yearlyAPR / 100; } } averageApr = averageApr / totalUserStaked; _print_bold(`Total Staked: $${formatMoney(totalStaked)}`); if (totalUserStaked > 0) { _print_bold(`\nYou are staking a total of $${formatMoney(totalUserStaked)} at an average APR of ${(averageApr * 100).toFixed(2)}%`) _print(`Estimated earnings:` + ` Day $${formatMoney(totalUserStaked*averageApr/365)}` + ` Week $${formatMoney(totalUserStaked*averageApr/52)}` + ` Year $${formatMoney(totalUserStaked*averageApr)}\n`); } return { prices, totalUserStaked, totalStaked, averageApr } } /** * printChefPool from ethers_helper.js */ function printRyuInuChefPool(App, chefAbi, chefAddr, prices, tokens_, poolInfo, poolIndex, poolPrices, totalAllocPoints, rewardsPerWeek, rewardTokenTicker, rewardTokenAddress, pendingRewardsFunction, fixedDecimals, claimFunction, chain="eth", depositFee=0, withdrawFee=0) { fixedDecimals = fixedDecimals ?? 2; const sp = (poolInfo.stakedToken == null) ? null : getPoolPrices(tokens_, prices, poolInfo.stakedToken, chain); var poolRewardsPerWeek = poolInfo.allocPoints / totalAllocPoints * rewardsPerWeek; if (poolRewardsPerWeek == 0 && rewardsPerWeek != 0) return; const userStaked = poolInfo.userLPStaked ?? poolInfo.userStaked; const rewardPrice = getParameterCaseInsensitive(prices, rewardTokenAddress)?.usd; const staked_tvl = sp?.staked_tvl ?? poolPrices.staked_tvl; _print_inline(`${poolIndex} - `); poolPrices.print_price(chain); sp?.print_price(chain); const apr = printAPR(rewardTokenTicker, rewardPrice, poolRewardsPerWeek, poolPrices.stakeTokenTicker, staked_tvl, userStaked, poolPrices.price, fixedDecimals); if (poolInfo.userLPStaked > 0) sp?.print_contained_price(userStaked); if (poolInfo.userStaked > 0) poolPrices.print_contained_price(userStaked); // changed printRyuInuChefContractLinks(App, chefAbi, chefAddr, poolIndex, poolInfo.address, pendingRewardsFunction, rewardTokenTicker, poolPrices.stakeTokenTicker, poolInfo.poolToken.unstaked, poolInfo.userStaked, poolInfo.pendingRewardTokens, fixedDecimals, claimFunction, rewardPrice, chain, depositFee, withdrawFee); return apr; } /** * printChefContractLinks from ethers_helper.js */ function printRyuInuChefContractLinks(App, chefAbi, chefAddr, poolIndex, poolAddress, pendingRewardsFunction, rewardTokenTicker, stakeTokenTicker, unstaked, userStaked, pendingRewardTokens, fixedDecimals, claimFunction, rewardTokenPrice, chain, depositFee, withdrawFee) { fixedDecimals = fixedDecimals ?? 2; // changed const approveAndStake = async function() { return ryuInuChefContract_stake(chefAbi, chefAddr, poolIndex, poolAddress, App) } // no need to change const unstake = async function() { return ryuInuChefContract_unstake(chefAbi, chefAddr, poolIndex, App, pendingRewardsFunction) } // changed const claim = async function() { return ryuInuChefContract_claim(chefAbi, chefAddr, poolIndex, App, pendingRewardsFunction, claimFunction) } if(depositFee > 0){ _print_link(`Stake ${unstaked.toFixed(fixedDecimals)} ${stakeTokenTicker} - Fee ${depositFee}%`, approveAndStake) }else{ _print_link(`Stake ${unstaked.toFixed(fixedDecimals)} ${stakeTokenTicker}`, approveAndStake) } if(withdrawFee > 0){ _print_link(`Unstake ${userStaked.toFixed(fixedDecimals)} ${stakeTokenTicker} - Fee ${withdrawFee}%`, unstake) }else{ _print_link(`Unstake ${userStaked.toFixed(fixedDecimals)} ${stakeTokenTicker}`, unstake) } _print_link(`Claim ${pendingRewardTokens.toFixed(fixedDecimals)} ${rewardTokenTicker} ($${formatMoney(pendingRewardTokens*rewardTokenPrice)})`, claim) _print(`Staking or unstaking also claims rewards.`) _print(""); } /** * chefContract_stake from ethers_helper.js */ const ryuInuChefContract_stake = async function(chefAbi, chefAddress, poolIndex, stakeTokenAddr, App) { const signer = App.provider.getSigner() const STAKING_TOKEN = new ethers.Contract(stakeTokenAddr, ERC20_ABI, signer) const CHEF_CONTRACT = new ethers.Contract(chefAddress, chefAbi, signer) const currentTokens = await STAKING_TOKEN.balanceOf(App.YOUR_ADDRESS) const allowedTokens = await STAKING_TOKEN.allowance(App.YOUR_ADDRESS, chefAddress) // added const refAddress = "0x0000000000000000000000000000000000000000"; let allow = Promise.resolve() if (allowedTokens / 1e18 < currentTokens / 1e18) { showLoading() allow = STAKING_TOKEN.approve(chefAddress, ethers.constants.MaxUint256) .then(function(t) { return App.provider.waitForTransaction(t.hash) }) .catch(function() { hideLoading() alert('Try resetting your approval to 0 first') }) } if (currentTokens / 1e18 > 0) { showLoading() allow .then(async function() { // added refAddress CHEF_CONTRACT.deposit(poolIndex, currentTokens, refAddress, {gasLimit: 500000}) .then(function(t) { App.provider.waitForTransaction(t.hash).then(function() { hideLoading() }) }) .catch(function() { hideLoading() _print('Something went wrong.') }) }) .catch(function() { hideLoading() _print('Something went wrong.') }) } else { alert('You have no tokens to stake!!') } } const ryuInuChefContract_unstake = async function(chefAbi, chefAddress, poolIndex, App, pendingRewardsFunction) { const signer = App.provider.getSigner() const CHEF_CONTRACT = new ethers.Contract(chefAddress, chefAbi, signer) const currentStakedAmount = (await CHEF_CONTRACT.userInfo(poolIndex, App.YOUR_ADDRESS)).amount const earnedTokenAmount = await CHEF_CONTRACT.callStatic[pendingRewardsFunction](poolIndex, App.YOUR_ADDRESS) / 1e18 if (earnedTokenAmount >= 0) { showLoading() CHEF_CONTRACT.withdraw(poolIndex, currentStakedAmount, {gasLimit: 500000}) .then(function(t) { return App.provider.waitForTransaction(t.hash) }) .catch(function() { hideLoading() }) } } /** * chefContract_claim from ethers_helper.js */ const ryuInuChefContract_claim = async function(chefAbi, chefAddress, poolIndex, App, pendingRewardsFunction, claimFunction) { const signer = App.provider.getSigner() const CHEF_CONTRACT = new ethers.Contract(chefAddress, chefAbi, signer) // added const refAddress = "0x0000000000000000000000000000000000000000"; const earnedTokenAmount = await CHEF_CONTRACT.callStatic[pendingRewardsFunction](poolIndex, App.YOUR_ADDRESS) / 1e18 if (earnedTokenAmount > 0) { showLoading() if (claimFunction) { claimFunction(poolIndex, {gasLimit: 500000}) .then(function(t) { return App.provider.waitForTransaction(t.hash) }) } else { // added refAddress CHEF_CONTRACT.deposit(poolIndex, 0, refAddress, {gasLimit: 500000}) .then(function(t) { return App.provider.waitForTransaction(t.hash) }) .catch(function() { hideLoading() }) } } }
86.007092
12,624
0.666199
7303515705ca46e849e4e39c46c031331e4c2bf7
863
js
JavaScript
apps/src/gamelab/AnimationTab/animationTabModule.js
pickettd/code-dot-org
20a6b232178e4389e1189b3bdcf0dc87ba59ec90
[ "Apache-2.0" ]
null
null
null
apps/src/gamelab/AnimationTab/animationTabModule.js
pickettd/code-dot-org
20a6b232178e4389e1189b3bdcf0dc87ba59ec90
[ "Apache-2.0" ]
null
null
null
apps/src/gamelab/AnimationTab/animationTabModule.js
pickettd/code-dot-org
20a6b232178e4389e1189b3bdcf0dc87ba59ec90
[ "Apache-2.0" ]
null
null
null
/** @file Redux actions and reducer for the AnimationTab */ 'use strict'; var combineReducers = require('redux').combineReducers; var GameLabActionType = require('../actions').ActionType; var SELECT_ANIMATION = 'AnimationTab/SELECT_ANIMATION'; exports.default = combineReducers({ selectedAnimation: selectedAnimation }); function selectedAnimation(state, action) { state = state || ''; switch (action.type) { case GameLabActionType.ADD_ANIMATION_AT: return action.animationProps.key; case SELECT_ANIMATION: return action.animationKey; default: return state; } } /** * Select an animation in the animation list. * @param {!string} animationKey * @returns {{type: string, animationKey: string}} */ exports.selectAnimation = function (animationKey) { return { type: SELECT_ANIMATION, animationKey: animationKey }; };
26.151515
64
0.726535
7304370bf0ec0348767545ba4c74bbc5cd93bfe2
9,367
js
JavaScript
docs/tests/screen.js
zanachka/creepjs
7a8ba027ae2b9724d09d35d8042fbd31aa0e7b78
[ "MIT" ]
1
2020-07-05T10:03:43.000Z
2020-07-05T10:03:43.000Z
docs/tests/screen.js
zanachka/creepjs
7a8ba027ae2b9724d09d35d8042fbd31aa0e7b78
[ "MIT" ]
21
2020-05-23T07:57:37.000Z
2020-07-06T01:02:20.000Z
docs/tests/screen.js
abrahamjuliot/CreepJS
236d0b348b509fb7e696c07ccc67321659765bd4
[ "MIT" ]
null
null
null
(async () => { const hashMini = x => { if (!x) return x const json = `${JSON.stringify(x)}` const hash = json.split('').reduce((hash, char, i) => { return Math.imul(31, hash) + json.charCodeAt(i) | 0 }, 0x811c9dc5) return ('0000000' + (hash >>> 0).toString(16)).substr(-8) } // template views const patch = (oldEl, newEl) => oldEl.parentNode.replaceChild(newEl, oldEl) const html = (str, ...expressionSet) => { const template = document.createElement('template') template.innerHTML = str.map((s, i) => `${s}${expressionSet[i] || ''}`).join('') return document.importNode(template.content, true) } const query = ({ type, rangeStart, rangeLen }) => { const el = document.getElementById('fingerprint-data') patch(el, html` <div id="fingerprint-data"> <style> ${[...Array(rangeLen)].map((slot, i) => { i += rangeStart return `@media(device-${type}:${i}px){body{--device-${type}:${i};}}` }).join('')} </style> </div> `) const style = getComputedStyle(document.body) return style.getPropertyValue(`--device-${type}`).trim() } const match = ({ type, rangeStart, rangeLen }) => { let found ;[...Array(rangeLen)].find((slot, i) => { i += rangeStart const { matches } = matchMedia(`(device-${type}:${i}px)`) || {} if (matches) { found = i } return matches }) return +found } const getScreenMedia = ({ width, height }) => { let widthMatch = query({ type: 'width', rangeStart: width, rangeLen: 1 }) let heightMatch = query({ type: 'height', rangeStart: height, rangeLen: 1 }) if (widthMatch && heightMatch) { return { width, height } } const rangeLen = 1000 ;[...Array(10)].find((slot, i) => { if (!widthMatch) { widthMatch = query({ type: 'width', rangeStart: i * rangeLen, rangeLen }) } if (!heightMatch) { heightMatch = query({ type: 'height', rangeStart: i * rangeLen, rangeLen }) } return widthMatch && heightMatch }) return { width: +widthMatch, height: +heightMatch } } const getScreenMatchMedia = ({ width, height }) => { let widthMatch = matchMedia(`(device-width:${width}px)`).matches let heightMatch = matchMedia(`(device-height:${height}px)`).matches if (widthMatch && heightMatch) { return { width, height } } const rangeLen = 1000 ;[...Array(10)].find((slot, i) => { if (!widthMatch) { widthMatch = match({ type: 'width', rangeStart: i * rangeLen, rangeLen }) } if (!heightMatch) { heightMatch = match({ type: 'height', rangeStart: i * rangeLen, rangeLen }) } return widthMatch && heightMatch }) return { width: +widthMatch, height: +heightMatch } } const getCSS = () => { const gcd = (a, b) => b == 0 ? a : gcd(b, a % b) const { innerWidth, innerHeight } = window const { width: screenWidth, height: screenHeight } = screen const ratio = gcd(innerWidth, innerHeight) const screenRatio = gcd(screenWidth, screenHeight) const aspectRatio = `${innerWidth / ratio}/${innerHeight / ratio}` const deviceAspectRatio = `${screenWidth / screenRatio}/${screenHeight / screenRatio}` const el = document.getElementById('fingerprint-data') patch(el, html` <div id="fingerprint-data"> <style> body { width: 100vw; height: 100vh; } @media (width: ${innerWidth}px) and (height: ${innerHeight}px) { body {--viewport: ${innerWidth} x ${innerHeight};} } @media (min-width: ${innerWidth}px) and (min-height: ${innerHeight}px) { body {--viewport: ${innerWidth} x ${innerHeight};} } @media (max-width: ${innerWidth}px) and (max-height: ${innerHeight}px) { body {--viewport: ${innerWidth} x ${innerHeight};} } @media (aspect-ratio: ${aspectRatio}) { body {--viewport-aspect-ratio: ${aspectRatio};} } @media (device-aspect-ratio: ${deviceAspectRatio}) { body {--device-aspect-ratio: ${deviceAspectRatio};} } @media (device-width: ${screenWidth}px) and (device-height: ${screenHeight}px) { body {--device-screen: ${screenWidth} x ${screenHeight};} } @media (display-mode: fullscreen) {body {--display-mode: fullscreen;}} @media (display-mode: standalone) {body {--display-mode: standalone;}} @media (display-mode: minimal-ui) {body {--display-mode: minimal-ui;}} @media (display-mode: browser) {body {--display-mode: browser;}} @media (orientation: landscape) {body {--orientation: landscape;}} @media (orientation: portrait) {body {--orientation: portrait;}} </style> </div> `) const { width: domRectWidth, height: domRectHeight } = document.body.getBoundingClientRect() const style = getComputedStyle(document.body) return { domRectViewport: [domRectWidth, domRectHeight], viewport: style.getPropertyValue('--viewport').trim() || undefined, viewportAspectRatio: style.getPropertyValue('--viewport-aspect-ratio').trim() || undefined, deviceAspectRatio: style.getPropertyValue('--device-aspect-ratio').trim() || undefined, deviceScreen: style.getPropertyValue('--device-screen').trim() || undefined, orientation: style.getPropertyValue('--orientation').trim() || undefined, displayMode: style.getPropertyValue('--display-mode').trim() || undefined } } const start = performance.now() const { width, height, availWidth, availHeight, colorDepth, pixelDepth, } = screen const { clientHeight, clientWidth } = document.documentElement const { type: orientationType } = screen.orientation || {} const vViewport = 'visualViewport' in window ? visualViewport : {} const { width: viewportWidth, height: viewportHeight } = vViewport const { width: mediaWidth, height: mediaHeight } = getScreenMedia({ width, height }) const { width: matchMediaWidth, height: matchMediaHeight } = getScreenMatchMedia({ width, height }) const { domRectViewport, viewport, viewportAspectRatio, deviceAspectRatio, deviceScreen, orientation, displayMode } = getCSS() const style = (a, b) => b.map((char, i) => char != a[i] ? `<span class="bold-fail">${char}</span>` : char).join('') const note = { unsupported: '<span class="blocked">unsupported</span>', blocked: '<span class="blocked">blocked</span>', lied: '<span class="lies">lied</span>' } const pad = x => x.padStart(22, '.') const fake = () => `<span class="fake">fake screen</span>` const el = document.getElementById('fingerprint-data') patch(el, html` <div id="fingerprint-data"> <style> #fingerprint-data > .jumbo { font-size: 32px; } .fake { color: #ca656e; background: #ca656e0d; border-radius: 2px; margin: 0 5px; padding: 1px 3px; } .bold-fail { color: #ca656e; font-weight: bold; } </style> <div class="visitor-info"> <strong>Screen</strong> </div> <div class="jumbo"> <div>${hashMini({ mediaWidth, mediaHeight })}</div> </div> <div class="flex-grid"> <div class="col-six relative"> <span class="aside-note">${(performance.now() - start).toFixed(2)}ms</span> <br> <div>${pad('@media search')}: ${ mediaWidth && mediaHeight ? `${'' + mediaWidth} x ${'' + mediaHeight}` : '<span class="fake">failed</span>' }</div> <div>${pad('matchMedia search')}: ${ matchMediaWidth && matchMediaHeight ? `${'' + matchMediaWidth} x ${'' + matchMediaHeight}` : '<span class="fake">failed</span>' }</div> <div>${pad('@media device')}: ${deviceScreen ? '' + deviceScreen : '<span class="fake">failed</span>'}</div> <div>${pad('device-aspect-ratio')}: ${deviceAspectRatio ? '' + deviceAspectRatio : '<span class="fake">failed</span>'}</div> <div>${pad('aspect-ratio')}: ${'' + viewportAspectRatio}</div> <div>${pad('screen')}: ${ style(('' + mediaWidth).split(''), ('' + width).split(''))} x ${style(('' + mediaHeight).split(''), ('' + height).split('')) }</div> <div>${pad('avail')}: ${'' + availWidth} x ${'' + availHeight}${ availWidth > width || availHeight > height ? '<span class="fake">out of bounds</span>' : '' }</div> <div>${pad('client')}: ${ style(('' + Math.round(domRectViewport[0])).split(''), ('' + clientWidth).split('')) } x ${'' + clientHeight} ${ clientWidth > width || clientHeight > height ? '<span class="fake">out of bounds</span>' : '' }</div> <div>${pad('inner')}: ${ style(('' + Math.round(domRectViewport[0])).split(''), ('' + innerWidth).split('')) } x ${'' + innerHeight} ${ innerWidth > width || innerHeight > height ? '<span class="fake">out of bounds</span>' : '' }</div> <div>${pad('outer')}: ${'' + outerWidth} x ${'' + outerHeight}${ outerWidth > width ? '<span class="fake">out of bounds</span>' : '' }</div> <div>${pad('@media viewport')}: ${'' + viewport}</div> <div>${pad('dom rect viewport')}: ${'' + domRectViewport.join(' x ')}</div> <div>${pad('visualViewport')}: ${viewportWidth && viewportHeight ? `${'' + viewportWidth} x ${'' + viewportHeight}` : note.unsupported}</div> <div>${pad('colorDepth')}: ${'' + colorDepth}</div> <div>${pad('pixelDepth')}: ${'' + pixelDepth}</div> <div>${pad('devicePixelRatio')}: ${'' + devicePixelRatio}</div> <div>${pad('orientation type')}: ${'' + orientationType}</div> <div>${pad('@media orientation')}: ${'' + orientation}</div> <div>${pad('@media display-mode')}: ${'' + displayMode}</div> </div> </div> </div> `) })()
35.082397
145
0.616099
7304935f85771c6c5b12bb72128f5e4efb239e62
11,582
js
JavaScript
src/templates/xformation-post.js
mustafa-synectiks/demo-xformation
30d4713994fef6f22fbfe25b4649bc86f45b4329
[ "MIT" ]
null
null
null
src/templates/xformation-post.js
mustafa-synectiks/demo-xformation
30d4713994fef6f22fbfe25b4649bc86f45b4329
[ "MIT" ]
null
null
null
src/templates/xformation-post.js
mustafa-synectiks/demo-xformation
30d4713994fef6f22fbfe25b4649bc86f45b4329
[ "MIT" ]
null
null
null
import React, { useState, useRef } from 'react'; import PropTypes from 'prop-types'; import { graphql } from 'gatsby'; import ScenarioSlider from '../components/ScenarioXformation/ScenarioSlider'; import SelectScenario from '../components/ScenarioXformation/SelectScenario'; import { AiFillCloseCircle } from 'react-icons/ai'; import '../css/scenario.css'; import Microsoft from '../img/scenario/homepage/microsoft.png'; import procurement from '../img/scenario/homepage/procurement.png'; import warehouse from '../img/scenario/homepage/warehouse.jpg'; import workflow from '../img/scenario/homepage/workflow.svg'; import cycle from '../img/scenario/homepage/procurement.svg'; import analysis from '../img/scenario/homepage/analysis.svg'; import telephone from '../img/scenario/homepage/telephone.svg'; import logo from '../img/scenario/homepage/logo.png'; import Login from '../components/Forms/Login'; import Register from '../components/Forms/Register'; import { TiSocialFacebook, TiSocialTwitter, TiSocialLinkedin, TiSocialYoutube, } from 'react-icons/ti'; export const XformationPageTemplate = ({ scenarios, slider }) => { const [showSelectScenario, setShowSelectScenario] = useState(false); const [showUseCase, setShowUseCase] = useState(false); const [useCase, setUseCase] = useState(null); const [showForm, setShowForm] = useState(false); const [showReg, setShowReg] = useState(false); function onClickSelectScenario() { setShowSelectScenario(true); } function onClickSelectScenarioClose() { setShowSelectScenario(false); } function onClickUseCase(uc) { if (uc.useCaseSlider) { setUseCase(uc); setShowUseCase(true); } } function onClickUseCaseClose() { setShowUseCase(false); } return ( <section id='scenario-bg'> <div className={`scenario-slider-container ${ showSelectScenario === true ? 'select-scenario' : '' } ${showUseCase === true ? 'select-usecase' : ''}`}> {/* <ScenarioHome /> */} {/* homePage Starts here*/} <div className='homePage-grid'> {/* Header Start */} <div className='header'> <div className='logo'> <img src={logo} alt='' /> </div> <div className='search-box'> <input type='search' name='' id='search-home' placeholder='Search Here...' /> </div> <div className='group-btn'> <a className='login' href='/login'> Login </a> <a className='register' href='/register'> Register </a> </div> </div> {/* Header End */} {/* <Register /> */} {showForm ? ( <div className='form-close-btn'> <button onClick={() => setShowForm(false)}> <AiFillCloseCircle /> </button> <Login /> </div> ) : null} {showReg ? ( <div className='reg-close-btn'> <button onClick={() => setShowReg(false)}> <AiFillCloseCircle /> </button> <Register /> </div> ) : null} <div className='banner-stack'> {/* banner Start */} <div className='banner'> <div className='banner-text'> {/* <h4>Get comprehensive control and visibility</h4> */} <p> XFORMATION SIMPLIFIED PROCUREMENT PROCESS WITH IMPROVED USER EXPERIENCE! </p> <h6> Transform your end-to-end procurement operations, personalized approvals, budget controls, and real-time information with our intuitive and easy-to-use solution. </h6> <div className='banner-btns'> <button className='login'>CONTACT US</button> {/* Scenario Button Starts*/} <div className={`scenario-select-container ${ showSelectScenario === true ? 'active' : '' } ${showUseCase === true ? 'active-usecase' : ''}`}> <button className='select' onClick={onClickSelectScenario}> SELECT SCENARIO </button> <SelectScenario scenarios={scenarios} onClickUseCase={onClickUseCase} onClickCloseScenario={onClickSelectScenarioClose} /> </div> {/* Scenario Button Ends*/} </div> </div> <div className='banner-img'> <img src={Microsoft} alt='' /> </div> <div className='banner-icons-stack'> <div className='article'> <div className='icon'> <img src={cycle} alt='' className='hover-animation' /> </div> <div className='icon-text-group'> <h6>Simplified Procurement Cycle</h6> <p> Lorem ipsum dolor sit amet, cons bh dolor, malesuada etili adipDon nec malesuada etgutet… </p> </div> </div> <div className='article'> <div className='icon'> <img className='hover-animation' src={workflow} alt='' /> </div> <div className='icon-text-group'> <h6>Purchasing Workflows</h6> <p> Lorem ipsum dolor sit amet, cons bh dolor, malesuada etili adipDon nec malesuada etgutet… </p> </div> </div> <div className='article'> <div className='icon'> <img className='hover-animation' src={analysis} alt='' /> </div> <div className='icon-text-group'> <h6>Supplier Analysis</h6> <p> Lorem ipsum dolor sit amet, cons bh dolor, malesuada etili adipDon nec malesuada etgutet… </p> </div> </div> </div> </div> {/* banner End */} {/* banner bottom Start*/} <div className='main-section'> {/* banner bottom End*/} {/* Procurement Start */} <div className='procurement'> <h2>End to End Procurement Process</h2> <img src={procurement} alt='' /> </div> {/* Procurement End */} <div className='warehouse'> <div className='warehouse-left'> <img src={warehouse} alt='' /> </div> <div className='warehouse-right'> <h6 className='we-are'>WHO WE ARE</h6> <h5>We give solution for your business and technology</h5> <p> Lorem ipsum dolor sit amet, cons bh dolor, malesuada etili adipDon nec malesu Lorem ipsum dolor sit amet, cons bh dolor, malesuada etgutet. Lorem ipsum dolor sit amet, cons bh dolor, malesuada etili adipDon nec malesu orem ipsum dolor sit amet, cons bh dolor, malesuada etgutet… </p> <div className='we-company'> <div className='first-row'> <span className='fh'>WE</span> <span className='fp'> are starter company with of creative mind to solve your business and IT problems </span> </div> <div className='second-row'> <a className='border-black'>LEARN MORE</a> <a className='register'>CONTACT US</a> </div> </div> </div> </div> <div className='footer-top'> <h4> Connect with us to simplify <br /> your your procurement process </h4> <a className='footer-contact'>Contact Us</a> <div className='telephone'> <img src={telephone} alt='' /> +00(00) 1234567 </div> </div> <div className='footer-bottom'> <div className='social-icons group-btn'> <div className='logo'> <img src={logo} alt='' /> </div> <ul className='social'> <li> <TiSocialFacebook className='icon-size' /> </li> <li> <TiSocialTwitter className='icon-size' /> </li> <li> <TiSocialLinkedin className='icon-size' /> </li> <li> <TiSocialYoutube className='icon-size-U' /> </li> </ul> </div> <p>Copyright © 2021 Synectiks Inc</p> </div> </div> </div> </div> {/* homePage Ends here*/} {/* <ScenarioSlider slider={slider} showMoreDetailsButton={true} /> */} </div> {showUseCase && ( <div className={`scenario-slider-container ${ showUseCase === true ? 'select-usecase' : '' }`}> <button className='close-btn' onClick={() => { onClickUseCaseClose(useCase); }}> <AiFillCloseCircle /> </button> <ScenarioSlider slider={useCase.useCaseSlider} showMoreDetailsButton={false} onClickUseCaseClose={onClickUseCaseClose} /> </div> )} </section> ); }; XformationPageTemplate.propTypes = { modules: PropTypes.array, scenarios: PropTypes.array, slider: PropTypes.array, }; const XformationPage = ({ data }) => { const { frontmatter } = data.markdownRemark; return ( <XformationPageTemplate modules={frontmatter.modules} scenarios={frontmatter.scenarios} slider={frontmatter.slider} /> ); }; XformationPage.propTypes = { data: PropTypes.shape({ markdownRemark: PropTypes.shape({ frontmatter: PropTypes.object, }), }), }; export default XformationPage; export const xformationPageQuery = graphql` query XformationPage($id: String!) { markdownRemark(id: { eq: $id }) { frontmatter { scenarios { img name subItems { img name useCaseSlider { img name text } } } slider { img name text moreDetails { moreDetailsName moreDetailsText moreDetailsImage { img } } } } } } `;
34.064706
90
0.476688
730496f0070b14b36d6e0f1ae3aba067a76552b7
2,780
js
JavaScript
Frontend/AngularJS/AngularJS JumpStart with Dan Wahlin/5 - Factories and Services/Code_1/UsingFactoriesAndServices/mysol_5_log/server.js
specter01wj/LAB-Udemy
9a81bbabc9f55e68f6cce68c50a6c3cae8ee426f
[ "MIT" ]
null
null
null
Frontend/AngularJS/AngularJS JumpStart with Dan Wahlin/5 - Factories and Services/Code_1/UsingFactoriesAndServices/mysol_5_log/server.js
specter01wj/LAB-Udemy
9a81bbabc9f55e68f6cce68c50a6c3cae8ee426f
[ "MIT" ]
89
2020-03-07T05:51:22.000Z
2022-03-02T15:52:45.000Z
Frontend/AngularJS/AngularJS JumpStart with Dan Wahlin/5 - Factories and Services/Code_1/UsingFactoriesAndServices/mysol_5_log/server.js
specter01wj/LAB-Udemy
9a81bbabc9f55e68f6cce68c50a6c3cae8ee426f
[ "MIT" ]
null
null
null
var express = require('express'), app = express(); //Express 3 //app.configure(function() { // app.use(express.static(__dirname, '/')); //}); //Express 4 app.use(express.static(__dirname + '/')); app.get('/customers/:id', function(req, res) { var customerId = parseInt(req.params.id); var data = {}; for (var i=0,len=customers.length;i<len;i++) { if (customers[i].id === customerId) { data = customers[i]; break; } } res.json(data); }); app.get('/customers', function(req, res) { // res.json(customers); res.json(500, { error: 'An error has occurred!' }); }); app.get('/orders', function(req, res) { var orders = []; for (var i=0,len=customers.length;i<len;i++) { if (customers[i].orders) { for (var j=0,ordersLen=customers[i].orders.length;j<ordersLen;j++) { orders.push(customers[i].orders[j]); } } } res.json(orders); }); app.delete('/customers/:id', function(req, res) { var customerId = parseInt(req.params.id); var data = { status: true }; for (var i=0,len=customers.length;i<len;i++) { if (customers[i].id === customerId) { customers.splice(i,1); data = { status: true }; break; } } res.json(data); }); app.listen(8080); console.log('Express listening on port 8080'); var customers = [ { id: 1, joined: '2000-12-02', name:'John', city:'Chandler', orderTotal: 9.9956, orders: [ { id: 1, product: 'Shoes', total: 9.9956 } ] }, { id: 2, joined: '1965-01-25', name:'Zed', city:'Las Vegas', orderTotal: 19.99, orders: [ { id: 2, product: 'Baseball', total: 9.995 }, { id: 3, product: 'Bat', total: 9.995 } ] }, { id: 3, joined: '1944-06-15', name:'Tina', city:'New York', orderTotal:44.99, orders: [ { id: 4, product: 'Headphones', total: 44.99 } ] }, { id: 4, joined: '1995-03-28', name:'Dave', city:'Seattle', orderTotal:101.50, orders: [ { id: 5, product: 'Kindle', total: 101.50 } ] } ];
23.166667
81
0.408273
7304f2835321f9c230ff07664b98f39e38e08ab4
1,575
js
JavaScript
src/reactReduxMiddleware/container/index.js
Gaara526/react-redux-train
37069873987e1fae5aa61c8ae95fc0c84682f10a
[ "MIT" ]
1
2018-12-27T10:02:41.000Z
2018-12-27T10:02:41.000Z
src/reactReduxMiddleware/container/index.js
Gaara526/react-redux-train
37069873987e1fae5aa61c8ae95fc0c84682f10a
[ "MIT" ]
null
null
null
src/reactReduxMiddleware/container/index.js
Gaara526/react-redux-train
37069873987e1fae5aa61c8ae95fc0c84682f10a
[ "MIT" ]
null
null
null
/** * @since 2018-12-14 15:10 * @author pengyumeng */ import React, { Component } from 'react'; import 'antd/dist/antd.css'; import { connect } from '../lib/react-redux'; import Number from '../components/Number'; import Alert from '../components/Alert'; import actions from '../actions'; import './index.pcss'; const mapStateToProps = (state) => ({ number: state.changeNumber.number, showAlert: state.toggleAlert.showAlert, }); class Demo extends Component { handleClickAdd = () => { this.props.dispatch({ type: actions.number.INCREMENT }); }; handleClickMinus = () => { this.props.dispatch({ type: actions.number.DECREMENT }); }; handleClickClear = () => { this.props.dispatch({ type: actions.number.CLEAR }); }; handleClickAlert = () => { this.props.dispatch({ type: actions.alert.TOGGLE_ALERT }); }; render() { const { number, showAlert, } = this.props; return ( <div className="wrap"> <h3>redux middleware</h3> <Number value={number} handleClickAdd={this.handleClickAdd} handleClickMinus={this.handleClickMinus} handleClickClear={this.handleClickClear} /> <Alert showAlert={showAlert} handleClickAlert={this.handleClickAlert} /> </div> ); } } export default connect( mapStateToProps, )(Demo);
24.609375
66
0.544127
73058281d79eb51ca493302ec7bbec879dd6d16d
2,813
js
JavaScript
tests/tests/classes/ServerlessFunctionTest.js
apaatsio/serverless
856c0d0847691cb4683d9357c69369dff7a9d0ef
[ "MIT" ]
null
null
null
tests/tests/classes/ServerlessFunctionTest.js
apaatsio/serverless
856c0d0847691cb4683d9357c69369dff7a9d0ef
[ "MIT" ]
null
null
null
tests/tests/classes/ServerlessFunctionTest.js
apaatsio/serverless
856c0d0847691cb4683d9357c69369dff7a9d0ef
[ "MIT" ]
null
null
null
'use strict'; /** * Test: Serverless Function Class */ let Serverless = require('../../../lib/Serverless.js'), path = require('path'), utils = require('../../../lib/utils/index'), assert = require('chai').assert, testUtils = require('../../test_utils'), config = require('../../config'); let serverless; let instance; describe('Test Serverless Function Class', function() { before(function(done) { this.timeout(0); testUtils.createTestProject(config) .then(projPath => { process.chdir(projPath); // Instantiate Serverless serverless = new Serverless({ interactive: false, projectPath: projPath }); // Instantiate Class instance = new serverless.classes.Function(serverless, { component: 'nodejscomponent', module: 'module1', function: 'function1' }); done(); }); }); after(function(done) { done(); }); describe('Tests', function() { it('Load instance from file system', function(done) { instance.load() .then(function(instance) { done(); }) .catch(e => { done(e); }); }); it('Get instance data, without private properties', function(done) { let clone = instance.get(); assert.equal(true, typeof clone._config === 'undefined'); done(); }); it('Get populated instance data', function(done) { let data = instance.getPopulated({ stage: config.stage, region: config.region }); assert.equal(true, JSON.stringify(data).indexOf('$${') == -1); assert.equal(true, JSON.stringify(data).indexOf('${') == -1); done(); }); it('Set instance data', function(done) { let clone = instance.get(); clone.name = 'newFunction'; instance.set(clone); assert.equal(true, instance.name === 'newFunction'); done(); }); it('Save instance to the file system', function(done) { instance.save() .then(function(instance) { done(); }) .catch(e => { done(e); }); }); it('Create new and save', function(done) { let func = new serverless.classes.Function(serverless, { component: 'nodejscomponent', module: 'module1', function: 'function4' }); func.save() .then(function(instance) { return func.load() .then(function() { done(); }); }) .catch(e => { done(e); }); }); it('Get module', function() { let module = instance.getModule(); assert.instanceOf(module, serverless.classes.Module); assert.equal(module.name, instance._config.module); }); }); });
24.25
87
0.53786
73064d0a1e7cd137692c9fd164b03c39428d067e
544
js
JavaScript
src/components/Globals/Footer/Footer.js
JunaidKhanEU/Coffee-shop-gatsby
fd1117eae93eff4627a818de0503a45e2de9e116
[ "MIT" ]
null
null
null
src/components/Globals/Footer/Footer.js
JunaidKhanEU/Coffee-shop-gatsby
fd1117eae93eff4627a818de0503a45e2de9e116
[ "MIT" ]
null
null
null
src/components/Globals/Footer/Footer.js
JunaidKhanEU/Coffee-shop-gatsby
fd1117eae93eff4627a818de0503a45e2de9e116
[ "MIT" ]
null
null
null
import React from 'react' import styled from 'styled-components' const Footer = ({ className }) => { return ( <footer className={`${className}`}> <div className='container'> <div className='row'> <div className='col-10 mx-auto col-md-6 text-yellow text-center text-capitalize'> <h3>all rights reserved &copy; {new Date().getFullYear().toString()}</h3> </div> </div> </div> </footer> ) } export default styled(Footer)` background: var(--mainBrown); padding: 1.5rem 0; `
23.652174
91
0.601103
73068cc0225e60e2fd19edb6e63f3afead266b10
3,426
js
JavaScript
src/js/appBarColor.js
bichdiep1802/AcronymDemoApp
6a578adbf33f0b6808ea147167770ed52e60d806
[ "MIT" ]
null
null
null
src/js/appBarColor.js
bichdiep1802/AcronymDemoApp
6a578adbf33f0b6808ea147167770ed52e60d806
[ "MIT" ]
null
null
null
src/js/appBarColor.js
bichdiep1802/AcronymDemoApp
6a578adbf33f0b6808ea147167770ed52e60d806
[ "MIT" ]
null
null
null
/* This function expects two hexStrings and relies on hexStrToRGBA to convert to a JSON object that represents RGBA for the underlying Windows API to understand. Examples of valid values: setAppBarColors('#FFFFFF','#000000'); setAppBarColors('#FFF','#000'); setAppBarColors('FFFFFF','000000'); setAppBarColors('FFF','000'); */ "use strict"; function setAppBarColors(brandColorHex, brandColorInactiveHex) { // Detect if the Windows namespace exists in the global object if (typeof Windows !== 'undefined' && typeof Windows.UI !== 'undefined' && typeof Windows.UI.ViewManagement !== 'undefined') { var brandColor = hexStrToRGBA(brandColorHex); var brandColorInactive = hexStrToRGBA(brandColorInactiveHex); // Get a reference to the App Title Bar var appTitleBar = Windows.UI.ViewManagement.ApplicationView.getForCurrentView().titleBar; var black = hexStrToRGBA('#000'); var white = hexStrToRGBA('#FFF'); appTitleBar.foregroundColor = brandColor; appTitleBar.backgroundColor = brandColor; appTitleBar.buttonForegroundColor = white; appTitleBar.buttonBackgroundColor = brandColor; appTitleBar.buttonHoverForegroundColor = white; appTitleBar.buttonHoverBackgroundColor = brandColor; appTitleBar.buttonPressedForegroundColor = brandColor; appTitleBar.buttonPressedBackgroundColor = white; appTitleBar.inactiveBackgroundColor = brandColorInactive; appTitleBar.inactiveForegroundColor = brandColor; appTitleBar.buttonInactiveForegroundColor = brandColor; appTitleBar.buttonInactiveBackgroundColor = brandColorInactive; appTitleBar.buttonInactiveHoverForegroundColor = brandColor; appTitleBar.buttonInactiveHoverBackgroundColor = brandColorInactive; appTitleBar.buttonPressedForegroundColor = brandColor; appTitleBar.buttonPressedBackgroundColor = brandColorInactive; } } // Helper function to support HTML hexColor Strings function hexStrToRGBA(hexStr){ // RGBA color object var colorObject = { r: 255, g: 255, b: 255, a: 255 }; // remove hash if it exists hexStr = hexStr.replace('#', ''); if (hexStr.length === 6) { // No Alpha colorObject.r = parseInt(hexStr.slice(0, 2),16); colorObject.g = parseInt(hexStr.slice(2, 4),16); colorObject.b = parseInt(hexStr.slice(4, 6),16); colorObject.a = parseInt('0xFF',16); } else if (hexStr.length === 8) { // Alpha colorObject.r = parseInt(hexStr.slice(0, 2),16); colorObject.g = parseInt(hexStr.slice(2, 4),16); colorObject.b = parseInt(hexStr.slice(4, 6),16); colorObject.a = parseInt(hexStr.slice(6, 8),16); } else if (hexStr.length === 3) { // Shorthand hex color var rVal = hexStr.slice(0, 1); var gVal = hexStr.slice(1, 2); var bVal = hexStr.slice(2, 3); colorObject.r = parseInt(rVal + rVal,16); colorObject.g = parseInt(gVal + gVal,16); colorObject.b = parseInt(bVal + bVal,16); } else { throw new Error('Invalid HexString length. Expected either 8, 6, or 3. The actual length was ' + hexStr.length); } return colorObject; } // Initialize when the Window loads addEventListener('load', function(){ var brandColor = '#2c3e50'; var brandColorInactive = '#2c3e50'; setAppBarColors(brandColor,brandColorInactive); });
37.23913
116
0.689434
7306900ef51d029d613b40f82ecdb43f54e53c39
177
js
JavaScript
tests/data/facebook/single/C4OnEvf_nsQ.js
xtuc/binjs-ref
8a3d3206d65e142bcd4d416fb87e751c21c721d4
[ "MIT" ]
391
2017-12-18T12:33:29.000Z
2022-03-09T10:11:57.000Z
tests/data/facebook/single/C4OnEvf_nsQ.js
xtuc/binjs-ref
8a3d3206d65e142bcd4d416fb87e751c21c721d4
[ "MIT" ]
297
2018-02-04T13:31:14.000Z
2021-01-03T21:06:50.000Z
tests/data/facebook/single/C4OnEvf_nsQ.js
xtuc/binjs-ref
8a3d3206d65e142bcd4d416fb87e751c21c721d4
[ "MIT" ]
31
2018-02-12T16:57:50.000Z
2020-12-26T16:28:53.000Z
if (self.CavalryLogger) { CavalryLogger.start_js(["PCXMF"]); } __d("AdsCouponPromotionError",[],(function a(b,c,d,e,f,g){f.exports={ALREADY_CLAIMED:"already_claimed"};}),null);
59
113
0.723164
7306dde60aef5483af723bc640da318a02888ea5
1,665
js
JavaScript
src/components/navDrawer.js
vDiesel19/r-medicine-2021
841acfe2be1c4b87f2ee4185496e4f25dd4acdee
[ "RSA-MD" ]
null
null
null
src/components/navDrawer.js
vDiesel19/r-medicine-2021
841acfe2be1c4b87f2ee4185496e4f25dd4acdee
[ "RSA-MD" ]
null
null
null
src/components/navDrawer.js
vDiesel19/r-medicine-2021
841acfe2be1c4b87f2ee4185496e4f25dd4acdee
[ "RSA-MD" ]
null
null
null
import React from 'react'; import { Link } from 'gatsby'; import Hamburger from './hamburger'; const NavDrawer = (props) => { const closeDrawer = () => { document.querySelector('.drawer').classList.remove('is-active'); document.querySelector('.hamburger').classList.remove('is-active'); } return ( <div className="drawer"> <Hamburger /> <div className="drawer__content"> <ul className="drawer__link-list"> <li> <Link className="drawer__link-level-1" to="/virtual-speaker-guide">Speakers</Link> </li> <li> <Link className="drawer__link-level-1" to="/about/">About</Link> </li> <li> <Link className="drawer__link-level-1" to="/schedule/">Schedule</Link> </li> <li> <Link className="drawer__link-level-1" to="/code-of-conduct/">Code of Conduct</Link> </li> <li className="drawer__dropdown--wrapper"> <Link className="drawer__link-level-1" to="/">Past Events</Link> <div className="drawer__dropdown"> <a href="https://events.linuxfoundation.org/r-medicine/" target="_blank" rel="noreferrer">R/Medicine 2020</a> <a href="https://r-medicine-2019.netlify.app/" target="_blank" rel="noreferrer">R/Medicine 2019</a> <a href="https://r-medicine-2018.netlify.app/" target="_blank" rel="noreferrer">R/Medicine 2018</a> </div> </li> <li> <a className="drawer__link-level-1" href="mailto:r-medicine-conf@r-consortium.org">Contact Us</a> </li> </ul> </div> <div className="drawer__overlay" onClick={(e) => closeDrawer(e)} role="button" aria-label="overlay" tabIndex="0"></div> </div> ); }; export default NavDrawer;
35.425532
122
0.642643
7307c775bd74f67b38ee6db2c2a4b639e89b0d5b
511
js
JavaScript
ember-quickstart/tmp/broccoli_persistent_filterbabel__babel_lint_treeapp-output_path-dtGhxtQB.tmp/ember-quickstart/tests/app.lint-test.js
shrenovica1/Ember-play
6158b1a2120ad55fc43d4729f734c2f1364c28b8
[ "CC0-1.0" ]
null
null
null
ember-quickstart/tmp/broccoli_persistent_filterbabel__babel_lint_treeapp-output_path-dtGhxtQB.tmp/ember-quickstart/tests/app.lint-test.js
shrenovica1/Ember-play
6158b1a2120ad55fc43d4729f734c2f1364c28b8
[ "CC0-1.0" ]
null
null
null
ember-quickstart/tmp/broccoli_persistent_filterbabel__babel_lint_treeapp-output_path-dtGhxtQB.tmp/ember-quickstart/tests/app.lint-test.js
shrenovica1/Ember-play
6158b1a2120ad55fc43d4729f734c2f1364c28b8
[ "CC0-1.0" ]
null
null
null
define('ember-quickstart/tests/app.lint-test', [], function () { 'use strict'; QUnit.module('ESLint | app'); QUnit.test('app.js', function (assert) { assert.expect(1); assert.ok(true, 'app.js should pass ESLint\n\n'); }); QUnit.test('resolver.js', function (assert) { assert.expect(1); assert.ok(true, 'resolver.js should pass ESLint\n\n'); }); QUnit.test('router.js', function (assert) { assert.expect(1); assert.ok(true, 'router.js should pass ESLint\n\n'); }); });
25.55
64
0.622309
7307f3785806c68b4df4a22fc379693d92b383d8
2,642
js
JavaScript
src/core/DataConverter.js
ibesora/vt-examiner
c1d480283bf5f9a132d9aed0ea705ebdaf76d161
[ "MIT" ]
48
2018-10-28T18:59:56.000Z
2022-03-14T09:41:24.000Z
src/core/DataConverter.js
ibesora/vt-examiner
c1d480283bf5f9a132d9aed0ea705ebdaf76d161
[ "MIT" ]
12
2018-11-07T22:51:34.000Z
2022-02-06T15:54:43.000Z
src/core/DataConverter.js
ibesora/vt-examiner
c1d480283bf5f9a132d9aed0ea705ebdaf76d161
[ "MIT" ]
7
2018-10-29T13:47:02.000Z
2022-01-31T10:17:19.000Z
// @flow "use strict"; const geojsonvt = require("geojson-vt"); const Pbf = require("pbf"); const { VectorTile } = require("@mapbox/vector-tile"); const vtpbf = require("vt-pbf"); const Utils = require("./Utils"); class DataConverter { static async mVTLayers2GeoJSON(tilePBF, zoomLevel, column, row) { const layers = {}; const tile = new VectorTile(new Pbf(tilePBF)); const layerNames = Object.keys(tile.layers); await Utils.asyncForEach(layerNames, async (layerName) => { const geojson = await DataConverter.mVTLayer2GeoJSON(tile, layerName, zoomLevel, column, row); layers[layerName] = geojson; }); return layers; } static mVTLayer2GeoJSON(tile, layerName, zoomLevel, column, row) { return new Promise((resolve) => { const features = []; const layerObject = tile.layers[layerName]; for (let i = 0; i < layerObject.length; ++i) { const feature = layerObject.feature(i); const geoJSON = feature.toGeoJSON(row, column, zoomLevel); features.push(geoJSON); } resolve({ type: "FeatureCollection", features }); }); } static async geoJSONs2VTPBF(geojsons, zoomLevel, column, row, extent) { const tiles = {}; const layerNames = Object.keys(geojsons); await Utils.asyncForEach(layerNames, async (layerName) => { const tile = await DataConverter.geoJSON2MVTLayer(geojsons[layerName]); DataConverter.convertTileCoords(tile, zoomLevel, column, row, extent); tiles[layerName] = tile; }); const buffer = vtpbf.fromGeojsonVt(tiles, {version: 2}); const binBuffer = Buffer.from(buffer); return binBuffer; } static geoJSON2MVTLayer(geojson) { return new Promise((resolve) => { const tileset = geojsonvt(geojson, { tolerance: 0, maxZoom: 0, indexMaxZoom: 0, indexMaxPoints: 0 }); resolve(tileset.tiles[0]); }); } static convertTileCoords(tile, zoomLevel, column, row, extent) { tile.features.forEach(feature => { if (feature.type === 1) { feature.geometry = [feature.geometry]; } feature.geometry.forEach(ring => { for (let i = 0; i < ring.length; i += 2) { const inTileCoordinateX = ring[i]; const inTileCoordinateY = ring[i + 1]; const worldCoordinateX = Utils.normalized2WorldX(inTileCoordinateX); const worldCoordinateY = Utils.normalized2WorldY(inTileCoordinateY); const vTCoordinateX = Utils.worldX2VT(zoomLevel, row, extent, worldCoordinateX); const vTCoordinateY = Utils.worldY2VT(zoomLevel, column, extent, worldCoordinateY); ring[i] = vTCoordinateX; ring[i + 1] = vTCoordinateY; } }); }); } } module.exports = DataConverter;
22.016667
97
0.677896
730950599b9e0be1dd0e593ff636a93fa8eab70c
1,556
js
JavaScript
node_modules/string.prototype.trimstart/node_modules/es-abstract/2019/AddEntriesFromIterable.js
GenaAiv/portfolio-website
66e5f5f012b73fe41879a824f231e8798fb7b5f8
[ "MIT" ]
null
null
null
node_modules/string.prototype.trimstart/node_modules/es-abstract/2019/AddEntriesFromIterable.js
GenaAiv/portfolio-website
66e5f5f012b73fe41879a824f231e8798fb7b5f8
[ "MIT" ]
7
2020-03-10T07:47:34.000Z
2022-02-12T00:20:30.000Z
node_modules/string.prototype.trimstart/node_modules/es-abstract/2019/AddEntriesFromIterable.js
GenaAiv/portfolio-website
66e5f5f012b73fe41879a824f231e8798fb7b5f8
[ "MIT" ]
null
null
null
'use strict'; var inspect = require('object-inspect'); var GetIntrinsic = require('../GetIntrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var Call = require('./Call'); var Get = require('./Get'); var GetIterator = require('./GetIterator'); var IsCallable = require('./IsCallable'); var IteratorClose = require('./IteratorClose'); var IteratorStep = require('./IteratorStep'); var IteratorValue = require('./IteratorValue'); var Type = require('./Type'); // https://tc39.es/ecma262/#sec-add-entries-from-iterable module.exports = function AddEntriesFromIterable(target, iterable, adder) { if (!IsCallable(adder)) { throw new $TypeError('Assertion failed: `adder` is not callable'); } if (iterable == null) { throw new $TypeError('Assertion failed: `iterable` is present, and not nullish'); } var iteratorRecord = GetIterator(iterable); while (true) { // eslint-disable-line no-constant-condition var next = IteratorStep(iteratorRecord); if (!next) { return target; } var nextItem = IteratorValue(next); if (Type(nextItem) !== 'Object') { var error = new $TypeError('iterator next must return an Object, got ' + inspect(nextItem)); return IteratorClose( iteratorRecord, function () { throw error; } // eslint-disable-line no-loop-func ); } try { var k = Get(nextItem, '0'); var v = Get(nextItem, '1'); Call(adder, target, [k, v]); } catch (e) { return IteratorClose( iteratorRecord, function () { throw e; } ); } } };
29.358491
96
0.645887
7309613265f3ccc2f50a1e1834df5462e9338849
1,756
js
JavaScript
js5/3/memegen.js
garageScript/c0d3-challenges
2ff605c08a45dc898e264eff1066a2155c539068
[ "MIT" ]
1
2020-11-18T15:11:40.000Z
2020-11-18T15:11:40.000Z
js5/3/memegen.js
garageScript/c0d3-challenges
2ff605c08a45dc898e264eff1066a2155c539068
[ "MIT" ]
1
2021-09-02T14:22:45.000Z
2021-09-02T14:22:45.000Z
js5/3/memegen.js
garageScript/c0d3-challenges
2ff605c08a45dc898e264eff1066a2155c539068
[ "MIT" ]
1
2020-08-26T22:56:47.000Z
2020-08-26T22:56:47.000Z
const Jimp = require('jimp'); const cache = {}; // last 10 images cache /** * Caches the image and deletes the oldest one if there's more than 10 * @param {string} src - Image source URL * @param {} image - Image object from Jimp */ const cacheImage = (src, image) => { if (!cache[src]) { cache[src] = { image }; } cache[src].timestamp = Date.now(); if (Object.keys(cache).length > 10) { const oldest = Object.keys(cache) .reduce((prev, cur) => (prev.timestamp < cur.timestamp ? prev : cur)); delete cache[oldest]; } }; /** * Generates a meme with the parameters in the request * @param {Request} req - Request object * @param {Response} res - Response object */ const genMeme = async (req, res) => { const { text } = req.params; const blur = parseInt(req.query.blur, 10) || 0; const src = req.query.src || 'https://placeimg.com/640/480/any'; const black = req.query.black === 'true'; const font = await Jimp.loadFont( black ? Jimp.FONT_SANS_32_BLACK : Jimp.FONT_SANS_32_WHITE, ); try { const image = cache[src] ? cache[src].image : await Jimp.read(src); const mime = image.getMIME() || Jimp.MIME_JPEG; // defaults to "image/jpeg" if cannot get MIME console.log(`memegem: src="${src}"; text="${text}"; blur="${blur}"; black="${black}"; mime="${mime}"`); cacheImage(src, image); if (blur > 0) { image.blur(blur); } image.print(font, 0, 0, text); image.getBuffer(mime, (err, buffer) => { res.set('content-type', mime); res.send(buffer); }); } catch (e) { console.log(`memegen: Error processing image from src="${src}"\n${e}`); res.send(`Error while processing the requested image.<br>${e}`); } }; module.exports = { genMeme, };
28.786885
107
0.613326
7309faa79b100d8a51fcea6b7890311241231dc4
92
js
JavaScript
index.js
strotech/date_formater-js
b488c967daa0de2df6d9a1c8e2325e69c49ebcab
[ "MIT" ]
1
2020-04-22T06:27:35.000Z
2020-04-22T06:27:35.000Z
index.js
strotech/date_formater-js
b488c967daa0de2df6d9a1c8e2325e69c49ebcab
[ "MIT" ]
2
2020-05-16T04:56:14.000Z
2020-05-16T08:08:11.000Z
index.js
strotech/date_formater-js
b488c967daa0de2df6d9a1c8e2325e69c49ebcab
[ "MIT" ]
1
2020-05-16T06:04:30.000Z
2020-05-16T06:04:30.000Z
const date_formater = require('./lib/index') exports.formatDate = date_formater.formatDate;
30.666667
46
0.793478
730a220056b0290d559b1db88e25c4920cdbf8fc
642
js
JavaScript
src/hola_provider_hls.js
hola/hap.js
a774faeb3e37aee0db0a23143158d8bd441f1833
[ "0BSD" ]
2
2017-03-05T07:30:55.000Z
2017-03-05T19:59:10.000Z
src/hola_provider_hls.js
hola/hap.js
a774faeb3e37aee0db0a23143158d8bd441f1833
[ "0BSD" ]
null
null
null
src/hola_provider_hls.js
hola/hap.js
a774faeb3e37aee0db0a23143158d8bd441f1833
[ "0BSD" ]
3
2017-03-19T12:44:45.000Z
2021-07-09T09:26:14.000Z
function main(){ var conf = require('./conf.js').init('__SCRIPTID__'); if (conf.disabled) return {disabled: true, attach: function(){}, detach: function(){}}; var Hls = window.Hls = require('@hola.org/hls.js').default; var provider = require('__PROVIDER__'); provider.Hls = Hls; provider.version = '__VERSION__'; provider.provider_version = provider.VERSION; provider.hls_version = provider.Hls.version; provider.hls_params = conf.hls_params; if (conf.autoinit) provider.attach(); return provider; } try { module.exports = main(); } catch(e){ module.exports = {init_failure: e}; }
33.789474
76
0.655763
730b1bce94aa496183074c9cab92fa51f8930bfb
294
js
JavaScript
src/utilities.js
InlineManual/coerce
e659341e3e29d5321d0a96c7a6098d2b6572d1d1
[ "MIT" ]
null
null
null
src/utilities.js
InlineManual/coerce
e659341e3e29d5321d0a96c7a6098d2b6572d1d1
[ "MIT" ]
null
null
null
src/utilities.js
InlineManual/coerce
e659341e3e29d5321d0a96c7a6098d2b6572d1d1
[ "MIT" ]
null
null
null
/** * Returns type of the input. Same as `typeof`, but also detects "null" and "array". * @param {*} [input] * @returns {string} * @private */ export function getType (input) { if (input === null) {return 'null';} if (Array.isArray(input)) {return 'array';} return typeof input; }
21
84
0.622449
730b3bb49db36d460b5c6ebb34b937b5f94f2667
14,035
js
JavaScript
assets/anyChart/geodata/usa_states/washington/washington.topo.js
markosocco/KernelPMS
99d3612d59ab2f2c22472c1634e7a9570fd4e5d7
[ "MIT" ]
null
null
null
assets/anyChart/geodata/usa_states/washington/washington.topo.js
markosocco/KernelPMS
99d3612d59ab2f2c22472c1634e7a9570fd4e5d7
[ "MIT" ]
null
null
null
assets/anyChart/geodata/usa_states/washington/washington.topo.js
markosocco/KernelPMS
99d3612d59ab2f2c22472c1634e7a9570fd4e5d7
[ "MIT" ]
1
2018-12-06T22:36:06.000Z
2018-12-06T22:36:06.000Z
window['anychart']=window['anychart']||{};window['anychart']['maps']=window['anychart']['maps']||{};window['anychart']['maps']['washington']={"crs": {"type": "name", "properties": {"name": "urn:ogc:def:crs:EPSG:4326"}}, "ac-tx": {"default": {"crs": "wsg84", "scale": 80.09702867059083, "xoffset": 0, "yoffset": 0}}, "arcs": [[[9604, 2635], [237, -73]], [[9841, 2562], [158, -794], [0, -469], [-710, 0]], [[9289, 1299], [79, 361], [0, 758], [236, 217]], [[8816, 3140], [142, 180], [457, -144], [189, -541]], [[9289, 1299], [-158, 0]], [[9131, 1299], [0, 1011], [-158, 361], [-157, 0], [0, 469]], [[8374, 3465], [205, 72], [110, 433], [0, 975]], [[8689, 4945], [174, 0]], [[8863, 4945], [978, 0]], [[9841, 4945], [0, -2383]], [[8816, 3140], [-395, -217], [-63, 109]], [[8358, 3032], [16, 433]], [[9131, 1299], [-489, 36]], [[8642, 1335], [0, 578], [-158, 0], [-157, 252], [16, 867]], [[8343, 3032], [15, 0]], [[6907, 3465], [1467, 0]], [[8343, 3032], [-284, 0], [-205, -253], [-16, -253], [-189, -361], [-316, -288]], [[7333, 1877], [-221, 144], [-79, 794], [-236, 469]], [[6797, 3284], [110, 181]], [[8642, 1335], [-1262, -36]], [[7380, 1299], [64, 253], [-111, 325]], [[8863, 6605], [142, 73], [221, -145], [-16, 686], [142, 0]], [[9352, 7219], [489, 0]], [[9841, 7219], [0, -2274]], [[8863, 4945], [0, 1660]], [[9352, 9999], [505, 0], [-16, -2780]], [[9352, 7219], [-95, 253], [16, 1516], [-79, 541], [158, 470]], [[8863, 6605], [-331, -72], [-205, 397], [-126, -144]], [[8201, 6786], [-64, 397], [174, 36], [158, 650], [-95, 577], [126, 542], [-110, 541], [0, 470]], [[8390, 9999], [962, 0]], [[7380, 1299], [-173, -180], [-615, -73], [-316, -216]], [[6276, 830], [0, 613]], [[6276, 1443], [-15, 1697]], [[6261, 3140], [536, 144]], [[4179, 1443], [1183, 0], [914, 0]], [[6276, 830], [-441, -289], [-363, -108], [-173, 144], [-268, -217], [-300, -72], [-552, 253]], [[4179, 541], [-95, 144], [-16, 758], [111, 0]], [[8201, 6786], [-237, -36], [-252, 72], [-158, 144]], [[7554, 6966], [31, 3033]], [[7585, 9999], [805, 0]], [[7412, 6930], [142, 36]], [[8689, 4945], [-1293, 36]], [[7396, 4981], [16, 1949]], [[5031, 9999], [1072, 0], [1482, 0]], [[7412, 6930], [-16, 72]], [[7396, 7002], [32, 145], [-221, 397], [-268, -289], [-205, 72], [-489, -72], [31, -289]], [[6276, 6966], [-236, 36], [-394, 578], [-32, 217], [-236, 216], [-158, 614]], [[5220, 8627], [-63, 361]], [[5157, 8988], [110, 180], [-236, 831]], [[6103, 4837], [0, 288], [158, 361], [441, 0], [0, 253], [237, 253], [158, 541], [0, 253], [299, 216]], [[7396, 4981], [0, -1047], [-489, 36], [0, -505]], [[6261, 3140], [-111, 325]], [[6150, 3465], [48, 216], [-142, 722], [47, 434]], [[4179, 2454], [173, 686], [-78, 433]], [[4274, 3573], [-16, 397], [16, 0], [94, 469]], [[4368, 4439], [0, 37]], [[4368, 4476], [300, -217], [158, -325], [473, 36], [15, -252], [158, -253], [678, 0]], [[4179, 1443], [0, 1011]], [[3280, 2418], [899, 36]], [[4179, 541], [-363, -72], [-363, -361], [-189, -108]], [[3264, 0], [16, 1479]], [[3280, 1479], [0, 939]], [[3264, 0], [-536, 216], [-110, 108], [-32, 578]], [[2586, 902], [63, 180], [331, 181], [158, -72], [142, 288]], [[2586, 902], [-142, 650], [-268, 288], [-126, -36]], [[2050, 1804], [-16, 614]], [[2034, 2418], [1246, 0]], [[2113, 3609], [0, -72], [1230, 0]], [[3343, 3537], [457, -108], [79, 144], [395, 0]], [[2034, 2418], [-173, 0]], [[1861, 2418], [-16, 1191]], [[1845, 3609], [268, 0]], [[4699, 5919], [237, -469], [252, -108], [426, -397], [379, 36]], [[5993, 4981], [110, -144]], [[4368, 4476], [95, 288], [-205, 470], [110, 288], [331, 397]], [[2901, 5378], [127, 433], [0, 650]], [[3028, 6461], [1671, 0]], [[4699, 6461], [0, -542]], [[4368, 4439], [-520, 289], [-205, -108], [-237, 325], [-252, 0], [-253, 433]], [[3343, 3537], [-331, 253], [-221, 397], [-63, 144], [-174, 433]], [[2554, 4764], [-47, 181], [63, 433]], [[2570, 5378], [331, 0]], [[2050, 1804], [-205, -72], [-126, 361], [-332, 0]], [[1387, 2093], [16, 325], [458, 0]], [[1387, 2093], [-173, -108], [-347, 72], [31, 397], [0, 939], [-47, 216]], [[851, 3609], [994, 0]], [[1687, 5703], [16, -1264], [363, 0]], [[2066, 4439], [47, -216], [0, -614]], [[851, 3609], [-94, 397], [-79, 975], [-205, 469], [47, 289]], [[520, 5739], [473, -36], [694, 0]], [[2066, 4439], [488, 325]], [[4841, 7941], [-47, 578], [252, 180], [174, -72]], [[6276, 6966], [-157, -505], [-253, -72], [-157, -867], [236, -252], [48, -289]], [[4699, 6461], [-79, 361], [48, 397], [252, 217], [-79, 505]], [[1687, 5703], [0, 253], [694, 0]], [[2381, 5956], [189, -253], [0, -325]], [[2381, 5956], [237, 252], [63, 325], [142, 217], [-16, 252]], [[2807, 7002], [158, -144], [63, -289]], [[3028, 6569], [0, -108]], [[2334, 7941], [410, -469], [63, -470]], [[520, 5739], [-126, 614], [-221, 397]], [[173, 6750], [1341, 0], [867, -36], [0, 577], [-47, 650]], [[5157, 8988], [-190, -36], [-2271, 0]], [[2696, 8952], [-110, 325], [-284, 216]], [[2302, 9493], [-394, 506], [1971, 0], [1152, 0]], [[4841, 7941], [-1798, 0]], [[3043, 7941], [-205, 361], [-189, -36]], [[2649, 8266], [-31, 613], [78, 73]], [[3028, 6569], [126, 325], [-48, 903], [-63, 144]], [[173, 6750], [-110, 289], [31, 360], [-94, 217], [126, 397], [-95, 217], [110, 289], [899, -578], [600, -181], [362, 145]], [[2002, 7905], [332, 36]], [[2649, 8266], [-315, -325]], [[2002, 7905], [174, 433], [-126, 361], [-63, 397], [315, 217], [0, 180]]], "transform": {"translate": [-9999, 3648], "scale": [0.0634063406340634, 0.0277027702770277]}, "objects": {"features": {"type": "GeometryCollection", "geometries": [{"type": "Polygon", "properties": {"name": "Asotin County", "stateAbbrev": "WA", "state": "Washington", "fips": "003", "incits": "53003", "id": "US.WA.003", "population": 22110}, "arcs": [[0, 1, 2]]}, {"type": "Polygon", "properties": {"name": "Garfield County", "stateAbbrev": "WA", "state": "Washington", "fips": "023", "incits": "53023", "id": "US.WA.023", "population": 2256}, "arcs": [[3, -3, 4, 5]]}, {"type": "Polygon", "properties": {"name": "Whitman County", "stateAbbrev": "WA", "state": "Washington", "fips": "075", "incits": "53075", "id": "US.WA.075", "population": 46570}, "arcs": [[6, 7, 8, 9, -1, -4, 10, 11]]}, {"type": "Polygon", "properties": {"name": "Columbia County", "stateAbbrev": "WA", "state": "Washington", "fips": "013", "incits": "53013", "id": "US.WA.013", "population": 4032}, "arcs": [[-11, -6, 12, 13, 14]]}, {"type": "Polygon", "properties": {"name": "Franklin County", "stateAbbrev": "WA", "state": "Washington", "fips": "021", "incits": "53021", "id": "US.WA.021", "population": 86638}, "arcs": [[15, -12, -15, 16, 17, 18]]}, {"type": "Polygon", "properties": {"name": "Walla Walla County", "stateAbbrev": "WA", "state": "Washington", "fips": "071", "incits": "53071", "id": "US.WA.071", "population": 59530}, "arcs": [[-14, 19, 20, -17]]}, {"type": "Polygon", "properties": {"name": "Spokane County", "stateAbbrev": "WA", "state": "Washington", "fips": "063", "incits": "53063", "id": "US.WA.063", "population": 479398}, "arcs": [[21, 22, 23, -9, 24]]}, {"type": "Polygon", "properties": {"name": "Pend Oreille County", "stateAbbrev": "WA", "state": "Washington", "fips": "051", "incits": "53051", "id": "US.WA.051", "population": 12896}, "arcs": [[25, -23, 26]]}, {"type": "Polygon", "properties": {"name": "Stevens County", "stateAbbrev": "WA", "state": "Washington", "fips": "065", "incits": "53065", "id": "US.WA.065", "population": 43430}, "arcs": [[-27, -22, 27, 28, 29]]}, {"type": "Polygon", "properties": {"name": "Benton County", "stateAbbrev": "WA", "state": "Washington", "fips": "005", "incits": "53005", "id": "US.WA.005", "population": 184486}, "arcs": [[-18, -21, 30, 31, 32, 33]]}, {"type": "Polygon", "properties": {"name": "Klickitat County", "stateAbbrev": "WA", "state": "Washington", "fips": "039", "incits": "53039", "id": "US.WA.039", "population": 20866}, "arcs": [[34, -32, 35, 36]]}, {"type": "Polygon", "properties": {"name": "Ferry County", "stateAbbrev": "WA", "state": "Washington", "fips": "019", "incits": "53019", "id": "US.WA.019", "population": 7646}, "arcs": [[-29, 37, 38, 39]]}, {"type": "Polygon", "properties": {"name": "Lincoln County", "stateAbbrev": "WA", "state": "Washington", "fips": "043", "incits": "53043", "id": "US.WA.043", "population": 10301}, "arcs": [[40, -38, -28, -25, -8, 41, 42]]}, {"type": "Polygon", "properties": {"name": "Okanogan County", "stateAbbrev": "WA", "state": "Washington", "fips": "047", "incits": "53047", "id": "US.WA.047", "population": 41193}, "arcs": [[43, -39, -41, 44, 45, 46, 47, 48]]}, {"type": "Polygon", "properties": {"name": "Grant County", "stateAbbrev": "WA", "state": "Washington", "fips": "025", "incits": "53025", "id": "US.WA.025", "population": 91878}, "arcs": [[49, -45, -43, 50, -19, -34, 51, 52]]}, {"type": "Polygon", "properties": {"name": "Adams County", "stateAbbrev": "WA", "state": "Washington", "fips": "001", "incits": "53001", "id": "US.WA.001", "population": 19067}, "arcs": [[-7, -16, -51, -42]]}, {"type": "Polygon", "properties": {"name": "Yakima County", "stateAbbrev": "WA", "state": "Washington", "fips": "077", "incits": "53077", "id": "US.WA.077", "population": 247044}, "arcs": [[53, 54, 55, 56, -52, -33, -35, 57]]}, {"type": "Polygon", "properties": {"name": "Skamania County", "stateAbbrev": "WA", "state": "Washington", "fips": "059", "incits": "53059", "id": "US.WA.059", "population": 11274}, "arcs": [[58, -58, -37, 59, 60, 61]]}, {"type": "Polygon", "properties": {"name": "Clark County", "stateAbbrev": "WA", "state": "Washington", "fips": "011", "incits": "53011", "id": "US.WA.011", "population": 443817}, "arcs": [[-61, 62, 63]]}, {"type": "Polygon", "properties": {"name": "Cowlitz County", "stateAbbrev": "WA", "state": "Washington", "fips": "015", "incits": "53015", "id": "US.WA.015", "population": 101860}, "arcs": [[-62, -64, 64, 65, 66]]}, {"type": "Polygon", "properties": {"name": "Lewis County", "stateAbbrev": "WA", "state": "Washington", "fips": "041", "incits": "53041", "id": "US.WA.041", "population": 75081}, "arcs": [[67, 68, -54, -59, -67, 69, 70, 71]]}, {"type": "Polygon", "properties": {"name": "Kittitas County", "stateAbbrev": "WA", "state": "Washington", "fips": "037", "incits": "53037", "id": "US.WA.037", "population": 41765}, "arcs": [[72, 73, -53, -57, 74]]}, {"type": "Polygon", "properties": {"name": "King County", "stateAbbrev": "WA", "state": "Washington", "fips": "033", "incits": "53033", "id": "US.WA.033", "population": 2044449}, "arcs": [[75, 76, 77, -75, -56, 78]]}, {"type": "Polygon", "properties": {"name": "Pierce County", "stateAbbrev": "WA", "state": "Washington", "fips": "053", "incits": "53053", "id": "US.WA.053", "population": 819743}, "arcs": [[-79, -55, -69, 79, 80, 81]]}, {"type": "Polygon", "properties": {"name": "Wahkiakum County", "stateAbbrev": "WA", "state": "Washington", "fips": "069", "incits": "53069", "id": "US.WA.069", "population": 4042}, "arcs": [[-70, -66, 82, 83]]}, {"type": "Polygon", "properties": {"name": "Pacific County", "stateAbbrev": "WA", "state": "Washington", "fips": "049", "incits": "53049", "id": "US.WA.049", "population": 20498}, "arcs": [[-71, -84, 84, 85]]}, {"type": "Polygon", "properties": {"name": "Grays Harbor County", "stateAbbrev": "WA", "state": "Washington", "fips": "027", "incits": "53027", "id": "US.WA.027", "population": 71078}, "arcs": [[86, 87, -72, -86, 88, 89]]}, {"type": "Polygon", "properties": {"name": "Thurston County", "stateAbbrev": "WA", "state": "Washington", "fips": "067", "incits": "53067", "id": "US.WA.067", "population": 262388}, "arcs": [[-80, -68, -88, 90]]}, {"type": "Polygon", "properties": {"name": "Chelan County", "stateAbbrev": "WA", "state": "Washington", "fips": "007", "incits": "53007", "id": "US.WA.007", "population": 73967}, "arcs": [[91, -47, 92, -73, -78, 93]]}, {"type": "Polygon", "properties": {"name": "Douglas County", "stateAbbrev": "WA", "state": "Washington", "fips": "017", "incits": "53017", "id": "US.WA.017", "population": 39471}, "arcs": [[-46, -50, -74, -93]]}, {"type": "Polygon", "properties": {"name": "Mason County", "stateAbbrev": "WA", "state": "Washington", "fips": "045", "incits": "53045", "id": "US.WA.045", "population": 60497}, "arcs": [[94, 95, -81, -91, -87]]}, {"type": "Polygon", "properties": {"name": "Kitsap County", "stateAbbrev": "WA", "state": "Washington", "fips": "035", "incits": "53035", "id": "US.WA.035", "population": 253968}, "arcs": [[96, 97, 98, -76, -82, -96]]}, {"type": "Polygon", "properties": {"name": "Jefferson County", "stateAbbrev": "WA", "state": "Washington", "fips": "031", "incits": "53031", "id": "US.WA.031", "population": 30076}, "arcs": [[99, -97, -95, -90, 100, 101]]}, {"type": "Polygon", "properties": {"name": "Whatcom County", "stateAbbrev": "WA", "state": "Washington", "fips": "073", "incits": "53073", "id": "US.WA.073", "population": 206353}, "arcs": [[102, 103, 104, -49]]}, {"type": "Polygon", "properties": {"name": "Skagit County", "stateAbbrev": "WA", "state": "Washington", "fips": "057", "incits": "53057", "id": "US.WA.057", "population": 118837}, "arcs": [[-103, -48, -92, 105, 106, 107]]}, {"type": "Polygon", "properties": {"name": "Snohomish County", "stateAbbrev": "WA", "state": "Washington", "fips": "061", "incits": "53061", "id": "US.WA.061", "population": 745913}, "arcs": [[108, -106, -94, -77, -99]]}, {"type": "Polygon", "properties": {"name": "Clallam County", "stateAbbrev": "WA", "state": "Washington", "fips": "009", "incits": "53009", "id": "US.WA.009", "population": 72312}, "arcs": [[-102, 109, 110]]}, {"type": "Polygon", "properties": {"name": "San Juan County", "stateAbbrev": "WA", "state": "Washington", "fips": "055", "incits": "53055", "id": "US.WA.055", "population": 15875}, "arcs": [[-108, 111, -111, 112, -104]]}, {"type": "Polygon", "properties": {"name": "Island County", "stateAbbrev": "WA", "state": "Washington", "fips": "029", "incits": "53029", "id": "US.WA.029", "population": 78801}, "arcs": [[-107, -109, -98, -100, -112]]}]}}, "bbox": [-9999, 3648, -9365, 3925], "type": "Topology"}
14,035
14,035
0.52989
730cd4061e2e7b02e7a414af7ab4f0a5f3da1d33
2,992
js
JavaScript
_/Chapter 04/sencha-travelly/app/controller/Places.js
paullewallencom/phonegap-978-1-7852-8531-8
a645ad8eb5eadabcded5b4c7e41bf789bcfd3606
[ "Apache-2.0" ]
1
2015-10-24T12:41:25.000Z
2015-10-24T12:41:25.000Z
app/controller/Places.js
cybind/travelly
f112c5fba14b7c0a3ffe43840b5e2b43ffe9ef9c
[ "MIT" ]
null
null
null
app/controller/Places.js
cybind/travelly
f112c5fba14b7c0a3ffe43840b5e2b43ffe9ef9c
[ "MIT" ]
null
null
null
Ext.define('Travelly.controller.Places', { extend: 'Ext.app.Controller', config: { refs: { mapPlaces: '#mapPlaces' }, control: { mapPlaces: { maprender: 'mapPlacesMapRenderer' } } }, mapPlacesMapRenderer: function(comp, map) { var pictures = this.getPictures(); var map = this.getMapPlaces().getMap(); for (var i = 0; i < pictures.length; i++) { this.addMarker(pictures[i], map); } }, getPictures: function() { var pictureStore = Ext.getStore('Pictures'); var data = pictureStore.getData(); return data ? data.all : null; }, addMarker: function(picture, map) { var self = this; var marker = new google.maps.Marker({ map : map, position : new google.maps.LatLng(picture.get('lat'), picture.get('lon')), title : picture.get('title'), icon : 'resources/images/camera.png', picture : picture }); google.maps.event.addListener(marker, 'click', function() { var marker = this; var popup = Ext.create('Travelly.view.Picture'); Ext.Viewport.add(popup); popup.show(); popup.on('hide', function() { popup.destroy(); }); Ext.getCmp('photoPreview').setSrc(marker.picture.get('url')); Ext.getCmp('photoTitle').setTitle(marker.picture.get('title')); Ext.getCmp('deletePhotoBtn').on('tap', function() { Ext.Msg.confirm("Confirmation", "Are you sure you want to delete this picture?", function(buttonId, value, opt) { if (buttonId == 'yes') { self.deletePicture(marker); popup.hide(); } }); }); Ext.getCmp('closePhotoBtn').on('tap', function() { popup.hide(); }); }); }, deletePicture: function(marker) { // delete from file system var fileURI = marker.picture.get('url'); fileURI = '/Travelly/' + fileURI.substring(fileURI.lastIndexOf('/')+1); window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSys) { fileSys.root.getFile(fileURI, {create: false, exclusive: false}, function(fileEntry) { fileEntry.remove(onSuccess, onError); }, onError); }, onError); var onSuccess = function(entry) { console.log("Removal succeeded"); } var onError = function(error) { console.log("Error removing file: " + error.code); } // delete from database var pictureStore = Ext.getStore('Pictures'); pictureStore.remove(marker.picture); // delete marker marker.setMap(null); } });
28.495238
129
0.512366
730cd7a47009c283dce409806872b15e5b3874fb
12,424
js
JavaScript
client/app/game/game_data/game_data.service.js
ahmadsoliman/game
654f310a2e68b8024f5d060df685ac76a7ffa50a
[ "MIT" ]
null
null
null
client/app/game/game_data/game_data.service.js
ahmadsoliman/game
654f310a2e68b8024f5d060df685ac76a7ffa50a
[ "MIT" ]
null
null
null
client/app/game/game_data/game_data.service.js
ahmadsoliman/game
654f310a2e68b8024f5d060df685ac76a7ffa50a
[ "MIT" ]
null
null
null
'use strict'; angular.module('gameApp') .service('gameData', function ($localStorage, $location, $window) { // AngularJS will instantiate a singleton by calling "new" on this function var defaults = { user: {}, timeRanges: [ {name: 'house', text: 'House Deposit', min: 26, max: 5*52, value: 4*52}, {name: 'travel', text: 'Overseas Trip', min: 26, max: 5*52, value: 4*52}, {name: 'wedding', text: 'Wedding', min: 26, max: 5*52, value: 3*52}, {name: 'car', text: 'New Car', min: 26, max: 5*52, value: 3*52}, {name: 'other', text: 'Something Else', min: 26, max: 5*52, value: 3*52} ], budgetDefaults: [ {min: 5000, max: 50000, step: 2500, value: 15000}, {min: 1000, max: 20000, step: 1000, value: 5000}, {min: 5000, max: 50000, step: 2500, value: 15000}, {min: 2500, max: 50000, step: 2500, value: 15000}, {min: 2500, max: 50000, step: 2500, value: 15000}, ], // default values for targets targets: [ // { code: 0, name: 'house', time: 4*52, budget: 15000} ], suspenseRanges: [ {name: 'rent', text: 'Rent / Mortgage', code: 'S1', min: 0, max: 1000, value: 0, step: 50, freq: 1}, {name: 'mobile', text: 'Mobile / Internet', code: 'S2', min: 0, max: 100, value: 0, step: 5, freq: 4}, {name: 'utilities', text: 'Rates / Power / Other Utilities', code: 'S3', min: 0, max: 100, value: 0, step: 5, freq: 13}, {name: 'health', text: 'Car / Health / Other Insurance', code: 'S4', min: 0, max: 100, value: 0, step: 5, freq: 52}, {name: 'commitments', text: 'Other Regular Commitments', code: 'S5', min: 0, max: 200, value: 0, step: 10, freq: 1} ], SSum: 0, discretionRanges: [ {name: 'entertainment', text: 'Entertainment', code: 'D1', min: 0, max: 400, value: 0, step: 25}, {name: 'groceries', text: 'Groceries', code: 'D2', min: 0, max: 300, value: 0, step: 25}, {name: 'transport', text: 'Transport', code: 'D3', min: 0, max: 200, value: 0, step: 10}, {name: 'personal', text: 'Personal / Sports / Health / Cosmetics', code: 'D4', min: 0, max: 200, value: 0, step: 10}, {name: 'household', text: 'Household / Family / Pets', code: 'D5', min: 0, max: 200, value: 0, step: 10}, {name: 'clothing', text: 'Clothing / Shoes / Accessories', code: 'D6', min: 0, max: 200, value: 0, step: 10}, {name: 'work', text: 'Work / Coffees / Lunches / Study', code: 'D7', min: 0, max: 200, value: 0, step: 10} ], DSum: 0, incomeRanges: [ {name: 'job', text: 'Other job', min: 0, max: 2000, value: 0, step: 100, freq: 1}, {name: 'tax', text: 'Tax refund', min: 0, max: 200, value: 0, step: 10, freq: 52}, {name: 'gifts', text: 'Gifts from family', min: 0, max: 200, value: 0, step: 10, freq: 52}, {name: 'freelance', text: 'Freelance income', min: 0, max: 1500, value: 0, step: 100, freq: 13}, {name: 'investments', text: 'Income from investments', min: 0, max: 1000, value: 0, step: 50, freq: 1}, {name: 'other', text: 'Other', min: 0, max: 1000, value: 0, step: 50, freq: 1}, ], otherEarnings: [], bossValues: { BPV: 0, BRATE: 5, BNPER: 260, // TODO admin setting }, closingBalance: [], savingsBalance: [], BP: 0, armoryRanges: [ {name: 'cash', text: 'Cash Savings', code: 'A1', min:0, max: 40000, step: 500, value: 0}, {name: 'assets', text: 'Other Financial Assets', code: 'A2', min:0, max: 40000, step: 500, value: 0}, {name: 'earning', text: 'Earning Capacity per Week', code: 'A3', min:0, max: 2000, step: 100, value: 0}, {name: 'other', text: 'Other Earnings per year', code: 'A4', min:0, max: 40000, step: 500, value: 0}, {name: 'savings-interest', text: 'Cash Savings Interest', code: 'A5', min:0, max: 10, step: 1, value: 0}, ], AA: 0, AB: 0, R: 0, centralFlags: {}, startedSurvey: {state: false}, surveyQuestions: [ { question: 'Who do you bank with?', options: ['ANZ', 'CBA', 'NAB', 'WBC', 'Credit Unions', 'Other Institutions'], type: "radio", answer: 0 }, { question: 'What are your bank’s top 3 priorities?', options: ['Help me achieve my goals', 'Help me grow my deposits', 'Help me understand my money', 'Sell me credit cards and other debt', 'Sell me investments and other products', 'Help me make payments and store money.' ], type: "checkbox", answer: [false,false,false,false,false] }, { question: 'What is your relationship with debt?', options: ['I don’t have an active credit card or other debt?', 'I have a credit card and pay less than $50 interest p.a.', 'I have some debt but it doesn’t concern me very much.', 'Paying off my debt is my first priority'], type: "radio", answer: 0 }, { question: 'Have you used any of these websites, apps, or services in the last 12 months:', options: ['iSelect', 'Pocketbook', 'Accountant', 'Compare the Market', 'Xero', 'MyBudget', 'Wealth Advisor', 'Mortgage Broker'], type: "checkbox", answer: [false,false,false,false,false,false,false,false] }, { question: 'Select all that apply about you.', options: ['Aged below 20', 'Aged 20-34', 'Aged over 34', 'Student –local', 'Student –international', 'Working part time or full time', 'Freelancer or business owner'], type: "checkbox", answer: [false,false,false,false,false,false,false] }, { question: 'Select all statements that are correct:', options: ['I have a clear picture of my financial position and performance to the nearest dollar.', 'I know the balances of all my savings accounts, credit card, and loans to a $200 margin of error.', 'I know the balances of all my savings accounts, credit card, and loans with a higher than $200 margin of error.', 'I have an up to date budget and track my actual expenditure to the nearest dollar.', 'I have an up to date budget and track my expenditure to a small margin of error.', 'I have an up to date budget and mentally track my expenditure.', 'I do not have an up to date budget.'], type: "checkbox", answer: [false,false,false,false,false,false,false] }, { question: 'Would you consider having an everyday transactions account with a technology company, if it helped you understand your money better?', options: ['Yes', 'No', 'Maybe'], type: "radio", answer: 0 }, { question: 'Would you like to register your interest as a beta tester?', options: ['Yes', 'No'], type: "radio", answer: 0 }] }; $localStorage.$default(defaults); return { user: $localStorage.user, timeRanges: $localStorage.timeRanges, budgetDefaults: $localStorage.budgetDefaults, targets: $localStorage.targets, suspenseRanges: $localStorage.suspenseRanges, calcSSum: calcSSum, discretionRanges: $localStorage.discretionRanges, calcDSum: calcDSum, getBP: getBP, calcR: calcR, bossValues: $localStorage.bossValues, armoryRanges: $localStorage.armoryRanges, centralFlags: $localStorage.centralFlags, startedSurvey: $localStorage.startedSurvey, getEarnings: getEarnings, incomeRanges: $localStorage.incomeRanges, otherEarnings: $localStorage.otherEarnings, closingBalance: $localStorage.closingBalance, savingsBalance: $localStorage.savingsBalance, calcAll: calcAll, calcCR: calcCR, testAllTargets: testAllTargets, reset: reset, surveyQuestions: $localStorage.surveyQuestions, saveToDatabase: saveToDatabase, saveSurveyToDatabase: saveSurveyToDatabase, saveUser: saveUser }; function calcSSum() { let sum = 0; angular.forEach($localStorage.suspenseRanges, function(r){ sum += r.value; }); $localStorage.SSum = sum; return sum; } function calcDSum() { let sum = 0; angular.forEach($localStorage.discretionRanges, function(r){ sum += r.value; }); $localStorage.DSum = sum; return sum; } function calcBP() { var bv = $localStorage.bossValues; var weeklyInterest = bv.BRATE/5200.0; $localStorage.BP = (weeklyInterest * bv.BPV) / (1 - Math.pow(1+weeklyInterest, -1 * (bv.BNPER))); $localStorage.closingBalance[0] = -1*bv.BPV; for(let i=1; i<=bv.BNPER; i++) { $localStorage.closingBalance[i] = $localStorage.closingBalance[i-1] + $localStorage.closingBalance[i-1]*weeklyInterest + $localStorage.BP; } return $localStorage.BP; } function getBP() { return $localStorage.BP; } function calcArmory() { $localStorage.AA = $localStorage.armoryRanges[0].value + $localStorage.armoryRanges[1].value; $localStorage.AB = $localStorage.armoryRanges[2].value + ($localStorage.armoryRanges[3].value / 52); return {AA: $localStorage.AA, AB: $localStorage.AB}; } function getEarnings() { return $localStorage.AB; } function calcR() { $localStorage.R = $localStorage.AB - $localStorage.DSum - $localStorage.SSum; return $localStorage.R; } function calcSavings() { $localStorage.savingsBalance[0] = $localStorage.AA; for(let i=1; i<=$localStorage.bossValues.BNPER; i++) { $localStorage.savingsBalance[i] = $localStorage.savingsBalance[i-1] + $localStorage.R - $localStorage.BP + ($localStorage.savingsBalance[i-1] * $localStorage.armoryRanges[4].value / 5200); } } function calcAll() { calcSSum(); calcDSum(); calcBP(); calcArmory(); calcR(); calcSavings(); } function calcCR(y) { calcSavings(); return $localStorage.savingsBalance[y]; } function testTarget(t, subtractedVal) { return (calcCR(t.time) - subtractedVal - t.budget >= 0); } function testAllTargets() { var subtractedVal = 0; var totalBudget = 0; $localStorage.targets.forEach(function(t) { totalBudget += t.budget; }); var results = $localStorage.results = { alive: true, DSum: $localStorage.DSum, SSum: $localStorage.SSum, R: $localStorage.R, finalCR: calcCR(260) - totalBudget, }; for(var i=0; i<$localStorage.targets.length; i++) { if(!testTarget($localStorage.targets[i], subtractedVal)) { results.alive = false; return results; } subtractedVal += $localStorage.targets[i].budget; } return results; } function saveToDatabase() { if(typeof firebase === 'undefined' || firebase == 0) return 0; $localStorage.user.results_record = firebase.database().ref('results').push(angular.copy({ targets: $localStorage.targets, suspenseRanges: $localStorage.suspenseRanges, discretionRanges: $localStorage.discretionRanges, otherEarnings: $localStorage.otherEarnings, bossValues: $localStorage.bossValues, armoryRanges: $localStorage.armoryRanges, })).path.o; return 1; } function saveSurveyToDatabase() { if(typeof firebase === 'undefined' || firebase == 0) return 0; $localStorage.user.survey_record = firebase.database().ref('survey_answers').push(angular.copy($localStorage.surveyQuestions)).path.o; return 1; } function saveUser() { $localStorage.user_record = firebase.database().ref('users').push(angular.copy($localStorage.user)).path.o; } function reset() { // console.log($localStorage.targets); $localStorage.$reset(); // console.log($localStorage); $localStorage.$default(defaults); // console.log($localStorage.targets); $location.path('/main'); $window.location.reload(); } });
40.734426
153
0.589504
730cf60b76404bd0e1e6900259687bd7523386cd
644
js
JavaScript
app/kubernetes/component-status/converter.js
dzma352/portainer
1b310ecaf5adc9e45f3f9908fa82809b84a5b614
[ "Zlib" ]
3
2021-03-05T23:50:15.000Z
2021-11-17T11:01:40.000Z
app/kubernetes/component-status/converter.js
dzma352/portainer
1b310ecaf5adc9e45f3f9908fa82809b84a5b614
[ "Zlib" ]
3
2021-05-12T00:01:53.000Z
2022-02-27T11:13:50.000Z
app/kubernetes/component-status/converter.js
dzma352/portainer
1b310ecaf5adc9e45f3f9908fa82809b84a5b614
[ "Zlib" ]
1
2021-04-09T18:07:40.000Z
2021-04-09T18:07:40.000Z
import _ from 'lodash-es'; import { KubernetesComponentStatus } from './models'; export class KubernetesComponentStatusConverter { /** * Convert API data to KubernetesComponentStatus model */ static apiToModel(data) { const res = new KubernetesComponentStatus(); res.ComponentName = data.metadata.name; const healthyCondition = _.find(data.conditions, { type: 'Healthy' }); if (healthyCondition && healthyCondition.status === 'True') { res.Healthy = true; } else if (healthyCondition && healthyCondition.status === 'False') { res.ErrorMessage = healthyCondition.message; } return res; } }
29.272727
74
0.689441
730d0b7db127a3fe1137896537a04168768e83ae
1,828
js
JavaScript
dist/_nuxt/static/1639986739/ar/projects/libft/state.js
i99dev/42AbuDhabi-docs
108458b70a4534427041a2afe5d42a4482e1176a
[ "MIT" ]
null
null
null
dist/_nuxt/static/1639986739/ar/projects/libft/state.js
i99dev/42AbuDhabi-docs
108458b70a4534427041a2afe5d42a4482e1176a
[ "MIT" ]
null
null
null
dist/_nuxt/static/1639986739/ar/projects/libft/state.js
i99dev/42AbuDhabi-docs
108458b70a4534427041a2afe5d42a4482e1176a
[ "MIT" ]
1
2021-12-14T05:48:52.000Z
2021-12-14T05:48:52.000Z
window.__NUXT__=(function(a,b,c,d,e,f,g,h,i,j,k){return {staticAssetsBase:"\u002F42AbuDhabi-docs\u002F_nuxt\u002Fstatic\u002F1639986739",layout:"default",error:d,state:{categories:{ar:{"البداية":[{slug:"index",title:"المقدمة",category:"البداية",to:"\u002F"}],"المشاريع":[{slug:e,title:e,category:b,to:"\u002Fprojects\u002Flibft"},{slug:f,title:f,category:b,to:"\u002Fprojects\u002Fget_next_line"},{slug:g,title:g,category:b,to:"\u002Fprojects\u002Fft_printf"},{slug:"born2beroot",title:"Born2beroot",category:b,to:"\u002Fprojects\u002Fborn2beroot"}],"ﻗﻮاﻋﺪ إرﺷﺎدﻳﺔ":[{slug:"general-guidelines",title:"إرشادات عامة",category:a,to:"\u002Fguidelines\u002Fgeneral-guidelines"},{slug:"contributors",title:"المساهمة",category:a,to:"\u002Fguidelines\u002Fcontributors"},{slug:"QA-Model",title:"نموذج QA",category:a,to:"\u002Fguidelines\u002FQA-Model"},{slug:h,title:h,category:a,to:"\u002Fguidelines\u002FComponents"},{slug:"42-ValgrindContainer",title:"Valgrind حاوية",category:a,to:"\u002Fguidelines\u002F42-ValgrindContainer"}]}},releases:[],settings:{title:"42 AbuDhabi Docs",url:"https:\u002F\u002Fgithub.com\u002Fi99dev\u002F42AbuDhabi-docs\u002F",defaultDir:i,defaultBranch:"master",filled:c,github:"i99dev\u002F42AbuDhabi-docs",category:i},menu:{open:j},i18n:{routeParams:{}}},serverRendered:c,routePath:"\u002Far\u002Fprojects\u002Flibft",config:{_app:{basePath:"\u002F42AbuDhabi-docs\u002F",assetsPath:"\u002F42AbuDhabi-docs\u002F_nuxt\u002F",cdnURL:d},content:{dbHash:"a51f2aab"}},__i18n:{langs:{ar:{search:{placeholder:"Search the docs (Press \"\u002F\" to focus)"},toc:{title:"On this page"},article:{github:"Edit this page on GitHub",updatedAt:"Updated at"}}}},colorMode:{preference:k,value:k,unknown:c,forced:j}}}("ﻗﻮاﻋﺪ إرﺷﺎدﻳﺔ","المشاريع",true,null,"libft","get_next_line","ft_printf","Components","",false,"system"));
1,828
1,828
0.769694
730d855b7d4e6ff2b9138c689978b06ece715bbf
1,846
js
JavaScript
vue-pc/src/store/modules/common.js
qq296629801/bzGhost
bb6a70042694d54891c3ee9668b8aa94c8e9528b
[ "MIT" ]
null
null
null
vue-pc/src/store/modules/common.js
qq296629801/bzGhost
bb6a70042694d54891c3ee9668b8aa94c8e9528b
[ "MIT" ]
null
null
null
vue-pc/src/store/modules/common.js
qq296629801/bzGhost
bb6a70042694d54891c3ee9668b8aa94c8e9528b
[ "MIT" ]
null
null
null
import Vue from "vue"; import cache from "@/utils/cache.js" export const state = { // 加载动画 loadingShow: false, // 登录弹窗状态 loginPopupShow: false, // 聊天对象 chatObj:{ }, // 红包对象 packetData:{}, newsPush:{}, // 缓存 post:[], friend:[], group:[], conversation:[] }; //缓存浏览器的数据名称 const cacheNameList = ["user","token","config","roles","permissions","post","friend","group","conversation"]; let clearTime; export const mutations = { setPost(state, data){ if(data){ state.post = Object.assign({}, state.post, data); cache.set("post",state.post); } }, setFriend(state, data){ if(data){ state.friend = Object.assign({}, state.friend, data); cache.set("friend",state.friend); } }, setGroup(state, data){ if(data){ state.group = Object.assign({}, state.group, data); cache.set("group",state.group); } }, setConversation(state, data){ if(data){ state.conversation = Object.assign({}, state.conversation, data); cache.set("conversation",state.conversation); } }, setCacheData(state) { for (let name of cacheNameList) { let data = cache.get(name); if (data) { state[name] = data; } } }, setPacketData(state, data){ if(data){ state.packetData = data } }, // setNewsPush(state, data){ if(data){ state.newsPush = data } }, // setChatObj(state, data){ if(data){ state.chatObj = data } }, //数据加载状态 setLoadingShow(state, data) { if(state.loadingShow){ clearTime && clearTimeout(clearTime); clearTime = setTimeout(function(){ state.loadingShow = data; },50); } else { state.loadingShow = data; } }, //登录弹窗状态 setLoginPopupShow(state, data) { state.loginPopupShow = data; } }; export const actions = { };
20.065217
110
0.58559
730d9689176732ebbcacb1079b82d5a4fb738ca0
53
js
JavaScript
04/01-webpack-cli/app.js
itcastFE/LearnVue
e6752a0bc7e5c780acb51d8663713dbb4a81929d
[ "MIT" ]
1
2020-03-08T11:58:14.000Z
2020-03-08T11:58:14.000Z
04/01-webpack-cli/app.js
itcastFE/LearnVue
e6752a0bc7e5c780acb51d8663713dbb4a81929d
[ "MIT" ]
null
null
null
04/01-webpack-cli/app.js
itcastFE/LearnVue
e6752a0bc7e5c780acb51d8663713dbb4a81929d
[ "MIT" ]
1
2020-03-08T11:58:16.000Z
2020-03-08T11:58:16.000Z
var add = require('./calc') document.write(add(1,2))
17.666667
27
0.660377
730e24572e619191c7c0d199106ba612a7f23073
4,138
js
JavaScript
ApolloPractice/node_modules/apollo/node_modules/apollo-codegen-core/lib/compiler/visitors/collectAndMergeFields.js
eric9102/ApolloPractice
38b52615ef97cd45ab5617fa2a1419f4aae1ffd9
[ "MIT" ]
1
2020-08-08T03:44:45.000Z
2020-08-08T03:44:45.000Z
ApolloPractice/node_modules/apollo/node_modules/apollo-codegen-core/lib/compiler/visitors/collectAndMergeFields.js
eric9102/ApolloPractice
38b52615ef97cd45ab5617fa2a1419f4aae1ffd9
[ "MIT" ]
6
2020-07-17T08:17:42.000Z
2022-01-22T05:18:33.000Z
ApolloPractice/node_modules/apollo/node_modules/apollo-codegen-core/lib/compiler/visitors/collectAndMergeFields.js
eric9102/ApolloPractice
38b52615ef97cd45ab5617fa2a1419f4aae1ffd9
[ "MIT" ]
null
null
null
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function collectAndMergeFields(selectionSet, mergeInFragmentSpreads = true) { const groupedFields = new Map(); function visitSelectionSet(selections, possibleTypes, conditions = []) { if (possibleTypes.length < 1) return; for (const selection of selections) { switch (selection.kind) { case "Field": let groupForResponseKey = groupedFields.get(selection.responseKey); if (!groupForResponseKey) { groupForResponseKey = []; groupedFields.set(selection.responseKey, groupForResponseKey); } groupForResponseKey.push(Object.assign({}, selection, { isConditional: conditions.length > 0, conditions, selectionSet: selection.selectionSet ? { possibleTypes: selection.selectionSet.possibleTypes, selections: [...selection.selectionSet.selections] } : undefined })); break; case "FragmentSpread": case "TypeCondition": if (selection.kind === "FragmentSpread" && !mergeInFragmentSpreads) continue; if (!possibleTypes.every(type => selection.selectionSet.possibleTypes.includes(type))) continue; visitSelectionSet(selection.selectionSet.selections, possibleTypes, conditions); break; case "BooleanCondition": visitSelectionSet(selection.selectionSet.selections, possibleTypes, [ ...conditions, selection ]); break; } } } visitSelectionSet(selectionSet.selections, selectionSet.possibleTypes); const fields = Array.from(groupedFields.values()).map(fields => { const isFieldIncludedUnconditionally = fields.some(field => !field.isConditional); return fields .map(field => { if (isFieldIncludedUnconditionally && field.isConditional && field.selectionSet) { field.selectionSet.selections = wrapInBooleanConditionsIfNeeded(field.selectionSet.selections, field.conditions); } return field; }) .reduce((field, otherField) => { field.isConditional = field.isConditional && otherField.isConditional; if (field.conditions && otherField.conditions) { field.conditions = [...field.conditions, ...otherField.conditions]; } else { field.conditions = undefined; } if (field.selectionSet && otherField.selectionSet) { field.selectionSet.selections.push(...otherField.selectionSet.selections); } return field; }); }); if (selectionSet.possibleTypes.length == 1) { const type = selectionSet.possibleTypes[0]; const fieldDefMap = type.getFields(); for (const field of fields) { const fieldDef = fieldDefMap[field.name]; if (fieldDef && fieldDef.description) { field.description = fieldDef.description; } } } return fields; } exports.collectAndMergeFields = collectAndMergeFields; function wrapInBooleanConditionsIfNeeded(selections, conditions) { if (!conditions || conditions.length == 0) return selections; const [condition, ...rest] = conditions; return [ Object.assign({}, condition, { selectionSet: { possibleTypes: condition.selectionSet.possibleTypes, selections: wrapInBooleanConditionsIfNeeded(selections, rest) } }) ]; } exports.wrapInBooleanConditionsIfNeeded = wrapInBooleanConditionsIfNeeded; //# sourceMappingURL=collectAndMergeFields.js.map
45.472527
162
0.571049
730e2d4009c2b06fe9739849f0196cf40c80496a
141
js
JavaScript
example/vue.config.js
martinsjek/vue-wamp
9b50b5a8a02b3cf593c1f688239c3289018faa55
[ "MIT" ]
50
2017-02-15T09:05:01.000Z
2022-02-24T00:49:28.000Z
example/vue.config.js
martinsjek/vue-wamp
9b50b5a8a02b3cf593c1f688239c3289018faa55
[ "MIT" ]
32
2017-03-25T15:21:36.000Z
2022-02-26T23:16:04.000Z
example/vue.config.js
martinsjek/vue-wamp
9b50b5a8a02b3cf593c1f688239c3289018faa55
[ "MIT" ]
13
2017-08-10T21:21:20.000Z
2022-02-12T09:43:58.000Z
const configureAPI = require('./src/server/configure'); module.exports = { devServer: { port: 3000, before: configureAPI, }, };
15.666667
55
0.638298
730f07f0624199bbe77d49a33c81da75fadd05a2
20,899
js
JavaScript
src/components/victory-axis/victory-axis.js
kenwheeler/victory-chart
3adb4bf00a0cf742cd86b31b5c6fbd847c9a985f
[ "MIT" ]
3
2016-06-13T10:35:33.000Z
2021-02-02T09:42:36.000Z
src/components/victory-axis/victory-axis.js
kenwheeler/victory-chart
3adb4bf00a0cf742cd86b31b5c6fbd847c9a985f
[ "MIT" ]
null
null
null
src/components/victory-axis/victory-axis.js
kenwheeler/victory-chart
3adb4bf00a0cf742cd86b31b5c6fbd847c9a985f
[ "MIT" ]
null
null
null
import { assign, defaults } from "lodash"; import React, { PropTypes } from "react"; import { PropTypes as CustomPropTypes, Helpers, VictoryTransition, VictoryLabel } from "victory-core"; import AxisLine from "./axis-line"; import GridLine from "./grid"; import Tick from "./tick"; import AxisHelpers from "./helper-methods"; import Axis from "../../helpers/axis"; const defaultStyles = { axis: { stroke: "#756f6a", fill: "none", strokeWidth: 2, strokeLinecap: "round" }, axisLabel: { stroke: "transparent", fill: "#756f6a", fontSize: 16, fontFamily: "Helvetica" }, grid: { stroke: "none", fill: "none", strokeLinecap: "round" }, ticks: { stroke: "#756f6a", fill: "none", padding: 5, strokeWidth: 2, strokeLinecap: "round", size: 4 }, tickLabels: { stroke: "transparent", fill: "#756f6a", fontFamily: "Helvetica", fontSize: 10, padding: 5 } }; const orientationSign = { top: -1, left: -1, right: 1, bottom: 1 }; const getStyles = (props) => { const style = props.style || {}; const parentStyleProps = { height: "auto", width: "100%" }; return { parent: defaults(parentStyleProps, style.parent, defaultStyles.parent), axis: defaults({}, style.axis, defaultStyles.axis), axisLabel: defaults({}, style.axisLabel, defaultStyles.axisLabel), grid: defaults({}, style.grid, defaultStyles.grid), ticks: defaults({}, style.ticks, defaultStyles.ticks), tickLabels: defaults({}, style.tickLabels, defaultStyles.tickLabels) }; }; export default class VictoryAxis extends React.Component { static role = "axis"; static defaultTransitions = { onExit: { duration: 500 }, onEnter: { duration: 500 } }; static propTypes = { /** * The animate prop specifies props for victory-animation to use. It this prop is * not given, the axis will not tween between changing data / style props. * Large datasets might animate slowly due to the inherent limits of svg rendering. * @examples {duration: 500, onEnd: () => alert("done!")} */ animate: PropTypes.object, /** * The axisComponent prop takes in an entire component which will be used * to create the axis line. The new element created from the passed axisComponent * will be supplied with the following properties: x1, y1, x2, y2, style and events. * Any of these props may be overridden by passing in props to the supplied component, * or modified or ignored within the custom component itself. If an axisComponent * is not supplied, VictoryAxis will render its default AxisLine component. */ axisComponent: PropTypes.element, /** * The axisLabelComponent prop takes in an entire component which will be used * to create the axis label. The new element created from the passed axisLabelComponent * will be supplied with the following properties: x, y, verticalAnchor, textAnchor, * angle, transform, style and events. Any of these props may be overridden by * passing in props to the supplied component, or modified or ignored within * the custom component itself. If an axisLabelComponent is not supplied, a new * VictoryLabel will be created with props described above */ axisLabelComponent: PropTypes.element, /** * This prop specifies whether a given axis is intended to cross another axis. */ crossAxis: PropTypes.bool, /** * The dependentAxis prop specifies whether the axis corresponds to the * dependent variable (usually y). This prop is useful when composing axis * with other components to form a chart. */ dependentAxis: PropTypes.bool, /** * The domain prop describes the range of values your axis will include. This prop should be * given as a array of the minimum and maximum expected values for your axis. * If this value is not given it will be calculated based on the scale or tickValues. * @examples [-1, 1] */ domain: PropTypes.oneOfType([ CustomPropTypes.domain, PropTypes.shape({ x: CustomPropTypes.domain, y: CustomPropTypes.domain }) ]), /** * The events prop attaches arbitrary event handlers to data and label elements * Event handlers are called with their corresponding events, corresponding component props, * and their index in the data array, and event name. The return value of event handlers * will be stored by index and namespace on the state object of VictoryAxis * i.e. `this.state.[index].axis = {style: {fill: "red"}...}`, and will be * applied by index to the appropriate child component. Event props on the * parent namespace are just spread directly on to the top level svg of VictoryAxis * if one exists. If VictoryAxis is set up to render g elements i.e. when it is * rendered within chart, or when `standalone={false}` parent events will not be applied. * * @examples {ticks: { * onClick: () => * return {ticks: {style: {stroke: "green"}}, tickLabels: {style: {stroke: "black"}} *}} */ events: PropTypes.shape({ parent: PropTypes.object, axis: PropTypes.object, axisLabel: PropTypes.object, grid: PropTypes.object, ticks: PropTypes.object, tickLabels: PropTypes.object }), /** * The gridComponent prop takes in an entire component which will be used * to create grid lines. The new element created from the passed gridComponent * will be supplied with the following properties: x1, y1, x2, y2, tick, style and events. * Any of these props may be overridden by passing in props to the supplied component, * or modified or ignored within the custom component itself. If a gridComponent * is not supplied, VictoryAxis will render its default GridLine component. */ gridComponent: PropTypes.element, /** * The height props specifies the height the svg viewBox of the chart container. * This value should be given as a number of pixels */ height: CustomPropTypes.nonNegative, /** * The label prop defines the label that will appear along the axis. This * prop should be given as a value or an entire, HTML-complete label * component. If a label component is given, it will be cloned. The new * element's properties x, y, textAnchor, verticalAnchor, and transform * will have defaults provided by the axis; styles filled out with * defaults provided by the axis, and overrides from the label component. * If a value is given, a new VictoryLabel will be created with props and * styles from the axis. */ label: PropTypes.any, /** * This value describes how far from the "edge" of its permitted area each axis * will be set back in the x-direction. If this prop is not given, * the offset is calculated based on font size, axis orientation, and label padding. */ offsetX: PropTypes.number, /** * This value describes how far from the "edge" of its permitted area each axis * will be set back in the y-direction. If this prop is not given, * the offset is calculated based on font size, axis orientation, and label padding. */ offsetY: PropTypes.number, /** * The orientation prop specifies the position and orientation of your axis. */ orientation: PropTypes.oneOf(["top", "bottom", "left", "right"]), /** * The padding props specifies the amount of padding in number of pixels between * the edge of the chart and any rendered child components. This prop can be given * as a number or as an object with padding specified for top, bottom, left * and right. */ padding: PropTypes.oneOfType([ PropTypes.number, PropTypes.shape({ top: PropTypes.number, bottom: PropTypes.number, left: PropTypes.number, right: PropTypes.number }) ]), /** * The scale prop determines which scales your axis should use. This prop can be * given as a `d3-scale@0.3.0` function or as a string corresponding to a supported d3-string * function. * @examples d3Scale.time(), "linear", "time", "log", "sqrt" */ scale: CustomPropTypes.scale, /** * The standalone prop determines whether the component will render a standalone svg * or a <g> tag that will be included in an external svg. Set standalone to false to * compose VictoryAxis with other components within an enclosing <svg> tag. */ standalone: PropTypes.bool, /** * The style prop specifies styles for your VictoryAxis. Any valid inline style properties * will be applied. Height, width, and padding should be specified via the height, * width, and padding props, as they are used to calculate the alignment of * components within chart. * @examples {axis: {stroke: "#756f6a"}, grid: {stroke: "grey"}, ticks: {stroke: "grey"}, * tickLabels: {fontSize: 10, padding: 5}, axisLabel: {fontSize: 16, padding: 20}} */ style: PropTypes.shape({ parent: PropTypes.object, axis: PropTypes.object, axisLabel: PropTypes.object, grid: PropTypes.object, ticks: PropTypes.object, tickLabels: PropTypes.object }), /** * The tickComponent prop takes in an entire component which will be used * to create tick lines. The new element created from the passed tickComponent * will be supplied with the following properties: x1, y1, x2, y2, tick, style and events. * Any of these props may be overridden by passing in props to the supplied component, * or modified or ignored within the custom component itself. If a tickComponent * is not supplied, VictoryAxis will render its default Tick component. */ tickComponent: PropTypes.element, /** * The tickCount prop specifies approximately how many ticks should be drawn on the axis if * tickValues are not explicitly provided. This values is calculated by d3 scale and * prioritizes returning "nice" values and evenly spaced ticks over an exact numnber of ticks */ tickCount: CustomPropTypes.nonNegative, /** * The tickLabelComponent prop takes in an entire component which will be used * to create the tick labels. The new element created from the passed tickLabelComponent * will be supplied with the following properties: x, y, verticalAnchor, textAnchor, * angle, tick, style and events. Any of these props may be overridden by * passing in props to the supplied component, or modified or ignored within * the custom component itself. If an tickLabelComponent is not supplied, a new * VictoryLabel will be created with props described above */ tickLabelComponent: PropTypes.element, /** * The tickFormat prop specifies how tick values should be expressed visually. * tickFormat can be given as a function to be applied to every tickValue, or as * an array of display values for each tickValue. * @examples d3.time.format("%Y"), (x) => x.toPrecision(2), ["first", "second", "third"] */ tickFormat: PropTypes.oneOfType([ PropTypes.func, CustomPropTypes.homogeneousArray ]), /** * The tickValues prop explicitly specifies which tick values to draw on the axis. * @examples ["apples", "bananas", "oranges"], [2, 4, 6, 8] */ tickValues: CustomPropTypes.homogeneousArray, /** * The width props specifies the width of the svg viewBox of the chart container * This value should be given as a number of pixels */ width: CustomPropTypes.nonNegative }; static defaultProps = { axisComponent: <AxisLine/>, axisLabelComponent: <VictoryLabel/>, tickLabelComponent: <VictoryLabel/>, tickComponent: <Tick/>, gridComponent: <GridLine/>, events: {}, height: 300, padding: 50, scale: "linear", standalone: true, tickCount: 5, width: 450 }; static getDomain = AxisHelpers.getDomain.bind(AxisHelpers); static getAxis = Axis.getAxis.bind(Axis); static getScale = AxisHelpers.getScale.bind(AxisHelpers); static getStyles = getStyles; constructor() { super(); this.state = {}; this.getEvents = Helpers.getEvents.bind(this); this.getEventState = Helpers.getEventState.bind(this); } getTickProps(props) { const stringTicks = Axis.stringTicks(props); const scale = AxisHelpers.getScale(props); const ticks = AxisHelpers.getTicks(props, scale); return {scale, ticks, stringTicks}; } getLayoutProps(props) { const style = getStyles(props); const padding = Helpers.getPadding(props); const orientation = props.orientation || (props.dependentAxis ? "left" : "bottom"); const isVertical = Axis.isVertical(props); const labelPadding = AxisHelpers.getLabelPadding(props, style); const offset = AxisHelpers.getOffset(props, style); return {style, padding, orientation, isVertical, labelPadding, offset}; } renderLine(props, layoutProps) { const {style, padding, isVertical} = layoutProps; const axisEvents = this.getEvents(props.events.axis, "axis"); const axisProps = defaults( {}, this.getEventState(0, "axis"), props.axisComponent.props, { style: style.axis, x1: isVertical ? null : padding.left, x2: isVertical ? null : props.width - padding.right, y1: isVertical ? padding.top : null, y2: isVertical ? props.height - padding.bottom : null } ); return React.cloneElement(props.axisComponent, assign( {}, axisProps, { events: Helpers.getPartialEvents(axisEvents, 0, axisProps) } )); } getAnchors(orientation, isVertical) { const anchorOrientation = { top: "end", left: "end", right: "start", bottom: "start" }; const anchor = anchorOrientation[orientation]; return { textAnchor: isVertical ? anchor : "middle", verticalAnchor: isVertical ? "middle" : anchor }; } renderTicks(props, layoutProps, dataProps) { const {style, orientation, isVertical} = layoutProps; const {scale, ticks, stringTicks} = dataProps; const tickFormat = AxisHelpers.getTickFormat(props, dataProps); const tickPosition = AxisHelpers.getTickPosition(style.ticks, orientation, isVertical); const tickEvents = this.getEvents(props.events.ticks, "ticks"); const labelEvents = this.getEvents(props.events.tickLabels, "tickLabels"); return ticks.map((data, index) => { const tick = stringTicks ? props.tickValues[data - 1] : data; const groupPosition = scale(data); const yTransform = isVertical ? groupPosition : 0; const xTransform = isVertical ? 0 : groupPosition; const tickProps = defaults( {}, this.getEventState(index, "ticks"), props.tickComponent.props, { key: `tick-${index}`, style: Helpers.evaluateStyle(style.ticks, tick), x1: xTransform, y1: yTransform, x2: xTransform + tickPosition.x2, y2: yTransform + tickPosition.y2, tick } ); const tickComponent = React.cloneElement(props.tickComponent, assign( {}, tickProps, {events: Helpers.getPartialEvents(tickEvents, index, tickProps)} )); let labelComponent; const label = tickFormat.call(this, tick, index); if (label !== null && label !== undefined) { const anchors = this.getAnchors(orientation, isVertical); const labelStyle = Helpers.evaluateStyle(style.tickLabels, tick); const labelProps = defaults( {}, this.getEventState(index, "tickLabels"), props.tickLabelComponent.props, { key: `tick-label-${index}`, style: labelStyle, x: xTransform + tickPosition.x, y: yTransform + tickPosition.y, verticalAnchor: labelStyle.verticalAnchor || anchors.verticalAnchor, textAnchor: labelStyle.textAnchor || anchors.textAnchor, angle: labelStyle.angle, text: label, tick } ); labelComponent = React.cloneElement(props.tickLabelComponent, assign( {}, labelProps, {events: Helpers.getPartialEvents(labelEvents, index, labelProps)} )); } return ( <g key={`tick-group-${index}`}> {tickComponent} {labelComponent} </g> ); }); } renderGrid(props, layoutProps, tickProps) { const {scale, ticks, stringTicks} = tickProps; const {style, padding, isVertical, offset, orientation} = layoutProps; const xPadding = orientation === "right" ? padding.right : padding.left; const yPadding = orientation === "top" ? padding.top : padding.bottom; const sign = -orientationSign[orientation]; const xOffset = props.crossAxis ? offset.x - xPadding : 0; const yOffset = props.crossAxis ? offset.y - yPadding : 0; const x2 = isVertical ? sign * (props.width - (padding.left + padding.right)) : 0; const y2 = isVertical ? 0 : sign * (props.height - (padding.top + padding.bottom)); const gridEvents = this.getEvents(props.events.grid, "grid"); return ticks.map((data, index) => { const tick = stringTicks ? props.tickValues[data - 1] : data; // determine the position and translation of each gridline const position = scale(data); const xTransform = isVertical ? -xOffset : position; const yTransform = isVertical ? position : yOffset; const gridProps = defaults( {}, this.getEventState(index, "grid"), props.gridComponent.props, { key: `grid-${index}`, style: Helpers.evaluateStyle(style.grid, tick), x1: xTransform, y1: yTransform, x2: x2 + xTransform, y2: y2 + yTransform, tick } ); const gridComponent = React.cloneElement(props.gridComponent, assign( {}, gridProps, {events: Helpers.getPartialEvents(gridEvents, index, gridProps)} )); return gridComponent; }); } renderLabel(props, layoutProps) { if (!props.label) { return undefined; } const {style, orientation, padding, labelPadding, isVertical} = layoutProps; const sign = orientationSign[orientation]; const hPadding = padding.left + padding.right; const vPadding = padding.top + padding.bottom; const x = isVertical ? -((props.height - vPadding) / 2) - padding.top : ((props.width - hPadding) / 2) + padding.left; const y = sign * labelPadding; const verticalAnchor = sign < 0 ? "end" : "start"; const transform = isVertical ? "rotate(-90)" : ""; const labelEvents = this.getEvents(props.events.axisLabel, "axisLabel"); const labelStyle = style.axisLabel; const labelProps = defaults( {}, this.getEventState(0, "axisLabel"), props.axisLabelComponent.props, { verticalAnchor: labelStyle.verticalAnchor || verticalAnchor, textAnchor: labelStyle.textAnchor || "middle", angle: labelStyle.angle, style: labelStyle, transform, x, y, text: props.label } ); return React.cloneElement(props.axisLabelComponent, assign( {}, labelProps, {events: Helpers.getPartialEvents(labelEvents, 0, labelProps)} )); } render() { if (this.props.animate) { // Do less work by having `VictoryAnimation` tween only values that // make sense to tween. In the future, allow customization of animated // prop whitelist/blacklist? const whitelist = [ "style", "domain", "range", "tickCount", "tickValues", "offsetX", "offsetY", "padding", "width", "height" ]; return ( <VictoryTransition animate={this.props.animate} animationWhitelist={whitelist}> <VictoryAxis {...this.props}/> </VictoryTransition> ); } const layoutProps = this.getLayoutProps(this.props); const tickProps = this.getTickProps(this.props); const {style} = layoutProps; const transform = AxisHelpers.getTransform(this.props, layoutProps); const group = ( <g style={style.parent} transform={transform}> {this.renderGrid(this.props, layoutProps, tickProps)} {this.renderLine(this.props, layoutProps)} {this.renderTicks(this.props, layoutProps, tickProps)} {this.renderLabel(this.props, layoutProps)} </g> ); return this.props.standalone ? ( <svg style={style.parent} viewBox={`0 0 ${this.props.width} ${this.props.height}`} {...this.props.events.parent} > {group} </svg> ) : group; } }
38.918063
97
0.656108
730fa7cfee402c63251cd9e8dd7768a180c333a8
3,540
js
JavaScript
components/nav.js
nikhilgupta2001/TeacherFund_next
075809ff7f7a73bd4b6cdfd98c711eff6341011b
[ "MIT" ]
null
null
null
components/nav.js
nikhilgupta2001/TeacherFund_next
075809ff7f7a73bd4b6cdfd98c711eff6341011b
[ "MIT" ]
null
null
null
components/nav.js
nikhilgupta2001/TeacherFund_next
075809ff7f7a73bd4b6cdfd98c711eff6341011b
[ "MIT" ]
null
null
null
import React, { useState } from 'react' import Hamburger from './icons/hamburger' import X from './icons/x' import Link from 'next/link' import useAuth from '../hooks/useAuth' const style={ fontSize:25 } const Nav = () => { const { user, loading } = useAuth() const links = [ { href: '/mission', label: 'Our Mission', key: 'our-mission' }, { href: '/contact', label: 'Contact Us', key: 'contact' }, { href: '/donate', label: 'Donate', key: 'donate' } ] let buttons = [ { href: '/signin', label: 'Login', key: 'login' } ] if (user && !loading) { links.push({ href: '/account', label: 'Account', key: 'account' }) buttons = [ { href: '/logout', label: 'Logout', key: 'logout' } ] } const [drawerOpen, setDrawerOpen] = useState(false) const toggleDrawerOpen = () => { if (!drawerOpen) { document.body.classList.add('no-scroll') document.getElementById('hamburger-icon').classList.add('dn') } else { document.body.classList.remove('no-scroll') document.getElementById('hamburger-icon').classList.remove('dn') } setDrawerOpen(!drawerOpen) } return ( <nav> <div className='f6 f5-m tf-lato bg-white pv4 flex fl w-100 pl5-ns pr5-ns pl4 pr3 z-1'> <div className='w-70-l mh-auto b--tf-yellow flex justify-between flex-row w-100'> <div className='pointer tc'> <Link href='/'> <img src='/images/Logo_with_text.png' className='w4' alt='The Teacher Fund – Home' /> </Link> </div> <div className='fr dn db-l flex-column flex-auto-ns mv-auto'> {links.map(({ key, href, label }) => ( <div key={key} className=' w-auto fr '> <Link href={href}> <a className='nav-item tf-dark-gray no-underline black pa3' style={style}>{label}</a> </Link> </div> ))} </div> <div className='fr dn db-l tf-yellow mv-auto ml4'> {buttons.map(({ key, href, label }) => ( <div key={key} className='db center w-auto fr ph2'> <Link href={href} key={key}> <a className='btn-alt no-underline black pv3 ph4 br3' style={{fontSize:25 }}>{label}</a> </Link> </div> ))} </div> <div className='fr dn-l db'> <div className='pa3 f2-m' onClick={toggleDrawerOpen}> <Hamburger /> </div> </div> </div> </div> {drawerOpen && <div className='w-100 h-100 bg-tf-dark-gray o-90 absolute white tf-lato tc pv4 pl5-ns pr5-ns'> <div className='fr pa2 pr3 mr1 pt2-m pr2-m mr1-m mt1-m' onClick={toggleDrawerOpen}> <X /> </div> <div className='flex-column flex justify-around h5 mt6 pt4 f3'> {links.map(({ key, href, label }) => ( <div key={key} className='db center w-auto fr ph2' onClick={toggleDrawerOpen}> <Link href={href}> <a className='white no-underline mv4 w5 center'>{label}</a> </Link> </div> ))} {buttons.map(({ key, href, label }) => ( <div key={key} className='btn-menu no-underline pv3 br3 mv4 w4 w5-m center' onClick={toggleDrawerOpen}> <Link href={href} key={key}> <a className=''>{label}</a> </Link> </div> ))} </div> </div>} </nav> ) } export default Nav
33.714286
115
0.525706
731115b9c5eba9e799a33ba82d69794efc270896
137
js
JavaScript
documentation/html/search/defines_0.js
dub-basu/convex-hull
6e5ba71d540315c4aea4f419d058c6f9ca3a5987
[ "MIT" ]
null
null
null
documentation/html/search/defines_0.js
dub-basu/convex-hull
6e5ba71d540315c4aea4f419d058c6f9ca3a5987
[ "MIT" ]
null
null
null
documentation/html/search/defines_0.js
dub-basu/convex-hull
6e5ba71d540315c4aea4f419d058c6f9ca3a5987
[ "MIT" ]
null
null
null
var searchData= [ ['animation_5fspeed',['ANIMATION_SPEED',['../_graphix_8h.html#aaa69f89df4c8e47abeb574bfdd11d9f4',1,'Graphix.h']]] ];
27.4
115
0.744526
73116febb8994f63d15c8f37f9816d78a0265976
610
js
JavaScript
webpack.mix.js
MekDrop/JobTest-Teltonika-TodoAppWithRESTApiCalls
ea67dff8f21cad185a15788a4d4756bf6eefa72f
[ "MIT" ]
null
null
null
webpack.mix.js
MekDrop/JobTest-Teltonika-TodoAppWithRESTApiCalls
ea67dff8f21cad185a15788a4d4756bf6eefa72f
[ "MIT" ]
null
null
null
webpack.mix.js
MekDrop/JobTest-Teltonika-TodoAppWithRESTApiCalls
ea67dff8f21cad185a15788a4d4756bf6eefa72f
[ "MIT" ]
1
2019-04-14T12:50:20.000Z
2019-04-14T12:50:20.000Z
const mix = require('laravel-mix'); /* |-------------------------------------------------------------------------- | Mix Asset Management |-------------------------------------------------------------------------- | | Mix provides a clean, fluent API for defining some Webpack build steps | for your Laravel application. By default, we are compiling the Sass | file for your application, as well as bundling up your JS files. | */ mix .babelConfig({ "plugins": [ "@babel/plugin-syntax-dynamic-import" ] }) .js('resources/assets/js/main.js', 'public/main.js');
30.5
76
0.483607
7312600714f94609018ea19edca0300a5dddadd2
2,404
js
JavaScript
src/main/resources/js/other.js
gengzi/codecopy
5b784acc22546dee2627072b2866779cb2de0941
[ "MIT" ]
7
2020-06-05T06:59:54.000Z
2021-11-09T08:03:42.000Z
src/main/resources/js/other.js
gengzi/codecopy
5b784acc22546dee2627072b2866779cb2de0941
[ "MIT" ]
1
2022-01-06T10:07:25.000Z
2022-01-07T06:02:05.000Z
src/main/resources/js/other.js
gengzi/codecopy
5b784acc22546dee2627072b2866779cb2de0941
[ "MIT" ]
6
2020-06-18T07:46:56.000Z
2021-12-06T12:18:22.000Z
function getAesString(data, key, iv) {//加密 var key = CryptoJS.enc.Utf8.parse(key); var iv = CryptoJS.enc.Utf8.parse(iv); var encrypted = CryptoJS.AES.encrypt(data, key, { iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }); return encrypted.toString(); //返回的是base64格式的密文 } function getDAesString(encrypted, key, iv) {//解密 var key = CryptoJS.enc.Utf8.parse(key); var iv = CryptoJS.enc.Utf8.parse(iv); var decrypted = CryptoJS.AES.decrypt(encrypted, key, { iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }); return decrypted.toString(CryptoJS.enc.Utf8); } function getAES(data) { //加密 var key = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'; //密钥 var iv = '1234567812345678'; var encrypted = getAesString(data, key, iv); //密文 var encrypted1 = CryptoJS.enc.Utf8.parse(encrypted); return encrypted; } function getDAes(data) {//解密 var key = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'; //密钥 var iv = '1234567812345678'; var decryptedStr = getDAesString(data, key, iv); return decryptedStr; } function getRSAString(data, key) {//加密 var key = CryptoJS.enc.Utf8.parse(key); var encrypted = CryptoJS.RSA.encrypt(data, key, { mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }); return encrypted.toString(); //返回的是base64格式的密文 } function getRSAString(encrypted, key) {//解密 var key = CryptoJS.enc.Utf8.parse(key); var decrypted = CryptoJS.RSA.decrypt(encrypted, key, { mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }); return decrypted.toString(CryptoJS.enc.Utf8); } // 使用 jsencrypt 进行 rsa 前端的加密和解密 // https://github.com/travist/jsencrypt /** * RSA 加密,使用公钥加密 * @param key 公钥 * @param str 需要加密的内容 * @returns {CipherParams|PromiseLike<ArrayBuffer>|null|string|string|*} */ function encryptRSAByPublicKey(str, key) { Encrypt = new JSEncrypt(); Encrypt.setPublicKey(key); return Encrypt.encrypt(str); } /** * RSA 解密,使用密钥解密 * @param str 需要解密的内容 * @param key 密钥 * @returns {WordArray|PromiseLike<ArrayBuffer>|null|*|undefined} */ function decryptRSAByPrivateKey(str, key) { Encrypt = new JSEncrypt(); Encrypt.setPrivateKey(key); return Encrypt.decrypt(str); }
22.895238
72
0.636855
73127677475303ca045eace46d425ff932e20b63
2,462
js
JavaScript
functions/commands.js
cycloptux/discotwit
2bf65c20bbbd9f6dc43f2f86ffe5d6bda77b7fdd
[ "0BSD" ]
null
null
null
functions/commands.js
cycloptux/discotwit
2bf65c20bbbd9f6dc43f2f86ffe5d6bda77b7fdd
[ "0BSD" ]
1
2021-02-28T22:18:11.000Z
2021-02-28T22:18:11.000Z
functions/commands.js
cycloptux/DiscoTwit
2bf65c20bbbd9f6dc43f2f86ffe5d6bda77b7fdd
[ "0BSD" ]
null
null
null
const config = require("../config/config"); const logger = require("./winston"); const { truncateText } = require("./helper"); // Individual commands logic const _commandsLogic = { help: (message) => { const response_text = truncateText("**DiscoTwit** is an **open source**, customizable **Discord-to-Twitter** integration bot whose goal is to tweet messages posted on Discord.\n" + "You can find my source code here: https://github.com/cycloptux/DiscoTwit\n\n" + "Here's my current configuration:\n" + `- **Server ID:** \`${config.discordSettings.server_id}\`\n` + `- **Channel ID:** \`${config.discordSettings.channel_id}\`\n` + `- **User ID(s):** \`${config.discordSettings.user_ids.join(" ")}\`\n` + `- **React on Success:** \`${Boolean(config.discordSettings.react_on_success)}\`\n` + `- **Reaction Emoji:** \`${config.discordSettings.reaction_emoji}\`\n`, 2000); return message.channel.send(response_text); }, }; const commandHandler = (message) => { // Ignore messages from bots if (message.author.bot) return; // Ignore messages with no content if (!message.content || !message.content.length || !message.content.trim().length) return; const botPrefix = config.generalSettings.bot_prefix; // Ignore any message that does not start with the prefix if (message.content.indexOf(botPrefix) !== 0) return; // Separate the command name from its arguments const args = message.content.slice(botPrefix.length).trim().split(/ +/g); // Add a fake character to avoid that a space in between the prefix and the command is ignored (due to .trim()) if (message.content.slice(botPrefix.length).indexOf(args[0])) args.splice(0, 0, ""); // Isolate the actual command, return if no command let command = args.shift(); if (command && command.length) command = command.toLowerCase(); else return; // Return on unknown commands if (!Object.keys(_commandsLogic).includes(command)) return; // Log and execute the command response logger.info(`[Command Request] From ${message.author.tag} (${message.author.id}), Command [ ${command} ] in Server ${message.guild.name} (${message.guild.id}), Channel #${message.channel.name} (${message.channel.id}), ` + `Message ID [ ${message.id} ].`); return _commandsLogic[command](message); }; module.exports = { commandHandler, };
46.45283
223
0.653534
7312929a680f53a2ee5f05026706d0728ac8b4ee
1,704
js
JavaScript
client/src/components/GridField/tests/GridField-test.js
dnsl48/silverstripe-admin
41c81600659586ed975d7fcd7af4900b8454afcc
[ "BSD-3-Clause" ]
30
2017-03-14T23:17:40.000Z
2022-03-25T04:29:19.000Z
client/src/components/GridField/tests/GridField-test.js
dnsl48/silverstripe-admin
41c81600659586ed975d7fcd7af4900b8454afcc
[ "BSD-3-Clause" ]
939
2017-03-15T22:20:59.000Z
2022-03-30T08:25:25.000Z
client/src/components/GridField/tests/GridField-test.js
dnsl48/silverstripe-admin
41c81600659586ed975d7fcd7af4900b8454afcc
[ "BSD-3-Clause" ]
100
2017-03-10T12:11:19.000Z
2022-03-05T11:08:07.000Z
/* global jest, describe, beforeEach, it, expect */ import React from 'react'; import ReactTestUtils from 'react-dom/test-utils'; import GridFieldTable from '../GridFieldTable'; describe('GridFieldTable', () => { let props = null; beforeEach(() => { props = { }; }); describe('generateHeader()', () => { let gridfield = null; it('should return props.header if it is set', () => { props.header = <tr className="header" />; gridfield = ReactTestUtils.renderIntoDocument( <GridFieldTable {...props} /> ); expect(gridfield.generateHeader().props.className).toBe('header'); }); it('should generate and return a header from props.data if it is set', () => { }); it('should return null if props.header and props.data are both not set', () => { gridfield = ReactTestUtils.renderIntoDocument( <GridFieldTable {...props} /> ); expect(gridfield.generateHeader()).toBe(null); }); }); describe('generateRows()', () => { let gridfield = null; it('should return props.rows if it is set', () => { props.rows = [<tr className="row" key="row1"><td>row1</td></tr>]; gridfield = ReactTestUtils.renderIntoDocument( <GridFieldTable {...props} /> ); expect(gridfield.generateRows()[0].props.className).toBe('row'); }); it('should generate and return rows from props.data if it is set', () => { }); it('should return null if props.rows and props.data are both not set', () => { gridfield = ReactTestUtils.renderIntoDocument( <GridFieldTable {...props} /> ); expect(gridfield.generateRows()).toBe(null); }); }); });
25.432836
84
0.599178
7312e62ac4b9cfa13e0c086bc631e001bf71e644
604
js
JavaScript
server/server.js
jerogers8789/React-Book_Shack
c82824c961ea15914b52c7b66a0226d333764ace
[ "Unlicense" ]
null
null
null
server/server.js
jerogers8789/React-Book_Shack
c82824c961ea15914b52c7b66a0226d333764ace
[ "Unlicense" ]
null
null
null
server/server.js
jerogers8789/React-Book_Shack
c82824c961ea15914b52c7b66a0226d333764ace
[ "Unlicense" ]
null
null
null
const express = require('express'); const PORT = process.env.PORT || 3001; const app = express(); const routes = require('./routes'); const mongoose = require('mongoose'); mongoose.set('useCreateIndex', true); app.use(express.urlencoded({extended: true})); app.use(express.json()); if (process.env.NODE_ENV === 'production') { app.use(express.static('client/build')) } app.use(routes); const MONGODB_URI = process.env.MONGODB_URI || 'mongodb://localhost/googlebooks'; mongoose.connect(MONGODB_URI, {useNewUrlParser: true}); app.listen(PORT, () => { console.log(`API Server now on port: ${PORT}`) });
33.555556
81
0.706954
73136411d083126bd31568d4eceb19155d22cda1
3,642
js
JavaScript
app/__sapper__/build/client/legacy/overview.5186f426.js
RegieKI/pdac
3212f3a19055562bf4566487d548ebbbb3ab46e0
[ "MIT" ]
null
null
null
app/__sapper__/build/client/legacy/overview.5186f426.js
RegieKI/pdac
3212f3a19055562bf4566487d548ebbbb3ab46e0
[ "MIT" ]
null
null
null
app/__sapper__/build/client/legacy/overview.5186f426.js
RegieKI/pdac
3212f3a19055562bf4566487d548ebbbb3ab46e0
[ "MIT" ]
null
null
null
import{v as t,w as n,A as a,_ as r,a as e,b as s,c,i as o,s as i,d as u,S as f,B as l,e as h,t as v,f as p,g as d,h as m,j as g,k as $,l as y,m as w,aj as D,n as E,o as I,F as k,C as x,D as R,E as V,L as N,G as S,H as j,I as A,Q as P,q as b,u as q,ak as B,al as C}from"./client.e39ef8f4.js";function F(t){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var a,r=e(t);if(n){var c=e(this).constructor;a=Reflect.construct(r,arguments,c)}else a=r.apply(this,arguments);return s(this,a)}}function G(t,n,a){var r=t.slice();return r[6]=n[a],r[8]=a,r}function H(t){var n,a,r,e,s,c,o,i,u,f=t[6].timestamp+"",l=t[6].message+"";return{c:function(){n=h("div"),a=h("span"),r=v("["),e=v(f),s=v("]"),c=p(),o=h("span"),i=v(l),u=p(),this.h()},l:function(t){n=d(t,"DIV",{});var h=m(n);a=d(h,"SPAN",{class:!0});var v=m(a);r=g(v,"["),e=g(v,f),s=g(v,"]"),v.forEach($),c=y(h),o=d(h,"SPAN",{});var p=m(o);i=g(p,l),p.forEach($),u=y(h),h.forEach($),this.h()},h:function(){w(a,"class","fade"),D(o,"success",t[6].type==J),D(o,"error",t[6].type==z)},m:function(t,f){E(t,n,f),I(n,a),I(a,r),I(a,e),I(a,s),I(n,c),I(n,o),I(o,i),I(n,u)},p:function(t,n){4&n&&f!==(f=t[6].timestamp+"")&&k(e,f),4&n&&l!==(l=t[6].message+"")&&k(i,l),4&n&&D(o,"success",t[6].type==J),4&n&&D(o,"error",t[6].type==z)},d:function(t){t&&$(n)}}}function L(t){var n,a,r,e,s,c,o,i,u,f,D;n=new l({});for(var b=t[2],q=[],B=0;B<b.length;B+=1)q[B]=H(G(t,b,B));return{c:function(){x(n.$$.fragment),a=p(),r=h("div"),e=h("div"),s=v(t[0]),c=p(),o=h("div"),i=v(t[1]),u=p(),f=h("div");for(var l=0;l<q.length;l+=1)q[l].c();this.h()},l:function(l){R(n.$$.fragment,l),a=y(l),r=d(l,"DIV",{class:!0});var h=m(r);e=d(h,"DIV",{});var v=m(e);s=g(v,t[0]),v.forEach($),c=y(h),o=d(h,"DIV",{});var p=m(o);i=g(p,t[1]),p.forEach($),h.forEach($),u=y(l),f=d(l,"DIV",{class:!0});for(var w=m(f),D=0;D<q.length;D+=1)q[D].l(w);w.forEach($),this.h()},h:function(){w(r,"class","plr1"),w(f,"class","konsole p04")},m:function(t,l){V(n,t,l),E(t,a,l),E(t,r,l),I(r,e),I(e,s),I(r,c),I(r,o),I(o,i),E(t,u,l),E(t,f,l);for(var h=0;h<q.length;h+=1)q[h].m(f,null);D=!0},p:function(t,n){var a=N(n,1)[0];if((!D||1&a)&&k(s,t[0]),(!D||2&a)&&k(i,t[1]),4&a){var r;for(b=t[2],r=0;r<b.length;r+=1){var e=G(t,b,r);q[r]?q[r].p(e,a):(q[r]=H(e),q[r].c(),q[r].m(f,null))}for(;r<q.length;r+=1)q[r].d(1);q.length=b.length}},i:function(t){D||(S(n.$$.fragment,t),D=!0)},o:function(t){j(n.$$.fragment,t),D=!1},d:function(t){A(n,t),t&&$(a),t&&$(r),t&&$(u),t&&$(f),P(q,t)}}}function Q(t,n){return _.apply(this,arguments)}function _(){return(_=t(n.mark((function t(r,e){return n.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",a(r,e,this));case 1:case"end":return t.stop()}}),t,this)})))).apply(this,arguments)}var z="❌",J="✅";function K(a,r,e){var s,c;b(a,B,(function(t){return e(5,s=t)})),b(a,C,(function(t){return e(2,c=t)}));var o,i,u,f=r.data;return q(t(n.mark((function t(){return n.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:console.log("[overview.svelte] 👁 mounted overview...");case 1:case"end":return t.stop()}}),t)})))),a.$$set=function(t){"data"in t&&e(3,f=t.data)},a.$$.update=function(){32&a.$$.dirty&&e(4,o=s.status||{}),16&a.$$.dirty&&e(0,i=o.title||"No title"),16&a.$$.dirty&&e(1,u=o.message||"No message")},[i,u,c,f]}var M=function(t){r(a,f);var n=F(a);function a(t){var r;return c(this,a),r=n.call(this),o(u(r),t,K,L,i,{data:3}),r}return a}();export default M;export{Q as preload};
1,821
3,641
0.580725
7313804e0a8eae389745084ee68dbcba183c71a1
1,831
js
JavaScript
src/cli.js
vitwit/SDKGen
22f6371a3f5cd5ab0f9d3a5212b1feab4ded3917
[ "MIT" ]
7
2019-09-21T16:11:41.000Z
2020-12-16T06:50:41.000Z
src/cli.js
vitwit/SDKGen
22f6371a3f5cd5ab0f9d3a5212b1feab4ded3917
[ "MIT" ]
2
2019-10-15T13:45:52.000Z
2021-05-10T14:03:56.000Z
src/cli.js
vitwit/SDKGen
22f6371a3f5cd5ab0f9d3a5212b1feab4ded3917
[ "MIT" ]
2
2019-10-13T17:45:08.000Z
2019-10-16T10:01:17.000Z
import chalk from "chalk"; import arg from "arg"; import { Schedular } from "./scheduleTasks"; import { printManPage } from "./utils"; import { ShellScriptGen } from "./shellScriptGen"; /** * * * @param {*} rawArgs * @returns */ export function parseArgumentsIntoOptions(rawArgs) { let args; try { args = arg({ // Types "--json-file": String, // --jsonFile <string> or --jsonFile=<string> "--version": String, "--js-file": String, "--name": String, "--base-url": String, "--required-headers": [String], "--optional-headers": [String], "--output": String, "--help": Boolean, // Aliases "-f": "--json-file", "-j": "--js-file", "-v": "--version", "-b": "--base-url", "-o": "--optional-headers", "-r": "--required-headers", "-n": "--name" }); } catch (err) { if (err.code === "ARG_UNKNOWN_OPTION") { console.log( ` %s ${err.message} `, chalk.red.bold("ERROR") ); process.exit(1); } else { throw err; } } if (args["--help"]) { printManPage(); process.exit(1); } return { requiredHeaders: args["--required-headers"], optionalHeaders: args["--optional-headers"], name: args["--name"], baseUrl: args["--base-url"], version: args["--version"], jsonFile: args["--json-file"], jsFile: args["--js-file"], output: args["--output"], parsedArgs: args }; } /** * * * @export * @param {*} args */ export async function cli(args) { const { parsedArgs, ...options } = parseArgumentsIntoOptions(args); if (!options.jsonFile) { console.error("%s --json-file is required", chalk.red.bold("ERROR")); process.exit(1); } await new Schedular(options, parsedArgs).generateSDK(); }
20.573034
74
0.538504
7314e679ab459f1515a898ffaaa60c3451416b67
1,197
js
JavaScript
tool/format_content.js
leizongmin/node-doc-cn
d522babe95c1a90b6d2f8c5010c4f155daede921
[ "MIT" ]
127
2015-01-06T09:02:39.000Z
2019-01-04T12:35:26.000Z
tool/format_content.js
leizongmin/node-doc-cn
d522babe95c1a90b6d2f8c5010c4f155daede921
[ "MIT" ]
7
2015-01-01T01:26:44.000Z
2017-12-21T04:08:07.000Z
tool/format_content.js
leizongmin/node-doc-cn
d522babe95c1a90b6d2f8c5010c4f155daede921
[ "MIT" ]
46
2015-02-09T09:29:58.000Z
2017-03-16T02:55:48.000Z
/** * 格式化英文内容,统一换行符,去掉首行的空行,重新生成hash值 */ var async = require('async'); var config = require('../config'); var utils = require('./utils'); var db = config.mysql; console.log('查询出所有记录...'); db.select('origin_api', '*', '1', function (err, list) { if (err) throw err; console.log(' 共%d条数据', list.length); async.eachSeries(list, function (item, next) { // 统一换行符 var content = utils.standardLineBreak(item.content); var lines = content.split(/\n/); if (lines[0].trim() === '') { lines.shift(); content = lines.join('\n'); } var hash = utils.md5(content).toLowerCase(); if (hash === item.hash) return next(); console.log('更新:[%d] %s => %s', item.id, item.hash, hash); db.update('origin_api', '`id`=' + item.id, {hash: hash, content: content}, function (err) { if (err) return next(err); db.update('translate_api', '`origin_hash`=' + db.escape(item.hash), {origin_hash: hash}, function (err, info) { if (err) return next(err); console.log(' 更新了%d条翻译', info.affectedRows); next(); }); }); }, function (err) { if (err) throw err; console.log('完成'); process.exit(); }); });
23.94
117
0.572264
731541bfaba9168e5e9bd10ceea88c84d0e85d43
447
js
JavaScript
test/language/statements/for-in/head-var-bound-names-let.js
katemihalikova/test262
aaf4402b4ca9923012e61830fba588bf7ceb6027
[ "BSD-3-Clause" ]
2,602
2015-01-02T10:45:13.000Z
2022-03-30T23:04:17.000Z
test/language/statements/for-in/head-var-bound-names-let.js
katemihalikova/test262
aaf4402b4ca9923012e61830fba588bf7ceb6027
[ "BSD-3-Clause" ]
2,157
2015-01-06T05:01:55.000Z
2022-03-31T17:18:08.000Z
test/language/statements/for-in/head-var-bound-names-let.js
katemihalikova/test262
aaf4402b4ca9923012e61830fba588bf7ceb6027
[ "BSD-3-Clause" ]
527
2015-01-08T16:04:26.000Z
2022-03-24T03:34:47.000Z
// Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- description: The head's bound names may include "let" esid: sec-for-in-and-for-of-statements-static-semantics-early-errors es6id: 13.7.5 flags: [noStrict] ---*/ var iterCount = 0; for (var let in { attr: null }) { assert.sameValue(let, 'attr'); iterCount += 1; } assert.sameValue(iterCount, 1);
23.526316
70
0.700224
73159582ab9c553b5f8ab9f7c27117c6d43fadd8
437
js
JavaScript
js/components/Title.js
pt-br/relay-phones-guide
9db14cf70286055c8d001e5cefb5002e47de7b70
[ "MIT" ]
null
null
null
js/components/Title.js
pt-br/relay-phones-guide
9db14cf70286055c8d001e5cefb5002e47de7b70
[ "MIT" ]
null
null
null
js/components/Title.js
pt-br/relay-phones-guide
9db14cf70286055c8d001e5cefb5002e47de7b70
[ "MIT" ]
null
null
null
import React, { Component } from 'react'; export default class Title extends Component { constructor(props) { super(props); } render() { const { text } = this.props; return ( <div style={Style.container}> <div style={Style.text}>{text}</div> </div> ); } } const Style = { container: { }, text: { fontSize: '22px', }, }; Title.propTypes = { text: React.PropTypes.string, };
14.096774
46
0.562929
73163e4dc6c6485a97a9c1a930244dd9d3821bae
535
js
JavaScript
test/support/mongooseuser.js
sielay/octopusidentity
dfc02b0bed111869d28c4d3bb382dcbf42315993
[ "MIT" ]
null
null
null
test/support/mongooseuser.js
sielay/octopusidentity
dfc02b0bed111869d28c4d3bb382dcbf42315993
[ "MIT" ]
null
null
null
test/support/mongooseuser.js
sielay/octopusidentity
dfc02b0bed111869d28c4d3bb382dcbf42315993
[ "MIT" ]
null
null
null
var userPlugin = require( 'mongoose-user' ); var mongoose = require('mongoose'); var Schema = mongoose.Schema; var MongooseUserSchema = new Schema( { email : { type : String, default : '' }, hashed_password : { type : String, default : '' }, salt : { type : String, default : '' }, name : { type : String, default : '' } } ); MongooseUserSchema.plugin( userPlugin, {} ); var MongooseUserModel = mongoose.model( 'MongooseUser', MongooseUserSchema ); module.exports = MongooseUserModel;
35.666667
77
0.624299
731693cb6bc565fc010cd6344da32b849c01f619
78
js
JavaScript
src/config/app.config.js
sergeyossinskiy/questionnaire
94bbd39db68e0ff56fc44b0c70ae9b2998ce228f
[ "MIT" ]
null
null
null
src/config/app.config.js
sergeyossinskiy/questionnaire
94bbd39db68e0ff56fc44b0c70ae9b2998ce228f
[ "MIT" ]
null
null
null
src/config/app.config.js
sergeyossinskiy/questionnaire
94bbd39db68e0ff56fc44b0c70ae9b2998ce228f
[ "MIT" ]
null
null
null
export const AppConfig = { appName: 'Qiuz', appSubTitle: 'by Means' };
19.5
27
0.628205
7316a553ff944e46b2dbbd60a9ef4cc27a4945f0
2,685
js
JavaScript
db/mongo/seed.js
abibas-hrsf127/reviews-module-steve
a788bda19d7bd05687449dbde7b9148fed017324
[ "MIT" ]
null
null
null
db/mongo/seed.js
abibas-hrsf127/reviews-module-steve
a788bda19d7bd05687449dbde7b9148fed017324
[ "MIT" ]
1
2022-01-22T12:25:43.000Z
2022-01-22T12:25:43.000Z
db/mongo/seed.js
abibas-hrsf127/reviews-module-steve
a788bda19d7bd05687449dbde7b9148fed017324
[ "MIT" ]
null
null
null
const faker = require("faker"); const ProductsModel = require("./index.js"); async function seedMongo(outer, inner) { var reviewCounter = 1; var reviewList = []; var createReview = function () { for (let p = 0; p < faker.random.number({ min: 0, max: 10 }); p++) { reviewList.push({ review_id: reviewCounter, userVerified: faker.random.boolean(), nickname: faker.internet.userName(), email: faker.internet.email(), category: faker.random.arrayElement([ "comfort", "price", "quality", "satisfaction", "color", ]), subject: faker.lorem.sentence(), description: faker.lorem.sentences(), isRecommended: faker.random.boolean(), ratingSize: faker.random.arrayElement([ "a size too small", "1/2 a size too small", "Perfect", "1/2 a size too big", "a size too big", ]), ratingWidth: faker.random.arrayElement([ "Too narrow", "Slightly narrow", "Perfect", "Slightly wide", "Too wide", ]), ratingComfort: faker.random.arrayElement([ "Uncomfortable", "Slightly uncomfortable", "Ok", "Comfortable", "Perfect", ]), ratingQuality: faker.random.arrayElement([ "Poor", "Below average", "What I expected", "Pretty great", "Perfect", ]), isHelpful: faker.random.number({ min: 0, max: 1000 }), isNotHelpful: faker.random.number({ min: 0, max: 1000 }), createdAt: faker.date .between("2020-01-01", "2020-05-05") .toString() .replace(/G.+/g, "PST"), }); reviewCounter += 1; } }; var productCounter = 1; for (var i = 0; i < outer; i++) { var productList = []; for (var j = 0; j < inner; j++) { createReview(); var singleProduct = { productId: productCounter, productName: faker.commerce.productName(), ratingOverall: faker.random.number({ min: 1, max: 5 }), reviews: reviewList }; reviewList = []; productList.push(singleProduct); productCounter += 1; if (productCounter % 100000 === 0) { console.log("product seeding progress:", productCounter); } } await ProductsModel.insertMany(productList); } console.log("Number of review:", reviewCounter - 1); console.log("Number of product:", productCounter - 1); } seedMongo(10000, 1000); console.log("...done"); console.time("seed time"); console.timeEnd("seed time");
28.263158
72
0.544134
7316a5f9133a6deedf36442d8fd80a188c951e91
322
js
JavaScript
skeletons/default/build/shared/apps/index/text.js
inventorjs/inventor-cli
0dea11d17952059c608c3f1ad8757ed1f07c7ea9
[ "MIT" ]
1
2017-12-03T12:55:31.000Z
2017-12-03T12:55:31.000Z
skeletons/default/build/shared/app/index/text.js
inventorjs/inventor-cli
0dea11d17952059c608c3f1ad8757ed1f07c7ea9
[ "MIT" ]
1
2018-09-18T13:09:35.000Z
2018-09-18T13:09:35.000Z
skeletons/default/build/shared/apps/index/text.js
inventorjs/inventor-cli
0dea11d17952059c608c3f1ad8757ed1f07c7ea9
[ "MIT" ]
null
null
null
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = undefined; var _redux = require('./redux'); var _redux2 = _interopRequireDefault(_redux); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = _redux2.default;
23
95
0.723602
7316b4dcda01209023ea8b840bab7bcf651f8204
1,475
js
JavaScript
app/components/volume-source/source-custom-log-path/component.js
rak-phillip/ui
b17134067bcc530f298e30eaff886ff63c9fb02f
[ "Apache-2.0" ]
2
2016-01-07T15:43:50.000Z
2016-05-17T19:07:59.000Z
app/components/volume-source/source-custom-log-path/component.js
rak-phillip/ui
b17134067bcc530f298e30eaff886ff63c9fb02f
[ "Apache-2.0" ]
null
null
null
app/components/volume-source/source-custom-log-path/component.js
rak-phillip/ui
b17134067bcc530f298e30eaff886ff63c9fb02f
[ "Apache-2.0" ]
2
2015-09-10T01:33:21.000Z
2016-01-07T15:43:53.000Z
import { get, set, computed, observer } from '@ember/object'; import Component from '@ember/component'; import layout from './template'; import VolumeSource from 'shared/mixins/volume-source'; const formats = [ 'json', 'apache2', 'nginx', 'rfc3164', 'rfc5424', 'none', ].map((value) => ({ value, label: value, })); export default Component.extend(VolumeSource, { layout, formats, useCustomRegex: false, cachedFormat: null, field: 'flexVolume', initialCustomFormat: null, init() { this._super(...arguments); const format = get(this, 'config.options.format'); if (formats.every((item) => item.value !== format)) { set(this, 'useCustomRegex', true); set(this, 'initialCustomFormat', format); } }, actions: { remove() { if (this.remove) { this.remove(this.model); } }, useCustomRegex() { set(this, 'useCustomRegex', !get(this, 'useCustomRegex')); }, }, useCustomRegexChange: observer('useCustomRegex', function() { const useCustomRegex = get(this, 'useCustomRegex'); if (useCustomRegex) { set(this, 'cachedFormat', get(this, 'config.options.format')); set(this, 'config.options.format', get(this, 'initialCustomFormat')); } else { set(this, 'config.options.format', get(this, 'cachedFormat')); } }), firstMount: computed('mounts.[]', function() { return get(this, 'mounts').get('firstObject'); }), });
23.412698
75
0.615593
73172981d7e37b2b234b7c915cfe15e4ea215705
304
js
JavaScript
src/2017/5/part-2.js
Akallabet/advent-of-code-2017
a70aa92cf1359fa46e3edfda90b153961237c35f
[ "MIT" ]
null
null
null
src/2017/5/part-2.js
Akallabet/advent-of-code-2017
a70aa92cf1359fa46e3edfda90b153961237c35f
[ "MIT" ]
null
null
null
src/2017/5/part-2.js
Akallabet/advent-of-code-2017
a70aa92cf1359fa46e3edfda90b153961237c35f
[ "MIT" ]
null
null
null
const MazeJumps = (input) => { let idx = 0 let step = 0 const maze = input.split('\n').map(n => parseInt(n)) while (idx < maze.length && idx >= 0) { const jump = idx + maze[idx] maze[idx] += maze[idx] >= 3 ? -1 : 1 idx = jump step++ } return step } export default MazeJumps
19
54
0.552632
73172aff655c8bc743acc789523ff0ce46990eab
315
js
JavaScript
app/components/map/js/levelsStrategies/nestedLevelStrategy.js
skvigl/Map-Prototype
8e493b89bd2fc1d9899ea78b3c620b682d7487e2
[ "MIT" ]
6
2017-02-25T16:03:34.000Z
2017-07-01T07:02:51.000Z
app/components/map/js/levelsStrategies/nestedLevelStrategy.js
skvigl/Map-Prototype
8e493b89bd2fc1d9899ea78b3c620b682d7487e2
[ "MIT" ]
null
null
null
app/components/map/js/levelsStrategies/nestedLevelStrategy.js
skvigl/Map-Prototype
8e493b89bd2fc1d9899ea78b3c620b682d7487e2
[ "MIT" ]
null
null
null
import AbstractLevelStrategy from './abstractLevelStrategy'; import TabNames from '../enums/tabNames'; export default class NestedLevelStrategy extends AbstractLevelStrategy { getTabs() { return [ TabNames.overview, TabNames.pois, TabNames.hotels ]; } }
24.230769
72
0.644444
73173287e7fdeb2eab1db51b2a91a9c90ce68d44
76
js
JavaScript
scripts/findTestsCleanup.js
arvindnarsimhan/NebulaLogger
ac69a01e2fc7a0703b079e01a2ee3cd5b333d424
[ "MIT" ]
null
null
null
scripts/findTestsCleanup.js
arvindnarsimhan/NebulaLogger
ac69a01e2fc7a0703b079e01a2ee3cd5b333d424
[ "MIT" ]
null
null
null
scripts/findTestsCleanup.js
arvindnarsimhan/NebulaLogger
ac69a01e2fc7a0703b079e01a2ee3cd5b333d424
[ "MIT" ]
null
null
null
const fs = require("fs"); try { fs.unlinkSync("./test-files"); } catch {}
15.2
32
0.592105
73175143606259e9e3fc0f0cafcdc83621599519
1,413
js
JavaScript
node_modules/rc-field-form/lib/index.js
dillonthompson/dillonthompson.github.io
c5344ace15bd31dba258a9c6b1a2278358fe243a
[ "MIT" ]
10
2021-01-19T16:48:22.000Z
2021-02-18T16:55:52.000Z
node_modules/rc-field-form/lib/index.js
dillonthompson/dillonthompson.github.io
c5344ace15bd31dba258a9c6b1a2278358fe243a
[ "MIT" ]
9
2020-11-27T16:32:40.000Z
2022-02-13T19:22:26.000Z
node_modules/rc-field-form/lib/index.js
dillonthompson/dillonthompson.github.io
c5344ace15bd31dba258a9c6b1a2278358fe243a
[ "MIT" ]
8
2020-11-20T19:57:12.000Z
2021-02-07T03:10:20.000Z
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "Field", { enumerable: true, get: function get() { return _Field.default; } }); Object.defineProperty(exports, "List", { enumerable: true, get: function get() { return _List.default; } }); Object.defineProperty(exports, "useForm", { enumerable: true, get: function get() { return _useForm.default; } }); Object.defineProperty(exports, "FormProvider", { enumerable: true, get: function get() { return _FormContext.FormProvider; } }); exports.default = void 0; var React = _interopRequireWildcard(require("react")); var _Field = _interopRequireDefault(require("./Field")); var _List = _interopRequireDefault(require("./List")); var _useForm = _interopRequireDefault(require("./useForm")); var _Form = _interopRequireDefault(require("./Form")); var _FormContext = require("./FormContext"); var InternalForm = /*#__PURE__*/React.forwardRef(_Form.default); var RefForm = InternalForm; RefForm.FormProvider = _FormContext.FormProvider; RefForm.Field = _Field.default; RefForm.List = _List.default; RefForm.useForm = _useForm.default; var _default = RefForm; exports.default = _default;
25.690909
87
0.733192
73176ca7a09f75cad84130b601ac7366cea53c06
1,784
js
JavaScript
gatsby-node.js
charbelchahine/broadsign-prototype
996a901bc6a809a3e385f58aea6df52700ef3cbd
[ "MIT" ]
null
null
null
gatsby-node.js
charbelchahine/broadsign-prototype
996a901bc6a809a3e385f58aea6df52700ef3cbd
[ "MIT" ]
null
null
null
gatsby-node.js
charbelchahine/broadsign-prototype
996a901bc6a809a3e385f58aea6df52700ef3cbd
[ "MIT" ]
null
null
null
/** * Gatsby's Node APIs. * https://www.gatsbyjs.org/docs/node-apis/ **/ const path = require('path') const i18n = require('./src/i18n/config/i18n') const _ = require(`lodash`) const Promise = require(`bluebird`) const slash = require(`slash`) const queryAll = require(`./src/queries/queryAll.js`) exports.onCreatePage = ({ page, actions }) => { if (page.componentPath && page.componentPath.match(/pages|templates/)) { const { createPage, deletePage } = actions const getTitle = (object, path) => { var array = path.split('/').filter(val => val) if (path === '/') { array.push('home') } let value = {} value = array.reduce( (obj, key) => (obj && obj[key] !== 'undefined' ? obj[key] : undefined), object ) return value ? value.title : 'Untitled' } return new Promise(resolve => { deletePage(page) Object.keys(i18n).map(key => { return createPage({ ...page, path: i18n[key].path + page.path, context: { lang: i18n[key], title: getTitle(i18n[key], page.path) } }) }) resolve() }) } } exports.createPages = ({ graphql, actions }) => { const { createPage } = actions; return new Promise((resolve, reject) => { const postTemplate = path.resolve("./src/templates/post.js") const blogTemplate = path.resolve("./src/templates/blog.js") createPage({ path: `/blog/`, component: slash(blogTemplate) }); resolve( graphql(queryAll).then(result => { if (result.errors) reject(result.errors) const posts = result.data.allWordpressPost.edges posts.forEach(edge => { createPage({ path: `/blog/${edge.node.slug}/`, component: slash(postTemplate), context: { id: edge.node.id, }, }); }) }) ) resolve() }) }
22.3
75
0.598655
73182cbf01fa5754b4e88664901203c4efb26dce
13,096
js
JavaScript
screens/Login(111:2845)1269964_111_2845/index.js
crowdbotics-apps/vimp-app-2-32557
e38841b05699472eb72c4d6e792a81460de367bb
[ "FTL", "AML", "RSA-MD" ]
null
null
null
screens/Login(111:2845)1269964_111_2845/index.js
crowdbotics-apps/vimp-app-2-32557
e38841b05699472eb72c4d6e792a81460de367bb
[ "FTL", "AML", "RSA-MD" ]
null
null
null
screens/Login(111:2845)1269964_111_2845/index.js
crowdbotics-apps/vimp-app-2-32557
e38841b05699472eb72c4d6e792a81460de367bb
[ "FTL", "AML", "RSA-MD" ]
null
null
null
import React from "react" import { View, Image, ImageBackground, TouchableOpacity, Text, Button, Switch, TextInput, StyleSheet, ScrollView } from "react-native" import Icon from "react-native-vector-icons/FontAwesome" import { CheckBox } from "react-native-elements" import { connect } from "react-redux" import { widthPercentageToDP as wp, heightPercentageToDP as hp } from "react-native-responsive-screen" import { getNavigationScreen } from "@screens" export class Blank extends React.Component { constructor(props) { super(props) this.state = {} } render = () => ( <ScrollView contentContainerStyle={{ flexGrow: 1 }} style={styles.ScrollView_1} > <View style={styles.View_2} /> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/4fe7/c638/d6f84af8e5924acd67b3f2d81a854cf2" }} style={styles.ImageBackground_111_2846} /> <View style={styles.View_111_2847}> <View style={styles.View_111_2848}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/152d/36db/2550e655506dda054b9193b89a05efe4" }} style={styles.ImageBackground_111_2849} /> <View style={styles.View_111_2850}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/cef9/04d6/a0a52bbd88849274356e8f52ddc40a8e" }} style={styles.ImageBackground_111_2851} /> </View> </View> <View style={styles.View_111_2852}> <Text style={styles.Text_111_2852}> Lorem ipsum dolor sit amet, consectetur adipiscing elit. </Text> </View> <TouchableOpacity style={styles.TouchableOpacity_111_2853} onPress={() => this.props.navigation.navigate(getNavigationScreen("111_2887")) } > <View style={styles.View_111_2854}> <View style={styles.View_111_2855}> <Text style={styles.Text_111_2855}>Continue with email</Text> </View> </View> </TouchableOpacity> <View style={styles.View_111_2856}> <Text style={styles.Text_111_2856}>You Can Sign In with</Text> </View> <View style={styles.View_111_2857}> <View style={styles.View_111_2858}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/4f81/4850/232c86f4492ac4ed70b611ba39f0a83b" }} style={styles.ImageBackground_111_2859} /> <View style={styles.View_111_2864}> <Text style={styles.Text_111_2864}>Gmail</Text> </View> </View> </View> <View style={styles.View_111_2865}> <View style={styles.View_111_2866}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/b7c0/204d/341008710dd2a36053e279a148679efc" }} style={styles.ImageBackground_111_2867} /> <View style={styles.View_111_2868}> <Text style={styles.Text_111_2868}>Facebook</Text> </View> </View> </View> </View> <View style={styles.View_111_2869}> <View style={styles.View_111_2870}> <View style={styles.View_111_2871} /> <View style={styles.View_111_2872}> <View style={styles.View_111_2873} /> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/55d5/f2fd/e11b5d6fe55eb953f02aaac25a84d5be" }} style={styles.ImageBackground_111_2874} /> <View style={styles.View_111_2875} /> </View> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/da39/27d7/d0739342b1f8ca6043489e9e3efe3e22" }} style={styles.ImageBackground_111_2876} /> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/0d25/b952/48d88af9c2d393b00f59cb1ea3039b28" }} style={styles.ImageBackground_111_2880} /> <View style={styles.View_111_2885}> <View style={styles.View_111_2886}> <Text style={styles.Text_111_2886}>9:41</Text> </View> </View> </View> </View> </ScrollView> ) } const styles = StyleSheet.create({ ScrollView_1: { backgroundColor: "rgba(0, 0, 0, 0)" }, View_2: { height: hp("111%") }, ImageBackground_111_2846: { width: wp("100%"), minWidth: wp("100%"), height: hp("69%"), minHeight: hp("69%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%") }, View_111_2847: { width: wp("87%"), minWidth: wp("87%"), height: hp("59%"), minHeight: hp("59%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("7%"), top: hp("44%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_111_2848: { width: wp("15%"), minWidth: wp("15%"), height: hp("8%"), minHeight: hp("8%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("36%"), top: hp("0%") }, ImageBackground_111_2849: { width: wp("15%"), minWidth: wp("15%"), height: hp("8%"), minHeight: hp("8%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%") }, View_111_2850: { width: wp("9%"), height: hp("4%"), top: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("3%"), backgroundColor: "rgba(0, 0, 0, 0)" }, ImageBackground_111_2851: { width: wp("9%"), height: hp("4%"), top: hp("0%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%") }, View_111_2852: { width: wp("75%"), top: hp("11%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("6%"), justifyContent: "flex-start" }, Text_111_2852: { color: "rgba(255, 255, 255, 1)", fontSize: 16, fontWeight: "500", textAlign: "center", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, TouchableOpacity_111_2853: { width: wp("86%"), minWidth: wp("86%"), height: hp("8%"), minHeight: hp("8%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("23%"), backgroundColor: "rgba(235, 124, 104, 1)" }, View_111_2854: { width: wp("49%"), height: hp("3%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("19%"), top: hp("2%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_111_2855: { width: wp("41%"), top: hp("0%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("4%"), justifyContent: "flex-start" }, Text_111_2855: { color: "rgba(255, 255, 255, 1)", fontSize: 13, fontWeight: "600", textAlign: "center", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_111_2856: { width: wp("31%"), minWidth: wp("31%"), minHeight: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("28%"), top: hp("34%"), justifyContent: "flex-start" }, Text_111_2856: { color: "rgba(255, 255, 255, 1)", fontSize: 10, fontWeight: "600", textAlign: "center", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_111_2857: { width: wp("87%"), minWidth: wp("87%"), height: hp("8%"), minHeight: hp("8%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("40%"), backgroundColor: "rgba(255, 255, 255, 1)" }, View_111_2858: { width: wp("21%"), minWidth: wp("21%"), height: hp("4%"), minHeight: hp("4%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("33%"), top: hp("2%") }, ImageBackground_111_2859: { width: wp("7%"), height: hp("4%"), top: hp("0%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%") }, View_111_2864: { width: wp("12%"), minWidth: wp("12%"), minHeight: hp("3%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("9%"), top: hp("0%"), justifyContent: "flex-start" }, Text_111_2864: { color: "rgba(25, 118, 210, 1)", fontSize: 13, fontWeight: "500", textAlign: "center", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_111_2865: { width: wp("86%"), minWidth: wp("86%"), height: hp("8%"), minHeight: hp("8%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("51%"), backgroundColor: "rgba(255, 255, 255, 1)" }, View_111_2866: { width: wp("26%"), minWidth: wp("26%"), height: hp("3%"), minHeight: hp("3%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("30%"), top: hp("2%"), backgroundColor: "rgba(0, 0, 0, 0)" }, ImageBackground_111_2867: { width: wp("3%"), height: hp("3%"), top: hp("0%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%") }, View_111_2868: { width: wp("20%"), minWidth: wp("20%"), minHeight: hp("3%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("6%"), top: hp("0%"), justifyContent: "flex-start" }, Text_111_2868: { color: "rgba(60, 90, 154, 1)", fontSize: 13, fontWeight: "500", textAlign: "center", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_111_2869: { width: wp("100%"), height: hp("6%"), minHeight: hp("6%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_111_2870: { width: wp("100%"), height: hp("6%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%"), backgroundColor: "rgba(0, 0, 0, 0)", overflow: "hidden" }, View_111_2871: { width: wp("100%"), height: hp("6%"), top: hp("0%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%") }, View_111_2872: { width: wp("6%"), minWidth: wp("6%"), height: hp("2%"), minHeight: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("90%"), top: hp("2%") }, View_111_2873: { width: wp("6%"), minWidth: wp("6%"), height: hp("2%"), minHeight: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%"), borderColor: "rgba(3, 36, 38, 1)", borderWidth: 1 }, ImageBackground_111_2874: { width: wp("0%"), minWidth: wp("0%"), height: hp("1%"), minHeight: hp("1%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("6%"), top: hp("1%") }, View_111_2875: { width: wp("5%"), minWidth: wp("5%"), height: hp("1%"), minHeight: hp("1%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("1%"), top: hp("0%"), backgroundColor: "rgba(3, 36, 38, 1)" }, ImageBackground_111_2876: { width: wp("4%"), height: hp("1%"), top: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("84%") }, ImageBackground_111_2880: { width: wp("5%"), height: hp("1%"), top: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("78%") }, View_111_2885: { width: wp("14%"), minWidth: wp("14%"), height: hp("3%"), minHeight: hp("3%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("6%"), top: hp("2%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_111_2886: { width: wp("14%"), minWidth: wp("14%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%"), justifyContent: "flex-start" }, Text_111_2886: { color: "rgba(3, 36, 38, 1)", fontSize: 11, fontWeight: "600", textAlign: "center", fontStyle: "normal", letterSpacing: -0.2800000011920929, textTransform: "none" } }) const mapStateToProps = state => { return {} } const mapDispatchToProps = () => { return {} } export default connect(mapStateToProps, mapDispatchToProps)(Blank)
24.524345
117
0.535354
7318c777a52e91d6af4c120fe9eeddb862b8d86b
195
js
JavaScript
tests/fixtures/async-await-example.js
SKalt/cookiecutter-webpack-es6-plus
6181c832baad6202dde98541df0abea39a908ba9
[ "MIT" ]
null
null
null
tests/fixtures/async-await-example.js
SKalt/cookiecutter-webpack-es6-plus
6181c832baad6202dde98541df0abea39a908ba9
[ "MIT" ]
null
null
null
tests/fixtures/async-await-example.js
SKalt/cookiecutter-webpack-es6-plus
6181c832baad6202dde98541df0abea39a908ba9
[ "MIT" ]
null
null
null
/** * foo * @return {[type]} [description] */ async function foo() { return 1; } /** * bar * @return {[type]} [description] */ async function bar() { return await foo() + 1; } bar();
10.833333
33
0.538462
7318fa3ae44976930e15cacb8fda413b8f214f2a
1,671
js
JavaScript
src/checkbox.js
peerawatth/cookie-consent
711d4e71e40d9f7fd401d2192e8711994afacde0
[ "MIT" ]
null
null
null
src/checkbox.js
peerawatth/cookie-consent
711d4e71e40d9f7fd401d2192e8711994afacde0
[ "MIT" ]
null
null
null
src/checkbox.js
peerawatth/cookie-consent
711d4e71e40d9f7fd401d2192e8711994afacde0
[ "MIT" ]
null
null
null
/* * This document includes material copied from or derived from * https://www.w3.org/TR/wai-aria-practices/examples/checkbox/checkbox-1/js/checkbox.js * Copyright © 2015 W3C® (MIT, ERCIM, Keio, Beihang). * */ export default class Checkbox { constructor(domNode) { this.domNode = domNode; this.keyCode = Object.freeze({ "RETURN": 13, "SPACE": 32 }); } init() { this.domNode.tabIndex = 0; if (!this.domNode.getAttribute("aria-checked")) { this.domNode.setAttribute("aria-checked", "false"); } this.domNode.addEventListener("keydown", this.handleKeydown.bind(this)); this.domNode.addEventListener("click", this.handleClick.bind(this)); this.domNode.addEventListener("focus", this.handleFocus.bind(this)); this.domNode.addEventListener("blur", this.handleBlur.bind(this)); } toggleCheckbox() { if (this.domNode.getAttribute("aria-disabled") === "true") { return; } if (this.domNode.getAttribute("aria-checked") === "true") { this.domNode.setAttribute("aria-checked", "false"); } else { this.domNode.setAttribute("aria-checked", "true"); } } /* EVENT HANDLERS */ handleKeydown(event) { let flag = false; switch (event.keyCode) { case this.keyCode.SPACE: this.toggleCheckbox(); flag = true; break; default: break; } if (flag) { event.stopPropagation(); event.preventDefault(); } } handleClick() { this.toggleCheckbox(); } handleFocus() { this.domNode.classList.add("focus"); } handleBlur() { this.domNode.classList.remove("focus"); } }
21.151899
87
0.61939
731902228214e7c50372b2df90d0a55c3fb300de
1,233
js
JavaScript
assets/calendario/angular-fullcalendar.min.js
jobserver/webradio-panel-admin
fa0a780f2be450779c84051b5e5cfe7f7921df02
[ "MIT" ]
null
null
null
assets/calendario/angular-fullcalendar.min.js
jobserver/webradio-panel-admin
fa0a780f2be450779c84051b5e5cfe7f7921df02
[ "MIT" ]
null
null
null
assets/calendario/angular-fullcalendar.min.js
jobserver/webradio-panel-admin
fa0a780f2be450779c84051b5e5cfe7f7921df02
[ "MIT" ]
null
null
null
/* angular-fullcalendar https://github.com/JavyMB/angular-fullcalendar#readme Version: 1.0.1 - 2017-09-14T15:14:58.066Z License: ISC */ (function(){angular.module("angular-fullcalendar",[]).value("CALENDAR_DEFAULTS",{locale:"pt-br",defaultView:"agendaWeek",height:500,nowIndicator:!0,titleFormat:"D MMM, YYYY",timeFormat:"H(:mm)",columnFormat:"ddd D/M",header:{right:"prev,next",center:"title",left:"agendaWeek,listWeek,agendaDay"},monthNames:"Janeiro Fevereiro Mar\u00e7o Abril Maio Junho Julho Agosto Setembro Outubro Novembro Dezembro".split(" "),monthNamesShort:"Jan Fev Mar Abr Mai Jun Jul Ago Set Out Nov Dez".split(" "),dayNames:"Domingo Segunda Ter\u00e7a Quarta Quinta Sexta Sabado".split(" "), dayNamesShort:"Dom Seg Ter Qua Qui Sex Sab".split(" ")}).directive("fc",["CALENDAR_DEFAULTS",function(f){return{restrict:"A",scope:{eventSource:"=ngModel",options:"=fcOptions"},link:function(a,g){function d(){b||(b=$(g).html(""));b.fullCalendar(angular.extend(f,{events:a.eventSource},a.options))}function e(){b&&b.fullCalendar&&b.fullCalendar("destroy")}function c(a,c){a!==c?(e(),d()):a&&angular.isUndefined(b)&&d()}var b;d();a.$watch("eventSource",c,!0);a.$watch("options",c,!0);a.$on("$destroy",function(){e()})}}}])})();
154.125
567
0.721006
7319be649f213f60885a754c6898d3cb780ba6a8
4,824
js
JavaScript
src/routes/driver/Modal.js
WaylonSong/tms
ba2b69605c412d47f670672a55d354a83d9e4bf9
[ "MIT" ]
2
2018-06-15T06:09:29.000Z
2018-07-17T10:19:40.000Z
src/routes/driver/Modal.js
WaylonSong/tms
ba2b69605c412d47f670672a55d354a83d9e4bf9
[ "MIT" ]
null
null
null
src/routes/driver/Modal.js
WaylonSong/tms
ba2b69605c412d47f670672a55d354a83d9e4bf9
[ "MIT" ]
null
null
null
import React from 'react' import PropTypes from 'prop-types' import { Form, Input, InputNumber, Radio, Modal,Select, Cascader, Row, Col, Card, Icon, Tooltip} from 'antd' import city from '../../utils/city' import ACInput from '../../components/Map/ACInput' import Price from '../../components/Map/Price' import DistanceHandler from '../../components/Map/DistanceHandler' const FormItem = Form.Item const formItemLayout = { labelCol: { span: 6, }, wrapperCol: { span: 14, }, } var districtMap = {} const modal = ({ item, modalType, itemIndexes, onOk, onAddBlankTo, // onCancel, onMinusTo = ()=>console.log("Minus To"), form: { getFieldDecorator, validateFields, getFieldsValue, getFieldValue, setFieldsValue }, ...modalProps }) => { const handleOk = () => { if(modalType == "view") onOk(""); else{ validateFields((errors) => { if (errors) { return } var formData = getFieldsValue(); const data = { ...formData, key: item.key, } console.log(data) onOk(data) }) } } const formItemLayout = { labelCol: { xs: { span: 24 }, sm: { span: 5 }, }, wrapperCol: { xs: { span: 24 }, sm: { span: 16 }, }, }; const formItemLayoutWithOutLabel = { wrapperCol: { xs: { span: 24, offset: 0 }, sm: { span: 16, offset: 5 }, }, }; const safeGetFieldValue = (name)=>{ if(getFieldValue(name)) return getFieldValue(name) else return "" } const modalOpts = { ...modalProps, onOk: handleOk, } var disableFlag = {disabled:modalType=='view'} const types = ["箱货", "货车", "平板", "面包车", "冷藏车"] const getDom = ()=>{ return <Input {...disableFlag}/>; } const genToList = () => { var list = []; return list; } // getFieldDecorator('keys', { initialValue: [] }); return ( <Modal {...modalOpts} width={600} style={{}}> <Form layout="horizontal"> <Row gutter={24}> <FormItem label="驾驶证编号" hasFeedback {...formItemLayout}> {getFieldDecorator('id', { initialValue: item.id||'', rules: [{required: true}], })( <Input/> )} </FormItem> <FormItem label="姓名" hasFeedback {...formItemLayout}> {getFieldDecorator('name', { initialValue: item.name||'', rules: [{required: true}], })( <Input/> )} </FormItem> <FormItem label="性别" hasFeedback {...formItemLayout}> {getFieldDecorator('gender', { initialValue: item.gender||'男', rules: [{required: true}], })( <Radio.Group defaultValue='男'> <Radio value='男'>男</Radio> <Radio value='女'>女</Radio> </Radio.Group> )} </FormItem> <FormItem label="身份证" hasFeedback {...formItemLayout}> {getFieldDecorator('idCard', { initialValue: item.idCard||'', rules: [{required: true}], })( <Input/> )} </FormItem> <FormItem label="学历" hasFeedback {...formItemLayout}> {getFieldDecorator('education', { initialValue: item.education||'', rules: [{required: true}], })( <Select><Option key='小学'>小学</Option><Option key='中学'>中学</Option><Option key='专科'>专科</Option><Option key='本科'>本科</Option><Option key='研究生及以上'>研究生及以上</Option></Select> )} </FormItem> <FormItem label="银行卡" hasFeedback {...formItemLayout}> {getFieldDecorator('bankCard', { initialValue: item.bankCard||'', })( <Input/> )} </FormItem> <FormItem label="电话" hasFeedback {...formItemLayout}> {getFieldDecorator('phone', { initialValue: item.phone||'', rules: [{required: true}], })( <Input/> )} </FormItem> <FormItem label="在岗状态" hasFeedback {...formItemLayout}> {getFieldDecorator('status', { initialValue: item.status||"ON", rules: [{required: true}], })( <Radio.Group> <Radio value={"OFF"}>下班</Radio> <Radio value={"ON"}>当班</Radio> </Radio.Group> )} </FormItem> </Row> </Form> </Modal> ) } modal.propTypes = { form: PropTypes.object.isRequired, type: PropTypes.string, item: PropTypes.object, onOk: PropTypes.func, } export default Form.create()(modal)
26.217391
179
0.500415
731a50d786863811126b1a326432aed105a104b7
2,286
js
JavaScript
src/components/Map.js
vannizhang/firefly-symbols-generator
21fa020321ebdeb22571c066ce6e8c085c2d2f88
[ "Apache-2.0" ]
4
2019-11-25T03:01:50.000Z
2021-05-02T07:23:32.000Z
src/components/Map.js
vannizhang/firefly-symbols-generator
21fa020321ebdeb22571c066ce6e8c085c2d2f88
[ "Apache-2.0" ]
null
null
null
src/components/Map.js
vannizhang/firefly-symbols-generator
21fa020321ebdeb22571c066ce6e8c085c2d2f88
[ "Apache-2.0" ]
null
null
null
import React from 'react'; import { loadCss, loadModules } from "esri-loader"; const esriLoaderOptions = { css: true }; const config = { containerId: 'viewDiv', webmapId: '4c2895b0eb4b42399a1d6885410844fc', }; export default class Map extends React.PureComponent { constructor(props){ super(props); this.mapView = null; this.state = { }; } initMap(){ loadModules(['esri/views/MapView', 'esri/WebMap'], esriLoaderOptions) .then(([MapView, WebMap])=>{ const webmap = new WebMap({ portalItem: { id: config.webmapId } }); this.mapView = new MapView({ container: config.containerId, map: webmap, padding: { right: this.props.paddingRight || 0 } }); this.mapView.when(()=>{ this.updateRendererFortheDemoLayer(); }); }); } updateRendererFortheDemoLayer(){ const demoLayer = this.mapView.map.layers.getItemAt(0); // console.log(demoLayer); if(this.props.activeStyleUrl && demoLayer){ const symbolSize = this.state.symbolSize ? this.state.symbolSize + 'px' : '24px'; const symbol = { type: "picture-marker", // autocasts as new PictureMarkerSymbol() url: this.props.activeStyleUrl, width: symbolSize, height: symbolSize }; const renderer = { type: "simple", symbol }; demoLayer.renderer = renderer; } } componentDidUpdate(prevProps, prevState){ if(this.props.activeStyleUrl !== prevProps.activeStyleUrl){ this.updateRendererFortheDemoLayer(); } } componentDidMount(){ this.initMap(); } render(){ return( <div id={config.containerId} style={{ position: 'absolute', top: 0, bottom: 0, left: 0, right: 0, margin: 0, padding: 0 }}></div> ); } }
23.8125
93
0.486002
731ab1b06acebb9b087cd6ed133ba01a8f532365
405
js
JavaScript
node_modules/cylon-i2c/examples/lsm9ds0g/fluent-lsm9ds0g.js
SmartCIA/ServiceSmart
d7bbb8800de9c55d0b264b3b6a4c2981bc9709fe
[ "Intel", "Unlicense" ]
1
2015-12-25T09:52:40.000Z
2015-12-25T09:52:40.000Z
node_modules/cylon-i2c/examples/lsm9ds0g/fluent-lsm9ds0g.js
SmartCIA/ServiceSmart
d7bbb8800de9c55d0b264b3b6a4c2981bc9709fe
[ "Intel", "Unlicense" ]
null
null
null
node_modules/cylon-i2c/examples/lsm9ds0g/fluent-lsm9ds0g.js
SmartCIA/ServiceSmart
d7bbb8800de9c55d0b264b3b6a4c2981bc9709fe
[ "Intel", "Unlicense" ]
null
null
null
"use strict"; var Cylon = require("cylon"); Cylon .robot() .connection("arduino", { adaptor: "firmata", port: "/dev/tty.usbmodem1421" }) .device("gyro", { driver: "lsm9ds0g" }) .on("ready", function(bot) { setInterval(function() { bot.gyro.getGyro(function(err, data) { if (err) { console.error(err); } console.log(data); }); }, 1000); }); Cylon.start();
20.25
79
0.567901
731ac309ebd670768dfb398029c0e2af501d5bb2
414
js
JavaScript
doc/html/search/functions_b.js
SKA-ScienceDataProcessor/FastImaging
8103fb4d20434ffdc45dee7471dafc6be66354bb
[ "Apache-2.0" ]
7
2017-02-13T11:21:21.000Z
2020-07-20T16:07:39.000Z
doc/html/search/functions_b.js
SKA-ScienceDataProcessor/FastImaging
8103fb4d20434ffdc45dee7471dafc6be66354bb
[ "Apache-2.0" ]
15
2016-09-11T11:14:35.000Z
2017-08-29T14:21:46.000Z
doc/html/search/functions_b.js
SKA-ScienceDataProcessor/FastImaging
8103fb4d20434ffdc45dee7471dafc6be66354bb
[ "Apache-2.0" ]
4
2016-10-28T16:17:08.000Z
2021-12-22T12:11:12.000Z
var searchData= [ ['normalise_5fimage_5fbeam_5fresult_5f1d',['normalise_image_beam_result_1D',['../namespacestp.html#a674d910ef471f5f234894a92057a0a47',1,'stp']]], ['num_5flower',['num_lower',['../classtk_1_1band__matrix.html#a57b351eff7db8c9875a5204ea3132d42',1,'tk::band_matrix']]], ['num_5fupper',['num_upper',['../classtk_1_1band__matrix.html#a964e9950c0f778b13a963e4acfa8d6ae',1,'tk::band_matrix']]] ];
59.142857
147
0.777778
731bd1024ab4e354fb110f645e0606490069806d
463
js
JavaScript
grunt/watch.js
terrymun/paver
c0b4de10ddbb333215363d857fe7059fa5bd7859
[ "MIT" ]
145
2015-05-14T12:09:08.000Z
2020-07-20T10:57:59.000Z
grunt/watch.js
terrymun/paver
c0b4de10ddbb333215363d857fe7059fa5bd7859
[ "MIT" ]
28
2015-05-20T07:27:58.000Z
2021-09-20T19:06:03.000Z
grunt/watch.js
terrymun/paver
c0b4de10ddbb333215363d857fe7059fa5bd7859
[ "MIT" ]
52
2015-08-05T09:27:55.000Z
2022-01-09T16:17:56.000Z
module.exports = { options: { spawn: false, livereload: true }, scripts: { files: [ 'src/js/*.js', 'demo/src/js/*.js' ], tasks: [ 'jshint', 'uglify' ] }, styles: { files: [ 'src/css/*.scss', 'demo/src/css/*.scss' ], tasks: [ 'sass:prod', 'postcss:prod' ] }, };
15.965517
33
0.323974