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
1026e451e503259b89eac2ee86e4f5c380e28d2d
1,140
js
JavaScript
src/app/plugins/kubernetes/components/common/UserMultiSelect.js
rohitkishnan/pf9-ui-plugin
c671731aadfbed7be3634781bdcb3ac8cf2c3176
[ "Apache-2.0" ]
null
null
null
src/app/plugins/kubernetes/components/common/UserMultiSelect.js
rohitkishnan/pf9-ui-plugin
c671731aadfbed7be3634781bdcb3ac8cf2c3176
[ "Apache-2.0" ]
null
null
null
src/app/plugins/kubernetes/components/common/UserMultiSelect.js
rohitkishnan/pf9-ui-plugin
c671731aadfbed7be3634781bdcb3ac8cf2c3176
[ "Apache-2.0" ]
null
null
null
import React, { forwardRef } from 'react' import PropTypes from 'prop-types' import { projectAs } from 'utils/fp' import withFormContext, { ValidatedFormInputPropTypes } from 'core/components/validatedForm/withFormContext' import useDataLoader from 'core/hooks/useDataLoader' import MultiSelect from 'core/components/MultiSelect' import { mngmUserActions } from 'k8s/components/userManagement/users/actions' const UserMultiSelect = forwardRef(({ onChange, value, ...rest }, ref) => { const [users, loadingUsers] = useDataLoader(mngmUserActions.list, { orderBy: 'username' }) const usersList = projectAs({ label: 'username', value: 'username' }, users) return ( <MultiSelect label="Users" options={usersList} values={value} onChange={onChange} loading={loadingUsers} {...rest} /> ) }) UserMultiSelect.propTypes = { id: PropTypes.string.isRequired, initialValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), onChange: PropTypes.func, ...ValidatedFormInputPropTypes, } UserMultiSelect.displayName = 'UserMultiSelect' export default withFormContext(UserMultiSelect)
33.529412
108
0.738596
1026e810a48b0f1e0b5802e2dcf3a695e72d88f5
2,034
js
JavaScript
benchmark/scope/async_local_storage.js
vecerek/dd-trace-js
5ffa4c2e81a01f910cea4f7e1e4f7932326e668e
[ "Apache-2.0", "BSD-3-Clause" ]
1
2020-09-10T15:15:36.000Z
2020-09-10T15:15:36.000Z
benchmark/scope/async_local_storage.js
vecerek/dd-trace-js
5ffa4c2e81a01f910cea4f7e1e4f7932326e668e
[ "Apache-2.0", "BSD-3-Clause" ]
null
null
null
benchmark/scope/async_local_storage.js
vecerek/dd-trace-js
5ffa4c2e81a01f910cea4f7e1e4f7932326e668e
[ "Apache-2.0", "BSD-3-Clause" ]
null
null
null
'use strict' const { AsyncResource } = require('async_hooks') const proxyquire = require('proxyquire') const platform = require('../../packages/dd-trace/src/platform') const node = require('../../packages/dd-trace/src/platform/node') const benchmark = require('../benchmark') platform.use(node) const suite = benchmark('scope (AsyncLocalStorage)') const spanStub = require('../stubs/span') const Scope = proxyquire('../../packages/dd-trace/src/scope/async_local_storage', { '../platform': platform }) const scope = new Scope({ experimental: {} }) function activateResource (name) { return scope.activate(spanStub, () => { return new AsyncResource(name, { requireManualDestroy: true }) }) } suite .add('Scope#activate', { fn () { const resource = activateResource('test') resource.runInAsyncScope(() => {}) resource.emitDestroy() } }) .add('Scope#activate (nested)', { fn () { const outer = activateResource('outer') let middle let inner outer.runInAsyncScope(() => { middle = activateResource('middle') }) outer.emitDestroy() middle.runInAsyncScope(() => { inner = activateResource('middle') }) middle.emitDestroy() inner.runInAsyncScope(() => {}) inner.emitDestroy() } }) .add('Scope#activate (async)', { defer: true, fn (deferred) { scope.activate(spanStub, () => { queueMicrotask(() => { deferred.resolve() }) }) } }) .add('Scope#activate (promise)', { defer: true, fn (deferred) { scope.activate(spanStub, () => { Promise.resolve().then(() => { deferred.resolve() }) }) } }) .add('Scope#activate (async/await)', { defer: true, async fn (deferred) { await scope.activate(spanStub, () => { return Promise.resolve() }) deferred.resolve() } }) .add('Scope#active', { fn () { scope.active() } }) suite.run()
21.1875
83
0.572271
1027949038f2e7a66bd8ab507c3ff30beaf05616
1,877
js
JavaScript
index.js
MaxArt2501/gulp-json-fmt
7972c7e583a47a98ff5862c0bc57a1863c601ccc
[ "MIT" ]
null
null
null
index.js
MaxArt2501/gulp-json-fmt
7972c7e583a47a98ff5862c0bc57a1863c601ccc
[ "MIT" ]
1
2016-03-09T13:58:44.000Z
2016-03-09T13:58:44.000Z
index.js
MaxArt2501/gulp-json-fmt
7972c7e583a47a98ff5862c0bc57a1863c601ccc
[ "MIT" ]
null
null
null
/*! * gulp-json-fmt * https://github.com/MaxArt2501/gulp-json-fmt * * Copyright (c) 2015-2018 Massimo Artizzu * Licensed under the MIT license. */ "use strict"; var JSONFormatter = require("json-fmt"), PluginError = require("plugin-error"), through = require("through2"); var getBuffer = Buffer.from || function(string, encoding) { return new Buffer(string, encoding); }; function jsonFmt(options) { return through.obj(function(file, encoding, done) { if (file.isNull()) { // Nothing to do here this.push(file), done(); return; } try { var fmt = new JSONFormatter(options); if (file.isBuffer()) { // Buffer mode file.contents = getBuffer(fmt.end(file.contents).flush(), encoding); done(null, file); } else if (file.isStream()) { // Stream mode var stream = through(function(chunk, encoding, callback) { try { callback(null, getBuffer(fmt.append(chunk).flush())); } catch (ee) { callback(ee); } }, function(callback) { try { // Final check fmt.end(); callback(); } catch (ee) { callback(ee); } }); stream.on("error", done); file.contents = file.contents.pipe(stream); done(null, file); } else done(new PluginError("gulp-json-fmt", "Invalid input type")); } catch (e) { done(new PluginError("gulp-json-fmt", e)); } }); } jsonFmt.MINI = JSONFormatter.MINI; jsonFmt.PRETTY = JSONFormatter.PRETTY; jsonFmt.JSONError = JSONFormatter.JSONError; module.exports = exports = jsonFmt;
31.813559
84
0.513586
1027c0b195d78e0aea48358543dc11cd2968b3c2
6,156
js
JavaScript
webapp/src/scenes/services/components/ServiceCards.js
DavidGeisel/machine-learning-lab
2d7a9ecae3780a5ecfe323e55b5d555ac41ce261
[ "Apache-2.0" ]
null
null
null
webapp/src/scenes/services/components/ServiceCards.js
DavidGeisel/machine-learning-lab
2d7a9ecae3780a5ecfe323e55b5d555ac41ce261
[ "Apache-2.0" ]
null
null
null
webapp/src/scenes/services/components/ServiceCards.js
DavidGeisel/machine-learning-lab
2d7a9ecae3780a5ecfe323e55b5d555ac41ce261
[ "Apache-2.0" ]
null
null
null
import React, { Component } from "react"; import PropTypes from "prop-types"; import { connect } from "react-redux"; // material-ui components import { withStyles } from "@material-ui/core/styles"; import Grid from "@material-ui/core/Grid"; import Button from "@material-ui/core/Button"; import Typography from "@material-ui/core/Typography"; import Card from "@material-ui/core/Card"; import CardActions from "@material-ui/core/CardActions"; import CardContent from "@material-ui/core/CardContent"; import CardMedia from "@material-ui/core/CardMedia"; //scene components import DeployServiceControl from "./DeployServiceControl"; import DisplayJsonButton from "./DisplayJsonButton"; import AccessButton from "./AccessButton"; import LogsButton from "../../../components/table/ActionButtons/LogsButton"; import DisplayCommandButton from "./DisplayCommandButton"; //controller import * as Parser from "../../../services/handler/parser"; import * as ReduxUtils from "../../../services/handler/reduxUtils"; import DeleteServiceButton from "./DeleteServiceButton"; const styles = theme => ({ card: { minWidth: 0, display: "flex", height: "100%" }, content: { flex: "1 0 auto" }, details: { display: "flex", flexDirection: "column", width: "calc(100% - 100px)" }, pos: { marginBottom: 12, color: theme.palette.text.secondary }, serviceImage: { width: 80, height: 80, marginTop: theme.spacing(2), marginRight: theme.spacing(2) }, controls: { display: "flex", alignItems: "center", paddingLeft: theme.spacing(1), paddingBottom: theme.spacing(1) }, DeployServiceDialog: { marginTop: "20px", display: "inline-block" } }); class ServiceCard extends Component { getIconFromName(type) { return "./service_default.png"; } getServiceName(currentProject, serviceName) { var regex = new RegExp(currentProject + "-", "g"); var newServiceName = serviceName.replace(regex, ""); var serviceNameTruncated = Parser.truncate(newServiceName, 50); return serviceNameTruncated; } render() { const { classes, isAdmin } = this.props; return ( <Grid item xs={12} sm={12} md={6} lg={this.props.colSize}> <Card className={classes.card}> <div className={classes.details}> <CardContent className={classes.content}> <Typography style={{ overflow: "auto", fontSize: "1.0rem" }} variant="h5" component="h2" > {this.getServiceName( this.props.currentProject, this.props.name )} </Typography> <Typography variant="subtitle2" className={classes.pos}> {Parser.SetVariableFormat(this.props.modifiedAt, "date")} </Typography> </CardContent> <CardActions className={classes.controls}> <AccessButton projectId={this.props.currentProjectId} serviceName={this.props.dockerName} exposedPorts={this.props.exposedPorts} /> {isAdmin ? ( <Button size="small" target="_blank" href={this.props.portainerLink} > MANAGE </Button> ) : ( false )} <DisplayCommandButton jsonObj={{ ...this.props.item }} /> <DisplayJsonButton jsonObj={{ ...this.props.item }} projName={this.props.name} /> <LogsButton project={this.props.currentProject} id={this.props.item.dockerId} type="service" /> <DeleteServiceButton project={this.props.currentProject} serviceName={this.props.dockerName} onServiceDeleted={this.props.onServiceDeleted} /> </CardActions> </div> <CardMedia className={classes.serviceImage} image={this.getIconFromName(this.props.name)} /> </Card> </Grid> ); } } class ServiceCards extends Component { render() { //const data = this.props.data; const { onServiceDeploy, data, isAdmin } = this.props; const colSize = 12 / data.length <= 3 ? 3 : 4; const oServiceCards = data .sort((a, b) => a.modifiedAt > b.modifiedAt ? -1 : b.modifiedAt > a.modifiedAt ? 1 : 0 // show newest services first ) .map(item => ( <ServiceCard colSize={colSize} currentProject={this.props.currentProject} currentProjectId={this.props.currentProjectId} onServiceDeleted={this.props.onServiceDeleted} classes={this.props.classes} key={item.name} name={item.name} modifiedAt={item.modifiedAt} id={item.id} endpoint={item.host} accessLink={ "/projects/" + this.props.currentProject + "/services/" + item.dockerName + "/8091/webui" } exposedPorts={item.exposedPorts} portainerLink={item.adminLink} dockerName={item.dockerName} item={item} isAdmin={isAdmin} /> )); return ( <div> <Grid container spacing={3}> {oServiceCards} </Grid> <Card className={this.props.classes.DeployServiceDialog}> <DeployServiceControl onServiceDeploy={onServiceDeploy} /> </Card> </div> ); } } ServiceCards.propTypes = { classes: PropTypes.object.isRequired, currentProject: PropTypes.string.isRequired, // from redux currentProjectId: PropTypes.string.isRequired, // from redux data: PropTypes.array.isRequired, onServiceDeploy: PropTypes.func.isRequired, onServiceDeleted: PropTypes.func.isRequired }; export default connect(ReduxUtils.mapStateToProps)( withStyles(styles)(ServiceCards) );
30.029268
108
0.582684
1027c6a95c51c6a5d2459aab2ea29c78ba9e7a30
2,772
js
JavaScript
resources/js/app.js
Sergggggg/Test_project
9309362590330195a213fd0a030cb1b78efe2d0e
[ "MIT" ]
null
null
null
resources/js/app.js
Sergggggg/Test_project
9309362590330195a213fd0a030cb1b78efe2d0e
[ "MIT" ]
null
null
null
resources/js/app.js
Sergggggg/Test_project
9309362590330195a213fd0a030cb1b78efe2d0e
[ "MIT" ]
null
null
null
/** * First we will load all of this project's JavaScript dependencies which * includes Vue and other libraries. It is a great starting point when * building robust, powerful web applications using Vue and Laravel. */ require('./bootstrap'); window.Vue = require('vue').default; /** * The following block of code may be used to automatically register your * Vue components. It will recursively scan this directory for the Vue * components and automatically register them with their "basename". * * Eg. ./components/ExampleComponent.vue -> <example-component></example-component> */ // const files = require.context('./', true, /\.vue$/i) // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default)) //Vue.component('example-component', require('./components/ExampleComponent.vue').default); /** * Next, we will create a fresh Vue application instance and attach it to * the page. Then, you may begin adding components to this application * or customize the JavaScript scaffolding to fit your unique needs. */ // const app = new Vue({ // el: '#app', // }); import Vue from 'vue' import * as VueGoogleMaps from 'vue2-google-maps' //import App from "./App"; import GoogleMap from "vue2-google-maps/dist/components/map.vue"; import GmapMap from 'vue2-google-maps/dist/components/map.vue' Vue.component('GmapMap', GmapMap) // Vue.use(VueGoogleMaps, { // load: { // key: '', // libraries: 'places', // } // }) //import * as VueGoogleMaps from 'vue2-google-maps'; Vue.use(VueGoogleMaps, { load: { key: '', libraries: 'places' }, installComponents: true //name: "GoogleMap", }); new Vue({ el: "#app", data() { return { // default to Montreal to keep it simple // change this to whatever makes sense center: { lat: 50.4547, lng: 30.5238 }, markers: [], places: [], currentPlace: null }; }, mounted() { this.geolocate(); }, methods: { // receives a place object via the autocomplete component setPlace(place) { this.currentPlace = place; }, addMarker() { if (this.currentPlace) { const marker = { lat: this.currentPlace.geometry.location.lat(), lng: this.currentPlace.geometry.location.lng() }; this.markers.push({ position: marker }); this.places.push(this.currentPlace); this.center = marker; this.currentPlace = null; } }, geolocate: function() { navigator.geolocation.getCurrentPosition(position => { this.center = { lat: position.coords.latitude, lng: position.coords.longitude }; }); } } //components: { App }, //template: "" });
23.294118
97
0.629509
1027ce4ae913b3b3f260206b56c83c6a4bfe7765
545
js
JavaScript
icons/SquareRootIcon.js
cyjake/material
eb0ee2393f200b544900d7360741ef760a6db48c
[ "MIT" ]
5
2018-11-21T09:41:06.000Z
2020-11-04T13:46:37.000Z
icons/SquareRootIcon.js
cyjake/material
eb0ee2393f200b544900d7360741ef760a6db48c
[ "MIT" ]
4
2019-03-06T13:41:48.000Z
2020-04-08T00:53:00.000Z
icons/SquareRootIcon.js
cyjake/material
eb0ee2393f200b544900d7360741ef760a6db48c
[ "MIT" ]
5
2020-04-07T22:11:38.000Z
2022-01-10T20:10:06.000Z
import React from 'react' const DEFAULT_SIZE = 24 export default ({ fill = 'currentColor', width = DEFAULT_SIZE, height = DEFAULT_SIZE, style = {}, ...props }) => ( <svg viewBox={ `0 0 ${ DEFAULT_SIZE } ${ DEFAULT_SIZE }` } style={{ fill, width, height, ...style }} { ...props } > <path d="M11.76,16.83L14.59,14L11.76,11.17L13.17,9.76L16,12.59L18.83,9.76L20.24,11.17L17.41,14L20.24,16.83L18.83,18.24L16,15.41L13.17,18.24L11.76,16.83M2,11H5V11H5L7.29,16.4L10,6H22V8H11.55L8.68,19H6.22L3.68,13H2V11Z" /> </svg> )
27.25
224
0.638532
1027d113f04a2d3720fef79e6bbd03efaa06569a
1,181
js
JavaScript
routes/api/category-routes.js
namees-github/E-Commerce-Back-End
0987230b27a76259bc514b45ef4f5a34a53477a4
[ "ADSL" ]
null
null
null
routes/api/category-routes.js
namees-github/E-Commerce-Back-End
0987230b27a76259bc514b45ef4f5a34a53477a4
[ "ADSL" ]
null
null
null
routes/api/category-routes.js
namees-github/E-Commerce-Back-End
0987230b27a76259bc514b45ef4f5a34a53477a4
[ "ADSL" ]
null
null
null
const router = require('express').Router(); const { Category, Product } = require('../../models'); // The `/api/categories` endpoint router.get('/', async(req, res) => { const result=await Category.findAll({ include:[{model:Product}]} ); try{ res.json(result) }catch(err){ res.status(404).json({status:'not found Namees'}) } }); router.get('/:id', async(req, res) => { const result=await Category.findByPk(req.params.id,{ include:[{model:Product}] }); try{ res.json(result) }catch(err){ res.status(404).send('not Found') } }); router.post('/',async (req, res) => { let category_name=req.body; const create=await Category.create(category_name) if(!category_name){ res.status(404).send('please enter category_name VALUE!!') } res.json(create) }); router.put('/:id', async(req, res) => { const category_nameU=req.body; const updateUser=await Category.update(req.body,{ where:{ id:req.params.id} }); res.send('UPDATED') }); router.delete('/:id', async(req, res) => { const Userdelete=await Category.destroy({ where:{ id:req.params.id } }) res.send('DELETED') }); module.exports = router;
19.048387
62
0.628281
10281c257a78d63e9e587d99d819009bd4f4123f
2,164
js
JavaScript
src -7-FormValidation/Products.js
aladin002dz/ReactJS-CRUD-Basic
e866e39f1c7ba9296e7301406a402badf7b75116
[ "MIT" ]
5
2019-01-09T20:50:36.000Z
2020-01-07T10:09:30.000Z
src -7-FormValidation/Products.js
aladin002dz/ReactJS-CRUD-Basic
e866e39f1c7ba9296e7301406a402badf7b75116
[ "MIT" ]
null
null
null
src -7-FormValidation/Products.js
aladin002dz/ReactJS-CRUD-Basic
e866e39f1c7ba9296e7301406a402badf7b75116
[ "MIT" ]
null
null
null
import React from 'react'; import Filters from './ProductsFilter.js'; import ProductTable from './ProductsTable.js'; import ProductForm from './ProductForm'; var PRODUCTS = { '1': {id: 1, category: 'Musical Instruments', price: '$459.99', stocked: true, name: 'Clarinet'}, '2': {id: 2, category: 'Musical Instruments', price: '$5,000', stocked: true, name: 'Harpsicord'}, '3': {id: 3, category: 'Musical Instruments', price: '$11,000', stocked: false, name: 'Fortepiano'}, '4': {id: 4, category: 'Furniture', price: '$799', stocked: true, name: 'Chaise Lounge'}, '5': {id: 5, category: 'Furniture', price: '$1,300', stocked: false, name: 'Dining Table'}, '6': {id: 6, category: 'Furniture', price: '$100', stocked: true, name: 'Bean Bag'} }; class Products extends React.Component { constructor(props) { super(props); this.state = { filterText: '', inStockOnly: false, products: PRODUCTS }; this.handleFilter = this.handleFilter.bind(this); this.handleDestroy = this.handleDestroy.bind(this); this.saveProduct = this.saveProduct.bind(this); } handleFilter(filterInput) { this.setState(filterInput); } saveProduct(product) { if (!product.id) { product.id = new Date().getTime(); } this.setState((prevState) => { let products = prevState.products; products[product.id] = product; return { products }; }); } handleDestroy(productId) { this.setState((prevState) => { let products = prevState.products; delete products[productId]; return { products }; }); } render() { return ( <div> <Filters filterText={this.state.filterText} inStockOnly={this.state.inStockOnly} onFilter={this.handleFilter} ></Filters> <ProductTable products={this.state.products} filterText={this.state.filterText} inStockOnly={this.state.inStockOnly} onDestroy={this.handleDestroy} ></ProductTable> <ProductForm onSave={this.saveProduct} ></ProductForm> </div> ); } } export default Products;
28.853333
102
0.61414
1028a5b9ada318398c84c2f2252b56dcf624d6f3
15,161
js
JavaScript
js/webxr-button.js
codeimpl/webxr-samples
ddcb40e3b86f01d481461b4c856808988fab9610
[ "MIT" ]
2
2019-07-08T18:56:48.000Z
2019-07-30T23:15:01.000Z
js/webxr-button.js
codeimpl/webxr-samples
ddcb40e3b86f01d481461b4c856808988fab9610
[ "MIT" ]
null
null
null
js/webxr-button.js
codeimpl/webxr-samples
ddcb40e3b86f01d481461b4c856808988fab9610
[ "MIT" ]
1
2018-09-14T14:04:52.000Z
2018-09-14T14:04:52.000Z
// Copyright 2016 Google Inc. // // 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. // This is a stripped down and specialized version of WebVR-UI // (https://github.com/googlevr/webvr-ui) that takes out most of the state // management in favor of providing a simple way of listing available devices // for the needs of the sample pages. Functionality like beginning sessions // is intentionally left out so that the sample pages can demonstrate them more // clearly. window.XRDeviceButton = (function () { // // State consts // // Not yet presenting, but ready to present const READY_TO_PRESENT = 'ready'; // In presentation mode const PRESENTING = 'presenting'; const PRESENTING_FULLSCREEN = 'presenting-fullscreen'; // Checking device availability const PREPARING = 'preparing'; // Errors const ERROR_NO_PRESENTABLE_DISPLAYS = 'error-no-presentable-displays'; const ERROR_BROWSER_NOT_SUPPORTED = 'error-browser-not-supported'; const ERROR_REQUEST_TO_PRESENT_REJECTED = 'error-request-to-present-rejected'; const ERROR_EXIT_PRESENT_REJECTED = 'error-exit-present-rejected'; const ERROR_REQUEST_STATE_CHANGE_REJECTED = 'error-request-state-change-rejected'; const ERROR_UNKOWN = 'error-unkown'; // // DOM element // const _LOGO_SCALE = 0.8; let _WEBXR_UI_CSS_INJECTED = {}; /** * Generate the innerHTML for the button * * @return {string} html of the button as string * @param {string} cssPrefix * @param {Number} height * @private */ const generateInnerHTML = (cssPrefix, height)=> { const logoHeight = height*_LOGO_SCALE; const svgString = generateXRIconString(cssPrefix, logoHeight) + generateNoXRIconString(cssPrefix, logoHeight); return `<button class="${cssPrefix}-button"> <div class="${cssPrefix}-title"></div> <div class="${cssPrefix}-logo" >${svgString}</div> </button>`; }; /** * Inject the CSS string to the head of the document * * @param {string} cssText the css to inject */ const injectCSS = (cssText)=> { // Create the css const style = document.createElement('style'); style.innerHTML = cssText; let head = document.getElementsByTagName('head')[0]; head.insertBefore(style, head.firstChild); }; /** * Generate DOM element view for button * * @return {HTMLElement} * @param {Object} options */ const createDefaultView = (options)=> { const fontSize = options.height / 3; if (options.injectCSS) { // Check that css isnt already injected if (!_WEBXR_UI_CSS_INJECTED[options.cssprefix]) { injectCSS(generateCSS(options, fontSize)); _WEBXR_UI_CSS_INJECTED[options.cssprefix] = true; } } const el = document.createElement('div'); el.innerHTML = generateInnerHTML(options.cssprefix, fontSize); return el.firstChild; }; const createXRIcon = (cssPrefix, height)=>{ const el = document.createElement('div'); el.innerHTML = generateXRIconString(cssPrefix, height); return el.firstChild; }; const createNoXRIcon = (cssPrefix, height)=>{ const el = document.createElement('div'); el.innerHTML = generateNoXRIconString(cssPrefix, height); return el.firstChild; }; const generateXRIconString = (cssPrefix, height)=> { let aspect = 28 / 18; return `<svg class="${cssPrefix}-svg" version="1.1" x="0px" y="0px" width="${aspect * height}px" height="${height}px" viewBox="0 0 28 18" xml:space="preserve"> <path d="M26.8,1.1C26.1,0.4,25.1,0,24.2,0H3.4c-1,0-1.7,0.4-2.4,1.1C0.3,1.7,0,2.7,0,3.6v10.7 c0,1,0.3,1.9,0.9,2.6C1.6,17.6,2.4,18,3.4,18h5c0.7,0,1.3-0.2,1.8-0.5c0.6-0.3,1-0.8,1.3-1.4l 1.5-2.6C13.2,13.1,13,13,14,13v0h-0.2 h0c0.3,0,0.7,0.1,0.8,0.5l1.4,2.6c0.3,0.6,0.8,1.1,1.3, 1.4c0.6,0.3,1.2,0.5,1.8,0.5h5c1,0,2-0.4,2.7-1.1c0.7-0.7,1.2-1.6,1.2-2.6 V3.6C28,2.7,27.5, 1.7,26.8,1.1z M7.4,11.8c-1.6,0-2.8-1.3-2.8-2.8c0-1.6,1.3-2.8,2.8-2.8c1.6,0,2.8,1.3,2.8,2.8 C10.2,10.5,8.9,11.8,7.4,11.8z M20.1,11.8c-1.6,0-2.8-1.3-2.8-2.8c0-1.6,1.3-2.8,2.8-2.8C21.7 ,6.2,23,7.4,23,9 C23,10.5,21.7,11.8,20.1,11.8z"/> </svg>`; }; const generateNoXRIconString = (cssPrefix, height)=>{ let aspect = 28 / 18; return `<svg class="${cssPrefix}-svg-error" x="0px" y="0px" width="${aspect * height}px" height="${aspect * height}px" viewBox="0 0 28 28" xml:space="preserve"> <path d="M17.6,13.4c0-0.2-0.1-0.4-0.1-0.6c0-1.6,1.3-2.8,2.8-2.8s2.8,1.3,2.8,2.8s-1.3,2.8-2.8,2.8 c-0.2,0-0.4,0-0.6-0.1l5.9,5.9c0.5-0.2,0.9-0.4,1.3-0.8 c0.7-0.7,1.1-1.6,1.1-2.5V7.4c0-1-0.4-1.9-1.1-2.5c-0.7-0.7-1.6-1-2.5-1 H8.1 L17.6,13.4z"/> <path d="M10.1,14.2c-0.5,0.9-1.4,1.4-2.4,1.4c-1.6,0-2.8-1.3-2.8-2.8c0-1.1,0.6-2,1.4-2.5 L0.9,5.1 C0.3,5.7,0,6.6,0,7.5v10.7c0,1,0.4,1.8,1.1,2.5c0.7,0.7,1.6,1,2.5,1 h5c0.7,0,1.3-0.1,1.8-0.5c0.6-0.3,1-0.8,1.3-1.4l1.3-2.6 L10.1,14.2z"/> <path d="M25.5,27.5l-25-25C-0.1,2-0.1,1,0.5,0.4l0,0C1-0.1,2-0.1,2.6,0.4l25,25c0.6,0.6,0.6,1.5 ,0,2.1l0,0 C27,28.1,26,28.1,25.5,27.5z"/> </svg>`; }; /** * Generate the CSS string to inject * * @param {Object} options * @param {Number} [fontSize=18] * @return {string} */ const generateCSS = (options, fontSize=18)=> { const height = options.height; const borderWidth = 2; const borderColor = options.background ? options.background : options.color; const cssPrefix = options.cssprefix; let borderRadius; if (options.corners == 'round') { borderRadius = options.height / 2; } else if (options.corners == 'square') { borderRadius = 2; } else { borderRadius = options.corners; } return (` @font-face { font-family: 'Karla'; font-style: normal; font-weight: 400; src: local('Karla'), local('Karla-Regular'), url(https://fonts.gstatic.com/s/karla/v5/31P4mP32i98D9CEnGyeX9Q.woff2) format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; } @font-face { font-family: 'Karla'; font-style: normal; font-weight: 400; src: local('Karla'), local('Karla-Regular'), url(https://fonts.gstatic.com/s/karla/v5/Zi_e6rBgGqv33BWF8WTq8g.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; } button.${cssPrefix}-button { font-family: 'Karla', sans-serif; border: ${borderColor} ${borderWidth}px solid; border-radius: ${borderRadius}px; box-sizing: border-box; background: ${options.background ? options.background : 'none'}; height: ${height}px; min-width: ${fontSize * 9.6}px; display: inline-block; position: relative; cursor: pointer; } button.${cssPrefix}-button:focus { outline: none; } /* * Logo */ .${cssPrefix}-logo { width: ${height}px; height: ${height}px; position: absolute; top:0px; left:0px; width: ${height - 4}px; height: ${height - 4}px; } .${cssPrefix}-svg { fill: ${options.color}; margin-top: ${(height - fontSize * _LOGO_SCALE) / 2 - 2}px; margin-left: ${height / 3 }px; } .${cssPrefix}-svg-error { fill: ${options.color}; display:none; margin-top: ${(height - 28 / 18 * fontSize * _LOGO_SCALE) / 2 - 2}px; margin-left: ${height / 3 }px; } /* * Title */ .${cssPrefix}-title { color: ${options.color}; position: relative; font-size: ${fontSize}px; padding-left: ${height * 1.05}px; padding-right: ${(borderRadius - 10 < 5) ? height / 3 : borderRadius - 10}px; } /* * disabled */ button.${cssPrefix}-button[disabled=true] { opacity: ${options.disabledOpacity}; } button.${cssPrefix}-button[disabled=true] > .${cssPrefix}-logo > .${cssPrefix}-svg { display:none; } button.${cssPrefix}-button[disabled=true] > .${cssPrefix}-logo > .${cssPrefix}-svg-error { display:initial; } `); }; // // Button class // class EnterXRButton { /** * Construct a new Enter XR Button * @constructor * @param {HTMLCanvasElement} sourceCanvas the canvas that you want to present with WebXR * @param {Object} [options] optional parameters * @param {HTMLElement} [options.domElement] provide your own domElement to bind to * @param {Boolean} [options.injectCSS=true] set to false if you want to write your own styles * @param {Function} [options.beforeEnter] should return a promise, opportunity to intercept request to enter * @param {Function} [options.beforeExit] should return a promise, opportunity to intercept request to exit * @param {Function} [options.onRequestStateChange] set to a function returning false to prevent default state changes * @param {string} [options.textEnterXRTitle] set the text for Enter XR * @param {string} [options.textXRNotFoundTitle] set the text for when a XR display is not found * @param {string} [options.textExitXRTitle] set the text for exiting XR * @param {string} [options.color] text and icon color * @param {string} [options.background] set to false for no brackground or a color * @param {string} [options.corners] set to 'round', 'square' or pixel value representing the corner radius * @param {string} [options.disabledOpacity] set opacity of button dom when disabled * @param {string} [options.cssprefix] set to change the css prefix from default 'webvr-ui' */ constructor(options) { options = options || {}; options.color = options.color || 'rgb(80,168,252)'; options.background = options.background || false; options.disabledOpacity = options.disabledOpacity || 0.5; options.height = options.height || 55; options.corners = options.corners || 'square'; options.cssprefix = options.cssprefix || 'webvr-ui'; // This reads VR as none of the samples are designed for other formats as of yet. options.textEnterXRTitle = options.textEnterXRTitle || 'ENTER VR'; options.textXRNotFoundTitle = options.textXRNotFoundTitle || 'VR NOT FOUND'; options.textExitXRTitle = options.textExitXRTitle || 'EXIT VR'; options.onRequestSession = options.onRequestSession || (function() {}); options.onEndSession = options.onEndSession || (function() {}); options.injectCSS = options.injectCSS !== false; this.options = options; this.device = null; this.session = null; // Pass in your own domElement if you really dont want to use ours this.domElement = options.domElement || createDefaultView(options); this.__defaultDisplayStyle = this.domElement.style.display || 'initial'; // Bind button click events to __onClick this.domElement.addEventListener('click', ()=> this.__onXRButtonClick()); this.__forceDisabled = false; this.__setDisabledAttribute(true); this.setTitle(this.options.textXRNotFoundTitle); } /** * Sets the XRDevice this button is associated with. * @param {XRDevice} device * @return {EnterXRButton} */ setDevice(device) { this.device = device; this.__updateButtonState(); return this; } /** * Indicate that there's an active XRSession. Switches the button to "Exit XR" * state if not null, or "Enter XR" state if null. * @param {XRSession} session * @return {EnterXRButton} */ setSession(session) { this.session = session; this.__updateButtonState(); return this; } /** * Set the title of the button * @param {string} text * @return {EnterXRButton} */ setTitle(text) { this.domElement.title = text; ifChild(this.domElement, this.options.cssprefix, 'title', (title)=> { if (!text) { title.style.display = 'none'; } else { title.innerText = text; title.style.display = 'initial'; } }); return this; } /** * Set the tooltip of the button * @param {string} tooltip * @return {EnterXRButton} */ setTooltip(tooltip) { this.domElement.title = tooltip; return this; } /** * Show the button * @return {EnterXRButton} */ show() { this.domElement.style.display = this.__defaultDisplayStyle; return this; } /** * Hide the button * @return {EnterXRButton} */ hide() { this.domElement.style.display = 'none'; return this; } /** * Enable the button * @return {EnterXRButton} */ enable() { this.__setDisabledAttribute(false); this.__forceDisabled = false; return this; } /** * Disable the button from being clicked * @return {EnterXRButton} */ disable() { this.__setDisabledAttribute(true); this.__forceDisabled = true; return this; } /** * clean up object for garbage collection */ remove() { if (this.domElement.parentElement) { this.domElement.parentElement.removeChild(this.domElement); } } /** * Set the disabled attribute * @param {boolean} disabled * @private */ __setDisabledAttribute(disabled) { if (disabled || this.__forceDisabled) { this.domElement.setAttribute('disabled', 'true'); } else { this.domElement.removeAttribute('disabled'); } } /** * Handling click event from button * @private */ __onXRButtonClick() { if (this.session) { this.options.onEndSession(this.session); } else if (this.device) { this.options.onRequestSession(this.device); } } /** * Updates the display of the button based on it's current state * @private */ __updateButtonState() { if (this.session) { this.setTitle(this.options.textExitXRTitle); this.setTooltip('Exit XR presentation'); this.__setDisabledAttribute(false); } else if (this.device) { this.setTitle(this.options.textEnterXRTitle); this.setTooltip('Enter XR'); this.__setDisabledAttribute(false); } else { this.setTitle(this.options.textXRNotFoundTitle); this.setTooltip('No XR headset found.'); this.__setDisabledAttribute(true); } } } /** * Function checking if a specific css class exists as child of element. * * @param {HTMLElement} el element to find child in * @param {string} cssPrefix css prefix of button * @param {string} suffix class name * @param {function} fn function to call if child is found * @private */ const ifChild = (el, cssPrefix, suffix, fn)=> { const c = el.querySelector('.' + cssPrefix + '-' + suffix); c && fn(c); }; return EnterXRButton; })();
31.00409
120
0.6429
1028a62f62a3df54db33a2e9e44377923e994871
879
js
JavaScript
src/CommandManager.js
kevelbreh/bottie-commands
c8605c2ed054a3cb559a5d6a389fe003f7076735
[ "Apache-2.0" ]
null
null
null
src/CommandManager.js
kevelbreh/bottie-commands
c8605c2ed054a3cb559a5d6a389fe003f7076735
[ "Apache-2.0" ]
null
null
null
src/CommandManager.js
kevelbreh/bottie-commands
c8605c2ed054a3cb559a5d6a389fe003f7076735
[ "Apache-2.0" ]
null
null
null
const Command = require("./Command"); /* TODO: Define a prefix (or list of prefixes) TODO: Prefix handling when a message is consumed. */ class CommandManager { constructor(options = {}) { this.commands = [] // Add a command for displaying information on help. if (options.allow_help == true) { } // Add a command for querying the usage of a specific command. if (options.allow_usage == true) { } } register(pattern, fn) { var cmd = new Command(pattern, fn); this.commands.push(cmd); return cmd; } register_command(cmd) { this.commands.push(cmd) return cmd; } consume(message, context={}) { this.commands.forEach(item => { var matches = item.re.exec(message); if (!matches) return; item.fn(matches.slice(1, matches.length), context); }); } } module.exports = CommandManager;
19.977273
66
0.629124
1028c41d998b285301d015a38cd298032e7c92d0
1,372
js
JavaScript
dist/samples/maptype-overlay/jsfiddle.js
caltrans/js-samples
a0e7fbfda8219feb97fa0a1d29732cf0d372211f
[ "Apache-2.0" ]
1
2021-06-19T10:45:59.000Z
2021-06-19T10:45:59.000Z
dist/samples/maptype-overlay/jsfiddle.js
gausic-m/js-samples
a1337dedd25fec0ebb5775fc90005aefed412d8e
[ "Apache-2.0" ]
1
2021-02-23T12:58:47.000Z
2021-02-23T12:58:47.000Z
dist/samples/maptype-overlay/jsfiddle.js
gausic-m/js-samples
a1337dedd25fec0ebb5775fc90005aefed412d8e
[ "Apache-2.0" ]
1
2021-05-12T00:21:04.000Z
2021-05-12T00:21:04.000Z
/* * This demo illustrates the coordinate system used to display map tiles in the * API. * * Tiles in Google Maps are numbered from the same origin as that for * pixels. For Google's implementation of the Mercator projection, the origin * tile is always at the northwest corner of the map, with x values increasing * from west to east and y values increasing from north to south. * * Try panning and zooming the map to see how the coordinates change. */ class CoordMapType { constructor(tileSize) { this.tileSize = tileSize; } getTile(coord, zoom, ownerDocument) { const div = ownerDocument.createElement("div"); div.innerHTML = String(coord); div.style.width = this.tileSize.width + "px"; div.style.height = this.tileSize.height + "px"; div.style.fontSize = "10"; div.style.borderStyle = "solid"; div.style.borderWidth = "1px"; div.style.borderColor = "#AAAAAA"; return div; } releaseTile(tile) {} } function initMap() { const map = new google.maps.Map(document.getElementById("map"), { zoom: 10, center: { lat: 41.85, lng: -87.65 }, }); // Insert this overlay map type as the first overlay map type at // position 0. Note that all overlay map types appear on top of // their parent base map. map.overlayMapTypes.insertAt( 0, new CoordMapType(new google.maps.Size(256, 256)) ); }
31.906977
79
0.687318
102985c3534c0c7bb2478aeee4a2125b7784252d
3,488
js
JavaScript
test/unit/specs/util/dom_spec.js
shaheen-karodia/vue
d8e9e2ea16153aacdc99a6cc36f7d121a5ab484c
[ "MIT" ]
1
2021-12-27T03:46:06.000Z
2021-12-27T03:46:06.000Z
test/unit/specs/util/dom_spec.js
shaheen-karodia/vue
d8e9e2ea16153aacdc99a6cc36f7d121a5ab484c
[ "MIT" ]
null
null
null
test/unit/specs/util/dom_spec.js
shaheen-karodia/vue
d8e9e2ea16153aacdc99a6cc36f7d121a5ab484c
[ "MIT" ]
null
null
null
var _ = require('../../../../src/util') if (_.inBrowser) { describe('Util - DOM', function () { var parent, child, target function div () { return document.createElement('div') } beforeEach(function () { parent = div() child = div() target = div() parent.appendChild(child) }) it('inDoc', function () { expect(_.inDoc(target)).toBe(false) document.body.appendChild(target) expect(_.inDoc(target)).toBe(true) document.body.removeChild(target) expect(_.inDoc(target)).toBe(false) }) it('attr', function () { target.setAttribute('v-test', 'ok') var val = _.attr(target, 'v-test') expect(val).toBe('ok') expect(target.hasAttribute('v-test')).toBe(false) }) it('before', function () { _.before(target, child) expect(target.parentNode).toBe(parent) expect(target.nextSibling).toBe(child) }) it('after', function () { _.after(target, child) expect(target.parentNode).toBe(parent) expect(child.nextSibling).toBe(target) }) it('after with sibling', function () { var sibling = div() parent.appendChild(sibling) _.after(target, child) expect(target.parentNode).toBe(parent) expect(child.nextSibling).toBe(target) }) it('remove', function () { _.remove(child) expect(child.parentNode).toBeNull() expect(parent.childNodes.length).toBe(0) }) it('prepend', function () { _.prepend(target, parent) expect(target.parentNode).toBe(parent) expect(parent.firstChild).toBe(target) }) it('prepend to empty node', function () { parent.removeChild(child) _.prepend(target, parent) expect(target.parentNode).toBe(parent) expect(parent.firstChild).toBe(target) }) it('replace', function () { _.replace(child, target) expect(parent.childNodes.length).toBe(1) expect(parent.firstChild).toBe(target) }) it('on/off', function () { // IE requires element to be in document to fire events document.body.appendChild(target) var spy = jasmine.createSpy() _.on(target, 'click', spy) var e = document.createEvent('HTMLEvents') e.initEvent('click', true, true) target.dispatchEvent(e) expect(spy.calls.count()).toBe(1) expect(spy).toHaveBeenCalledWith(e) _.off(target, 'click', spy) target.dispatchEvent(e) expect(spy.calls.count()).toBe(1) document.body.removeChild(target) }) it('addClass/removeClass', function () { var el = document.createElement('div') el.className = 'aa bb cc' _.removeClass(el, 'bb') expect(el.className).toBe('aa cc') _.removeClass(el, 'aa') expect(el.className).toBe('cc') _.addClass(el, 'bb') expect(el.className).toBe('cc bb') _.addClass(el, 'bb') expect(el.className).toBe('cc bb') }) it('addClass/removeClass for SVG/IE9', function () { var el = document.createElementNS('http://www.w3.org/2000/svg', 'circle') el.setAttribute('class', 'aa bb cc') _.removeClass(el, 'bb') expect(el.getAttribute('class')).toBe('aa cc') _.removeClass(el, 'aa') expect(el.getAttribute('class')).toBe('cc') _.addClass(el, 'bb') expect(el.getAttribute('class')).toBe('cc bb') _.addClass(el, 'bb') expect(el.getAttribute('class')).toBe('cc bb') }) }) }
28.357724
79
0.600057
10299c94066b669deda26fe1817b9d5578130471
5,363
js
JavaScript
lib/index.js
jrnewell/json-router
e46d37181c7489ca0596e7a97a23ffd78e62a240
[ "MIT" ]
1
2017-03-11T22:47:54.000Z
2017-03-11T22:47:54.000Z
lib/index.js
jrnewell/json-router
e46d37181c7489ca0596e7a97a23ffd78e62a240
[ "MIT" ]
null
null
null
lib/index.js
jrnewell/json-router
e46d37181c7489ca0596e7a97a23ffd78e62a240
[ "MIT" ]
null
null
null
var _ = require('lodash'); var async = require('async'); var EventEmitter = require('events').EventEmitter; var jsonRouter = { _requests: {}, _emitter: new EventEmitter(), _defaultCallback: function(req, res, results, next) { return res.json(results); }, getRequestHandler: function(name) { return this._requests[name]; }, newRequest: function(name, handler) { this._requests[name] = handler; }, middleware: function(opts, callback) { var _self = this; // special case were we don't include an opts, but do include a callback if (!_.isFunction(callback) && _.isFunction(opts)) { callback = opts; opts = {}; } // set default options opts = (_.isObject(opts) ? opts : {}); _.defaults(opts, {routeProperty: 'jsonRoute', flattenSingle: true, sendObject: true}); callback = (_.isFunction(callback) ? callback : _self._defaultCallback); // get options var routeProperty = opts.routeProperty; var flattenSingle = opts.flattenSingle; var sendObject = opts.sendObject; return function(httpReq, httpRes, next) { // if there is no 'jsonRoute' (routeProperty) parameter, then skip this middleware var requestList = httpReq.param(routeProperty); if (typeof requestList === 'undefined' || requestList === null) { return next(); } // request instance variables var depMap = {}; var requestOrder = []; var results = {}; var reqUtils = require('./request').init(_self, depMap, requestOrder); var contextUtils = require('./context').init(reqUtils, depMap); // create context obj var context = contextUtils.newContext(_self, httpReq, httpRes); var routeRequest = function(req, callback) { // skip request if (req._skip) { reqUtils.updateStatus(req, "cancelled"); if (!req._error) req._error = "Request skipped"; return callback(null, req); } var reqName = req.name; if (typeof reqName === 'undefined' || reqName === null) { return callback(new Error("missing 'name' property for request")); } context.request = req; if (req.dependsOn && req._parent) { context.dependsOn = req.dependsOn; if (req._parent._result) context.parentResult = req._parent._result; } context.requestId = req.requestId; context.name = reqName; var reqMapping = _self._requests[reqName]; if (typeof reqMapping === 'undefined' || reqMapping === null) { return callback(new Error("missing request " + reqName)); } var reqArgs = req.arguments; if (typeof reqArgs === 'undefined' || reqArgs === null) { reqArgs = []; } else if (!_.isArray(reqArgs)) { reqArgs = [ reqArgs ]; } reqUtils.updateStatus(req, "running"); reqMapping(context, reqArgs, function(err, result) { // attach result object reqUtils.updateStatus(req, "finished"); req._result = result; if (err) req._error = err.toString(); callback(null, req); }); }; // make sure we are dealing with arrays if (!_.isArray(requestList)) { if (_.isObject(requestList)) { var keys = _.keys(requestList); // do we have a single request or literal notation? if (!requestList.name) { requestList = _.transform(requestList, function(result, req, key) { req.requestId = key; if (!req.name) req.name = key; result.push(req); }, []); } else { requestList = [ requestList ]; } } else { // don't know what type this is return next(new Error(routeProperty + " needs to be an array or object")); } } // init and create dependency tree, job queue reqUtils.initRequestList(requestList); // do actual requests var doRequest = function(reqArray, callback) { contextUtils.incReqOrderIdx(); async.map(reqArray, routeRequest, function(err, requests) { if (err) return callback(err); // check for any errors, disable any children on error _.each(requests, function(req) { if (reqUtils.anyDeps && req._error && !req._skip) { reqUtils.cancelDependencies(req, "Request skipped due to failed dependency"); } var resObj = { requestId: req.requestId }; if (req._result) resObj.result = req._result; if (req._error) resObj.error = req._error; results[resObj.requestId] = resObj; }); callback(null); }); }; async.each(requestOrder, doRequest, function(err) { if (err) return next(err); if (flattenSingle) { var keys = _.keys(results); if (keys.length === 1) results = results[keys[0]]; } if (!sendObject) { results = _.values(results); } return callback(httpReq, httpRes, results, next); }); }; } }; _.each(['addListener', 'on', 'once', 'emit'], function(func) { jsonRouter[func] = jsonRouter._emitter[func]; }); module.exports = jsonRouter;
31.733728
91
0.575611
10299f87286f1e29e8374591167a721e022fc500
497
js
JavaScript
dist/decorator/index.js
CaoMeiYouRen/swagger-ts-doc
a5e605992c90352877f28678d2f04eddfb0eb300
[ "Apache-2.0" ]
null
null
null
dist/decorator/index.js
CaoMeiYouRen/swagger-ts-doc
a5e605992c90352877f28678d2f04eddfb0eb300
[ "Apache-2.0" ]
null
null
null
dist/decorator/index.js
CaoMeiYouRen/swagger-ts-doc
a5e605992c90352877f28678d2f04eddfb0eb300
[ "Apache-2.0" ]
null
null
null
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.log = exports.apiModelProperty = void 0; const apiModelProperty_1 = require("./apiModelProperty"); Object.defineProperty(exports, "apiModelProperty", { enumerable: true, get: function () { return apiModelProperty_1.apiModelProperty; } }); const log_1 = require("./log"); Object.defineProperty(exports, "log", { enumerable: true, get: function () { return log_1.log; } }); //# sourceMappingURL=index.js.map
62.125
140
0.72837
1029e43471f2835bc9fbcd4f6ea7d3e99e6d2373
4,101
js
JavaScript
app/models/groups.js
rexming1999/ASP-Portel
278db2faeed3e01c801f188d384c0d1745dfc8ea
[ "Apache-2.0" ]
null
null
null
app/models/groups.js
rexming1999/ASP-Portel
278db2faeed3e01c801f188d384c0d1745dfc8ea
[ "Apache-2.0" ]
null
null
null
app/models/groups.js
rexming1999/ASP-Portel
278db2faeed3e01c801f188d384c0d1745dfc8ea
[ "Apache-2.0" ]
null
null
null
exports.definition = { config: { columns: { id: "INTEGER PRIMARY KEY", name: "TEXT", u_id: "INTEGER", status: "INTEGER", created: "DATE", updated: "DATE", image: "TEXT" }, adapter: { type: "sql", collection_name: "groups" } }, extendModel: function(Model) { _.extend(Model.prototype, { // extended functions and properties go here }); return Model; }, extendCollection: function(Collection) { _.extend(Collection.prototype, { // extended functions and properties go here addColumn : function( newFieldName, colSpec) { var collection = this; var db = Ti.Database.open(collection.config.adapter.db_name); if(Ti.Platform.osname != "android"){ db.file.setRemoteBackup(false); } var fieldExists = false; resultSet = db.execute('PRAGMA TABLE_INFO(' + collection.config.adapter.collection_name + ')'); while (resultSet.isValidRow()) { if(resultSet.field(1)==newFieldName) { fieldExists = true; } resultSet.next(); } if(!fieldExists) { db.execute('ALTER TABLE ' + collection.config.adapter.collection_name + ' ADD COLUMN '+newFieldName + ' ' + colSpec); } db.close(); }, saveArray:function(arr){ var collection = this; var columns = collection.config.columns; var names = []; for (var k in columns) { names.push(k); } db = Ti.Database.open(collection.config.adapter.db_name); if(Ti.Platform.osname != "android"){ db.file.setRemoteBackup(false); } db.execute("BEGIN"); console.log("group:"+JSON.stringify(arr)); arr.forEach(function(entry) { var keys = []; var questionmark = []; var eval_values = []; var update_questionmark = []; var update_value = []; for(var k in entry){ if (entry.hasOwnProperty(k)){ _.find(names, function(name){ if(name == k){ keys.push(k); questionmark.push("?"); eval_values.push("entry."+k); update_questionmark.push(k+"=?"); } }); } } var without_pk_list = _.rest(update_questionmark); var without_pk_value = _.rest(eval_values); var sql_query = "INSERT OR REPLACE INTO "+collection.config.adapter.collection_name+" ("+keys.join()+") VALUES ("+questionmark.join()+")"; eval("db.execute(sql_query, "+eval_values.join()+")"); }); db.execute("COMMIT"); //console.log(db.getRowsAffected()+" affected row"); db.close(); collection.trigger('sync'); }, getData: function(g_id,unlimit,offset){ var collection = this; var columns = collection.config.columns; var names = []; for (var k in columns) { names.push(k); } offset = offset || 0; var sql_limit = (unlimit)?"":" limit "+offset+",10"; var collection = this; var sql = "select * from " + collection.config.adapter.collection_name + " WHERE id=" + g_id; db = Ti.Database.open(collection.config.adapter.db_name); if(Ti.Platform.osname != "android"){ db.file.setRemoteBackup(false); } var res = db.execute(sql); var arr = []; var count = 0; var eval_column = ""; for (var i=0; i < names.length; i++) { eval_column = eval_column+names[i]+": res.fieldByName('"+names[i]+"'),"; }; while (res.isValidRow()){ eval("arr[count] = {"+eval_column+"}"); res.next(); count++; } res.close(); db.close(); collection.trigger('sync'); return arr; }, }); return Collection; } };
32.547619
156
0.513533
102a4af50ee49dff0b754a75db3a5de47660e5f5
7,354
js
JavaScript
src/core/propertyTypes.js
demo3d/aframe
3ba5eda3d9ea2c253fc481e92ecd78b22815c81d
[ "MIT" ]
1
2018-01-02T02:27:35.000Z
2018-01-02T02:27:35.000Z
src/core/propertyTypes.js
sshepanski7/aframe
93d4c9ea5539368c75f21cdd18cde70931cbcacc
[ "MIT" ]
null
null
null
src/core/propertyTypes.js
sshepanski7/aframe
93d4c9ea5539368c75f21cdd18cde70931cbcacc
[ "MIT" ]
1
2019-12-15T08:50:14.000Z
2019-12-15T08:50:14.000Z
var coordinates = require('../utils/coordinates'); var debug = require('debug'); var error = debug('core:propertyTypes:warn'); var warn = debug('core:propertyTypes:warn'); var propertyTypes = module.exports.propertyTypes = {}; // Built-in property types. registerPropertyType('audio', '', assetParse); registerPropertyType('array', [], arrayParse, arrayStringify); registerPropertyType('asset', '', assetParse); registerPropertyType('boolean', false, boolParse); registerPropertyType('color', '#FFF', defaultParse, defaultStringify); registerPropertyType('int', 0, intParse); registerPropertyType('number', 0, numberParse); registerPropertyType('map', '', assetParse); registerPropertyType('model', '', assetParse); registerPropertyType('selector', '', selectorParse, selectorStringify); registerPropertyType('selectorAll', '', selectorAllParse, selectorAllStringify); registerPropertyType('src', '', srcParse); registerPropertyType('string', '', defaultParse, defaultStringify); registerPropertyType('time', 0, intParse); registerPropertyType('vec2', {x: 0, y: 0}, vecParse, coordinates.stringify); registerPropertyType('vec3', {x: 0, y: 0, z: 0}, vecParse, coordinates.stringify); registerPropertyType('vec4', {x: 0, y: 0, z: 0, w: 0}, vecParse, coordinates.stringify); /** * Register a parser for re-use such that when someone uses `type` in the schema, * `schema.process` will set the property `parse` and `stringify`. * * @param {string} type - Type name. * @param [defaultValue=null] - * Default value to use if component does not define default value. * @param {function} [parse=defaultParse] - Parse string function. * @param {function} [stringify=defaultStringify] - Stringify to DOM function. */ function registerPropertyType (type, defaultValue, parse, stringify) { if ('type' in propertyTypes) { error('Property type ' + type + ' is already registered.'); return; } propertyTypes[type] = { default: defaultValue, parse: parse || defaultParse, stringify: stringify || defaultStringify }; } module.exports.registerPropertyType = registerPropertyType; function arrayParse (value) { if (Array.isArray(value)) { return value; } if (!value || typeof value !== 'string') { return []; } return value.split(',').map(trim); function trim (str) { return str.trim(); } } function arrayStringify (value) { return value.join(', '); } /** * For general assets. * * @param {string} value - Can either be `url(<value>)`, an ID selector to an asset, or * just string. * @returns {string} Parsed value from `url(<value>)`, src from `<someasset src>`, or * just string. */ function assetParse (value) { var el; var parsedUrl; // If an element was provided (e.g. canvas or video), just return it. if (typeof value !== 'string') { return value; } // Wrapped `url()` in case of data URI. parsedUrl = value.match(/\url\((.+)\)/); if (parsedUrl) { return parsedUrl[1]; } // ID. if (value.charAt(0) === '#') { el = document.getElementById(value.substring(1)); if (el) { // Pass through media elements. If we have the elements, we don't have to call // three.js loaders which would re-request the assets. if (el.tagName === 'CANVAS' || el.tagName === 'VIDEO' || el.tagName === 'IMG') { return el; } return el.getAttribute('src'); } warn('"' + value + '" asset not found.'); return; } // Non-wrapped url(). return value; } function defaultParse (value) { return value; } function defaultStringify (value) { if (value === null) { return 'null'; } return value.toString(); } function boolParse (value) { return value !== 'false' && value !== false; } function intParse (value) { return parseInt(value, 10); } function numberParse (value) { return parseFloat(value, 10); } function selectorParse (value) { if (!value) { return null; } if (typeof value !== 'string') { return value; } return document.querySelector(value); } function selectorAllParse (value) { if (!value) { return null; } if (typeof value !== 'string') { return value; } return Array.prototype.slice.call(document.querySelectorAll(value), 0); } function selectorStringify (value) { if (value.getAttribute) { return '#' + value.getAttribute('id'); } return defaultStringify(value); } function selectorAllStringify (value) { if (value instanceof Array) { return value.map(function (element) { return '#' + element.getAttribute('id'); }).join(', '); } return defaultStringify(value); } function srcParse (value) { warn('`src` property type is deprecated. Use `asset` instead.'); return assetParse(value); } function vecParse (value) { return coordinates.parse(value, this.default); } /** * Validate the default values in a schema to match their type. * * @param {string} type - Property type name. * @param defaultVal - Property type default value. * @returns {boolean} Whether default value is accurate given the type. */ function isValidDefaultValue (type, defaultVal) { if (type === 'audio' && typeof defaultVal !== 'string') { return false; } if (type === 'array' && !Array.isArray(defaultVal)) { return false; } if (type === 'asset' && typeof defaultVal !== 'string') { return false; } if (type === 'boolean' && typeof defaultVal !== 'boolean') { return false; } if (type === 'color' && typeof defaultVal !== 'string') { return false; } if (type === 'int' && typeof defaultVal !== 'number') { return false; } if (type === 'number' && typeof defaultVal !== 'number') { return false; } if (type === 'map' && typeof defaultVal !== 'string') { return false; } if (type === 'model' && typeof defaultVal !== 'string') { return false; } if (type === 'selector' && typeof defaultVal !== 'string') { return false; } if (type === 'selectorAll' && typeof defaultVal !== 'string') { return false; } if (type === 'src' && typeof defaultVal !== 'string') { return false; } if (type === 'string' && typeof defaultVal !== 'string') { return false; } if (type === 'time' && typeof defaultVal !== 'number') { return false; } if (type === 'vec2') { return isValidDefaultCoordinate(defaultVal, 2); } if (type === 'vec3') { return isValidDefaultCoordinate(defaultVal, 3); } if (type === 'vec4') { return isValidDefaultCoordinate(defaultVal, 4); } return true; } module.exports.isValidDefaultValue = isValidDefaultValue; /** * Checks if default coordinates are valid. * * @param possibleCoordinates * @param {number} dimensions - 2 for 2D Vector, 3 for 3D vector. * @returns {boolean} Whether coordinates are parsed correctly. */ function isValidDefaultCoordinate (possibleCoordinates, dimensions) { if (possibleCoordinates === null) { return true; } if (typeof possibleCoordinates !== 'object') { return false; } if (Object.keys(possibleCoordinates).length !== dimensions) { return false; } else { var x = possibleCoordinates.x; var y = possibleCoordinates.y; var z = possibleCoordinates.z; var w = possibleCoordinates.w; if (typeof x !== 'number' || typeof y !== 'number') { return false; } if (dimensions > 2 && typeof z !== 'number') { return false; } if (dimensions > 3 && typeof w !== 'number') { return false; } } return true; } module.exports.isValidDefaultCoordinate = isValidDefaultCoordinate;
34.204651
88
0.667256
102ad2b71fcd8f083d4daf5a54748bfead84ed5d
2,311
js
JavaScript
vant/common/utils.js
CryFeiFei/WeComponents
10da8e034b883bb16597722d516133fa823c6996
[ "Apache-2.0" ]
null
null
null
vant/common/utils.js
CryFeiFei/WeComponents
10da8e034b883bb16597722d516133fa823c6996
[ "Apache-2.0" ]
null
null
null
vant/common/utils.js
CryFeiFei/WeComponents
10da8e034b883bb16597722d516133fa823c6996
[ "Apache-2.0" ]
null
null
null
import { isDef, isNumber, isPlainObject, isPromise } from './validator'; import { canIUseGroupSetData, canIUseNextTick } from './version'; export function range(num, min, max) { return Math.min(Math.max(num, min), max); } export function nextTick(cb) { if (canIUseNextTick()) { wx.nextTick(cb); } else { setTimeout(() => { cb(); }, 1000 / 30); } } let systemInfo; export function getSystemInfoSync() { if (systemInfo == null) { systemInfo = wx.getSystemInfoSync(); } return systemInfo; } export function addUnit(value) { if (!isDef(value)) { return undefined; } value = String(value); return isNumber(value) ? `${value}px` : value; } export function requestAnimationFrame(cb) { const systemInfo = getSystemInfoSync(); if (systemInfo.platform === 'devtools') { return setTimeout(() => { cb(); }, 1000 / 30); } return wx .createSelectorQuery() .selectViewport() .boundingClientRect() .exec(() => { cb(); }); } export function pickExclude(obj, keys) { if (!isPlainObject(obj)) { return {}; } return Object.keys(obj).reduce((prev, key) => { if (!keys.includes(key)) { prev[key] = obj[key]; } return prev; }, {}); } export function getRect(context, selector) { return new Promise((resolve) => { wx.createSelectorQuery() .in(context) .select(selector) .boundingClientRect() .exec((rect = []) => resolve(rect[0])); }); } export function getAllRect(context, selector) { return new Promise((resolve) => { wx.createSelectorQuery() .in(context) .selectAll(selector) .boundingClientRect() .exec((rect = []) => resolve(rect[0])); }); } export function groupSetData(context, cb) { if (canIUseGroupSetData()) { context.groupSetData(cb); } else { cb(); } } export function toPromise(promiseLike) { if (isPromise(promiseLike)) { return promiseLike; } return Promise.resolve(promiseLike); } export function getCurrentPage() { const pages = getCurrentPages(); return pages[pages.length - 1]; }
25.119565
72
0.565556
102b308f2567535e06933805146dfd14d02c83cf
1,268
js
JavaScript
src/core_modules/capture-core/components/Pages/NewEvent/epics/newEvent.epics.js
karolinelien/capture-app
717eafd38d10450a661445dfc59fc5270ff12d6a
[ "BSD-2-Clause" ]
null
null
null
src/core_modules/capture-core/components/Pages/NewEvent/epics/newEvent.epics.js
karolinelien/capture-app
717eafd38d10450a661445dfc59fc5270ff12d6a
[ "BSD-2-Clause" ]
null
null
null
src/core_modules/capture-core/components/Pages/NewEvent/epics/newEvent.epics.js
karolinelien/capture-app
717eafd38d10450a661445dfc59fc5270ff12d6a
[ "BSD-2-Clause" ]
null
null
null
// @flow import { push } from 'connected-react-router'; import { actionTypes as editEventSelectorActionTypes, } from '../../EditEvent/EditEventSelector/EditEventSelector.actions'; import { actionTypes as viewEventSelectorActionTypes, } from '../../ViewEvent/ViewEventSelector/ViewEventSelector.actions'; import { actionTypes as mainPageSelectorActionTypes } from '../../MainPage/MainPageSelector/MainPageSelector.actions'; const getArguments = (programId: string, orgUnitId: string) => { const argArray = []; if (programId) { argArray.push(`programId=${programId}`); } if (orgUnitId) { argArray.push(`orgUnitId=${orgUnitId}`); } return argArray.join('&'); }; export const openNewEventPageLocationChangeEpic = (action$: InputObservable, store: ReduxStore) => // $FlowSuppress action$.ofType( editEventSelectorActionTypes.OPEN_NEW_EVENT, viewEventSelectorActionTypes.OPEN_NEW_EVENT, mainPageSelectorActionTypes.OPEN_NEW_EVENT, ) .map(() => { const state = store.getState(); const { programId, orgUnitId } = state.currentSelections; const args = getArguments(programId, orgUnitId); return push(`/newEvent/${args}`); });
35.222222
118
0.677445
102b6917bb9b3482eb70c57bdb0b7aa721df9510
1,588
js
JavaScript
client/components/Forms/index.js
jjpestacio/whos-djing
1f6ce5f19e38b2aac886ca600c5564153691d2b4
[ "MIT" ]
null
null
null
client/components/Forms/index.js
jjpestacio/whos-djing
1f6ce5f19e38b2aac886ca600c5564153691d2b4
[ "MIT" ]
null
null
null
client/components/Forms/index.js
jjpestacio/whos-djing
1f6ce5f19e38b2aac886ca600c5564153691d2b4
[ "MIT" ]
null
null
null
import React, { Component, PropTypes } from 'react' import Radium from 'radium' @Radium class InputForm extends Component { constructor(props) { super(props); this.state = { value: '' } this.handleTextChange = this.handleTextChange.bind(this); this.handleSubmit = this.handleSubmit.bind(this); } handleSubmit(e) { const { minLength, submit } = this.props; const { value } = this.state; e.preventDefault(); if (minLength && value.length < minLength) { alert('Must be atleast ' + minLength + 'characters'); return; } submit(value); this.setState({ value: '' }); } handleTextChange(e) { const { maxLength } = this.props; // Don't let user type more characters than maxLength if (maxLength && e.target.value.length > maxLength) return; this.setState({ value: e.target.value }); } render() { const { value } = this.state; const { buttonText, buttonStyle, inputStyle, placeHolder } = this.props; return ( <form className='commentForm' onSubmit={this.handleSubmit}> <input autoComplete='off' style={inputStyle} type='text' name='text' placeholder={placeHolder} value={value} onChange={this.handleTextChange} /> <button key={buttonText} style={buttonStyle} type='submit'> {buttonText} </button> </form> ) } } InputForm.propTypes = { buttonText: PropTypes.string.isRequired, maxLength: PropTypes.number, placeHolder: PropTypes.string.isRequired, buttonText: PropTypes.string.isRequired, submit: PropTypes.func.isRequired } export default InputForm
22.055556
74
0.671914
102c722fd3d233f869ccfe3a253d3c2d35059692
181
js
JavaScript
packages/discord.js/src/util/ShardEvents.js
bryanberger/discord.js
cedd0536baa1301984daf89dfda4e63a7be595a2
[ "Apache-2.0" ]
7
2022-02-27T14:25:38.000Z
2022-03-30T10:41:54.000Z
packages/discord.js/src/util/ShardEvents.js
bryanberger/discord.js
cedd0536baa1301984daf89dfda4e63a7be595a2
[ "Apache-2.0" ]
2
2022-03-20T10:51:54.000Z
2022-03-20T10:51:55.000Z
packages/discord.js/src/util/ShardEvents.js
bryanberger/discord.js
cedd0536baa1301984daf89dfda4e63a7be595a2
[ "Apache-2.0" ]
1
2022-02-17T03:58:07.000Z
2022-02-17T03:58:07.000Z
'use strict'; module.exports = { Close: 'close', Destroyed: 'destroyed', InvalidSession: 'invalidSession', Ready: 'ready', Resumed: 'resumed', AllReady: 'allReady', };
16.454545
35
0.651934
102c83a09942a307763f6e7d58d849d786bec146
199
js
JavaScript
test/fixtures/percy-web/addon-tree-output/ember-font-awesome/utils/try-match.js
kellyselden/ember-cli-dependency-graph
3dccbd6efe24819d9cb32e7e488e3fc672c6e118
[ "MIT" ]
4
2017-11-30T01:12:20.000Z
2019-02-24T07:14:45.000Z
test/fixtures/code-corps-ember/addon-tree-output/ember-font-awesome/utils/try-match.js
kellyselden/ember-cli-dependency-graph
3dccbd6efe24819d9cb32e7e488e3fc672c6e118
[ "MIT" ]
8
2017-12-07T01:01:47.000Z
2018-12-24T11:59:40.000Z
test/fixtures/percy-web/addon-tree-output/ember-font-awesome/utils/try-match.js
kellyselden/ember-cli-dependency-graph
3dccbd6efe24819d9cb32e7e488e3fc672c6e118
[ "MIT" ]
2
2017-11-28T05:56:29.000Z
2018-02-28T21:22:32.000Z
define('ember-font-awesome/utils/try-match', ['exports'], function (exports) { exports['default'] = function (object, regex) { return typeof object === 'string' && object.match(regex); }; });
39.8
78
0.653266
102ca5a52947bf7ba6642026b37bd4ef70897d3b
293
js
JavaScript
src/js/common.js
igorok-by/Take-App
7d0deb62e90ed5507ad4fc91835d07e5340c1360
[ "MIT" ]
null
null
null
src/js/common.js
igorok-by/Take-App
7d0deb62e90ed5507ad4fc91835d07e5340c1360
[ "MIT" ]
1
2021-03-09T01:51:21.000Z
2021-03-09T01:51:21.000Z
src/js/common.js
igorok-by/Antirab
75358020709d51e6cf44321be7ad1fd0dce16a25
[ "MIT" ]
null
null
null
; let menuLink = document.getElementById('menuLink'); let navBar = document.getElementById('navBar'); menuLink.addEventListener('click', function() { menuLink.classList.toggle('menu-link--active'); navBar.classList.toggle('navbar'); navBar.classList.toggle('navbar--active'); });
29.3
51
0.723549
102d6aad11fec02fd5aeaec0c692a4797eb4cacd
1,613
js
JavaScript
src/pages/index.js
Al-Amin-Rahul/alaminrahul.github.io
b83f3495653d8c40d3341fa78a3e18eb8a0b75c1
[ "MIT" ]
null
null
null
src/pages/index.js
Al-Amin-Rahul/alaminrahul.github.io
b83f3495653d8c40d3341fa78a3e18eb8a0b75c1
[ "MIT" ]
null
null
null
src/pages/index.js
Al-Amin-Rahul/alaminrahul.github.io
b83f3495653d8c40d3341fa78a3e18eb8a0b75c1
[ "MIT" ]
null
null
null
import React, { Component } from "react" import Layout from "../components/layout" class IndexPage extends Component{ render(){ return( <Layout> <section className="banner"> <div className="container-fluid"> <div className="row"> <img src={'/img/me.JPG'} className="img-fluid"></img> </div> </div> </section> <section className="sec-some-words pt-5 pb-5"> <div className="container"> <div className="row"> <div className="col-lg-8"> <h2>Lorem Ipsum is simply dummy text of the printing and typesetting industry</h2> <span className="text-justify">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</span><br/><br/> <a href="#" className="blue-btn text-decoration-none">My Work</a> </div> <div className="col-lg-4"> <img src={'/img/me.JPG'} className="img-fluid"></img> </div> </div> </div> </section> </Layout> ) } } export default IndexPage
44.805556
325
0.464352
102df34a2f0d784b817195fd7bfd24d8740c7977
2,072
js
JavaScript
src/pages/404.js
andreybond79/eliasbarber-template
9f26b692b51611681a7bd420424e6f5f2eb8d92d
[ "MIT" ]
null
null
null
src/pages/404.js
andreybond79/eliasbarber-template
9f26b692b51611681a7bd420424e6f5f2eb8d92d
[ "MIT" ]
null
null
null
src/pages/404.js
andreybond79/eliasbarber-template
9f26b692b51611681a7bd420424e6f5f2eb8d92d
[ "MIT" ]
null
null
null
import React, { useContext } from "react" import Layout from "../components/Layout" import Seo from "../components/Seo" import { graphql } from "gatsby" import { StaticImage } from "gatsby-plugin-image" import PideCita from "../components/PideCita" import { Link, useTranslation, I18nextContext, } from "gatsby-plugin-react-i18next" const PageIsNotFound = () => { const { t } = useTranslation() const { language } = useContext(I18nextContext) return ( <Layout> <Seo lang={language} title={t("PAGE NO FOUND")} /> <PideCita phrase={t("EL LUGAR PARA CAMBIAR DE IMAGEN")} id="my-cool-header" /> <div className="z-50 block md:hidden sticky top-12 shadow-lg bg-secondary"> <Link to="/pidecita#pidecita"> <button className="sticky top-0 bg-red-600 hover:bg-red-500 h-20 text-3xl shadow-md text-gray-900 min-w-full font-oswald uppercase m-0 transition delay-75 duration-300 ease-in-out"> {t("PIDE CITA")} </button> </Link> </div> <div className="grid4 bg-indigo text-center"> <div className="col-span-2 p-5 lg:p-10 xl:p-16 flex justify-center"> <StaticImage src="../images/scull.png" formats={["AUTO", "WEBP", "AVIF"]} width={200} loading="lazy" alt="Elias Barber Barcelona" draggable="false" /> </div> <div className="col-span-2 flex"> <p className="leading-normal font-spartan text-white text-xl md:text-2xl uppercase self-center"> <span className="text-red-700 font-semibold"> ERROR 404 <br /> </span> <br /> {t("PAGE NO FOUND")} </p> </div> </div> </Layout> ) } export default PageIsNotFound export const query = graphql` query($language: String!) { locales: allLocale(filter: { language: { eq: $language } }) { edges { node { ns data language } } } } `
28.777778
191
0.563707
102e6f3fcfc222e298806b085898ee8a198f206c
3,374
js
JavaScript
servicecode/commands/AwaitCodeRedirect.js
luciany/cloudrail-si-node-sdk
1f41e693372f2bd517e9e59089f346cf52036052
[ "ADSL" ]
2
2019-10-03T21:21:03.000Z
2019-10-03T23:38:46.000Z
servicecode/commands/AwaitCodeRedirect.js
samiravelar/cloudrail-si-node-sdk
d3c4bd2d830f5d4b65f11d4cbf56e9983ed6561a
[ "ADSL" ]
null
null
null
servicecode/commands/AwaitCodeRedirect.js
samiravelar/cloudrail-si-node-sdk
d3c4bd2d830f5d4b65f11d4cbf56e9983ed6561a
[ "ADSL" ]
null
null
null
"use strict"; var Helper_1 = require("../../helpers/Helper"); var VarAddress_1 = require("../VarAddress"); var UserError_1 = require("../../errors/UserError"); var url = require("url"); var Promise = require("bluebird"); var Settings_1 = require("../../Settings"); var CHECK_URL = "https://developers.cloudrail.com/api/misc/check-license/"; var TIMEOUT = 500; var AwaitCodeRedirect = (function () { function AwaitCodeRedirect() { } AwaitCodeRedirect.prototype.getIdentifier = function () { return "awaitCodeRedirect"; }; AwaitCodeRedirect.prototype.execute = function (environment, parameters) { var enoughParameters = parameters.length >= 2; var returnIsVariable = parameters[0] instanceof VarAddress_1.VarAddress; var inputIsStringOrVariable = Helper_1.Helper.isString(parameters[1]) || parameters[1] instanceof VarAddress_1.VarAddress; Helper_1.Helper.assert(enoughParameters && returnIsVariable && inputIsStringOrVariable); var resVar = parameters[0]; var urlStr = Helper_1.Helper.resolve(environment, parameters[1]); var legacy = false; var keys = []; if (parameters.length >= 3 && parameters[2]) { keys = Helper_1.Helper.resolve(environment, parameters[2]); } else { keys.push("code"); legacy = true; } var redirectReceiver = environment.instanceDependencyStorage["redirectReceiver"]; if (!redirectReceiver || typeof redirectReceiver !== "function") { throw new UserError_1.UserError("This service needs the RedirectReceiver to be implemented as a function. Have a look at our examples and documentation if you are unsure how to do that."); } return Helper_1.Helper.makeRequest(CHECK_URL + Settings_1.Settings.licenseKey, null, null, "GET", TIMEOUT).then(function (res) { if (res.statusCode === 200) { return Helper_1.Helper.dumpStream(res).then(function (str) { var parsed = JSON.parse(str); urlStr = parsed.url + encodeURIComponent(urlStr); }); } }).catch(function () { }).then(function () { return new Promise(function (resolve, reject) { redirectReceiver(urlStr, environment.saveStateToString(), function (error, redirectedUrl) { if (error) { reject(error); } else { resolve(redirectedUrl); } }); }); }).then(function (redirectUrl) { var queryMap = url.parse(redirectUrl, true).query; var resMap = {}; for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) { var key = keys_1[_i]; if (queryMap[key] != null) { resMap[key] = queryMap[key]; } else { throw new UserError_1.UserError("The URL the RedirectReceiver returns does not contain all necessary keys in the query, it's missing at least " + key); } } environment.setVariable(resVar, legacy ? resMap["code"] : resMap); }); }; return AwaitCodeRedirect; }()); exports.AwaitCodeRedirect = AwaitCodeRedirect;
46.219178
200
0.585951
102e8d1a45a3cedb48a7e245eb577dc96ae796b5
312
js
JavaScript
test/unit/util.js
pepsipu/rctf
438b6adf32dbb491efccc961f3a41d1c8ff8a414
[ "BSD-3-Clause" ]
null
null
null
test/unit/util.js
pepsipu/rctf
438b6adf32dbb491efccc961f3a41d1c8ff8a414
[ "BSD-3-Clause" ]
null
null
null
test/unit/util.js
pepsipu/rctf
438b6adf32dbb491efccc961f3a41d1c8ff8a414
[ "BSD-3-Clause" ]
null
null
null
const test = require('ava') const util = require('../../dist/server/util') test('get score static', t => { const score = util.scores.getScore('static', 100, 100, 20) t.is(score, 100) }) test('get score dynamic', t => { const score = util.scores.getScore('dynamic', 100, 500, 20) t.is(score, 484) })
19.5
61
0.625
102ef6e30aeb4f2b0fdcb31859f54fbe8d5dc014
1,027
js
JavaScript
src/_nav.js
locutermo/sisgep-front-
3ded3c97db50d3ff98e0dfbffd1b47f3700de8dd
[ "MIT" ]
null
null
null
src/_nav.js
locutermo/sisgep-front-
3ded3c97db50d3ff98e0dfbffd1b47f3700de8dd
[ "MIT" ]
null
null
null
src/_nav.js
locutermo/sisgep-front-
3ded3c97db50d3ff98e0dfbffd1b47f3700de8dd
[ "MIT" ]
null
null
null
export default { items: [ { name: 'Inicio', url: '/dashboard', icon: 'icon-speedometer', badge: { variant: 'info', text: 'NEW', }, }, { name: 'Productos', url: '/products', icon: 'icon-handbag', // badge: { // variant: 'info', // text: 'NEW', // }, }, { name: 'Categorías', url: '/categories', icon: 'icon-trophy', // badge: { // variant: 'info', // text: 'NEW', // }, }, { name: 'Clientes', url: '/customers', icon: 'icon-people', badge: { variant: 'info', text: 'NEW', }, }, { name: 'Empleados', url: '/employees', icon: 'icon-people', badge: { variant: 'info', text: 'NEW', }, }, { name: 'Pedidos', url: '/orders', icon: 'icon-people', badge: { variant: 'info', text: 'NEW', }, }, ], };
17.40678
31
0.377799
102f2139fdd8317804a9fb2e0029c5342bd05d46
23,553
js
JavaScript
docs/uibench-reactlike/dist/bundle.js
linjiajian999/inferno
5998762ffa89015bdf1671419e1be492567b83f0
[ "MIT" ]
27
2021-03-08T19:13:13.000Z
2022-02-07T00:30:28.000Z
docs/uibench-reactlike/dist/bundle.js
xwillxu/inferno
521a4c39ca229345f76e43d6b2255fbf61b809a1
[ "MIT" ]
null
null
null
docs/uibench-reactlike/dist/bundle.js
xwillxu/inferno
521a4c39ca229345f76e43d6b2255fbf61b809a1
[ "MIT" ]
5
2021-03-13T02:42:15.000Z
2022-01-17T22:22:11.000Z
!function(){"use strict";function e(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,n(e,t)}function n(e,t){return(n=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e})(e,t)}var t=Array.isArray;function r(e){var n=typeof e;return"string"===n||"number"===n}function o(e){return void 0===e||null===e}function l(e){return null===e||!1===e||!0===e||void 0===e}function i(e){return"function"===typeof e}function a(e){return"string"===typeof e}function u(e){return null===e}function c(e,n){var t={};if(e)for(var r in e)t[r]=e[r];if(n)for(var o in n)t[o]=n[o];return t}function s(e){return!u(e)&&"object"===typeof e}var f={};function d(e){return e.substr(2).toLowerCase()}function p(e,n){e.appendChild(n)}function h(e,n,t){u(t)?p(e,n):e.insertBefore(n,t)}function v(e,n){e.removeChild(n)}function m(e){for(var n=0;n<e.length;n++)e[n]()}function g(e,n,t){var r=e.children;if(4&t)return r.$LI;if(8192&t)return 2===e.childFlags?r:r[n?0:r.length-1];return r}function y(e,n){for(var t;e;){if(2033&(t=e.flags))return e.dom;e=g(e,n,t)}return null}function b(e,n){do{var t=e.flags;if(2033&t)return void v(n,e.dom);var r=e.children;if(4&t&&(e=r.$LI),8&t&&(e=r),8192&t){if(2!==e.childFlags){for(var o=0,l=r.length;o<l;++o)b(r[o],n);return}e=r}}while(e)}function $(e,n,t){do{var r=e.flags;if(2033&r)return void h(n,e.dom,t);var o=e.children;if(4&r&&(e=o.$LI),8&r&&(e=o),8192&r){if(2!==e.childFlags){for(var l=0,i=o.length;l<i;++l)$(o[l],n,t);return}e=o}}while(e)}function k(e,n,t){if(e.constructor.getDerivedStateFromProps)return c(t,e.constructor.getDerivedStateFromProps(n,t));return t}var C={v:!1},w={componentComparator:null,createVNode:null,renderComplete:null};function U(e,n){e.textContent=n}function x(e,n){return s(e)&&e.event===n.event&&e.data===n.data}function P(e,n){for(var t in n)void 0===e[t]&&(e[t]=n[t]);return e}function F(e,n){return!!i(e)&&(e(n),!0)}var S="$";function N(e,n,t,r,o,l,i,a){this.childFlags=e,this.children=n,this.className=t,this.dom=null,this.flags=r,this.key=void 0===o?null:o,this.props=void 0===l?null:l,this.ref=void 0===i?null:i,this.type=a}function V(e,n,o,i,c,s,f,d){var p=void 0===c?1:c,h=new N(p,i,o,e,f,s,d,n);return w.createVNode&&w.createVNode(h),0===p&&function(e,n){var o,i=1;if(l(n))o=n;else if(r(n))i=16,o=n;else if(t(n)){for(var c=n.length,s=0;s<c;++s){var f=n[s];if(l(f)||t(f)){o=o||n.slice(0,s),A(n,o,s,"");break}if(r(f))(o=o||n.slice(0,s)).push(I(f,S+s));else{var d=f.key,p=(81920&f.flags)>0,h=u(d),v=a(d)&&d[0]===S;p||h||v?(o=o||n.slice(0,s),(p||v)&&(f=M(f)),(h||v)&&(f.key=S+s),o.push(f)):o&&o.push(f),f.flags|=65536}}i=0===(o=o||n).length?1:8}else(o=n).flags|=65536,81920&n.flags&&(o=M(n)),i=2;e.children=o,e.childFlags=i}(h,h.children),h}function L(e,n,t,r,l){var i=new N(1,null,null,e=function(e,n){if(12&e)return e;if(n.prototype&&n.prototype.render)return 4;if(n.render)return 32776;return 8}(e,n),r,function(e,n,t){var r=(32768&e?n.render:n).defaultProps;if(o(r))return t;if(o(t))return c(r,null);return P(t,r)}(e,n,t),function(e,n,t){if(4&e)return t;var r=(32768&e?n.render:n).defaultHooks;if(o(r))return t;if(o(t))return r;return P(t,r)}(e,n,l),n);return w.createVNode&&w.createVNode(i),i}function I(e,n){return new N(1,o(e)||!0===e||!1===e?"":e,null,16,n,null,null,null)}function B(e,n,t){var r=V(8192,8192,null,e,n,null,t,null);switch(r.childFlags){case 1:r.children=T(),r.childFlags=2;break;case 16:r.children=[I(e)],r.childFlags=4}return r}function M(e){var n=-16385&e.flags,t=e.props;if(14&n&&!u(t)){var r=t;for(var o in t={},r)t[o]=r[o]}if(0===(8192&n))return new N(e.childFlags,e.children,e.className,n,e.key,t,e.ref,e.type);return function(e){var n=e.children,t=e.childFlags;return B(2===t?M(n):n.map(M),t,e.key)}(e)}function T(){return I("",null)}function A(e,n,o,i){for(var c=e.length;o<c;o++){var s=e[o];if(!l(s)){var f=i+S+o;if(t(s))A(s,n,0,f);else{if(r(s))s=I(s,f);else{var d=s.key,p=a(d)&&d[0]===S;(81920&s.flags||p)&&(s=M(s)),s.flags|=65536,p?d.substring(0,i.length)!==i&&(s.key=i+d):u(d)?s.key=f:s.key=i+d}n.push(s)}}}}function D(e){if(l(e)||r(e))return I(e,null);if(t(e))return B(e,0,null);return 16384&e.flags?M(e):e}var E="http://www.w3.org/1999/xlink",O="http://www.w3.org/XML/1998/namespace",W={"xlink:actuate":E,"xlink:arcrole":E,"xlink:href":E,"xlink:role":E,"xlink:show":E,"xlink:title":E,"xlink:type":E,"xml:base":O,"xml:lang":O,"xml:space":O};function R(e){return{onClick:e,onDblClick:e,onFocusIn:e,onFocusOut:e,onKeyDown:e,onKeyPress:e,onKeyUp:e,onMouseDown:e,onMouseMove:e,onMouseUp:e,onTouchEnd:e,onTouchMove:e,onTouchStart:e}}var j=R(0),_=R(null),H=R(!0);function Q(e,n){var t=n.$EV;return t||(t=n.$EV=R(null)),t[e]||1===++j[e]&&(_[e]=function(e){var n="onClick"===e||"onDblClick"===e?function(e){return function(n){if(0!==n.button)return void n.stopPropagation();G(n,!0,e,z(n))}}(e):function(e){return function(n){G(n,!1,e,z(n))}}(e);return document.addEventListener(d(e),n),n}(e)),t}function X(e,n){var t=n.$EV;t&&t[e]&&(0===--j[e]&&(document.removeEventListener(d(e),_[e]),_[e]=null),t[e]=null)}function G(e,n,t,r){var o=function(e){return i(e.composedPath)?e.composedPath()[0]:e.target}(e);do{if(n&&o.disabled)return;var l=o.$EV;if(l){var a=l[t];if(a&&(r.dom=o,a.event?a.event(a.data,e):a(e),e.cancelBubble))return}o=o.parentNode}while(!u(o))}function K(){this.cancelBubble=!0,this.immediatePropagationStopped||this.stopImmediatePropagation()}function q(){return this.defaultPrevented}function J(){return this.cancelBubble}function z(e){var n={dom:document};return e.isDefaultPrevented=q,e.isPropagationStopped=J,e.stopPropagation=K,Object.defineProperty(e,"currentTarget",{configurable:!0,get:function(){return n.dom}}),n}function Y(e,n,t){if(e[n]){var r=e[n];r.event?r.event(r.data,t):r(t)}else{var o=n.toLowerCase();e[o]&&e[o](t)}}function Z(e,n){var t=function(t){var r=this.$V;if(!r)return;var o=r.props||f,l=r.dom;if(a(e))Y(o,e,t);else for(var u=0;u<e.length;++u)Y(o,e[u],t);if(i(n)){var c=this.$V,s=c.props||f;n(s,l,!1,c)}};return Object.defineProperty(t,"wrapped",{configurable:!1,enumerable:!1,value:!0,writable:!1}),t}function ee(e,n,t){var r="$"+n,o=e[r];if(o){if(o[1].wrapped)return;e.removeEventListener(o[0],o[1]),e[r]=null}i(t)&&(e.addEventListener(n,t),e[r]=[n,t])}function ne(e){return"checkbox"===e||"radio"===e}var te=Z("onInput",le),re=Z(["onClick","onChange"],le);function oe(e){e.stopPropagation()}function le(e,n){var t=e.type,r=e.value,l=e.checked,i=e.multiple,a=e.defaultValue,u=!o(r);t&&t!==n.type&&n.setAttribute("type",t),o(i)||i===n.multiple||(n.multiple=i),o(a)||u||(n.defaultValue=a+""),ne(t)?(u&&(n.value=r),o(l)||(n.checked=l)):u&&n.value!==r?(n.defaultValue=r,n.value=r):o(l)||(n.checked=l)}function ie(e,n){if("option"===e.type)!function(e,n){var r=e.props||f,l=e.dom;l.value=r.value,r.value===n||t(n)&&-1!==n.indexOf(r.value)?l.selected=!0:o(n)&&o(r.selected)||(l.selected=r.selected||!1)}(e,n);else{var r=e.children,l=e.flags;if(4&l)ie(r.$LI,n);else if(8&l)ie(r,n);else if(2===e.childFlags)ie(r,n);else if(12&e.childFlags)for(var i=0,a=r.length;i<a;++i)ie(r[i],n)}}oe.wrapped=!0;var ae=Z("onChange",ue);function ue(e,n,t,r){var l=Boolean(e.multiple);o(e.multiple)||l===n.multiple||(n.multiple=l);var i=e.selectedIndex;if(-1===i&&(n.selectedIndex=-1),1!==r.childFlags){var a=e.value;"number"===typeof i&&i>-1&&n.options[i]&&(a=n.options[i].value),t&&o(a)&&(a=e.defaultValue),ie(r,a)}}var ce,se,fe=Z("onInput",pe),de=Z("onChange");function pe(e,n,t){var r=e.value,l=n.value;if(o(r)){if(t){var i=e.defaultValue;o(i)||i===l||(n.defaultValue=i,n.value=i)}}else l!==r&&(n.defaultValue=r,n.value=r)}function he(e,n,t,r,o,l){64&e?le(r,t):256&e?ue(r,t,o,n):128&e&&pe(r,t,o),l&&(t.$V=n)}function ve(e){return e.type&&ne(e.type)?!o(e.checked):!o(e.value)}function me(e){e&&!F(e,null)&&e.current&&(e.current=null)}function ge(e,n,t){e&&(i(e)||void 0!==e.current)&&t.push((function(){F(e,n)||void 0===e.current||(e.current=n)}))}function ye(e,n){be(e),b(e,n)}function be(e){var n,t=e.flags,r=e.children;if(481&t){n=e.ref;var l=e.props;me(n);var a=e.childFlags;if(!u(l))for(var c=Object.keys(l),s=0,d=c.length;s<d;s++){var p=c[s];H[p]&&X(p,e.dom)}12&a?$e(r):2===a&&be(r)}else r&&(4&t?(i(r.componentWillUnmount)&&r.componentWillUnmount(),me(e.ref),r.$UN=!0,be(r.$LI)):8&t?(!o(n=e.ref)&&i(n.onComponentWillUnmount)&&n.onComponentWillUnmount(y(e,!0),e.props||f),be(r)):1024&t?ye(r,e.ref):8192&t&&12&e.childFlags&&$e(r))}function $e(e){for(var n=0,t=e.length;n<t;++n)be(e[n])}function ke(e){e.textContent=""}function Ce(e,n,t){$e(t),8192&n.flags?b(n,e):ke(e)}function we(e,n,t,r,l,c,f){switch(e){case"children":case"childrenType":case"className":case"defaultValue":case"key":case"multiple":case"ref":case"selectedIndex":break;case"autoFocus":r.autofocus=!!t;break;case"allowfullscreen":case"autoplay":case"capture":case"checked":case"controls":case"default":case"disabled":case"hidden":case"indeterminate":case"loop":case"muted":case"novalidate":case"open":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"selected":r[e]=!!t;break;case"defaultChecked":case"value":case"volume":if(c&&"value"===e)break;var p=o(t)?"":t;r[e]!==p&&(r[e]=p);break;case"style":!function(e,n,t){if(o(n))return void t.removeAttribute("style");var r,l,i=t.style;if(a(n))return void(i.cssText=n);if(o(e)||a(e))for(r in n)l=n[r],i.setProperty(r,l);else{for(r in n)(l=n[r])!==e[r]&&i.setProperty(r,l);for(r in e)o(n[r])&&i.removeProperty(r)}}(n,t,r);break;case"dangerouslySetInnerHTML":!function(e,n,t,r){var l=e&&e.__html||"",i=n&&n.__html||"";l!==i&&(o(i)||function(e,n){var t=document.createElement("i");return t.innerHTML=n,t.innerHTML===e.innerHTML}(r,i)||(u(t)||(12&t.childFlags?$e(t.children):2===t.childFlags&&be(t.children),t.children=null,t.childFlags=1),r.innerHTML=i))}(n,t,f,r);break;default:H[e]?function(e,n,t,r){if(i(t))Q(e,r)[e]=t;else if(s(t)){if(x(n,t))return;Q(e,r)[e]=t}else X(e,r)}(e,n,t,r):111===e.charCodeAt(0)&&110===e.charCodeAt(1)?function(e,n,t,r){if(s(t)){if(x(n,t))return;t=function(e){var n=e.event;return function(t){n(e.data,t)}}(t)}ee(r,d(e),t)}(e,n,t,r):o(t)?r.removeAttribute(e):l&&W[e]?r.setAttributeNS(W[e],e,t):r.setAttribute(e,t)}}function Ue(e,n,t){var r=D(e.render(n,e.state,t)),o=t;return i(e.getChildContext)&&(o=c(t,e.getChildContext())),e.$CX=o,r}function xe(e,n){var t=e.props||f;return 32768&e.flags?e.type.render(t,e.ref,n):e.type(t,n)}function Pe(e,n,t,r,l,a){var c=e.flags|=16384;481&c?function(e,n,t,r,l,i){var a=e.flags,c=e.props,s=e.className,f=e.childFlags,d=e.dom=function(e,n){if(n)return document.createElementNS("http://www.w3.org/2000/svg",e);return document.createElement(e)}(e.type,r=r||(32&a)>0),p=e.children;if(o(s)||""===s||(r?d.setAttribute("class",s):d.className=s),16===f)U(d,p);else if(1!==f){var v=r&&"foreignObject"!==e.type;2===f?(16384&p.flags&&(e.children=p=M(p)),Pe(p,d,t,v,null,i)):8!==f&&4!==f||Se(p,d,t,v,null,i)}u(n)||h(n,d,l),u(c)||function(e,n,t,r,o){var l=!1,i=(448&n)>0;for(var a in i&&(l=ve(t))&&function(e,n,t){64&e?function(e,n){ne(n.type)?(ee(e,"change",re),ee(e,"click",oe)):ee(e,"input",te)}(n,t):256&e?function(e){ee(e,"change",ae)}(n):128&e&&function(e,n){ee(e,"input",fe),n.onChange&&ee(e,"change",de)}(n,t)}(n,r,t),t)we(a,null,t[a],r,o,l,null);i&&he(n,e,r,t,!0,l)}(e,a,c,d,r),ge(e.ref,d,i)}(e,n,t,r,l,a):4&c?function(e,n,t,r,o,l){var a=function(e,n,t,r,o,l){var a=new n(t,r),c=a.$N=Boolean(n.getDerivedStateFromProps||a.getSnapshotBeforeUpdate);if(a.$SVG=o,a.$L=l,e.children=a,a.$BS=!1,a.context=r,a.props===f&&(a.props=t),c)a.state=k(a,t,a.state);else if(i(a.componentWillMount)){a.$BR=!0,a.componentWillMount();var s=a.$PS;if(!u(s)){var d=a.state;if(u(d))a.state=s;else for(var p in s)d[p]=s[p];a.$PS=null}a.$BR=!1}return a.$LI=Ue(a,t,r),a}(e,e.type,e.props||f,t,r,l);Pe(a.$LI,n,a.$CX,r,o,l),function(e,n,t){ge(e,n,t),i(n.componentDidMount)&&t.push(function(e){return function(){e.componentDidMount()}}(n))}(e.ref,a,l)}(e,n,t,r,l,a):8&c?(function(e,n,t,r,o,l){Pe(e.children=D(xe(e,t)),n,t,r,o,l)}(e,n,t,r,l,a),function(e,n){var t=e.ref;o(t)||(F(t.onComponentWillMount,e.props||f),i(t.onComponentDidMount)&&n.push(function(e,n){return function(){e.onComponentDidMount(y(n,!0),n.props||f)}}(t,e)))}(e,a)):512&c||16&c?Fe(e,n,l):8192&c?function(e,n,t,r,o,l){var i=e.children,a=e.childFlags;12&a&&0===i.length&&(a=e.childFlags=2,i=e.children=T()),2===a?Pe(i,t,o,r,o,l):Se(i,t,n,r,o,l)}(e,t,n,r,l,a):1024&c&&function(e,n,t,r,o){Pe(e.children,e.ref,n,!1,null,o);var l=T();Fe(l,t,r),e.dom=l.dom}(e,t,n,l,a)}function Fe(e,n,t){var r=e.dom=document.createTextNode(e.children);u(n)||h(n,r,t)}function Se(e,n,t,r,o,l){for(var i=0;i<e.length;++i){var a=e[i];16384&a.flags&&(e[i]=a=M(a)),Pe(a,n,t,r,o,l)}}function Ne(e,n,t,r,a,s,d){var h=n.flags|=16384;e.flags!==h||e.type!==n.type||e.key!==n.key||2048&h?16384&e.flags?function(e,n,t,r,o,l){be(e),0!==(n.flags&e.flags&2033)?(Pe(n,null,r,o,null,l),function(e,n,t){e.replaceChild(n,t)}(t,n.dom,e.dom)):(Pe(n,t,r,o,y(e,!0),l),b(e,t))}(e,n,t,r,a,d):Pe(n,t,r,a,s,d):481&h?function(e,n,t,r,l,i){var a,u=n.dom=e.dom,c=e.props,s=n.props,d=!1,p=!1;if(r=r||(32&l)>0,c!==s){var h=c||f;if((a=s||f)!==f)for(var v in(d=(448&l)>0)&&(p=ve(a)),a){var m=h[v],g=a[v];m!==g&&we(v,m,g,u,r,p,e)}if(h!==f)for(var y in h)o(a[y])&&!o(h[y])&&we(y,h[y],null,u,r,p,e)}var b=n.children,$=n.className;e.className!==$&&(o($)?u.removeAttribute("class"):r?u.setAttribute("class",$):u.className=$),4096&l?function(e,n){e.textContent!==n&&(e.textContent=n)}(u,b):Ve(e.childFlags,n.childFlags,e.children,b,u,t,r&&"foreignObject"!==n.type,null,e,i),d&&he(l,n,u,a,!1,p);var k=n.ref,C=e.ref;C!==k&&(me(C),ge(k,u,i))}(e,n,r,a,h,d):4&h?function(e,n,t,r,o,l,a){var s=n.children=e.children;if(u(s))return;s.$L=a;var d=n.props||f,p=n.ref,h=e.ref,v=s.state;if(!s.$N){if(i(s.componentWillReceiveProps)){if(s.$BR=!0,s.componentWillReceiveProps(d,r),s.$UN)return;s.$BR=!1}u(s.$PS)||(v=c(v,s.$PS),s.$PS=null)}Le(s,v,d,t,r,o,!1,l,a),h!==p&&(me(h),ge(p,s,a))}(e,n,t,r,a,s,d):8&h?function(e,n,t,r,l,a,u){var c=!0,s=n.props||f,d=n.ref,p=e.props,h=!o(d),v=e.children;if(h&&i(d.onComponentShouldUpdate)&&(c=d.onComponentShouldUpdate(p,s)),!1!==c){h&&i(d.onComponentWillUpdate)&&d.onComponentWillUpdate(p,s);var m=D(xe(n,r));Ne(v,m,t,r,l,a,u),n.children=m,h&&i(d.onComponentDidUpdate)&&d.onComponentDidUpdate(p,s)}else n.children=v}(e,n,t,r,a,s,d):16&h?function(e,n){var t=n.children,r=n.dom=e.dom;t!==e.children&&(r.nodeValue=t)}(e,n):512&h?n.dom=e.dom:8192&h?function(e,n,t,r,o,l){var i=e.children,a=n.children,u=e.childFlags,c=n.childFlags,s=null;12&c&&0===a.length&&(c=n.childFlags=2,a=n.children=T());var f=0!==(2&c);if(12&u){var d=i.length;(8&u&&8&c||f||!f&&a.length>d)&&(s=y(i[d-1],!1).nextSibling)}Ve(u,c,i,a,t,r,o,s,e,l)}(e,n,t,r,a,d):function(e,n,t,r){var o=e.ref,i=n.ref,a=n.children;if(Ve(e.childFlags,n.childFlags,e.children,a,o,t,!1,null,e,r),n.dom=e.dom,o!==i&&!l(a)){var u=a.dom;v(o,u),p(i,u)}}(e,n,r,d)}function Ve(e,n,t,r,o,l,i,a,u,c){switch(e){case 2:switch(n){case 2:Ne(t,r,o,l,i,a,c);break;case 1:ye(t,o);break;case 16:be(t),U(o,r);break;default:!function(e,n,t,r,o,l){be(e),Se(n,t,r,o,y(e,!0),l),b(e,t)}(t,r,o,l,i,c)}break;case 1:switch(n){case 2:Pe(r,o,l,i,a,c);break;case 1:break;case 16:U(o,r);break;default:Se(r,o,l,i,a,c)}break;case 16:switch(n){case 16:!function(e,n,t){e!==n&&(""!==e?t.firstChild.nodeValue=n:U(t,n))}(t,r,o);break;case 2:ke(o),Pe(r,o,l,i,a,c);break;case 1:ke(o);break;default:ke(o),Se(r,o,l,i,a,c)}break;default:switch(n){case 16:$e(t),U(o,r);break;case 2:Ce(o,u,t),Pe(r,o,l,i,a,c);break;case 1:Ce(o,u,t);break;default:var s=0|t.length,f=0|r.length;0===s?f>0&&Se(r,o,l,i,a,c):0===f?Ce(o,u,t):8===n&&8===e?function(e,n,t,r,o,l,i,a,u,c){var s,f,d=l-1,p=i-1,h=0,v=e[h],m=n[h];e:{for(;v.key===m.key;){if(16384&m.flags&&(n[h]=m=M(m)),Ne(v,m,t,r,o,a,c),e[h]=m,++h>d||h>p)break e;v=e[h],m=n[h]}for(v=e[d],m=n[p];v.key===m.key;){if(16384&m.flags&&(n[p]=m=M(m)),Ne(v,m,t,r,o,a,c),e[d]=m,p--,h>--d||h>p)break e;v=e[d],m=n[p]}}if(h>d){if(h<=p)for(f=(s=p+1)<i?y(n[s],!0):a;h<=p;)16384&(m=n[h]).flags&&(n[h]=m=M(m)),++h,Pe(m,t,r,o,f,c)}else if(h>p)for(;h<=d;)ye(e[h++],t);else!function(e,n,t,r,o,l,i,a,u,c,s,f,d){var p,h,v,m=0,g=a,b=a,k=l-a+1,C=i-a+1,w=new Int32Array(C+1),U=k===r,x=!1,P=0,F=0;if(o<4||(k|C)<32)for(m=g;m<=l;++m)if(p=e[m],F<C){for(a=b;a<=i;a++)if(h=n[a],p.key===h.key){if(w[a-b]=m+1,U)for(U=!1;g<m;)ye(e[g++],u);P>a?x=!0:P=a,16384&h.flags&&(n[a]=h=M(h)),Ne(p,h,u,t,c,s,d),++F;break}!U&&a>i&&ye(p,u)}else U||ye(p,u);else{var S={};for(m=b;m<=i;++m)S[n[m].key]=m;for(m=g;m<=l;++m)if(p=e[m],F<C)if(void 0!==(a=S[p.key])){if(U)for(U=!1;m>g;)ye(e[g++],u);w[a-b]=m+1,P>a?x=!0:P=a,16384&(h=n[a]).flags&&(n[a]=h=M(h)),Ne(p,h,u,t,c,s,d),++F}else U||ye(p,u);else U||ye(p,u)}if(U)Ce(u,f,e),Se(n,u,t,c,s,d);else if(x){var N=function(e){var n=0,t=0,r=0,o=0,l=0,i=0,a=0,u=e.length;for(u>Ie&&(Ie=u,ce=new Int32Array(u),se=new Int32Array(u));t<u;++t)if(0!==(n=e[t])){if(e[r=ce[o]]<n){se[t]=r,ce[++o]=t;continue}for(l=0,i=o;l<i;)e[ce[a=l+i>>1]]<n?l=a+1:i=a;n<e[ce[l]]&&(l>0&&(se[t]=ce[l-1]),ce[l]=t)}l=o+1;var c=new Int32Array(l);for(i=ce[l-1];l-- >0;)c[l]=i,i=se[i],ce[l]=0;return c}(w);for(a=N.length-1,m=C-1;m>=0;m--)0===w[m]?(16384&(h=n[P=m+b]).flags&&(n[P]=h=M(h)),Pe(h,u,t,c,(v=P+1)<o?y(n[v],!0):s,d)):a<0||m!==N[a]?$(h=n[P=m+b],u,(v=P+1)<o?y(n[v],!0):s):a--}else if(F!==C)for(m=C-1;m>=0;m--)0===w[m]&&(16384&(h=n[P=m+b]).flags&&(n[P]=h=M(h)),Pe(h,u,t,c,(v=P+1)<o?y(n[v],!0):s,d))}(e,n,r,l,i,d,p,h,t,o,a,u,c)}(t,r,o,l,i,s,f,a,u,c):function(e,n,t,r,o,l,i,a,u){for(var c,s,f=l>i?i:l,d=0;d<f;++d)c=n[d],s=e[d],16384&c.flags&&(c=n[d]=M(c)),Ne(s,c,t,r,o,a,u),e[d]=c;if(l<i)for(d=f;d<i;++d)16384&(c=n[d]).flags&&(c=n[d]=M(c)),Pe(c,t,r,o,a,u);else if(l>i)for(d=f;d<l;++d)ye(e[d],t)}(t,r,o,l,i,s,f,a,c)}}}function Le(e,n,t,r,o,l,a,u,s){var f=e.state,d=e.props,p=Boolean(e.$N),h=i(e.shouldComponentUpdate);if(p&&(n=k(e,t,n!==f?c(f,n):n)),a||!h||h&&e.shouldComponentUpdate(t,n,o)){!p&&i(e.componentWillUpdate)&&e.componentWillUpdate(t,n,o),e.props=t,e.state=n,e.context=o;var v=null,m=Ue(e,t,o);p&&i(e.getSnapshotBeforeUpdate)&&(v=e.getSnapshotBeforeUpdate(d,f)),Ne(e.$LI,m,r,e.$CX,l,u,s),e.$LI=m,i(e.componentDidUpdate)&&function(e,n,t,r,o){o.push((function(){e.componentDidUpdate(n,t,r)}))}(e,d,f,v,s)}else e.props=t,e.state=n,e.context=o}var Ie=0;function Be(e,n,t,r){void 0===t&&(t=null),void 0===r&&(r=f),function(e,n,t,r){var l=[],a=n.$V;C.v=!0,o(a)?o(e)||(16384&e.flags&&(e=M(e)),Pe(e,n,r,!1,null,l),n.$V=e,a=e):o(e)?(ye(a,n),n.$V=null):(16384&e.flags&&(e=M(e)),Ne(a,e,n,r,!1,null,l),a=n.$V=e),m(l),C.v=!1,i(t)&&t(),i(w.renderComplete)&&w.renderComplete(a,n)}(e,n,t,r)}"undefined"!==typeof document&&window.Node&&(Node.prototype.$EV=null,Node.prototype.$V=null);var Me=[],Te="undefined"!==typeof Promise?Promise.resolve().then.bind(Promise.resolve()):function(e){window.setTimeout(e,0)},Ae=!1;function De(e,n,t,r){var l=e.$PS;if(i(n)&&(n=n(l?c(e.state,l):e.state,e.props,e.context)),o(l))e.$PS=n;else for(var a in n)l[a]=n[a];if(e.$BR)i(t)&&e.$L.push(t.bind(e));else{if(!C.v&&0===Me.length)return We(e,r),void(i(t)&&t.call(e));if(-1===Me.indexOf(e)&&Me.push(e),r&&(e.$F=!0),Ae||(Ae=!0,Te(Oe)),i(t)){var u=e.$QU;u||(u=e.$QU=[]),u.push(t)}}}function Ee(e){for(var n=e.$QU,t=0;t<n.length;++t)n[t].call(e);e.$QU=null}function Oe(){var e;for(Ae=!1;e=Me.shift();)if(!e.$UN){var n=e.$F;e.$F=!1,We(e,n),e.$QU&&Ee(e)}}function We(e,n){if(n||!e.$BR){var t=e.$PS;e.$PS=null;var r=[];C.v=!0,Le(e,c(e.state,t),e.props,y(e.$LI,!0).parentNode,e.context,e.$SVG,n,null,r),m(r),C.v=!1}else e.state=e.$PS,e.$PS=null}var Re=function(e,n){this.state=null,this.$BR=!1,this.$BS=!0,this.$PS=null,this.$LI=null,this.$UN=!1,this.$CX=null,this.$QU=null,this.$N=!1,this.$L=null,this.$SVG=!1,this.$F=!1,this.props=e||f,this.context=n||f};Re.prototype.forceUpdate=function(e){if(this.$UN)return;De(this,{},e,!0)},Re.prototype.setState=function(e,n){if(this.$UN)return;this.$BS||De(this,e,n,!1)},Re.prototype.render=function(e,n,t){return null},uibench.init("Inferno [same as react]","7.4.8");var je=function(n){function t(e){var t;return(t=n.call(this,e)||this).onClick=t.onClick.bind(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(t)),t}e(t,n);var r=t.prototype;return r.shouldComponentUpdate=function(e,n){return this.props.text!==e.text},r.onClick=function(e){console.log("Clicked"+this.props.text),e.stopPropagation()},r.render=function(){return V(1,"td","TableCell",this.props.text,0,{onClick:this.onClick},null,null)},t}(Re),_e=function(n){function t(){return n.apply(this,arguments)||this}e(t,n);var r=t.prototype;return r.shouldComponentUpdate=function(e,n){return this.props.data!==e.data},r.render=function(){for(var e=this.props.data,n=e.active?"TableRow active":"TableRow",t=e.props,r=[L(2,je,{text:"#"+e.id},-1,null)],o=0;o<t.length;o++)r.push(L(2,je,{text:t[o]},o,null));return V(1,"tr",n,r,0,{"data-id":e.id},null,null)},t}(Re),He=function(n){function t(){return n.apply(this,arguments)||this}e(t,n);var r=t.prototype;return r.shouldComponentUpdate=function(e,n){return this.props.data!==e.data},r.render=function(){for(var e=this.props.data.items,n=[],t=0;t<e.length;t++){var r=e[t];n.push(L(2,_e,{data:r},r.id,null))}return V(1,"table","Table",V(1,"tbody",null,n,0,null,null,null),2,null,null,null)},t}(Re),Qe=function(n){function t(){return n.apply(this,arguments)||this}e(t,n);var r=t.prototype;return r.shouldComponentUpdate=function(e,n){return this.props.data!==e.data},r.render=function(){var e=this.props.data,n=e.time,t={"border-radius":(n%10).toString()+"px",background:"rgba(0,0,0,"+(.5+n%10/10).toString()+")"};return V(1,"div","AnimBox",null,1,{"data-id":e.id,style:t},null,null)},t}(Re),Xe=function(n){function t(){return n.apply(this,arguments)||this}e(t,n);var r=t.prototype;return r.shouldComponentUpdate=function(e,n){return this.props.data!==e.data},r.render=function(){for(var e=this.props.data.items,n=[],t=0;t<e.length;t++){var r=e[t];n.push(L(2,Qe,{data:r},r.id,null))}return V(1,"div","Anim",n,0,null,null,null)},t}(Re),Ge=function(n){function t(){return n.apply(this,arguments)||this}e(t,n);var r=t.prototype;return r.shouldComponentUpdate=function(e,n){return this.props.data!==e.data},r.render=function(){return V(1,"li","TreeLeaf",this.props.data.id,0,null,null,null)},t}(Re),Ke=function(n){function t(){return n.apply(this,arguments)||this}e(t,n);var r=t.prototype;return r.shouldComponentUpdate=function(e,n){return this.props.data!==e.data},r.render=function(){for(var e=this.props.data,n=[],r=0;r<e.children.length;r++){var o=e.children[r];o.container?n.push(L(2,t,{data:o},o.id,null)):n.push(L(2,Ge,{data:o},o.id,null))}return V(1,"ul","TreeNode",n,0,null,null,null)},t}(Re),qe=function(n){function t(){return n.apply(this,arguments)||this}e(t,n);var r=t.prototype;return r.shouldComponentUpdate=function(e,n){return this.props.data!==e.data},r.render=function(){return V(1,"div","Tree",L(2,Ke,{data:this.props.data.root},null,null),2,null,null,null)},t}(Re),Je=function(n){function t(){return n.apply(this,arguments)||this}e(t,n);var r=t.prototype;return r.shouldComponentUpdate=function(e,n){return this.props.data!==e.data},r.render=function(){var e,n=this.props.data,t=n.location;return"table"===t?e=L(2,He,{data:n.table},null,null):"anim"===t?e=L(2,Xe,{data:n.anim},null,null):"tree"===t&&(e=L(2,qe,{data:n.tree},null,null)),V(1,"div","Main",e,0,null,null,null)},t}(Re);document.addEventListener("DOMContentLoaded",(function(e){var n=document.querySelector("#App");uibench.run((function(e){Be(L(2,Je,{data:e},null,null),n)}),(function(e){Be(V(1,"pre",null,JSON.stringify(e,null," "),0,null,null,null),n)}))}))}();
11,776.5
23,552
0.644334
102f29a51f981d7bff2d74795c57e5efc798e715
39
js
JavaScript
packages/2002/08/16/index.js
antonmedv/year
ae5d8524f58eaad481c2ba599389c7a9a38c0819
[ "MIT" ]
7
2017-07-03T19:53:01.000Z
2021-04-05T18:15:55.000Z
packages/2002/08/16/index.js
antonmedv/year
ae5d8524f58eaad481c2ba599389c7a9a38c0819
[ "MIT" ]
1
2018-09-05T11:53:41.000Z
2018-12-16T12:36:21.000Z
packages/2002/08/16/index.js
antonmedv/year
ae5d8524f58eaad481c2ba599389c7a9a38c0819
[ "MIT" ]
2
2019-01-27T16:57:34.000Z
2020-10-11T09:30:25.000Z
module.exports = new Date(2002, 7, 16)
19.5
38
0.692308
102f60dbf55c07421f14e3be823eacf609df9ba7
16,035
js
JavaScript
js/__old/camera.js
djmisterjon/PIXI.ProStageMap
31ad00f173f4d2c5ce99fd19711f687d09d84b45
[ "MIT" ]
30
2018-09-17T16:53:24.000Z
2022-03-24T16:46:31.000Z
js/__old/camera.js
djmisterjon/PIXI.ProStageMap
31ad00f173f4d2c5ce99fd19711f687d09d84b45
[ "MIT" ]
2
2019-07-10T15:44:04.000Z
2019-10-20T15:31:57.000Z
js/__old/camera.js
djmisterjon/PIXI.ProStageMap
31ad00f173f4d2c5ce99fd19711f687d09d84b45
[ "MIT" ]
5
2018-10-17T09:13:05.000Z
2022-03-29T02:49:01.000Z
/*: // PLUGIN □────────────────────────────────□CAMERA CORE ENGINE□───────────────────────────────┐ * @author □ Jonathan Lepage (dimisterjon),(jonforum) * @plugindesc camera 2.5D engine with pixi-projection, all camera events store here * V.0.1a * License:© M.I.T └───────────────────────────────────────────────────────────────────────────────────────────────────┘ */ // TODO: TODO: CHECK POUR CAMERA 2.5D /*updateSkew() { this._cx = Math.cos(this._rotation + this.skew._y); this._sx = Math.sin(this._rotation + this.skew._y); this._cy = -Math.sin(this._rotation - this.skew._x); // cos, added PI/2 this._sy = Math.cos(this._rotation - this.skew._x); // sin, added PI/2 this._localID ++; }*/ // ┌-----------------------------------------------------------------------------┐ // GLOBAL $camera CLASS: _camera //└------------------------------------------------------------------------------┘ /**@description camera view-port and culling */ class _camera extends PIXI.projection.Container2d{ constructor() { /**@description camera viewport contain all the scene */ super() this._screenW = $app.screen.width; // 1920 this._screenH = $app.screen.height; // 1080; this._sceneW = 0; // scene width this._sceneH = 0; // scene height this._zoom = 1; /**@description far point to affine projections, est pinner a (0.5,0) mais permet detre piner a un objet */ this.far = new PIXI.Sprite(PIXI.Texture.WHITE); // this.far.renderable = false; /**@description default for far point factor */ this._fpf = 0; // far factor this._fpX = 0; // x focus 2d projection (debug with arrow) this._fpY = 0; // y focus 2d projection (debug with arrow) this._fpXLock = true; this._fpYLock = true; this.lfp = new PIXI.Point(this._screenW/2,this._screenH/2); // far point locked on top screen, laisse come ca pas defaut, utilise _fpX,_fpY /**@description screen position, les coordonnées XY centrer du view-port (ecrant) */ this.sp = new PIXI.Point(this._screenW/2,this._screenH/2); /**@description target point, les coordonnées XY du target */ this.tp = new PIXI.Point(); this.scene = null; // scene asigneded when camera initialised this.target = null; }; set lockCamX(value) { isNaN(value)? this._fpXLock = value && this._fpX || false : this._fpXLock = value }; // $camera.far.toLocal($camera.scene) set lockCamY(value) { isNaN(value)? this._fpYLock = value && this._fpY || false : this._fpYLock = value }; get camToMapX() { return this.pivot._x + (this._sceneW/2)}; // $camera.toLocal($player.spine,$camera,{x:0,y:0}) get camToMapY() { return this.pivot._y + this._sceneH}; get camToMapX3D() { return this.camToMapX-(this._sceneW/2*this._fpf) }; // $camera.toLocal($player.spine,$camera,{x:0,y:0}) get camToMapY3D() { return this.camToMapY-(this._sceneH*this._fpf) }; get distFYSY(){ return (this.sp.y-this.far.y)} get plocal(){ const point = $camera.parent.toLocal($player.spine,$camera.scene); //point.x/=this._zoom//-=this.x//-(this.pivot._x); //point.y/=this._zoom//-=this.y//-(this.pivot._y); point.x-=(this.x-this.pivot._x); point.y-=(this.y-this.pivot._y); return point; }; initialize(projected) { const scene = this.scene = $stage.scene; //scene.convertSubtreeTo2d(); //TODO: prepare les scene deja en 2d this.addChild(scene); scene.convertSubtreeTo2d(); this._sceneW = scene.background? scene.background.d.width : this._screenW; this._sceneH = scene.background? scene.background.d.height : this._screenH; scene.pivot.set(this._sceneW/2,this._sceneH); this.position.set(this._screenW/2,this._screenH/2); const far = this.far; far.factor = this._fpf; // facteur pour la projection global de la map sur les axe x et y far.position.set(this._screenW/2,-this._sceneH); far.position.__x = far.position._x; far.position.__y = far.position._y; $stage.addChild(far); // Listen for animate update if(!this._tickerProjection){ $app.ticker.add((delta) => { this.updateProjection(); this.debug();//TODO: REMOVE ME }); }; }; updateProjection(){ const far = this.far; let pos = this.toLocal(far.position, undefined, undefined, undefined, PIXI.projection.TRANSFORM_STEP.BEFORE_PROJ); pos.y = -pos.y; pos.x = -pos.x; this.proj.setAxisY(pos, -far.factor); const objList = $objs.list_master; for (let i=0, l= objList.length; i<l; i++) { const cage = objList[i]; if(cage.constructor.name === "ContainerSpine"){ cage.d.proj.affine = PIXI.projection.AFFINE.AXIS_X; }else{ if(!cage.isCase){ // TODO: add affine method in container car special pour les case cage.d.proj.affine = PIXI.projection.AFFINE.AXIS_X; cage.n.proj.affine = PIXI.projection.AFFINE.AXIS_X; }; }; }; }; /** use only for precompute between ticks for get easing camera coord */ preComputeProjWith(factor){ //const fp = {x:x,y:y} let pos = this.toLocal(this.far.position, undefined, undefined, undefined, PIXI.projection.TRANSFORM_STEP.BEFORE_PROJ); pos.y = -pos.y; pos.x = -pos.x; this.proj.setAxisY(pos, -factor); }; updateFarPointFromTarget(fpX,fpY,fpf){ this.far.x = this.sp.x-(this.pivot._x*this._zoom)+(fpX||this._fpX); this.far.y = -((this.pivot._y+this._sceneH)*this._zoom)+this.sp.y+(fpY||this._fpY)+((this._sceneH*this._zoom)*(fpf||this.far.factor)); }; setTarget(obj = $player.spine) { // add target to camera, default player this.target = obj; }; //$camera.moveToTarget(null,f) moveToTarget(obj,factor=0,fx=0,fy=0) { // camera objet setup {x,y,z,focal{x,y} // ont doit precalcul toLocal en 2 step, avec le camera setup actuel, et un autre apres avoir redefenir le camera setup. // this.moveProgress = true; // stop update // TODO: Ajouter le update du bas , dans les master // backup const origin_piv = this.pivot.clone(); const origin_far = {x:this.far.x, y:this.far.y, f:this.far.factor}; //this.far.factor = factor; this.preComputeProjWith(factor); let toPivot = this.plocal; // go to local target ? player this.pivot.copy(toPivot); // step 2 refactor with fx and fy //this.far.x = this.lfp.x-(this.pivot._x*this._zoom)+this._fpX, //this.far.y = -((this.pivot._y+this._sceneH)*this._zoom)+this.lfp.y+this._fpY+((this._sceneH*this._zoom)*factor), //this.preComputeProjWith(); //toPivot = this.plocal; //this.pivot.copy(toPivot); this.far.factor = factor; this.far.x = this.lfp.x-(this.pivot._x*this._zoom)+this._fpX return; // step1: find position to player // step2: find position to far and factor for fit to player // step:2 create new point for easing const toFar = { //TODO: a precompute preComputeProjWith x:this.lfp.x-(this.pivot._x*this._zoom)+this._fpX, y:-((this.pivot._y+this._sceneH)*this._zoom)+this.lfp.y+this._fpY+((this._sceneH*this._zoom)*this._fpf), f:this.far.factor }; const _toPivot = this.pivot.clone(); // step: reset to default coor and setup for easing this.pivot.copy(origin_piv); this.preComputeProjWith(origin_far.f); TweenLite.to(this.pivot, 2, { x:_toPivot.x, y:_toPivot.y, ease: Elastic.easeOut.config(0.4, 0.4), onComplete: () => {}, }); TweenLite.to(this.far, 2, { x:toFar.x, y:toFar.y, ease: Elastic.easeOut.config(0.4, 0.4), }); TweenLite.to(this.far, 2, { factor:factor, ease: Elastic.easeOut.config(0.4, 0.4), }); }; moveTo(x,y){ // target {x,y,z,focal{x,y}} this.moveProgress = true; const toX = -(this._sceneW/2)+x; const toY = -this._sceneH+y; const focalX = (toX*this._fpf); const focalY = (toY*this._fpf); this.pivot.set( toX-focalX, toY-focalY ); this.far.x = this.sp.x-(this.pivot._x*this._zoom)+this._fpX; this.far.y = -((this.pivot._y+this._sceneH)*this._zoom)+this.sp.y+this._fpY+((this._sceneH*this._zoom)*this._fpf); console.log('this.far.y: ', this.far.y); }; /* moveFromTarget(x,y,speed,ease) { const tX = this.target.x-((this.screenX/2)/this._tmpZoom); const tY = this.target.y-((this.screenY/2)/this._tmpZoom); isFinite(x) && (this.tweenP.vars.x = tX+x); isFinite(y) && (this.tweenP.vars.y = tY+y); speed && (this.tweenP._duration = speed); this.tweenP.invalidate(); this.tweenP.play(0); };*/ setZoom(value,speed=1,ease) { this.scale.set(value); }; /*onMouseMove(x,y){ const ra = $player._zoneLimit; // player data allowed for zone limit const raX = x>this.screenX && ra || x<0 && -ra || NaN; const raY = y>this.screenY && ra || y<0 && -ra || NaN; // player actived the limit if(raX || raY){ this.targetFocus = 0; $camera.moveFromTarget(raX,raY,4) }else{ // refocus camera to target const rX = (x/$camera.zoom.x)+$camera.position.x ; const inX = $player.position().x- $player._width/2; const outX = $player.position().x + $player._width/2; const inY = $player.position().y- $player._height; const outY = $player.position().y if(rX>inX && rX<outX){ this.targetFocus+=1; if( this.targetFocus>48){ $camera.moveFromTarget(0,0,5) } }else{ this.targetFocus = 0; } }; };*/ onMouseWheel(e){ //TODO: isoler le zoom dans un pixi points pour precalculer le resulta final const value = e.deltaY>0 && -0.05 || 0.05; //if(this._zoom+value>2.5 || this._zoom+value<1 ){return}; this._zoom+=value; this.setZoom(this._zoom,3); //ratio,speed,ease //this.moveToTarget(3); //si ya une messageBox event active ?, ajuster le bones camera des bubbles /*if($messages.data){ $messages.fitMessageToCamera(this.tX,this.tY,this.zoom); };*/ }; /*onMouseCheckBorderCamera(e){ e.screenY const x = $app.renderer.plugins.interaction.mouse.global.x; let xx = 0; xx = ((this.screenX/2)-x)/50000; $stage.scene.skew.x = xx; $Objs.list_master.forEach(obj => { obj.skew.x = xx*-1; }); };*/ /**@description debug camera for test pixi-projections, also need move ticker and update to $app update */ debug() { if(!this._debug){ this._debug = true; let debugLine = new PIXI.Graphics(); let debugFarPoint = new PIXI.Graphics();// far point factor line const redraw = (debugLine,debugFarPoint) => { return (lockX=$camera._fpXLock,lockY=$camera._fpYLock) => { debugLine.lineStyle(4, 0xffffff, 1); debugLine.lineStyle(6,lockY?0xff0000:0xffffff,0.6).moveTo(this._screenW/2,0).lineTo(this._screenW/2, this._screenH).endFill(); // Vertical line Y debugLine.lineStyle(6,lockX?0xff0000:0xffffff,0.6).moveTo(0,this._screenH/2).lineTo(this._screenW, this._screenH/2).endFill(); debugLine.beginFill(0x000000, 0.6).lineStyle(2).drawRect(0,0,220,420).endFill(); // debug data square debugFarPoint.lineStyle(2,0x000000).moveTo(this._screenW/2,this._screenH/2).lineTo(this.far.x, this.far.y).endFill(); // Vertical line }; } this.redrawDebugScreen = redraw(debugLine,debugFarPoint); // create closure for redraw this.redrawDebugScreen(); $stage.addChildAt(debugLine,6); $stage.addChildAt(debugFarPoint,7); this.far.anchor.set(0.5); this.far.alpha = 0.5; this.far.tint = 0xff0000; this.far.width = 64, this.far.height = 64; // add once screen debug const [x,y,px,py,zoom,sceneW,sceneH,camToMapX,camToMapY,camToMapX3D,camToMapY3D,fpX,fpY,fpf,plocal] = Array.from({length:15},()=>(new PIXI.Text('',{fill: "white",fontSize: 20}))); const v = [x,y,px,py,zoom,sceneW,sceneH,camToMapX,camToMapY,camToMapX3D,camToMapY3D,fpX,fpY,fpf,plocal]; let _margeY = 34, _lastY = 0; v.forEach(vv => { vv.y = _lastY; _lastY+=_margeY; }); $stage.addChild(...v); let [sX,sY,_sx,_sy,ss,ac] = [0,0,0,0,15,1]; // scroll power and scroll speed $app.ticker.add((delta) => { if(this.moveProgress){return}; // avoid update when camera set to new pivot point x.text = 'x:'+~~this.x; y.text = 'y:'+~~this.y; px.text = 'px:'+~~this.pivot.x; py.text = 'py:'+~~this.pivot.y; zoom.text = 'zoom:'+this._zoom.toFixed(3); sceneW.text = 'sceneW:'+this._sceneW; sceneH.text = 'sceneH:'+this._sceneH; camToMapX.text = 'camToMapX:'+~~this.camToMapX; camToMapY.text = 'camToMapY:'+~~this.camToMapY; camToMapX3D.text = 'camToMapX3D:'+~~this.camToMapX3D; camToMapY3D.text = 'camToMapY3D:'+~~this.camToMapY3D; fpX.text = `fpX:${~~this.far.x} : (${~~(this.far.x-this.far.position.__x)})`; fpY.text = `fpY:${~~this.far.y} : (${~~(this.distFYSY)})`; fpf.text = 'fpf:'+this._fpf.toFixed(3)+''; plocal.text = `plocal: [x:${~~this.plocal.x} : y:${~~this.plocal.y}]`; //TODO: ADD ME TO $app core //const m = $mouse; //const sW = this._screenW-4, sH = this._screenH-4; //let acc = void 0; //acc = (m.x<4)?sX-=ac:(m.x>sW)?sX+=ac:acc; //acc = (m.y<4)?sY-=ac:(m.y>sH)?sY+=ac:acc; //acc? ac+=0.4 : ac = 2; //this.pivot.x+=(sX-this.pivot._x)/ss; //this.pivot.y+=(sY-this.pivot._y)/ss; //if(!this._fpXLock) { // this.far.lockX? this._fpX = (this.far.lockX-this.pivot.x) && delete this.far.lockX : void 0; // update lock from last lock // this.far.x = (this._screenW/2)+this._fpX; //}else{ // !this.far.lockX? this.far.lockX = this.pivot.x : void 0; // this.far.x = this.sp.x-(this.pivot._x*this._zoom)+this._fpX; //} //if(this._fpYLock) { // this.far.y = -((this.pivot._y+this._sceneH)*this._zoom)+this.sp.y+this._fpY+((this._sceneH*this._zoom)*this._fpf); //} else { // //}; //this.far.factor = this._fpf; // line for far point and target lock debugFarPoint.clear().lineStyle(3,0x000000).moveTo(this._screenW/2,this._screenH/2).lineTo(this.far.x, this.far.y); }); }; }; }; let $camera = new _camera(); console.log1('$camera.', $camera); document.onwheel = $camera.onMouseWheel.bind($camera); //TODO: //document.onmousemove = $camera.onMouseCheckBorderCamera.bind($camera); //TODO:
45.29661
191
0.552292
10304d4137b5ed2182d294a3246da659560c0fcc
401
js
JavaScript
storybook/stories/CenterView/index.js
maurusrv/reflash_ui
d2f316f71855c306e0d8325341ed9ebc0459a618
[ "MIT" ]
null
null
null
storybook/stories/CenterView/index.js
maurusrv/reflash_ui
d2f316f71855c306e0d8325341ed9ebc0459a618
[ "MIT" ]
null
null
null
storybook/stories/CenterView/index.js
maurusrv/reflash_ui
d2f316f71855c306e0d8325341ed9ebc0459a618
[ "MIT" ]
null
null
null
import React from 'react' import PropTypes from 'prop-types' import { View } from 'react-native' import tailwind from 'tailwind-rn' export default function CenterView({ children }) { return ( <View style={tailwind('flex-1 justify-center items-center')}> {children} </View> ) } CenterView.defaultProps = { children: null, } CenterView.propTypes = { children: PropTypes.node, }
19.095238
65
0.693267
1030789ee4a05f2489ccd4105b559566c29e4f4f
11,026
js
JavaScript
GDJS/tests/tests/hot-reloader.js
Add00/GDevelop
b341bc5be0426e4902f709d8d0fb9670bae654df
[ "MIT" ]
1
2020-06-20T12:06:12.000Z
2020-06-20T12:06:12.000Z
GDJS/tests/tests/hot-reloader.js
Saurav1905/GDevelop
2811eef4e072ab35cf35ca22562ccd9f854cae9f
[ "MIT" ]
null
null
null
GDJS/tests/tests/hot-reloader.js
Saurav1905/GDevelop
2811eef4e072ab35cf35ca22562ccd9f854cae9f
[ "MIT" ]
null
null
null
// @ts-check /** * Tests for gdjs.InputManager and related. */ describe('gdjs.HotReloader.deepEqual', () => { it('compares object, arrays, and primitives', () => { expect(gdjs.HotReloader.deepEqual('a', 'a')).to.be(true); expect(gdjs.HotReloader.deepEqual('a', 'b')).to.be(false); expect(gdjs.HotReloader.deepEqual(1, 1)).to.be(true); expect(gdjs.HotReloader.deepEqual(1, 2)).to.be(false); expect(gdjs.HotReloader.deepEqual(true, true)).to.be(true); expect(gdjs.HotReloader.deepEqual(true, false)).to.be(false); expect(gdjs.HotReloader.deepEqual({ a: 1 }, { a: 1 })).to.be(true); expect(gdjs.HotReloader.deepEqual({ a: 1, b: 2 }, { a: 1, b: 2 })).to.be( true ); expect(gdjs.HotReloader.deepEqual({ a: 1 }, { a: 2 })).to.be(false); expect(gdjs.HotReloader.deepEqual({ a: 1 }, { b: 2 })).to.be(false); expect(gdjs.HotReloader.deepEqual({ a: 1 }, { a: 1, b: 2 })).to.be(false); expect(gdjs.HotReloader.deepEqual({ a: 1, b: 2 }, { a: 1 })).to.be(false); expect(gdjs.HotReloader.deepEqual([1], [1])).to.be(true); expect(gdjs.HotReloader.deepEqual([1, 2], [1, 2])).to.be(true); expect(gdjs.HotReloader.deepEqual([1, { a: 1 }], [1, { a: 1 }])).to.be( true ); expect(gdjs.HotReloader.deepEqual([1], [2])).to.be(false); expect(gdjs.HotReloader.deepEqual([1, 2], [2])).to.be(false); expect(gdjs.HotReloader.deepEqual([1, { a: 1 }], [1, { a: 2 }])).to.be( false ); }); it('hot-reloads variables', () => { const runtimeGame = new gdjs.RuntimeGame({ variables: [], resources: { resources: [] }, // @ts-expect-error ts-migrate(2740) FIXME: Type '{ windowWidth: number; windowHeight: number;... Remove this comment to see the full error message properties: { windowWidth: 800, windowHeight: 600 }, }); const hotReloader = new gdjs.HotReloader(runtimeGame); const variablesContainer = new gdjs.VariablesContainer([]); // Add a new variable /** @type {VariableData[]} */ const dataWithMyVariable = [ { name: 'MyVariable', value: '123', }, ]; hotReloader._hotReloadVariablesContainer( [], dataWithMyVariable, variablesContainer ); expect(variablesContainer.has('MyVariable')).to.be(true); expect(variablesContainer.get('MyVariable').getAsNumber()).to.be(123); // Remove a new variable hotReloader._hotReloadVariablesContainer( dataWithMyVariable, [], variablesContainer ); expect(variablesContainer.has('MyVariable')).to.be(false); // Change a variable /** @type {VariableData[]} */ const dataWithMyVariableAsString = [ { name: 'MyVariable', value: 'Hello World', }, ]; hotReloader._hotReloadVariablesContainer( dataWithMyVariable, dataWithMyVariableAsString, variablesContainer ); expect(variablesContainer.has('MyVariable')).to.be(true); expect(variablesContainer.get('MyVariable').getAsString()).to.be( 'Hello World' ); // Add a new structure /** @type {VariableData[]} */ const dataWithMyVariableAsStructure = [ { name: 'MyVariable', children: [ { name: 'MyChild1', value: '123', }, { name: 'MyChild2', value: 'Hello World', }, ], }, ]; hotReloader._hotReloadVariablesContainer( [], dataWithMyVariableAsStructure, variablesContainer ); expect(variablesContainer.has('MyVariable')).to.be(true); expect(variablesContainer.get('MyVariable').isStructure()).to.be(true); expect(variablesContainer.get('MyVariable').hasChild('MyChild1')).to.be( true ); expect(variablesContainer.get('MyVariable').hasChild('MyChild2')).to.be( true ); expect( variablesContainer.get('MyVariable').getChild('MyChild1').getAsNumber() ).to.be(123); expect( variablesContainer.get('MyVariable').getChild('MyChild2').getAsString() ).to.be('Hello World'); // Change a variable in a structure /** @type {VariableData[]} */ const dataWithMyVariableAsStructure2 = [ { name: 'MyVariable', children: [ { name: 'MyChild1', value: '124', }, { name: 'MyChild2', value: 'Hello World 2', }, ], }, ]; hotReloader._hotReloadVariablesContainer( dataWithMyVariableAsStructure, dataWithMyVariableAsStructure2, variablesContainer ); expect(variablesContainer.has('MyVariable')).to.be(true); expect(variablesContainer.get('MyVariable').isStructure()).to.be(true); expect(variablesContainer.get('MyVariable').hasChild('MyChild1')).to.be( true ); expect(variablesContainer.get('MyVariable').hasChild('MyChild2')).to.be( true ); expect( variablesContainer.get('MyVariable').getChild('MyChild1').getAsNumber() ).to.be(124); expect( variablesContainer.get('MyVariable').getChild('MyChild2').getAsString() ).to.be('Hello World 2'); // Remove a child variable /** @type {VariableData[]} */ const dataWithMyVariableAsStructureWithoutChild1 = [ { name: 'MyVariable', children: [ { name: 'MyChild2', value: 'Hello World 2', }, ], }, ]; hotReloader._hotReloadVariablesContainer( dataWithMyVariableAsStructure2, dataWithMyVariableAsStructureWithoutChild1, variablesContainer ); expect(variablesContainer.has('MyVariable')).to.be(true); expect(variablesContainer.get('MyVariable').isStructure()).to.be(true); expect(variablesContainer.get('MyVariable').hasChild('MyChild1')).to.be( false ); expect(variablesContainer.get('MyVariable').hasChild('MyChild2')).to.be( true ); expect( variablesContainer.get('MyVariable').getChild('MyChild2').getAsString() ).to.be('Hello World 2'); // Add a child variable as a structure /** @type {VariableData[]} */ const dataWithMyVariableAsStructureWithChild1AsStructure = [ { name: 'MyVariable', children: [ { name: 'MyChild1', children: [ { name: 'MyGrandChild1', value: '456', }, ], }, { name: 'MyChild2', value: 'Hello World 2', }, ], }, ]; hotReloader._hotReloadVariablesContainer( dataWithMyVariableAsStructureWithoutChild1, dataWithMyVariableAsStructureWithChild1AsStructure, variablesContainer ); expect(variablesContainer.has('MyVariable')).to.be(true); expect(variablesContainer.get('MyVariable').isStructure()).to.be(true); expect(variablesContainer.get('MyVariable').hasChild('MyChild1')).to.be( true ); expect(variablesContainer.get('MyVariable').hasChild('MyChild2')).to.be( true ); expect( variablesContainer.get('MyVariable').getChild('MyChild2').getAsString() ).to.be('Hello World 2'); expect( variablesContainer.get('MyVariable').getChild('MyChild1').isStructure() ).to.be(true); expect( variablesContainer .get('MyVariable') .getChild('MyChild1') .hasChild('MyGrandChild1') ).to.be(true); expect( variablesContainer .get('MyVariable') .getChild('MyChild1') .getChild('MyGrandChild1') .getAsNumber() ).to.be(456); // Modify a grand child variable /** @type {VariableData[]} */ const dataWithMyVariableAsStructureWithChild1AsStructure2 = [ { name: 'MyVariable', children: [ { name: 'MyChild1', children: [ { name: 'MyGrandChild1', value: '789', }, ], }, { name: 'MyChild2', value: 'Hello World 2', }, ], }, ]; hotReloader._hotReloadVariablesContainer( dataWithMyVariableAsStructureWithChild1AsStructure, dataWithMyVariableAsStructureWithChild1AsStructure2, variablesContainer ); expect(variablesContainer.has('MyVariable')).to.be(true); expect(variablesContainer.get('MyVariable').isStructure()).to.be(true); expect(variablesContainer.get('MyVariable').hasChild('MyChild1')).to.be( true ); expect(variablesContainer.get('MyVariable').hasChild('MyChild2')).to.be( true ); expect( variablesContainer.get('MyVariable').getChild('MyChild2').getAsString() ).to.be('Hello World 2'); expect( variablesContainer.get('MyVariable').getChild('MyChild1').isStructure() ).to.be(true); expect( variablesContainer .get('MyVariable') .getChild('MyChild1') .hasChild('MyGrandChild1') ).to.be(true); expect( variablesContainer .get('MyVariable') .getChild('MyChild1') .getChild('MyGrandChild1') .getAsNumber() ).to.be(789); // Remove a grand child variable and add another /** @type {VariableData[]} */ const dataWithMyVariableAsStructureWithChild1AsStructure3 = [ { name: 'MyVariable', children: [ { name: 'MyChild1', children: [ { name: 'MyGrandChild2', value: 'Hello World 3', }, ], }, { name: 'MyChild2', value: 'Hello World 2', }, ], }, ]; hotReloader._hotReloadVariablesContainer( dataWithMyVariableAsStructureWithChild1AsStructure2, dataWithMyVariableAsStructureWithChild1AsStructure3, variablesContainer ); expect(variablesContainer.has('MyVariable')).to.be(true); expect(variablesContainer.get('MyVariable').isStructure()).to.be(true); expect(variablesContainer.get('MyVariable').hasChild('MyChild1')).to.be( true ); expect(variablesContainer.get('MyVariable').hasChild('MyChild2')).to.be( true ); expect( variablesContainer.get('MyVariable').getChild('MyChild2').getAsString() ).to.be('Hello World 2'); expect( variablesContainer.get('MyVariable').getChild('MyChild1').isStructure() ).to.be(true); expect( variablesContainer .get('MyVariable') .getChild('MyChild1') .hasChild('MyGrandChild1') ).to.be(false); expect( variablesContainer .get('MyVariable') .getChild('MyChild1') .hasChild('MyGrandChild2') ).to.be(true); expect( variablesContainer .get('MyVariable') .getChild('MyChild1') .getChild('MyGrandChild2') .getAsString() ).to.be('Hello World 3'); }); });
30.125683
153
0.58879
1030bc877cd68bf3ab33fbd48bf49f7986f52e98
1,356
js
JavaScript
src/classes/Projectile.js
Zuhaitz/UNIR_Programacion_Minijuego
0db0f8c88a52c7482868f463d16601e15a2eef6f
[ "MIT" ]
null
null
null
src/classes/Projectile.js
Zuhaitz/UNIR_Programacion_Minijuego
0db0f8c88a52c7482868f463d16601e15a2eef6f
[ "MIT" ]
null
null
null
src/classes/Projectile.js
Zuhaitz/UNIR_Programacion_Minijuego
0db0f8c88a52c7482868f463d16601e15a2eef6f
[ "MIT" ]
null
null
null
import Enemy from "./Enemy"; import Entity from "./Entity"; export default class Projectile extends Entity { constructor(scene, x, y, spriteName, enemies, direction, speed) { super(scene, x,y, spriteName); //Ajustar el sprite y hitbox this.setSize(3, 4); this.setOffset(3, 4); this.setAngle(90); this.body.setAllowGravity(false); //Colison con los enemigos this.scene.physics.add.overlap(this, enemies, this.spriteHit, null, this); //Estadisticas this.speed = speed; this.distance = global.pixels*5; //Datos this.originX = x; this.direction = direction; this.end = false; } update(time, delta) { //Se destruye al finalizar if(this.end){ this.destroy(); return; } //Comprueba si se acabo el tiempo de vida if(Math.abs(this.originX-this.body.x) > this.distance) this.end = true; else this.setVelocityX(this.direction*this.speed); } /** * Llamada cuando se colisiona con un enemigo * @param {Projectile} proyectile - el proyectil que impacta * @param {Enemy} enemy - el enemigo con el que impacto */ spriteHit(projectile, enemy) { enemy.die(); projectile.end = true; } }
25.584906
82
0.578909
1030fd2f44bc0c00e2c682e0d70a483344ad0315
2,316
js
JavaScript
web-app/js/siesta-3.0.1-lite/lib/Siesta/Role/CanStyleOutput.js
department-of-veterans-affairs/ChartReview
154ae29f065fa26b5a5fa262105cd862966cab38
[ "Apache-2.0" ]
8
2015-01-12T17:09:43.000Z
2020-09-01T20:09:34.000Z
web-app/js/siesta-3.0.1-lite/lib/Siesta/Role/CanStyleOutput.js
department-of-veterans-affairs/ChartReview
154ae29f065fa26b5a5fa262105cd862966cab38
[ "Apache-2.0" ]
1
2020-12-03T08:07:51.000Z
2022-03-09T23:03:13.000Z
web-app/js/siesta-3.0.1-lite/lib/Siesta/Role/CanStyleOutput.js
department-of-veterans-affairs/ChartReview
154ae29f065fa26b5a5fa262105cd862966cab38
[ "Apache-2.0" ]
2
2015-02-02T23:37:35.000Z
2017-07-14T06:32:15.000Z
/* Siesta 3.0.1 Copyright(c) 2009-2015 Bryntum AB http://bryntum.com/contact http://bryntum.com/products/siesta/license */ /** @class Siesta.Role.CanStyleOutput @private A role, providing output coloring functionality */ Role('Siesta.Role.CanStyleOutput', { has : { /** * @cfg {Boolean} disableColoring When set to `true` will disable the colors in the console output in automation launchers / NodeJS launcher */ disableColoring : false, style : { is : 'rwc', lazy : 'this.buildStyle' }, styles : { init : { 'bold' : [1, 22], 'italic' : [3, 23], 'underline' : [4, 24], 'black ' : [30, 39], 'yellow' : [33, 39], 'cyan' : [36, 39], 'white' : [37, 39], 'green' : [32, 39], 'red' : [31, 39], 'grey' : [90, 39], 'blue' : [34, 39], 'magenta' : [35, 39], 'bgblack ' : [40, 49], 'bgyellow' : [43, 49], 'bgcyan' : [46, 49], 'bgwhite' : [47, 49], 'bggreen' : [42, 49], 'bgred' : [41, 49], 'bggrey' : [100, 49], 'bgblue' : [44, 49], 'bgmagenta' : [45, 49], 'inverse' : [7, 27] } } }, methods : { buildStyle : function () { var me = this var style = {} Joose.O.each(this.styles, function (value, name) { style[ name ] = function (text) { return me.styled(text, name) } }) return style }, styled : function (text, style) { if (this.disableColoring) return text var styles = this.styles return '\033[' + styles[ style ][ 0 ] + 'm' + text + '\033[' + styles[ style ][ 1 ] + 'm' } } })
27.247059
148
0.35924
10318a78b775fb3dd122a5947eb190260922f9ec
4,034
js
JavaScript
thefencing/static/js/jquery.meanmenu.js
Lucifer-Kim/thefencing
147499eac623ba6a4929dd17a1a1fd9b7bbb6c9a
[ "MIT" ]
null
null
null
thefencing/static/js/jquery.meanmenu.js
Lucifer-Kim/thefencing
147499eac623ba6a4929dd17a1a1fd9b7bbb6c9a
[ "MIT" ]
null
null
null
thefencing/static/js/jquery.meanmenu.js
Lucifer-Kim/thefencing
147499eac623ba6a4929dd17a1a1fd9b7bbb6c9a
[ "MIT" ]
null
null
null
!function(e){"use strict";e.fn.meanmenu=function(n){var a={meanMenuTarget:jQuery(this),meanMenuContainer:"body",meanMenuClose:"X",meanMenuCloseSize:"18px",meanMenuOpen:"<span /><span /><span />",meanRevealPosition:"right",meanRevealPositionDistance:"0",meanRevealColour:"",meanScreenWidth:"767",meanNavPush:"",meanShowChildren:!0,meanExpandableChildren:!0,meanExpand:"+",meanContract:"-",meanRemoveAttrs:!1,onePage:!1,meanDisplay:"block",removeElements:""};n=e.extend(a,n);var t=window.innerWidth||document.documentElement.clientWidth;return this.each(function(){var e=n.meanMenuTarget,a=n.meanMenuContainer,r=n.meanMenuClose,i=n.meanMenuCloseSize,u=n.meanMenuOpen,m=n.meanRevealPosition,s=n.meanRevealPositionDistance,l=n.meanRevealColour,o=n.meanScreenWidth,c=n.meanNavPush,v=n.meanShowChildren,h=n.meanExpandableChildren,d=n.meanExpand,y=n.meanContract,j=n.meanRemoveAttrs,Q=n.onePage,f=n.meanDisplay,g=n.removeElements,p=!1;(navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPod/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i)||navigator.userAgent.match(/Blackberry/i)||navigator.userAgent.match(/Windows Phone/i))&&(p=!0),(navigator.userAgent.match(/MSIE 8/i)||navigator.userAgent.match(/MSIE 7/i))&&jQuery("html").css("overflow-y","scroll");var C="",w=function(){if("center"===m){var e=(window.innerWidth||document.documentElement.clientWidth)/2-22+"px";C="left:"+e+";right:auto;",p?jQuery(".meanmenu-reveal").animate({left:e}):jQuery(".meanmenu-reveal").css("left",e)}},x=!1,A=!1;"right"===m&&(C="right:"+s+";left:auto;"),"left"===m&&(C="left:"+s+";right:auto;"),w();var E="",M=function(){jQuery(E).is(".meanmenu-reveal.meanclose")?E.html(r):E.html(u)},P=function(){jQuery(".mean-bar,.mean-push").remove(),jQuery(a).removeClass("mean-container"),jQuery(e).css("display",f),x=!1,A=!1,jQuery(g).removeClass("mean-remove")},W=function(){var n="background:"+l+";color:"+l+";"+C;if(t<=o){jQuery(g).addClass("mean-remove"),A=!0,jQuery(a).addClass("mean-container"),jQuery(".mean-container").prepend('<div class="mean-bar"><a href="#nav" class="meanmenu-reveal" style="'+n+'">Show Navigation</a><nav class="mean-nav"></nav></div>');var r=jQuery(e).html();jQuery(".mean-nav").html(r),j&&jQuery("nav.mean-nav ul, nav.mean-nav ul *").each(function(){jQuery(this).is(".mean-remove")?jQuery(this).attr("class","mean-remove"):jQuery(this).removeAttr("class"),jQuery(this).removeAttr("id")}),jQuery(e).before('<div class="mean-push" />'),jQuery(".mean-push").css("margin-top",c),jQuery(e).hide(),jQuery(".meanmenu-reveal").show(),jQuery(".meanmenu-reveal").html(u),E=jQuery(".meanmenu-reveal"),jQuery(".mean-nav ul").hide(),v?h?(jQuery(".mean-nav ul ul").each(function(){jQuery(this).children().length&&jQuery(this,"li:first").parent().append('<a class="mean-expand" href="#" style="font-size: '+i+'">'+d+"</a>")}),jQuery(".mean-expand").on("click",function(e){e.preventDefault(),jQuery(this).hasClass("mean-clicked")?(jQuery(this).text(d),jQuery(this).prev("ul").slideUp(300,function(){})):(jQuery(this).text(y),jQuery(this).prev("ul").slideDown(300,function(){})),jQuery(this).toggleClass("mean-clicked")})):jQuery(".mean-nav ul ul").show():jQuery(".mean-nav ul ul").hide(),jQuery(".mean-nav ul li").last().addClass("mean-last"),E.removeClass("meanclose"),jQuery(E).click(function(e){e.preventDefault(),!1===x?(E.css("text-align","center"),E.css("text-indent","0"),E.css("font-size",i),jQuery(".mean-nav ul:first").slideDown(),x=!0):(jQuery(".mean-nav ul:first").slideUp(),x=!1),E.toggleClass("meanclose"),M(),jQuery(g).addClass("mean-remove")}),Q&&jQuery(".mean-nav ul > li > a:first-child").on("click",function(){jQuery(".mean-nav ul:first").slideUp(),x=!1,jQuery(E).toggleClass("meanclose").html(u)})}else P()};p||jQuery(window).resize(function(){t=window.innerWidth||document.documentElement.clientWidth,P(),t<=o?(W(),w()):P()}),jQuery(window).resize(function(){t=window.innerWidth||document.documentElement.clientWidth,p?(w(),t<=o?!1===A&&W():P()):(P(),t<=o&&(W(),w()))}),W()})}}(jQuery);
4,034
4,034
0.70476
1031e385d0a666d7b0be96151bd27994f793f9a4
2,482
js
JavaScript
temperature/temperature.js
iluque95/m365dashboard_api
900f2b0e11647c2f402fe7f47d7792ec2e427073
[ "MIT" ]
null
null
null
temperature/temperature.js
iluque95/m365dashboard_api
900f2b0e11647c2f402fe7f47d7792ec2e427073
[ "MIT" ]
null
null
null
temperature/temperature.js
iluque95/m365dashboard_api
900f2b0e11647c2f402fe7f47d7792ec2e427073
[ "MIT" ]
null
null
null
module.exports = (temperatureModel) => { class Temperature { async create(params) { return new Promise(async (resolve, reject) => { try { // validacion: if (!params.km) throw new Error('El km es obligatorio') //params.creationDate = this.formatDate(params.creationDate) let model = new temperatureModel(params) let response = await model.save() resolve(response) } catch (e) { reject(e) } }) } async get() { return new Promise(async (resolve, reject) => { try { let list = await temperatureModel.find() resolve(list) } catch (e) { reject(e) } }) } async get_by_id(id) { return new Promise(async (resolve, reject) => { try { let list if (id.length == 24) list = await temperatureModel.findById(id) else list = await temperatureModel.findOne({ serial: id }) } catch (e) { reject(e) } }) } formatDate(date) { return new Date(date) } async update(id, params) { return new Promise(async (resolve, reject) => { try { let list if (id.length == 24) list = await temperatureModel.findByIdAndUpdate(id, params) else list = await temperatureModel.findOneAndUpdate({ serial: id }, params) resolve(doc) } catch (e) { reject(e) } }) } async delete(id) { return new Promise(async (resolve, reject) => { try { if (id.length == 24) doc = await temperatureModel.findByIdAndDelete(id) else doc = await temperatureModel.findOneAndDelete({ serial: id }) resolve(doc) } catch (e) { reject(e) } }) } } return new Temperature() }
29.547619
94
0.398066
10336ce4e464e253957a4605d57fc13c44a367dc
2,522
js
JavaScript
src/coc/ComponentButtons.js
oricis/JS-UI
376b659262991f91f95e2b33260f96ba165f8d52
[ "MIT" ]
null
null
null
src/coc/ComponentButtons.js
oricis/JS-UI
376b659262991f91f95e2b33260f96ba165f8d52
[ "MIT" ]
null
null
null
src/coc/ComponentButtons.js
oricis/JS-UI
376b659262991f91f95e2b33260f96ba165f8d52
[ "MIT" ]
null
null
null
console.log('Loaded ./coc/ComponentButtons.js'); // HACK: class ComponentButtons extends BaseComponent { ACCEPT_BUTTON_SELECTOR = 'button[data-action="accept"]'; CANCEL_BUTTON_SELECTOR = 'button[data-action="cancel"]'; constructor(componentSelector, acceptButtonSelector, cancelButtonSelector) // void { this.COMPONENT_SELECTOR = componentSelector; if (acceptButtonSelector) { this.ACCEPT_BUTTON_SELECTOR = acceptButtonSelector; } if (cancelButtonSelector) { this.CANCEL_BUTTON_SELECTOR = cancelButtonSelector; } } getAcceptButtonNode() // js node { return qs(this.COMPONENT_SELECTOR + ' ' + this.ACCEPT_BUTTON_SELECTOR); } getCancelButtonNode() // js node { return qs(this.COMPONENT_SELECTOR + ' ' + this.CANCEL_BUTTON_SELECTOR); } handleAcceptButtonActivation(callback, callbackParams, confirmMessage = '') // void { const buttonNode = this.getAcceptButtonNode(); if (!buttonNode) { return; } buttonNode.addEventListener('click', function (ev) // void { ev.preventDefault(); if (confirmMessage && !confirm(confirmMessage)) { return; } enable(buttonNode); if (callback) { callback(callbackParams); } }); } handleCancelButtonActivation(callback, callbackParams, confirmMessage = '') // void { const buttonNode = this.getCancelButtonNode(); if (!buttonNode) { return; } buttonNode.addEventListener('click', function (ev) // void { ev.preventDefault(); if (confirmMessage && !confirm(confirmMessage)) { return; } disable(buttonNode); if (callback) { callback(callbackParams); } }); } handleRelatedButtonsGroup(groupSelectorOrNodes, callback, callbackParams) // void { const buttonNodes = getNodes(groupSelectorOrNodes); if (buttonNodes.length) { buttonNodes.forEach(buttonNode => // void { buttonNode.addEventListener('click', function (ev) // void { ev.preventDefault(); if (callback) { callback(callbackParams); } }); }); } } }
27.714286
87
0.551546
1033aa20bd4ed5b353261e5b493697a6f2232c1e
2,408
js
JavaScript
src/router/index.js
cvv123456/vue-admin
47bba1f185f17c64e674ef5cdd3ca1ced087b365
[ "MIT" ]
1
2020-07-28T07:36:53.000Z
2020-07-28T07:36:53.000Z
src/router/index.js
cvv123456/vue-admin
47bba1f185f17c64e674ef5cdd3ca1ced087b365
[ "MIT" ]
null
null
null
src/router/index.js
cvv123456/vue-admin
47bba1f185f17c64e674ef5cdd3ca1ced087b365
[ "MIT" ]
null
null
null
import Vue from 'vue' import Router from 'vue-router' Vue.use(Router) // /* Layout */ import Layout from '@/layout' const router=new Router({ mode:"history", routes:[ { path: '/', component: Layout, redirect: '/origanizational', children: [{ path: 'origanizational', name: 'origanizational', component: () => import('@/views/Organizational/index'), meta: { title: '组织架构', icon: '404'} }] }, { path: '/404', component: () => import('@/views/404'), hidden: true }, // { // path: '/register', // component: () => import('@/views/Register/register'), // hidden: true // }, //乐播平台注册 { path: '/register', component: () => import('@/views/Register/register'), hidden:true }, //权限组 { path: '/', component: Layout, redirect: '/PermissionGroup', children: [{ path: 'PermissionGroup', name: 'PermissionGroup', component: () => import('@/views/PermissionGroup/index'), meta: { title: '权限组'} }] }, //权限管理 { path: '/', component: Layout, redirect: '/PermissionManager', children: [{ path: 'PermissionManager', name: 'PermissionManager', component: () => import('@/views/PermissionManager/index'), meta: { title: '权限'} }] }, //集团 { path: '/', component: Layout, redirect: '/BlocGroup', children: [{ path: 'BlocGroup', name: 'BlocGroup', component: () => import('@/views/BlocGroup/index'), meta: { title: '集团'} }] }, //集团业态产品 { path: '/', component: Layout, redirect: '/ProductGroup', children: [{ path: 'ProductGroup', name: 'ProductGroup', component: () => import('@/views/ProductGroup/index'), meta: { title: '集团业态产品'} }], hidden:true }, //集团门店 { path: '/', component: Layout, redirect: '/Storeshop', children: [{ path: 'Storeshop', name: 'Storeshop', component: () => import('@/views/ProductGroup/Storeshop'), meta: { title: '集团门店'} }], hidden:true }, // 404 page must be placed at the end !!! { path: '*', redirect: '/404', hidden: true } ] }) export default router
22.716981
67
0.495847
1033adf5adb70311275904e8ae111e1972a83d0b
1,285
js
JavaScript
node_modules/@rimble/icons/es/md/MicNone.js
astarinmymind/decentralizedbounty
8f285ba864f80e5bbb5f5cdf2f7f3f26f1de4d76
[ "MIT" ]
5
2021-02-08T20:51:36.000Z
2022-01-21T05:29:48.000Z
node_modules/@rimble/icons/es/md/MicNone.js
astarinmymind/decentralizedbounty
8f285ba864f80e5bbb5f5cdf2f7f3f26f1de4d76
[ "MIT" ]
6
2019-12-05T19:53:24.000Z
2020-02-21T20:31:41.000Z
node_modules/@rimble/icons/es/md/MicNone.js
astarinmymind/decentralizedbounty
8f285ba864f80e5bbb5f5cdf2f7f3f26f1de4d76
[ "MIT" ]
7
2021-02-08T20:51:40.000Z
2021-10-31T11:25:45.000Z
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } import * as React from "react"; import styled from "styled-components"; import { space, color } from "styled-system"; var Svg = styled("svg")({ flex: "none" }, space, color); var SvgMicNone = React.forwardRef(function (props, ref) { return React.createElement(Svg, _extends({}, props, { viewBox: "0 0 24 24", height: props.size, width: props.size, fill: "currentcolor", ref: ref }), React.createElement("path", { d: "M12 14c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm-1.2-9.1c0-.66.54-1.2 1.2-1.2.66 0 1.2.54 1.2 1.2l-.01 6.2c0 .66-.53 1.2-1.19 1.2-.66 0-1.2-.54-1.2-1.2V4.9zm6.5 6.1c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.48 6-3.3 6-6.72h-1.7z" }), React.createElement("path", { d: "M0 0h24v24H0z", fill: "none" })); }); SvgMicNone.displayName = "SvgMicNone"; SvgMicNone.defaultProps = { size: 24, color: "inherit" }; export default SvgMicNone;
45.892857
317
0.645914
1033d418df1d54529f61ba26e63da15c32a663a0
521
js
JavaScript
JS WEB/Papazov qnuari 2021/React-My-Pets/client/src/components/Footer/Footer.js
nikindtmas1/SoftUni---Software---Engineering
f24d5893016450470301ee82134b678beae71b20
[ "MIT" ]
null
null
null
JS WEB/Papazov qnuari 2021/React-My-Pets/client/src/components/Footer/Footer.js
nikindtmas1/SoftUni---Software---Engineering
f24d5893016450470301ee82134b678beae71b20
[ "MIT" ]
1
2022-01-02T23:06:28.000Z
2022-01-02T23:06:28.000Z
JS WEB/Papazov qnuari 2021/React-My-Pets/client/src/components/Footer/Footer.js
nikindtmas1/SoftUni-Software-Engineering
955adc8eb457dde0745590db5dcd6e7f79a8ebc2
[ "MIT" ]
null
null
null
const Footer = () => { return ( <footer id="site-footer"> <p>@PetMyPet</p> <style jsx>{` footer { margin-top: auto; text-align: center; background: #234465; } footer p { padding: 1rem 0; font-weight: bold; margin: 0rem; color: white; } `}</style> </footer> ) } export default Footer;
19.296296
36
0.357006
10345f7fb71599ae678115f9d245da0e15e0126d
4,962
js
JavaScript
src/svgPath/a2c.js
hamger/cvs
594d9221e39d104915c532ffd7b04cfc28e9a3ab
[ "MIT" ]
2
2018-10-16T06:45:04.000Z
2019-01-09T08:20:39.000Z
src/svgPath/a2c.js
hamger/cvs
594d9221e39d104915c532ffd7b04cfc28e9a3ab
[ "MIT" ]
null
null
null
src/svgPath/a2c.js
hamger/cvs
594d9221e39d104915c532ffd7b04cfc28e9a3ab
[ "MIT" ]
3
2018-09-11T07:06:17.000Z
2018-09-17T12:14:09.000Z
// https://github.com/colinmeinke/svg-arc-to-cubic-bezier // // Convert an arc to a sequence of cubic bézier curves // /* eslint-disable */ const TAU = Math.PI * 2 /* eslint-disable space-infix-ops */ // Calculate an angle between two unit vectors // // Since we measure angle between radii of circular arcs, // we can use simplified math (without length normalization) // function unit_vector_angle (ux, uy, vx, vy) { const sign = ux * vy - uy * vx < 0 ? -1 : 1 let dot = ux * vx + uy * vy // Add this to work with arbitrary vectors: // dot /= Math.sqrt(ux * ux + uy * uy) * Math.sqrt(vx * vx + vy * vy); // rounding errors, e.g. -1.0000000000000002 can screw up this if (dot > 1.0) { dot = 1.0 } if (dot < -1.0) { dot = -1.0 } return sign * Math.acos(dot) } // Convert from endpoint to center parameterization, // see http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes // // Return [cx, cy, theta1, delta_theta] // function get_arc_center (x1, y1, x2, y2, fa, fs, rx, ry, sin_phi, cos_phi) { // Step 1. // // Moving an ellipse so origin will be the middlepoint between our two // points. After that, rotate it to line up ellipse axes with coordinate // axes. // const x1p = (cos_phi * (x1 - x2)) / 2 + (sin_phi * (y1 - y2)) / 2 const y1p = (-sin_phi * (x1 - x2)) / 2 + (cos_phi * (y1 - y2)) / 2 const rx_sq = rx * rx const ry_sq = ry * ry const x1p_sq = x1p * x1p const y1p_sq = y1p * y1p // Step 2. // // Compute coordinates of the centre of this ellipse (cx', cy') // in the new coordinate system. // let radicant = rx_sq * ry_sq - rx_sq * y1p_sq - ry_sq * x1p_sq if (radicant < 0) { // due to rounding errors it might be e.g. -1.3877787807814457e-17 radicant = 0 } radicant /= rx_sq * y1p_sq + ry_sq * x1p_sq radicant = Math.sqrt(radicant) * (fa === fs ? -1 : 1) const cxp = ((radicant * rx) / ry) * y1p const cyp = ((radicant * -ry) / rx) * x1p // Step 3. // // Transform back to get centre coordinates (cx, cy) in the original // coordinate system. // const cx = cos_phi * cxp - sin_phi * cyp + (x1 + x2) / 2 const cy = sin_phi * cxp + cos_phi * cyp + (y1 + y2) / 2 // Step 4. // // Compute angles (theta1, delta_theta). // const v1x = (x1p - cxp) / rx const v1y = (y1p - cyp) / ry const v2x = (-x1p - cxp) / rx const v2y = (-y1p - cyp) / ry const theta1 = unit_vector_angle(1, 0, v1x, v1y) let delta_theta = unit_vector_angle(v1x, v1y, v2x, v2y) if (fs === 0 && delta_theta > 0) { delta_theta -= TAU } if (fs === 1 && delta_theta < 0) { delta_theta += TAU } return [cx, cy, theta1, delta_theta] } // // Approximate one unit arc segment with bézier curves, // see http://math.stackexchange.com/questions/873224 // function approximate_unit_arc (theta1, delta_theta) { const alpha = (4 / 3) * Math.tan(delta_theta / 4) const x1 = Math.cos(theta1) const y1 = Math.sin(theta1) const x2 = Math.cos(theta1 + delta_theta) const y2 = Math.sin(theta1 + delta_theta) return [ x1, y1, x1 - y1 * alpha, y1 + x1 * alpha, x2 + y2 * alpha, y2 - x2 * alpha, x2, y2 ] } export default function a2c (x1, y1, x2, y2, fa, fs, rx, ry, phi) { const sin_phi = Math.sin((phi * TAU) / 360) const cos_phi = Math.cos((phi * TAU) / 360) // Make sure radii are valid // const x1p = (cos_phi * (x1 - x2)) / 2 + (sin_phi * (y1 - y2)) / 2 const y1p = (-sin_phi * (x1 - x2)) / 2 + (cos_phi * (y1 - y2)) / 2 if (x1p === 0 && y1p === 0) { // we're asked to draw line to itself return [] } if (rx === 0 || ry === 0) { // one of the radii is zero return [] } // Compensate out-of-range radii // rx = Math.abs(rx) ry = Math.abs(ry) const lambda = (x1p * x1p) / (rx * rx) + (y1p * y1p) / (ry * ry) if (lambda > 1) { rx *= Math.sqrt(lambda) ry *= Math.sqrt(lambda) } // Get center parameters (cx, cy, theta1, delta_theta) // const cc = get_arc_center(x1, y1, x2, y2, fa, fs, rx, ry, sin_phi, cos_phi) const result = [] let theta1 = cc[2] let delta_theta = cc[3] // Split an arc to multiple segments, so each segment // will be less than τ/4 (= 90°) // const segments = Math.max(Math.ceil(Math.abs(delta_theta) / (TAU / 4)), 1) delta_theta /= segments for (let i = 0; i < segments; i++) { result.push(approximate_unit_arc(theta1, delta_theta)) theta1 += delta_theta } // We have a bezier approximation of a unit circle, // now need to transform back to the original ellipse // return result.map(curve => { for (let i = 0; i < curve.length; i += 2) { let x = curve[i + 0] let y = curve[i + 1] // scale x *= rx y *= ry // rotate const xp = cos_phi * x - sin_phi * y const yp = sin_phi * x + cos_phi * y // translate curve[i + 0] = xp + cc[0] curve[i + 1] = yp + cc[1] } return curve }) }
25.060606
77
0.585852
10346a50f3e9aa69507a9cb407b10a4e48091d31
339
js
JavaScript
src/shader-impl/ray-tracing.js
HeGanjie/ash-engine
89f1e85a052359adf4336a90f843474441797056
[ "MIT" ]
1
2021-09-02T09:48:39.000Z
2021-09-02T09:48:39.000Z
src/shader-impl/ray-tracing.js
HeGanjie/ash-engine
89f1e85a052359adf4336a90f843474441797056
[ "MIT" ]
null
null
null
src/shader-impl/ray-tracing.js
HeGanjie/ash-engine
89f1e85a052359adf4336a90f843474441797056
[ "MIT" ]
null
null
null
import rayTracingVert from '../shader-snippets/ray-tracing.vert' import rayTracingFrag from '../shader-snippets/ray-tracing.frag' export const rayTracingShaderImpl = { genUniforms: material => { // const {kS} = material return { // u_ks: kS } }, vert: rayTracingVert, frag: rayTracingFrag }
18.833333
65
0.640118
10347f90a5cbdf97c6001da077818a6faeea3fcf
6,888
js
JavaScript
src/verror.js
GiorgioRegni/jsutils
1406681895e44c1cad9f9ec1a68bd6547ce44e61
[ "Apache-2.0" ]
null
null
null
src/verror.js
GiorgioRegni/jsutils
1406681895e44c1cad9f9ec1a68bd6547ce44e61
[ "Apache-2.0" ]
null
null
null
src/verror.js
GiorgioRegni/jsutils
1406681895e44c1cad9f9ec1a68bd6547ce44e61
[ "Apache-2.0" ]
null
null
null
/* * verror.js: richer JavaScript errors */ var mod_assert = require('assert'); var mod_util = require('util'); var mod_extsprintf = require('extsprintf'); /* * Public interface */ /* So you can 'var VError = require('verror')' */ module.exports = VError; /* For compatibility */ VError.VError = VError; /* Other exported classes */ VError.SError = SError; VError.WError = WError; VError.MultiError = MultiError; /* * VError([cause], fmt[, arg...]): Like JavaScript's built-in Error class, but * supports a "cause" argument (another error) and a printf-style message. The * cause argument can be null or omitted entirely. * * Examples: * * CODE MESSAGE * new VError('something bad happened') "something bad happened" * new VError('missing file: "%s"', file) "missing file: "/etc/passwd" * with file = '/etc/passwd' * new VError(err, 'open failed') "open failed: file not found" * with err.message = 'file not found' */ function VError(options) { var args, obj, causedBy, ctor, tailmsg; /* * This is a regrettable pattern, but JavaScript's built-in Error class * is defined to work this way, so we allow the constructor to be called * without "new". */ if (!(this instanceof VError)) { args = Array.prototype.slice.call(arguments, 0); obj = Object.create(VError.prototype); VError.apply(obj, arguments); return (obj); } if (options instanceof Error || typeof (options) === 'object') { args = Array.prototype.slice.call(arguments, 1); } else { args = Array.prototype.slice.call(arguments, 0); options = undefined; } /* * extsprintf (which we invoke here with our caller's arguments in order * to construct this Error's message) is strict in its interpretation of * values to be processed by the "%s" specifier. The value passed to * extsprintf must actually be a string or something convertible to a * String using .toString(). Passing other values (notably "null" and * "undefined") is considered a programmer error. The assumption is * that if you actually want to print the string "null" or "undefined", * then that's easy to do that when you're calling extsprintf; on the * other hand, if you did NOT want that (i.e., there's actually a bug * where the program assumes some variable is non-null and tries to * print it, which might happen when constructing a packet or file in * some specific format), then it's better to stop immediately than * produce bogus output. * * However, sometimes the bug is only in the code calling VError, and a * programmer might prefer to have the error message contain "null" or * "undefined" rather than have the bug in the error path crash the * program (making the first bug harder to identify). For that reason, * by default VError converts "null" or "undefined" arguments to their * string representations and passes those to extsprintf. Programmers * desiring the strict behavior can use the SError class or pass the * "strict" option to the VError constructor. */ if (!options || !options.strict) { args = args.map(function (a) { return (a === null ? 'null' : a === undefined ? 'undefined' : a); }); } tailmsg = args.length > 0 ? mod_extsprintf.sprintf.apply(null, args) : ''; this.message = tailmsg; if (options) { causedBy = options.cause; if (!causedBy || !(options.cause instanceof Error)) causedBy = options; if (causedBy && (causedBy instanceof Error)) { this.jse_cause = causedBy; this.message += ': ' + causedBy.message; } } Error.call(this, this.message); if (Error.captureStackTrace) { ctor = options ? options.constructorOpt : undefined; ctor = ctor || arguments.callee; Error.captureStackTrace(this, ctor); } return (this); } mod_util.inherits(VError, Error); VError.prototype.name = 'VError'; VError.prototype.toString = function ve_toString() { var str = (this.hasOwnProperty('name') && this.name || this.constructor.name || this.constructor.prototype.name); if (this.message) str += ': ' + this.message; return (str); }; VError.prototype.cause = function ve_cause() { return (this.jse_cause); }; /* * SError is like VError, but stricter about types. You cannot pass "null" or * "undefined" as string arguments to the formatter. Since SError is only a * different function, not really a different class, we don't set * SError.prototype.name. */ function SError() { var fmtargs, opts, key, args; opts = {}; opts.constructorOpt = SError; if (arguments[0] instanceof Error) { opts.cause = arguments[0]; fmtargs = Array.prototype.slice.call(arguments, 1); } else if (typeof (arguments[0]) == 'object') { for (key in arguments[0]) opts[key] = arguments[0][key]; fmtargs = Array.prototype.slice.call(arguments, 1); } else { fmtargs = Array.prototype.slice.call(arguments, 0); } opts.strict = true; args = [ opts ].concat(fmtargs); VError.apply(this, args); } mod_util.inherits(SError, VError); /* * Represents a collection of errors for the purpose of consumers that generally * only deal with one error. Callers can extract the individual errors * contained in this object, but may also just treat it as a normal single * error, in which case a summary message will be printed. */ function MultiError(errors) { mod_assert.ok(errors.length > 0); this.ase_errors = errors; VError.call(this, errors[0], 'first of %d error%s', errors.length, errors.length == 1 ? '' : 's'); } mod_util.inherits(MultiError, VError); /* * Like JavaScript's built-in Error class, but supports a "cause" argument which * is wrapped, not "folded in" as with VError. Accepts a printf-style message. * The cause argument can be null. */ function WError(options) { Error.call(this); var args, cause, ctor; if (typeof (options) === 'object') { args = Array.prototype.slice.call(arguments, 1); } else { args = Array.prototype.slice.call(arguments, 0); options = undefined; } if (args.length > 0) { this.message = mod_extsprintf.sprintf.apply(null, args); } else { this.message = ''; } if (options) { if (options instanceof Error) { cause = options; } else { cause = options.cause; ctor = options.constructorOpt; } } Error.captureStackTrace(this, ctor || this.constructor); if (cause) this.cause(cause); } mod_util.inherits(WError, Error); WError.prototype.name = 'WError'; WError.prototype.toString = function we_toString() { var str = (this.hasOwnProperty('name') && this.name || this.constructor.name || this.constructor.prototype.name); if (this.message) str += ': ' + this.message; if (this.we_cause && this.we_cause.message) str += '; caused by ' + this.we_cause.toString(); return (str); }; WError.prototype.cause = function we_cause(c) { if (c instanceof Error) this.we_cause = c; return (this.we_cause); };
27.774194
80
0.684959
10348288658686ec3438f4cb54d1144ce0dcc823
478
js
JavaScript
src/context/ThemeContext.js
mrcMesen/CoffeeShop_RN_SysCo
9aa2ea70bac8137e5e22f08a159bd8dfbd8f2db5
[ "MIT" ]
null
null
null
src/context/ThemeContext.js
mrcMesen/CoffeeShop_RN_SysCo
9aa2ea70bac8137e5e22f08a159bd8dfbd8f2db5
[ "MIT" ]
null
null
null
src/context/ThemeContext.js
mrcMesen/CoffeeShop_RN_SysCo
9aa2ea70bac8137e5e22f08a159bd8dfbd8f2db5
[ "MIT" ]
1
2021-05-14T00:51:44.000Z
2021-05-14T00:51:44.000Z
import React, { createContext, useState } from "react"; export const ThemeContext = createContext(); const ThemeLight = { palette: { primary: "#239b56", secondary: "#7e5109", ligth: "#DBC2AF", cancel: "#e70012", }, }; export const ThemeProvider = ({ children }) => { const [theme, setTheme] = useState(ThemeLight); return ( <ThemeContext.Provider value={{ theme, }} > {children} </ThemeContext.Provider> ); };
17.703704
55
0.589958
10348dde5408147d60fba83a434d6f316eff6e00
10,733
js
JavaScript
src/main/webapp/static/jquery-validation/1.11.0/additional-methods.min.js
zhaozh2/companyhome
e87db907f4aa1d5058bb559e80e69bc873efc31c
[ "Apache-2.0" ]
null
null
null
src/main/webapp/static/jquery-validation/1.11.0/additional-methods.min.js
zhaozh2/companyhome
e87db907f4aa1d5058bb559e80e69bc873efc31c
[ "Apache-2.0" ]
8
2020-09-09T19:50:23.000Z
2022-02-01T01:02:39.000Z
src/main/webapp/static/jquery-validation/1.11.0/additional-methods.min.js
zhaozh2/companyhome
e87db907f4aa1d5058bb559e80e69bc873efc31c
[ "Apache-2.0" ]
3
2020-03-01T02:54:02.000Z
2022-01-08T11:29:18.000Z
/*! jQuery Validation Plugin - v1.11.0 - 2/4/2013 * https://github.com/jzaefferer/jquery-validation * Copyright (c) 2013 Jörn Zaefferer; Licensed MIT */ (function(){function e(e){return e.replace(/<.[^<>]*?>/g," ").replace(/&nbsp;|&#160;/gi," ").replace(/[.(),;:!?%#$'"_+=\/\-]*/g,"")}jQuery.validator.addMethod("maxWords",function(t,n,r){return this.optional(n)||e(t).match(/\b\w+\b/g).length<=r},jQuery.validator.format("Please enter {0} words or less.")),jQuery.validator.addMethod("minWords",function(t,n,r){return this.optional(n)||e(t).match(/\b\w+\b/g).length>=r},jQuery.validator.format("Please enter at least {0} words.")),jQuery.validator.addMethod("rangeWords",function(t,n,r){var i=e(t),s=/\b\w+\b/g;return this.optional(n)||i.match(s).length>=r[0]&&i.match(s).length<=r[1]},jQuery.validator.format("Please enter between {0} and {1} words."))})(),jQuery.validator.addMethod("letterswithbasicpunc",function(e,t){return this.optional(t)||/^[a-z\-.,()'"\s]+$/i.test(e)},"Letters or punctuation only please"),jQuery.validator.addMethod("alphanumeric",function(e,t){return this.optional(t)||/^\w+$/i.test(e)},"Letters, numbers, and underscores only please"),jQuery.validator.addMethod("lettersonly",function(e,t){return this.optional(t)||/^[a-z]+$/i.test(e)},"Letters only please"),jQuery.validator.addMethod("nowhitespace",function(e,t){return this.optional(t)||/^\S+$/i.test(e)},"No white space please"),jQuery.validator.addMethod("ziprange",function(e,t){return this.optional(t)||/^90[2-5]\d\{2\}-\d{4}$/.test(e)},"Your ZIP-code must be in the range 902xx-xxxx to 905-xx-xxxx"),jQuery.validator.addMethod("zipcodeUS",function(e,t){return this.optional(t)||/\d{5}-\d{4}$|^\d{5}$/.test(e)},"The specified US ZIP Code is invalid"),jQuery.validator.addMethod("integer",function(e,t){return this.optional(t)||/^-?\d+$/.test(e)},"A positive or negative non-decimal number please"),jQuery.validator.addMethod("vinUS",function(e){if(e.length!==17)return!1;var t,n,r,i,s,o,u=["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"],a=[1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9],f=[8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2],l=0;for(t=0;t<17;t++){i=f[t],r=e.slice(t,t+1),t===8&&(o=r);if(!isNaN(r))r*=i;else for(n=0;n<u.length;n++)if(r.toUpperCase()===u[n]){r=a[n],r*=i,isNaN(o)&&n===8&&(o=u[n]);break}l+=r}return s=l%11,s===10&&(s="X"),s===o?!0:!1},"The specified vehicle identification number (VIN) is invalid."),jQuery.validator.addMethod("dateITA",function(e,t){var n=!1,r=/^\d{1,2}\/\d{1,2}\/\d{4}$/;if(r.test(e)){var i=e.split("/"),s=parseInt(i[0],10),o=parseInt(i[1],10),u=parseInt(i[2],10),a=new Date(u,o-1,s);a.getFullYear()===u&&a.getMonth()===o-1&&a.getDate()===s?n=!0:n=!1}else n=!1;return this.optional(t)||n},"Please enter a correct date"),jQuery.validator.addMethod("dateNL",function(e,t){return this.optional(t)||/^(0?[1-9]|[12]\d|3[01])[\.\/\-](0?[1-9]|1[012])[\.\/\-]([12]\d)?(\d\d)$/.test(e)},"Vul hier een geldige datum in."),jQuery.validator.addMethod("time",function(e,t){return this.optional(t)||/^([01]\d|2[0-3])(:[0-5]\d){1,2}$/.test(e)},"Please enter a valid time, between 00:00 and 23:59"),jQuery.validator.addMethod("time12h",function(e,t){return this.optional(t)||/^((0?[1-9]|1[012])(:[0-5]\d){1,2}( ?[AP]M))$/i.test(e)},"Please enter a valid time in 12-hour format"),jQuery.validator.addMethod("phoneUS",function(e,t){return e=e.replace(/\s+/g,""),this.optional(t)||e.length>9&&e.match(/^(\+?1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/)},"Please specify a valid phone number"),jQuery.validator.addMethod("phoneUK",function(e,t){return e=e.replace(/\(|\)|\s+|-/g,""),this.optional(t)||e.length>9&&e.match(/^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:(?:\d{5}\)?\s?\d{4,5})|(?:\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3}))|(?:\d{3}\)?\s?\d{3}\s?\d{3,4})|(?:\d{2}\)?\s?\d{4}\s?\d{4}))$/)},"Please specify a valid phone number"),jQuery.validator.addMethod("mobileUK",function(e,t){return e=e.replace(/\s+|-/g,""),this.optional(t)||e.length>9&&e.match(/^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[45789]\d{2}|624)\s?\d{3}\s?\d{3})$/)},"Please specify a valid mobile number"),jQuery.validator.addMethod("phonesUK",function(e,t){return e=e.replace(/\s+|-/g,""),this.optional(t)||e.length>9&&e.match(/^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[45789]\d{8}|624\d{6})))$/)},"Please specify a valid uk phone number"),jQuery.validator.addMethod("postcodeUK",function(e,t){return e=e.toUpperCase().replace(/\s+/g,""),this.optional(t)||e.match(/^([^QZ][^IJZ]{0,1}\d{1,2})(\d[^CIKMOV]{2})$/)||e.match(/^([^QV]\d[ABCDEFGHJKSTUW])(\d[^CIKMOV]{2})$/)||e.match(/^([^QV][^IJZ]\d[ABEHMNPRVWXY])(\d[^CIKMOV]{2})$/)||e.match(/^(GIR)(0AA)$/)||e.match(/^(BFPO)(\d{1,4})$/)||e.match(/^(BFPO)(C\/O\d{1,3})$/)},"Please specify a valid postcode"),jQuery.validator.addMethod("strippedminlength",function(e,t,n){return jQuery(e).text().length>=n},jQuery.validator.format("Please enter at least {0} characters")),jQuery.validator.addMethod("email2",function(e,t,n){return this.optional(t)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(e)},jQuery.validator.messages.email),jQuery.validator.addMethod("url2",function(e,t,n){return this.optional(t)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(e)},jQuery.validator.messages.url),jQuery.validator.addMethod("creditcardtypes",function(e,t,n){if(/[^0-9\-]+/.test(e))return!1;e=e.replace(/\D/g,"");var r=0;return n.mastercard&&(r|=1),n.visa&&(r|=2),n.amex&&(r|=4),n.dinersclub&&(r|=8),n.enroute&&(r|=16),n.discover&&(r|=32),n.jcb&&(r|=64),n.unknown&&(r|=128),n.all&&(r=255),r&1&&/^(5[12345])/.test(e)?e.length===16:r&2&&/^(4)/.test(e)?e.length===16:r&4&&/^(3[47])/.test(e)?e.length===15:r&8&&/^(3(0[012345]|[68]))/.test(e)?e.length===14:r&16&&/^(2(014|149))/.test(e)?e.length===15:r&32&&/^(6011)/.test(e)?e.length===16:r&64&&/^(3)/.test(e)?e.length===16:r&64&&/^(2131|1800)/.test(e)?e.length===15:r&128?!0:!1},"Please enter a valid credit card number."),jQuery.validator.addMethod("ipv4",function(e,t,n){return this.optional(t)||/^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/i.test(e)},"Please enter a valid IP v4 address."),jQuery.validator.addMethod("ipv6",function(e,t,n){return this.optional(t)||/^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i.test(e)},"Please enter a valid IP v6 address."),jQuery.validator.addMethod("pattern",function(e,t,n){return this.optional(t)?!0:(typeof n=="string"&&(n=new RegExp("^(?:"+n+")$")),n.test(e))},"Invalid format."),jQuery.validator.addMethod("require_from_group",function(e,t,n){var r=this,i=n[1],s=$(i,t.form).filter(function(){return r.elementValue(this)}).length>=n[0];if(!$(t).data("being_validated")){var o=$(i,t.form);o.data("being_validated",!0),o.valid(),o.data("being_validated",!1)}return s},jQuery.format("Please fill at least {0} of these fields.")),jQuery.validator.addMethod("skip_or_fill_minimum",function(e,t,n){var r=this,i=n[0],s=n[1],o=$(s,t.form).filter(function(){return r.elementValue(this)}).length,u=o>=i||o===0;if(!$(t).data("being_validated")){var a=$(s,t.form);a.data("being_validated",!0),a.valid(),a.data("being_validated",!1)}return u},jQuery.format("Please either skip these fields or fill at least {0} of them.")),jQuery.validator.addMethod("accept",function(e,t,n){var r=typeof n=="string"?n.replace(/\s/g,"").replace(/,/g,"|"):"image/*",i=this.optional(t),s,o;if(i)return i;if($(t).attr("type")==="file"){r=r.replace(/\*/g,".*");if(t.files&&t.files.length)for(s=0;s<t.files.length;s++){o=t.files[s];if(!o.type.match(new RegExp(".?("+r+")$","i")))return!1}}return!0},jQuery.format("Please enter a value with a valid mimetype.")),jQuery.validator.addMethod("extension",function(e,t,n){return n=typeof n=="string"?n.replace(/,/g,"|"):"png|jpe?g|gif",this.optional(t)||e.match(new RegExp(".("+n+")$","i"))},jQuery.format("Please enter a value with a valid extension."));
2,683.25
10,577
0.584739
1035302dcd08b2b3ac655daa90c1bd7dcf328e8b
5,156
js
JavaScript
frontend/src/modules/iam/iamService.js
landeddeveloper/idpt
1d051ffd428e85b7a04df2b73d0d3633b9931264
[ "MIT" ]
23
2020-07-13T01:47:33.000Z
2021-11-09T15:22:43.000Z
frontend/src/modules/iam/iamService.js
landeddeveloper/idpt
1d051ffd428e85b7a04df2b73d0d3633b9931264
[ "MIT" ]
30
2020-07-08T09:52:14.000Z
2022-03-08T23:38:24.000Z
frontend/src/modules/iam/iamService.js
landeddeveloper/idpt
1d051ffd428e85b7a04df2b73d0d3633b9931264
[ "MIT" ]
5
2020-08-19T12:00:34.000Z
2021-03-02T08:21:38.000Z
import gql from 'graphql-tag'; import graphqlClient from 'modules/shared/graphql/graphqlClient'; export default class IamService { static async enable(ids) { return this._changeStatus(ids, false); } static async disable(ids) { return this._changeStatus(ids, true); } static async _changeStatus(ids, disabled) { const response = await graphqlClient.mutate({ mutation: gql` mutation IAM_CHANGE_STATUS( $ids: [String!]! $disabled: Boolean ) { iamChangeStatus(ids: $ids, disabled: $disabled) } `, variables: { ids, disabled: !!disabled, }, }); return response.data.iamChangeStatus; } static async edit(data) { const response = await graphqlClient.mutate({ mutation: gql` mutation IAM_EDIT($data: IamEditInput!) { iamEdit(data: $data) } `, variables: { data, }, }); return response.data.iamEdit; } static async remove(emails, roles, all = false) { const response = await graphqlClient.mutate({ mutation: gql` mutation IAM_REMOVE( $emails: [String!]! $roles: [String!]! $all: Boolean ) { iamRemove( emails: $emails roles: $roles all: $all ) } `, variables: { emails, roles, all, }, }); return response.data.iamRemove; } static async create(data) { const response = await graphqlClient.mutate({ mutation: gql` mutation IAM_CREATE($data: IamCreateInput!) { iamCreate(data: $data) } `, variables: { data, }, }); return response.data.iamCreate; } static async import(values, importHash) { const response = await graphqlClient.mutate({ mutation: gql` mutation IAM_IMPORT( $data: IamImportInput! $importHash: String! ) { iamImport(data: $data, importHash: $importHash) } `, variables: { data: { ...values, }, importHash, }, }); return response.data.iamImport; } static async find(id) { const response = await graphqlClient.query({ query: gql` query IAM_FIND($id: String!) { iamFind(id: $id) { id fullName firstName lastName authenticationUid phoneNumber email roles createdAt updatedAt disabled avatars { id name sizeInBytes publicUrl privateUrl } patient { id name } } } `, variables: { id, }, }); return response.data.iamFind; } static async fetchUsers(filter, orderBy, limit, offset) { const response = await graphqlClient.query({ query: gql` query IAM_LIST_USERS( $filter: IamListUsersFilterInput $orderBy: UserWithRolesOrderByEnum $limit: Int $offset: Int ) { iamListUsers( filter: $filter orderBy: $orderBy limit: $limit offset: $offset ) { count rows { id fullName email phoneNumber avatars { id name sizeInBytes publicUrl privateUrl } disabled roles createdAt } } } `, variables: { filter, orderBy, limit, offset, }, }); return response.data.iamListUsers; } static async fetchRoles(filter, orderBy, limit, offset) { const response = await graphqlClient.query({ query: gql` query IAM_LIST_ROLES( $filter: IamListRolesFilterInput $orderBy: RoleWithUsersOrderByEnum ) { iamListRoles(filter: $filter, orderBy: $orderBy) { role users { id fullName email disabled createdAt } } } `, variables: { filter, orderBy, }, }); const rows = response.data.iamListRoles; return { rows, count: rows.length, }; } static async fetchUserAutocomplete(query, limit) { const response = await graphqlClient.query({ query: gql` query IAM_USER_AUTOCOMPLETE( $query: String $limit: Int ) { iamUserAutocomplete( query: $query limit: $limit ) { id label } } `, variables: { query, limit, }, }); return response.data.iamUserAutocomplete; } }
19.907336
65
0.474205
10355841fd91ed9a282d8fcbefb49a5524b1c960
947
js
JavaScript
static/html/classt4_1_1pdf_1_1_a_e_s_cryptor_holder.js
AdobeDocs/dc-testing
a69533527c3646ea8b0072b35df51ae50b07dae5
[ "Apache-2.0" ]
null
null
null
static/html/classt4_1_1pdf_1_1_a_e_s_cryptor_holder.js
AdobeDocs/dc-testing
a69533527c3646ea8b0072b35df51ae50b07dae5
[ "Apache-2.0" ]
9
2021-10-14T05:18:57.000Z
2022-03-10T05:39:14.000Z
static/html/classt4_1_1pdf_1_1_a_e_s_cryptor_holder.js
AdobeDocs/dc-testing
a69533527c3646ea8b0072b35df51ae50b07dae5
[ "Apache-2.0" ]
null
null
null
var classt4_1_1pdf_1_1_a_e_s_cryptor_holder = [ [ "AESCryptorHolder", "classt4_1_1pdf_1_1_a_e_s_cryptor_holder.html#aa9f8af4e37338beb559b7fcb03e41efc", null ], [ "AESCryptorHolder", "classt4_1_1pdf_1_1_a_e_s_cryptor_holder.html#a3bc96495ea6b8e4d6f0ce18dc5dc0c3e", null ], [ "AESCryptorHolder", "classt4_1_1pdf_1_1_a_e_s_cryptor_holder.html#a02dd72d51daf56a55d26faf617bb8616", null ], [ "~AESCryptorHolder", "classt4_1_1pdf_1_1_a_e_s_cryptor_holder.html#a7f1349c5c6480a42435770c0e11d050c", null ], [ "operator*", "classt4_1_1pdf_1_1_a_e_s_cryptor_holder.html#ab54b4b1abc932d996d353c47b58b0060", null ], [ "operator->", "classt4_1_1pdf_1_1_a_e_s_cryptor_holder.html#a4d22eb09e802bb323d2ba45cf8fbf5ec", null ], [ "operator=", "classt4_1_1pdf_1_1_a_e_s_cryptor_holder.html#aa447166352cbdf9d60e1effa98944960", null ], [ "reset", "classt4_1_1pdf_1_1_a_e_s_cryptor_holder.html#a7177c9e20d085a3eb820d9710b249b72", null ] ];
86.090909
116
0.818374
1036920bc220962a43a24c407939d15735fa5cee
2,919
js
JavaScript
tile-block.js
hfu/tile-block
976c0123fa3adc65b54cbb334fe0ed634b8ea252
[ "Unlicense" ]
3
2018-04-04T10:42:08.000Z
2021-09-09T16:13:23.000Z
tile-block.js
hfu/tile-block
976c0123fa3adc65b54cbb334fe0ed634b8ea252
[ "Unlicense" ]
3
2018-08-27T08:28:39.000Z
2018-08-27T08:30:16.000Z
tile-block.js
hfu/tile-block
976c0123fa3adc65b54cbb334fe0ed634b8ea252
[ "Unlicense" ]
null
null
null
const fs = require('fs') const MBTiles = require('@mapbox/mbtiles') const express = require('express') const spdy = require('spdy') const cors = require('cors') const config = require('config') const app = express() app.use(cors()) let mbtiles = {} /* get the port: override by command line parameter */ let port = config.get('port') if (process.argv.length === 3) { port = parseInt(process.argv[2]) } const scanFiles = () => { fs.readdir('mbtiles', (err, files) => { if (err) throw err for (let file of files) { if (file.endsWith('.mbtiles')) { const t = file.replace('.mbtiles', '') if (mbtiles[t]) continue // console.log(`opening ${t}`) new MBTiles(`mbtiles/${file}?mode=ro`, (err, mbt) => { if (err) throw err mbtiles[t] = mbt }) } } }) } scanFiles() app.get('/zxy/:t/:z/:x/:y', (req, res, next) => { const [z, x, y] = [req.params.z, req.params.x, req.params.y].map(v => Number(v)) const t = req.params.t getTile(t, z, x, y).then(tile => { if (tile) { res.set('Content-Encoding', 'gzip') res.send(tile) } else { res.status(404).send(`${t}/${z}/${x}/${y} does not exist.`) } }).catch(reason => { throw reason }) }) app.get('/module/:z/:x/:y', (req, res, next) => { const [z, x, y] = [req.params.z, req.params.x, req.params.y].map(v => Number(v)) const Z = 5 const X = x >> (z - Z) const Y = y >> (z - Z) const t = `${Z}-${X}-${Y}` getTile(t, z, x, y).then(tile => { if (tile) { res.set('Content-Encoding', 'gzip') res.send(tile) } else { res.status(404).send(`${t}/${z}/${x}/${y} does not exist.`) } }).catch(reason => { throw reason }) }) app.get('/module6/:z/:x/:y', (req, res, next) => { const [z, x, y] = [req.params.z, req.params.x, req.params.y].map(v => Number(v)) const Z = 6 const X = x >> (z - Z) const Y = y >> (z - Z) const t = `${Z}-${X}-${Y}` getTile(t, z, x, y).then(tile => { if (tile) { res.set('Content-Encoding', 'gzip') res.send(tile) } else { res.status(404).send(`${t}/${z}/${x}/${y} does not exist.`) } }).catch(reason => { throw reason }) }) const getTile = (t, z, x, y) => { if (!mbtiles[t]) scanFiles() return new Promise((resolve, reject) => { if (!mbtiles[t]) resolve(false) mbtiles[t].getTile(z, x, y, (err, data, headers) => { if (err) { resolve(false) } else { resolve(data) } }) }) } app.use(express.static('htdocs')) /* be sure to change style.json if you want to use http app.listen(port, () => {}) */ spdy.createServer({ key: fs.readFileSync('privkey.pem'), cert: fs.readFileSync('fullchain.pem'), ca: fs.readFileSync('chain.pem') // key: fs.readFileSync('private.key'), // cert: fs.readFileSync('server.crt'), // passphrase: 'tile-block' }, app).listen(port, () => { })
25.605263
82
0.536485
1036b65178771649f5dd5ce91f574b554debba7b
479
js
JavaScript
server/models/user-model.js
Hack-Diversity/cafe_client
8f240baddef9b1abfb63c0e24725d340935b5634
[ "MIT" ]
1
2021-08-20T22:39:51.000Z
2021-08-20T22:39:51.000Z
app/models/user.js
kamsahn/pokemon-tcg-express
dfea0fb34db5cb1b6ccb95cfbb4c286a524a7f32
[ "Xnet", "X11" ]
22
2021-01-30T16:01:49.000Z
2021-02-23T09:37:09.000Z
server/models/user-model.js
Hack-Diversity/cafe_client
8f240baddef9b1abfb63c0e24725d340935b5634
[ "MIT" ]
2
2020-10-09T18:17:27.000Z
2020-10-18T10:06:12.000Z
const mongoose = require('mongoose') const userSchema = new mongoose.Schema({ email: { type: String, required: true, unique: true }, hashedPassword: { type: String, required: true }, token: String }, { timestamps: true, toObject: { // remove `hashedPassword` field when we call `.toObject` transform: (_doc, user) => { delete user.hashedPassword return user } } }) module.exports = mongoose.model('User', userSchema)
18.423077
61
0.626305
1036d0418eb6edab86b93737a2d57e69229512e2
4,661
js
JavaScript
src/modules/Requester.js
bennettscience/gas-canvasapi
87e2ccdc6760d87b8338a03c7e82ab6a1650e9f6
[ "MIT" ]
2
2021-04-20T20:27:31.000Z
2021-04-26T01:44:49.000Z
src/modules/Requester.js
bennettscience/gas-canvasapi
87e2ccdc6760d87b8338a03c7e82ab6a1650e9f6
[ "MIT" ]
null
null
null
src/modules/Requester.js
bennettscience/gas-canvasapi
87e2ccdc6760d87b8338a03c7e82ab6a1650e9f6
[ "MIT" ]
null
null
null
import {NotImplementedError, IncompleteRequestError} from './Error.js'; import {serialize_} from './Utils.js'; /** * @typedef {Object} CanvasResponse * @property {String} json HTTP response content * @property {Int} status HTTP status code * @property {String} headers HTTP response headers * * @typedef {Object} HTTPResponse * @name HTTPResponse * @description The base Google Apps Script HTTP response object. See https://developers.google.com/apps-script/reference/url-fetch/http-response */ // TODO: Check for optional args before making the request // TODO: Create payload for requests export class Requester { static classType() { return "Requester"; } constructor(baseUrl, accessToken, {UrlFetchApp_=UrlFetchApp}={}) { this._baseUrl = baseUrl + "/api/v1/"; this._accessToken = accessToken; this.UrlFetchApp = UrlFetchApp_; } delete_request_(url, headers, data=null, payload={}) { const opts = { "method": "DELETE", "contentType": "application/json", "headers": headers } } /** * * @param {String} url Endpoint for the request * @param {Object} headers Optional headers * @param {String} query URL-safe query string * * @returns {HTTPResponse} */ get_request(url, headers, query) { let fullUrl = url + query; const opts = { "method": "GET", "contentType": "application/json", "headers": headers, "muteHttpExceptions": true, } return this.UrlFetchApp.fetch(fullUrl, opts); } post_request(url, headers, data=null) { const opts = { "method": "POST", "contentType": "application/json", "headers": headers, } // Every POST request expects a payload. // Only stringify the payload if it exists. If it doesn't, throw an error. if(data) { opts['payload'] = JSON.stringify(data) } else { throw new IncompleteRequestError("POST requests expect a JSON payload.") } return this.UrlFetchApp.fetch(url, opts) } put_request_(url, headers, data=null, payload={}) { const opts = { "method": "PUT", "contentType": "application/json", "headers": headers } } /** * Make a request to the Canvas API and return the response * @param {string} method HTTP method * @param {string} endpoint The Canvas endpoint * @param {Object} payload Optional arguments to use with the request * @param {Object} headers Optional headers to include * * @returns {CanvasResponse} */ request(method, endpoint, url, payload=null, headers=null) { let query = ""; let req_method, response; // serialize an object of options into a querystring for the API call if(payload) { query = serialize_(payload) } method = method.toUpperCase(); const full_url = url || `${this._baseUrl}${endpoint}`; if (!headers) { headers = { "Authorization": "Bearer " + this._accessToken } } if(method === "GET") { req_method = this.get_request.bind(this); } else if(method === "POST") { req_method = this.post_request.bind(this); // throw new NotImplementedError('POST not implemented. Use a native UrlFetchApp.fetch() request.') } else if(method === "PUT") { // req_method = this.put_request.bind(this); throw new NotImplementedError('PUT not implemented. Use a native UrlFetchApp.fetch() request.') } else if(method === "DELETE") { // req_method = this.delete_request.bind(this); throw new NotImplementedError('DELETE not implemented. Use a native UrlFetchApp.fetch() request.') } response = req_method(full_url, headers, query) const status = response.getResponseCode() // Handle response codes switch(status) { case 400: throw new Error(`400: Bad Request`) case 401: if(response.getHeaders().hasOwnProperty('WWW-Authenticate')) { throw new Error(`Invalid access token.`) } else { throw new Error(`Unauthorized`) } case 403: throw new Error(`Forbidden`) // This could also be rate limiting. Need a better check. case 404: throw new Error(`Not found`) case 409: throw new Error(`Conflict: ${response.getContentText()}`) case 422: throw new Error(`Unprocessable request`) } if(status >= 500) { throw new Error(`Encoutered an error: status code ${status}`) } return { json: () => response.getContentText(), status: () => status, headers: () => response.getHeaders() } } }
29.878205
145
0.624973
1036dbd3150adf131b5217051e27fe2ed4a54de2
569
js
JavaScript
src/components/students/exercise/SelectExercise.js
nivida/vv-hackathon
8c0056a93ba4394c0c69aaa596e5207a5e5d5a41
[ "MIT" ]
1
2020-04-14T11:18:44.000Z
2020-04-14T11:18:44.000Z
src/components/students/exercise/SelectExercise.js
nivida/vv-hackathon
8c0056a93ba4394c0c69aaa596e5207a5e5d5a41
[ "MIT" ]
4
2021-03-10T13:36:08.000Z
2022-02-27T02:33:50.000Z
src/components/students/exercise/SelectExercise.js
nivida/vv-hackathon
8c0056a93ba4394c0c69aaa596e5207a5e5d5a41
[ "MIT" ]
1
2020-04-16T19:59:53.000Z
2020-04-16T19:59:53.000Z
import * as React from "react"; import {Radio} from "antd"; import SubmittableExercise from "./shared/SubmittableExercise"; const SelectExercise = ({exercise}) => { const radioStyle = { display: 'block', height: '30px', lineHeight: '30px', }; return ( <SubmittableExercise exercise={exercise}> <Radio.Group> {(exercise.choices || []).map(choice => ( <Radio key={choice} style={radioStyle} value={choice}>{choice}</Radio> ))} </Radio.Group> </SubmittableExercise> ) }; export default SelectExercise;
22.76
80
0.623902
1036f525592a14c7b85ffe6b5c604c32451b17ad
5,129
js
JavaScript
src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js
mkhorton/three.js
ba7692384ce7d319b2003c825f0ac998d7a21882
[ "MIT" ]
497
2018-01-24T04:32:07.000Z
2022-03-29T08:47:40.000Z
src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js
mkhorton/three.js
ba7692384ce7d319b2003c825f0ac998d7a21882
[ "MIT" ]
29
2019-03-06T16:37:33.000Z
2021-05-11T09:33:54.000Z
src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js
mkhorton/three.js
ba7692384ce7d319b2003c825f0ac998d7a21882
[ "MIT" ]
179
2018-01-24T04:29:39.000Z
2022-03-31T02:13:42.000Z
export default /* glsl */` uniform bool receiveShadow; uniform vec3 ambientLightColor; uniform vec3 lightProbe[ 9 ]; // get the irradiance (radiance convolved with cosine lobe) at the point 'normal' on the unit sphere // source: https://graphics.stanford.edu/papers/envmap/envmap.pdf vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { // normal is assumed to have unit length float x = normal.x, y = normal.y, z = normal.z; // band 0 vec3 result = shCoefficients[ 0 ] * 0.886227; // band 1 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; // band 2 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); return result; } vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) { vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix ); vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); return irradiance; } vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { vec3 irradiance = ambientLightColor; #ifndef PHYSICALLY_CORRECT_LIGHTS irradiance *= PI; #endif return irradiance; } #if NUM_DIR_LIGHTS > 0 struct DirectionalLight { vec3 direction; vec3 color; int shadow; float shadowBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; void getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) { directLight.color = directionalLight.color; directLight.direction = directionalLight.direction; directLight.visible = true; } #endif #if NUM_POINT_LIGHTS > 0 struct PointLight { vec3 position; vec3 color; float distance; float decay; int shadow; float shadowBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; // directLight is an out parameter as having it as a return value caused compiler errors on some devices void getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) { vec3 lVector = pointLight.position - geometry.position; directLight.direction = normalize( lVector ); float lightDistance = length( lVector ); directLight.color = pointLight.color; directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay ); directLight.visible = ( directLight.color != vec3( 0.0 ) ); } #endif #if NUM_SPOT_LIGHTS > 0 struct SpotLight { vec3 position; vec3 direction; vec3 color; float distance; float decay; float coneCos; float penumbraCos; int shadow; float shadowBias; float shadowRadius; vec2 shadowMapSize; }; uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; // directLight is an out parameter as having it as a return value caused compiler errors on some devices void getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) { vec3 lVector = spotLight.position - geometry.position; directLight.direction = normalize( lVector ); float lightDistance = length( lVector ); float angleCos = dot( directLight.direction, spotLight.direction ); if ( angleCos > spotLight.coneCos ) { float spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos ); directLight.color = spotLight.color; directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay ); directLight.visible = true; } else { directLight.color = vec3( 0.0 ); directLight.visible = false; } } #endif #if NUM_RECT_AREA_LIGHTS > 0 struct RectAreaLight { vec3 color; vec3 position; vec3 halfWidth; vec3 halfHeight; }; // Pre-computed values of LinearTransformedCosine approximation of BRDF // BRDF approximation Texture is 64x64 uniform sampler2D ltc_1; // RGBA Float uniform sampler2D ltc_2; // RGBA Float uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; #endif #if NUM_HEMI_LIGHTS > 0 struct HemisphereLight { vec3 direction; vec3 skyColor; vec3 groundColor; }; uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) { float dotNL = dot( geometry.normal, hemiLight.direction ); float hemiDiffuseWeight = 0.5 * dotNL + 0.5; vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); #ifndef PHYSICALLY_CORRECT_LIGHTS irradiance *= PI; #endif return irradiance; } #endif `;
24.193396
156
0.737376
1036f822b9c1247105bcf1c94d01e624a405c786
1,375
js
JavaScript
examples/example_0.js
madhums/LeafletPlayback
b9b6ed5bf58a3dce83706f1f7fc3a22348e6cb21
[ "BSD-2-Clause" ]
null
null
null
examples/example_0.js
madhums/LeafletPlayback
b9b6ed5bf58a3dce83706f1f7fc3a22348e6cb21
[ "BSD-2-Clause" ]
null
null
null
examples/example_0.js
madhums/LeafletPlayback
b9b6ed5bf58a3dce83706f1f7fc3a22348e6cb21
[ "BSD-2-Clause" ]
null
null
null
$(function() { // Setup leaflet map var map = new L.Map('map'); var basemapLayer = new L.TileLayer('https://api.mapbox.com/v4/mapbox.streets/{z}/{x}/{y}.png?access_token=pk.eyJ1Ijoibm9tYWRkZXYiLCJhIjoiY2pwMzJicmNjMGRoZzNxbW5saGF5d2t2eCJ9.SIa-W0ZxIqU726w6KJAw4Q'); let json = window.trekker.filter(d => d.time).map(d => ({ time: d.time * 1000, lat: Number(d.lat), lng: Number(d.lng) })) // Center map and default zoom level map.setView([json[0].lat, json[0].lng], 17); // Adds the background layer to the map map.addLayer(basemapLayer); // ===================================================== // =============== Playback ============================ // ===================================================== // Playback options var playbackOptions = { playControl: true, dateControl: true, sliderControl: true }; let coordinates = json.map(coord => [coord.lng, coord.lat]); let times = json.map(coord => coord.time); const data = { "type": "Feature", "geometry": { "type": "MultiPoint", "coordinates": coordinates }, "properties": { "time": times } } // Initialize playback var playback = new L.Playback(map, data, null, playbackOptions); });
31.976744
203
0.506909
10373d87c04d314b95b6013ad84a556cb1bb1e44
618
js
JavaScript
src/components/Stat/Stat.js
patrikPu/patrikp_rpg
36581fac4b69bced3729961e002778f49c20bc3c
[ "MIT" ]
42
2020-01-16T17:40:11.000Z
2020-07-01T12:57:07.000Z
src/components/Stat/Stat.js
patrik-pk/simple-rpg
36581fac4b69bced3729961e002778f49c20bc3c
[ "MIT" ]
2
2022-02-15T01:34:20.000Z
2022-02-27T23:40:50.000Z
src/components/Stat/Stat.js
patrikPu/patrikp_rpg
36581fac4b69bced3729961e002778f49c20bc3c
[ "MIT" ]
4
2020-01-17T21:58:36.000Z
2020-01-19T06:41:27.000Z
import React from 'react' export default ({ name, value, enemy }) => { const strongStatClass = () => { if (enemy && enemy.type === 'Boss' && (name === 'M-Armor:' || name === 'R-Armor:')) { const meleeArmor = enemy.meleeArmor const rangedArmor = enemy.rangedArmor const higherValue = Math.max(meleeArmor, rangedArmor) if(value === higherValue) return 'strong-stat' } return '' } return ( <li className={`stat-container ${strongStatClass()}`} > <p>{name}</p> <p>{value}</p> </li> ) }
28.090909
93
0.506472
1038323cda1a800b173256edbdbdf0634d6787b3
3,984
js
JavaScript
server/dist/modules/notifications/infra/typeorm/schemas/Notification.js
pauloreis7/GoBarber
83e17b35626a5e44ebdf85626ba936b7bb16c669
[ "MIT" ]
null
null
null
server/dist/modules/notifications/infra/typeorm/schemas/Notification.js
pauloreis7/GoBarber
83e17b35626a5e44ebdf85626ba936b7bb16c669
[ "MIT" ]
3
2020-07-04T20:38:57.000Z
2022-02-27T07:45:53.000Z
server/dist/modules/notifications/infra/typeorm/schemas/Notification.js
pauloreis7/GoBarber
83e17b35626a5e44ebdf85626ba936b7bb16c669
[ "MIT" ]
null
null
null
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _typeorm = require("typeorm"); var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6; function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } let Notification = (_dec = (0, _typeorm.Entity)('notifications'), _dec2 = (0, _typeorm.ObjectIdColumn)(), _dec3 = Reflect.metadata("design:type", typeof _typeorm.ObjectID === "undefined" ? Object : _typeorm.ObjectID), _dec4 = (0, _typeorm.Column)(), _dec5 = Reflect.metadata("design:type", String), _dec6 = (0, _typeorm.Column)('uuid'), _dec7 = Reflect.metadata("design:type", String), _dec8 = (0, _typeorm.Column)({ default: false }), _dec9 = Reflect.metadata("design:type", Boolean), _dec10 = (0, _typeorm.CreateDateColumn)(), _dec11 = Reflect.metadata("design:type", typeof Date === "undefined" ? Object : Date), _dec12 = (0, _typeorm.UpdateDateColumn)(), _dec13 = Reflect.metadata("design:type", typeof Date === "undefined" ? Object : Date), _dec(_class = (_class2 = class Notification { constructor() { _initializerDefineProperty(this, "id", _descriptor, this); _initializerDefineProperty(this, "content", _descriptor2, this); _initializerDefineProperty(this, "recipient_id", _descriptor3, this); _initializerDefineProperty(this, "read", _descriptor4, this); _initializerDefineProperty(this, "created_at", _descriptor5, this); _initializerDefineProperty(this, "updated_at", _descriptor6, this); } }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "id", [_dec2, _dec3], { configurable: true, enumerable: true, writable: true, initializer: null }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "content", [_dec4, _dec5], { configurable: true, enumerable: true, writable: true, initializer: null }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "recipient_id", [_dec6, _dec7], { configurable: true, enumerable: true, writable: true, initializer: null }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "read", [_dec8, _dec9], { configurable: true, enumerable: true, writable: true, initializer: null }), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "created_at", [_dec10, _dec11], { configurable: true, enumerable: true, writable: true, initializer: null }), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "updated_at", [_dec12, _dec13], { configurable: true, enumerable: true, writable: true, initializer: null })), _class2)) || _class); var _default = Notification; exports.default = _default;
59.462687
724
0.737199
10388520213b351c43344d0f0bbbc74fa7e42d5b
283
js
JavaScript
src/js/app.js
Ne184/Adding-elements-dynamically
7ba2c93aa4bcd55b1a5978435a2f8794dcacb35d
[ "Apache-2.0" ]
null
null
null
src/js/app.js
Ne184/Adding-elements-dynamically
7ba2c93aa4bcd55b1a5978435a2f8794dcacb35d
[ "Apache-2.0" ]
null
null
null
src/js/app.js
Ne184/Adding-elements-dynamically
7ba2c93aa4bcd55b1a5978435a2f8794dcacb35d
[ "Apache-2.0" ]
null
null
null
import "../scss/app.scss"; window.addEventListener("DOMContentLoaded", () => { // This block will be executed once the page is loaded and ready // const button = document.querySelector(".button"); // button.addEventListener("click", () => { // alert("💣"); // }); });
21.769231
66
0.618375
1038c858f114f54a23bc53af5afb09600f43679f
345
js
JavaScript
src/components/YourQuery/FastaTextbox/presentation.js
r06942072/frontend_BLASTquery
bbb12300930b3f606b628498452d9f069f69a267
[ "MIT" ]
null
null
null
src/components/YourQuery/FastaTextbox/presentation.js
r06942072/frontend_BLASTquery
bbb12300930b3f606b628498452d9f069f69a267
[ "MIT" ]
3
2019-07-10T15:08:05.000Z
2019-07-25T18:45:32.000Z
src/components/YourQuery/FastaTextbox/presentation.js
r06942072/frontend_BLASTquery
bbb12300930b3f606b628498452d9f069f69a267
[ "MIT" ]
null
null
null
import React from 'react'; function FastaTextbox(props) { let fastaWidth = props.data.windowWidth/20; let fastaHeight = props.data.windowHeight/50; return ( <div> <p>*FastaTextBox</p> <textarea cols={fastaWidth} rows={fastaHeight} /> </div> ); } export default FastaTextbox;
24.642857
62
0.594203
103a9096e7ebe5595b3af5030a7d13d88e791455
490
js
JavaScript
test/test-79-npm/node-libcurl/node-libcurl.js
plasmo-foss/pkg
d9508881313581697a4632c217c3af6a6ca0490d
[ "MIT" ]
16,585
2017-04-29T18:12:54.000Z
2020-05-27T03:51:27.000Z
test/test-79-npm/node-libcurl/node-libcurl.js
plasmo-foss/pkg
d9508881313581697a4632c217c3af6a6ca0490d
[ "MIT" ]
1,022
2020-05-28T11:10:24.000Z
2022-03-31T22:48:18.000Z
test/test-79-npm/node-libcurl/node-libcurl.js
plasmo-foss/pkg
d9508881313581697a4632c217c3af6a6ca0490d
[ "MIT" ]
779
2017-04-29T18:13:06.000Z
2020-05-26T19:35:53.000Z
'use strict'; // apt-get install libcurl4-openssl-dev // IF YOU USE 32-BIT NODEJS: // patch /usr/include/curl/curlbuild.h // #define CURL_SIZEOF_LONG 4 // #define CURL_SIZEOF_CURL_OFF_T 4 var Curl = require('node-libcurl').Curl; var curl = new Curl(); curl.setOpt('URL', 'www.yandex.ru'); curl.setOpt('FOLLOWLOCATION', true); curl.on('end', function (status) { if (status === 200) { console.log('ok'); } this.close(); // eslint-disable-line no-invalid-this }); curl.perform();
23.333333
54
0.67551
103ae3a6665e523c930086ec68178cf2b931949e
3,205
js
JavaScript
test/SIMD.uint16x8.asmjs/testShuffle.js
goyakin/ChakraCore
9d9fea268ce1ae6c00873fd966a6a2be048f3455
[ "MIT" ]
1
2021-11-07T18:56:21.000Z
2021-11-07T18:56:21.000Z
test/SIMD.uint16x8.asmjs/testShuffle.js
MaxMood96/ChakraCore
9d9fea268ce1ae6c00873fd966a6a2be048f3455
[ "MIT" ]
null
null
null
test/SIMD.uint16x8.asmjs/testShuffle.js
MaxMood96/ChakraCore
9d9fea268ce1ae6c00873fd966a6a2be048f3455
[ "MIT" ]
1
2021-09-04T23:26:57.000Z
2021-09-04T23:26:57.000Z
//------------------------------------------------------------------------------------------------------- // Copyright (C) Microsoft Corporation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. //------------------------------------------------------------------------------------------------------- this.WScript.LoadScriptFile("..\\UnitTestFramework\\SimdJsHelpers.js"); function asmModule(stdlib, imports) { "use asm"; var ui8 = stdlib.SIMD.Uint16x8; var ui8check = ui8.check; var ui8shuffle = ui8.shuffle; var ui8add = ui8.add; var ui8mul = ui8.mul; var globImportui8 = ui8check(imports.g1); var ui8g1 = ui8(10, 1073, 107, 1082, 10402, 12332, 311, 650); var ui8g2 = ui8(35316, 492529, 1128, 1085, 3692, 3937, 9755, 2638); var loopCOUNT = 3; function testShuffleLocal() { var a = ui8(5033, 3401, 665, 3234, 948, 2834, 7748, 25); var b = ui8(3483, 2144, 5697, 65, 1000000, 984, 3434, 9876); var result = ui8(0, 0, 0, 0, 0, 0, 0, 0); var loopIndex = 0; while ((loopIndex | 0) < (loopCOUNT | 0)) { result = ui8shuffle(a, b, 0, 1, 4, 5, 8, 3, 2, 6); loopIndex = (loopIndex + 1) | 0; } return ui8check(result); } function testShuffleGlobal() { var result = ui8(0, 0, 0, 0, 0, 0, 0, 0); var loopIndex = 0; while ((loopIndex | 0) < (loopCOUNT | 0)) { result = ui8shuffle(ui8g1, ui8g2, 0, 1, 4, 5, 8, 3, 2, 6); loopIndex = (loopIndex + 1) | 0; } return ui8check(result); } function testShuffleGlobalImport() { var a = ui8(5033, 3401, 665, 3234, 948, 2834, 7748, 25); var result = ui8(0, 0, 0, 0, 0, 0, 0, 0); var loopIndex = 0; while ((loopIndex | 0) < (loopCOUNT | 0)) { result = ui8shuffle(a, globImportui8, 0, 1, 4, 5, 8, 3, 2, 6); loopIndex = (loopIndex + 1) | 0; } return ui8check(result); } function testShuffleFunc() { var a = ui8(5033, 3401, 665, 3234, 948, 2834, 7748, 25); var result = ui8(0, 0, 0, 0, 0, 0, 0, 0); var loopIndex = 0; while ((loopIndex | 0) < (loopCOUNT | 0)) { result = ui8shuffle(ui8add(a, ui8g1), ui8mul(a, ui8g1), 0, 1, 4, 5, 8, 3, 2, 6); loopIndex = (loopIndex + 1) | 0; } return ui8check(result); } return { testShuffleLocal: testShuffleLocal, testShuffleGlobal: testShuffleGlobal, testShuffleGlobalImport: testShuffleGlobalImport, testShuffleFunc: testShuffleFunc }; } var m = asmModule(this, { g1: SIMD.Uint16x8(50, 1000, 3092, 3393, Infinity, 39238, NaN, 838) }); equalSimd([5033, 3401, 948, 2834, 3483, 3234, 665, 7748], m.testShuffleLocal(), SIMD.Uint16x8, ""); equalSimd([10, 1073, 10402, 12332, 35316, 1082, 107, 311], m.testShuffleGlobal(), SIMD.Uint16x8, ""); equalSimd([5033, 3401, 948, 2834, 50, 3234, 665, 7748], m.testShuffleGlobalImport(), SIMD.Uint16x8, ""); equalSimd([5043, 4474, 11350, 15166, 50330, 4316, 772, 8059], m.testShuffleFunc(), SIMD.Uint16x8, ""); print("PASS");
36.420455
172
0.547582
103b073aa160c389fbc859916dfb52fe66eb4794
524
js
JavaScript
app/config/development.conf.js
GTrebaol/hr-reminder
350f421291d20cd4bdd36e596bd90b4c4cabde79
[ "MIT" ]
null
null
null
app/config/development.conf.js
GTrebaol/hr-reminder
350f421291d20cd4bdd36e596bd90b4c4cabde79
[ "MIT" ]
null
null
null
app/config/development.conf.js
GTrebaol/hr-reminder
350f421291d20cd4bdd36e596bd90b4c4cabde79
[ "MIT" ]
null
null
null
/** * Development database configuration file */ var db_hostname = process.env.DB_PORT_3306_TCP_ADDR, db_username = process.env.DB_USERNAME, db_password = process.env.DB_PASSWORD, db_database = process.env.DB_DATABASE; module.exports.db = { host: db_hostname === undefined ? '127.0.0.1' : db_hostname, user: db_username === undefined ? 'root' : db_username, password: db_password === undefined ? '' : db_password, database: db_database === undefined ? 'reminder' : db_database };
32.75
66
0.683206
103b07f381d5a2802869663a6d3a88337ac661e4
1,666
js
JavaScript
src/resources/1_0_2/profiles/enrollmentrequest/query.js
rafmos/graphql-fhir
1f5a6c244e6446de765dff8a149d9bae354ba2d5
[ "MIT" ]
null
null
null
src/resources/1_0_2/profiles/enrollmentrequest/query.js
rafmos/graphql-fhir
1f5a6c244e6446de765dff8a149d9bae354ba2d5
[ "MIT" ]
null
null
null
src/resources/1_0_2/profiles/enrollmentrequest/query.js
rafmos/graphql-fhir
1f5a6c244e6446de765dff8a149d9bae354ba2d5
[ "MIT" ]
null
null
null
// Schemas const EnrollmentRequestSchema = require('../../schemas/enrollmentrequest.schema'); const BundleSchema = require('../../schemas/bundle.schema'); // Arguments const EnrollmentRequestArgs = require('../../parameters/enrollmentrequest.parameters'); const CommonArgs = require('../../parameters/common.parameters'); // Resolvers const { enrollmentrequestResolver, enrollmentrequestListResolver, enrollmentrequestInstanceResolver } = require('./resolver'); // Scope Utilities const { scopeInvariant } = require('../../../../utils/scope.utils'); let scopeOptions = { name: 'EnrollmentRequest', action: 'read', version: '1_0_2' }; /** * @name exports.EnrollmentRequestQuery * @summary EnrollmentRequest Query. */ module.exports.EnrollmentRequestQuery = { args: Object.assign({}, CommonArgs, EnrollmentRequestArgs), description: 'Query for a single EnrollmentRequest', resolve: scopeInvariant(scopeOptions, enrollmentrequestResolver), type: EnrollmentRequestSchema }; /** * @name exports.EnrollmentRequestListQuery * @summary EnrollmentRequestList Query. */ module.exports.EnrollmentRequestListQuery = { args: Object.assign({}, CommonArgs, EnrollmentRequestArgs), description: 'Query for multiple EnrollmentRequests', resolve: scopeInvariant(scopeOptions, enrollmentrequestListResolver), type: BundleSchema }; /** * @name exports.EnrollmentRequestInstanceQuery * @summary EnrollmentRequestInstance Query. */ module.exports.EnrollmentRequestInstanceQuery = { description: 'Get information about a single EnrollmentRequest', resolve: scopeInvariant(scopeOptions, enrollmentrequestInstanceResolver), type: EnrollmentRequestSchema };
28.724138
87
0.77431
103c1ede41345ff26ac528e79e791fe21bcf1d41
2,546
js
JavaScript
src/templates/product.js
olitaylor/firebase-graphql-api-interface
0cfbc33cbaed27f82347bfb642a3ea078148487c
[ "MIT" ]
null
null
null
src/templates/product.js
olitaylor/firebase-graphql-api-interface
0cfbc33cbaed27f82347bfb642a3ea078148487c
[ "MIT" ]
7
2021-03-09T12:37:22.000Z
2022-02-18T06:00:38.000Z
src/templates/product.js
olitaylor/firebase-graphql-api-interface
0cfbc33cbaed27f82347bfb642a3ea078148487c
[ "MIT" ]
null
null
null
import React, { Fragment } from "react" import { Link, graphql } from "gatsby" import { Query } from 'react-apollo' import gql from 'graphql-tag' import Layout from "../components/layout" import SEO from "../components/seo" import { Table, Header, Segment } from 'semantic-ui-react' // This query is executed at build time by Gatsby. export const GatsbyQuery = graphql` query Product($name: String!) { productsApi { product(name: $name) { name isFull location meetAndGreet pricePerDay } } } ` // This query is executed at run time by Apollo. const APOLLO_QUERY = gql` query Product($name: String!) { product(name: $name) { name isFull location meetAndGreet pricePerDay } } ` class ProductView extends React.Component { render() { return ( <Query query={APOLLO_QUERY} variables={{ name: this.props.pageContext.name }}> {({ data, loading, error }) => ( <Layout> { loading && <p>Loading products...</p> } { error && <p>Error: ${error.message}</p> } { data && data.product && <Fragment> <SEO title={data.product.name} /> <Link className="ui button" to="/">Back</Link> <Header as='h2' attached='top'>{data.product.name}</Header> <Segment attached> <Table celled> <Table.Header> <Table.Row> <Table.HeaderCell>Capacity</Table.HeaderCell> <Table.HeaderCell>Location</Table.HeaderCell> <Table.HeaderCell>Meet and Greet</Table.HeaderCell> <Table.HeaderCell>Price per day</Table.HeaderCell> </Table.Row> </Table.Header> <Table.Body> <Table.Row> <Table.Cell error={data.product.isFull}>{data.product.isFull ? 'Full' : 'Spaces'}</Table.Cell> <Table.Cell>{data.product.location}</Table.Cell> <Table.Cell>{data.product.meetAndGreet ? "Yes" : "No"}</Table.Cell> <Table.Cell>&pound;{data.product.pricePerDay}</Table.Cell> </Table.Row> </Table.Body> </Table> </Segment> </Fragment> } </Layout> )} </Query> ) } } export default ProductView
30.674699
118
0.510212
103c4af40f888d5d3e5b61924915a1269757b126
1,920
js
JavaScript
conquerSquad/client/src/components/Dialog/Dialog.js
huhangbo/conquer-squad-master
482ca1716381ad39b38b96fe8ee1d5b41ffe75bf
[ "MIT" ]
1
2021-09-06T11:08:42.000Z
2021-09-06T11:08:42.000Z
conquerSquad/client/src/components/Dialog/Dialog.js
huhangbo/conquer-squad-master
482ca1716381ad39b38b96fe8ee1d5b41ffe75bf
[ "MIT" ]
null
null
null
conquerSquad/client/src/components/Dialog/Dialog.js
huhangbo/conquer-squad-master
482ca1716381ad39b38b96fe8ee1d5b41ffe75bf
[ "MIT" ]
null
null
null
import {renderElement, clearElement} from "../../Utils/modal"; import styles from "./Dialog.less" import * as ReactDOM from "react-dom"; export default function Dialog (props) { const {visible=false, title, onOk=false, okTitle="确认", handleOk, onCancel=false, cancelTitle="取消", handleCancel, children} = props const component = visible ? <> <div className={styles.mask}></div> <div className={styles.dialog}> <h3 className={styles.header}> <div className={styles.title}> {title} </div> </h3> <div className={styles.body}> {children} </div> <div className={styles.footer}> {onOk && <button onClick={handleOk}>{okTitle}</button>} {onCancel && <button onClick={handleCancel}>{cancelTitle}</button>} </div> </div> </> : null return ( ReactDOM.createPortal(component, document.body) ) } export function alert (content){ const component = <Dialog visible={true} title={"提示"} onOk={true} children={content} handleOk={() => {clearElement(component,div)}}/> const div = renderElement(component) } export function confirm (content, ok=()=>{}, cancel=()=>{}) { const component = <Dialog visible={true} title={"确认"} onOk={true} onCancle={true} children={content} handleOk={() => { ok() clearElement(component, div) }} hanleCancel={() => { cancel() clearElement(component, div) }}/> const div = renderElement(component) }
36.923077
134
0.479688
103c741044028e4650956dfc2525aedc081e6844
506
js
JavaScript
examples/index.js
matjas/Backbone.ViewStructure
d8afdeddca3163e21ca8d1e109cecbd1836e7543
[ "MIT" ]
2
2018-05-29T03:27:31.000Z
2019-05-14T11:44:30.000Z
examples/index.js
matjas/Backbone.ViewStructure
d8afdeddca3163e21ca8d1e109cecbd1836e7543
[ "MIT" ]
null
null
null
examples/index.js
matjas/Backbone.ViewStructure
d8afdeddca3163e21ca8d1e109cecbd1836e7543
[ "MIT" ]
null
null
null
const ModelView = require('./modelView/modelView'); const CollectionView = require('./collectionView/collectionView'); const CollectionModelView = require('./collectionModelView/collectionModelView'); const LayoutView = require('./layoutView/layoutView'); const LayoutCollection = require('./layoutCollection/layoutCollection'); const CycleView = require('./cycleView/cycleView'); new ModelView(); new CollectionView(); new CollectionModelView(); new LayoutView(); new LayoutCollection(); new CycleView();
38.923077
81
0.786561
103c8711d50937aeecf763621d02c21e740d3e5d
1,814
js
JavaScript
script/embed-styles.js
dt-83/buy-button-js
973c0f1c43d1eb607cb4d6e1a2732da6cced5cba
[ "MIT" ]
199
2016-11-04T19:24:35.000Z
2022-03-21T20:59:48.000Z
script/embed-styles.js
dt-83/buy-button-js
973c0f1c43d1eb607cb4d6e1a2732da6cced5cba
[ "MIT" ]
252
2016-11-05T02:03:59.000Z
2022-03-29T11:40:54.000Z
script/embed-styles.js
dt-83/buy-button-js
973c0f1c43d1eb607cb4d6e1a2732da6cced5cba
[ "MIT" ]
99
2016-11-07T19:58:39.000Z
2022-02-11T11:38:59.000Z
var fs = require('fs'); var postcss = require('postcss'); var presetenv = require('postcss-preset-env')({ stage: 1, features: { 'custom-properties': { preserve: false, }, 'color-mod-function': true, }, }); var cssimports = require('postcss-import'); var csscalc = require('postcss-calc'); var embedsCSS = 'const styles = {};'; var promises = fs.readdirSync('src/styles/embeds/sass/manifests').map(function(file) { var fileRoot = file.split('.')[0]; return postcss([cssimports, presetenv, csscalc]) .process(fs.readFileSync('./src/styles/embeds/sass/manifests/' + file), {from: './src/styles/embeds/sass/manifests/' + file}) .then(function(result) { return {file: fileRoot, css: result.css}; }) .catch(function(err) { console.log(err); }); }); Promise.all(promises).then(function(values) { embedsCSS += values.reduce(function(acc, value) { return acc + '\n styles.' + value.file + ' = \'' + value.css.replace(/(\r\n|\n|\r)/gm, ' ') + '\''; }, ''); embedsCSS += '\n export default styles'; fs.writeFileSync('src/styles/embeds/all.js', embedsCSS); }) .catch(function(err) { console.log(err); }); postcss([presetenv, csscalc]) .process(fs.readFileSync('./src/styles/embeds/sass/conditional.css'), { from: './src/styles/embeds/sass/conditional.css' }) .then(function(result) { fs.writeFileSync('src/styles/embeds/conditional.js', 'export default ' + JSON.stringify(result.css)); }) .catch(function(err) { console.log(err); }); postcss([cssimports, presetenv, csscalc]) .process(fs.readFileSync('./src/styles/manifest.css'), { from: './src/styles/manifest.css' }) .then(function(result) { fs.writeFileSync('./dist/buybutton.css', result.css); }) .catch(function(err) { console.log(err); });
28.793651
129
0.638368
103ca54bb57adcfde834345c810678f9f2739559
771
js
JavaScript
test/class/class.js
LXSMNSYC/simply-strong
0eb9b48b90496ac4f61fafa6a43e9fcb3517a80b
[ "MIT" ]
1
2019-04-16T08:12:10.000Z
2019-04-16T08:12:10.000Z
test/class/class.js
LXSMNSYC/simply-strong
0eb9b48b90496ac4f61fafa6a43e9fcb3517a80b
[ "MIT" ]
2
2020-04-04T06:52:05.000Z
2020-07-16T22:44:15.000Z
test/class/class.js
LXSMNSYC/simply-strong
0eb9b48b90496ac4f61fafa6a43e9fcb3517a80b
[ "MIT" ]
null
null
null
/* eslint-disable no-undef */ import assert from 'assert'; import { Class } from '../../src'; describe('Class', () => { describe('#is', () => { it('should return false if the checked value is not an instance of the given class', () => { assert(Class(Array).is({}) === false); }); it('should return true if the checked value is an instance of the given class', () => { assert(Class(Array).is([])); }); }); describe('#equals', () => { it('should return true if both instances had the same given type.', () => { assert(Class(Array).equals(Class(Array))); }); }); describe('toString', () => { it('should return the correct string format', () => { assert(`${Class(Array)}` === '<class Array>'); }); }); });
30.84
96
0.555123
103cf99e9ae35f01725a49c3bc857e43ed253150
1,046
js
JavaScript
packages/slate-html-serializer/benchmark/index.js
OpusCapita/slate
055f32bf18d22f44018aa6f42da170502f58ee22
[ "MIT" ]
1
2021-04-06T04:43:48.000Z
2021-04-06T04:43:48.000Z
packages/slate-plain-serializer/benchmark/index.js
christophercliff/slate
eda5c02e79c3ee2807b5abc51002ca72af5c6a93
[ "MIT" ]
2
2018-01-12T13:50:12.000Z
2018-06-25T12:08:19.000Z
packages/slate-plain-serializer/benchmark/index.js
OpusCapita/slate
055f32bf18d22f44018aa6f42da170502f58ee22
[ "MIT" ]
null
null
null
/* global suite, set, bench */ import fs from 'fs' import { basename, extname, resolve } from 'path' import { __clear } from '../../slate/lib/utils/memoize' /** * Benchmarks. */ const categoryDir = resolve(__dirname) const categories = fs.readdirSync(categoryDir).filter(c => c[0] != '.' && c != 'index.js') categories.forEach((category) => { suite(category, () => { set('iterations', 50) set('mintime', 1000) if (category == 'models') { after(() => { __clear() }) } const benchmarkDir = resolve(categoryDir, category) const benchmarks = fs.readdirSync(benchmarkDir).filter(b => b[0] != '.' && !!~b.indexOf('.js')).map(b => basename(b, extname(b))) benchmarks.forEach((benchmark) => { const dir = resolve(benchmarkDir, benchmark) const module = require(dir) const fn = module.default let { input, before, after } = module if (before) input = before(input) bench(benchmark, () => { fn(input) if (after) after() }) }) }) })
24.904762
133
0.580306
103d02571264404ac0b1d266cb8f8e227259997e
767
js
JavaScript
index.js
iachieve/mini-social-media-app
6fc9461ce7d4b77c21b1a86bf5801b25dc5d9305
[ "MIT" ]
null
null
null
index.js
iachieve/mini-social-media-app
6fc9461ce7d4b77c21b1a86bf5801b25dc5d9305
[ "MIT" ]
4
2021-03-10T16:08:09.000Z
2022-02-27T03:38:15.000Z
index.js
iachieve/mini-social-media-app
6fc9461ce7d4b77c21b1a86bf5801b25dc5d9305
[ "MIT" ]
null
null
null
const PORT = process.env.PORT || 5000; if (process.env.NODE_ENV !== 'production') { require('dotenv').config(); } const { ApolloServer, PubSub } = require('apollo-server'); const pubsub = new PubSub(); const mongoose = require('mongoose'); const typeDefs = require('./graphql/typeDefs'); const resolvers = require('./graphql/resolvers/index'); const server = new ApolloServer({ typeDefs, resolvers, context: ({ req }) => ({ req, pubsub }) }); mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true }) .then(() => { console.log('connected to mongodb'); }) .catch(err => console.log('==> db network failure', err)); server.listen({ port: PORT }) .then(res =>{ console.log(`server is running at ${res.url}`); });
26.448276
60
0.663625
103d5bf3fcbbd8973547bc8c5cfc6e4427c10a20
266
js
JavaScript
test/browserEnv.js
pengge/wgis.leaflet.geosearch.vue2
35631df6ee0657e2d128b1cabc785bd718beed19
[ "MIT" ]
544
2017-01-03T20:54:26.000Z
2022-03-29T08:19:38.000Z
test/browserEnv.js
pengge/wgis.leaflet.geosearch.vue2
35631df6ee0657e2d128b1cabc785bd718beed19
[ "MIT" ]
212
2016-12-26T16:16:38.000Z
2022-03-31T21:10:16.000Z
test/browserEnv.js
pengge/wgis.leaflet.geosearch.vue2
35631df6ee0657e2d128b1cabc785bd718beed19
[ "MIT" ]
150
2017-01-20T09:03:55.000Z
2022-03-25T20:03:39.000Z
/* eslint-disable no-undef, @typescript-eslint/no-var-requires */ const browserEnv = require('browser-env'); browserEnv(); const fetch = require('node-fetch'); window.fetch = global.fetch = fetch; const leaflet = require('leaflet'); window.L = global.L = leaflet;
26.6
65
0.718045
103da4ff0dcf27241b560ef3a57ecc7a8b797202
2,609
js
JavaScript
src/js/contentscript.js
prince0203/github-file-icon
40f9632bc3840137e480a6103357ca3b39862da7
[ "MIT" ]
null
null
null
src/js/contentscript.js
prince0203/github-file-icon
40f9632bc3840137e480a6103357ca3b39862da7
[ "MIT" ]
null
null
null
src/js/contentscript.js
prince0203/github-file-icon
40f9632bc3840137e480a6103357ca3b39862da7
[ "MIT" ]
null
null
null
import fileIcons from 'file-icons-js'; import '../css/icons.css'; const select = document.querySelector.bind(document); select.all = document.querySelectorAll.bind(document); const getSelector = () => { switch (window.location.hostname) { case 'github.com': return { filenameSelector: 'tr.js-navigation-item > td.content > span > a', iconSelector: 'tr.js-navigation-item > td.icon', host: 'github', }; case 'gitlab.com': return { filenameSelector: 'tr.tree-item > td.tree-item-file-name > a > span', iconSelector: 'tr.tree-item > td.tree-item-file-name > i', host: 'gitlab', }; case 'bitbucket.org': return { filenameSelector: 'tr.iterable-item > td.filename > div > a', iconSelector: 'tr.iterable-item > td.filename > div > a > span', host: 'bitbucket', }; default: return { filenameSelector: 'tr > td.name > a', iconSelector: 'tr > td.name > span', host: 'others', }; } }; const update = () => { const { filenameSelector, iconSelector, host } = getSelector(); const filenameDoms = Array.from(select.all(filenameSelector)); const iconDoms = Array.from(select.all(iconSelector)); const filenameDomsLength = filenameDoms.length; if (filenameDomsLength !== 0) { for (let i = 0; i < filenameDomsLength; i += 1) { const { innerText: filename } = filenameDoms[i]; const iconDom = host === 'github' ? iconDoms[i].querySelector('.octicon') : iconDoms[i]; const isDirectory = iconDom.classList.contains('octicon-file-directory') || iconDom.classList.contains('fa-folder'); const className = fileIcons.getClassWithColor(filename); if (className && !isDirectory) { if (host === 'github') { iconDoms[i].innerHTML = `<span class='icon ${className}'></span>`; } else { const icon = document.createElement('span'); icon.className = `${className}`; icon.style.marginRight = host === 'bitbucket' ? '10px' : '3px'; iconDoms[i].parentNode.replaceChild(icon, iconDoms[i]); } } } } }; const init = () => { const observer = new MutationObserver(update); const observeFragment = () => { const ajaxFiles = select('.file-wrap'); if (ajaxFiles) { observer.observe(ajaxFiles.parentNode, { childList: true, }); } }; update(); observeFragment(); document.addEventListener('pjax:end', update); document.addEventListener('pjax:end', observeFragment); }; init();
29.314607
80
0.60138
103dce95c75d3b0a9d8f44ad4bc20a9ef05430a8
678
js
JavaScript
api/src/jobs/retrieve-summoners.js
maxdeviant/treeline
0bbb1deba867c4550a02e19ec97afecc3d081f94
[ "MIT" ]
null
null
null
api/src/jobs/retrieve-summoners.js
maxdeviant/treeline
0bbb1deba867c4550a02e19ec97afecc3d081f94
[ "MIT" ]
null
null
null
api/src/jobs/retrieve-summoners.js
maxdeviant/treeline
0bbb1deba867c4550a02e19ec97afecc3d081f94
[ "MIT" ]
null
null
null
'use strict'; const path = require('path'); require('app-module-path').addPath(path.join(__dirname, '../')) const config = require('config'); const RiotAPI = require('controllers/riot/index')(config.riot.base_url, config.riot.api_key); const summonersController = require('controllers/treeline/summoners'); module.exports = ((summonerNames) => { RiotAPI.Summoners.getAllByName(summonerNames).then((summoners) => { return summonersController.createMultiple(summoners) }).then(() => { console.log('Done!'); }).catch((err) => { console.log(err); }); })([ 'maxdeviant', 'initinate', 'therastamasta', 'kevbotonline' ]);
24.214286
93
0.650442
103e0300ce033c1e815a9848da12a857e8d21ec8
3,851
js
JavaScript
src/OrgLang.js
jnterry/org-parser
445d2c68d721b95bde796377acabed38236d8588
[ "MIT" ]
null
null
null
src/OrgLang.js
jnterry/org-parser
445d2c68d721b95bde796377acabed38236d8588
[ "MIT" ]
null
null
null
src/OrgLang.js
jnterry/org-parser
445d2c68d721b95bde796377acabed38236d8588
[ "MIT" ]
null
null
null
//////////////////////////////////////////////////////////////////////////// /// Part of org-parser /// //////////////////////////////////////////////////////////////////////////// /// \file OrgLang.js /// \author Jamie Terry /// \date 2017/09/10 /// \brief Defines a parsimmon language for org-mode //////////////////////////////////////////////////////////////////////////// "use strict"; let P = require('./ParserUtils'); ///////////////////////////////////////////////////////////////////// /// \brief Creates an AST node of the specified type from a parser which yielded /// a mark() /// \param type The type of node to create /// \param data Value yielded by parser with a mark() on the end ///////////////////////////////////////////////////////////////////// function createAstNode(type, data){ let result = data.value; if(result === undefined){ result = {}; } result.type = type; result.loc = { start : data.start, end : data.end, }; return result; } ///////////////////////////////////////////////////////////////////// /// \brief Defines a parser that creates an AstNode /// \param node_type Value of the 'type' field of the produced AST node /// \param parser Parser to use to parse the contents of the AST node /// \param mapper Function that is applied as map to result of parser to produce /// the contents of the AST node ///////////////////////////////////////////////////////////////////// function defParser(node_type, parser, mapper){ return { type : node_type, parser : parser = parser.mark().map(x => { x.value = mapper(x.value); return createAstNode(node_type, x); }), }; } let OrgLang = {}; ///////////////////////////////////////////////////////////////////// /// \brief Parses latex equation snippets such as: /// \( 1 + \frac{1}{2} \) /// \[ hi \] /// /// \return /// { /// contents : trimed string contents of the block /// inline : true if \( \), false if \[ \] /// } ///////////////////////////////////////////////////////////////////// OrgLang.equation = defParser( 'equation', P.string('\\') .then(P.oneOf('([')) .chain((x) => { let closer = { '(' : ')', '[' : ']' }[x]; return P.manyUntil(P.any, P.string('\\' + closer)); }), x => { return { contents : x.list.join('').trim(), inline : x.last === '\\)', }; } ); ///////////////////////////////////////////////////////////////////// /// \brief Parses org mode links such as: /// [[file:test.png]] /// [[example.com][click here]] /// /// /// \todo :TODO: parse the target string to get link type etc, /// see: http://orgmode.org/manual/Internal-links.html, /// http://orgmode.org/manual/External-links.html /// \return /// { /// target : contents of first [] - where link is going /// text : contents of second [] - text to display, may be undefined /// } ///////////////////////////////////////////////////////////////////// OrgLang.link = defParser( 'link', P.string('[[') .then( P.seq( P.manyUntil(P.anyButEol, P.string(']')), P.opt( P.string('[').then(P.manyUntil(P.anyButEol, P.string(']'))) ) ) ) .skip(P.string(']')), (x) => { let text = undefined; if(x[1] !== undefined){ text = x[1].list.join(''); } return { target : x[0].list.join(''), text : text, }; } ); ///////////////////////////////////////////////////////////////////// /// \brief Parses a single line of potentially formatted text /// /// \return /// { /// content :: [string or span] - array of children, either just /// plain string of text, or additional span AST nodes /// style :: char - one of the span.STYLE_XXX constants /// } ///////////////////////////////////////////////////////////////////// OrgLang.span = require('./parser_span'); module.exports = OrgLang;
28.738806
83
0.442742
103e251fba48b8c2c02ffb25654c8bf8fe45416b
228
js
JavaScript
app/initializers/list-view-helper.js
jonnii/list-view
26809accdcd34600f583b20813f93c3cdb4bd664
[ "MIT" ]
164
2015-01-04T11:03:45.000Z
2021-05-09T12:36:37.000Z
app/initializers/list-view-helper.js
jonnii/list-view
26809accdcd34600f583b20813f93c3cdb4bd664
[ "MIT" ]
91
2015-01-04T18:18:38.000Z
2017-11-11T13:49:29.000Z
app/initializers/list-view-helper.js
isabella232/list-view
d463fa6f874c143fe4766379594b6c11cdf7a5d0
[ "MIT" ]
44
2015-01-05T11:01:44.000Z
2022-01-18T11:58:35.000Z
import Ember from 'ember'; import {registerListViewHelpers} from 'ember-list-view/helper'; export var initialize = registerListViewHelpers; export default { name: 'list-view-helper', initialize: registerListViewHelpers };
22.8
63
0.780702
103e7d14dea19d5ba5944eac26bb874d00d6eabc
7,411
js
JavaScript
examples/learningwebgl/lesson03.js
shamangeorge/node-webgl
3d6f0a9d3ddae4fd60f9e05cdc85d00915db15f6
[ "BSD-2-Clause" ]
null
null
null
examples/learningwebgl/lesson03.js
shamangeorge/node-webgl
3d6f0a9d3ddae4fd60f9e05cdc85d00915db15f6
[ "BSD-2-Clause" ]
3
2020-04-22T05:43:11.000Z
2021-06-25T15:18:45.000Z
examples/learningwebgl/lesson03.js
fruitopology/node-webgl
3d6f0a9d3ddae4fd60f9e05cdc85d00915db15f6
[ "BSD-2-Clause" ]
null
null
null
var WebGL = require('../../index'), document = WebGL.document(), requestAnimationFrame = document.requestAnimationFrame, fs = require('fs'); eval(fs.readFileSync(__dirname + '/glMatrix-0.9.5.min.js', 'utf8')); var gl; var width = 500; var height = 500; var canvas_id = 'canvas'; var shaders = { fragment: [ '#ifdef GL_ES', 'precision highp float;', '#endif', 'varying vec4 vColor;', 'void main(void) {', ' gl_FragColor = vColor;', '}' ].join('\n'), vertex: [ 'attribute vec3 aVertexPosition;', 'attribute vec4 aVertexColor;', 'uniform mat4 uMVMatrix;', 'uniform mat4 uPMatrix;', 'varying vec4 vColor;', 'void main(void) {', ' gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);', ' vColor = aVertexColor;', '}' ].join('\n') }; var shaderProgram; var triangleVertexPositionBuffer; var triangleVertexColorBuffer; var squareVertexPositionBuffer; var squareVertexColorBuffer; var mvMatrix = mat4.create(); var mvMatrixStack = []; var pMatrix = mat4.create(); var rTri = 0; var rSquare = 0; var lastTime = 0; function mvPushMatrix() { var copy = mat4.create(); mat4.set(mvMatrix, copy); mvMatrixStack.push(copy); } function mvPopMatrix() { if (mvMatrixStack.length == 0) { throw "Invalid popMatrix!"; } mvMatrix = mvMatrixStack.pop(); } function degToRad(degrees) { return degrees * Math.PI / 180; } function initGL(canvas) { try { gl = canvas.getContext("experimental-webgl"); gl.viewportWidth = canvas.width; gl.viewportHeight = canvas.height; } catch (e) {} if (!gl) { console.error("Could not initialise WebGL, sorry :-("); console.error(e.message); } } function initShaders() { var fragmentShader = getShader(gl, "fragment", shaders.fragment); var vertexShader = getShader(gl, "vertex", shaders.vertex); shaderProgram = gl.createProgram(); gl.attachShader(shaderProgram, vertexShader); gl.attachShader(shaderProgram, fragmentShader); gl.linkProgram(shaderProgram); if (!gl.getProgramParameter(shaderProgram, gl.LINK_STATUS)) { alert("Could not initialise shaders"); } gl.useProgram(shaderProgram); shaderProgram.vertexPositionAttribute = gl.getAttribLocation(shaderProgram, "aVertexPosition"); gl.enableVertexAttribArray(shaderProgram.vertexPositionAttribute); shaderProgram.vertexColorAttribute = gl.getAttribLocation(shaderProgram, "aVertexColor"); gl.enableVertexAttribArray(shaderProgram.vertexColorAttribute); shaderProgram.pMatrixUniform = gl.getUniformLocation(shaderProgram, "uPMatrix"); shaderProgram.mvMatrixUniform = gl.getUniformLocation(shaderProgram, "uMVMatrix"); } function getShader(gl, type, content) { if (!type) { console.error('please specify your type of shader'); return null; } var str = content; var shader; if (type == "fragment") { shader = gl.createShader(gl.FRAGMENT_SHADER); } else if (type == "vertex") { shader = gl.createShader(gl.VERTEX_SHADER); } else { console.error('please specify a correct type of shader'); return null; } gl.shaderSource(shader, str); gl.compileShader(shader); if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) { console.error(gl.getShaderInfoLog(shader)); return null; } return shader; } function initBuffers() { triangleVertexPositionBuffer = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, triangleVertexPositionBuffer); var vertices = [ 0.0, 1.0, 0.0, -1.0, -1.0, 0.0, 1.0, -1.0, 0.0 ]; gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW); triangleVertexPositionBuffer.itemSize = 3; triangleVertexPositionBuffer.numItems = 3; triangleVertexColorBuffer = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, triangleVertexColorBuffer); var colors = [ 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, ]; gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(colors), gl.STATIC_DRAW); triangleVertexColorBuffer.itemSize = 4; triangleVertexColorBuffer.numItems = 3; squareVertexPositionBuffer = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, squareVertexPositionBuffer); vertices = [ 1.0, 1.0, 0.0, -1.0, 1.0, 0.0, 1.0, -1.0, 0.0, -1.0, -1.0, 0.0 ]; gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW); squareVertexPositionBuffer.itemSize = 3; squareVertexPositionBuffer.numItems = 4; squareVertexColorBuffer = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, squareVertexColorBuffer); colors = [] for (var i = 0; i < 4; i++) { colors = colors.concat([0.5, 0.5, 1.0, 1.0]); } gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(colors), gl.STATIC_DRAW); squareVertexColorBuffer.itemSize = 4; squareVertexColorBuffer.numItems = 4; } function drawScene() { gl.viewport(0, 0, gl.viewportWidth, gl.viewportHeight); gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); mat4.perspective(45, gl.viewportWidth / gl.viewportHeight, 0.1, 100.0, pMatrix); mat4.identity(mvMatrix); mat4.translate(mvMatrix, [-1.5, 0.0, -7.0]); mvPushMatrix(); mat4.rotate(mvMatrix, degToRad(rTri), [0, 1, 0]); gl.bindBuffer(gl.ARRAY_BUFFER, triangleVertexPositionBuffer); gl.vertexAttribPointer(shaderProgram.vertexPositionAttribute, triangleVertexPositionBuffer.itemSize, gl.FLOAT, false, 0, 0); gl.bindBuffer(gl.ARRAY_BUFFER, triangleVertexColorBuffer); gl.vertexAttribPointer(shaderProgram.vertexColorAttribute, triangleVertexColorBuffer.itemSize, gl.FLOAT, false, 0, 0); setMatrixUniforms(); gl.drawArrays(gl.TRIANGLES, 0, triangleVertexPositionBuffer.numItems); mvPopMatrix(); mat4.translate(mvMatrix, [3.0, 0.0, 0.0]); mvPushMatrix(); mat4.rotate(mvMatrix, degToRad(rSquare), [1, 0, 0]); gl.bindBuffer(gl.ARRAY_BUFFER, squareVertexPositionBuffer); gl.vertexAttribPointer(shaderProgram.vertexPositionAttribute, squareVertexPositionBuffer.itemSize, gl.FLOAT, false, 0, 0); gl.bindBuffer(gl.ARRAY_BUFFER, squareVertexColorBuffer); gl.vertexAttribPointer(shaderProgram.vertexColorAttribute, squareVertexColorBuffer.itemSize, gl.FLOAT, false, 0, 0); setMatrixUniforms(); gl.drawArrays(gl.TRIANGLE_STRIP, 0, squareVertexPositionBuffer.numItems); mvPopMatrix(); } function setMatrixUniforms() { gl.uniformMatrix4fv(shaderProgram.pMatrixUniform, false, pMatrix); gl.uniformMatrix4fv(shaderProgram.mvMatrixUniform, false, mvMatrix); } function webGLStart() { var canvas = document.createElement(canvas_id); canvas.width = width; canvas.height = height; initGL(canvas); initShaders(); initBuffers(); gl.clearColor(0.0, 0.0, 0.0, 1.0); gl.enable(gl.DEPTH_TEST); tick(); } function animate() { var timeNow = new Date().getTime(); if (lastTime != 0) { var elapsed = timeNow - lastTime; rTri += (90 * elapsed) / 1000.0; rSquare += (75 * elapsed) / 1000.0; } lastTime = timeNow; } function tick() { requestAnimationFrame(tick); drawScene(); animate(); } webGLStart();
29.644
128
0.669545
103e92997860bf5662dfd639be0f84f3528089db
87
js
JavaScript
node_modules/carbon-icons-svelte/lib/CloudDownload32/index.js
seekersapp2013/new
1e393c593ad30dc1aa8642703dad69b84bad3992
[ "MIT" ]
null
null
null
node_modules/carbon-icons-svelte/lib/CloudDownload32/index.js
seekersapp2013/new
1e393c593ad30dc1aa8642703dad69b84bad3992
[ "MIT" ]
null
null
null
node_modules/carbon-icons-svelte/lib/CloudDownload32/index.js
seekersapp2013/new
1e393c593ad30dc1aa8642703dad69b84bad3992
[ "MIT" ]
null
null
null
import CloudDownload32 from "./CloudDownload32.svelte"; export default CloudDownload32;
43.5
55
0.850575
103ec3c3972f406edf6361fc9d6914dbe3b06785
6,396
js
JavaScript
src/@redux/crudCreator/slice.js
mytrangnguyen/test-i18next-gatsby
4c42c5da3841ee5c0e9abf08c9bad8c502247962
[ "RSA-MD" ]
null
null
null
src/@redux/crudCreator/slice.js
mytrangnguyen/test-i18next-gatsby
4c42c5da3841ee5c0e9abf08c9bad8c502247962
[ "RSA-MD" ]
null
null
null
src/@redux/crudCreator/slice.js
mytrangnguyen/test-i18next-gatsby
4c42c5da3841ee5c0e9abf08c9bad8c502247962
[ "RSA-MD" ]
null
null
null
import { createSlice } from '@reduxjs/toolkit'; import _, { union } from 'lodash'; import { PRIMARY_KEY } from './dataProvider'; export const INITIAL_STATE = { loading: false, itemLoadings: {}, error: null, data: {}, ids: [], currentId: null, filter: {}, page: 1, pageSize: 20, total: 0, numberOfPages: 1, sort: '', currentData: {}, }; // getAll export const clear = (state) => { state.loading = false; state.ids = []; state.data = {}; state.total = 0; state.numberOfPages = 1; }; export const getAll = (state, { meta: { arg = {} } }) => { const { data = {}, options = {} } = arg; if (options.isRefresh) { // eslint-disable-next-line state = { ...state, ...INITIAL_STATE, loading: true, ...data, currentData: state.currentData, }; } else { // eslint-disable-next-line state = { ...state, loading: true, error: null, page: state.page + 1, offset: state.offset + state.limit, ...data, }; } return state; }; export const getAllSuccess = ( state, { payload: { data, pagging, options } }, ) => { // console.log(pagging) // if (options.isRefresh) { // // eslint-disable-next-line // state = { // ...state, // ...INITIAL_STATE, // loading: true, // ...pagging, // currentData: state.currentData, // }; // } else { // // eslint-disable-next-line // state = { // ...state, // loading: true, // error: null, // page: state.page + 1, // offset: state.offset + state.limit, // ...pagging, // }; // } state.loading = false; state.ids = options.isRefresh ? data.ids : union(state.ids, data.ids); state.data = options.isRefresh ? data.data : { ...state.data, ...data.data }; state.total = data.total; state.page = pagging.page; state.numberOfPages = data.numberOfPages; return state; }; export const getAllFailure = (state, { payload }) => { state.loading = false; state.error = payload?.data || null; return state; }; // getOne export const getDataById = (state, e) => { const { meta: { arg: { data }, }, } = e; state.currentId = data[PRIMARY_KEY]; state.loading = true; state.itemLoadings[data[PRIMARY_KEY]] = true; state.currentData = data; return state; }; export const setCurrent = (state, { payload }) => { state.currentData = payload; return state; }; export const getDataByIdSuccess = (state, { payload: { data } }) => { state.data = { ...state.data, [data?.[PRIMARY_KEY]]: data }; state.loading = false; state.currentData = data; state.itemLoadings[data?.[PRIMARY_KEY]] = false; return state; }; export const getDataByIdFailure = (state, { payload: { data } }) => { state.error = data || null; state.loading = false; state.itemLoadings[data[PRIMARY_KEY]] = false; return state; }; export const create = (state) => { state.error = null; state.loading = false; return state; }; export const createSuccess = (state, { payload: { data } }) => { state.data = { ...state.data, [data[PRIMARY_KEY]]: data }; state.loading = false; state.ids = [...state.ids, data[PRIMARY_KEY]]; state.currentId = data.id; state.error = null; return state; }; export const createFailure = (state, { payload: { data } }) => { state.error = data || null; state.loading = false; return state; }; // Edit export const edit = ( state, { meta: { arg: { data }, }, }, ) => { state.error = null; state.loading = true; state.itemLoadings = { ...state.itemLoadings, [data[PRIMARY_KEY]]: true }; return state; }; export const editSuccess = (state, { payload: { data } }) => { state.error = null; state.loading = true; state.data = { ...state.data, [data[PRIMARY_KEY]]: { ...state.data[data[PRIMARY_KEY]], ...data }, }; state.currentData = data; state.itemLoadings = { ...state.itemLoadings, [data[PRIMARY_KEY]]: false }; return state; }; export const editFailure = (state, { payload: { data } }) => { state.error = data || null; state.itemLoadings = { ...state.itemLoadings, [data[PRIMARY_KEY]]: false }; return state; }; // Delete export const del = ( state, { meta: { arg: { data }, }, }, ) => { state.error = null; state.itemLoadings = data[PRIMARY_KEY] ? { ...state.itemLoadings, [data[PRIMARY_KEY]]: true } : null; return state; }; export const delSuccess = (state, { payload: { data } }) => { delete state.data[data[PRIMARY_KEY]]; state.error = null; state.currentId = null; state.itemLoadings = data[PRIMARY_KEY] ? { ...state.itemLoadings, [data[PRIMARY_KEY]]: null } : null; state.ids = _.xor(state.ids, [data[PRIMARY_KEY]]); state.data = data[PRIMARY_KEY] ? state.data : {}; return state; }; export const delFailure = (state, { payload: { data } }) => { delete state.data[data[PRIMARY_KEY]]; state.error = data || null; state.itemLoadings = data[PRIMARY_KEY] ? { ...state.itemLoadings, [data[PRIMARY_KEY]]: null } : null; return state; }; export const makeCRUDSlice = ( model, actions, customActions = {}, ignoreActions = [], ) => { const extraReducers = { [actions.getAll.pending]: getAll, [actions.getAll.fulfilled]: getAllSuccess, [actions.getAll.rejected]: getAllFailure, [actions.getDataById.pending]: getDataById, [actions.getDataById.fulfilled]: getDataByIdSuccess, [actions.getDataById.rejected]: getDataByIdFailure, [actions.create.pending]: create, [actions.create.fulfilled]: createSuccess, [actions.create.rejected]: createFailure, [actions.edit.pending]: edit, [actions.edit.fulfilled]: editSuccess, [actions.edit.rejected]: editFailure, [actions.del.pending]: del, [actions.del.fulfilled]: delSuccess, [actions.del.rejected]: delFailure, [actions.setCurrent.fulfilled]: setCurrent, [actions.clear.pending]: clear, ...customActions, }; ignoreActions.forEach((element) => { // eslint-disable-next-line const _ignoreActions = Object.keys(extraReducers).filter( (key) => key.indexOf(element) > -1, ); _ignoreActions.forEach((e) => { delete extraReducers[e]; }); }); const slice = createSlice({ name: model, initialState: INITIAL_STATE, reducers: {}, extraReducers, }); return slice; };
23.173913
79
0.607255
103f2526515f3768eac0eb21217d39d3e5d953f6
634
js
JavaScript
Resources/mobileweb/alloy/styles/index.js
appcelerator-se/webinar-components
4c5880fb118d23da2a6c85462b0ba8a41f862258
[ "Apache-2.0" ]
16
2015-03-19T16:34:19.000Z
2020-10-07T03:07:42.000Z
Resources/mobileweb/alloy/styles/index.js
titanium-forks/appcelerator-se.webinar-components
4c5880fb118d23da2a6c85462b0ba8a41f862258
[ "Apache-2.0" ]
1
2016-08-23T11:20:12.000Z
2016-08-23T11:20:12.000Z
Resources/mobileweb/alloy/styles/index.js
titanium-forks/appcelerator-se.webinar-components
4c5880fb118d23da2a6c85462b0ba8a41f862258
[ "Apache-2.0" ]
12
2015-03-19T18:35:37.000Z
2020-10-07T09:31:07.000Z
module.exports = [{"isApi":true,"priority":1000.0027,"key":"Label","style":{width:Ti.UI.SIZE,height:Ti.UI.SIZE,color:"#000",}},{"isClass":true,"priority":10000.0001,"key":"padding-left","style":{left:"10%",}},{"isClass":true,"priority":10000.0002,"key":"padding-right","style":{right:"10%",}},{"isClass":true,"priority":10000.0003,"key":"padding-top","style":{top:"10%",}},{"isClass":true,"priority":10000.0004,"key":"padding-bottom","style":{bottom:"10%",}},{"isClass":true,"priority":10000.0026,"key":"container","style":{backgroundColor:"white",}},{"isId":true,"priority":100000.0028,"key":"label","style":{font:{fontSize:12,},}}];
634
634
0.662461
103f4a80066b3386258da62955e6405259ff8718
94
js
JavaScript
demos/scheme-explorer/index.js
calvinomiguel/node-sketch
f397e6e67a273bd4514eff0bfb9b663bb7fd545d
[ "MIT" ]
298
2017-05-19T15:39:40.000Z
2022-03-24T03:03:06.000Z
demos/scheme-explorer/index.js
calvinomiguel/node-sketch
f397e6e67a273bd4514eff0bfb9b663bb7fd545d
[ "MIT" ]
44
2017-05-27T19:56:32.000Z
2022-02-15T03:17:23.000Z
demos/scheme-explorer/index.js
calvinomiguel/node-sketch
f397e6e67a273bd4514eff0bfb9b663bb7fd545d
[ "MIT" ]
22
2017-12-13T08:01:40.000Z
2021-08-05T08:59:20.000Z
const ns = require('../../'); ns.read('demo.sketch').then(sketch => sketch.saveDir('demo'));
23.5
62
0.606383
103f5ad313d820830339462d14cceb873e5bdf7e
986
js
JavaScript
src/index.js
cchiama/ui-cataloging
443413768e9dc420f75ff03b2b5966ec1b4039c4
[ "Apache-2.0" ]
null
null
null
src/index.js
cchiama/ui-cataloging
443413768e9dc420f75ff03b2b5966ec1b4039c4
[ "Apache-2.0" ]
null
null
null
src/index.js
cchiama/ui-cataloging
443413768e9dc420f75ff03b2b5966ec1b4039c4
[ "Apache-2.0" ]
null
null
null
import React from 'react'; import Route from 'react-router-dom/Route'; import Switch from 'react-router-dom/Switch'; import { Settings } from './Settings'; import Cataloging from './App/Cataloging'; type RoutingProps = {| stripes: { connect: Function, intl: Object }, history: { goBack: Function, pop: Function, push: Function }, match: { path: string, id: string }, location: { pathname: string }, showSettings: bool; |} class CatalogingRouting extends React.Component<RoutingProps, {}> { constructor(props) { super(props); this.connectedApp = props.stripes.connect(Cataloging); } render() { let { showSettings } = this.props; if (showSettings) { return <Settings {...this.props} />; } return ( <Switch> <Route path={`${this.props.match.path}`} render={() => <this.connectedApp {...this.props} />} /> </Switch> ); } } export default CatalogingRouting;
18.603774
67
0.609533
103f93980ae671476ca594c68930fd3bba43957e
1,332
js
JavaScript
src/components/MoviesList/MoviesList.js
izzydoesit/starWarsApi
2d55b3e96040d49df8425a199216fbfee8f1ebd7
[ "Apache-2.0" ]
null
null
null
src/components/MoviesList/MoviesList.js
izzydoesit/starWarsApi
2d55b3e96040d49df8425a199216fbfee8f1ebd7
[ "Apache-2.0" ]
null
null
null
src/components/MoviesList/MoviesList.js
izzydoesit/starWarsApi
2d55b3e96040d49df8425a199216fbfee8f1ebd7
[ "Apache-2.0" ]
null
null
null
import React, { Component } from 'react'; import Movie from '../Movie/Movie'; import Grid from '@material-ui/core/Grid'; import './MoviesList.css'; class MoviesList extends Component { componentWillReceiveProps = (nextProps) => { if (this.props.selected !== nextProps.selected) { this.props.updateFetching(true); } if (this.props.profile !== nextProps.profile) { this.props.getMoviesInfo(nextProps.profile.films); } } render() { const { profile, isFetching, movies, error } = this.props; const displayTitle = Object.keys(profile).length !== 0 && !error ? "Filmography" : "" return ( <div id="movies-list-wrapper"> <h2 id="movies-list-title">{displayTitle}</h2> {error ? <p>{error}</p> : null} { isFetching ? ( <h3>Loading...</h3> ) : ( <div id="movies-list"> <Grid container spacing={24} style={{padding: 24}}> { movies.map((currentMovie, index) => ( <Grid item xs={12} sm={6} lg={4} xl={3} key={index} > <Movie movie={currentMovie} /> </Grid> ))} </Grid> </div> ) } </div> ) } } export default MoviesList;
26.117647
89
0.509009
103f970019b3dda6058d2fa1e64b773d106ca8c5
20,015
js
JavaScript
demo/demo.js
mogilvie/material-table
b748d4ab6bd3a6a68cb473dc3c5a2819364f129d
[ "MIT" ]
null
null
null
demo/demo.js
mogilvie/material-table
b748d4ab6bd3a6a68cb473dc3c5a2819364f129d
[ "MIT" ]
null
null
null
demo/demo.js
mogilvie/material-table
b748d4ab6bd3a6a68cb473dc3c5a2819364f129d
[ "MIT" ]
null
null
null
import { Grid, MuiThemeProvider, Button } from "@material-ui/core"; import { createMuiTheme } from "@material-ui/core/styles"; import React, { Component } from "react"; import ReactDOM from "react-dom"; import MaterialTable from "../src"; import Typography from "@material-ui/core/Typography"; let direction = "ltr"; // direction = 'rtl'; const theme = createMuiTheme({ direction: direction, palette: { type: "light", }, }); const bigData = []; for (let i = 0; i < 1; i++) { const d = { id: i + 1, name: "Name" + i, surname: "Surname" + Math.round(i / 10), isMarried: i % 2 ? true : false, birthDate: new Date(1987, 1, 1), birthCity: 0, sex: i % 2 ? "Male" : "Female", type: "adult", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), }; bigData.push(d); } class App extends Component { tableRef = React.createRef(); colRenderCount = 0; state = { text: "text", selecteds: 0, data: [ { id: 1, name: "A1", surname: "B", isMarried: true, birthDate: new Date(1987, 1, 1), birthCity: 0, sex: "Male", type: "adult", insertDateTime: "1994-11-23T08:15:30-05:00", time: new Date(1900, 1, 1, 14, 23, 35), }, { id: 2, name: "A2", surname: "B", isMarried: false, birthDate: new Date(1987, 1, 1), birthCity: 34, sex: "Female", type: "adult", insertDateTime: "1994-11-05T13:15:30Z", time: new Date(1900, 1, 1, 14, 23, 35), parentId: 1, }, { id: 3, name: "A3", surname: "B", isMarried: true, birthDate: new Date(1987, 1, 1), birthCity: 34, sex: "Female", type: "child", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), parentId: 1, }, { id: 4, name: "A4", surname: "Dede Dede Dede Dede Dede Dede Dede Dede", isMarried: true, birthDate: new Date(1987, 1, 1), birthCity: 34, sex: "Female", type: "child", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), parentId: 3, }, { id: 5, name: "A5", surname: "C", isMarried: false, birthDate: new Date(1987, 1, 1), birthCity: 34, sex: "Female", type: "child", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), }, { id: 6, name: "A6", surname: "C", isMarried: true, birthDate: new Date(1989, 1, 1), birthCity: 34, sex: "Female", type: "child", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), parentId: 5, }, { id: 11, name: "A1", surname: "B", isMarried: true, birthDate: new Date(1987, 1, 1), birthCity: 0, sex: "Male", type: "adult", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), }, { id: 21, name: "A2", surname: "B", isMarried: false, birthDate: new Date(1987, 1, 1), birthCity: 34, sex: "Female", type: "adult", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), parentId: 1, }, { id: 31, name: "A3", surname: "B", isMarried: true, birthDate: new Date(1987, 1, 1), birthCity: 34, sex: "Female", type: "child", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), parentId: 1, }, { id: 41, name: "A4", surname: "Dede", isMarried: true, birthDate: new Date(1987, 1, 1), birthCity: 34, sex: "Female", type: "child", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), parentId: 3, }, { id: 51, name: "A5", surname: "C", isMarried: false, birthDate: new Date(1987, 1, 1), birthCity: 34, sex: "Female", type: "child", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), }, { id: 61, name: "A6", surname: "C", isMarried: true, birthDate: new Date(1989, 1, 1), birthCity: 34, sex: "Female", type: "child", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), parentId: 5, }, { id: 12, name: "A1", surname: "B", isMarried: true, birthDate: new Date(1987, 1, 1), birthCity: 0, sex: "Male", type: "adult", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), }, { id: 22, name: "A2", surname: "B", isMarried: false, birthDate: new Date(1987, 1, 1), birthCity: 34, sex: "Female", type: "adult", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), parentId: 1, }, { id: 32, name: "A3", surname: "B", isMarried: true, birthDate: new Date(1987, 1, 1), birthCity: 34, sex: "Female", type: "child", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), parentId: 1, }, { id: 42, name: "A4", surname: "Dede", isMarried: true, birthDate: new Date(1987, 1, 1), birthCity: 34, sex: "Female", type: "child", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), parentId: 3, }, { id: 52, name: "A5", surname: "C", isMarried: false, birthDate: new Date(1987, 1, 1), birthCity: 34, sex: "Female", type: "child", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), }, { id: 62, name: "A6", surname: "C", isMarried: true, birthDate: new Date(1989, 1, 1), birthCity: 34, sex: "Female", type: "child", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), parentId: 5, }, { id: 13, name: "A1", surname: "B", isMarried: true, birthDate: new Date(1987, 1, 1), birthCity: 0, sex: "Male", type: "adult", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), }, { id: 23, name: "A2", surname: "B", isMarried: false, birthDate: new Date(1987, 1, 1), birthCity: 34, sex: "Female", type: "adult", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), parentId: 1, }, { id: 33, name: "A3", surname: "B", isMarried: true, birthDate: new Date(1987, 1, 1), birthCity: 34, sex: "Female", type: "child", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), parentId: 1, }, { id: 43, name: "A4", surname: "Dede", isMarried: true, birthDate: new Date(1987, 1, 1), birthCity: 34, sex: "Female", type: "child", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), parentId: 3, }, { id: 53, name: "A5", surname: "C", isMarried: false, birthDate: new Date(1987, 1, 1), birthCity: 34, sex: "Female", type: "child", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), }, { id: 63, name: "A6", surname: "C", isMarried: true, birthDate: new Date(1989, 1, 1), birthCity: 34, sex: "Female", type: "child", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), parentId: 5, }, { id: 14, name: "A1", surname: "B", isMarried: true, birthDate: new Date(1987, 1, 1), birthCity: 0, sex: "Male", type: "adult", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), }, { id: 24, name: "A2", surname: "B", isMarried: false, birthDate: new Date(1987, 1, 1), birthCity: 34, sex: "Female", type: "adult", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), parentId: 1, }, { id: 34, name: "A3", surname: "B", isMarried: true, birthDate: new Date(1987, 1, 1), birthCity: 34, sex: "Female", type: "child", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), parentId: 1, }, { id: 44, name: "A4", surname: "Dede", isMarried: true, birthDate: new Date(1987, 1, 1), birthCity: 34, sex: "Female", type: "child", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), parentId: 3, }, { id: 54, name: "A5", surname: "C", isMarried: false, birthDate: new Date(1987, 1, 1), birthCity: 34, sex: "Female", type: "child", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), }, { id: 64, name: "A6", surname: "C", isMarried: true, birthDate: new Date(1989, 1, 1), birthCity: 34, sex: "Female", type: "child", insertDateTime: new Date(2018, 1, 1, 12, 23, 44), time: new Date(1900, 1, 1, 14, 23, 35), parentId: 5, }, ], columns: [ { title: "Adı", customExport: () => "T", field: "name", filterPlaceholder: "Adı filter", tooltip: "This is tooltip text", editPlaceholder: "This is placeholder", maxWidth: 50, }, { title: "Soyadı", field: "surname", initialEditValue: "test", tooltip: "This is tooltip text", editable: "never", resizable: false, }, { title: "Evli", field: "isMarried" }, { title: "Cinsiyet", field: "sex", disableClick: true, editable: "onAdd", }, { title: "Tipi", field: "type", removable: false, editable: "never" }, { title: "Doğum Yılı", field: "birthDate", type: "date" }, { title: "Doğum Yeri", field: "birthCity", lookup: { 34: "İstanbul", 0: "Şanlıurfa" }, }, { title: "Kayıt Tarihi", field: "insertDateTime", type: "datetime" }, { title: "Zaman", field: "time", type: "time" }, ], remoteColumns: [ { title: "Avatar", field: "avatar", render: (rowData) => ( <img style={{ height: 36, borderRadius: "50%" }} src={rowData.avatar} /> ), tooltip: "delakjdslkjdaskljklsdaj", }, { title: "Id", field: "id" }, { title: "First Name", field: "first_name", defaultFilter: "De" }, { title: "Last Name", field: "last_name" }, ], }; render() { return ( <> <MuiThemeProvider theme={theme}> <div style={{ maxWidth: "100%", direction }}> <Grid container> <Grid item xs={12}> {this.state.selectedRows && this.state.selectedRows.length} <MaterialTable tableRef={this.tableRef} columns={this.state.columns} data={this.state.data} title="Demo Title" onFilterChange={(appliedFilter) => { console.log("selected Filters : ", appliedFilter); }} // cellEditable={{ // cellStyle: {}, // onCellEditApproved: ( // newValue, // oldValue, // rowData, // columnDef // ) => { // return new Promise((resolve, reject) => { // console.log("newValue: " + newValue); // setTimeout(resolve, 4000); // }); // }, // }} options={{ tableLayout: "fixed", columnResizable: true, exportButton: true, headerSelectionProps: { color: "primary", }, selection: false, selectionProps: (rowData) => { rowData.tableData.disabled = rowData.name === "A1"; return { disabled: rowData.name === "A1", color: "primary", }; }, }} // editable={{ // onBulkUpdate: (changedRows) => // new Promise((resolve, reject) => { // console.log(changedRows); // setTimeout(() => { // { // /* const data = this.state.data; // data.push(newData); // this.setState({ data }, () => resolve()); */ // } // resolve(); // }, 1000); // }), // onRowAdd: (newData) => // new Promise((resolve, reject) => { // setTimeout(() => { // { // /* const data = this.state.data; // data.push(newData); // this.setState({ data }, () => resolve()); */ // } // resolve(); // }, 1000); // }), // onRowUpdate: (newData, oldData) => // new Promise((resolve, reject) => { // setTimeout(() => { // { // /* const data = this.state.data; // const index = data.indexOf(oldData); // data[index] = newData; // this.setState({ data }, () => resolve()); */ // } // resolve(); // }, 1000); // }), // onRowDelete: (oldData) => // new Promise((resolve, reject) => { // setTimeout(() => { // { // /* let data = this.state.data; // const index = data.indexOf(oldData); // data.splice(index, 1); // this.setState({ data }, () => resolve()); */ // } // resolve(); // }, 1000); // }), // }} localization={{ body: { emptyDataSourceMessage: "No records to display", filterRow: { filterTooltip: "Filter", filterPlaceHolder: "Filtaaer", }, }, }} onSearchChange={(e) => console.log("search changed: " + e)} onColumnDragged={(oldPos, newPos) => console.log( "Dropped column from " + oldPos + " to position " + newPos ) } // parentChildData={(row, rows) => rows.find(a => a.id === row.parentId)} /> </Grid> </Grid> {this.state.text} <button onClick={() => this.tableRef.current.onAllSelected(true)} style={{ margin: 10 }} > Select </button> {/* <MaterialTable title={ <Typography variant="h6" color="primary"> Remote Data Preview </Typography> } columns={[ { title: "Avatar", field: "avatar", render: (rowData) => ( <img style={{ height: 36, borderRadius: "50%" }} src={rowData.avatar} /> ), }, { title: "Id", field: "id", filterOnItemSelect: true, filterPlaceholder: "placeholder", lookup: { 1: "1", 2: "2", 3: "3", 4: "4", 5: "5", 6: "6", 7: "7", 8: "8", 9: "9", 10: "10", 11: "11", 12: "12", }, }, { title: "First Name", field: "first_name" }, { title: "Last Name", field: "last_name" }, ]} options={{ filtering: true, grouping: true, groupTitle: (group) => group.data.length, searchFieldVariant: "outlined", }} localization={{ toolbar: { searchPlaceholder: "Outlined Search Field", }, }} data={(query) => new Promise((resolve, reject) => { let url = "https://reqres.in/api/users?"; url += "per_page=" + query.pageSize; url += "&page=" + (query.page + 1); console.log(query); fetch(url) .then((response) => response.json()) .then((result) => { resolve({ data: result.data, page: result.page - 1, totalCount: result.total, }); }); }) } /> */} </div> </MuiThemeProvider> </> ); } } ReactDOM.render(<App />, document.getElementById("app")); module.hot.accept();
29.520649
91
0.39995
1040732132feae0988b4fa4e2e92ae8ade8347d6
171
js
JavaScript
fuzzer_output/interesting/sample_1554482881768.js
patil215/v8
bb941b58df9ee1e4048b69a555a2ce819fb819ed
[ "BSD-3-Clause" ]
null
null
null
fuzzer_output/interesting/sample_1554482881768.js
patil215/v8
bb941b58df9ee1e4048b69a555a2ce819fb819ed
[ "BSD-3-Clause" ]
null
null
null
fuzzer_output/interesting/sample_1554482881768.js
patil215/v8
bb941b58df9ee1e4048b69a555a2ce819fb819ed
[ "BSD-3-Clause" ]
null
null
null
function main() { const v2 = new Uint32Array(56871); const v5 = new Float32Array(1337); const v8 = v2.set(v5,Function,1529365101); } %NeverOptimizeFunction(main); main();
21.375
42
0.730994
104080ba5795156d8d5189a3206ea5fce18f04b9
206
js
JavaScript
bundles/framework/bundle/promote/locale/fi.js
uhef/Oskari-Routing-frontend
5f4002760ea01f79aadde2af8bf05753f4ae3de3
[ "MIT" ]
null
null
null
bundles/framework/bundle/promote/locale/fi.js
uhef/Oskari-Routing-frontend
5f4002760ea01f79aadde2af8bf05753f4ae3de3
[ "MIT" ]
null
null
null
bundles/framework/bundle/promote/locale/fi.js
uhef/Oskari-Routing-frontend
5f4002760ea01f79aadde2af8bf05753f4ae3de3
[ "MIT" ]
null
null
null
Oskari.registerLocalization( { "lang": "fi", "key": "Promote", "value": { "title": "Sisäänkirjautuneille", "desc": "Sisäänkirjautuneena saat lisää toiminnallisuuksia." } } );
20.6
68
0.592233
1040de86829a49d052b4662171f14e82cd803391
573
js
JavaScript
src/states/RuleSelectedState.js
gbagolin/explainable-ai-gatsby-version
035344b815297a342436bbb0feeb145eec6d5fe7
[ "RSA-MD" ]
1
2021-04-01T14:31:52.000Z
2021-04-01T14:31:52.000Z
src/states/RuleSelectedState.js
gbagolin/explainable-ai-gatsby-version
035344b815297a342436bbb0feeb145eec6d5fe7
[ "RSA-MD" ]
null
null
null
src/states/RuleSelectedState.js
gbagolin/explainable-ai-gatsby-version
035344b815297a342436bbb0feeb145eec6d5fe7
[ "RSA-MD" ]
1
2021-05-30T07:25:01.000Z
2021-05-30T07:25:01.000Z
import create from "zustand" /** * TODO: add the comment here * @type {UseStore<{setRuleString: function(*=): *, ruleString: string, setIndex: function(*=): *, index: string}>} */ const RuleSelectedState = create(set => ({ ruleString: "", ruleId: 0, actionId: 0, setStore: store => set(() => store), setRuleString: newRuleString => set(() => ({ ruleString: newRuleString, })), setRuleId: id => set(() => ({ ruleId: id, })), setActionId: id => set(() => ({ actionId: id, })), })) export default RuleSelectedState
21.222222
115
0.572426
10414e9130055d1e6a4bc8879fda9656ebff564d
200
js
JavaScript
src/utils/index.js
moning3/lazyForumDemo
e9af90be508dda861b99dc853c62697188379b8d
[ "MIT" ]
null
null
null
src/utils/index.js
moning3/lazyForumDemo
e9af90be508dda861b99dc853c62697188379b8d
[ "MIT" ]
null
null
null
src/utils/index.js
moning3/lazyForumDemo
e9af90be508dda861b99dc853c62697188379b8d
[ "MIT" ]
null
null
null
import moment from 'moment' // 时间格式 export function formatDate (time, format = 'YYYY-MM-DD') { if (!time) { return '' } const date = new Date(time) return moment(date).format(format) }
15.384615
58
0.64
104155feee90f98c6e42be5c8d03dac4500545ab
124
js
JavaScript
src/constants.js
onelive-dev/luxon-business-days
b870dcf0db46ce0da7c3fd2c52cdaad8460d99d1
[ "MIT" ]
24
2020-02-03T16:56:21.000Z
2022-02-11T06:11:13.000Z
src/constants.js
onelive-dev/luxon-business-days
b870dcf0db46ce0da7c3fd2c52cdaad8460d99d1
[ "MIT" ]
38
2019-09-01T09:22:36.000Z
2022-02-23T13:05:58.000Z
src/constants.js
onelive-dev/luxon-business-days
b870dcf0db46ce0da7c3fd2c52cdaad8460d99d1
[ "MIT" ]
11
2020-02-15T10:37:05.000Z
2022-01-14T18:12:21.000Z
export const MONTH = { january: 1, may: 5, september: 9, october: 10, november: 11, }; export const ONE_WEEK = 7;
13.777778
26
0.620968
1041ae3e26c19338ac116aa59b1c80b441697c3d
2,688
js
JavaScript
server/test/api.test.js
vip1all/ts3-admin-charts
5e33ce3ed6cd17f1597f47e0b41fe2870a929968
[ "MIT" ]
1
2018-02-03T12:39:38.000Z
2018-02-03T12:39:38.000Z
server/test/api.test.js
vip1all/ts3-admin-charts
5e33ce3ed6cd17f1597f47e0b41fe2870a929968
[ "MIT" ]
null
null
null
server/test/api.test.js
vip1all/ts3-admin-charts
5e33ce3ed6cd17f1597f47e0b41fe2870a929968
[ "MIT" ]
null
null
null
const rauth = require('request-promise').defaults({json: true, baseUrl: 'http://localhost:3000'}); const rapi = require('request-promise').defaults({json: true, baseUrl: 'http://localhost:3000/api'}); function authenticateAsUser () { return rauth.post('/auth', { body: {username: "user", password: "password"} }) .then(data => data.token); } function authenticateAsAdmin () { return rauth.post('/auth', { body: {username: "user", password: "administrator_password_1234"} }) .then(data => data.token); } describe('/auth', () => { it('Authenticates user properly! Test data is user:password', (done) => { rauth.post('/auth', { body: { username: "user", password: "password" } }).then(res => { done(); }) .catch(err => done(err)); }); }); describe('/api/reg', () => { it('Returns users registered by administrator with id 42230 from 2018-01-25 to 2018-01-30', done => { const ids = 42230, from = '2018-01-25', to = '2018-01-30'; const dateFrom = new Date(2018, 0, 25), dateTo = new Date(2018, 0, 30); authenticateAsUser().then(token => { const url = `/reg?ids=${ids}&from=${from}&to=${to}`; rapi.get(url, {headers: {'Authorization': token}}) .then(data => { console.log(data.data[0].count); if (data.length == 0) throw new Error('Registered clients not found! It should return a lot of data!'); // const invalidDates = data.map(client => client.registrationDate).filter(date => date > dateTo || date < dateFrom); // if (invalidDates.length > 0) throw new Error('Returned dates are not in the requested range! ' + url); else done(); }) .catch(err => done(err)); }) }) }) describe('/api/users', () => { describe('GET', () => { it('Should return users array without password.', (done) => { authenticateAsUser().then(token => { rapi.get('/users', {headers: {'Authorization': token}}) .then(data => data.users) .then(users => { if (users.length) return users; else throw new Error('Users data empty!'); }) .then(users => users.filter(user => user.password)) .then(users => !users.length ? done() : done(new Error('Returned user data has includes password!'))) .catch(err => done(err)); }) }) }) })
38.956522
137
0.512277
104228182a578e471df3641f6f7b50a993aced8d
3,642
js
JavaScript
client/src/components/policy/terms.js
ORKO06/project-tahiti-1
c5dda85b31f6ccd3ac53de23b64e317db3e68d1f
[ "MIT" ]
5
2022-03-16T19:49:29.000Z
2022-03-18T08:48:36.000Z
client/src/components/policy/terms.js
ORKO06/project-tahiti-1
c5dda85b31f6ccd3ac53de23b64e317db3e68d1f
[ "MIT" ]
2
2022-03-16T14:24:27.000Z
2022-03-17T17:20:26.000Z
client/src/components/policy/terms.js
ORKO06/project-tahiti-1
c5dda85b31f6ccd3ac53de23b64e317db3e68d1f
[ "MIT" ]
3
2022-03-16T10:01:53.000Z
2022-03-16T19:44:16.000Z
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */ /* eslint-disable jsx-a11y/no-static-element-interactions */ /* eslint-disable jsx-a11y/click-events-have-key-events */ import React, { useState } from 'react'; // libararies import { makeStyles, Typography, useMediaQuery } from '@material-ui/core'; // theme import theme from '../../config/themes/light'; // placeholder import { POLICY } from '../../assets/placeholder/policy'; const LiveData = () => { const classes = useStyles(); const Desktop = useMediaQuery(theme.breakpoints.up('md')); const [activeType, setType] = useState(0); return ( <> <div className={classes.title}> <Typography variant='h1'>Terms and Policies</Typography> </div> {Desktop ? ( <div className={classes.typeWrapper}> {POLICY.map((policy, key) => ( <Typography variant='body1' key={policy.type} style={{ paddingBottom: '1px', borderBottom: activeType === key ? '2px solid #006DCC' : 'none', color: activeType === key ? '#222222' : '#999999', cursor: 'pointer', }} onClick={() => setType(key)} > {policy.type} </Typography> ))} </div> ) : ( <div className={classes.typeWrapper}> {POLICY.map((policy, key) => ( <div key={policy.type} className={classes.batch} onClick={() => setType(key)} > <Typography variant='body2'>{policy.type}</Typography> </div> ))} </div> )} <div style={{ marginBottom: '4rem' }}> <Typography variant='h2'>{POLICY[activeType].type}</Typography> <Typography variant='body1' className={classes.bodyText}> {POLICY[activeType].text} </Typography> <ol style={{ listStyleType: 'decimal' }}> {POLICY[activeType].terms.map((term) => ( <li key={term.body} className={classes.bodyItem}> <Typography variant='body1' className={classes.bodyText} style={{ fontWeight: 700 }} > {term.title} </Typography> <Typography variant='body1' className={classes.bodyText}> {term.subtitle} </Typography> <Typography variant='body1' className={classes.bodyText}> {term.body} </Typography> </li> ))} </ol> </div> </> ); }; export default LiveData; const useStyles = makeStyles(() => ({ title: { textAlign: 'center', margin: '2rem 0rem 1rem 0rem', color: theme.palette.secondary.main, }, typeWrapper: { margin: '2rem 0rem', display: 'flex', flexDirection: 'row', justifyContent: 'space-between', [theme.breakpoints.down('sm')]: { flexWrap: 'wrap', justifyContent: 'flex-start', }, }, batch: { backgroundColor: theme.palette.primary.blue10, cursor: 'pointer', userSelect: 'none', padding: '8px 3px', margin: '4px', }, bodyItem: { fontFamily: 'Source Sans Pro', fontWeight: 700, fontSize: '1.25rem', lineHeight: '1.75rem', '@media (max-width:600px)': { fontSize: '1rem', lineHeight: '1.5rem', }, }, bodyText: { marginTop: '2rem', fontFamily: 'Source Sans Pro', fontWeight: 400, [theme.breakpoints.down('md')]: { marginTop: '1rem', }, }, }));
28.015385
80
0.528007
10422dff77e9c5c9aeb8b25059945156e64cd10a
7,755
js
JavaScript
src/passes/BlurPass.js
arpu/postprocessing
4d61d6121e6e9d9f13fb93bfb6df6a841d5070e3
[ "Zlib" ]
null
null
null
src/passes/BlurPass.js
arpu/postprocessing
4d61d6121e6e9d9f13fb93bfb6df6a841d5070e3
[ "Zlib" ]
null
null
null
src/passes/BlurPass.js
arpu/postprocessing
4d61d6121e6e9d9f13fb93bfb6df6a841d5070e3
[ "Zlib" ]
null
null
null
import { LinearFilter, RGBFormat, UnsignedByteType, WebGLRenderTarget } from "three"; import { ConvolutionMaterial, KernelSize } from "../materials"; import { Resizer } from "../core/Resizer"; import { Pass } from "./Pass"; /** * An efficient, incremental blur pass. */ export class BlurPass extends Pass { /** * Constructs a new blur pass. * * @param {Object} [options] - The options. * @param {Number} [options.resolutionScale=0.5] - Deprecated. Adjust the height or width instead for consistent results. * @param {Number} [options.width=Resizer.AUTO_SIZE] - The blur render width. * @param {Number} [options.height=Resizer.AUTO_SIZE] - The blur render height. * @param {KernelSize} [options.kernelSize=KernelSize.LARGE] - The blur kernel size. */ constructor({ resolutionScale = 0.5, width = Resizer.AUTO_SIZE, height = Resizer.AUTO_SIZE, kernelSize = KernelSize.LARGE } = {}) { super("BlurPass"); /** * A render target. * * @type {WebGLRenderTarget} * @private */ this.renderTargetA = new WebGLRenderTarget(1, 1, { minFilter: LinearFilter, magFilter: LinearFilter, stencilBuffer: false, depthBuffer: false }); this.renderTargetA.texture.name = "Blur.Target.A"; /** * A second render target. * * @type {WebGLRenderTarget} * @private */ this.renderTargetB = this.renderTargetA.clone(); this.renderTargetB.texture.name = "Blur.Target.B"; /** * The render resolution. * * It's recommended to set the height or the width to an absolute value for * consistent results across different devices and resolutions. * * @type {Resizer} */ this.resolution = new Resizer(this, width, height, resolutionScale); /** * A convolution shader material. * * @type {ConvolutionMaterial} * @private */ this.convolutionMaterial = new ConvolutionMaterial(); /** * A convolution shader material that uses dithering. * * @type {ConvolutionMaterial} * @private */ this.ditheredConvolutionMaterial = new ConvolutionMaterial(); this.ditheredConvolutionMaterial.dithering = true; /** * Whether the blurred result should also be dithered using noise. * * @type {Boolean} * @deprecated Set the frameBufferType of the EffectComposer to HalfFloatType instead. */ this.dithering = false; this.kernelSize = kernelSize; } /** * The current width of the internal render targets. * * @type {Number} * @deprecated Use resolution.width instead. */ get width() { return this.resolution.width; } /** * Sets the render width. * * @type {Number} * @deprecated Use resolution.width instead. */ set width(value) { this.resolution.width = value; } /** * The current height of the internal render targets. * * @type {Number} * @deprecated Use resolution.height instead. */ get height() { return this.resolution.height; } /** * Sets the render height. * * @type {Number} * @deprecated Use resolution.height instead. */ set height(value) { this.resolution.height = value; } /** * The current blur scale. * * @type {Number} */ get scale() { return this.convolutionMaterial.uniforms.scale.value; } /** * Sets the blur scale. * * This value influences the overall blur strength and should not be greater * than 1. For larger blurs please increase the {@link kernelSize}! * * Note that the blur strength is closely tied to the resolution. For a smooth * transition from no blur to full blur, set the width or the height to a high * enough value. * * @type {Number} */ set scale(value) { this.convolutionMaterial.uniforms.scale.value = value; this.ditheredConvolutionMaterial.uniforms.scale.value = value; } /** * The kernel size. * * @type {KernelSize} */ get kernelSize() { return this.convolutionMaterial.kernelSize; } /** * Sets the kernel size. * * Larger kernels require more processing power but scale well with larger * render resolutions. * * @type {KernelSize} */ set kernelSize(value) { this.convolutionMaterial.kernelSize = value; this.ditheredConvolutionMaterial.kernelSize = value; } /** * Returns the current resolution scale. * * @return {Number} The resolution scale. * @deprecated Adjust the fixed resolution width or height instead. */ getResolutionScale() { return this.resolution.scale; } /** * Sets the resolution scale. * * @param {Number} scale - The new resolution scale. * @deprecated Adjust the fixed resolution width or height instead. */ setResolutionScale(scale) { this.resolution.scale = scale; } /** * Blurs the input buffer and writes the result to the output buffer. The * input buffer remains intact, unless it's also the output buffer. * * @param {WebGLRenderer} renderer - The renderer. * @param {WebGLRenderTarget} inputBuffer - A frame buffer that contains the result of the previous pass. * @param {WebGLRenderTarget} outputBuffer - A frame buffer that serves as the output render target unless this pass renders to screen. * @param {Number} [deltaTime] - The time between the last frame and the current one in seconds. * @param {Boolean} [stencilTest] - Indicates whether a stencil mask is active. */ render(renderer, inputBuffer, outputBuffer, deltaTime, stencilTest) { const scene = this.scene; const camera = this.camera; const renderTargetA = this.renderTargetA; const renderTargetB = this.renderTargetB; let material = this.convolutionMaterial; let uniforms = material.uniforms; const kernel = material.getKernel(); let lastRT = inputBuffer; let destRT; let i, l; this.setFullscreenMaterial(material); // Apply the multi-pass blur. for(i = 0, l = kernel.length - 1; i < l; ++i) { // Alternate between targets. destRT = ((i & 1) === 0) ? renderTargetA : renderTargetB; uniforms.kernel.value = kernel[i]; uniforms.inputBuffer.value = lastRT.texture; renderer.setRenderTarget(destRT); renderer.render(scene, camera); lastRT = destRT; } if(this.dithering) { material = this.ditheredConvolutionMaterial; uniforms = material.uniforms; this.setFullscreenMaterial(material); } uniforms.kernel.value = kernel[i]; uniforms.inputBuffer.value = lastRT.texture; renderer.setRenderTarget(this.renderToScreen ? null : outputBuffer); renderer.render(scene, camera); } /** * Updates the size of this pass. * * @param {Number} width - The width. * @param {Number} height - The height. */ setSize(width, height) { const resolution = this.resolution; resolution.base.set(width, height); const w = resolution.width; const h = resolution.height; this.renderTargetA.setSize(w, h); this.renderTargetB.setSize(w, h); this.convolutionMaterial.setTexelSize(1.0 / w, 1.0 / h); this.ditheredConvolutionMaterial.setTexelSize(1.0 / w, 1.0 / h); } /** * Performs initialization tasks. * * @param {WebGLRenderer} renderer - The renderer. * @param {Boolean} alpha - Whether the renderer uses the alpha channel or not. * @param {Number} frameBufferType - The type of the main frame buffers. */ initialize(renderer, alpha, frameBufferType) { if(!alpha && frameBufferType === UnsignedByteType) { this.renderTargetA.texture.format = RGBFormat; this.renderTargetB.texture.format = RGBFormat; } if(frameBufferType !== undefined) { this.renderTargetA.texture.type = frameBufferType; this.renderTargetB.texture.type = frameBufferType; } } /** * An auto sizing flag. * * @type {Number} * @deprecated Use {@link Resizer.AUTO_SIZE} instead. */ static get AUTO_SIZE() { return Resizer.AUTO_SIZE; } }
21.541667
136
0.68343
10423280d998c1ac7439393bfea006969e71d915
2,599
js
JavaScript
public/javascripts/upcomingDevices/upcomingDEvice.js
shobhitsingh29/asset-tracker
29ff09c026815d8e862919b4872c9b42127b77fa
[ "MIT" ]
null
null
null
public/javascripts/upcomingDevices/upcomingDEvice.js
shobhitsingh29/asset-tracker
29ff09c026815d8e862919b4872c9b42127b77fa
[ "MIT" ]
4
2020-09-29T23:23:54.000Z
2021-06-25T15:43:00.000Z
public/javascripts/upcomingDevices/upcomingDEvice.js
shobhitsingh29/asset-tracker
29ff09c026815d8e862919b4872c9b42127b77fa
[ "MIT" ]
null
null
null
/* * upcomingDevice.js * This file adds the upcoming device to database successfully. * @project Asset Tracker * @author Plavika Singh, SapientNitro */ (function($, at, window, document) { 'use strict'; var upcomingDevice, init; upcomingDevice= function() { var checkUpcomingDevice, _submitData; //Drop down using jquery ui $("#browserDropBox").selectmenu(); _submitData = function (response) { var $popUpContent = $(".popup-data"); if (response) { $popUpContent.find("span").text(config.infoMsg.successfulUpdate); $(".popup-button-hide").on("click", function () { window.location.href = config.templateUrl.upcomingDevicePage; }); } else { $popUpContent.find("span").text(); $(".popup-button-hide").on("click", function () { window.location.href = config.templateUrl.upcomingDevicePage; }); } }; checkUpcomingDevice = function () { $("#upcomingDevice").validate({ //Validation rules rules: at.formValidator.formValidation.rules, messages: at.formValidator.formValidation.messages, highlight: at.formValidator.formValidation.highlight, unhighlight: at.formValidator.formValidation.unhighlight, checkNameMethod: at.formValidator.formValidation.checkNameMethod, submitHandler : function () { var data; data = { data: [{ deviceType: $('#deviceType').val(), deviceName: $('#deviceName').val(), os: $('#os').val(), defaultApplications: $('#defaultApplications').val(), browserDropBox: $('#browserDropBox').val() }], key: "deviceType" }; //AJAX request to put data to JSON file util.ajaxCall(config.json.putUpcomingDevice, "PUT", data, _submitData); } }) }; init =function(){ checkUpcomingDevice(); }; $(document).ready(init); }; at.upcomingDeviceValidation = new upcomingDevice(); })((typeof window.jQuery !== "undefined") ? window.jQuery : null , window.AT || window , window.document);
33.320513
106
0.502501
10428833a5f4949b37cfd0345f706458d6a4a76c
33
js
JavaScript
app/photo-list/photo-list.module.js
vivaelnino9/johnnyglenn
a061376458d172991af3d449a7e923dbb71555c5
[ "MIT" ]
null
null
null
app/photo-list/photo-list.module.js
vivaelnino9/johnnyglenn
a061376458d172991af3d449a7e923dbb71555c5
[ "MIT" ]
null
null
null
app/photo-list/photo-list.module.js
vivaelnino9/johnnyglenn
a061376458d172991af3d449a7e923dbb71555c5
[ "MIT" ]
null
null
null
angular.module('photoList', []);
16.5
32
0.666667
1042b81ab0f8f5c0f3ffa4c5992bbcd0552642df
12,729
js
JavaScript
dist/Actions/ActionContext.js
excaliburjs/excalibur-dist
d29b9a0c2be41c5578eee3dba736b5969be5204e
[ "BSD-2-Clause-FreeBSD" ]
2
2017-11-07T14:53:18.000Z
2019-10-30T03:26:53.000Z
dist/Actions/ActionContext.js
excaliburjs/excalibur-dist
d29b9a0c2be41c5578eee3dba736b5969be5204e
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
dist/Actions/ActionContext.js
excaliburjs/excalibur-dist
d29b9a0c2be41c5578eee3dba736b5969be5204e
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
import * as Actions from './Action'; import { EasingFunctions } from '../Util/EasingFunctions'; /** * The fluent Action API allows you to perform "actions" on * [[Actor|Actors]] such as following, moving, rotating, and * more. You can implement your own actions by implementing * the [[Action]] interface. */ export class ActionContext { constructor() { this._actors = []; this._queues = []; if (arguments !== null) { this._actors = Array.prototype.slice.call(arguments, 0); this._queues = this._actors.map((a) => { return a.actionQueue; }); } } /** * Clears all queued actions from the Actor */ clearActions() { const len = this._queues.length; for (let i = 0; i < len; i++) { this._queues[i].clearActions(); } } addActorToContext(actor) { this._actors.push(actor); // if we run into problems replace the line below with: this._queues.push(actor.actionQueue); } removeActorFromContext(actor) { const index = this._actors.indexOf(actor); if (index > -1) { this._actors.splice(index, 1); this._queues.splice(index, 1); } } /** * This method will move an actor to the specified `x` and `y` position over the * specified duration using a given [[EasingFunctions]] and return back the actor. This * method is part of the actor 'Action' fluent API allowing action chaining. * @param x The x location to move the actor to * @param y The y location to move the actor to * @param duration The time it should take the actor to move to the new location in milliseconds * @param easingFcn Use [[EasingFunctions]] or a custom function to use to calculate position */ easeTo(x, y, duration, easingFcn = EasingFunctions.Linear) { const len = this._queues.length; for (let i = 0; i < len; i++) { this._queues[i].add(new Actions.EaseTo(this._actors[i], x, y, duration, easingFcn)); } return this; } /** * This method will move an actor to the specified x and y position at the * speed specified (in pixels per second) and return back the actor. This * method is part of the actor 'Action' fluent API allowing action chaining. * @param x The x location to move the actor to * @param y The y location to move the actor to * @param speed The speed in pixels per second to move */ moveTo(x, y, speed) { const len = this._queues.length; for (let i = 0; i < len; i++) { this._queues[i].add(new Actions.MoveTo(this._actors[i], x, y, speed)); } return this; } /** * This method will move an actor by the specified x offset and y offset from its current position, at a certain speed. * This method is part of the actor 'Action' fluent API allowing action chaining. * @param xOffset The x offset to apply to this actor * @param yOffset The y location to move the actor to * @param speed The speed in pixels per second the actor should move */ moveBy(xOffset, yOffset, speed) { const len = this._queues.length; for (let i = 0; i < len; i++) { this._queues[i].add(new Actions.MoveBy(this._actors[i], xOffset, yOffset, speed)); } return this; } /** * This method will rotate an actor to the specified angle at the speed * specified (in radians per second) and return back the actor. This * method is part of the actor 'Action' fluent API allowing action chaining. * @param angleRadians The angle to rotate to in radians * @param speed The angular velocity of the rotation specified in radians per second * @param rotationType The [[RotationType]] to use for this rotation */ rotateTo(angleRadians, speed, rotationType) { const len = this._queues.length; for (let i = 0; i < len; i++) { this._queues[i].add(new Actions.RotateTo(this._actors[i], angleRadians, speed, rotationType)); } return this; } /** * This method will rotate an actor by the specified angle offset, from it's current rotation given a certain speed * in radians/sec and return back the actor. This method is part * of the actor 'Action' fluent API allowing action chaining. * @param angleRadiansOffset The angle to rotate to in radians relative to the current rotation * @param speed The speed in radians/sec the actor should rotate at * @param rotationType The [[RotationType]] to use for this rotation, default is shortest path */ rotateBy(angleRadiansOffset, speed, rotationType) { const len = this._queues.length; for (let i = 0; i < len; i++) { this._queues[i].add(new Actions.RotateBy(this._actors[i], angleRadiansOffset, speed, rotationType)); } return this; } /** * This method will scale an actor to the specified size at the speed * specified (in magnitude increase per second) and return back the * actor. This method is part of the actor 'Action' fluent API allowing * action chaining. * @param sizeX The scaling factor to apply on X axis * @param sizeY The scaling factor to apply on Y axis * @param speedX The speed of scaling specified in magnitude increase per second on X axis * @param speedY The speed of scaling specified in magnitude increase per second on Y axis */ scaleTo(sizeX, sizeY, speedX, speedY) { const len = this._queues.length; for (let i = 0; i < len; i++) { this._queues[i].add(new Actions.ScaleTo(this._actors[i], sizeX, sizeY, speedX, speedY)); } return this; } /** * This method will scale an actor by an amount relative to the current scale at a certain speed in scale units/sec * and return back the actor. This method is part of the * actor 'Action' fluent API allowing action chaining. * @param sizeOffsetX The scaling factor to apply on X axis * @param sizeOffsetY The scaling factor to apply on Y axis * @param speed The speed to scale at in scale units/sec */ scaleBy(sizeOffsetX, sizeOffsetY, speed) { const len = this._queues.length; for (let i = 0; i < len; i++) { this._queues[i].add(new Actions.ScaleBy(this._actors[i], sizeOffsetX, sizeOffsetY, speed)); } return this; } /** * This method will cause an actor to blink (become visible and not * visible). Optionally, you may specify the number of blinks. Specify the amount of time * the actor should be visible per blink, and the amount of time not visible. * This method is part of the actor 'Action' fluent API allowing action chaining. * @param timeVisible The amount of time to stay visible per blink in milliseconds * @param timeNotVisible The amount of time to stay not visible per blink in milliseconds * @param numBlinks The number of times to blink */ blink(timeVisible, timeNotVisible, numBlinks = 1) { const len = this._queues.length; for (let i = 0; i < len; i++) { this._queues[i].add(new Actions.Blink(this._actors[i], timeVisible, timeNotVisible, numBlinks)); } return this; } /** * This method will cause an actor's opacity to change from its current value * to the provided value by a specified time (in milliseconds). This method is * part of the actor 'Action' fluent API allowing action chaining. * @param opacity The ending opacity * @param time The time it should take to fade the actor (in milliseconds) */ fade(opacity, time) { const len = this._queues.length; for (let i = 0; i < len; i++) { this._queues[i].add(new Actions.Fade(this._actors[i], opacity, time)); } return this; } /** * This method will delay the next action from executing for a certain * amount of time (in milliseconds). This method is part of the actor * 'Action' fluent API allowing action chaining. * @param time The amount of time to delay the next action in the queue from executing in milliseconds */ delay(time) { const len = this._queues.length; for (let i = 0; i < len; i++) { this._queues[i].add(new Actions.Delay(this._actors[i], time)); } return this; } /** * This method will add an action to the queue that will remove the actor from the * scene once it has completed its previous actions. Any actions on the * action queue after this action will not be executed. */ die() { const len = this._queues.length; for (let i = 0; i < len; i++) { this._queues[i].add(new Actions.Die(this._actors[i])); } return this; } /** * This method allows you to call an arbitrary method as the next action in the * action queue. This is useful if you want to execute code in after a specific * action, i.e An actor arrives at a destination after traversing a path */ callMethod(method) { const len = this._queues.length; for (let i = 0; i < len; i++) { this._queues[i].add(new Actions.CallMethod(this._actors[i], method)); } return this; } /** * This method will cause the actor to repeat all of the previously * called actions a certain number of times. If the number of repeats * is not specified it will repeat forever. This method is part of * the actor 'Action' fluent API allowing action chaining * @param times The number of times to repeat all the previous actions in the action queue. If nothing is specified the actions * will repeat forever */ repeat(times) { if (!times) { this.repeatForever(); return this; } const len = this._queues.length; for (let i = 0; i < len; i++) { this._queues[i].add(new Actions.Repeat(this._actors[i], times, this._actors[i].actionQueue.getActions())); } return this; } /** * This method will cause the actor to repeat all of the previously * called actions forever. This method is part of the actor 'Action' * fluent API allowing action chaining. */ repeatForever() { const len = this._queues.length; for (let i = 0; i < len; i++) { this._queues[i].add(new Actions.RepeatForever(this._actors[i], this._actors[i].actionQueue.getActions())); } return this; } /** * This method will cause the actor to follow another at a specified distance * @param actor The actor to follow * @param followDistance The distance to maintain when following, if not specified the actor will follow at the current distance. */ follow(actor, followDistance) { const len = this._queues.length; for (let i = 0; i < len; i++) { if (followDistance === undefined) { this._queues[i].add(new Actions.Follow(this._actors[i], actor)); } else { this._queues[i].add(new Actions.Follow(this._actors[i], actor, followDistance)); } } return this; } /** * This method will cause the actor to move towards another until they * collide "meet" at a specified speed. * @param actor The actor to meet * @param speed The speed in pixels per second to move, if not specified it will match the speed of the other actor */ meet(actor, speed) { const len = this._queues.length; for (let i = 0; i < len; i++) { if (speed === undefined) { this._queues[i].add(new Actions.Meet(this._actors[i], actor)); } else { this._queues[i].add(new Actions.Meet(this._actors[i], actor, speed)); } } return this; } /** * Returns a promise that resolves when the current action queue up to now * is finished. */ asPromise() { const promises = this._queues.map((q, i) => { const temp = new Promise((resolve) => { q.add(new Actions.CallMethod(this._actors[i], () => { resolve(); })); }); return temp; }); return Promise.all(promises); } } //# sourceMappingURL=ActionContext.js.map
42.858586
134
0.61136
1042e6ca65239164125021c8cf04b74eea2099be
725
js
JavaScript
tests/components/OpenSeaDragonPage/modules/buildOpenSeaDragonImage.spec.js
ndlib/dave
4e7944d2eed05430e15cbe494deecb6e06e64b1a
[ "Apache-2.0" ]
3
2016-11-08T20:44:41.000Z
2016-11-17T16:02:38.000Z
tests/components/OpenSeaDragonPage/modules/buildOpenSeaDragonImage.spec.js
ndlib/dave
4e7944d2eed05430e15cbe494deecb6e06e64b1a
[ "Apache-2.0" ]
28
2016-07-20T14:43:40.000Z
2022-03-02T04:32:13.000Z
tests/components/OpenSeaDragonPage/modules/buildOpenSeaDragonImage.spec.js
ndlib/dave
4e7944d2eed05430e15cbe494deecb6e06e64b1a
[ "Apache-2.0" ]
null
null
null
import buildOpenSeaDragonImage from 'components/OpenSeaDragonPage/modules/buildOpenSeaDragonImage.js' describe('(Module) buildOpenSeaDragonImage', () => { const _data = { sequences: { 0: { canvases: { 1: {label: 'label', images: {0:{resource: {'@id': 'http://google.com/image.jpg'}}}}}}}} const _params = { base: '1', manifest: 'manifest', sequence: '0', view: '1', canvasId: '1' } const _img = buildOpenSeaDragonImage(_data, _params) it('Returns a closeUri, imageUri, and label for an OpenSeaDragon image', () => { expect(_img.closeUri).to.equal('/1/manifest/0/1/1'); expect(_img.imageUri).to.equal('http://google.com/image.jpg'); expect(_img.label).to.equal('label'); }) })
31.521739
135
0.652414
10432df016e393692f89f77b6fdc8ef5e68055ea
197
js
JavaScript
js/modules/camera.js
flagpatch/pixi-raycast
539dd4db289b875ffd2f6b341931a09ef6ef2a59
[ "MIT" ]
1
2022-01-24T20:11:46.000Z
2022-01-24T20:11:46.000Z
js/modules/camera.js
flagpatch/pixi-raycast
539dd4db289b875ffd2f6b341931a09ef6ef2a59
[ "MIT" ]
2
2022-01-24T20:15:10.000Z
2022-01-25T06:01:10.000Z
js/modules/camera.js
flagpatch/pixi-raycast
539dd4db289b875ffd2f6b341931a09ef6ef2a59
[ "MIT" ]
1
2022-01-24T20:12:19.000Z
2022-01-24T20:12:19.000Z
function Camera(x, y) { this.position = {x: x, y: y}; this.direction = {x: -1, y: 0}; this.plane = {x: 0, y:1}; } Camera.prototype.update = function (dt) { } module.exports = Camera;
17.909091
41
0.568528
1043618de1e185c22694e5790d787c1f37f703a3
632
js
JavaScript
problem01-20200401.js
darjama/leetcode30day042020
398fa1162690ad25390738fe491a0b62ccd46292
[ "MIT" ]
null
null
null
problem01-20200401.js
darjama/leetcode30day042020
398fa1162690ad25390738fe491a0b62ccd46292
[ "MIT" ]
null
null
null
problem01-20200401.js
darjama/leetcode30day042020
398fa1162690ad25390738fe491a0b62ccd46292
[ "MIT" ]
null
null
null
/** 136. Single Number Easy 3843 147 Add to List Share Given a non-empty array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory? Example 1: Input: [2,2,1] Output: 1 Example 2: Input: [4,1,2,1,2] Output: 4 **/ /** * @param {number[]} nums * @return {number} */ var singleNumber = function(nums) { var numMap = {}; for (let i = 0; i < nums.length; i++) { numMap[nums[i]] ? delete numMap[nums[i]] : numMap[nums[i]] = 1; } return Object.keys(numMap)[0]; };
16.205128
106
0.647152
104369d54fe32ccb50534039734b7d8849bf6401
3,611
js
JavaScript
dist/dev/utils/calendar.js
MiisterPatate/planning
04b4a0c3a62cc5ed01b7e830a29476b820873a18
[ "MIT" ]
1
2015-06-29T15:25:08.000Z
2015-06-29T15:25:08.000Z
dist/dev/utils/calendar.js
MiisterPatate/planning
04b4a0c3a62cc5ed01b7e830a29476b820873a18
[ "MIT" ]
null
null
null
dist/dev/utils/calendar.js
MiisterPatate/planning
04b4a0c3a62cc5ed01b7e830a29476b820873a18
[ "MIT" ]
null
null
null
var Calendar = (function () { function Calendar() { this.events = [ { title: "title", start: "2015-06-30T18:00:00", end: "2015-06-30T20:00:00" } ]; console.log(this.events); $('#calendar').fullCalendar({ events: function (start, end, timezone, callback) { callback(this.events); }, eventClick: function (event) { alert('Title : ' + event.title + ' | Time : ' + event.start.format() + ' - ' + event.end.format()); return false; }, dayClick: function (date, jsEvent, view) { $('.popup').css('display', 'block'); } }); } Calendar.prototype.addNewEvent = function (eventsObject) { this.events.push(eventsObject); }; return Calendar; })(); exports.Calendar = Calendar; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInV0aWxzL2NhbGVuZGFyLnRzIl0sIm5hbWVzIjpbIkNhbGVuZGFyIiwiQ2FsZW5kYXIuY29uc3RydWN0b3IiLCJDYWxlbmRhci5hZGROZXdFdmVudCJdLCJtYXBwaW5ncyI6IkFBQUE7SUFDRUE7UUFDR0MsSUFBSUEsQ0FBQ0EsTUFBTUEsR0FBR0E7WUFDWEE7Z0JBQ0VBLEtBQUtBLEVBQUVBLE9BQU9BO2dCQUNkQSxLQUFLQSxFQUFFQSxxQkFBcUJBO2dCQUM1QkEsR0FBR0EsRUFBRUEscUJBQXFCQTthQUMzQkE7U0FDSEEsQ0FBQ0E7UUFFSEEsT0FBT0EsQ0FBQ0EsR0FBR0EsQ0FBQ0EsSUFBSUEsQ0FBQ0EsTUFBTUEsQ0FBQ0EsQ0FBQ0E7UUFFekJBLENBQUNBLENBQUNBLFdBQVdBLENBQUNBLENBQUNBLFlBQVlBLENBQUNBO1lBQzFCQSxNQUFNQSxFQUFFQSxVQUFTQSxLQUFLQSxFQUFFQSxHQUFHQSxFQUFFQSxRQUFRQSxFQUFFQSxRQUFRQTtnQkFDM0MsUUFBUSxDQUFDLElBQUksQ0FBQyxNQUFNLENBQUMsQ0FBQztZQUMxQixDQUFDO1lBRURBLFVBQVVBLEVBQUVBLFVBQVNBLEtBQUtBO2dCQUN4QixLQUFLLENBQUMsVUFBVSxHQUFHLEtBQUssQ0FBQyxLQUFLLEdBQUcsWUFBWSxHQUFHLEtBQUssQ0FBQyxLQUFLLENBQUMsTUFBTSxFQUFFLEdBQUcsS0FBSyxHQUFHLEtBQUssQ0FBQyxHQUFHLENBQUMsTUFBTSxFQUFFLENBQUMsQ0FBQTtnQkFDbEcsTUFBTSxDQUFDLEtBQUssQ0FBQztZQUNmLENBQUM7WUFFREEsUUFBUUEsRUFBRUEsVUFBU0EsSUFBSUEsRUFBRUEsT0FBT0EsRUFBRUEsSUFBSUE7Z0JBRXBDLENBQUMsQ0FBQyxRQUFRLENBQUMsQ0FBQyxHQUFHLENBQUMsU0FBUyxFQUFFLE9BQU8sQ0FBQyxDQUFDO1lBQ3RDLENBQUM7U0FFRkEsQ0FBQ0EsQ0FBQ0E7SUFDTEEsQ0FBQ0E7SUFFREQsOEJBQVdBLEdBQVhBLFVBQVlBLFlBQVlBO1FBQ3JCRSxJQUFJQSxDQUFDQSxNQUFNQSxDQUFDQSxJQUFJQSxDQUFDQSxZQUFZQSxDQUFDQSxDQUFDQTtJQUNsQ0EsQ0FBQ0E7SUFDSEYsZUFBQ0E7QUFBREEsQ0FqQ0EsQUFpQ0NBLElBQUE7QUFqQ1ksZ0JBQVEsV0FpQ3BCLENBQUEiLCJmaWxlIjoidXRpbHMvY2FsZW5kYXIuanMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgY2xhc3MgQ2FsZW5kYXJ7XG4gIGNvbnN0cnVjdG9yKCl7XG4gICAgIHRoaXMuZXZlbnRzID0gW1xuICAgICAgICB7XG4gICAgICAgICAgdGl0bGU6IFwidGl0bGVcIixcbiAgICAgICAgICBzdGFydDogXCIyMDE1LTA2LTMwVDE4OjAwOjAwXCIsXG4gICAgICAgICAgZW5kOiBcIjIwMTUtMDYtMzBUMjA6MDA6MDBcIlxuICAgICAgICB9XG4gICAgIF07XG5cbiAgICBjb25zb2xlLmxvZyh0aGlzLmV2ZW50cyk7XG5cbiAgICAkKCcjY2FsZW5kYXInKS5mdWxsQ2FsZW5kYXIoe1xuICAgICAgZXZlbnRzOiBmdW5jdGlvbihzdGFydCwgZW5kLCB0aW1lem9uZSwgY2FsbGJhY2spIHtcbiAgICAgICAgICBjYWxsYmFjayh0aGlzLmV2ZW50cyk7ICAgXG4gICAgICB9LFxuICAgICAgXG4gICAgICBldmVudENsaWNrOiBmdW5jdGlvbihldmVudCkge1xuICAgICAgICBhbGVydCgnVGl0bGUgOiAnICsgZXZlbnQudGl0bGUgKyAnIHwgVGltZSA6ICcgKyBldmVudC5zdGFydC5mb3JtYXQoKSArICcgLSAnICsgZXZlbnQuZW5kLmZvcm1hdCgpKVxuICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICB9LFxuXG4gICAgICBkYXlDbGljazogZnVuY3Rpb24oZGF0ZSwganNFdmVudCwgdmlldykge1xuICAgICAgICAvLyBhbGVydCgnQ2xpY2tlZCBvbjogJyArIGRhdGUuZm9ybWF0KCkgKyAnQ3VycmVudCB2aWV3OiAnICsgdmlldy5uYW1lKTtcbiAgICAgICAgJCgnLnBvcHVwJykuY3NzKCdkaXNwbGF5JywgJ2Jsb2NrJyk7XG4gICAgICB9XG4gICAgICBcbiAgICB9KTtcbiAgfSxcblxuICBhZGROZXdFdmVudChldmVudHNPYmplY3Qpe1xuICAgICB0aGlzLmV2ZW50cy5wdXNoKGV2ZW50c09iamVjdCk7XG4gIH1cbn0iXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
116.483871
2,670
0.858211
1045144ccefc6c961aabf89929ee77841319b86c
415
js
JavaScript
app/autotranslate/server/settings.js
thedigicraft/Rocket.Chat
19db9c61a44aed61e779b2831311382138f26520
[ "MIT" ]
3
2018-02-10T13:28:50.000Z
2018-03-06T13:47:57.000Z
app/autotranslate/server/settings.js
thedigicraft/Rocket.Chat
19db9c61a44aed61e779b2831311382138f26520
[ "MIT" ]
2
2021-08-04T05:16:50.000Z
2022-01-15T03:31:01.000Z
app/autotranslate/server/settings.js
thedigicraft/Rocket.Chat
19db9c61a44aed61e779b2831311382138f26520
[ "MIT" ]
1
2019-03-11T15:34:43.000Z
2019-03-11T15:34:43.000Z
import { Meteor } from 'meteor/meteor'; import { settings } from '../../settings'; Meteor.startup(function() { settings.add('AutoTranslate_Enabled', false, { type: 'boolean', group: 'Message', section: 'AutoTranslate', public: true }); settings.add('AutoTranslate_GoogleAPIKey', '', { type: 'string', group: 'Message', section: 'AutoTranslate', enableQuery: { _id: 'AutoTranslate_Enabled', value: true } }); });
51.875
172
0.693976
1045a925aa5c44b4f165ed3b8891c35a4f40c7f9
9,948
js
JavaScript
public/iui/iui.js
carlism/barcamp_schedule
3f17d00364b1d1733aa6a57518d3d0a3fb6fd2f6
[ "MIT" ]
1
2016-05-08T14:21:33.000Z
2016-05-08T14:21:33.000Z
public/iui/iui.js
carlism/barcamp_schedule
3f17d00364b1d1733aa6a57518d3d0a3fb6fd2f6
[ "MIT" ]
null
null
null
public/iui/iui.js
carlism/barcamp_schedule
3f17d00364b1d1733aa6a57518d3d0a3fb6fd2f6
[ "MIT" ]
null
null
null
/* Copyright (c) 2007, iUI Project Members See LICENSE.txt for licensing terms */ (function() { var slideSpeed = 20; var slideInterval = 0; var currentPage = null; var currentDialog = null; var currentWidth = 0; var currentHash = location.hash; var hashPrefix = "#_"; var pageHistory = []; var newPageCount = 0; var checkTimer; var currPos = 1; // ************************************************************************************************* window.iui = { showPage: function(page, backwards) { if (page) { if (currentDialog) { currentDialog.removeAttribute("selected"); currentDialog = null; } if (hasClass(page, "dialog")) showDialog(page); else { var fromPage = currentPage; currentPage = page; if (fromPage) setTimeout(slidePages, 0, fromPage, page, backwards); else updatePage(page, fromPage); } } }, showPageById: function(pageId) { var page = $(pageId); if (page) { var index = pageHistory.indexOf(pageId); var backwards = index != -1; if (backwards) pageHistory.splice(index, pageHistory.length); iui.showPage(page, backwards); } }, showPageByHref: function(href, args, method, replace, cb) { var req = new XMLHttpRequest(); req.onerror = function() { if (cb) cb(false); }; req.onreadystatechange = function() { if (req.readyState == 4) { if (replace) replaceElementWithSource(replace, req.responseText); else { var frag = document.createElement("div"); frag.innerHTML = req.responseText; iui.insertPages(frag.childNodes); } if (cb) setTimeout(cb, 1000, true); } }; if (args) { req.open(method || "GET", href, true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); req.setRequestHeader("Content-Length", args.length); req.send(args.join("&")); } else { req.open(method || "GET", href, true); req.send(null); } }, insertPages: function(nodes) { var targetPage; for (var i = 0; i < nodes.length; ++i) { var child = nodes[i]; if (child.nodeType == 1) { if (!child.id) child.id = "__" + (++newPageCount) + "__"; var clone = $(child.id); if (clone) clone.parentNode.replaceChild(child, clone); else document.body.appendChild(child); if (child.getAttribute("selected") == "true" || !targetPage) targetPage = child; --i; } } if (targetPage) iui.showPage(targetPage); }, getSelectedPage: function() { for (var child = document.body.firstChild; child; child = child.nextSibling) { if (child.nodeType == 1 && child.getAttribute("selected") == "true") return child; } } }; // ************************************************************************************************* addEventListener("load", function(event) { var page = iui.getSelectedPage(); if (page) iui.showPage(page); setTimeout(preloadImages, 0); setTimeout(checkOrientAndLocation, 0); checkTimer = setInterval(checkOrientAndLocation, 300); }, false); addEventListener("click", function(event) { var link = findParent(event.target, "a"); if (link) { function unselect() { link.removeAttribute("selected"); } if (link.href && link.hash && link.hash != "#") { link.setAttribute("selected", "true"); iui.showPage($(link.hash.substr(1))); setTimeout(unselect, 500); } else if (link == $("backButton")) history.back(); else if (link.getAttribute("type") == "submit") submitForm(findParent(link, "form")); else if (link.getAttribute("type") == "cancel") cancelDialog(findParent(link, "form")); else if (link.target == "_replace") { link.setAttribute("selected", "progress"); iui.showPageByHref(link.href, null, null, link, unselect); } else if (!link.target) { link.setAttribute("selected", "progress"); iui.showPageByHref(link.href, null, null, null, unselect); } else return; event.preventDefault(); } }, true); addEventListener("click", function(event) { var div = findParent(event.target, "div"); if (div && hasClass(div, "toggle")) { div.setAttribute("toggled", div.getAttribute("toggled") != "true"); event.preventDefault(); } }, true); function checkOrientAndLocation() { if (window.innerWidth != currentWidth) { currentWidth = window.innerWidth; var orient = currentWidth == 320 ? "profile" : "landscape"; document.body.setAttribute("orient", orient); setTimeout(scrollTo, 100, 0, currPos); } if (location.hash != currentHash) { var pageId = location.hash.substr(hashPrefix.length) iui.showPageById(pageId); } } function showDialog(page) { currentDialog = page; page.setAttribute("selected", "true"); if (hasClass(page, "dialog") && !page.target) showForm(page); } function showForm(form) { form.onsubmit = function(event) { event.preventDefault(); submitForm(form); }; form.onclick = function(event) { if (event.target == form && hasClass(form, "dialog")) cancelDialog(form); }; } function cancelDialog(form) { form.removeAttribute("selected"); } function updatePage(page, fromPage) { if (!page.id) page.id = "__" + (++newPageCount) + "__"; location.href = currentHash = hashPrefix + page.id; pageHistory.push(page.id); var pageTitle = $("pageTitle"); if (page.title) pageTitle.innerHTML = page.title; if (page.localName.toLowerCase() == "form" && !page.target) showForm(page); var backButton = $("backButton"); if (backButton) { var prevPage = $(pageHistory[pageHistory.length-2]); if (prevPage && !page.getAttribute("hideBackButton")) { backButton.style.display = "inline"; backButton.innerHTML = prevPage.title ? prevPage.title : "Back"; } else backButton.style.display = "none"; } } function slidePages(fromPage, toPage, backwards) { var axis = (backwards ? fromPage : toPage).getAttribute("axis"); if (axis == "y") (backwards ? fromPage : toPage).style.top = "100%"; else toPage.style.left = "100%"; toPage.setAttribute("selected", "true"); scrollTo(0, 1); clearInterval(checkTimer); var percent = 100; slide(); var timer = setInterval(slide, slideInterval); function slide() { percent -= slideSpeed; if (percent <= 0) { percent = 0; if (!hasClass(toPage, "dialog")) fromPage.removeAttribute("selected"); clearInterval(timer); checkTimer = setInterval(checkOrientAndLocation, 300); setTimeout(updatePage, 0, toPage, fromPage); } if (axis == "y") { backwards ? fromPage.style.top = (100-percent) + "%" : toPage.style.top = percent + "%"; } else { fromPage.style.left = (backwards ? (100-percent) : (percent-100)) + "%"; toPage.style.left = (backwards ? -percent : percent) + "%"; } } } function preloadImages() { var preloader = document.createElement("div"); preloader.id = "preloader"; document.body.appendChild(preloader); } function submitForm(form) { iui.showPageByHref(form.action || "POST", encodeForm(form), form.method); } function encodeForm(form) { function encode(inputs) { for (var i = 0; i < inputs.length; ++i) { if (inputs[i].name) args.push(inputs[i].name + "=" + escape(inputs[i].value)); } } var args = []; encode(form.getElementsByTagName("input")); encode(form.getElementsByTagName("select")); return args; } function findParent(node, localName) { while (node && (node.nodeType != 1 || node.localName.toLowerCase() != localName)) node = node.parentNode; return node; } function hasClass(self, name) { var re = new RegExp("(^|\\s)"+name+"($|\\s)"); return re.exec(self.getAttribute("class")) != null; } function replaceElementWithSource(replace, source) { var page = replace.parentNode; var parent = replace; while (page.parentNode != document.body) { page = page.parentNode; parent = parent.parentNode; } var frag = document.createElement(parent.localName); frag.innerHTML = source; page.removeChild(parent); while (frag.firstChild) page.appendChild(frag.firstChild); } function $(id) { return document.getElementById(id); } function ddd() { console.log.apply(console, arguments); } })();
25.772021
100
0.520205
10464b8d3b4712f56ae5b10a29d936224354d414
5,085
js
JavaScript
src/config.js
wanderer6994/melonJS
a972fe2a765dac59eea5c0cd8b57d9c0fe7dd834
[ "MIT" ]
null
null
null
src/config.js
wanderer6994/melonJS
a972fe2a765dac59eea5c0cd8b57d9c0fe7dd834
[ "MIT" ]
null
null
null
src/config.js
wanderer6994/melonJS
a972fe2a765dac59eea5c0cd8b57d9c0fe7dd834
[ "MIT" ]
null
null
null
(function () { /** * current melonJS version * @static * @constant * @memberof me * @name version * @type {string} */ me.version = "__VERSION__"; /** * global system settings and browser capabilities * @namespace */ me.sys = { /** * Set game FPS limiting * @see me.timer.tick * @type {Number} * @default 60 * @memberOf me.sys */ fps : 60, /** * Rate at which the game updates;<br> * may be greater than or lower than the fps * @see me.timer.tick * @type {Number} * @default 60 * @memberOf me.sys */ updatesPerSecond : 60, /** * Enable/disable frame interpolation * @see me.timer.tick * @type {Boolean} * @default false * @memberOf me.sys */ interpolation : false, /** * Global scaling factor * @type {me.Vector2d} * @default <0,0> * @memberOf me.sys */ scale : null, //initialized by me.video.init /** * Global y axis gravity settings. * (will override body gravity value if defined) * @type {Number} * @default undefined * @memberOf me.sys */ gravity : undefined, /** * Specify either to stop on audio loading error or not<br> * if true, melonJS will throw an exception and stop loading<br> * if false, melonJS will disable sounds and output a warning message * in the console<br> * @type {Boolean} * @default true * @memberOf me.sys */ stopOnAudioError : true, /** * Specify whether to pause the game when losing focus.<br> * @type {Boolean} * @default true * @memberOf me.sys */ pauseOnBlur : true, /** * Specify whether to unpause the game when gaining focus.<br> * @type {Boolean} * @default true * @memberOf me.sys */ resumeOnFocus : true, /** * Specify whether to automatically bring the window to the front.<br> * @type {Boolean} * @default true * @memberOf me.sys */ autoFocus : true, /** * Specify whether to stop the game when losing focus or not<br> * The engine restarts on focus if this is enabled. * @type {boolean} * @default false * @memberOf me.sys */ stopOnBlur : false, /** * Specify the rendering method for layers <br> * if false, visible part of the layers are rendered dynamically<br> * if true, the entire layers are first rendered into an offscreen * canvas<br> * the "best" rendering method depends of your game<br> * (amount of layer, layer size, amount of tiles per layer, etc.)<br> * note : rendering method is also configurable per layer by adding this * property to your layer (in Tiled)<br> * @type {Boolean} * @default false * @memberOf me.sys */ preRender : false }; /** * a flag indicating that melonJS is fully initialized * @type {Boolean} * @default false * @readonly * @memberOf me */ me.initialized = false; /** * disable melonJS auto-initialization * @type {Boolean} * @default false * @see me.boot * @memberOf me */ me.skipAutoInit = false; /** * initialize the melonJS library. * this is automatically called unless me.skipAutoInit is set to true, * to allow asynchronous loaders to work. * @name boot * @memberOf me * @see me.skipAutoInit * @public * @function */ me.boot = function () { // don't do anything if already initialized (should not happen anyway) if (me.initialized === true) { return; } // check the device capabilites me.device._check(); // init the object Pool me.pool.init(); // initialize me.save me.save.init(); // init the FPS counter if needed me.timer.init(); // enable/disable the cache me.loader.setNocache( me.utils.getUriFragment().nocache || false ); // init the App Manager me.state.init(); // automatically enable keyboard events me.input.initKeyboardEvent(); // init the level Director me.levelDirector.init(); // mark melonJS as initialized me.initialized = true; /// if auto init is disable and this function was called manually if (me.skipAutoInit === true) { me.device._domReady(); } }; // call the library init function when ready me.device.onReady(function () { if (me.skipAutoInit === false) { me.boot(); } }); })();
25.425
80
0.52468
1046779295344c82a224277ce717192859e81515
2,596
js
JavaScript
packages/editor/editor-core/dist/esm/plugins/placeholder-text/ui/PlaceholderFloatingToolbar/index.js
rholang/archive-old
55d05c67b2015b646e6f3aa7c4e1fde778162eea
[ "Apache-2.0" ]
1
2020-04-24T13:28:17.000Z
2020-04-24T13:28:17.000Z
packages/editor/editor-core/dist/esm/plugins/placeholder-text/ui/PlaceholderFloatingToolbar/index.js
rholang/archive-old
55d05c67b2015b646e6f3aa7c4e1fde778162eea
[ "Apache-2.0" ]
1
2022-03-02T07:06:35.000Z
2022-03-02T07:06:35.000Z
packages/editor/editor-core/dist/esm/plugins/placeholder-text/ui/PlaceholderFloatingToolbar/index.js
rholang/archive-old
55d05c67b2015b646e6f3aa7c4e1fde778162eea
[ "Apache-2.0" ]
null
null
null
import { __extends } from "tslib"; import * as React from 'react'; import { defineMessages, injectIntl } from 'react-intl'; import PanelTextInput from '../../../../ui/PanelTextInput'; import FloatingToolbar, { handlePositionCalculatedWith, getOffsetParent, getNearestNonTextNode, } from '../../../../ui/FloatingToolbar'; export var messages = defineMessages({ placeholderTextPlaceholder: { id: 'fabric.editor.placeholderTextPlaceholder', defaultMessage: 'Add placeholder text', description: '', }, }); var PlaceholderFloatingToolbar = /** @class */ (function (_super) { __extends(PlaceholderFloatingToolbar, _super); function PlaceholderFloatingToolbar() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.handleSubmit = function (value) { if (value) { _this.props.insertPlaceholder(value); _this.props.setFocusInEditor(); } else { _this.props.hidePlaceholderFloatingToolbar(); } }; _this.handleBlur = function () { _this.props.hidePlaceholderFloatingToolbar(); }; return _this; } PlaceholderFloatingToolbar.prototype.render = function () { var _a = this.props, getNodeFromPos = _a.getNodeFromPos, showInsertPanelAt = _a.showInsertPanelAt, editorViewDOM = _a.editorViewDOM, popupsMountPoint = _a.popupsMountPoint, getFixedCoordinatesFromPos = _a.getFixedCoordinatesFromPos, popupsBoundariesElement = _a.popupsBoundariesElement, formatMessage = _a.intl.formatMessage; var target = getNodeFromPos(showInsertPanelAt); var offsetParent = getOffsetParent(editorViewDOM, popupsMountPoint); var getFixedCoordinates = function () { return getFixedCoordinatesFromPos(showInsertPanelAt); }; var handlePositionCalculated = handlePositionCalculatedWith(offsetParent, target, getFixedCoordinates); return (React.createElement(FloatingToolbar, { target: getNearestNonTextNode(target), onPositionCalculated: handlePositionCalculated, popupsMountPoint: popupsMountPoint, popupsBoundariesElement: popupsBoundariesElement, fitHeight: 32, offset: [0, 12] }, React.createElement(PanelTextInput, { placeholder: formatMessage(messages.placeholderTextPlaceholder), onSubmit: this.handleSubmit, onBlur: this.handleBlur, autoFocus: true, width: 300 }))); }; return PlaceholderFloatingToolbar; }(React.Component)); export default injectIntl(PlaceholderFloatingToolbar); //# sourceMappingURL=index.js.map
57.688889
333
0.709553