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
6ffd869f2f64a6384d38342dbeaf06db034de67a
862
js
JavaScript
node_modules/sails-stringfile/deprecation.js
Pikorua/sails-0.10.0
ec757fd62708cfb018c11ec8d62d291486182dae
[ "MIT" ]
null
null
null
node_modules/sails-stringfile/deprecation.js
Pikorua/sails-0.10.0
ec757fd62708cfb018c11ec8d62d291486182dae
[ "MIT" ]
null
null
null
node_modules/sails-stringfile/deprecation.js
Pikorua/sails-0.10.0
ec757fd62708cfb018c11ec8d62d291486182dae
[ "MIT" ]
null
null
null
/** * Module dependencies */ var _ = require('lodash') , logMoreInfoLink = require('./links').logMoreInfoLink , util = require('util'); // // Used for throttling deprecation notices // var featureCache = {}; module.exports = { logUpgradeNotice: function(template, values, log) { log = log || console.log; if (!_.isArray(values)) values = [values]; log(util.format.apply(null, [template].concat(values))); }, logDeprecationNotice: function(feature, moreInfoURL, log) { var time = new Date().getTime(); if (featureCache[feature] && (featureCache[feature] + 5000 > time)) { return false; } else featureCache[feature] = time; log = log || console.log; console.log(); log(util.format('Deprecated: `%s`', feature).bold); if (moreInfoURL) logMoreInfoLink(moreInfoURL, log); return true; } };
24.628571
72
0.639211
6fffb5e2e8cac99792ad6052c85d710cd5567399
138
js
JavaScript
src/pages/index.js
Razatastic/wassup
d72e020c32b1f878b41afa5fbea10ed800f5af8c
[ "MIT" ]
null
null
null
src/pages/index.js
Razatastic/wassup
d72e020c32b1f878b41afa5fbea10ed800f5af8c
[ "MIT" ]
null
null
null
src/pages/index.js
Razatastic/wassup
d72e020c32b1f878b41afa5fbea10ed800f5af8c
[ "MIT" ]
null
null
null
export { default as Home } from "./Home"; export { default as Profile } from "./Profile"; export { default as NoMatch } from "./NoMatch";
34.5
47
0.673913
6fffda9e9739558e4b0f4df939ea89323189963b
4,627
js
JavaScript
wordpress/wp-content/themes/timber-lite/assets/js/main/main.js
wc-work/wc-site
ab26af532d6cd9d55d763a84f693e29af8a4728b
[ "MIT" ]
null
null
null
wordpress/wp-content/themes/timber-lite/assets/js/main/main.js
wc-work/wc-site
ab26af532d6cd9d55d763a84f693e29af8a4728b
[ "MIT" ]
11
2020-02-03T19:33:52.000Z
2020-02-12T22:17:23.000Z
wordpress/wp-content/themes/timber-lite/assets/js/main/main.js
wc-work/wc-site
ab26af532d6cd9d55d763a84f693e29af8a4728b
[ "MIT" ]
null
null
null
// /* ====== ON DOCUMENT READY ====== */ $(function () { init(); }); function init() { browserSupport(); platformDetect(); browserSize(); scrollToTop(); focusItems(); Nav.init(); updateHeader(); $html.addClass('ready'); $('.site-header, #page, .site-footer').css('opacity', 1); if( Modernizr.touchevents ) { HandleParentMenuItems.bindOuterNavClick(); } } function softInit() { niceScrollInit(); sizeColumns(); $('html, body, *').unbind('mousewheel', vertToHorScroll); horToVertScroll = false; if( windowWidth > 900 && Modernizr.touchevents ) { HandleParentMenuItems.handle(); } if ($('.single-jetpack-portfolio').length ) { Project.init(); Placeholder.update(); Project.prepare(); } else { Placeholder.update(); } Portfolio.init(); Blog.init(); frontpageSlider.init(); royalSliderInit(); videos.init(); filterHandler(); $('.site-header, #page, .site-footer').css('opacity', 1); $(".pixcode--tabs").organicTabs(); if ( ! Modernizr.touchevents && ! horToVertScroll ) { bindVertToHorScroll(); } } // /* ====== ON WINDOW LOAD ====== */ $window.load(function () { softInit(); eventHandlers(); loop(); }); // /* ====== ON RESIZE ====== */ function onResize() { browserSize(); sizeColumns(); if( Modernizr.touchevents ) { if( windowWidth >= 900 ) { // Handle parent menu items HandleParentMenuItems.handle(); } else if ( windowWidth < 900 ) { // Remove handlers HandleParentMenuItems.unHandle(); } } Project.onResize(); Nav.onResize(); frontpageSlider.onResize(); videos.resize(); if( isiele10 ) { Blog.calcIeFilmstrip(); } Placeholder.resize(); } function updateHeader() { if ($('.page-has-featured-image').length && latestKnownScrollY > windowHeight - 62) { $('body').addClass('header--not-light'); } else { $('body').removeClass('header--not-light'); } } var scrollTimeout, isScrolling = false; function onScroll(e) { if ( $('.filmstrip').length || $('.portfolio--filmstrip.portfolio--visible').length ) { latestKnownScrollX = $(this).scrollLeft(); } else { latestKnownScrollY = $(this).scrollTop(); } if ( ! isScrolling ) { isScrolling = true; $body.addClass( 'is-scrolling' ); } clearTimeout(scrollTimeout); scrollTimeout = setTimeout(doneScrolling, 1000); } function doneScrolling() { $body.removeClass( 'is-scrolling' ); isScrolling = false; } function loop() { Project.getCurrent(); Portfolio.maybeloadNextProjects(); Blog.maybeLoadNextPosts(); updateHeader(); requestAnimationFrame(loop) } function focusItems() { var $portfolioItemThumb = $('.filmstrip__item .item__thumb'); $portfolioItemThumb.on('focusin', function(){ var element = $(this).parent(); element[0].scrollIntoView({inline: "end"}); }); } function eventHandlers() { $window.on('debouncedresize', onResize); $window.on('scroll', onScroll); if ( Modernizr.touchevents && isFilmstrip() ) { $('.site-content').on('scroll', onScroll); } $window.on('mousemove', function(e) { latestKnownMouseX = e.clientX; latestKnownMouseY = e.clientY; }); $window.on('deviceorientation', function(e) { latestDeviceAlpha = e.originalEvent.alpha; latestDeviceBeta = e.originalEvent.beta; latestDeviceGamma = e.originalEvent.gamma; }); if( windowWidth > 740 ) { bindVertToHorScroll(); } } (function() { window.disable_mobile_panning = true; window.addEventListener( 'touchstart', function onFirstTouch() { Modernizr.touchevents = true; window.removeEventListener( 'touchstart', onFirstTouch, false ); }, false ); function onPointerDownHandler( event ) { if ( event.pointerType === 'touch' ) { Modernizr.touchevents = true; } } // For IE 10 window.addEventListener( 'MSPointerDown', onPointerDownHandler ); // For IE 11+ window.addEventListener( 'pointerdown', onPointerDownHandler ); window.addEventListener( "devicemotion", function( event ) { if ( ! event.rotationRate ) { return; } if ( event.rotationRate.alpha || event.rotationRate.beta || event.rotationRate.gamma ) { window.disable_mobile_panning = false; } } ); })();
22.570732
96
0.589151
b5000b96a5e58507210f9af9ba9da3b3511abf0e
9,390
js
JavaScript
src/components/layout/sidebar.js
Afh21/adopt-client
ba34b258fe8817a6ed08313cefaad542b6fca718
[ "MIT" ]
null
null
null
src/components/layout/sidebar.js
Afh21/adopt-client
ba34b258fe8817a6ed08313cefaad542b6fca718
[ "MIT" ]
null
null
null
src/components/layout/sidebar.js
Afh21/adopt-client
ba34b258fe8817a6ed08313cefaad542b6fca718
[ "MIT" ]
null
null
null
import React, { Component } from "react"; import { Layout, Icon, Button, Menu } from "antd"; import { Tag } from "antd"; // import MenuLinkSidebar from "./sider"; import PropTypes from "prop-types"; import { Switch, withRouter, BrowserRouter as Router, Route, Link } from "react-router-dom"; // Components import Animal from "../dashboard/animal/animal"; import RegisterAnimal from "../dashboard/animal/animal-register"; import AnimalEdit from "../dashboard/animal/animal-edit"; import Dashboard from "../dashboard/dashboard/dashboard"; import Profile from "../dashboard/user/profile"; import User from "../dashboard/user/user"; import RegisterUser from "../dashboard/user/register"; import Adoptions from "../dashboard/adoption/adoption"; import Breed from "../../components/dashboard/master/type-breed/type-breed"; import Rh from "../../components/dashboard/master/type-rh/type-rh"; import MapAdoptions from "../../components/dashboard/map/map-Adoptions"; import ProtectedRoute from "../../utilities/RoutesProtected/ProtectedRoute"; // import NoFound from "../noFound/not-found"; // Redux import { connect } from "react-redux"; import { logoutUser } from "../../redux/actions/authActions"; // Css import "../dashboard/dashboard/dashboard.css"; const SubMenu = Menu.SubMenu; const { Header, Content, Footer, Sider } = Layout; class Sidebar extends Component { state = { collapsed: false }; toggle = () => { this.setState({ collapsed: !this.state.collapsed }); }; onCloseSession = () => { const { history } = this.props; this.props.logoutUser(history); }; render() { const { collapsed } = this.state; const { user } = this.props.auth; const { match } = this.props; return ( <Router> <Layout> <Sider trigger={null} collapsible collapsed={collapsed}> <div className="logo" /> <Menu theme="dark" defaultOpenKeys={["home", "users", "animals", "settings"]} mode="inline" > <SubMenu key="home" title={ <span> <Icon type="home" /> <span>Home</span> </span> } > {user.rol === "administrator" ? ( <Menu.Item key="1"> <Link to={`${match.url}`}> <Icon type="dashboard" /> <span>Dashboard</span> </Link> </Menu.Item> ) : null} <Menu.Item key="2"> <Link to={`${match.url}/user/profile`}> <Icon type="user" /> <span>Perfil</span> </Link> </Menu.Item> </SubMenu> <SubMenu key="animals" title={ <span> <Icon type="table" theme="outlined" /> <span>Animales</span> </span> } > <Menu.Item key="3"> <Link to={`${match.url}/animals`}> <Icon type="bars" /> <span>Lista</span> </Link> </Menu.Item> <Menu.Item key="12"> <Link to={`${match.url}/map`}> <Icon type="compass" theme="outlined" /> <span>Mapa </span> </Link> </Menu.Item> {user.rol === "administrator" ? ( <Menu.Item key="4"> <Link to={`${match.url}/animal/register`}> <Icon type="switcher" theme="outlined" /> <span>Registro</span> </Link> </Menu.Item> ) : null} </SubMenu> {user.rol === "administrator" ? ( <SubMenu key="users" title={ <span> <Icon type="team" theme="outlined" /> <span>Usuarios</span> </span> } > <Menu.Item key="6"> <Link to={`${match.url}/users`}> <Icon type="bars" /> <span>Lista</span> </Link> </Menu.Item> <Menu.Item key="7"> <Link to={`${match.url}/user/register`}> <Icon type="user-add" theme="outlined" /> <span>Registro</span> </Link> </Menu.Item> <Menu.Item key="8"> <Link to={`${match.url}/user/adoptions`}> <Icon type="audit" theme="outlined" /> <span>Adopciones</span> </Link> </Menu.Item> </SubMenu> ) : null} {user.rol === "administrator" ? ( <SubMenu key="settings" title={ <span> <Icon type="setting" theme="outlined" /> <span>Configuraciones</span> </span> } > <Menu.Item key="10"> <Link to={`${match.url}/master/type-rh`}> <Icon type="heart" theme="outlined" /> <span>TIpo Rh</span> </Link> </Menu.Item> <Menu.Item key="11"> <Link to={`${match.url}/master/type-breed`}> <Icon type="tag" theme="outlined" /> <span>Tipo Raza</span> </Link> </Menu.Item> </SubMenu> ) : null} </Menu> </Sider> <Layout> <Header style={{ background: "#ffff", padding: 0, lineHeight: "64px" }} > <Icon className="trigger" type={this.state.collapsed ? "menu-unfold" : "menu-fold"} onClick={this.toggle} /> Bienvenido,{" "} <Tag color="orange"> {user.name} {user.lastname} </Tag> <Button type="danger" icon="logout" ghost onClick={this.onCloseSession} style={{ float: "right", margin: 13 }} > Cerrar Sesión </Button> </Header> <Content style={{ margin: "24px 16px", padding: 24, background: "#fff", minHeight: 600 }} > <Switch> <ProtectedRoute exact path={`${match.path}`} component={Dashboard} /> <ProtectedRoute exact path={`${match.path}user/profile`} component={Profile} /> <ProtectedRoute exact path={`${match.path}animals`} component={Animal} /> <ProtectedRoute exact path={`${match.path}animal/register`} component={RegisterAnimal} /> <ProtectedRoute exact path={`${match.path}animal/edit/:animalId`} component={AnimalEdit} /> <ProtectedRoute exact path={`${match.path}map`} component={MapAdoptions} /> <ProtectedRoute exact path={`${match.path}users`} component={User} /> <ProtectedRoute exact path={`${match.path}user/register`} component={RegisterUser} /> <ProtectedRoute exact path={`${match.path}user/adoptions`} component={Adoptions} /> <ProtectedRoute exact path={`${match.path}master/type-rh`} component={Rh} /> <ProtectedRoute exact path={`${match.path}master/type-breed`} component={Breed} /> </Switch> </Content> <Footer style={{ textAlign: "center" }}> Powered By Ing. Andres Felipe H. © 2018 </Footer> </Layout> </Layout> </Router> ); } } Sidebar.propTypes = { match: PropTypes.object.isRequired, logoutUser: PropTypes.func.isRequired, auth: PropTypes.object.isRequired }; const mapStateToProps = state => ({ auth: state.auth }); export default connect( mapStateToProps, { logoutUser } )(withRouter(Sidebar));
31.3
77
0.414164
b50325e7d6465e8d4bdc1db80ca6bf4c067f8421
1,063
js
JavaScript
resources/assets/js/controllers/municipio/municipioList.js
desenv-1dl/bancotalentos
feb62221e6591c86fc1c68974277529965054473
[ "MIT" ]
null
null
null
resources/assets/js/controllers/municipio/municipioList.js
desenv-1dl/bancotalentos
feb62221e6591c86fc1c68974277529965054473
[ "MIT" ]
null
null
null
resources/assets/js/controllers/municipio/municipioList.js
desenv-1dl/bancotalentos
feb62221e6591c86fc1c68974277529965054473
[ "MIT" ]
null
null
null
angular.module('app.controllers') .controller('MunicipioListController',['$scope', 'Municipio','UnidadeFederacao', function($scope, Municipio,UnidadeFederacao){ $scope.municipios = Municipio.query(); $scope.unidadeFederacao = UnidadeFederacao.query(); $scope.gridOptions = { data : $scope.municipios, enableFiltering: true, controller: 'municipios', enableHiding: true, columnDefs: [ { field: 'nome', displayName: "Nome" }, { field: 'sigla', displayName: "Sigla" }, { field: 'unidadeFederacao.data.nome', displayName: "País" }, { field: 'acoes', displayName: "Acoes", enableFiltering: false, enableSorting: false, width: 200, cellTemplate : '<menu-acao></menu-acao>' } ] }; $scope.gridOptions.onRegisterApi = function(gridApi){ $scope.gridApi = gridApi; }; }]);
37.964286
131
0.523048
b503ce74fe82f6d8c8c2022983da97d5b30bd76e
856
js
JavaScript
components/layout.js
NimitzDEV/next-press
6de36a14cffa3f1e48cc42ff5a27e30ec0bcdb96
[ "MIT" ]
null
null
null
components/layout.js
NimitzDEV/next-press
6de36a14cffa3f1e48cc42ff5a27e30ec0bcdb96
[ "MIT" ]
null
null
null
components/layout.js
NimitzDEV/next-press
6de36a14cffa3f1e48cc42ff5a27e30ec0bcdb96
[ "MIT" ]
null
null
null
import Link from 'next/link'; import Head from 'next/head'; import React from 'react'; import PropTypes from 'prop-types'; import styled from 'styled-components'; import { media } from '../tools/server'; const config = require('../config'); const Layout = styled.div` display: flex; flex-direction: row; height: 100vh; width: 100vw; ${media.tablet` flex-direction: column; height: auto; `}; `; export default class AppLayout extends React.Component { constructor(props) { super(props); } static propTypes = { title: PropTypes.string, }; static defaultProps = { title: 'Default Title', }; render() { return ( <Layout> <Head> <title> {this.props.title} - {config.blog.name} </title> </Head> {this.props.children} </Layout> ); } }
19.022222
56
0.599299
b5044aab4e5e95f117e5237539980216a3ed334b
119
js
JavaScript
resources/js/app.js
stevy-sys/kaly
ce2dae13ad0c8d1df64c71eae2b26e2e3ac27606
[ "MIT" ]
null
null
null
resources/js/app.js
stevy-sys/kaly
ce2dae13ad0c8d1df64c71eae2b26e2e3ac27606
[ "MIT" ]
1
2021-08-17T22:56:33.000Z
2021-08-17T22:56:33.000Z
resources/js/app.js
stevy-sys/kaly
ce2dae13ad0c8d1df64c71eae2b26e2e3ac27606
[ "MIT" ]
null
null
null
require('./bootstrap'); require("./main") require("./publication/jquery-ui.min") require("./publication/jquery.steps")
23.8
38
0.714286
b5051e5291bab269e834276e31cfe3d4aa7809ad
1,649
js
JavaScript
src/routes/clothes.js
bushraAD98/api-server
8559a9ed21239b0a406f5ab949596238a683d455
[ "MIT" ]
null
null
null
src/routes/clothes.js
bushraAD98/api-server
8559a9ed21239b0a406f5ab949596238a683d455
[ "MIT" ]
null
null
null
src/routes/clothes.js
bushraAD98/api-server
8559a9ed21239b0a406f5ab949596238a683d455
[ "MIT" ]
null
null
null
'use strict'; const express = require ('express');//to make a router // const {clothes} = require('../models/index') const routers = express.Router();//to put all the clothes router inside it then export it in the server.js const {clothesCollection} = require('../models/index'); //we call the points by the routers to have them all in one place to use them in server.js routers.get('/clothes',getAllclothes); routers.post('/clothes',addNewClothes) routers.get('/clothes/:id',getSingleClothes) routers.delete('/clothes/:id',removeClothes) routers.put('/clothes/:id',updateClothes) async function getAllclothes(req,res){ let clothes = await clothesCollection.readRecord();//findAll a sequelize method res.status(200).json(clothes); } async function addNewClothes(req,res) { let sentClothes = req.body; let newClothes = await clothesCollection.createRecord(sentClothes);//create a sequelize method res.status(201).json(newClothes); } async function getSingleClothes(req,res){ let customerId = parseInt(req.params.id);//here we use parseInt because the data is returned as a string let theClothes = await clothesCollection.readRecord(customerId); res.status(200).json(theClothes); } async function removeClothes(req,res){ let removedID = parseInt(req.params.id); let removedClothes = await clothesCollection.removeRecord(removedID); res.status(204).json(removedClothes); } async function updateClothes(req,res){ let body =req.body; let id = req.params.id; const updateClothes = await clothesCollection.updateRecord(body,id); res.status(201).json(updateClothes); } module.exports = routers ;
33.653061
108
0.746513
b5062ba5a300c7da98235d4246655cdf0df76ca7
1,329
js
JavaScript
routes/api.js
mhans003/budgettracker
c8756090c118bcf94c76593c4e84a787259b92d3
[ "MIT" ]
null
null
null
routes/api.js
mhans003/budgettracker
c8756090c118bcf94c76593c4e84a787259b92d3
[ "MIT" ]
null
null
null
routes/api.js
mhans003/budgettracker
c8756090c118bcf94c76593c4e84a787259b92d3
[ "MIT" ]
null
null
null
const router = require("express").Router(); const Transaction = require("../models/transaction.js"); //Post one transaction to the database using the request body destructured. router.post("/api/transaction", ({body}, res) => { //Create the transaction with the request body. Transaction.create(body) .then(dbTransaction => { //Send back the result as json. res.json(dbTransaction); }) .catch(err => { //Otherwise, send an error. res.status(404).json(err); }); }); //Post multiple transactions to the database. router.post("/api/transaction/bulk", ({body}, res) => { Transaction.insertMany(body) .then(dbTransaction => { //Send back the json result. res.json(dbTransaction); }) .catch(err => { //Otherwise, send an error. res.status(404).json(err); }); }); //Get the transactions from the database. router.get("/api/transaction", (req, res) => { //Sorted by order of date, get all transactions (exclude ID and __v fields) Transaction.find({}, {_id: 0, __v: 0}).sort({date: -1}) .then(dbTransaction => { //Using the results, send back json data. res.json(dbTransaction); }) .catch(err => { //Otherwise, send an error. res.status(404).json(err); }); }); module.exports = router;
29.533333
77
0.617005
b50741721511db04d3874242cdeb2fc767a6ca3e
492
js
JavaScript
public/search-controller.js
thejdavid/feedbacks
6d9c14f05671382b720219daaecfdadde9f42980
[ "MIT" ]
null
null
null
public/search-controller.js
thejdavid/feedbacks
6d9c14f05671382b720219daaecfdadde9f42980
[ "MIT" ]
null
null
null
public/search-controller.js
thejdavid/feedbacks
6d9c14f05671382b720219daaecfdadde9f42980
[ "MIT" ]
null
null
null
angular.module('FeedbackTool') .controller("mainCtrl", function ($scope, $http) { $scope.selected = ''; $http.get('/feedbacks/search.json'). then(function(response) { $scope.test = " ok " $scope.states = response.data; // this callback will be called asynchronously // when the response is available }, function(response) { // called asynchronously if an error occurs // or server returns response with an error status. $scope.test = " error" }); });
32.8
55
0.654472
b507755632f9e87587d257ef9372e34f8210dfce
559
js
JavaScript
ReactJS-Fundamentals/Exam/frontend/src/cars/details/ReviewForm.js
VladimirAnaniev/JS-Web
9c90fb2622b1c7e59fd14ac60d405c58007e426d
[ "MIT" ]
null
null
null
ReactJS-Fundamentals/Exam/frontend/src/cars/details/ReviewForm.js
VladimirAnaniev/JS-Web
9c90fb2622b1c7e59fd14ac60d405c58007e426d
[ "MIT" ]
null
null
null
ReactJS-Fundamentals/Exam/frontend/src/cars/details/ReviewForm.js
VladimirAnaniev/JS-Web
9c90fb2622b1c7e59fd14ac60d405c58007e426d
[ "MIT" ]
null
null
null
import React from 'react' export default function ReviewForm ({formState, onChange, onSubmit}) { return ( <div> <label htmlFor='rating'>Rating: </label> <input name='rating' type='number' value={formState.rating} onChange={onChange} /> <br /> <label htmlFor='comment'>Comment: </label> <input name='comment' placeholder='Comment' value={formState.comment} onChange={onChange} /> <br /> <button onClick={onSubmit}>Submit</button> </div> ) }
23.291667
70
0.567084
b507b583b90bf3ab6b566283c084372465164b90
3,235
js
JavaScript
bin/index.js
pidtchay/openapi-codegen
ee1f1bb6e1efeb0dfb57629113e1065efc9c9627
[ "MIT" ]
null
null
null
bin/index.js
pidtchay/openapi-codegen
ee1f1bb6e1efeb0dfb57629113e1065efc9c9627
[ "MIT" ]
3
2021-09-10T11:35:56.000Z
2021-11-17T15:14:14.000Z
bin/index.js
pidtchay/openapi-codegen
ee1f1bb6e1efeb0dfb57629113e1065efc9c9627
[ "MIT" ]
null
null
null
#!/usr/bin/env node 'use strict'; const path = require('path'); const program = require('commander'); const pkg = require('../package.json'); const OpenAPI = require(path.resolve(__dirname, '../dist/index.js')); const { rmdirSync } = require('fs'); const params = program .name('openapi') .usage('[options]') .version(pkg.version) .option('-i, --input <value>', 'OpenAPI specification, can be a path, url or string content (required)') .option('-o, --output <value>', 'Output directory (required)') .option('-c, --client <value>', 'HTTP client to generate [fetch, xhr, node]', 'fetch') .option('--useOptions <value>', 'Use options instead of arguments', false) .option('--useUnionTypes <value>', 'Use union types instead of enums', false) .option('--exportCore <value>', 'Write core files to disk', true) .option('--exportServices <value>', 'Write services to disk', true) .option('--exportModels <value>', 'Write models to disk', true) .option('--exportSchemas <value>', 'Write schemas to disk', false) .option('--clean <value>', 'Clean a directory before generation', true) .option('--request <value>', 'Path to custom request file') .parse(process.argv) .opts(); function isValidJson(value) { try { JSON.parse(value); return true; } catch { return false; } } function generate(config) { return OpenAPI.generate({ input: config.input, output: config.output, httpClient: config.client, useOptions: isValidJson(config.useOptions) ? JSON.parse(config.useOptions) : false, useUnionTypes: isValidJson(config.useUnionTypes) ? JSON.parse(config.useUnionTypes) : false, exportCore: isValidJson(config.exportCore) ? JSON.parse(config.exportCore) : false, exportServices: isValidJson(config.exportServices) ? JSON.parse(config.exportServices) : false, exportModels: isValidJson(config.exportModels) ? JSON.parse(config.exportModels) : false, exportSchemas: isValidJson(config.exportSchemas) ? JSON.parse(config.exportSchemas) : false, clean: isValidJson(config.clean) ? JSON.parse(config.clean) : false, request: config.request, }) .then(() => { console.group(`Generation from "${config.input}"`); console.log(`Generation from "${config.input}" was finished\n`); console.log(`Output folder: ${path.resolve(process.cwd(), config.output)}\n`); console.groupEnd(); }) .catch(error => { console.log(error); process.exit(1); }); } if (OpenAPI) { const fs = require('fs'); const configFile = path.resolve(process.cwd(), 'openapi.config.json'); if (fs.existsSync(configFile)) { const dataString = fs.readFileSync(configFile, { encoding: `UTF-8` }); const configs = isValidJson(dataString) ? JSON.parse(dataString) : []; if (params.clean) { configs.forEach(config => { rmdirSync(config.output, { recursive: true, force: true }); }); } configs.forEach(config => { generate(config); }); } else { generate(params); } }
38.975904
108
0.620402
b5083990565af798396af7923aad459e6190ee15
3,467
js
JavaScript
server/src/constants/err.type.js
SaraiNoQ/covid_maga
e2015ba0b3f3d8db8576f36d7b23575f7b1d2574
[ "MIT" ]
null
null
null
server/src/constants/err.type.js
SaraiNoQ/covid_maga
e2015ba0b3f3d8db8576f36d7b23575f7b1d2574
[ "MIT" ]
null
null
null
server/src/constants/err.type.js
SaraiNoQ/covid_maga
e2015ba0b3f3d8db8576f36d7b23575f7b1d2574
[ "MIT" ]
null
null
null
// constant error info module.exports = { userFormatError: { code: '10001', message: 'account or password is null!', result: '' }, userAlreadyExited: { code: '10002', message: 'account duplicate (has exited) !', result: '' }, userRegisterError: { code: '10003', message: 'register error!', result: '' }, userNotExited: { code: '10004', message: 'account is not exsit!', result: '' }, userLoginError: { code: '10005', message: 'login error!', result: '' }, invalidPassword: { code: '10006', message: 'password is wrong!', result: '' }, updatePswError: { code: '10007', message: 'update password error!', result: '' }, userPermissionLow: { code: '10008', message: 'You have no permission to access this page!', result: '' }, deleteUserError: { code: '10009', message: 'delete user error!', result: '' }, deleteNotFound: { code: '10010', message: 'delete user not found!', result: '' }, TokenExpiredError: { code: '10101', message: 'token is pasttime!', result: '' }, invalidToken: { code: '10102', message: 'token is invalid!', result: '' }, noPermission: { code: '10103', message: 'no permission!', result: '' }, fileUploadError: { code: '10201', message: 'file upload failed!', result: '' }, fileTypeError: { code: '10202', message: 'file type wrong!', result: '' }, goodsFormatError: { code: '10203', message: 'goods info format wrong!', result: '' }, createGoodsError: { code: '10204', message: 'create goods info error!', result: '' }, updateGoodsError: { code: '10205', message: 'update goods info error!', result: '' }, removeGoodsError: { code: '10206', message: 'remove goods info error!', result: '' }, getUserInfoError: { code: '10207', message: 'get user information error!', result: '' }, updateAccountError: { code: '10208', message: 'update email error', result: '' }, studentFormatError: { code: '20101', // 中间件层面错误 message: 'student regist info format error', result: '' }, studentAlreadyExited: { code: '20102', message: 'student already exist', result: '' }, studentRegisterError: { code: '20103', message: 'student regist error', result: '' }, createStudentError: { code: '20201', // 数据库层面报错 message: 'create student error', result: '' }, deleteStudentError: { code: '20202', message: 'delete student error', result: '' }, deleteStudentNull: { code: '20203', message: 'delete student is not exist', result: '' }, deleteConditionNull: { code: '20104', message: 'delete condition is null', result: '' }, journeyFormatError: { code: '30101', message: 'journey info format error', result: '' }, createJourneyError: { code: '30201', message: 'create journey error', result: '' }, noQueryStudent: { code: '30202', message: 'no query student', result: '' }, infoUpdateError: { code: '30203', message: 'update user info error', result: '' }, updateJourneyError: { code: '30204', message: 'update journey error', result: '' }, updateStudentError: { code: '30205', message: 'update student error', result: '' }, noStudentNumber: { code: '30206', message: 'no query student', result: '' }, retrieveJourneyError: { code: '30102', message: 'retrieve journey error', result: '' }, retrieveNotFound: { code: '30103', message: 'retrieve outcome is null', result: '' } }
18.441489
57
0.618979
b509305b41c20896d4cf6eca4d7940bc843e7cd3
555
js
JavaScript
lib/script.js
Marconi-Lab/evaluation_system
bf5f6c70a344270372f21b7170317742b423f56e
[ "MIT" ]
null
null
null
lib/script.js
Marconi-Lab/evaluation_system
bf5f6c70a344270372f21b7170317742b423f56e
[ "MIT" ]
6
2021-12-03T20:55:40.000Z
2021-12-03T22:37:06.000Z
lib/script.js
Marconi-Lab/evaluation_system
bf5f6c70a344270372f21b7170317742b423f56e
[ "MIT" ]
3
2021-12-03T10:15:03.000Z
2021-12-04T21:01:08.000Z
const { PrismaClient } = require('@prisma/client') const prisma = new PrismaClient() // A `main` function so that you can use async/await export async function main(some_work) { // ... you will write your Prisma Client queries here const user_one = await prisma.user.create({ data: { name: "user.nickname", email: "user.name", model: 'v1', sentence: "sentence", metric: 5, comment: some_work, }, }) } main() .catch(e => { throw e }) .finally(async () => { await prisma.$disconnect() })
20.555556
55
0.6
b50a6f9dbf7986b85861821770cb682e8f31a9bb
688
js
JavaScript
src/server/server.js
duro/react-redux-webpack-univeral-starter
d64982bd3b8977db6978a7ff9a7360b698aec251
[ "MIT" ]
null
null
null
src/server/server.js
duro/react-redux-webpack-univeral-starter
d64982bd3b8977db6978a7ff9a7360b698aec251
[ "MIT" ]
null
null
null
src/server/server.js
duro/react-redux-webpack-univeral-starter
d64982bd3b8977db6978a7ff9a7360b698aec251
[ "MIT" ]
null
null
null
import Glue from 'glue' import Manifest from 'server/manifest' import ServerConfig from 'server/config' const composeOptions = { relativeTo: __dirname }; const Composer = module.exports = Glue.compose.bind(Glue, Manifest.get('/'), composeOptions); Composer((err, server) => { if (err) throw err; server.log(['server', 'info'], '==> ✅ Server is composed'); server.start(() => { server.log(['server', 'info'], '==> ✅ Server is started'); const ui = server.select('ui'); const api = server.select('api'); server.log(['server', 'info'], `==> 🌎 ${ ServerConfig.meta('/').name } running on port ${ ui.info.port }, API on port ${ api.info.port }`); }); })
26.461538
144
0.622093
b51008d294207c57e64da73efe786dfedc5b71ae
702
js
JavaScript
src/App.js
lysprestes/trybe-online-store
271f87ad3aa447181a466c19eb494adf7b3f5f6d
[ "MIT" ]
null
null
null
src/App.js
lysprestes/trybe-online-store
271f87ad3aa447181a466c19eb494adf7b3f5f6d
[ "MIT" ]
null
null
null
src/App.js
lysprestes/trybe-online-store
271f87ad3aa447181a466c19eb494adf7b3f5f6d
[ "MIT" ]
null
null
null
import React from 'react'; import { Route, Switch, BrowserRouter } from 'react-router-dom'; import './App.css'; import Home from './pages/Home'; import ShoppingCart from './pages/ShoppingCart'; import ProductDetails from './pages/ProductDetails'; import Checkout from './pages/Checkout'; import 'bootstrap/dist/css/bootstrap.min.css'; function App() { return ( <BrowserRouter> <Switch> <Route path="/shopping-cart" component={ ShoppingCart } /> <Route path="/details/:id" component={ ProductDetails } /> <Route path="/checkout" component={ Checkout } /> <Route path="/" component={ Home } /> </Switch> </BrowserRouter> ); } export default App;
29.25
66
0.659544
b51045f6441b7d6214b02fe2ef37ad12fa72627f
949
js
JavaScript
rules/limit-language-features.js
Kin-Carta-Connect/stylelint-conf
9b381f5bca23737cf4ddb41732ac149d11012886
[ "MIT" ]
null
null
null
rules/limit-language-features.js
Kin-Carta-Connect/stylelint-conf
9b381f5bca23737cf4ddb41732ac149d11012886
[ "MIT" ]
39
2020-12-21T07:25:15.000Z
2022-03-28T16:26:33.000Z
rules/limit-language-features.js
Kin-Carta-Connect/stylelint-config
9b381f5bca23737cf4ddb41732ac149d11012886
[ "MIT" ]
null
null
null
module.exports = { "number-max-precision": 6, "shorthand-property-no-redundant-values": true, "value-no-vendor-prefix": true, "property-no-vendor-prefix": true, "declaration-block-no-redundant-longhand-properties": true, "declaration-no-important": true, "declaration-block-single-line-max-declarations": 1, // Disabled because it doesn't work with Sass composed selectors // https://gitlab.com/amazerealise-fe-group/fe-boilerplate/issues/33 // "selector-class-pattern": [ // "^(--)?([a-z][a-z0-9]*)(-[a-z0-9]+)*$", // { // resolveNestedSelectors: true, // message: // "Expect class selector to conform to AR BEM flavour, see styleguide docs (regexr.com/4b2ts tests). Example: `listing-card --featured`" // } // ], "selector-max-empty-lines": 0, "selector-max-compound-selectors": 4, "selector-max-specificity": "0,4,1", "selector-no-vendor-prefix": true, "at-rule-no-vendor-prefix": true, "max-nesting-depth": 3 };
36.5
141
0.685985
b51126c541b933a54ed2818468a02fc23f19e3a5
2,627
js
JavaScript
site/src/meta.js
sevka/orc-data
5663a01c4936f7ee27fb2f5086ed9ae30b12d17d
[ "MIT" ]
null
null
null
site/src/meta.js
sevka/orc-data
5663a01c4936f7ee27fb2f5086ed9ae30b12d17d
[ "MIT" ]
null
null
null
site/src/meta.js
sevka/orc-data
5663a01c4936f7ee27fb2f5086ed9ae30b12d17d
[ "MIT" ]
null
null
null
var d3 = require('d3'); var polarcsv = require('./polar-csv.js').export; var polartable = require('./polartable.js'); var meta = d3.select('#meta').attr('class', 'meta'); function metaItem (label, className, contents, title) { var className = 'meta-label' + (className ? ' ' + className : ''); var title = title ? 'title="' + title + '"' : ''; return '<span class="' + className + '" ' + title + '>' + label + '</span> ' + contents; } function table (data) { var header = ''; var contents = ''; for (var i = 0; i < data[0].length; i++) { header += '<td class="meta-label">' + data[0][i] + '</td>'; contents += '<td>' + data[1][i] + '</td>' } return '<table class="meta-table"><tr>' + header + '</tr><tr>' + contents + '</tr></table>'; } module.exports = function render_metadata (boat, extended) { d3.select('#name').html(boat.name || '<span class="text-muted">Name unknown</span>'); var sizes = boat.boat.sizes; var sailsTable = [['main', 'genoa'], [sizes.main + 'm²', sizes.genoa + 'm²']]; if (sizes.spinnaker > 0) { sailsTable[0].push('spinnaker'); sailsTable[1].push(sizes.spinnaker + 'm²'); } if (sizes.spinnaker_asym > 0) { sailsTable[0].push('asym. spinnaker'); sailsTable[1].push(sizes.spinnaker_asym + 'm²'); } meta.selectAll('.meta-item') .data([ table([ ['sail number', 'type', 'designer', 'owner'], [boat.sailnumber, boat.boat.type, boat.boat.designer, boat.owner] ]), table([ ['length', 'beam', 'draft', 'displacement'], [sizes.loa + 'm', sizes.beam + 'm', sizes.draft + 'm', sizes.displacement + ' kg'] ]), ['Max sail area', table(sailsTable)], '<br />', table([['GPH', 'OSN'], [boat.rating.gph, boat.rating.osn]]), ['offshore TN', boat.rating.triple_offshore.join(', '), 'Offshore triple number'], ['inshore TN', boat.rating.triple_inshore.join(', '), 'Inshore triple number'], '<div class="table-container"></table>', metaItem( 'polar (csv)', 'polar', '<textarea class="' + (extended ? 'csv-extended' : '') + '">' + polarcsv(boat, extended) + '</textarea>' ) ]).enter().append('div').attr('class', 'meta-item'); meta.selectAll('.meta-item').html(function (d) { return (typeof d === 'string') ? d : metaItem(d[0], undefined, d[1], d[2]); }); polartable(meta.select('.table-container'), boat); };
38.072464
120
0.522649
b5139217a1d1a85beb076793969f0df6ebb1c036
2,525
js
JavaScript
js/src/components/Controls/FontSize/Component/index.js
understory-dev/react-draft-wysiwyg
6a67ffa63227790ff960f05d1c79e5c9d91fc9b4
[ "MIT" ]
null
null
null
js/src/components/Controls/FontSize/Component/index.js
understory-dev/react-draft-wysiwyg
6a67ffa63227790ff960f05d1c79e5c9d91fc9b4
[ "MIT" ]
5
2017-12-01T19:11:55.000Z
2018-02-06T21:24:07.000Z
js/src/components/Controls/FontSize/Component/index.js
understory-dev/react-draft-wysiwyg
6a67ffa63227790ff960f05d1c79e5c9d91fc9b4
[ "MIT" ]
null
null
null
/* @flow */ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import { Dropdown, DropdownOption } from '../../../Dropdown'; import styles from './styles.css'; // eslint-disable-line no-unused-vars export default class LayoutComponent extends Component { static propTypes = { expanded: PropTypes.bool, onExpandEvent: PropTypes.func, doExpand: PropTypes.func, doCollapse: PropTypes.func, onChange: PropTypes.func, config: PropTypes.object, currentState: PropTypes.object, }; state: Object = { defaultFontSize: undefined, }; componentDidMount(): void { const editorElm = document.getElementsByClassName('DraftEditor-root'); if (editorElm && editorElm.length > 0) { const styles = window.getComputedStyle(editorElm[0]); let defaultFontSize = styles.getPropertyValue('font-size'); defaultFontSize = defaultFontSize.substring(0, defaultFontSize.length - 2); this.setState({ defaultFontSize, }); } } render() { const { config: { icon, className, dropdownClassName, options }, translations, onChange, expanded, doCollapse, onExpandEvent, doExpand, } = this.props; let { currentState: { fontSize : currentFontSize} } = this.props; let { defaultFontSize } = this.state; defaultFontSize = Number(defaultFontSize); currentFontSize = currentFontSize || (options && options.indexOf(defaultFontSize) >= 0 && defaultFontSize); return ( <div className="rdw-fontsize-wrapper" aria-label="rdw-font-size-control"> <Dropdown className={classNames('rdw-fontsize-dropdown', className)} optionWrapperClassName={classNames(dropdownClassName)} onChange={onChange} expanded={expanded} doExpand={doExpand} doCollapse={doCollapse} onExpandEvent={onExpandEvent} > {currentFontSize ? <span>{currentFontSize}</span> : <img src={icon} alt="" /> } { options.map((size, index) => <DropdownOption className="rdw-fontsize-option" active={currentFontSize === size} value={size} key={index} > {size} </DropdownOption> ) } </Dropdown> </div> ); } }
28.370787
81
0.588911
b515f0faeff3ded398b72f4790bad56aed28a015
529
js
JavaScript
src/Muck_V2.1/LineCheck/Layout.js
G-Pig/Extra
89da377325be8609081883b103d37f97d5f368da
[ "MIT" ]
null
null
null
src/Muck_V2.1/LineCheck/Layout.js
G-Pig/Extra
89da377325be8609081883b103d37f97d5f368da
[ "MIT" ]
null
null
null
src/Muck_V2.1/LineCheck/Layout.js
G-Pig/Extra
89da377325be8609081883b103d37f97d5f368da
[ "MIT" ]
null
null
null
/** * Created by liulin on 2017/9/1. */ ES.Muck.Layout= ES.Muck.BaseLayout.extend({ initUI: function () { // 主地图显示 $('.ex-layout-content').css({ height: $(window).height() , width: $(window).width() - this.oOption.nWidth }); var $dtGridCantrain = $('.dt-grid-container'); var $formSearch = $('.ex-layout-form-search'); $dtGridCantrain.height($('.ex-layout-content').height() - $formSearch.height() - this.oOption.nSearchHeight - $('.echarts-style-box').height()- 40); }, });
33.0625
156
0.589792
b5164328a0a75e8b53ed2ef5c2040e179c8626a3
993
js
JavaScript
app/modules/create-job/controllers/create-job.ctrl.js
stackdot/cuid
802937a05b028ab5b4bbc2341f9f165c9e348d49
[ "MIT" ]
null
null
null
app/modules/create-job/controllers/create-job.ctrl.js
stackdot/cuid
802937a05b028ab5b4bbc2341f9f165c9e348d49
[ "MIT" ]
null
null
null
app/modules/create-job/controllers/create-job.ctrl.js
stackdot/cuid
802937a05b028ab5b4bbc2341f9f165c9e348d49
[ "MIT" ]
null
null
null
// create-job controller: // const Later = require('later') const PrettyCron = require('prettycron') const lodash = require('lodash') module.exports = ( $scope, $state, createJobService ) => { var self = this $scope.cron = { name: 'New Cron', description: 'My new cron description', cron: '0,30 * * * *' } $scope.meta = { auth: { registry: 'docker.infra.tstllc.net', user: 'drone', password: 'drone', email: 'drone@tstllc.net' }, image: 'node:6.3.1', cmd: 'npm install express -g' } $scope.parseText = () => { if( lodash.isEmpty( $scope.cron.cron ) ) return '' return PrettyCron.toString( $scope.cron.cron ) } $scope.submitForm = () => { console.log('submit form') let data = $scope.cron data.meta = {} data.meta.executor = $scope.meta data.meta.executor.cmd = $scope.meta.cmd.split(' ') createJobService.createJob( data ) .then(( res ) => { console.log('create done', res) $state.go('jobs.all', { reload: true }) }) } }
21.586957
58
0.612286
b518895f9e9959d776502ea7b53a38a7bcaefaa1
5,595
js
JavaScript
dist/js/kategoriCamp.js
nurulfauziahh/wedding
264e5780c775976ac2ae9129a8d7669e5bf50b6a
[ "MIT" ]
null
null
null
dist/js/kategoriCamp.js
nurulfauziahh/wedding
264e5780c775976ac2ae9129a8d7669e5bf50b6a
[ "MIT" ]
null
null
null
dist/js/kategoriCamp.js
nurulfauziahh/wedding
264e5780c775976ac2ae9129a8d7669e5bf50b6a
[ "MIT" ]
null
null
null
const database = firebase.firestore(); const userCollection = database.collection('Kategori'); var statusAdd = false; $("#add-kategori-button").click(function(){ var kategori = { namaKat: $("#namaKategoriAdd").val(), gambarKat: $("#gambarKategoriAdd").val(), // tanggal: firebase.firestore.FieldValue.serverTimestamp(), } addKategori(kategori); console.log("berhasil ditambahkan"); statusAdd = true; // if(statusAdd){ // window.location.href = window.location.href; // } }); function addKategori(h){ firebase.firestore().collection("Kategori").add(h); } // Clear modal let template = null; $('.modal').on('show.bs.modal', function(event) { template = $(this).html(); }); $('.modal').on('hidden.bs.modal', function(e) { $(this).html(template); }); // function detailShow(id) { // const database = firebase.firestore(); // const userCollection = database.collection('Campaign'); // userCollection.doc(id).get() // .then(campaigns => { // campaign = campaigns.data(); // if (campaigns.exists) // document.getElementById("detailSection").innerHTML += ` // <img class="card-img-top" src="${campaign.gambarCampaign}" alt="Card image cap"> // <div class="card-body"> // <h4 class="card-title">${campaign.namaCampaign}</h4> // <p class="card-text kategori"> Kategori ${campaign.kategori}</p> // <p class="card-text dana">Dana yang terkumpul Rp.${campaign.danaTerkumpul} dari Rp.${campaign.danaCampaign}</p> // <p class="deskTitle">Deskripsi :</p> // <p class="card-text">${campaign.deskripsi}</p> // </div> // </div> // ` // else // console.log('Campaign does not exist !'); // }) // .catch(error => { // console.error(error); // }); // } function readKategori() { firebase.firestore().collection("Kategori").onSnapshot(function (snapshot) { document.getElementById("table").innerHTML = `<thead class="thead-dark"> <tr> <th scope="col">#</th> <th scope="col">Nama Kategori</th> <th scope="col">Gambar</th> <th scope="col">Action</th> </tr> </thead>`; var i =1; snapshot.forEach(function (kategoriValue) { var kategori = kategoriValue.data(); document.getElementById("table").innerHTML += ` <tbody> <tr> <th scope="row">${i++}</th> <td class="card-title nama">${kategori.namaKat}</td> <td class="name"><img class="card-img-top" src="${kategori.gambarKat}" alt="Card image cap"></td> <td class="gambar" style="display:none"><p>${kategori.gambarKat}</p></td> <td> <button type="button" id="detail-btn" class="btn btn-success" onclick="detailShow('${kategoriValue.id}')" data-toggle="modal" data-target="#detailModal">Details</button> <button type="button" id="edit-kategori-btn" data-heroId="${kategoriValue.id}" class="btn btn-success edit-kategori-btn" data-toggle="modal" data-target="#editModal">Edit</button> <button type="submit" class="btn btn-success" onclick="deleteCamp('${kategoriValue.id}')">Hapus</button> </td> </tr> </tbody> ` }); }); } function deleteCamp(id){ firebase.firestore().collection("Kategori").doc(id).delete().then(() => { console.log("data dihapus"); }); } $(document).on('click', '.edit-kategori-btn', function(){ var kategoriId = $(this).attr('data-heroId'); console.log("you click " + kategoriId); $('#kategoriId').val(kategoriId); var nama = $(this).closest('tr').find('.nama').text(); $('#namaKategoriEdit').val(nama); var gambar = $(this).closest('tr').find('.gambar').text(); $('#gambarKategoriEdit').val(gambar); }); $('#edit-kategori-button').click(function(){ const database = firebase.firestore(); const userCollection = database.collection('Kategori'); const idKat = $('#kategoriId').val(); userCollection.doc(idKat).update({ namaKat: $("#namaKategoriEdit").val(), gambarKat : $("#gambarKategoriEdit").val(), // tanggal: firebase.firestore.FieldValue.serverTimestamp(), }) .then(() => {console.log('Data Successfully');}) .catch(error => {console.error(error)}); }); function uploadImageAdd() { const ref = firebase.storage().ref() const file = document.querySelector("#photoAdd").files[0] const name = new Date() + '-' + file.name const metadata = { contentType: file.type } const task = ref.child(name).put(file, metadata) task .then(snapshot => snapshot.ref.getDownloadURL()) .then(url => { alert("Image Upload Successful") const image = document.querySelector('#imageAdd') image.src = url document.getElementById("gambarKategoriAdd").value = url }) } function uploadImageEdit() { const ref = firebase.storage().ref() const file = document.querySelector("#photoEdit").files[0] const name = new Date() + '-' + file.name const metadata = { contentType: file.type } const task = ref.child(name).put(file, metadata) task .then(snapshot => snapshot.ref.getDownloadURL()) .then(urlEdit => { alert("Image Upload Successful") const imageEdit = document.querySelector('#imageEdit') imageEdit.src = urlEdit document.getElementById("gambarKategoriEdit").value = urlEdit }) }
30.407609
197
0.594459
b519e902dad988add3b9476f390d5c80189feba5
256
js
JavaScript
frontend/src/widgets/CareForm/service.js
PSW-ISA-G4-MNS/PSW-ISA
f96858c64b91f7b61e8995e59154d6df36f3a970
[ "MIT" ]
null
null
null
frontend/src/widgets/CareForm/service.js
PSW-ISA-G4-MNS/PSW-ISA
f96858c64b91f7b61e8995e59154d6df36f3a970
[ "MIT" ]
1
2022-01-21T23:35:26.000Z
2022-01-21T23:35:26.000Z
frontend/src/widgets/CareForm/service.js
PSW-ISA-G4-MNS/PSW-ISA
f96858c64b91f7b61e8995e59154d6df36f3a970
[ "MIT" ]
null
null
null
import { API_URL } from "./../../config"; import axios from "axios" export default class CareFormService { constructor(self) { this.self = self; } static submit(x) { return axios.post(API_URL + "/care/", x); } }
16
49
0.558594
6febc8403c3b5a4968a8fe09b076a740ce8834f9
501
js
JavaScript
javascripts/jquery_rails_ujs_helper.js
pixelvitamina/jquery_rails_ujs_helper
00539a285a77b8cd66c445f88fd7055807845af6
[ "MIT" ]
1
2016-05-09T02:55:51.000Z
2016-05-09T02:55:51.000Z
javascripts/jquery_rails_ujs_helper.js
pixelvitamina/jquery_rails_ujs_helper
00539a285a77b8cd66c445f88fd7055807845af6
[ "MIT" ]
null
null
null
javascripts/jquery_rails_ujs_helper.js
pixelvitamina/jquery_rails_ujs_helper
00539a285a77b8cd66c445f88fd7055807845af6
[ "MIT" ]
null
null
null
// Ajaxify links and form elements with ujs class $(document).ready(function() { $('a.ujs').click(function() {return false;}); $('form.ujs').submit(function() { $.ajax({ data: $.param($(this).serializeArray()), dataType: 'script', type: 'post', url: $(this).attr('action') }); $(this).reset(); return false; }); // Uses the authenticity token from the variables created by yield_authenticity_token $.ajaxSetup({ data: { authenticity_token : AUTH_TOKEN } }); });
21.782609
86
0.62475
6ff272bb4ebcdda27bb566b12ec4d0455f775305
3,936
js
JavaScript
themes/Basic/Gruntfile.js
WasabiCMS/wasabi
e020c02d576ed9b3606b4740376d285e18e7c0c9
[ "MIT" ]
1
2016-06-30T22:58:06.000Z
2016-06-30T22:58:06.000Z
themes/Basic/Gruntfile.js
WasabiCMS/wasabi
e020c02d576ed9b3606b4740376d285e18e7c0c9
[ "MIT" ]
null
null
null
themes/Basic/Gruntfile.js
WasabiCMS/wasabi
e020c02d576ed9b3606b4740376d285e18e7c0c9
[ "MIT" ]
null
null
null
module.exports = function(grunt) { "use strict"; require('jit-grunt')(grunt); require('time-grunt')(grunt); grunt.initConfig({ //-------------------------------------------- STYLE PROCESSING --------------------------------------------------// less: { frontend: { options: { sourceMap: true, sourceMapURL: 'main.css.map' }, files: { '.build/Assets/css/main.css': 'src/Assets/less/main.less' } } }, cssmin: { options: { shorthandCompacting: false, roundingPrecision: -1 }, default: { files: { '.build/Assets/css/main.min.css': '.build/Assets/css/main.css' } } }, //--------------------------------------------- JS PROCESSING -----------------------------------------------------// jshint: { default: [ 'package.json', 'Gruntfile.js', 'src/Assets/js/**/*.js' ] }, requirejs: { app: { options: { // Define our base URL - all module paths are relative to this // base directory. baseUrl: 'src/Assets/js/src', // Define our build directory. All files in the base URL will be // COPIED OVER into the build directory as part of the // concatentation and optimization process. dir: '.build/Assets/js/', // Load the RequireJS config() definition from the config.js file. // Otherwise, we'd have to redefine all of our paths again here. mainConfigFile: 'src/Assets/js/src/common.js', findNestedDependencies: true, fileExclusionRegExp: /^\.|\.md$|^LICENSE$|\.json$|^src$|\.map$|^demo$|^test$|^tests$|\.TXT$|\.txt$|^fonts$|^css$|\.css$|^less$|\.less$|^grunt$|\.sh$|^r.js$/, // Define the modules to compile. modules: [ { name: 'app' } ], // Minify all js files via uglify2 and set DEBUG to false during the build. // This way you can use statements like: // if (DEBUG) { // console.log('foobar') // } // during development (Configure::write('debug', true)) // which will be excluded from the build. optimize: 'uglify2', uglify2: { compress:{ global_defs: { DEBUG: false } } } } } }, uglify: { requirejs: { files: [ {src: 'src/Assets/js/vendor/requirejs/require.js', dest: '.build/Assets/js/require.js'} ] } }, concat: { options: { separator: ';' }, js: { src: ['.build/Assets/js/require.js', '.build/Assets/js/app.js'], dest: '.build/Assets/js/build.js' } }, copy: { js: { files: [ {src: '.build/Assets/js/build.js', dest: 'webroot/js/app.js'} ] }, css: { files: [ {src: '.build/Assets/css/main.min.css', dest: 'webroot/css/main.min.css'}, {src: '.build/Assets/css/main.css', dest: 'webroot/css/main.css'}, {src: '.build/Assets/css/main.css.map', dest: 'webroot/css/main.css.map'} ] } }, //----------------------------------------------- WATCHERS -------------------------------------------------------// watch: { less: { files: ['src/Assets/less/**/*.less'], tasks: ['less', 'cssmin', 'copy:css'] } } }); //--------------------------------------------- REGISTERED TASKS ---------------------------------------------------// grunt.registerTask('default', [ 'less', 'cssmin', 'jshint', 'requirejs:app', 'uglify:requirejs', 'concat:js', 'copy:js', 'copy:css' ]); grunt.registerTask('watch-less', [ 'watch:less' ]); };
27.71831
167
0.4375
6ff3caa6c11d86727fdcedccba98cb7d79e4fc61
1,672
js
JavaScript
cli.js
abranhe/abranhe-feedback
1bd24a89c911339c5d2ec1eed1e9084374c48ef1
[ "MIT" ]
2
2018-08-14T04:30:08.000Z
2018-10-14T06:42:32.000Z
cli.js
abranhe/abranhe-feedback
1bd24a89c911339c5d2ec1eed1e9084374c48ef1
[ "MIT" ]
null
null
null
cli.js
abranhe/abranhe-feedback
1bd24a89c911339c5d2ec1eed1e9084374c48ef1
[ "MIT" ]
null
null
null
#!/usr/bin/env node 'use strict'; const meow = require('meow'); const username = require('username'); const open = require('opn'); const capitalize = require('capitalize'); const feedback = require('./index.js'); const cli = meow(` Usage $ abranhe-feedback <option> Options -h, --help Show this message and close -n, --name Set your name, default: your computer username -p, --project Project Name -m, --message Set message to send -e, --email Set your email to contact you back -s, --submit If you use (submit) you will automatically send the feedback from the command line, otherwise you will need to finish online. Examples $ abranhe-feedback -n "your name" -e "your@email.com" $ abranhe-feedback -p "a project" -m "Your feedback" --submit `,{ flags: { submit: { type: 'boolean', alias: 's' }, help: { type: 'boolean', alias: 'h' }, name: { type: 'string', alias: 'n' }, project: { type: 'string', alias: 'p' }, email: { type: 'string', alias: 'e' }, message: { type: 'string', alias: 'm' } } }); username().then(username => { if(cli.flags.project) { feedback.project(cli.flags.project); } if(cli.flags.email) { feedback.email(cli.flags.email); } if(cli.flags.message) { feedback.message(cli.flags.message); } else { feedback.message(feedback.defaultMessage); } if(cli.flags.name) { feedback.name(cli.flags.name); } else { feedback.name(capitalize(username)); } if(cli.flags.submit) { feedback.submit(); } feedback.web(); });
20.390244
75
0.587321
6fe9f0d33c99ba8cd6c0d3301c4c63bbe220441e
736
js
JavaScript
eletivaspro/aluno_frontend/src/containers/LanguageProvider/selectors.js
flavioVitoriano/EletivasPro
34447081a1923286d78c56bd1f019214a8b25999
[ "MIT" ]
4
2018-11-22T22:29:21.000Z
2019-01-31T17:57:16.000Z
eletivaspro/aluno_frontend/internals/templates/containers/LanguageProvider/selectors.js
luckysora/EletivasPro
34447081a1923286d78c56bd1f019214a8b25999
[ "MIT" ]
11
2021-03-19T12:20:56.000Z
2022-03-12T00:47:14.000Z
eletivaspro/aluno_frontend/internals/templates/containers/LanguageProvider/selectors.js
flavioVitoriano/EletivasPro
34447081a1923286d78c56bd1f019214a8b25999
[ "MIT" ]
2
2018-11-22T22:37:58.000Z
2018-11-22T22:49:20.000Z
/** * * LanguageProvider selectors * */ import { createSelector } from 'reselect'; import { initialState } from './reducer'; /** * Direct selector to the languageProvider state domain */ const selectLanguageProviderDomain = state => state.languageProvider || initialState; /** * Other specific selectors */ const makeSelectLocale = () => createSelector( selectLanguageProviderDomain, languageState => languageState.locale, ); /** * Default selector used by LanguageProvider */ const makeSelectLanguageProvider = () => createSelector( selectLanguageProviderDomain, subState => subState, ); export default makeSelectLanguageProvider; export { selectLanguageProviderDomain, makeSelectLocale };
18.4
58
0.726902
b508d2069a6d91ece28f4c577032e09256a22bd0
1,277
js
JavaScript
lib/ClassHelpers.js
techery/janet-ts
0ca74a329b41f771c1342dfa804503b810d5ae51
[ "MIT" ]
5
2017-09-08T12:01:28.000Z
2019-02-05T19:47:36.000Z
lib/ClassHelpers.js
techery/janet-ts
0ca74a329b41f771c1342dfa804503b810d5ae51
[ "MIT" ]
null
null
null
lib/ClassHelpers.js
techery/janet-ts
0ca74a329b41f771c1342dfa804503b810d5ae51
[ "MIT" ]
null
null
null
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function getClassName(constructor) { var funcNameRegex = new RegExp("function (\\w+)\\("); var results = (funcNameRegex).exec(constructor.toString()); return (results && results.length > 1) ? results[1] : ""; } exports.getClassName = getClassName; function getFullClassNameComponentsFromClass(target) { var classNames = []; var obj = target.prototype; var className = getClassName(target); while (className !== "Object") { classNames.push(className); obj = Object.getPrototypeOf(obj); className = getClassName(obj.constructor); } classNames.push("@@janet"); return classNames.reverse(); } exports.getFullClassNameComponentsFromClass = getFullClassNameComponentsFromClass; function getActionName(obj) { if (obj.type !== undefined) { return obj.type; } else if (typeof obj === "object") { return getFullClassNameComponentsFromClass(obj.constructor).join("/"); } else if (typeof obj === "function") { return getFullClassNameComponentsFromClass(obj).join("/"); } else { throw new Error("Invalid action type:" + JSON.stringify(obj)); } } exports.getActionName = getActionName;
34.513514
82
0.671104
b5110e4e421275ad3c29bcb26958bdc029100c36
17,232
js
JavaScript
help/PE.js
kcomain/Detect-It-Easy
b80d655ef54f7d3f14192c03f5207018aa6835a4
[ "MIT" ]
1
2019-02-06T14:36:45.000Z
2019-02-06T14:36:45.000Z
help/PE.js
kwl3434/Detect-It-Easy
9f418121c83ef9c88421f2a19f1493a61c1ea8ce
[ "MIT" ]
null
null
null
help/PE.js
kwl3434/Detect-It-Easy
9f418121c83ef9c88421f2a19f1493a61c1ea8ce
[ "MIT" ]
null
null
null
/** * @class * @classdesc This is a description of the PE class. */ function PE(){} /** * @see Binary.calculateEntropy */ PE.calculateEntropy=function(nOffset,nSize){} /** * @see Binary.calculateMD5 */ PE.calculateMD5=function(nOffset,nSize){} /** * Calculate the size of the headers. * @returns {UInt} */ PE.calculateSizeOfHeaders=function(){} /** * @see Binary.compare */ PE.compare=function(sSignature,nOffset){} /** * Compare (see {@link Binary.compare}) bytes at the <b>E</b>ntry <b>P</b>oint. * @param {String} sSignature - The signature. * @param {Int} [nOffset=0] - The offset from the entry point. * @returns {Bool} * @example * if(PE.compareEP("2C81",8)) * { * sVersion="1.98"; * } * * if(PE.compareEP("EB016860E8000000008B1C2483C312812BE8B10600FE4BFD822C24")) * { * bDetected=1; * } */ PE.compareEP=function(sSignature,nOffset){} /** * Compare (see {@link Binary.compare}) bytes at the <b>E</b>ntry <b>P</b>oint of .NET. * @param {String} sSignature - The signature. * @param {Int} [nOffset=0] - The offset from the entry point of .NET. * @returns {Bool} * @example * if(PE.compareEP_NET("4228070000066f09000006283800000a2a1b3004006f0000000d0000110272b9")) * { * bDetected=1; * sVersion="2.X"; * } */ PE.compareEP_NET=function(sSignature,nOffset){} /** * Compare bytes at the overlay. * @param {String} sSignature - The signature. * @param {Int} [nOffset=0] - The offset from the overlay. * @returns {Bool} * @example * if(PE.compareOverlay("';!@Install@!UTF-8!'")) * { * bDetected=1; * } */ PE.compareOverlay=function(sSignature,nOffset){} /** * @see Binary.findByte */ PE.findByte=function(nOffset,nSize,cValue){} /** * @see Binary.findDword */ PE.findDword=function(nOffset,nSize,nValue){} /** * @see Binary.findSignature * @example * nOffset=PE.findSignature(nOffset,1024,"'7z'BCAF271C"); * if(nOffset!=-1) * { * bDetected=1; * } */ PE.findSignature=function(nOffset,nSize,sSignature){} /** * @see Binary.findString * @example * nOffset=PE.findString(0,1024,"UPX!"); * if(nOffset==-1) * { * return; * } */ PE.findString=function(nOffset,nSize,sValue){} /** * @see Binary.findWord */ PE.findWord=function(nOffset,nSize,sValue){} /** * Get the relative virtual address (RVA) of the entry point. * @returns {UInt} * @example * var nSection=PE.nLastSection; * if(nSection>=2) * { * if(PE.getAddressOfEntryPoint()==PE.section[nSection].VirtualAddress) * { * if(PE.section[nSection].Characteristics==0xe0000040) * { * if(PE.section[nSection-1].Characteristics==0xe0000040) * { * if(PE.getNumberOfImportThunks(0)==1) * { * bDetected=1; * } * } * } * } * } */ PE.getAddressOfEntryPoint=function(){} /** * Get the compiler version. * @returns {String} The string <code>"<i>MajorLinkerVersion</i>.<i>MinorLinkerVersion</i>"</code>. * @example * if(bDetected) * { * switch(PE.getCompilerVersion()) * { * case "6.0": sVersion="6.0"; break; * case "7.0": sVersion="2002"; break; * case "7.10": sVersion="2003"; break; * case "8.0": sVersion="2005"; break; * case "9.0": sVersion="2008"; break; * case "10.0": sVersion="2010"; break; * case "11.0": sVersion="2012"; break; * case "12.0": sVersion="2013"; break; * } * } */ PE.getCompilerVersion=function(){} /** * Get the number of the section containing the entry point. * @returns {Int} If no entry point returns <code>-1</code>. * @example * if(PE.getEntryPointSection()==PE.nLastSection) * { * bDetected=1; * } */ PE.getEntryPointSection=function(){} /** * @see Binary.getFileDirectory */ PE.getFileDirectory=function(){} /** * Get the version of the file, if the version resource exists. * @returns {String} */ PE.getFileVersion=function(){} /** * Get a string in the form of <code>"<i>PEtype</i><i>PEmode</i>"</code>. For example <samp>"EXE32"</samp> or <samp>"Driver32"</samp>. * @returns {String} */ PE.getGeneralOptions=function(){} /** * Get the base address of the image. * @returns {UInt} */ PE.getImageBase=function(){} /** * Get the name of an imported function. * @param {UInt} nImport - Number of the imported library. * @param {UInt} nFunctionNumber - Number of the function in the library. * @returns {String} */ PE.getImportFunctionName=function(nImport,nFunctionNumber){} /** * Get the name of an imported library. * @param {UInt} nImport - Number of the imported library. * @returns {String} */ PE.getImportLibraryName=function(nImport){} /** * Get the number of the section containing the import table. * @returns {Int} If no import returns <code>-1</code>. */ PE.getImportSection=function(){} /** * Get the machine type. * @returns {UShort} */ PE.getMachineType=function(){} /** * Get the major linker version. * @returns {UInt} * @example * var nMajor=PE.getMajorLinkerVersion(); * if(nMajor>3) * { * sName="Microsoft Linker"; * bDetected=1; * } */ PE.getMajorLinkerVersion=function(){} /** * Get the XML manifest from the resources. * @returns {String} * @example * if(/requireAdministrator/.test(PE.getManifest())) * { * sOptions=sOptions.append("admin"); * } */ PE.getManifest=function(){} /** * Get the minor linker version. * @returns {UInt} * @example * var nMinor=PE.getMinorLinkerVersion(); * if(nMinor==55) * { * sName="LCC Linker"; * sVersion+="*"; * bDetected=1; * } */ PE.getMinorLinkerVersion=function(){} /** * Get the .NET version. * @returns {String} * @example * if(PE.isNET()) * { * sVersion=PE.getNETVersion(); * bDetected=1; * } */ PE.getNETVersion=function(){} /** * Get the number of imports. * @returns {Int} * @example * if(PE.getNumberOfImports()==1) * { * if(PE.getNumberOfImportThunks(0)==2) * { * if(PE.section[0].Name=="ANDpakk2") * { * sVersion="2.X"; * bDetected=1; * } * } * } */ PE.getNumberOfImports=function(){} /** * Get the number of functions in the imported library. * @param {UInt} nImport - Number of the library. * @returns {UInt} * @example * if(PE.getNumberOfImportThunks(0)==1) * { * bDetected=1; * } */ PE.getNumberOfImportThunks=function(nImport){} /** * Get the number of sections. * @returns {Int} */ PE.getNumberOfSections=function(){} /** * Get the file offset of the overlay. * @returns {UInt} */ PE.getOverlayOffset=function(){} /** * Get the size of the overlay . * @returns {UInt} */ PE.getOverlaySize=function(){} /** * Get the version of a particular file, if the version resource exists. * @param {String} sFileName - The file name. * @returns {String} */ PE.getPEFileVersion=function(sFileName){} /** * Get the file offset to a named resource. * @param {String} sFileName - The name of the resource. * @returns {Int} If an error occurs, <code>-1</code> will be returned. */ PE.getResourceNameOffset=function(sName){} /** * Get the size of a named resource. * @param {String} sFileName - The name of the resource. * @returns {Int} */ PE.getResourceNameSize=function(sName){} /** * Get the characteristics of a section. * @param {Int} nSectionNumber - Section number (from 0). * @returns {UInt} */ PE.getSectionCharacteristics=function(nSectionNumber){} /** * Get the file offset of a setion. * @param {Int} nSectionNumber - Section number (from 0). * @returns {UInt} */ PE.getSectionFileOffset=function(nSectionNumber){} /** * Get the file size of a section. * @param {Int} nSectionNumber - Section number (from 0). * @returns {UInt} */ PE.getSectionFileSize=function(nSectionNumber){} /** * Get the name of a section. * @param {Int} nSectionNumber - Section number (from 0). * @returns {String} */ PE.getSectionName=function(nSectionNumber){} /** * Get the relative virtual address of a section. * @param {Int} nSectionNumber - Section number (from 0). * @returns {UInt} */ PE.getSectionVirtualAddress=function(nSectionNumber){} /** * Get the virtual size of a section. * @param {Int} nSectionNumber - Section number (from 0). * @returns {UInt} */ PE.getSectionVirtualSize=function(nSectionNumber){} /** * Get the common prefix of two section name suffixes. * @param {String} sString1 - First section name suffix. * @param {String} sString2 - Second section name suffix. * @returns {String} Section name prefix. * @example * if("UPX"==PE.getSectionNameCollision("0","1")) * { * // Both "UPX0" and "UPX1" exist. * bDetected=1; * } */ PE.getSectionNameCollision=function(sString1,sString2){} /** * Get the number of a section with a specific name. * @param {String} sSectionName - Section name. * @returns {Int} 0-based section number, or <code>-1</code> if there is no section with that name. */ PE.getSectionNumber=function(sSectionName){} /** * Get the number of a section whose name matches a regular expression. * @param {String} sSectionName - Section pattern. * @returns {Int} 0-based section number, or <code>-1</code> if there is no section with that pattern. */ PE.getSectionNumberExp=function(sSectionName){} /** * Checks if a section exists with a specific name. * @param {String} sSectionName - Section name. * @returns {Bool} */ PE.isSectionNamePresent=function(sSectionName){} /** * Check if a section name matches a regular expression. * @param {String} sSectionName - Section pattern. * @returns {Bool} */ PE.isSectionNamePresentExp=function(sSectionName){} /** * @see Binary.getSignature */ PE.getSignature=function(nOffset,nSize){} /** * @see Binary.getSize */ PE.getSize=function(){} /** * Get the size of code. * @returns {Int} */ PE.getSizeOfCode=function(){} /** * Get the size of unitialized data. * @returns {Int} */ PE.getSizeOfUninitializedData=function(){} /** * Check if the file is a console application. * @returns {Bool} */ PE.isConsole=function(){} /** * Check if the file is a DLL. * @returns {Bool} */ PE.isDll=function(){} /** * Check if the file is a driver. * @returns {Bool} */ PE.isDriver=function(){} /** * Check if the file is a .NET application. * @returns {Bool} */ PE.isNET=function(){} /** * Check if there is an overlay in the file. * @returns {Bool} */ PE.isOverlayPresent=function(){} /** * Check if the file is 64 bit (PE+). * @returns {Bool} * @example * if(PE.isPEPlus()) * { * sOptions="PE+"; * } */ PE.isPEPlus=function(){} /** * Check if the “Rich” signature is in the file. For more information see {@link http://www.ntcore.com/files/richsign.htm}. It is typical for the files made by the MS Linker. * @returns {Bool} * @example * if(PE.isRichSignaturePresent()) * { * sName="Microsoft Linker"; * bDetected=1; * } */ PE.isRichSignaturePresent=function(){} /** * Check if there is a resource with a specific name in the file. * @param {String} sName - The name of the resource. * @returns {Bool} * @example * if(PE.isResourceNamePresent("PACKAGEINFO")) * { * bDetected=1; * } */ PE.isResourceNamePresent=function(sName){} /** * Check if there is a specific .NET string. * @param {String} sString * @returns {Bool} * @example * if(PE.isNETStringPresent(0,"DotfuscatorAttribute")) * { * bDetected=1; * } */ PE.isNETStringPresent=function(sString){} /** * Check if there is a specific .NET Unicode string. * @param {String} sString * @returns {Bool} * @example * if(PE.isNETUnicodeStringPresent("E_TamperDetected")) * { * sVersion="3.X-4.X"; * bDetected=1; * } */ PE.isNETUnicodeStringPresent=function(sString){} /** * Check if a function exists in a library. * @param {String} sLibraryName - The name of the library. * @param {String} sFunctionName - The name of the function. * @returns {Bool} */ PE.isLibraryFunctionPresent=function(sLibraryName,sFunctionName){} /** * Check if a library is imported. * @param {String} sLibraryName - The name of the library. * @returns {Bool} * @example * if(PE.isLibraryPresent("MSVBVM50.DLL")) * { * sVersion="5.0"; * bDetected=1; * } */ PE.isLibraryPresent=function(sLibraryName){} /** * Check if a signature (see {@link Binary.compare}) exists in a section. * @param {Int} nSection - Section number (from 0). * @param {String} sSignature - Signature. * @returns {Bool} * @example * if(PE.isSignatureInSectionPresent(0,"'ENIGMA'")) * { * bDetected=1; * } */ PE.isSignatureInSectionPresent=function(nSection,sSignature){} /** * @see Binary.isSignaturePresent */ PE.isSignaturePresent=function(nOffset,nSize,sSignature){} /** * Convert a file offset to a relative virtual address (RVA). * @param {UInt64} nOffset * @returns {Int64} If an error occurs, -1 will be returned. */ PE.OffsetToRVA=function(nOffset){} /** * Convert a file offset to a virtual address (VA). * @param {UInt64} nOffset * @returns {Int64} If an error occurs, -1 will be returned. */ PE.OffsetToVA=function(nOffset){} /** * @see Binary.readByte */ PE.readByte=function(nOffset){} /** * @see Binary.readDword */ PE.readDword=function(nOffset){} /** * @see Binary.readWord */ PE.readWord=function(nOffset){} /** * @see Binary.swapBytes */ PE.swapBytes=function(nValue){} /** * Convert a relative virtual address (RVA) to a file offset. * @param {UInt64} nRVA * @returns {Int64} If an error occurs, -1 will be returned. */ PE.RVAToOffset=function(nRVA){} /** * Convert a virtual address (VA) to a file offset. * @param {UInt64} nVA * @returns {Int64} If an error occurs, -1 will be returned. */ PE.VAToOffset=function(nVA){} /** * @see Binary.getString */ PE.getString=function(nOffset,nSize){} /** * Get the value associated with a version resource string key. * @param {String} sKey * @returns {String} */ PE.getVersionStringInfo=function(sKey){} /** * Check if there is an MSDOS stub. * @returns {Bool} */ PE.isDosStubPresent=function(){} /** * Get the file offset of the MSDOS stub. * @returns {UInt} */ PE.getDosStubOffset=function(){} /** * Get the size of the MSDOS stub. * @returns {UInt} */ PE.getDosStubSize=function(){} /** * Get the number of resources. * @returns {UInt} */ PE.getNumberOfResources=function(){} /** * Get the offset of a resource. * @param {UInt} nNumber - Number of resource. * @returns {Int} If an error occurs, -1 will be returned. */ PE.getResourceOffsetByNumber=function(nNumber){} /** * Get the size of a resource. * @param {UInt} nNumber - Number of resource. * @returns {Int} */ PE.getResourceSizeByNumber=function(nNumber){} /** * Get the Id of a resource. * @param {UInt} nNumber - Number of resource. * @returns {UInt} */ PE.getResourceIdByNumber=function(nNumber){} /** * Get the name of a resource. * @param {UInt} nNumber - Number of resource. * @returns {String} */ PE.getResourceNameByNumber=function(nNumber){} /** * Get the type of a resource. * @param {UInt} nNumber - Number of resource. * @returns {String} * @example * if(PE.getResourceTypeByNumber(0)=="RT_MANIFEST") * { * bDetected=1; * } */ PE.getResourceTypeByNumber=function(nNumber){} /** * Get the number of the section containing the export table. * @returns {Int} If no export returns <code>-1</code>. */ PE.getExportSection=function(){} /** * Get the number of the section containing the relocations. * @returns {Int} If no relocations returns <code>-1</code>. */ PE.getRelocsSection=function(){} /** * Get the number of the section containing the resources. * @returns {Int} If no resources returns <code>-1</code>. */ PE.getResourceSection=function(){} /** * Get the number of the section containing the TLS. * @returns {Int} If no TLS returns <code>-1</code>. */ PE.getTLSSection=function(){} /** * Get the number of the Rich IDs. * @returns {UInt} */ PE.getNumberOfRichIDs=function(){} /** * Check if there is a Rich version. * @param {UInt} nVersion - Rich version. * @returns {Bool} */ PE.isRichVersionPresent=function(nVersion){} /** * Check if there is a digital signature. * @returns {Bool} */ PE.isSignedFile=function(){} /** * Get the offset of the entry point. * @returns {Int64} If an error occurs, -1 will be returned. */ PE.getEntryPointOffset=function(){} /** * @see Binary.getFileBaseName */ PE.getFileBaseName=function(){} /** * @see Binary.getFileSuffix */ PE.getFileSuffix=function(){} /** * @see Binary.getFileCompleteSuffix */ PE.getFileCompleteSuffix=function(){} /** * Check if Export presents. * @returns {Bool} */ PE.isExportPresent=function(){} /** * Check if TLS presents. * @returns {Bool} */ PE.isTLSPresent=function(){} /** * Check if Import presents. * @returns {Bool} */ PE.isImportPresent=function(){} /** * Check if Resource presents. * @returns {Bool} */ PE.isResourcePresent=function(){} /** * Check if Export function exists with a specific name. * @param {String} sFunctionName - Function name * @returns {Bool} */ PE.isExportFunctionPresent=function(){} /** * Check if Export function matches a regular expression. * @param {String} sFunctionName - Function pattern * @returns {Bool} */ PE.isExportFunctionPresentExp=function(){}
24.829971
174
0.657904
6ff3cee220c545d6ae4a1d1478267433f69cb43f
8,593
js
JavaScript
docs/doxygen/html/search/all_12.js
QiuAhha/NumCpp
3d7c09fe004d7cd414dc657fc1603940dc617cb8
[ "MIT" ]
1
2019-06-17T02:04:04.000Z
2019-06-17T02:04:04.000Z
docs/doxygen/html/search/all_12.js
QiuAhha/NumCpp
3d7c09fe004d7cd414dc657fc1603940dc617cb8
[ "MIT" ]
null
null
null
docs/doxygen/html/search/all_12.js
QiuAhha/NumCpp
3d7c09fe004d7cd414dc657fc1603940dc617cb8
[ "MIT" ]
null
null
null
var searchData= [ ['ra',['RA',['../classnc_1_1coordinates_1_1_r_a.html',1,'nc::coordinates::RA'],['../classnc_1_1coordinates_1_1_r_a.html#aecba08a8023c2db83cad9a4081acc2f8',1,'nc::coordinates::RA::RA() noexcept=default'],['../classnc_1_1coordinates_1_1_r_a.html#ab14fd57fb6ab65c4d8ca668d549a507f',1,'nc::coordinates::RA::RA(double inDegrees)'],['../classnc_1_1coordinates_1_1_r_a.html#a7566e8350b9075ae0f0406fce26b7900',1,'nc::coordinates::RA::RA(uint8 inHours, uint8 inMinutes, double inSeconds) noexcept'],['../classnc_1_1coordinates_1_1_coordinate.html#abf447494a1d0a769af81aeab79041e5b',1,'nc::coordinates::Coordinate::ra()']]], ['rad2deg',['rad2deg',['../namespacenc.html#a08f4ef3bf79eaa0944f869a4013940e9',1,'nc::rad2deg(dtype inValue) noexcept'],['../namespacenc.html#a3dd7ad21130c11676cf2d292c0f0e11d',1,'nc::rad2deg(const NdArray&lt; dtype &gt; &amp;inArray) noexcept']]], ['radians',['radians',['../classnc_1_1coordinates_1_1_r_a.html#a8a9f875774dd8375cbc72c7fbfbebc2a',1,'nc::coordinates::RA::radians()'],['../classnc_1_1coordinates_1_1_dec.html#af80282ccfb04054bbccb98735a28ac46',1,'nc::coordinates::Dec::radians()'],['../namespacenc.html#a362034446d04a8dc9468b5a90f6998c0',1,'nc::radians(dtype inValue) noexcept'],['../namespacenc.html#a66f8e8d8f43d565bf5c709184627f11e',1,'nc::radians(const NdArray&lt; dtype &gt; &amp;inArray) noexcept']]], ['radianseperation',['radianSeperation',['../classnc_1_1coordinates_1_1_coordinate.html#a169974783c87c9bbc89ccb4ea2ea4123',1,'nc::coordinates::Coordinate::radianSeperation(const Coordinate &amp;inOtherCoordinate) const'],['../classnc_1_1coordinates_1_1_coordinate.html#ae01f4143ae771a0f8bccefc4bba78b86',1,'nc::coordinates::Coordinate::radianSeperation(const NdArray&lt; double &gt; &amp;inVector) const'],['../namespacenc_1_1coordinates.html#ac26247590cae76bd0e551a3300680f55',1,'nc::coordinates::radianSeperation(const Coordinate &amp;inCoordinate1, const Coordinate &amp;inCoordinate2) noexcept'],['../namespacenc_1_1coordinates.html#a0fd3df39e04b072bf988390bce990f7c',1,'nc::coordinates::radianSeperation(const NdArray&lt; double &gt; &amp;inVector1, const NdArray&lt; double &gt; &amp;inVector2) noexcept']]], ['rand',['rand',['../classnc_1_1_random.html#ac73c913bc278f74fd7d5085d03f837e0',1,'nc::Random']]], ['randfloat',['randFloat',['../classnc_1_1_random.html#a05b9dec10bb644cf7eddb739080f0a4f',1,'nc::Random']]], ['randint',['randInt',['../classnc_1_1_random.html#a58118049d8d151830785eea302af5586',1,'nc::Random']]], ['randn',['randN',['../classnc_1_1_random.html#aa1c4292668a94c9e5a9b554f9c0ca76d',1,'nc::Random']]], ['random',['Random',['../classnc_1_1_random.html',1,'nc']]], ['random_2ehpp',['Random.hpp',['../_random_8hpp.html',1,'']]], ['rankfilter',['rankFilter',['../namespacenc_1_1filter.html#a972e8e16448b6c4aab483b0e352d3e02',1,'nc::filter']]], ['rankfilter1d',['rankFilter1d',['../namespacenc_1_1filter.html#a543f334070e494f6fba9a943a832415e',1,'nc::filter']]], ['readme_2emd',['README.md',['../_r_e_a_d_m_e_8md.html',1,'']]], ['reciprocal',['reciprocal',['../namespacenc.html#aa30825d04d9afa89e8ab434535c56cb6',1,'nc']]], ['reflect',['REFLECT',['../namespacenc_1_1filter.html#ada517a46ea965fa51ed51101135c6ac6ae4f6a05f82ed398f984f4bc1a55838df',1,'nc::filter']]], ['reflectboundary',['reflectBoundary',['../namespacenc_1_1filter.html#a668b6c63836542f26d963a619f5658d1',1,'nc::filter']]], ['reflectboundary1d',['reflectBoundary1d',['../namespacenc_1_1filter.html#aee9c0973c07ffabdfd3fd92c3a182a90',1,'nc::filter']]], ['remainder',['remainder',['../namespacenc.html#a12bfc5b4d937aa0366b70fb15270bd41',1,'nc::remainder(dtype inValue1, dtype inValue2) noexcept'],['../namespacenc.html#abb157bedd0a3a4c5ee9d7dabc57cfde1',1,'nc::remainder(const NdArray&lt; dtype &gt; &amp;inArray1, const NdArray&lt; dtype &gt; &amp;inArray2)']]], ['repeat',['repeat',['../classnc_1_1_nd_array.html#ada6c26cecef37f5db019011b458a6c12',1,'nc::NdArray::repeat(uint32 inNumRows, uint32 inNumCols) const noexcept'],['../classnc_1_1_nd_array.html#a775b416ccd90497951c25029ad932c2c',1,'nc::NdArray::repeat(const Shape &amp;inRepeatShape) const noexcept'],['../namespacenc.html#ab05327f86b004d1109eb84255786fde6',1,'nc::repeat(const NdArray&lt; dtype &gt; &amp;inArray, uint32 inNumRows, uint32 inNumCols) noexcept'],['../namespacenc.html#a74456399d0c5250f19b437ea6ac06f99',1,'nc::repeat(const NdArray&lt; dtype &gt; &amp;inArray, const Shape &amp;inRepeatShape) noexcept']]], ['reshape',['reshape',['../classnc_1_1_nd_array.html#a597b9157af97d8be0d38403639aa4b02',1,'nc::NdArray::reshape(uint32 inNumRows, uint32 inNumCols)'],['../classnc_1_1_nd_array.html#a7ca330bab82607c59533526d710934ba',1,'nc::NdArray::reshape(const Shape &amp;inShape)'],['../namespacenc.html#a2d711099d8ee30a6e127aa946118bfc4',1,'nc::reshape(NdArray&lt; dtype &gt; &amp;inArray, uint32 inNumRows, uint32 inNumCols)'],['../namespacenc.html#a73096b21189fdc428553b7ab7a5ad556',1,'nc::reshape(NdArray&lt; dtype &gt; &amp;inArray, const Shape &amp;inNewShape)']]], ['resizefast',['resizeFast',['../classnc_1_1_nd_array.html#a840391eb35aa00abef21132db0fdb6c5',1,'nc::NdArray::resizeFast(uint32 inNumRows, uint32 inNumCols) noexcept'],['../classnc_1_1_nd_array.html#a7ad0dade90a29ff329c565515c7f8122',1,'nc::NdArray::resizeFast(const Shape &amp;inShape) noexcept'],['../namespacenc.html#a23e62805f41c2c3878fd4cec22ae0593',1,'nc::resizeFast(NdArray&lt; dtype &gt; &amp;inArray, uint32 inNumRows, uint32 inNumCols) noexcept'],['../namespacenc.html#ae5244c329773c955dcf94b3120e8645d',1,'nc::resizeFast(NdArray&lt; dtype &gt; &amp;inArray, const Shape &amp;inNewShape) noexcept']]], ['resizeslow',['resizeSlow',['../classnc_1_1_nd_array.html#a5b886044df5232dc1ba6a8e01c92c9dd',1,'nc::NdArray::resizeSlow(uint32 inNumRows, uint32 inNumCols) noexcept'],['../classnc_1_1_nd_array.html#a358cee90c1763477d9aff546811a9e55',1,'nc::NdArray::resizeSlow(const Shape &amp;inShape) noexcept'],['../namespacenc.html#a4aaa0d29fba0d537e19931efe21b2184',1,'nc::resizeSlow(NdArray&lt; dtype &gt; &amp;inArray, uint32 inNumRows, uint32 inNumCols) noexcept'],['../namespacenc.html#a276e498af952a840bf5fdf74f95cdbe2',1,'nc::resizeSlow(NdArray&lt; dtype &gt; &amp;inArray, const Shape &amp;inNewShape) noexcept']]], ['right_5fshift',['right_shift',['../namespacenc.html#a3934a88b2bb7a4f3de0949eb00e3b4a2',1,'nc']]], ['rint',['rint',['../namespacenc.html#a9ba33527dbca7d5482cf88899abd827d',1,'nc::rint(dtype inValue) noexcept'],['../namespacenc.html#aad089cbed60089da7def17fd9b5d143b',1,'nc::rint(const NdArray&lt; dtype &gt; &amp;inArray) noexcept']]], ['rms',['rms',['../classnc_1_1_nd_array.html#a6d2ac80b2f7b1fa818e33bd03d66a224',1,'nc::NdArray::rms()'],['../namespacenc.html#a7849bce8e073ce26bbb5d6082bf42f62',1,'nc::rms()']]], ['roll',['roll',['../namespacenc.html#acac1ebbc5e3f3ef8d09874f3fcf1b22b',1,'nc']]], ['rot90',['rot90',['../namespacenc.html#afee9039247b1185f0d619017be3a6109',1,'nc']]], ['rotate',['rotate',['../classnc_1_1rotations_1_1_quaternion.html#ac0d338fe7e9bb4a3a9ab2386f3f4f7c4',1,'nc::rotations::Quaternion']]], ['rotations_2ehpp',['Rotations.hpp',['../_rotations_8hpp.html',1,'']]], ['round',['round',['../classnc_1_1_nd_array.html#a3f1c7b94cf5f2b2beb961ef426e0e29f',1,'nc::NdArray::round()'],['../namespacenc.html#a41f18de9a9c6b9ae0b2053a22400baba',1,'nc::round(dtype inValue, uint8 inDecimals=0) noexcept'],['../namespacenc.html#a17488aafca1cf8f27267297d98595c1a',1,'nc::round(const NdArray&lt; dtype &gt; &amp;inArray, uint8 inDecimals=0) noexcept']]], ['row',['row',['../classnc_1_1image_processing_1_1_pixel.html#a14a430dd867f89a9eb6e112a7a5ce567',1,'nc::imageProcessing::Pixel::row()'],['../classnc_1_1image_processing_1_1_centroid.html#aa3546b7b2430b51650f40fb344ab55a8',1,'nc::imageProcessing::Centroid::row()'],['../classnc_1_1_nd_array.html#a72747c61318537694bf9a7a594075c78',1,'nc::NdArray::row()'],['../namespacenc.html#a5edb9ac6f596ae1256faa3f5d797dc84a54c1ed33c810f895d48c008d89f880b7',1,'nc::ROW()']]], ['row_5fstack',['row_stack',['../namespacenc.html#a4d53bca44b0a1ec255de0bc72d048bf2',1,'nc']]], ['rowmax',['rowMax',['../classnc_1_1image_processing_1_1_cluster.html#a58eea870dca4a5c61cfd4db24ea50267',1,'nc::imageProcessing::Cluster']]], ['rowmin',['rowMin',['../classnc_1_1image_processing_1_1_cluster.html#ac3f0c485f193a71a6caca9f553970383',1,'nc::imageProcessing::Cluster']]], ['rows',['rows',['../classnc_1_1_shape.html#a6f89f699dea6eb89eef19e00c92b223a',1,'nc::Shape']]], ['rslice',['rSlice',['../classnc_1_1_nd_array.html#aea1061c8c6954ca960412a7f4b323405',1,'nc::NdArray']]] ];
214.825
816
0.766903
b504e281d8827c870fff9816696e799badc5c877
351
js
JavaScript
client/src/views/styles/MediatoSearchBox.js
rogercp/BravFrontEndDeploy
2f00a42d98f011338e7b1287b17a046ce2aa9fed
[ "MIT" ]
2
2019-08-24T18:46:42.000Z
2020-01-29T05:31:18.000Z
client/src/views/styles/MediatoSearchBox.js
rogercp/Frontend
78670f0896da43ef6d538f753d6c6fdee247052f
[ "MIT" ]
17
2019-07-12T20:48:43.000Z
2022-02-26T15:11:13.000Z
client/src/views/styles/MediatoSearchBox.js
rogercp/Frontend
78670f0896da43ef6d538f753d6c6fdee247052f
[ "MIT" ]
5
2019-09-11T20:34:40.000Z
2019-09-13T20:51:42.000Z
// /** // * Dependencies // */ // import { styled } from '@material-ui/styles'; // /** // * Define style // */ // const MediatorSearchBox=styled('div')({ // paddingTop:"10%", // display:"flex", // justifyContent:"space around", // alignItems:"center" // }); // /** // * Export style // */ // export default MediatorSearchBox;
16.714286
48
0.54416
b514e36c10763bf36b6335d00dcdf2bac0d1b389
682
js
JavaScript
src/server/db/queries/products.js
jeneser/smart-pos-api
2143724420ac85bbd4ec7196c051e2c9a8d5c18e
[ "MIT" ]
1
2020-02-12T23:12:09.000Z
2020-02-12T23:12:09.000Z
src/server/db/queries/products.js
jeneser/smart-pos-api
2143724420ac85bbd4ec7196c051e2c9a8d5c18e
[ "MIT" ]
6
2020-07-17T00:13:38.000Z
2022-03-08T22:45:10.000Z
src/server/db/queries/products.js
jeneser/smart-pos-api
2143724420ac85bbd4ec7196c051e2c9a8d5c18e
[ "MIT" ]
null
null
null
const knex = require('../connection'); function getAllProducts() { return knex('products').select('*'); } function getSingleProduct(id) { return knex('products') .select('*') .where({ itemId: id }); } function addProduct(movie) { return knex('products') .insert(movie) .returning('*'); } function updateProduct(id, movie) { return knex('products') .update(movie) .where({ id: parseInt(id) }) .returning('*'); } function deleteProduct(id) { return knex('products') .del() .where({ id: parseInt(id) }) .returning('*'); } module.exports = { getAllProducts, getSingleProduct, addProduct, updateProduct, deleteProduct };
17.05
38
0.627566
b51ab4e95bed284c735acc8df2d4197013afcf7b
1,761
js
JavaScript
hwdisk/hwdisk.js
molda/flow-components
579e476f041b7beeef7d7e26c1a75fe592b9ad43
[ "MIT" ]
4
2019-02-03T18:18:07.000Z
2020-02-17T03:19:28.000Z
hwdisk/hwdisk.js
molda/flow-components
579e476f041b7beeef7d7e26c1a75fe592b9ad43
[ "MIT" ]
null
null
null
hwdisk/hwdisk.js
molda/flow-components
579e476f041b7beeef7d7e26c1a75fe592b9ad43
[ "MIT" ]
null
null
null
exports.id = 'hwdisk'; exports.title = 'Disk'; exports.version = '1.0.0'; exports.author = 'Martin Smola'; exports.group = 'Hardware monitor'; exports.color = '#F6BB42'; exports.input = 1; exports.output = 1; exports.icon = 'hdd-o'; exports.options = { path: '/' }; exports.readme = `# Disk monitoring This component monitors disk \`bytes\` consumption in Linux systems. It uses \`df\` command. __Data Example__: \`\`\`javascript { total: 474549649408, used: 39125245952, free: 411294994432 } \`\`\``; exports.html = `<div class="padding"> <div class="row"> <div class="col-md-3 m"> <div data---="textbox__path__placeholder:/;required:true">@(Path)</div> </div> </div> </div>`; exports.install = function(instance) { var current = { total: 0, used: 0, free: 0, path: '', type: '', percentUsed: 0 }; function run(callback) { require('child_process').exec('df -hTB1 ' + instance.options.path, function(err, response) { if (err) { instance.error(err); return; } response.parseTerminal(function(line) { if (line[0][0] !== '/') return; current.total = line[2].parseInt(); current.free = line[4].parseInt(); current.used = line[3].parseInt(); current.path = instance.options.path || '/'; current.type = line[1]; current.percentUsed = Math.round(current.used / (current.total / 100)); current.percentFree = Math.round(current.free / (current.total / 100)); current.percentUnavailable = Math.abs(current.percentUsed + current.percentFree - 100); callback(); }); }); }; instance.on('data', function(flowdata, next){ run(function(){ flowdata.data = current; next(flowdata); instance.status(current.free.filesize() + ' / ' + current.total.filesize()); }); }); };
25.521739
94
0.641681
b5091bb45fb8fde77000410501297d4b0a325ab3
4,223
js
JavaScript
demo/detectBrowser.js
wgkoro/detectbrowser
10aa773f432bc317ab7bab0d84f62ec7e0a07a5b
[ "MIT" ]
5
2015-01-02T11:42:53.000Z
2020-03-04T06:41:00.000Z
src/detectBrowser.js
wgkoro/detectbrowser
10aa773f432bc317ab7bab0d84f62ec7e0a07a5b
[ "MIT" ]
null
null
null
src/detectBrowser.js
wgkoro/detectbrowser
10aa773f432bc317ab7bab0d84f62ec7e0a07a5b
[ "MIT" ]
null
null
null
/** * detectBrowser.js * Version: 1.0.1 * * A tool discern browser and device user using. * * This detects * - device (PC / Android / iPhone / iPad / Windows Phone) * - tablet or not * - browser (InternetExplorer, Firefox, Chrome, Safari, Opera) * - browser version (IE only) * * Copyright (c) 2013 wgkoro ( http://zafiel.wingall.com/ ) * * Released under MIT license: * http://www.opensource.org/licenses/mit-license.php * **/ (function($){ var methods = { ua : null, cache : null, device_pattern : ['iphone', 'ipad', 'android', 'windows phone'], browser_pattern : ['firefox', 'opera', 'chrome', 'safari', 'msie', 'mozilla'], tablet_pattern : [], result : { mobile : null, is_tablet : false, browser : null, ie_version : null }, // for test setUa : function(ua_str){ this.ua = ua_str.toLowerCase(); }, addDevicePattern : function(pattern){ if(! pattern){return} this.device_pattern.push(pattern); this.cache = null; }, addTabletPattern : function(pattern){ if(! pattern){return} this.tablet_pattern.push(pattern); this.cache = null; }, detect : function(){ if(this.cache){return this.cache} if(! this.ua){ this.ua = navigator.userAgent.toLowerCase(); } if(this.isMobile()){ return this.returnObj(); } var ie_version = this.isIE(); if(ie_version){ this.result.browser = 'ie'; this.result.ie_version = ie_version; return this.returnObj(); } this.result.browser = this.whichBrowser(); return this.returnObj(); }, returnObj : function(){ this.result.ua = navigator.userAgent; this.cache = this.result; return this.cache; }, isMobile : function(){ var reg = new RegExp(this.device_pattern.join('|'), 'i'); var result = this.ua.match(reg); if(! result){return false} var device = result[0]; this.result.mobile = device; this.result.browser = this.whichBrowser(); if(device == 'ipad'){ this.result.is_tablet = true; } if(device == 'android' && this.isAndroidTablet()){ this.result.is_tablet = true; } return true; }, /** * CAUTION: This method cannot detect few Android tablets(Android2.x). * http://blog.flexfirm.jp/mysta/545/ * http://googlewebmastercentral-ja.blogspot.jp/2012/11/giving-tablet-users-full-sized-web.html **/ isAndroidTablet : function(){ if(this.checkTabletPattern()){ return true; } if(! this.ua.match('mobile')){ return true; } return false; }, checkTabletPattern : function(){ var len = this.tablet_pattern.length; if(! len){return false} for(var i=0;i<len;i++){ var reg = new RegExp(this.tablet_pattern[i], 'i'); if(this.ua.match(reg)){ return true; } } return false; }, isIE : function(){ if(window.ActiveXObject){ // IE8 〜 if(document.documentMode){ return document.documentMode; } if(typeof document.documentElement.style.maxHeight == 'undefined'){return 6} if(typeof document.querySelectorAll == 'undefined'){return 7} return 6; } // IE11 doesn't have window.ActiveXObject, but it has document.documentMode. if(document.documentMode){ return document.documentMode; } return false; }, whichBrowser : function(){ var len = this.browser_pattern.length for(var i=0;i<len;i++){ var pattern = this.browser_pattern[i]; if(this.ua.match(pattern)){ return pattern.replace('ms', ''); // Remove strings 'ms' from 'msie' } } return 'unknown'; } }; $.detectBrowser = { isIE : function(){ return methods.isIE(); }, addTabletPattern : function(pattern_str){ methods.addTabletPattern(pattern_str); }, addDevicePattern : function(pattern_str){ methods.addDevicePattern(pattern_str); }, detect : function(){ var result = methods.detect(); return result; }, mobile : function(){ return this.detect().mobile; }, isTablet : function(){ return this.detect().is_tablet; }, browser : function(){ return this.detect().browser; }, ieVersion : function(){ return this.detect().ie_version; }, ua : function(){ return this.detect().ua; } }; })(jQuery);
20.6
97
0.6287
6ff41dff10834a8b979e092e94aabfe33decce76
10,284
js
JavaScript
node_modules/mathjs/test/function/relational/compareNatural.test.js
lydiaxing/snail-motion-profiles2
d219537072be30dad14be3227ee4ca8780e05d72
[ "MIT" ]
25
2018-03-28T10:17:20.000Z
2020-03-20T03:28:34.000Z
node_modules/mathjs/test/function/relational/compareNatural.test.js
Alekcy/vacancy-analysis
0938e90db8827ac33036996b8492df4ebce0ad0c
[ "MIT" ]
2
2018-03-29T04:13:06.000Z
2018-03-29T09:02:05.000Z
node_modules/mathjs/test/function/relational/compareNatural.test.js
Alekcy/vacancy-analysis
0938e90db8827ac33036996b8492df4ebce0ad0c
[ "MIT" ]
11
2018-03-28T10:47:44.000Z
2019-08-31T04:16:39.000Z
// test compareNatural var assert = require('assert'); var math = require('../../../index'); var bignumber = math.bignumber; var complex = math.complex; var matrix = math.matrix; var sparse = math.sparse; var unit = math.unit; var compareNatural = math.compareNatural; describe('compareNatural', function() { it('should compare two numbers correctly', function() { assert.equal(compareNatural(2, 3), -1); assert.equal(compareNatural(2, 2), 0); assert.equal(compareNatural(2, 1), 1); assert.equal(compareNatural(0, 0), 0); assert.equal(compareNatural(-2, 2), -1); assert.equal(compareNatural(-2, -3), 1); assert.equal(compareNatural(-3, -2), -1); }); it('should compare two floating point numbers correctly', function() { // Infinity assert.equal(compareNatural(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY), 0); assert.equal(compareNatural(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY), 0); assert.equal(compareNatural(Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY), 1); assert.equal(compareNatural(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY), -1); assert.equal(compareNatural(Number.POSITIVE_INFINITY, 2.0), 1); assert.equal(compareNatural(2.0, Number.POSITIVE_INFINITY), -1); assert.equal(compareNatural(Number.NEGATIVE_INFINITY, 2.0), -1); assert.equal(compareNatural(2.0, Number.NEGATIVE_INFINITY), 1); // floating point numbers assert.equal(compareNatural(0.3 - 0.2, 0.1), 0); }); it('should compare two booleans', function() { assert.equal(compareNatural(true, true), 0); assert.equal(compareNatural(true, false), 1); assert.equal(compareNatural(false, true), -1); assert.equal(compareNatural(false, false), 0); }); it('should compare bignumbers', function() { assert.strictEqual(compareNatural(bignumber(2), bignumber(3)), -1); assert.strictEqual(compareNatural(bignumber(2), bignumber(2)), 0); assert.strictEqual(compareNatural(bignumber(3), bignumber(2)), 1); assert.strictEqual(compareNatural(bignumber(0), bignumber(0)), 0); assert.strictEqual(compareNatural(bignumber(-2), bignumber(2)), -1); assert.equal(typeof compareNatural(bignumber(-2), bignumber(2)), 'number'); }); it('should compare two fractions', function() { var a = math.fraction(1,3); var b = math.fraction(1,6); assert.equal(typeof compareNatural(a, b), 'number'); assert.equal(a.toString(), '0.(3)'); assert.equal(b.toString(), '0.1(6)'); assert.equal(compareNatural(math.fraction(3), math.fraction(2)).valueOf(), 1); assert.equal(compareNatural(math.fraction(2), math.fraction(3)).valueOf(), -1); assert.equal(compareNatural(math.fraction(3), math.fraction(3)).valueOf(), 0); assert.strictEqual(compareNatural(math.add(math.fraction(0.1), math.fraction(0.2)), math.fraction(0.3)).valueOf(), 0); // this would fail with numbers }); it('should compare two measures of the same unit', function() { assert.strictEqual(compareNatural(unit('100cm'), unit('10inch')), 1); assert.strictEqual(compareNatural(unit('99cm'), unit('1m')), -1); assert.strictEqual(compareNatural(unit('1m'), unit('1m')), 0); assert.strictEqual(compareNatural(unit('1m'), unit('100 cm')), 0); assert.strictEqual(compareNatural(unit('101cm'), unit('1m')), 1); }); it('should compare two measures of different unit', function() { assert.strictEqual(compareNatural(math.unit(5, 'km'), math.unit(100, 'gram')), 1); assert.strictEqual(compareNatural(math.unit(4, 'km/h'), math.unit(2, 'm/s^2')), -1); assert.strictEqual(compareNatural(math.unit(2, 'm/s^2'), math.unit(4, 'km/h')), 1); }); it('should compare mixed types (by type name)', function() { // booleans assert.strictEqual (compareNatural(2, true), 1); assert.strictEqual (compareNatural(0, false), 1); assert.strictEqual (compareNatural(true, 2), -1); assert.strictEqual (compareNatural(false, 2), -1); // null assert.strictEqual (compareNatural(2, null), 1); assert.strictEqual (compareNatural(null, 2), -1); // undefined assert.strictEqual (compareNatural(2, undefined), -1); assert.strictEqual (compareNatural(undefined, 2), 1); // fractions and units assert.strictEqual (compareNatural(1, math.fraction(1,3)), 1); assert.strictEqual (compareNatural(math.fraction(1,3), 1), -1); assert.strictEqual (compareNatural(1, math.fraction(1)), 1); assert.strictEqual (compareNatural(math.fraction(1), 1), -1); // units and numbers assert.strictEqual (compareNatural(unit('100cm'), 22), -1); assert.strictEqual (compareNatural(22, unit('100cm')), 1); // units and bignumbers assert.strictEqual (compareNatural(unit('100cm'), bignumber(22)), 1); assert.strictEqual (compareNatural(bignumber(22), unit('100cm')), -1); // numbers and complex assert.strictEqual (compareNatural(1, complex(2,3)), 1); assert.strictEqual (compareNatural(complex(2,3), 1), -1); // numbers and bignumbers assert.strictEqual (compareNatural(bignumber(2), 3), -1); assert.strictEqual (compareNatural(3, bignumber(2)), 1); assert.strictEqual (compareNatural(bignumber(2), 2), -1); assert.strictEqual (compareNatural(2, bignumber(2)), 1); // array, DenseMatrix, SparseMatrix assert.strictEqual (compareNatural([2], matrix([2])), -1); assert.strictEqual (compareNatural(matrix([2]), [2]), 1); assert.strictEqual (compareNatural(sparse([2]), [2]), -1); assert.strictEqual (compareNatural([2], sparse([2])), 1); assert.strictEqual (compareNatural(sparse([2]), matrix([2])), -1); assert.strictEqual (compareNatural(matrix([2]), sparse([2])), 1); // string and number assert.strictEqual (compareNatural('0', 0), 1); }); it('should perform natural comparison for two strings', function() { assert.strictEqual(compareNatural('abd', 'abc'), 1); assert.strictEqual(compareNatural('abc', 'abc'), 0); assert.strictEqual(compareNatural('abc', 'abd'), -1); // natural sorting of strings assert.strictEqual(compareNatural('10', '2'), 1); }); it('should compare arrays', function () { // mixed number/array assert.strictEqual(compareNatural(5, [1,2,3]), 1); assert.strictEqual(compareNatural([1,2,3], 5), -1); // same size assert.strictEqual(compareNatural([1,2,4], [1,2,3]), 1); // unequal size assert.strictEqual(compareNatural([1,2,3,4], [1,2,3]), 1); assert.strictEqual(compareNatural([1,2,3], [1,2,3,4]), -1); assert.strictEqual(compareNatural([1,4], [1,2,3]), 1); // unequal dimensions assert.strictEqual(compareNatural([[2]], [1]), 1); // multiple dimensions assert.strictEqual(compareNatural([[2,3]], [[2,4]]), -1); assert.strictEqual(compareNatural([[2,3], [5,6]], [[2,3], [5,6]]), 0); }); it('should compare dense matrices', function () { // mixed number/matrix assert.strictEqual(compareNatural(5, matrix([1,2,3])), 1); assert.strictEqual(compareNatural(matrix([1,2,3]), 5), -1); // same size assert.strictEqual(compareNatural(matrix([1,2,4]), matrix([1,2,3])), 1); // unequal size assert.strictEqual(compareNatural(matrix([1,2,3,4]), matrix([1,2,3])), 1); assert.strictEqual(compareNatural(matrix([1,2,3]), matrix([1,2,3,4])), -1); assert.strictEqual(compareNatural(matrix([1,4]), matrix([1,2,3])), 1); // unequal dimensions assert.strictEqual(compareNatural(matrix([[2]]), matrix([1])), 1); // multiple dimensions assert.strictEqual(compareNatural(matrix([[2,3]]), matrix([[2,4]])), -1); assert.strictEqual(compareNatural(matrix([[2,3], [5,6]]), matrix([[2,3], [5,6]])), 0); }); it('should compare sparse matrices', function () { // mixed number/sparse assert.strictEqual(compareNatural(5, sparse([1,2,3])), 1); assert.strictEqual(compareNatural(sparse([1,2,3]), 5), -1); // same size assert.strictEqual(compareNatural(sparse([1,2,4]), sparse([1,2,3])), 1); // unequal size assert.strictEqual(compareNatural(sparse([1,2,3,4]), sparse([1,2,3])), 1); assert.strictEqual(compareNatural(sparse([1,2,3]), sparse([1,2,3,4])), -1); assert.strictEqual(compareNatural(sparse([1,4]), sparse([1,2,3])), 1); // unequal dimensions assert.strictEqual(compareNatural(sparse([[2]]), sparse([1])), 1); // multiple dimensions assert.strictEqual(compareNatural(sparse([[2,3]]), sparse([[2,4]])), -1); assert.strictEqual(compareNatural(sparse([[2,3], [5,6]]), sparse([[2,3], [5,6]])), 0); }); it('should compare objects', function () { // different number of keys assert.strictEqual(compareNatural({a:2, b:3}, {a:2}), 1); // different keys assert.strictEqual(compareNatural({b:3}, {a:2}), 1); // different values assert.strictEqual(compareNatural({a:3}, {a:2}), 1); // equal assert.strictEqual(compareNatural({a:2, b:3}, {a:2, b:3}), 0); // nesting assert.strictEqual(compareNatural({a:2, b: {c: 4}}, {a:2, b: {c: 3}}), 1); assert.strictEqual(compareNatural({a:2, b: {c: 3}}, {a:2, b: {c: 4}}), -1); }); it('should apply configuration option epsilon', function() { var mymath = math.create(); assert.equal(mymath.compareNatural(1, 0.991), 1); assert.equal(mymath.compareNatural(math.bignumber(1), math.bignumber(0.991)).valueOf(), 1); mymath.config({epsilon: 1e-2}); assert.equal(mymath.compareNatural(1, 0.991), 0); assert.equal(mymath.compareNatural(math.bignumber(1), math.bignumber(0.991)), 0); }); it('should compare complex numbers', function() { assert.equal(compareNatural(complex(1,1), complex(1,1)), 0); assert.equal(compareNatural(complex(2,1), complex(1,2)), 1); assert.equal(compareNatural(complex(0,1), complex(1,2)), -1); }); it('should throw an error in case of invalid number of arguments', function() { assert.throws(function () {compareNatural(1);}, /TypeError: Too few arguments/); assert.throws(function () {compareNatural(1, 2, 3);}, /TypeError: Too many arguments/); }); it('should LaTeX compare', function () { var expression = math.parse('compareNatural(1,2)'); assert.equal(expression.toTex(), '\\mathrm{compareNatural}\\left(1,2\\right)'); }); });
41.301205
154
0.65986
b510e7e5e8510f8ab5141012441c9184a3264768
423
js
JavaScript
components/Header.js
mdheller/reddigg
9d5f2433285d0ca611fd79a1fc127cba7f312e04
[ "MIT" ]
1
2020-06-23T07:49:38.000Z
2020-06-23T07:49:38.000Z
components/Header.js
mdheller/reddigg
9d5f2433285d0ca611fd79a1fc127cba7f312e04
[ "MIT" ]
null
null
null
components/Header.js
mdheller/reddigg
9d5f2433285d0ca611fd79a1fc127cba7f312e04
[ "MIT" ]
null
null
null
import { Button, Jumbotron } from 'react-bootstrap'; import FontAwesome from 'react-fontawesome'; export default () => ( <div> <Jumbotron> <h1>Reddigg</h1> <p>A Reddit/Digg clone by @indocomsoft, hence the portmanteau name!</p> <a href="https://github.com/indocomsoft/reddigg"> <Button bsStyle="primary"><FontAwesome name="github" /> GitHub</Button> </a> </Jumbotron> </div> );
28.2
79
0.635934
b5136523d1fd00702ec07ac9011158f7a5066177
23
js
JavaScript
examples/simple/src/javascripts/pathSplit-foo.js
aokiken/gulp-pug-template-underscore
7367a20e4a9c8e765b5e1d9224417bd61b039795
[ "MIT" ]
1
2020-07-23T13:05:28.000Z
2020-07-23T13:05:28.000Z
examples/simple/src/javascripts/pathSplit-foo.js
aokiken/gulp-pug-template-underscore
7367a20e4a9c8e765b5e1d9224417bd61b039795
[ "MIT" ]
10
2016-08-17T22:55:04.000Z
2019-09-18T03:27:27.000Z
examples/simple/src/javascripts/pathSplit-foo.js
aokiken/gulp-pug-template-underscore
7367a20e4a9c8e765b5e1d9224417bd61b039795
[ "MIT" ]
null
null
null
_.template('nest/foo');
23
23
0.695652
6ff4e0c73bdd9e21e9c8a3e4682cdbda183f86c7
1,817
js
JavaScript
src/main/resources/static/js/userCreation.js
CarolineS-QA/hwa-game-time-log
e3b0c38b402364d5e2b040f49fb181b16b0f0884
[ "MIT" ]
1
2020-10-16T11:10:27.000Z
2020-10-16T11:10:27.000Z
src/main/resources/static/js/userCreation.js
CarolineS-QA/hwa-game-time-log
e3b0c38b402364d5e2b040f49fb181b16b0f0884
[ "MIT" ]
74
2020-05-06T11:42:03.000Z
2020-08-04T15:05:53.000Z
src/main/resources/static/js/userCreation.js
CarolineS-QA/hwa-game-time-log
e3b0c38b402364d5e2b040f49fb181b16b0f0884
[ "MIT" ]
1
2020-06-11T10:11:50.000Z
2020-06-11T10:11:50.000Z
let submitCreateUser = document.querySelector("#bSubmit"); const REQ = new XMLHttpRequest(); function postNewUser() { let username = document.getElementById("username").value; let freeTimeHours = document.getElementById("freeTimeHours").valueAsNumber; let freeTimeMinutes = document.getElementById("freeTimeMinutes").valueAsNumber; let freeTime = Number(freeTimeMinutes) + (Number(freeTimeHours) * 60); let jsonString = JSON.stringify( { "username": username, "totalTimePlayed": 0, "freeTime": freeTime, "timeRemaining": freeTime }); REQ.open('POST', '/createUser'); REQ.setRequestHeader('Content-Type', 'Application/json'); REQ.setRequestHeader('Access-Control-Allow-Origin', '*'); REQ.onload = () => { if (REQ.status === 201 && REQ.readyState === 4) { console.log(REQ); console.log(REQ.response); console.log("The data has been sent."); console.log(jsonString); window.alert("A User has been created!") window.location.replace("./Users.html"); } else { console.log(REQ); console.log(REQ.response); console.log(`Oh no! You should handle the Error(s)!`); window.alert("Oops! Something went wrong...") console.log(freeTime); console.log(freeTime.data_type); console.log("You tried to end the following JSON"); console.log(jsonString); } } REQ.send(jsonString); } submitCreateUser.addEventListener('click', function (event){ event.preventDefault(); postNewUser(); // let form = document.getElementById("userDetails"); // let section = document.getElementsByTagName("section"); // section.removeChild(form); })
35.627451
83
0.617501
6fea4761c121433045a5dbddfe47a9762424b211
132
js
JavaScript
doc/html/search/functions_6d.js
DimitrisVlachos/INTEL-AYC-2013SUMMER--2ND-PLACE-SOLUTION
94a0a4ad8b423c081061515f334e932fa9206f57
[ "MIT" ]
1
2020-12-07T19:42:38.000Z
2020-12-07T19:42:38.000Z
doc/html/search/functions_6d.js
DimitrisVlachos/INTEL-AYC-2013SUMMER--2ND-PLACE-SOLUTION
94a0a4ad8b423c081061515f334e932fa9206f57
[ "MIT" ]
null
null
null
doc/html/search/functions_6d.js
DimitrisVlachos/INTEL-AYC-2013SUMMER--2ND-PLACE-SOLUTION
94a0a4ad8b423c081061515f334e932fa9206f57
[ "MIT" ]
1
2020-12-07T19:42:41.000Z
2020-12-07T19:42:41.000Z
var searchData= [ ['match_5ftemplate',['match_template',['../main_8cpp.html#a02f38ff47a6797124d1f6f09573d9ad3',1,'main.cpp']]] ];
26.4
110
0.734848
6ff59c4f622e7b45cf7cf52c6da9528f45398b49
338
js
JavaScript
app/src/components/Navbar/tests/index.test.js
RyanCCollins/code-review-app
c447cd43e0d0392e9975636888350f8d76af0178
[ "MIT" ]
23
2016-10-08T08:44:11.000Z
2021-02-04T22:17:57.000Z
app/src/components/Navbar/tests/index.test.js
RyanCCollins/code-review-app
c447cd43e0d0392e9975636888350f8d76af0178
[ "MIT" ]
5
2020-06-25T09:47:16.000Z
2022-02-26T07:05:50.000Z
app/src/components/Navbar/tests/index.test.js
RyanCCollins/code-review-app
c447cd43e0d0392e9975636888350f8d76af0178
[ "MIT" ]
9
2016-10-14T19:37:52.000Z
2021-07-06T05:16:46.000Z
import { shallow } from 'enzyme'; import React from 'react'; import { shallowToJson } from 'enzyme-to-json'; import Navbar from '../index'; describe('<Navbar />', () => { it('should render with default props', () => { const wrapper = shallow( <Navbar /> ); expect(shallowToJson(wrapper)).toMatchSnapshot(); }); });
24.142857
53
0.618343
6ff5a1360f1fb8987d9b6c17a9296dfb6c835152
12,683
js
JavaScript
test/test-objects.js
telnetbot-com/rivescript-js
441f6e13918b4ff33b3e8881133c32304a6ed615
[ "MIT" ]
2
2021-03-18T17:02:44.000Z
2021-04-15T10:51:30.000Z
test/test-objects.js
telnetbot-com/rivescript-js
441f6e13918b4ff33b3e8881133c32304a6ed615
[ "MIT" ]
null
null
null
test/test-objects.js
telnetbot-com/rivescript-js
441f6e13918b4ff33b3e8881133c32304a6ed615
[ "MIT" ]
null
null
null
var TestCase = require("./test-base"); //############################################################################### // Object Macro Tests //############################################################################### exports.test_js_objects = async function(test) { var bot; bot = new TestCase(test, ` > object nolang return "Test w/o language." < object > object wlang javascript return "Test w/ language." < object > object reverse javascript var msg = args.join(" "); return msg.split("").reverse().join(""); < object > object broken javascript return "syntax error < object > object foreign perl return "Perl checking in!" < object + test nolang - Nolang: <call>nolang</call> + test wlang - Wlang: <call>wlang</call> + reverse * - <call>reverse <star></call> + test broken - Broken: <call>broken</call> + test fake - Fake: <call>fake</call> + test perl - Perl: <call>foreign</call> `); await bot.reply("Test nolang", "Nolang: Test w/o language."); await bot.reply("Test wlang", "Wlang: Test w/ language."); await bot.reply("Reverse hello world.", "dlrow olleh"); await bot.reply("Test broken", "Broken: [ERR: Object Not Found]"); await bot.reply("Test fake", "Fake: [ERR: Object Not Found]"); await bot.reply("Test perl", "Perl: [ERR: Object Not Found]"); return test.done(); }; exports.test_disabled_js_language = async function(test) { var bot; bot = new TestCase(test, ` > object test javascript return 'JavaScript here!' < object + test - Result: <call>test</call> `); await bot.reply("test", "Result: JavaScript here!"); bot.rs.setHandler("javascript", void 0); await bot.reply("test", "Result: [ERR: No Object Handler]"); return test.done(); }; exports.test_get_variable = async function(test) { var bot; bot = new TestCase(test, ` ! var test_var = test > object test_get_var javascript var name = "test_var"; return rs.getVariable(name); < object + show me var - <call> test_get_var </call> `); await bot.reply("show me var", "test"); return test.done(); }; exports.test_uppercase_call = async function(test) { var bot; bot = new TestCase(test, ` > begin + request * <bot mood> == happy => {sentence}{ok}{/sentence} * <bot mood> == angry => {uppercase}{ok}{/uppercase} * <bot mood> == sad => {lowercase}{ok}{/lowercase} - {ok} < begin > object test javascript return "The object result."; < object // Not much we can do about this part right now... when uppercasing the // whole reply the name of the macro is also uppercased. *shrug* > object TEST javascript return "The object result."; < object + * - Hello there. <call>test <star></call> `); await bot.reply("hello", "Hello there. The object result."); bot.rs.setVariable("mood", "happy"); await bot.reply("hello", "Hello there. The object result."); bot.rs.setVariable("mood", "angry"); await bot.reply("hello", "HELLO THERE. THE OBJECT RESULT."); bot.rs.setVariable("mood", "sad"); await bot.reply("hello", "hello there. the object result."); return test.done(); }; exports.test_objects_in_conditions = async function(test) { var bot; bot = new TestCase(test, ` // Normal synchronous object that returns an immediate response. > object test_condition javascript return args[0] === "1" ? "true" : "false"; < object // Asynchronous object that returns a promise. This isn't supported // in a conditional due to the immediate/urgent nature of the result. > object test_async_condition javascript return new Promise(function(resolve, reject) { setTimeout(function() { resolve(args[0] === "1" ? "true" : "false"); }, 10); }); < object + test sync * * <call>test_condition <star></call> == true => True. * <call>test_condition <star></call> == false => False. - Call failed. + test async * * <call>test_async_condition <star></call> == true => True. * <call>test_async_condition <star></call> == false => False. - Call failed. + call sync * - Result: <call>test_condition <star></call> + call async * - Result: <call>test_async_condition <star></call> `); // First, make sure the sync object works. await bot.reply("call sync 1", "Result: true"); await bot.reply("call sync 0", "Result: false"); await bot.reply("call async 1", "Result: true"); // Test the synchronous object in a conditional. await bot.reply("test sync 1", "True."); await bot.reply("test sync 2", "False."); await bot.reply("test sync 0", "False."); await bot.reply("test sync x", "False."); // Test the async object on its own and then in a conditional. This code looks // ugly, but `test.done()` must be called only when all tests have resolved // so we have to nest a couple of the promise-based tests this way. return bot.rs.reply(bot.username, "call async 1").then(function(reply) { test.equal(reply, "Result: true"); return bot.rs.reply(bot.username, "test async 1").then(function(reply) { test.equal(reply, "True."); return test.done(); }); }); }; exports.test_line_breaks_in_call = async function(test) { var bot; bot = new TestCase(test, ` > object macro javascript var a = args.join(" "); return a; < object // Variables with newlines aren't expected to interpolate, because // tag processing only happens in one phase. ! var name = name with\\nnew line + test literal newline - <call>macro "argumentwith\\nnewline"</call> + test botvar newline - <call>macro "<bot name>"</call> `); await bot.reply("test literal newline", "argumentwith\nnewline"); await bot.reply("test botvar newline", "name with\\nnew line"); return test.done(); }; exports.test_js_string_in_setSubroutine = async function(test) { var bot, input; bot = new TestCase(test, ` + hello - hello <call>helper <star></call> `); input = "hello there"; bot.rs.setSubroutine("helper", ["return 'person';"]); await bot.reply("hello", "hello person"); return test.done(); }; exports.test_function_in_setSubroutine = async function(test) { var bot, input; bot = new TestCase(test, ` + my name is * - hello person<call>helper <star></call> `); input = "my name is Rive"; bot.rs.setSubroutine("helper", function(rs, args) { test.equal(rs, bot.rs); test.equal(args.length, 1); test.equal(args[0], "rive"); return test.done(); }); return (await bot.reply(input, "hello person")); }; exports.test_function_in_setSubroutine_return_value = async function(test) { var bot; bot = new TestCase(test, ` + hello - hello <call>helper <star></call> `); bot.rs.setSubroutine("helper", function(rs, args) { return "person"; }); await bot.reply("hello", "hello person"); return test.done(); }; exports.test_arguments_in_setSubroutine = async function(test) { var bot; bot = new TestCase(test, ` + my name is * - hello <call>helper "<star>" 12</call> `); bot.rs.setSubroutine("helper", function(rs, args) { test.equal(args.length, 2); test.equal(args[0], "thomas edison"); test.equal(args[1], "12"); return args[0]; }); await bot.reply("my name is thomas edison", "hello thomas edison"); return test.done(); }; exports.test_quoted_strings_arguments_in_setSubroutine = async function(test) { var bot; bot = new TestCase(test, ` + my name is * - hello <call>helper "<star>" 12 "another param"</call> `); bot.rs.setSubroutine("helper", function(rs, args) { test.equal(args.length, 3); test.equal(args[0], "thomas edison"); test.equal(args[1], "12"); test.equal(args[2], "another param"); return args[0]; }); await bot.reply("my name is thomas edison", "hello thomas edison"); return test.done(); }; exports.test_arguments_with_funky_spacing_in_setSubroutine = async function(test) { var bot; bot = new TestCase(test, ` + my name is * - hello <call> helper "<star>" 12 "another param" </call> `); bot.rs.setSubroutine("helper", function(rs, args) { test.equal(args.length, 3); test.equal(args[0], "thomas edison"); test.equal(args[1], "12"); test.equal(args[2], "another param"); return args[0]; }); await bot.reply("my name is thomas edison", "hello thomas edison"); return test.done(); }; exports.test_promises_in_objects = function(test) { var bot, input; bot = new TestCase(test, ` + my name is * - hello there <call>helperWithPromise <star></call> with a <call>anotherHelperWithPromise</call> `); input = "my name is Rive"; bot.rs.setSubroutine("helperWithPromise", function(rs, args) { return new rs.Promise(function(resolve, reject) { return resolve("stranger"); }); }); bot.rs.setSubroutine("anotherHelperWithPromise", function(rs) { return new rs.Promise(function(resolve, reject) { return setTimeout(function() { return resolve("delay"); }, 10); }); }); return bot.rs.reply(bot.username, input).then(function(reply) { test.equal(reply, "hello there stranger with a delay"); return test.done(); }); }; exports.test_use_reply_with_async_subroutines = async function(test) { var bot; bot = new TestCase(test, ` + my name is * - hello there <call>asyncHelper</call> `); bot.rs.setSubroutine("asyncHelper", function(rs, args) { return new rs.Promise(function(resolve, reject) { return resolve("stranger"); }); }); await bot.reply("my name is Rive", "hello there stranger"); return test.done(); }; exports.test_async_and_sync_subroutines_together = function(test) { var bot; bot = new TestCase(test, ` + my name is * - hello there <call>asyncHelper</call><call>exclaim</call> `); bot.rs.setSubroutine("exclaim", function(rs, args) { return "!"; }); bot.rs.setSubroutine("asyncHelper", function(rs, args) { return new rs.Promise(function(resolve, reject) { return resolve("stranger"); }); }); return bot.rs.reply(bot.username, "my name is Rive").then(function(reply) { test.equal(reply, "hello there stranger!"); return test.done(); }); }; exports.test_stringify_with_objects = function(test) { var bot, expect, src; bot = new TestCase(test, ` > object hello javascript return "Hello"; < object + my name is * - hello there<call>exclaim</call> ^ and i like continues `); bot.rs.setSubroutine("exclaim", function(rs) { return "!"; }); src = bot.rs.stringify(); expect = `! version = 2.0 ! local concat = none > object hello javascript \treturn "Hello"; < object > object exclaim javascript \treturn "!"; < object + my name is * - hello there<call>exclaim</call>and i like continues `; test.equal(src, expect); return test.done(); }; exports.test_await_macro = async function(test) { // In RiveScript 2.0.0, macros parsed from RiveScript code are loaded as // async functions, allowing them to use the await keyword. // Test if we have async support in our local JS environment, or else skip // this test. try { eval("(async function() {})"); } catch(e) { console.log("skip test_await_macro: local JS environment doesn't support async/await"); return test.done(); } var bot = new TestCase(test, ` > object awaitable javascript var user = rs.currentUser(); var name = await rs.getUservar(user, "name"); var count = await rs.getUservar(user, "count"); if (count === "undefined") { count = 0; } await rs.setUservar(user, "count", count + 1); return name+", you have called this macro "+count+" time"+(count != 1 ? 's' : '')+"."; < object + my name is * - <set name=<formal>>Nice to meet you, <get name>. + test async - Ok: <call>awaitable</call> `); await bot.reply("test async", "Ok: undefined, you have called this macro 0 times."); await bot.reply("my name is alice", "Nice to meet you, Alice."); await bot.reply("test async", "Ok: Alice, you have called this macro 1 time."); await bot.reply("test async", "Ok: Alice, you have called this macro 2 times."); await bot.reply("test async", "Ok: Alice, you have called this macro 3 times."); test.done(); }; exports.test_error_in_await_macro = async function(test) { // In RiveScript 2.0.0, macros parsed from RiveScript code are loaded as // async functions, allowing them to use the await keyword. // Test if we have async support in our local JS environment, or else skip // this test. try { eval("(async function() {})"); } catch(e) { console.log("skip test_error_in_await_macro: local JS environment doesn't support async/await"); return test.done(); } var bot = new TestCase(test, ` > object awaitable javascript throw new Error('TestError'); < object + test async - Ok: <call>awaitable</call> `); await bot.reply("test async", "Ok: [ERR: Error raised by object macro: TestError]"); test.done(); };
28.247216
98
0.656154
b502b31aeb75a67cdcc311cd29b7a9abea2e51c9
550
js
JavaScript
nextjs/test/integration/babel-custom/test/index.test.js
benjakugler96/blitz
1e39604ae10366c1fc741a7badd5a06a798cbe70
[ "MIT" ]
2
2021-06-11T06:51:54.000Z
2021-06-12T16:11:08.000Z
nextjs/test/integration/babel-custom/test/index.test.js
benjakugler96/blitz
1e39604ae10366c1fc741a7badd5a06a798cbe70
[ "MIT" ]
null
null
null
nextjs/test/integration/babel-custom/test/index.test.js
benjakugler96/blitz
1e39604ae10366c1fc741a7badd5a06a798cbe70
[ "MIT" ]
1
2021-06-22T03:17:22.000Z
2021-06-22T03:17:22.000Z
/* eslint-env jest */ import { join } from 'path' import { nextBuild } from 'next-test-utils' jest.setTimeout(1000 * 60 * 5) describe('Babel', () => { it('should allow setting babelrc env', async () => { await nextBuild(join(__dirname, '../fixtures/babel-env')) }) it('should allow setting targets.browsers', async () => { await nextBuild(join(__dirname, '../fixtures/targets-browsers')) }) it('should allow setting targets to a string', async () => { await nextBuild(join(__dirname, '../fixtures/targets-string')) }) })
26.190476
68
0.643636
b50c6f642ac83e49470ded314e7322809a5b37cc
405
js
JavaScript
src/sources/CORSImage.js
awentzonline/doppelchat
6734f2cf2e278e4acc97bd7df77006ab3fe96b37
[ "MIT" ]
6
2015-10-27T02:27:59.000Z
2021-06-19T15:27:34.000Z
src/sources/CORSImage.js
awentzonline/doppelchat
6734f2cf2e278e4acc97bd7df77006ab3fe96b37
[ "MIT" ]
null
null
null
src/sources/CORSImage.js
awentzonline/doppelchat
6734f2cf2e278e4acc97bd7df77006ab3fe96b37
[ "MIT" ]
null
null
null
let $ = require('jquery'); export default class CORSImage { static checkURL(url, onSuccess, onFail) { var img = document.createElement('img'); img.crossOrigin = 'Anonymous'; img.onerror = (err) => { onFail('Could not load image. Maybe they don\'t allow cross-domain requests.'); }; img.onload = () => { onSuccess(); }; img.src = url; } }
25.3125
87
0.562963
6ff6aa664160c5392e2175cfc42dc35e17041238
589
js
JavaScript
frontend/mono-ui/web/dss-dashboard/src/index.js
pradeepkumarcm-egov/DIGIT-Dev
d8fb601fae6d919d2386f36b36dfc7fde77ebd4f
[ "MIT" ]
11
2021-04-22T13:18:00.000Z
2021-07-13T06:24:48.000Z
frontend/mono-ui/web/dss-dashboard/src/index.js
pradeepkumarcm-egov/DIGIT-Dev
d8fb601fae6d919d2386f36b36dfc7fde77ebd4f
[ "MIT" ]
2,489
2019-12-05T11:56:06.000Z
2022-03-31T23:05:12.000Z
frontend/mono-ui/web/dss-dashboard/src/index.js
pradeepkumarcm-egov/DIGIT-Dev
d8fb601fae6d919d2386f36b36dfc7fde77ebd4f
[ "MIT" ]
65
2019-11-29T10:08:05.000Z
2021-09-24T09:48:03.000Z
import React from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'react-redux' // import configureStore from '../store'; import { BrowserRouter } from 'react-router-dom'; import storeFactory from './store/store'; import App from './App'; import 'typeface-roboto'; //import registerServiceWorker from './registerServiceWorker'; ReactDOM.render( <Provider store={storeFactory}> <BrowserRouter basename="/"> <App store={storeFactory} /> </BrowserRouter> </Provider>, document.getElementById('root') ); //registerServiceWorker();
28.047619
62
0.692699
b518061aaeeb8b2d2aaa89e77cdaa392bf70bcb5
576
js
JavaScript
routes/index.js
Healthstart/health-start-back-end
ef990a07448994b54e24fc05b2481d8578c15091
[ "MIT" ]
1
2021-08-31T08:53:34.000Z
2021-08-31T08:53:34.000Z
routes/index.js
Healthstart/health-start-back-end
ef990a07448994b54e24fc05b2481d8578c15091
[ "MIT" ]
null
null
null
routes/index.js
Healthstart/health-start-back-end
ef990a07448994b54e24fc05b2481d8578c15091
[ "MIT" ]
null
null
null
const express = require("express"); const router = express.Router(); const con = require("../db/mysql"); const verifyToken = require("./middlewares/authorization"); router.get("/profile", verifyToken, (req, res, next) => { const sql = "SELECT name, sub_date FROM users WHERE email=?"; con.query(sql, [res.locals.email], (err, data) => { if (data.length <= 0) { return; } const { name, sub_date } = data[0]; res.json({ success: "프로필을 불러옵니다", data: { name, sub_date, email: res.locals.email }, }); }); }); module.exports = router;
26.181818
63
0.609375
6fea4bc8189df4a0aeefc1f885dcf19930f6d1af
9,537
js
JavaScript
src/fileformats/fasttracker.js
Rorkien/pasuuna-player
e36c6518fd38338fc74732aa918ffafb67accee5
[ "MIT" ]
3
2020-07-29T17:59:42.000Z
2021-09-05T06:34:57.000Z
src/fileformats/fasttracker.js
Rorkien/pasuuna-player
e36c6518fd38338fc74732aa918ffafb67accee5
[ "MIT" ]
3
2021-03-09T02:11:06.000Z
2022-02-12T08:12:08.000Z
src/fileformats/fasttracker.js
Rorkien/pasuuna-player
e36c6518fd38338fc74732aa918ffafb67accee5
[ "MIT" ]
2
2020-07-29T18:07:20.000Z
2021-02-07T20:13:10.000Z
import { Sample } from '../models/sample'; import { Note } from '../models/note'; import { Instrument } from '../models/instrument'; import { EVENT, LOOPTYPE, TRACKERMODE } from '../enum'; import { processEnvelope, checkEnvelope } from '../lib/util'; import { events } from '../events'; export class FastTracker { constructor(tracker) { this.tracker = tracker; } // see ftp://ftp.modland.com/pub/documents/format_documentation/FastTracker%202%20v2.04%20(.xm).html load(file) { this.tracker.setTrackerMode(TRACKERMODE.FASTTRACKER); this.tracker.clearInstruments(1); const mod = {}; const song = { patterns: [], instruments: [] }; file.littleEndian = true; file.goto(17); song.title = file.readString(20); file.jump(1); //$1a mod.trackerName = file.readString(20); mod.trackerVersion = file.readByte(); mod.trackerVersion = file.readByte() + '.' + mod.trackerVersion; mod.headerSize = file.readDWord(); // is this always 276? mod.songlength = file.readWord(); mod.restartPosition = file.readWord(); mod.numberOfChannels = file.readWord(); mod.numberOfPatterns = file.readWord(); // this is sometimes more then the actual number? should we scan for highest pattern? -> YES! -> NO! mod.numberOfInstruments = file.readWord(); mod.flags = file.readWord(); if (mod.flags % 2 === 1) { this.tracker.useLinearFrequency = true; } else { this.tracker.useLinearFrequency = false; } mod.defaultTempo = file.readWord(); mod.defaultBPM = file.readWord(); const patternTable = []; let highestPattern = 0; for (let i = 0; i < mod.songlength; ++i) { patternTable[i] = file.readUbyte(); if (highestPattern < patternTable[i]) highestPattern = patternTable[i]; } song.patternTable = patternTable; song.length = mod.songlength; song.channels = mod.numberOfChannels; song.restartPosition = (mod.restartPosition + 1); let fileStartPos = 60 + mod.headerSize; file.goto(fileStartPos); for (let i = 0; i < mod.numberOfPatterns; i++) { const patternData = []; const thisPattern = {}; thisPattern.headerSize = file.readDWord(); thisPattern.packingType = file.readUbyte(); // always 0 thisPattern.patternLength = file.readWord(); thisPattern.patternSize = file.readWord(); fileStartPos += thisPattern.headerSize; file.goto(fileStartPos); for (let step = 0; step < thisPattern.patternLength; step++) { let row = []; let channel; for (channel = 0; channel < mod.numberOfChannels; channel++) { let note = new Note(this.tracker); let v = file.readUbyte(); if (v & 128) { if (v & 1) note.setIndex(file.readUbyte()); if (v & 2) note.instrument = file.readUbyte(); if (v & 4) note.volumeEffect = file.readUbyte(); if (v & 8) note.effect = file.readUbyte(); if (v & 16) note.param = file.readUbyte(); } else { note.setIndex(v); note.instrument = file.readUbyte(); note.volumeEffect = file.readUbyte(); note.effect = file.readUbyte(); note.param = file.readUbyte(); } row.push(note); } patternData.push(row); } fileStartPos += thisPattern.patternSize; file.goto(fileStartPos); song.patterns.push(patternData); } const instrumentContainer = []; for (let i = 1; i <= mod.numberOfInstruments; ++i) { const instrument = new Instrument(this.tracker); try { instrument.filePosition = file.index; instrument.headerSize = file.readDWord(); instrument.name = file.readString(22); instrument.type = file.readUbyte(); instrument.numberOfSamples = file.readWord(); instrument.samples = []; instrument.sampleHeaderSize = 0; if (instrument.numberOfSamples > 0) { instrument.sampleHeaderSize = file.readDWord(); // some files report incorrect sampleheadersize (18, without the samplename) // e.g. dubmood - cybernostra weekends.xm // sample header should be at least 40 bytes instrument.sampleHeaderSize = Math.max(instrument.sampleHeaderSize, 40); // and not too much ... (Files saved with sk@letracker) if (instrument.sampleHeaderSize > 200) instrument.sampleHeaderSize = 40; //should we assume it's always 40? not according to specs ... for (let si = 0; si < 96; si++) { instrument.sampleNumberForNotes.push(file.readUbyte()); } for (let si = 0; si < 24; si++) { instrument.volumeEnvelope.raw.push(file.readWord()); } for (let si = 0; si < 24; si++) { instrument.panningEnvelope.raw.push(file.readWord()); } instrument.volumeEnvelope.count = file.readUbyte(); instrument.panningEnvelope.count = file.readUbyte(); instrument.volumeEnvelope.sustainPoint = file.readUbyte(); instrument.volumeEnvelope.loopStartPoint = file.readUbyte(); instrument.volumeEnvelope.loopEndPoint = file.readUbyte(); instrument.panningEnvelope.sustainPoint = file.readUbyte(); instrument.panningEnvelope.loopStartPoint = file.readUbyte(); instrument.panningEnvelope.loopEndPoint = file.readUbyte(); instrument.volumeEnvelope.type = file.readUbyte(); instrument.panningEnvelope.type = file.readUbyte(); instrument.vibrato.type = file.readUbyte(); instrument.vibrato.sweep = file.readUbyte(); instrument.vibrato.depth = Math.min(file.readUbyte(), 15); // some trackers have a different scale here? (e.g. Ambrozia) instrument.vibrato.rate = file.readUbyte(); instrument.fadeout = file.readWord(); instrument.reserved = file.readWord(); instrument.volumeEnvelope = processEnvelope(instrument.volumeEnvelope); instrument.panningEnvelope = processEnvelope(instrument.panningEnvelope); } } catch (e) { console.error('Pasuuna trakcer error', e); } fileStartPos += instrument.headerSize; file.goto(fileStartPos); if (instrument.numberOfSamples === 0) { const sample = new Sample(); instrument.samples.push(sample); } else { if (file.isEOF(1)) { console.error('Pasuuna seek past EOF', instrument); break; } for (let sampleI = 0; sampleI < instrument.numberOfSamples; sampleI++) { const sample = new Sample(); sample.length = file.readDWord(); sample.loop.start = file.readDWord(); sample.loop.length = file.readDWord(); sample.volume = file.readUbyte(); sample.finetuneX = file.readByte(); sample.type = file.readUbyte(); sample.panning = file.readUbyte() - 128; sample.relativeNote = file.readByte(); sample.reserved = file.readByte(); sample.name = file.readString(22); sample.bits = 8; instrument.samples.push(sample); fileStartPos += instrument.sampleHeaderSize; file.goto(fileStartPos); } for (let sampleI = 0; sampleI < instrument.numberOfSamples; sampleI++) { const sample = instrument.samples[sampleI]; if (!sample.length) continue; fileStartPos += sample.length; if (sample.type & 16) { sample.bits = 16; sample.type ^= 16; sample.length >>= 1; sample.loop.start >>= 1; sample.loop.length >>= 1; } sample.loop.type = sample.type || 0; sample.loop.enabled = !!sample.loop.type; // sample data // console.log('Reading sample from 0x' + file.index + ' with length of ' + sample.length + (sample.bits === 16 ? ' words' : ' bytes') + ' and repeat length of ' + sample.loop.length); const sampleEnd = sample.length; let old = 0; if (sample.bits === 16) { for (let j = 0; j < sampleEnd; j++) { const b = file.readShort() + old; if (b < -32768) b += 65536; else if (b > 32767) b -= 65536; old = b; sample.data.push(b / 32768); } } else { for (let j = 0; j < sampleEnd; j++) { const b = file.readByte() + old; if (b < -128) { b += 256; } else if (b > 127) { b -= 256; } old = b; sample.data.push(b / 127); // TODO: or /128 ? seems to introduce artifacts - see test-loop-fadeout.xm } } // unroll ping pong loops if (sample.loop.type === LOOPTYPE.PINGPONG) { // TODO: keep original sample? const loopPart = sample.data.slice(sample.loop.start, sample.loop.start + sample.loop.length); sample.data = sample.data.slice(0, sample.loop.start + sample.loop.length); sample.data = sample.data.concat(loopPart.reverse()); sample.loop.length = sample.loop.length * 2; sample.length = sample.loop.start + sample.loop.length; } file.goto(fileStartPos); } } instrument.setSampleIndex(0); this.tracker.setInstrument(i, instrument); instrumentContainer.push({ label: i + ' ' + instrument.name, data: i }); } events.emit(EVENT.instrumentListChange, instrumentContainer); song.instruments = this.tracker.getInstruments(); this.tracker.setBPM(mod.defaultBPM); this.tracker.setAmigaSpeed(mod.defaultTempo); this.validate(song); return song; }; validate(song) { song.instruments.forEach((instrument) => { // check envelope instrument.volumeEnvelope = checkEnvelope(instrument.volumeEnvelope, 'volume'); instrument.panningEnvelope = checkEnvelope(instrument.panningEnvelope, 'panning'); // check sampleIndexes; const maxSampleIndex = instrument.samples.length - 1; for (let i = 0, max = instrument.sampleNumberForNotes.length; i < max; i++) { instrument.sampleNumberForNotes[i] = Math.min(instrument.sampleNumberForNotes[i], maxSampleIndex); } }) }; }
32.438776
189
0.653979
b5029838258e962cecd798af7e4924127f127e9a
9,836
js
JavaScript
server/routes.js
jlvoiseux/opbeans-node
e561abdd26edaaefdfb79696895a3db40a6c7f88
[ "MIT" ]
32
2018-08-06T21:47:36.000Z
2021-09-29T23:09:06.000Z
server/routes.js
jlvoiseux/opbeans-node
e561abdd26edaaefdfb79696895a3db40a6c7f88
[ "MIT" ]
90
2018-07-25T07:22:55.000Z
2022-03-30T16:31:04.000Z
server/routes.js
jlvoiseux/opbeans-node
e561abdd26edaaefdfb79696895a3db40a6c7f88
[ "MIT" ]
28
2018-07-25T07:15:10.000Z
2022-03-05T18:28:27.000Z
'use strict' const apm = require('elastic-apm-node') const express = require('express') const afterAll = require('after-all-results') const db = require('./db') const redis = require('./redis') const accounting = require('./accounting') const app = module.exports = new express.Router() app.get('/stats', function (req, res) { const next = afterAll(function (err, results) { if (err) return error(err, res) res.json({ products: results[0].rows[0].count, customers: results[1].rows[0].count, orders: results[2].rows[0].count, numbers: results[3] }) }) db.pool.query('SELECT COUNT(*) FROM products', next()) db.pool.query('SELECT COUNT(*) FROM customers', next()) db.pool.query('SELECT COUNT(*) FROM orders', next()) const done = next() const sql = 'SELECT product_id, COUNT(product_id) AS amount ' + 'FROM order_lines ' + 'GROUP BY product_id' db.pool.query(sql, function (err, result) { if (err) return done(err) const orderedProducts = result.rows const next = afterAll(function (err, results) { if (err) return done(err) const result = { revenue: 0, cost: 0, profit: 0 } results.forEach(function (r, index) { const product = r.rows[0] const amount = orderedProducts[index].amount const cost = product.cost * amount const revenue = product.selling_price * amount result.revenue += revenue result.cost += cost result.profit += revenue - cost }) done(null, result) }) orderedProducts.forEach(function (row) { const sql = 'SELECT cost, selling_price FROM products WHERE id=$1' db.pool.query(sql, [row.product_id], next()) }) }) }) app.get('/products', function (req, res) { redis.get('products', function (err, obj) { if (err) apm.captureError(err) else if (obj) return res.json(obj) const sql = 'SELECT p.id, p.sku, p.name, p.stock, t.name AS type_name FROM products p ' + 'LEFT JOIN product_types t ON p.type_id=t.id' db.pool.query(sql, function (err, result) { if (err) return error(err, res) res.json(result.rows) }) }) }) app.get('/products/top', function (req, res) { const sql = 'SELECT product_id, COUNT(product_id) AS amount ' + 'FROM order_lines ' + 'GROUP BY product_id ' + 'LIMIT 3' db.pool.query(sql, function (err, result) { if (err) return error(err, res) const next = afterAll(function (err, results) { if (err) return error(err, res) const top = result.rows.map(function (row, index) { const product = results[index].rows[0] product.sold = row.amount return product }) res.json(top) }) result.rows.forEach(function (row) { const sql = 'SELECT id, sku, name, stock FROM products WHERE id=$1' db.pool.query(sql, [row.product_id], next()) }) }) }) app.get('/products/:id', function (req, res) { const sql = 'SELECT p.*, t.name AS type_name FROM products p ' + 'LEFT JOIN product_types t ON p.type_id=t.id ' + 'WHERE p.id=$1' db.pool.query(sql, [req.params.id], function (err, result) { if (err) return error(err, res) if (result.rowCount === 0) return res.status(404).end() res.json(result.rows[0]) }) }) app.get('/products/:id/customers', function (req, res) { const limit = req.query.limit || 1000 const sql = 'SELECT c.* FROM customers c ' + 'LEFT JOIN orders o ON c.id=o.customer_id ' + 'LEFT JOIN order_lines l ON o.id=l.order_id ' + 'LEFT JOIN products p ON l.product_id=p.id ' + 'WHERE p.id=$1 ' + 'LIMIT $2' db.pool.query(sql, [req.params.id, limit], function (err, result) { if (err) return error(err, res) if (!req.query.count) return res.json(result.rows) const next = afterAll(function (err, results) { if (err) return error(err, res) result.rows.forEach(function (row, index) { row.orderCount = results[index].rows.length }) res.json(result.rows) }) result.rows.forEach(function (row) { const sql = 'SELECT * FROM orders WHERE customer_id=$1' db.pool.query(sql, [row.id], next()) }) }) }) app.get('/types', function (req, res) { redis.get('types', function (err, obj) { if (err) apm.captureError(err) else if (obj) return res.json(obj) db.pool.query('SELECT * FROM product_types', function (err, result) { if (err) return error(err, res) res.json(result.rows) }) }) }) app.get('/types/:id', function (req, res) { db.pool.query('SELECT * FROM product_types WHERE id=$1', [req.params.id], function (err, result) { if (err) return error(err, res) const type = result.rows[0] if (!type) return res.status(404).end() db.pool.query('SELECT id, name FROM products WHERE type_id=$1', [req.params.id], function (err, result) { if (err) return error(err, res) type.products = result.rows res.json(type) }) }) }) app.get('/customers', function (req, res) { redis.get('customers', function (err, obj) { if (err) apm.captureError(err) else if (obj) return res.json(obj) const limit = req.query.limit || 1000 const sql = 'SELECT * FROM customers LIMIT $1' db.pool.query(sql, [limit], function (err, result) { if (err) return error(err, res) res.json(result.rows) }) }) }) app.post('/customers', function (req, res) { const customer = req.body const isEmail = /^([a-zA-Z0-9])(([-.]|[_]+)?([a-zA-Z0-9]+))*(@){1}[a-z0-9]+[.]{1}(([a-z]{2,3})|([a-z]{2,3}[.]{1}[a-z]{2,3}))$/ if (!customer.full_name || !customer.company_name || !isEmail.test(customer.email)) { res.status(400).end() return } const sql = 'INSERT INTO customers (full_name, company_name, email, address, postal_code, city, country) VALUES ($1, $2, $3, $4, $5, $6, $7)' const values = [ customer.full_name, customer.company_name, customer.email, customer.address, customer.postal_code, customer.city, customer.country ] db.pool.query(sql, values, function (err) { if (err) return error(err, res) res.end() }) }) app.get('/customers/:id', function (req, res) { db.pool.query('SELECT * FROM customers WHERE id=$1', [req.params.id], function (err, result) { if (err) return error(err, res) if (result.rowCount === 0) return res.status(404).end() res.json(result.rows[0]) }) }) app.get('/orders', function (req, res) { redis.get('orders', function (err, obj) { if (err) apm.captureError(err) else if (obj) return res.json(obj) const limit = req.query.limit || 1000 const sql = 'SELECT o.*, c.full_name AS customer_name FROM orders o ' + 'LEFT JOIN customers c ON c.id=o.customer_id ' + 'LIMIT $1' db.pool.query(sql, [limit], function (err, result) { if (err) return error(err, res) res.json(result.rows) }) }) }) /** * Example body: * { * customer_id: 1, * lines: [ * {id: 1, amount: 1} * ] * } */ app.post('/orders', function (req, res) { if (!req.body.customer_id || !req.body.lines) { res.status(400).end() return } db.client(function (err, client, done) { if (err) return error(err, res) const next = afterAll(function (err, results) { if (err) { done() error(err, res) return } if (results.some(function (result) { return result.rowCount === 0 })) { done() res.status(400).end() return } client.query('BEGIN', function (err) { if (err) return rollback(err) const sql = 'INSERT INTO orders (customer_id) VALUES ($1) RETURNING id' client.query(sql, [req.body.customer_id], function (err, result) { if (err) return rollback(err) const id = result.rows[0].id const next = afterAll(function (err) { if (err) return rollback(err) accounting.placeOrder({ id: id }, function (err) { if (err) return rollback(err) client.query('COMMIT', function (err) { if (err) return rollback(err) done() redis.set('newest-order', id, function (err) { if (err) return error(err, res) res.json({ id: id }) }) }) }) }) req.body.lines.forEach(function (line) { const sql = 'INSERT INTO order_lines (order_id, product_id, amount) ' + 'VALUES ($1, $2, $3)' client.query(sql, [id, line.id, line.amount], next()) }) }) function rollback (err) { apm.captureError(err) client.query('ROLLBACK', function (err) { if (err) apm.captureError(err) done(err) res.status(500).end() }) } }) }) client.query('SELECT id FROM customers WHERE id=$1', [req.body.customer_id], next()) req.body.lines.forEach(function (line) { client.query('SELECT id FROM products WHERE id=$1', [line.id], next()) }) }) }) app.get('/orders/:id', function (req, res) { db.pool.query('SELECT * FROM orders WHERE id=$1', [req.params.id], function (err, result) { if (err) return error(err, res) const order = result.rows[0] if (!order) return res.status(404).end() const sql = 'SELECT l.amount, p.* FROM order_lines l ' + 'LEFT JOIN products p ON l.product_id=p.id ' + 'WHERE l.order_id=$1' db.pool.query(sql, [req.params.id], function (err, result) { if (err) return error(err, res) order.lines = result.rows apm.setCustomContext({ orderLines: result.rows.length }) res.json(order) }) }) }) function error (err, res) { apm.captureError(err) res.status(500).end() }
28.844575
143
0.588756
6fee81543c203f31dfade98906387d2603c0ad92
405
js
JavaScript
api/class/chart/chart.js
acharts/acharts
8f8cc37c9d65356099ad4e5d7657a453e3a9c175
[ "MIT" ]
194
2015-01-13T08:36:55.000Z
2021-11-08T10:14:42.000Z
api/class/chart/chart.js
lsx459/acharts
8f8cc37c9d65356099ad4e5d7657a453e3a9c175
[ "MIT" ]
13
2015-04-11T13:55:16.000Z
2018-03-12T15:02:56.000Z
api/class/chart/chart.js
lsx459/acharts
8f8cc37c9d65356099ad4e5d7657a453e3a9c175
[ "MIT" ]
86
2015-01-04T01:58:31.000Z
2021-07-29T07:31:30.000Z
function mix(obj1,obj2){ } var chart = [ { text: 'width', dataType: 'number', desc: '指定图表的宽度' }, { text: 'height', dataType: 'number', desc: '指定图表的高度' }, { text: 'legend', dataType: 'object', desc: '用图标展示各个序列', children: [ { text: 'spacingX', dataType: 'number', def: 5, desc: '排布时子项之间x间距' } ] } ] module.exports = chart;
13.064516
24
0.501235
b50ab68b85019a8498fb56cf9d98c958993aa63c
107
js
JavaScript
app/containers/MapPage/MapContainer/styles.js
bobrovova/explorer
1b1ed85d3b46af0d9446d4504027515b01c75dda
[ "MIT" ]
9
2018-11-05T05:46:06.000Z
2021-12-17T06:30:48.000Z
app/containers/MapPage/MapContainer/styles.js
bobrovova/explorer
1b1ed85d3b46af0d9446d4504027515b01c75dda
[ "MIT" ]
6
2020-04-04T09:44:18.000Z
2022-03-23T17:44:18.000Z
app/containers/MapPage/MapContainer/styles.js
rise-worlds/Potato-Network-Monitor-Front
8fb73764788daa4a32b4104607d755aaf7ebdc13
[ "MIT" ]
12
2018-11-05T08:49:52.000Z
2022-01-12T18:55:09.000Z
import styled from 'styled-components'; export const Map = styled.div` width: 100vw; height: 94vh; `;
15.285714
39
0.700935
6ff53b4ee8f02bc6ea49b84e0de0bc806c34e2c2
59
js
JavaScript
gulp/tasks/test.js
risq/splash-app
c2ec12fc077f3c39fbf07a18745b49efb9f78407
[ "MIT" ]
67
2016-03-18T03:53:42.000Z
2022-01-10T01:05:03.000Z
gulp/tasks/test.js
risq/splash-app
c2ec12fc077f3c39fbf07a18745b49efb9f78407
[ "MIT" ]
1
2020-11-15T21:57:31.000Z
2021-04-12T08:42:32.000Z
gulp/tasks/test.js
risq/splash-app
c2ec12fc077f3c39fbf07a18745b49efb9f78407
[ "MIT" ]
10
2016-03-19T23:19:50.000Z
2021-12-08T15:40:41.000Z
var gulp = require('gulp'); gulp.task('test', ['karma']);
14.75
29
0.59322
b506727502d205b30efb511624b69f2d01133405
4,600
js
JavaScript
node_modules/ascoltatori/test/mongo_ascoltatore_spec.js
smartby/IOT
e113270a89a141b78cf8f300dc30cc01c0f039cf
[ "MIT" ]
21
2020-01-21T16:19:20.000Z
2022-01-21T09:42:07.000Z
node_modules/ascoltatori/test/mongo_ascoltatore_spec.js
Will-create/acg-flow
51943c930fdc59252d9359b624de96ee1f5abf06
[ "MIT" ]
89
2020-03-13T10:08:30.000Z
2020-12-10T19:56:00.000Z
node_modules/ascoltatori/test/mongo_ascoltatore_spec.js
Will-create/acg-flow
51943c930fdc59252d9359b624de96ee1f5abf06
[ "MIT" ]
5
2020-08-31T03:58:17.000Z
2021-12-14T21:13:47.000Z
var MongoClient = require('mongodb').MongoClient; var steed = require('steed')(); describeAscoltatore("mongo", function() { afterEach(function(done) { this.instance.close(done); }); it("should publish a binary payload", function(done) { var that = this; that.instance.sub("hello/*", function(topic, value) { expect(value).to.eql(new Buffer("42")); done(); }, function() { that.instance.pub("hello/123", new Buffer("42")); }); }); it("should support the old connect uri + db", function(done) { this.instance.close(function() { this.instance = new ascoltatori.MongoAscoltatore({ uri: 'mongodb://127.0.0.1/', db: 'ascoltatoriTests2' }); this.instance.on('ready', function() { expect(this.instance.db.databaseName).to.eql('ascoltatoriTests2'); done(); }.bind(this)); }.bind(this)); }); it("should reuse another mongo connection", function(done) { this.instance.close(function() { MongoClient.connect('mongodb://127.0.0.1/ascoltatoriTest3', {}, function(err, db) { this.instance = new ascoltatori.MongoAscoltatore({ db: db }); this.instance.on('ready', done); }.bind(this)); }.bind(this)); }); it.skip("should publish 2000 messages without skipping one", function(done) { var that = this; var count = 0; var max = 2000; function doPub(n, next) { that.instance.pub("hello/123", "abcde " + n, {}, next); } that.instance.sub("hello/*", function(topic, value) { count++; if (count === max) { done(); } }, function() { steed.times(max, doPub); }); }); it("should publish a big payload", function(done) { var that = this; var payload = new Buffer(5 * 1024); that.instance.sub("hello/*", function(topic, value) { expect(value).to.eql(payload); done(); }, function(err) { that.instance.pub("hello/123", payload); }); }); it("should publish with options", function(done) { var that = this; that.instance.subscribe("hello/*", function(topic, value, options) { expect(value).to.equal("42"); expect(options.qos).to.equal(1); expect(options.messageId).to.equal(5); done(); }, function() { that.instance.publish("hello/123", "42", { qos: 1, messageId: 5 }); }); }); // flaky test on CI it.skip("should not suffer from mongo interruptions", function (done) { this.instance.close(function () { MongoClient.connect('mongodb://127.0.0.1/ascoltatoriTest4', {}, function (err, db) { db.on('error', done); this.instance = new ascoltatori.MongoAscoltatore({ db: db }); this.instance.on('error', done); this.instance.on('ready', function () { _test(this); }.bind(this)); }.bind(this)); }.bind(this)); function _test(that) { that.instance.subscribe("hello/*", function (topic, value, options) { if (value === "42") { done(); } }, function () { that.instance.publish("hello/123", "21"); that.instance.db.logout({}, function (err, res) { if (err) { throw(err); } that.instance.publish("hello/456", "42"); }); }); } }); it("should not duplicate messages", function(done) { this.timeout(5000); var that = this; var called = 0; that.instance.sub("hello", function(topic, value) { called++; expect(called).to.be.lessThan(3); expect(value).to.eql(new Buffer("42")); }, function() { that.instance.pub("hello", new Buffer("42")); that.instance.pub("hello", new Buffer("42")); setTimeout(done, 3000); }); }); it("should not duplicate messages when sending messages sequentially", function(done) { this.timeout(5000); var that = this; var called = 0; that.instance.sub("hello", function(topic, value) { called++; expect(called).to.be.lessThan(7); expect(value).to.eql(new Buffer("42")); }, function() { setTimeout(function(){ that.instance.pub("hello", new Buffer("42")); that.instance.pub("hello", new Buffer("42")); setTimeout(function(){ that.instance.pub("hello", new Buffer("42")); that.instance.pub("hello", new Buffer("42")); setTimeout(function(){ that.instance.pub("hello", new Buffer("42")); that.instance.pub("hello", new Buffer("42")); },100); },100); },100); setTimeout(done, 3000); }); }); });
30.065359
113
0.569783
b50dca90374efdf814a1d92a909495a81a98237a
984
js
JavaScript
node_modules/bower/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/lib/js-yaml/type/omap.js
thomjoy/sydney-buses
fa596fd194ff1bfc57d29597988ec53154087f7c
[ "MIT" ]
1
2022-01-25T04:57:53.000Z
2022-01-25T04:57:53.000Z
node_modules/bower/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/lib/js-yaml/type/omap.js
thomjoy/sydney-buses
fa596fd194ff1bfc57d29597988ec53154087f7c
[ "MIT" ]
null
null
null
node_modules/bower/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/lib/js-yaml/type/omap.js
thomjoy/sydney-buses
fa596fd194ff1bfc57d29597988ec53154087f7c
[ "MIT" ]
null
null
null
'use strict'; var NIL = require('../common').NIL; var Type = require('../type'); var _hasOwnProperty = Object.prototype.hasOwnProperty; var _toString = Object.prototype.toString; function resolveYamlOmap(object /*, explicit*/) { var objectKeys = [], index, length, pair, pairKey, pairHasKey; for (index = 0, length = object.length; index < length; index += 1) { pair = object[index]; pairHasKey = false; if ('[object Object]' !== _toString.call(pair)) { return NIL; } for (pairKey in pair) { if (_hasOwnProperty.call(pair, pairKey)) { if (!pairHasKey) { pairHasKey = true; } else { return NIL; } } } if (!pairHasKey) { return NIL; } if (-1 === objectKeys.indexOf(pairKey)) { objectKeys.push(pairKey); } else { return NIL; } } return object; } module.exports = new Type('tag:yaml.org,2002:omap', { loader: { kind: 'array', resolver: resolveYamlOmap } });
18.222222
71
0.593496
b515b49a5b116522734bd99c4a0e121c4009af6c
701
js
JavaScript
app/src/js/reducers/operations/selector.js
NicoLaval/Bauhaus
e8a313e7196169ed7fe25b718457e8596bb3d55a
[ "MIT" ]
3
2020-04-21T07:45:08.000Z
2022-01-28T18:18:13.000Z
app/src/js/reducers/operations/selector.js
NicoLaval/Bauhaus
e8a313e7196169ed7fe25b718457e8596bb3d55a
[ "MIT" ]
69
2018-05-28T15:29:58.000Z
2022-03-25T06:36:40.000Z
app/src/js/reducers/operations/selector.js
NicoLaval/Bauhaus
e8a313e7196169ed7fe25b718457e8596bb3d55a
[ "MIT" ]
11
2018-04-06T06:47:58.000Z
2022-01-21T10:28:32.000Z
export const getOperationsOrganisations = state => { const organisations = state.operationsOrganisations || {}; return organisations.results || []; }; export const getOperationsCodesList = state => { const operationsCodesList = state.operationsCodesList || {}; return operationsCodesList.results || []; }; export const getOperationsDocuments = (state, group = 'full') => { if (!state.operationsDocuments.results) { return []; } return state.operationsDocuments.results[group] || []; }; export const getOperationsDocumentsStatus = state => { return state.operationsDocuments.status; }; export const getCurrentDocument = state => { return state.operationsCurrentDocument.results || {}; };
29.208333
66
0.737518
6fea427f893f50a4718097d7a330b029b2c7d23a
2,485
js
JavaScript
src/components/ChallengePane/ChallengeFilterSubnav/ChallengeFilterSubnav.js
reichg/maproulette3
2e92ca809362e21a639c3bf5ba049eac6673b11b
[ "MIT" ]
78
2018-05-14T02:58:14.000Z
2022-02-01T05:01:53.000Z
src/components/ChallengePane/ChallengeFilterSubnav/ChallengeFilterSubnav.js
reichg/maproulette3
2e92ca809362e21a639c3bf5ba049eac6673b11b
[ "MIT" ]
478
2018-05-11T05:29:07.000Z
2022-03-31T22:25:14.000Z
src/components/ChallengePane/ChallengeFilterSubnav/ChallengeFilterSubnav.js
reichg/maproulette3
2e92ca809362e21a639c3bf5ba049eac6673b11b
[ "MIT" ]
29
2018-07-08T22:36:52.000Z
2022-03-18T21:17:11.000Z
import React, { Component } from 'react' import { FormattedMessage, injectIntl } from 'react-intl' import SearchBox from '../../SearchBox/SearchBox' import WithChallengeSearch from '../../HOCs/WithSearch/WithChallengeSearch' import WithCommandInterpreter from '../../HOCs/WithCommandInterpreter/WithCommandInterpreter' import FilterByDifficulty from './FilterByDifficulty' import FilterByKeyword from './FilterByKeyword' import ClearFiltersControl from './ClearFiltersControl' import SortChallengesSelector from './SortChallengesSelector' import './ChallengeFilterSubnav.scss' import messages from './Messages' // Setup child components with necessary HOCs const CommandSearchBox = WithCommandInterpreter(SearchBox) /** * ChallengeFilterSubnav presents a navigation bar that contains options * for filtering MapRoulette challenges, as well as a search box for * further narrowing down challenges. * * @see See FilterByDifficulty * @see See FilterByKeyword * @see See FilterByLocation * @see See SearchBox * * @author [Neil Rotstan](https://github.com/nrotstan) */ export class ChallengeFilterSubnav extends Component { clearFilters = () => { this.props.clearSearchFilters() this.props.clearSearch() } render() { const filtersActive = this.props.unfilteredChallenges.length > this.props.challenges.length return ( <header className="mr-bg-black-10 mr-shadow mr-py-4 lg:mr-py-0 mr-px-6 mr-hidden lg:mr-flex mr-items-center mr-justify-between"> <div className="mr-flex-grow mr-flex mr-items-center mr-justify-between lg:mr-justify-start"> <h1 className="mr-hidden xl:mr-flex mr-text-3xl mr-leading-tight mr-font-normal mr-mr-6"> <FormattedMessage {...messages.header} /> </h1> <div className="mr-flex mr-items-center"> <SortChallengesSelector {...this.props} /> <FilterByKeyword {...this.props} /> <FilterByDifficulty {...this.props} /> <CommandSearchBox {...this.props} className="mr-h-12" placeholder={this.props.intl.formatMessage(messages.searchLabel)} showSearchTypeFilter setSearch={this.props.setSearch} /> </div> {filtersActive && ( <ClearFiltersControl clearFilters={this.clearFilters} /> )} </div> </header> ) } } export default WithChallengeSearch(injectIntl(ChallengeFilterSubnav))
36.544118
134
0.687726
b51715ab4baa4fc8a303d31ab72f799891bbe82d
630
js
JavaScript
demo/hoverHexagon.js
fderen-dev/react-hexagon
9de6c1141b56d2688e0b2365b6bd6dd225138cf6
[ "MIT" ]
60
2016-03-25T17:12:37.000Z
2022-02-08T14:26:31.000Z
demo/hoverHexagon.js
fderen-dev/react-hexagon
9de6c1141b56d2688e0b2365b6bd6dd225138cf6
[ "MIT" ]
9
2016-09-11T10:02:22.000Z
2021-06-28T15:14:02.000Z
demo/hoverHexagon.js
fderen-dev/react-hexagon
9de6c1141b56d2688e0b2365b6bd6dd225138cf6
[ "MIT" ]
24
2016-09-11T12:41:41.000Z
2022-01-13T08:05:30.000Z
import React from 'react' import Hexagon from '../src/Hexagon' function HoverHexagon(props) { return ( <Hexagon style={props.style} className={props.className} hexClassName={props.hexClassName} children={props.children} hexProps={{ onMouseEnter: props.onEnter, onMouseLeave: props.onLeave }} /> ) } const propTypes = React.PropTypes HoverHexagon.propTypes = { style: propTypes.object, children: propTypes.node, className: propTypes.string, hexClassName: propTypes.string, onEnter: propTypes.func, onLeave: propTypes.func } export default HoverHexagon
21
39
0.690476
6fe99e432b47fbc384561e8d1ed7ba2c8f2e7553
31
js
JavaScript
src/components/ChatToolbar/index.js
charliesouthview/react-chatengine-demo
ac55faf50b9ebbaa3c0eae2150efd5f3e71ae848
[ "MIT" ]
14
2021-02-20T16:06:21.000Z
2022-02-09T20:31:49.000Z
src/components/ChatToolbar/index.js
charliesouthview/react-chatengine-demo
ac55faf50b9ebbaa3c0eae2150efd5f3e71ae848
[ "MIT" ]
1
2021-12-04T09:28:16.000Z
2021-12-05T03:08:26.000Z
src/components/ChatToolbar/index.js
charliesouthview/react-chatengine-demo
ac55faf50b9ebbaa3c0eae2150efd5f3e71ae848
[ "MIT" ]
16
2021-02-26T12:55:20.000Z
2022-03-03T02:22:45.000Z
export * from './ChatToolbar';
15.5
30
0.677419
b50567f3813ae62f2a76479a8488164f97111734
122
js
JavaScript
docs/search/functions_0.js
maximsmol/rolmodl
fb41b7f9f4669eea84ce6f1574cdf1be9b6f072f
[ "MIT" ]
1
2022-02-19T21:34:42.000Z
2022-02-19T21:34:42.000Z
docs/search/functions_0.js
maximsmol/rolmodl
fb41b7f9f4669eea84ce6f1574cdf1be9b6f072f
[ "MIT" ]
null
null
null
docs/search/functions_0.js
maximsmol/rolmodl
fb41b7f9f4669eea84ce6f1574cdf1be9b6f072f
[ "MIT" ]
1
2021-12-07T09:33:42.000Z
2021-12-07T09:33:42.000Z
var searchData= [ ['_5fexit_3311',['_Exit',['http://en.cppreference.com/w/cpp/utility/program/_Exit.html',1,'std']]] ];
24.4
100
0.672131
b50c12d942f1ca49a22a387afb5ce853253e2365
2,425
js
JavaScript
__tests__/providers/webpush/notificationCatcher.js
udanpe/notifme-sdk
d32c30afcbbe42cfd5bde45d5253f1e27905c0f2
[ "MIT" ]
1,976
2017-08-09T13:00:05.000Z
2022-03-09T16:59:26.000Z
__tests__/providers/webpush/notificationCatcher.js
udanpe/notifme-sdk
d32c30afcbbe42cfd5bde45d5253f1e27905c0f2
[ "MIT" ]
67
2017-08-11T14:15:54.000Z
2021-12-29T05:41:59.000Z
__tests__/providers/webpush/notificationCatcher.js
udanpe/notifme-sdk
d32c30afcbbe42cfd5bde45d5253f1e27905c0f2
[ "MIT" ]
154
2017-08-11T15:57:33.000Z
2022-03-06T15:31:29.000Z
/* @flow */ /* global jest, test, expect */ import NotifmeSdk from '../../../src' const mockSend = jest.fn() jest.mock('../../../src/providers/email/smtp', () => () => ({ send: mockSend })) const sdk = new NotifmeSdk({ useNotificationCatcher: true }) const request = { webpush: { subscription: { keys: { auth: 'xxxxx', p256dh: 'xxxxx' }, endpoint: 'xxxxx' }, title: 'Hi John', body: 'Hello John! How are you?', icon: 'https://notifme.github.io/notifme-sdk/img/icon.png' } } test('webpush notification catcher provider should use SMTP provider.', async () => { const result = await sdk.send(request) expect(mockSend).lastCalledWith({ from: '-', headers: { 'X-payload': '{"title":"Hi John","body":"Hello John! How are you?","icon":"https://notifme.github.io/notifme-sdk/img/icon.png"}', 'X-to': '[webpush] ', 'X-type': 'webpush' }, subject: 'Hi John', to: 'user@webpush' }) expect(result).toEqual({ status: 'success', channels: { webpush: { id: undefined, providerId: 'webpush-notificationcatcher-provider' } } }) }) test('webpush notification catcher provider should use SMTP provider (with userId).', async () => { const result = await sdk.send({ metadata: { userId: '24' }, ...request }) expect(mockSend).lastCalledWith({ from: '-', headers: { 'X-payload': '{"title":"Hi John","userId":"24","body":"Hello John! How are you?","icon":"https://notifme.github.io/notifme-sdk/img/icon.png"}', 'X-to': '[webpush] 24', 'X-type': 'webpush' }, subject: 'Hi John', to: '24@webpush' }) expect(result).toEqual({ status: 'success', channels: { webpush: { id: undefined, providerId: 'webpush-notificationcatcher-provider' } } }) }) test('webpush notification catcher provider should customize requests.', async () => { await sdk.send({ metadata: { userId: '24' }, webpush: { ...request.webpush, customize: async (provider, request) => ({ ...request, title: 'Hi John!' }) } }) expect(mockSend).lastCalledWith({ from: '-', headers: { 'X-payload': '{"title":"Hi John!","userId":"24","body":"Hello John! How are you?","icon":"https://notifme.github.io/notifme-sdk/img/icon.png"}', 'X-to': '[webpush] 24', 'X-type': 'webpush' }, subject: 'Hi John!', to: '24@webpush' }) })
27.556818
150
0.581856
b51901ac0d5b4ad2cdd02fc572ad1b2d34fcfa59
602
js
JavaScript
01-Fundamentals-Part-1/16_logical_operators/script.js
Evavic44/Learn-JavaScript
2b10f4bb79449d6865608a53520ac7157ea3986e
[ "MIT" ]
4
2022-01-08T10:53:32.000Z
2022-03-09T22:40:56.000Z
01-Fundamentals-Part-1/16_logical_operators/script.js
Evavic44/Learn-JavaScript
2b10f4bb79449d6865608a53520ac7157ea3986e
[ "MIT" ]
null
null
null
01-Fundamentals-Part-1/16_logical_operators/script.js
Evavic44/Learn-JavaScript
2b10f4bb79449d6865608a53520ac7157ea3986e
[ "MIT" ]
null
null
null
const hasDriversLicense = true; // A const hasGoodVision = true; // B console.log(hasDriversLicense && hasGoodVision); console.log(hasDriversLicense || hasGoodVision); console.log(!hasDriversLicense); // if (hasDriversLicense && hasGoodVision) { // console.log("Sarah is able to drive"); // } else { // console.log("Someone else should drive..."); // } const isTired = false; // C console.log(hasDriversLicense && hasGoodVision && isTired); if (hasDriversLicense && hasGoodVision && !isTired) { console.log("Sarah is able to drive"); } else { console.log("Someone else should drive..."); }
27.363636
59
0.699336
b509adbda7f4e08513d8123ca3fde2568315b345
715
js
JavaScript
test/suite/index.js
qtttttttttting/vue-swift-i18n
8c829168289f2ca6e6d737f75342de6517381dad
[ "MIT" ]
35
2019-07-23T10:27:17.000Z
2022-03-11T08:38:38.000Z
test/suite/index.js
qtttttttttting/vue-swift-i18n
8c829168289f2ca6e6d737f75342de6517381dad
[ "MIT" ]
6
2020-04-20T12:37:48.000Z
2022-03-02T08:56:10.000Z
test/suite/index.js
qtttttttttting/vue-swift-i18n
8c829168289f2ca6e6d737f75342de6517381dad
[ "MIT" ]
12
2019-07-24T11:12:32.000Z
2022-02-11T14:00:41.000Z
const path = require('path'); const Mocha = require('mocha'); const glob = require('glob'); function run() { // Create the mocha test const mocha = new Mocha({ ui: 'tdd' }); // Use any mocha API mocha.useColors(true); return new Promise((c, e) => { glob('**/**.test.js', { cwd: testsRoot }, (err, files) => { if (err) { return e(err); } // Add files to the test suite files.forEach(f => mocha.addFile(path.resolve(testsRoot, f))); try { // Run the mocha test mocha.run(failures => { if (failures > 0) { e(new Error(`${failures} tests failed.`)); } else { c(); } }); } catch (err) { e(err); } }); }); } module.exports = { run };
17.439024
65
0.535664
b5195f2ef00a242fc2a449366ce3fad401acd0d5
516
js
JavaScript
Chapter02/mapping-collections-to-elements/src/index.js
NeIbrahim/React-and-React-Native---Third-Edition
aca40085902d2cac93e55c1dd35d71a897991194
[ "MIT" ]
79
2020-01-13T07:25:08.000Z
2022-03-14T08:53:00.000Z
Chapter02/mapping-collections-to-elements/src/index.js
NeIbrahim/React-and-React-Native---Third-Edition
aca40085902d2cac93e55c1dd35d71a897991194
[ "MIT" ]
24
2019-10-09T12:57:42.000Z
2021-11-23T18:11:20.000Z
Chapter02/mapping-collections-to-elements/src/index.js
NeIbrahim/React-and-React-Native---Third-Edition
aca40085902d2cac93e55c1dd35d71a897991194
[ "MIT" ]
81
2019-10-01T16:14:27.000Z
2022-03-27T18:00:52.000Z
import React from 'react'; import { render } from 'react-dom'; const array = ['First', 'Second', 'Third']; const object = { first: 1, second: 2, third: 3 }; render( <section> <h1>Array</h1> <ul> {array.map(i => ( <li key={i}>{i}</li> ))} </ul> <h1>Object</h1> <ul> {Object.keys(object).map(i => ( <li key={i}> <strong>{i}: </strong> {object[i]} </li> ))} </ul> </section>, document.getElementById('root') );
15.636364
43
0.463178
6ff1bc8d29bc7c775a7bf264eb62454168ecfc5f
3,504
js
JavaScript
frontend/src/ui/authentication/hardware-wallet-selector-view.js
stellar-expert/albedo
4213025977a543f6e151edec6abef7a18136c626
[ "MIT" ]
47
2020-02-25T20:10:50.000Z
2022-03-15T06:01:21.000Z
frontend/src/ui/authentication/hardware-wallet-selector-view.js
stellar-expert/albedo
4213025977a543f6e151edec6abef7a18136c626
[ "MIT" ]
37
2020-04-17T02:27:26.000Z
2022-03-19T10:50:15.000Z
frontend/src/ui/authentication/hardware-wallet-selector-view.js
stellar-expert/albedo
4213025977a543f6e151edec6abef7a18136c626
[ "MIT" ]
6
2020-03-08T21:03:05.000Z
2021-12-04T09:22:46.000Z
import React, {Component} from 'react' import PropTypes from 'prop-types' import cn from 'classnames' import {Button} from '@stellar-expert/ui-framework' import AlbedoSigner from '../../hw-signer/hw-signer' import {ACCOUNT_TYPES} from '../../state/account' import appSettings from '../../state/app-settings' import {extractDeviceId} from '../../util/device-id-generator' import './hw-selector.scss' class HardwareWalletSelectorView extends Component { state = { isDefaultPath: true, path: '', accountType: undefined } static propTypes = { requirePublicKey: PropTypes.bool, onConfirm: PropTypes.func.isRequired } async connect(event) { const {path, accountType} = this.state this.setState({inProgress: true}) const signer = new AlbedoSigner(accountType) await signer.init({ appManifest: appSettings.appManifest }) const pubkey = await signer.getPublicKey({path}) const result = { id: extractDeviceId(pubkey), path, type: accountType, publicKey: this.props.requirePublicKey ? pubkey : undefined } //TODO: handle errors this.props.onConfirm(result) } setHardwareWalletType(type) { this.setState({ accountType: type, path: `m/44'/148'/0'` }) } renderPathSelector() { const {isDefaultPath, path, accountType} = this.state if (!accountType) return return <div className="space"> <label style={{display: 'inline'}}> <input type="checkbox" checked={isDefaultPath} onChange={() => this.setState({isDefaultPath: !isDefaultPath})}/> Use default BIP 44 path </label>&emsp; {!isDefaultPath && <input type="text" value={path} style={{width: '10em'}} onChange={e => this.setState({path: e.target.value})}/>} <Button onClick={() => this.connect()}>Connect</Button> <div className="dimmed text-small"> Make sure you connected the hardware wallet and follow the instructions on the display of your device. </div> </div> } render() { const {accountType} = this.state return <div className="hw-selector"> <div className="row"> <div className="column column-50 column-offset-25"> <a href="#" id="ledger-signup" title="Ledger Nano" className={cn('button button-block keypair-selector-option', {'button-outline': accountType !== ACCOUNT_TYPES.LEDGER_ACCOUNT})} onClick={() => this.setHardwareWalletType(ACCOUNT_TYPES.LEDGER_ACCOUNT)}> <img src="/img/vendor/ledger.svg"/> </a> </div> {/*<div className="column column-50"> <a href="#" id="trezor-signup" title="Trezor" className={cn('button button-block keypair-selector-option', {'button-outline': accountType !== ACCOUNT_TYPES.TREZOR_ACCOUNT})} onClick={() => this.setHardwareWalletType(ACCOUNT_TYPES.TREZOR_ACCOUNT)}> <img src="/img/vendor/trezor.svg"/> </a> </div>*/} </div> {this.renderPathSelector()} </div> } } export default HardwareWalletSelectorView
37.677419
150
0.566781
6fee90dcab7bc50f9cf6a9f5990aaac7719d0e7a
25,508
js
JavaScript
dist/modules/grid.grouping.js
fabiofsilva/jqGrid
b954ab2ed20e97dab20eb36e5c9fa926fe4b42f5
[ "MIT" ]
504
2015-02-10T18:42:13.000Z
2022-03-17T16:57:29.000Z
dist/modules/grid.grouping.js
fabiofsilva/jqGrid
b954ab2ed20e97dab20eb36e5c9fa926fe4b42f5
[ "MIT" ]
494
2015-02-10T16:12:12.000Z
2022-02-20T07:00:27.000Z
dist/modules/grid.grouping.js
fabiofsilva/jqGrid
b954ab2ed20e97dab20eb36e5c9fa926fe4b42f5
[ "MIT" ]
261
2015-02-11T16:38:47.000Z
2022-03-27T17:46:28.000Z
/*jshint eqeqeq:false, eqnull:true */ /*global jQuery, define, exports, module, require */ /*jslint plusplus: true, unparam: true, eqeq: true, nomen: true, todo: true, continue: true */ // Grouping module (function (factory) { "use strict"; if (typeof define === "function" && define.amd) { // AMD. Register as an anonymous module. define([ "jquery", "./grid.base" ], factory); } else if (typeof module === "object" && module.exports) { // Node/CommonJS module.exports = function (root, $) { if (!root) { root = window; } if ($ === undefined) { // require("jquery") returns a factory that requires window to // build a jQuery instance, we normalize how we use modules // that require this pattern but the window provided is a noop // if it's defined (how jquery works) $ = typeof window !== "undefined" ? require("jquery") : require("jquery")(root); } require("./grid.base"); factory($); return $; }; } else { // Browser globals factory(jQuery); } }(function ($) { "use strict"; var jgrid = $.jgrid, base = $.fn.jqGrid; // begin module grid.grouping jgrid.extend({ groupingSetup: function () { return this.each(function () { var $t = this, i, j, cml, p = $t.p, colModel = p.colModel, grp = p.groupingView, cm, summary, emptyFormatter = function () { return ""; }; if (grp !== null && ((typeof grp === "object") || $.isFunction(grp))) { if (!grp.groupField.length) { p.grouping = false; } else { if (grp.visibiltyOnNextGrouping === undefined) { grp.visibiltyOnNextGrouping = []; } grp.lastvalues = []; if (!grp._locgr) { grp.groups = []; } grp.counters = []; for (i = 0; i < grp.groupField.length; i++) { if (!grp.groupOrder[i]) { grp.groupOrder[i] = "asc"; } if (!grp.groupText[i]) { grp.groupText[i] = "{0}"; } if (typeof grp.groupColumnShow[i] !== "boolean") { grp.groupColumnShow[i] = true; } if (typeof grp.groupSummary[i] !== "boolean") { grp.groupSummary[i] = false; } if (!grp.groupSummaryPos[i]) { grp.groupSummaryPos[i] = "footer"; } // TODO: allow groupField be from additionalProperties // and not only from colModel cm = colModel[p.iColByName[grp.groupField[i]]]; if (grp.groupColumnShow[i] === true) { grp.visibiltyOnNextGrouping[i] = true; if (cm != null && cm.hidden === true) { base.showCol.call($($t), grp.groupField[i]); } } else { grp.visibiltyOnNextGrouping[i] = $("#" + jgrid.jqID(p.id + "_" + grp.groupField[i])).is(":visible"); if (cm != null && cm.hidden !== true) { base.hideCol.call($($t), grp.groupField[i]); } } } grp.summary = []; if (grp.hideFirstGroupCol) { grp.formatDisplayField[0] = function (v) { return v; }; } for (j = 0, cml = colModel.length; j < cml; j++) { cm = colModel[j]; if (grp.hideFirstGroupCol) { if (!cm.hidden && grp.groupField[0] === cm.name) { cm.formatter = emptyFormatter; } } if (cm.summaryType) { summary = { nm: cm.name, st: cm.summaryType, v: "", sr: cm.summaryRound, srt: cm.summaryRoundType || "round" }; if (cm.summaryDivider) { summary.sd = cm.summaryDivider; summary.vd = ""; } grp.summary.push(summary); } } } } else { p.grouping = false; } }); }, groupingPrepare: function (record, irow) { this.each(function () { var $t = this, p = $t.p, grp = p.groupingView, groups = grp.groups, counters = grp.counters, lastvalues = grp.lastvalues, isInTheSameGroup = grp.isInTheSameGroup, groupLength = grp.groupField.length, i, j, keys, newGroup, counter, fieldName, v, displayName, displayValue, changed = false, groupingCalculationsHandler = base.groupingCalculations.handler, key, buildSummary = function () { var iSummary, summary, st; for (iSummary = 0; iSummary < counter.summary.length; iSummary++) { summary = counter.summary[iSummary]; st = $.isArray(summary.st) ? summary.st[newGroup.idx] : summary.st; if ($.isFunction(st)) { summary.v = st.call($t, summary.v, summary.nm, record, newGroup); } else { summary.v = groupingCalculationsHandler.call($($t), st, summary.v, summary.nm, summary.sr, summary.srt, record); if (st.toLowerCase() === "avg" && summary.sd) { summary.vd = groupingCalculationsHandler.call($($t), st, summary.vd, summary.sd, summary.sr, summary.srt, record); } } } return counter.summary; }, normilizeValue = function (value, cmOrPropName) { if (value == null && grp.useDefaultValuesOnGrouping) { var cm = p.iColByName[cmOrPropName] !== undefined ? p.colModel[p.iColByName[cmOrPropName]] : p.additionalProperties[p.iPropByName[cmOrPropName]], defaultValue; if (cm != null && cm.formatter != null) { if (cm.formatoptions != null && cm.formatoptions.defaultValue !== undefined) { value = cm.formatoptions.defaultValue; } else if (typeof cm.formatter === "string") { defaultValue = $($t).jqGrid("getGridRes", "formatter." + cm.formatter + ".defaultValue"); if (defaultValue !== undefined) { value = defaultValue; } } } } return value; }; for (i = 0; i < groupLength; i++) { fieldName = grp.groupField[i]; v = normilizeValue(record[fieldName], fieldName); key = v; displayName = grp.displayField[i]; displayValue = displayName == null ? null : normilizeValue(record[displayName], displayName); if (displayValue == null) { displayValue = v; } if (v !== undefined) { keys = []; for (j = 0; j <= i; j++) { keys.push(record[grp.groupField[j]]); } newGroup = { idx: i, // index in grp.groupField array dataIndex: fieldName, value: v, displayValue: displayValue, startRow: irow, cnt: 1, keys: keys, summary: [] }; counter = { cnt: 1, pos: groups.length, summary: $.extend(true, [], grp.summary) }; if (irow === 0) { // First record always starts a new group groups.push(newGroup); lastvalues[i] = v; counters[i] = counter; } else { if (typeof v !== "object" && ($.isArray(isInTheSameGroup) && $.isFunction(isInTheSameGroup[i]) ? !isInTheSameGroup[i].call($t, lastvalues[i], v, i, grp) : lastvalues[i] !== v)) { // This record is not in same group as previous one groups.push(newGroup); lastvalues[i] = v; changed = true; counters[i] = counter; } else { if (changed) { // This group has changed because an earlier group changed. groups.push(newGroup); lastvalues[i] = v; counters[i] = counter; } else { counter = counters[i]; counter.cnt += 1; groups[counter.pos].cnt = counter.cnt; } } } groups[counter.pos].summary = buildSummary(); for (j = counter.pos - 1; j >= 0; j--) { // find the parent group (the grouping header) if (groups[j].idx < groups[counter.pos].idx) { groups[counter.pos].parentGroupIndex = j; groups[counter.pos].parentGroup = groups[j]; break; } } } } //gdata.push( rData ); }); return this; }, getGroupHeaderIndex: function (hid, clickedElem) { var $self = this, self = $self[0], p = self.p, $tr = clickedElem ? $(clickedElem).closest("tr.jqgroup") : $("#" + jgrid.jqID(hid)), groupLevel = parseInt($tr.data("jqgrouplevel"), 10), hPrefix = p.id + "ghead_" + groupLevel + "_"; if (isNaN(groupLevel) || !$tr.hasClass("jqgroup") || hid.length <= hPrefix.length) { return -1; } return parseInt(hid.substring(hPrefix.length), 10); }, groupingToggle: function (hid, clickedElem) { this.each(function () { var $t = this, p = $t.p, grp = p.groupingView, minusClasses = grp.minusicon, plusClasses = grp.plusicon, $tr = clickedElem ? $(clickedElem).closest("tr.jqgroup") : $("#" + jgrid.jqID(hid)), getGroupHeaderIcon = function ($trElem) { return $trElem.find(">td>span." + "tree-wrap"); }, itemGroupingLevel, iRowStart, showDataRowsOnExpending = true, $groupIcon, collapsed = false, rowsToHideOrShow = [], addToHideOrShow = function ($elem) { var i, l = $elem.length; for (i = 0; i < l; i++) { rowsToHideOrShow.push($elem[i]); } }, num = parseInt($tr.data("jqgrouplevel"), 10); if (p.frozenColumns && $tr.length > 0) { // always get row from non-frozen column iRowStart = $tr[0].rowIndex; $tr = $($t.rows[iRowStart]); $tr = $tr.add($t.grid.fbRows[iRowStart]); } $groupIcon = getGroupHeaderIcon($tr); if (jgrid.hasAllClasses($groupIcon, minusClasses)) { $groupIcon.removeClass(minusClasses).addClass(plusClasses); collapsed = true; } else { $groupIcon.removeClass(plusClasses).addClass(minusClasses); } for ($tr = $tr.next(); $tr.length; $tr = $tr.next()) { if ($tr.hasClass("jqfoot")) { itemGroupingLevel = parseInt($tr.data("jqfootlevel"), 10); if (collapsed) { // hide all till the summary row of the same level. // don't hide the summary row if grp.showSummaryOnHide === true itemGroupingLevel = parseInt($tr.data("jqfootlevel"), 10); if ((!grp.showSummaryOnHide && itemGroupingLevel === num) || itemGroupingLevel > num) { addToHideOrShow($tr); } // stop hiding of rows if the footer of parent group are found if (itemGroupingLevel < num) { break; } } else { if (itemGroupingLevel === num || (grp.showSummaryOnHide && itemGroupingLevel === num + 1)) { addToHideOrShow($tr); } if (itemGroupingLevel <= num) { break; } } } else if ($tr.hasClass("jqgroup")) { itemGroupingLevel = parseInt($tr.data("jqgrouplevel"), 10); if (collapsed) { // stop hiding of rows if the grouping header of the next group // of the same (or higher) level are found if (itemGroupingLevel <= num) { break; } addToHideOrShow($tr); } else { // stop next grouping header of the same lever are found if (itemGroupingLevel <= num) { break; } if (itemGroupingLevel === num + 1) { // one should display subgroupes in collaped form getGroupHeaderIcon($tr).removeClass(minusClasses).addClass(plusClasses); addToHideOrShow($tr); } // one need hide all data if subgroup is found showDataRowsOnExpending = false; } } else { // data // we set currently no information about the level of data // se we use showDataRowsOnExpending variable which will be // used during expanding of data if (collapsed || showDataRowsOnExpending) { // grouping data need be displayed only // if the last level group with data (no subgroups) // is expanded addToHideOrShow($tr); } } } //$(rowsToHideOrShow)[collapsed ? "hide" : "show"](); $(rowsToHideOrShow).css("display", collapsed ? "none" : ""); // fix position of elements of frozen divs if (p.frozenColumns) { $($t).triggerHandler("jqGridResetFrozenHeights", [{ header: { resizeDiv: false, resizedRows: { iRowStart: -1, // -1 means don't recalculate heights or rows iRowEnd: -1 } }, resizeFooter: false, body: { resizeDiv: true, resizedRows: { iRowStart: iRowStart, iRowEnd: ($tr.length ? $tr[0].rowIndex - 1 : -1) } } }]); } // recalculate the width because vertical scrollbar can // appears/disappears after expanding/collapsing $t.fixScrollOffsetAndhBoxPadding(); $($t).triggerHandler("jqGridGroupingClickGroup", [hid, collapsed]); if ($.isFunction(p.onClickGroup)) { p.onClickGroup.call($t, hid, collapsed); } }); return false; }, groupingRender: function (grdata, rn) { // input parameter grdata is array of strings, which are either opening <tr> element // or full HTML fragment (outer HTML) of <td> element, inclusive the closing tag </td> // or it contains the closing </tr> tag. The array grdata contains HTML fragments // of all rows from the current group. // The exact contain of the grdata is the following: // "<tr ...>" - the opening tag of the first row of the group // "<td>...</td>" - the irst cell of the first row // "<td>...</td>" - the second cell of the first row // ... // "<td>...</td>" - the last cell of the first row // "</tr>" - closing tag of the first row of the group // "<tr ...>" - the opening tag of the second row of the group // ... - all <td> elements of the second row // "</tr>" - closing tag of the second row of the group // ... // "<tr ...>" - the opening tag of the last row of the group // ... - all <td> elements of the last row // "</tr>" - closing tag of the last row of the group // The input parameter rn corresponds to p.rowNum in the most cases. var str = "", $t = this[0], p = $t.p, toEnd = 0, cp = [], grp = p.groupingView, sumreverse = $.makeArray(grp.groupSummary), groupLength = grp.groupField.length, groups = grp.groups, colModel = p.colModel, cmLength = colModel.length, page = p.page, eventNames = "jqGridShowHideCol.groupingRender", getGridRowStyles = function (classes) { return base.getGuiStyles.call($t, "gridRow", classes); }, jqgroupClass = getGridRowStyles("jqgroup ui-row-" + p.direction), jqfootClass = getGridRowStyles("jqfoot ui-row-" + p.direction); function buildSummaryTd(iEndGroup, offset, g, foffset, iconHtml) { var fdata = groups[iEndGroup], i, groupCount, strTd = "", tmpdata, colSpan, align, vv, madeHidden, nMakeHidden = 0, iSummary, summary, cm, iCol, summaryType, summaryTpl, isColumnForIconNotFound = true; if (offset !== 0 && groups[iEndGroup].idx !== 0) { for (i = iEndGroup; i >= 0; i--) { if (groups[i].idx === groups[iEndGroup].idx - offset) { fdata = groups[i]; break; } } } groupCount = fdata.cnt; for (iCol = (iconHtml === undefined ? foffset : 0); iCol < cmLength; iCol++) { tmpdata = "&#160;"; cm = colModel[iCol]; for (iSummary = 0; iSummary < fdata.summary.length; iSummary++) { summary = fdata.summary[iSummary]; summaryType = $.isArray(summary.st) ? summary.st[g.idx] : summary.st; summaryTpl = $.isArray(cm.summaryTpl) ? cm.summaryTpl[g.idx] : (cm.summaryTpl || "{0}"); if (summary.nm === cm.name) { if (typeof summaryType === "string" && summaryType.toLowerCase() === "avg") { if (summary.sd && summary.vd) { summary.v = (summary.v / summary.vd); } else if (summary.v && groupCount > 0) { summary.v = (summary.v / groupCount); } } try { summary.groupCount = fdata.cnt; summary.groupIndex = fdata.dataIndex; summary.groupValue = fdata.value; vv = $t.formatter("", summary.v, iCol, summary); } catch (ef) { vv = summary.v; } tmpdata = jgrid.format(summaryTpl, vv); if (cm.summaryFormat) { tmpdata = cm.summaryFormat.call($t, g, tmpdata, vv, cm, summary); } break; } } colSpan = false; align = false; if (iconHtml !== undefined && isColumnForIconNotFound) { if (!cm.hidden) { // the icon need be placed in the first non-hidden column tmpdata = iconHtml; isColumnForIconNotFound = false; if (foffset > 1) { colSpan = true; // if foffset > 1 then the next foffset-1 non-hidden columns // must be displayed hidden. nMakeHidden = foffset - 1; } // the icon in the column header must be left aligned align = cm.align; // save the original align value cm.align = p.direction === "rtl" ? "right" : "left"; grp.iconColumnName = cm.name; } } madeHidden = false; if (nMakeHidden > 0 && !cm.hidden && tmpdata === "&#160;") { madeHidden = true; if (align) { cm.align = align; // restore the original align value } nMakeHidden--; continue; } strTd += "<td role='gridcell' " + $t.formatCol(iCol, 1, "") + (colSpan ? "colspan='" + foffset + "'" : "") + ">" + tmpdata + "</td>"; colSpan = false; if (align) { cm.align = align; // restore the original align value } if (madeHidden) { cm.hidden = false; nMakeHidden--; } } return strTd; } // TODO: allow groupField be from additionalProperties // and not only from colModel $.each(colModel, function (i, n) { var iGroup; for (iGroup = 0; iGroup < groupLength; iGroup++) { if (grp.groupField[iGroup] === n.name) { cp[iGroup] = i; break; } } }); sumreverse.reverse(); $.each(groups, function (i, n) { var gv, clid = p.id + "ghead_" + n.idx, hid = clid + "_" + i, groupCollapse = $.isFunction(grp.groupCollapse) ? grp.groupCollapse.call($t, { group: n, rowid: hid }) : grp.groupCollapse, jj, kk, ik, colspan = 1, offset = 0, sgr, gg, end, grpTextStr, leaf = groupLength - 1 === n.idx, parentGroupCollapse = n.parentGroup != null ? n.parentGroup.collapsed : false, icon = "<span style='cursor:pointer;margin-" + (p.direction === "rtl" ? "right:" : "left:") + (n.idx * 12) + "px;' class='" + grp.commonIconClass + " " + (groupCollapse ? grp.plusicon : grp.minusicon) + " tree-wrap'></span>"; if (grp._locgr) { if (!(n.startRow + n.cnt > (page - 1) * rn && n.startRow < page * rn)) { return true; } } if (parentGroupCollapse) { groupCollapse = true; } if (groupCollapse !== undefined) { n.collapsed = groupCollapse; } toEnd++; try { if ($.isArray(grp.formatDisplayField) && $.isFunction(grp.formatDisplayField[n.idx])) { n.displayValue = grp.formatDisplayField[n.idx].call($t, n.displayValue, n.value, colModel[cp[n.idx]], n.idx, n, i); gv = n.displayValue; } else { gv = $t.formatter(hid, n.displayValue, cp[n.idx], n.value, n); } } catch (egv) { gv = n.displayValue; } str += "<tr id='" + hid + "' data-jqgrouplevel='" + n.idx + "' " + (groupCollapse && parentGroupCollapse ? "style='display:none;' " : "") + "role='row' class='" + jqgroupClass + " " + clid + "'>"; grpTextStr = $.isFunction(grp.groupText[n.idx]) ? grp.groupText[n.idx].call($t, gv, n.cnt, n.summary) : jgrid.template(grp.groupText[n.idx], gv, n.cnt, n.summary); if (typeof grpTextStr !== "string" && typeof grpTextStr !== "number") { grpTextStr = gv; } if (grp.groupSummaryPos[n.idx] === "header") { colspan = 1; if (colModel[0].name === "cb" || colModel[1].name === "cb") { colspan++; } if (colModel[0].name === "subgrid" || colModel[1].name === "subgrid") { colspan++; } str += buildSummaryTd(i, 0, n, colspan, icon + "<span class='cell-wrapper'>" + grpTextStr + "</span>"); } else { str += "<td role='gridcell' style='padding-left:" + (n.idx * 12) + "px;'" + " colspan='" + cmLength + "'>" + icon + grpTextStr + "</td>"; } str += "</tr>"; if (leaf) { gg = groups[i + 1]; sgr = n.startRow; end = gg !== undefined ? gg.startRow : groups[i].startRow + groups[i].cnt; if (grp._locgr) { offset = (page - 1) * rn; if (offset > n.startRow) { sgr = offset; } } for (kk = sgr; kk < end; kk++) { if (!grdata[kk - offset]) { break; } str += grdata[kk - offset].join(""); } if (grp.groupSummaryPos[n.idx] !== "header") { if (gg !== undefined) { for (jj = 0; jj < grp.groupField.length; jj++) { if (gg.dataIndex === grp.groupField[jj]) { break; } } toEnd = grp.groupField.length - jj; } for (ik = 0; ik < toEnd; ik++) { if (!sumreverse[ik]) { continue; } str += "<tr data-jqfootlevel='" + (n.idx - ik) + (groupCollapse && ((n.idx - ik) > 0 || !grp.showSummaryOnHide) ? "' style='display:none;'" : "'") + " role='row' class='" + jqfootClass + "'>"; str += buildSummaryTd(i, ik, groups[n.idx - ik], 0); str += "</tr>"; } toEnd = jj; } } }); this.off(eventNames) .on(eventNames, function () { //e, show, cmName, iColShow) { // TODO fix the code after resorting columns var iCol = p.iColByName[grp.iconColumnName], iRow, row, iColNew, i; //$cellData; if ($.inArray("header", grp.groupSummaryPos) >= 0) { for (i = 0; i < colModel.length; i++) { if (!colModel[i].hidden) { iColNew = i; break; } } if (iColNew === undefined || iCol === iColNew) { return; } for (iRow = 0; iRow < $t.rows.length; iRow++) { row = $t.rows[iRow]; if ($(row).hasClass("jqgroup")) { /*$cellData = $(row.cells[iCol]).children(".cell-wrapper").detach(); $.wrapInner(row.cells[iColNew], function () {//"<span class='cell-wrapper'></span>"); return "<span class='cell-wrapper'>" + this.nodeValue + "</span>"; }); row.cells[iColNew] $cellData = $(row.cells[iCol]).children(".cell-wrapper").detach(); $(row.cells[iCol]).html($(row.cells[iCol]).children("").html());*/ $(row.cells[iColNew]).html(row.cells[iCol].innerHTML); $(row.cells[iCol]).html("&nbsp;"); } } grp.iconColumnName = colModel[iColNew].name; } }); return str; }, groupingGroupBy: function (name, options) { return this.each(function () { var $t = this, p = $t.p, grp = p.groupingView, i, cm; if (typeof name === "string") { name = [name]; } p.grouping = true; grp._locgr = false; //Set default, in case visibilityOnNextGrouping is undefined if (grp.visibiltyOnNextGrouping === undefined) { grp.visibiltyOnNextGrouping = []; } // show previous hidden groups if they are hidden and weren't removed yet for (i = 0; i < grp.groupField.length; i++) { cm = p.colModel[p.iColByName[grp.groupField[i]]]; if (!grp.groupColumnShow[i] && grp.visibiltyOnNextGrouping[i] && cm != null && cm.hidden === true) { base.showCol.call($($t), grp.groupField[i]); } } // set visibility status of current group columns on next grouping for (i = 0; i < name.length; i++) { grp.visibiltyOnNextGrouping[i] = $(p.idSel + "_" + jgrid.jqID(name[i])).is(":visible"); } p.groupingView = $.extend(p.groupingView, options || {}); grp.groupField = name; $($t).trigger("reloadGrid"); }); }, groupingRemove: function (current) { return this.each(function () { var $t = this, p = $t.p, tbody = $t.tBodies[0], grp = p.groupingView, i; if (current === undefined) { current = true; } p.grouping = false; if (current === true) { // show previous hidden groups if they are hidden and weren't removed yet for (i = 0; i < grp.groupField.length; i++) { if (!grp.groupColumnShow[i] && grp.visibiltyOnNextGrouping[i]) { base.showCol.call($($t), grp.groupField); } } $("tr.jqgroup, tr.jqfoot", tbody).remove(); $("tr.jqgrow", tbody).filter(":hidden").show(); } else { $($t).trigger("reloadGrid"); } }); }, groupingCalculations: { handler: function (fn, v, field, round, roundType, rc) { var funcs = { sum: function () { return parseFloat(v || 0) + parseFloat((rc[field] || 0)); }, min: function () { if (v === "") { return parseFloat(rc[field] || 0); } return Math.min(parseFloat(v), parseFloat(rc[field] || 0)); }, max: function () { if (v === "") { return parseFloat(rc[field] || 0); } return Math.max(parseFloat(v), parseFloat(rc[field] || 0)); }, count: function () { if (v === "") { v = 0; } if (rc.hasOwnProperty(field)) { return v + 1; } return 0; }, avg: function () { // the same as sum, but at end we divide it // so use sum instead of duplicating the code (?) return funcs.sum(); } }, res, mul; if (!funcs[fn]) { throw ("jqGrid Grouping No such method: " + fn); } res = funcs[fn](); if (round != null) { if (roundType === "fixed") { res = res.toFixed(round); } else { mul = Math.pow(10, round); res = Math.round(res * mul) / mul; } } return res; } } }); // end module grid.grouping }));
34.563686
185
0.557433
6feb056debf9dcc9c3324f5bdec5f74cdd66846e
993
js
JavaScript
test/get-ordinal-suffix.test.js
leeb48/stack-overflow-copy-paste
b301cfbe43ee40cd39088d75fac1956da36e38a0
[ "MIT" ]
518
2016-01-20T16:19:50.000Z
2022-03-25T03:14:25.000Z
test/get-ordinal-suffix.test.js
leeb48/stack-overflow-copy-paste
b301cfbe43ee40cd39088d75fac1956da36e38a0
[ "MIT" ]
246
2016-01-23T06:40:45.000Z
2019-02-19T23:03:34.000Z
test/get-ordinal-suffix.test.js
leeb48/stack-overflow-copy-paste
b301cfbe43ee40cd39088d75fac1956da36e38a0
[ "MIT" ]
963
2016-01-26T04:00:22.000Z
2022-03-31T09:37:01.000Z
import test from 'ava' import {getOrdinalSuffix} from '../src' test('appends st, nd, th ordinal suffix to first 10 numbers', t => { const numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] const expected = ['0th', '1st', '2nd', '3rd', '4th', '5th', '6th', '7th', '8th', '9th'] const actual = numbers.map(n => getOrdinalSuffix(n)) t.deepEqual(actual, expected) }) test('appends th ordinal suffix to second 10 numbers', t => { const numbers = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19] const expected = ['10th', '11th', '12th', '13th', '14th', '15th', '16th', '17th', '18th', '19th'] const actual = numbers.map(n => getOrdinalSuffix(n)) t.deepEqual(actual, expected) }) test('appends st, nd, th ordinal suffix to third 10 numbers', t => { const numbers = [20, 21, 22, 23, 24, 25, 26, 27, 28, 29] const expected = ['20th', '21st', '22nd', '23rd', '24th', '25th', '26th', '27th', '28th', '29th'] const actual = numbers.map(n => getOrdinalSuffix(n)) t.deepEqual(actual, expected) })
41.375
99
0.612286
6ff74cc18039276f2f08c57fc100a4bb7918fb14
963
js
JavaScript
code/miniprogram/adminEnd/pages/localPages/ugGoodsInfo/ugGoodsInfo.js
yuhanliu0121/crocodile-delivery
f1a743240a8e85c10a05417d33fd3b989cfe2c7a
[ "MIT" ]
23
2021-05-27T02:07:31.000Z
2022-03-27T23:23:24.000Z
code/miniprogram/adminEnd/pages/localPages/ugGoodsInfo/ugGoodsInfo.js
yuhanliu0121/crocodile-delivery
f1a743240a8e85c10a05417d33fd3b989cfe2c7a
[ "MIT" ]
3
2021-11-17T03:42:00.000Z
2022-02-16T11:49:00.000Z
code/miniprogram/adminEnd/pages/localPages/ugGoodsInfo/ugGoodsInfo.js
yuhanliu0121/crocodile-delivery
f1a743240a8e85c10a05417d33fd3b989cfe2c7a
[ "MIT" ]
5
2021-06-10T11:09:41.000Z
2022-03-17T04:06:22.000Z
const WEIXIN = 0; const MOBILE = 1; const EMAIL = 2; const QQ = 3; Page({ /** * 页面的初始数据 */ data: { goodsInfo: {}, contactTypeText: "", }, shopInfo: {}, /*============== 事务处理函数 ====================*/ /*============== 页面生命周期函数 ====================*/ /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { // 从URL中获取页面数据 let shopInfo = JSON.parse(decodeURIComponent(options.shopInfo)); let goodsInfo = JSON.parse(decodeURIComponent(options.goodsInfo)); this.shopInfo = shopInfo; let contactTypeText; switch (goodsInfo.contactType) { case WEIXIN: contactTypeText = "微信号"; break; case MOBILE: contactTypeText = "手机号"; break; case EMAIL: contactTypeText = "邮箱"; break; case QQ: contactTypeText = "QQ号"; break; } // 初始化页面数据 this.setData({ goodsInfo: goodsInfo, contactTypeText }); }, });
18.519231
70
0.516096
b50db356166602f1677296cb1e24c837cfc01a14
2,962
js
JavaScript
node_modules/@babel/helper-compilation-targets/node_modules/caniuse-lite/data/regions/WF.js
fracturesfei/angulardemo
7cb8ef6f9139d84f98034488f520a70215fb4375
[ "MIT" ]
48
2020-10-16T11:51:53.000Z
2022-03-28T11:21:21.000Z
node_modules/@babel/helper-compilation-targets/node_modules/caniuse-lite/data/regions/WF.js
fracturesfei/angulardemo
7cb8ef6f9139d84f98034488f520a70215fb4375
[ "MIT" ]
31
2020-05-22T16:59:58.000Z
2022-02-13T05:49:29.000Z
node_modules/@babel/helper-compilation-targets/node_modules/caniuse-lite/data/regions/WF.js
fracturesfei/angulardemo
7cb8ef6f9139d84f98034488f520a70215fb4375
[ "MIT" ]
30
2020-09-30T17:03:37.000Z
2022-03-14T19:08:48.000Z
module.exports={D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0.015885,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0.015885,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0.015885,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0.047655,"74":0,"75":0.047655,"76":0.06354,"77":0.015885,"78":2.47806,"79":1.375641,"80":0,"81":0},C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0.015885,"48":0,"49":0,"50":0,"51":0,"52":0.015885,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0.079425,"61":0,"62":0,"63":0,"64":0.06354,"65":0,"66":0,"67":0,"68":0.616338,"69":0,"70":0.85779,"71":1.296216,"72":0,"73":0,"3.5":0,"3.6":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"60":0,"62":0,"63":0,"64":0,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0.371709,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0.162027},G:{"8":0.0013711914191419,"3.2":0.0054847656765677,"4.0-4.1":0.0027423828382838,"4.2-4.3":0,"5.0-5.1":0.0082271485148515,"6.0-6.1":0.0027423828382838,"7.0-7.1":0.0095983399339934,"8.1-8.4":0.017825488448845,"9.0-9.2":0.016454297029703,"9.3":0.17414131023102,"10.0-10.2":0.060332422442244,"10.3":0.19470918151815,"11.0-11.2":0.16454297029703,"11.3-11.4":0.29343496369637,"12.0-12.1":0.41958457425743,"12.2-12.4":2.9700006138614,"13.0-13.1":4.3123970132013,"13.2":1.9635461122112,"13.3":3.0934078415842},I:{"3":0.0070139084507042,"4":0.030393603286385,_:"76","2.1":0,"2.2":0.0046759389671361,"2.3":0.0046759389671361,"4.1":0.053773298122066,"4.2-4.3":1.1759986502347,"4.4":0,"4.4.3-4.4.4":0.71541866197183},P:{"4":0.058870527597403,"5.0-5.4":0.17661158279221,"6.2-6.4":0.11774105519481,"7.2-7.4":0.058870527597403,"8.2":0.058870527597403,"9.2":0.058870527597403,"10.1":6.7230142516234},B:{"12":0,"13":0,"14":0,"15":0,"16":0,"17":0.047655,"18":0.454311,_:"76"},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"5.5":0},N:{"10":0,"11":0},J:{"7":0,"10":0},R:{_:"0"},M:{"0":0.061407},O:{"0":0.122814},Q:{"1.2":0},S:{"2.5":0},H:{"0":0},L:{"0":66.472116}};
1,481
2,961
0.528359
6ff1f091cb9074c7374f587c268dadbc3fc17f28
537
js
JavaScript
node_modules/@nestjs/graphql/dist/decorators/scalar.decorator.js
kkk0908/shipit-api-server-final
fe92222015353bf09bc48248a48f91ef09029cf9
[ "OML" ]
null
null
null
node_modules/@nestjs/graphql/dist/decorators/scalar.decorator.js
kkk0908/shipit-api-server-final
fe92222015353bf09bc48248a48f91ef09029cf9
[ "OML" ]
null
null
null
node_modules/@nestjs/graphql/dist/decorators/scalar.decorator.js
kkk0908/shipit-api-server-final
fe92222015353bf09bc48248a48f91ef09029cf9
[ "OML" ]
null
null
null
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Scalar = void 0; const common_1 = require("@nestjs/common"); const graphql_constants_1 = require("../graphql.constants"); function Scalar(name, typeFunc) { return (target, key, descriptor) => { (0, common_1.SetMetadata)(graphql_constants_1.SCALAR_NAME_METADATA, name)(target, key, descriptor); (0, common_1.SetMetadata)(graphql_constants_1.SCALAR_TYPE_METADATA, typeFunc)(target, key, descriptor); }; } exports.Scalar = Scalar;
41.307692
111
0.726257
b515e79be265b5859969c256bc00ac15b3b58bbe
800
js
JavaScript
router.js
nstratis/nodejsexpress
c5aefd57209c29d7ddcb2f10e911e2b2344ddf3f
[ "FSFAP" ]
null
null
null
router.js
nstratis/nodejsexpress
c5aefd57209c29d7ddcb2f10e911e2b2344ddf3f
[ "FSFAP" ]
null
null
null
router.js
nstratis/nodejsexpress
c5aefd57209c29d7ddcb2f10e911e2b2344ddf3f
[ "FSFAP" ]
null
null
null
/* global */ /* eslint no-plusplus:0 */ /** * @copyright (c) Copyright 2017 AV Digital Media Ltd. All Rights Reserved. * No unauthorized copying, distribution or modification to this code in whole * or in part is permitted without the express permission of * AV Digital Media Ltd (UK). */ // Set the reference to the index controller const indexCon = require('./controllers/index.controller'), userCon = require('./controllers/userdetails.controllers'); // Export the routes module.exports = (authApp) => { // Set the route to the index page authApp.get('/', indexCon.index); // Set the route to the userdetails page authApp.get('/userdetails', userCon.userdetails); authApp.use('/invalid', (req, res, next) => { console.warn(req, res, next); res.render('invalid'); }); };
32
78
0.695
6fe9e27cbce170e4ab4121378c46f0d0b9c9e87f
526
js
JavaScript
src/components/DynamicComponent.js
AlexanderKulemin/gatsby
f1dd098ff9602ea4299fc1a898dc44b35633906e
[ "RSA-MD" ]
null
null
null
src/components/DynamicComponent.js
AlexanderKulemin/gatsby
f1dd098ff9602ea4299fc1a898dc44b35633906e
[ "RSA-MD" ]
null
null
null
src/components/DynamicComponent.js
AlexanderKulemin/gatsby
f1dd098ff9602ea4299fc1a898dc44b35633906e
[ "RSA-MD" ]
null
null
null
import React from 'react' import Teaser from './Teaser' import Feature from './Feature' import Grid from './Grid' import Placeholder from './Placeholder' const Components = { 'teaser': Teaser, 'feature': Feature, 'grid': Grid } const Component = ({blok}) => { if (typeof Components[blok.component] !== 'undefined') { const Component = Components[blok.component] return <Component blok={blok} /> } return blok.component ? <Placeholder componentName={blok.component}/> : null } export default Component
25.047619
78
0.693916
b50fe699fc1736a6ef3b2d666783e6f1b94548d7
4,584
js
JavaScript
src/pages/{ContentfulRecepies.title}.js
waqas973/RecipesSiteUsingGatsby
09d831aeecbfa8403dc3bb321c1d11ef543b738e
[ "RSA-MD" ]
null
null
null
src/pages/{ContentfulRecepies.title}.js
waqas973/RecipesSiteUsingGatsby
09d831aeecbfa8403dc3bb321c1d11ef543b738e
[ "RSA-MD" ]
null
null
null
src/pages/{ContentfulRecepies.title}.js
waqas973/RecipesSiteUsingGatsby
09d831aeecbfa8403dc3bb321c1d11ef543b738e
[ "RSA-MD" ]
null
null
null
import React from 'react'; import {graphql, Link} from 'gatsby'; import { GatsbyImage,getImage } from 'gatsby-plugin-image'; import Layout from '../Components/Layout'; import slugify from 'slugify'; import SEO from '../Components/SEO'; const RecipeTemplate = ({data}) => { let {title ,cookTime , content , prepTime ,servings ,description : {description} ,image } = data.contentfulRecepies; let pathToImage = getImage(image); let {tags,tools,instructions,ingredients} = content; // console.log(content.ingredients); return ( <Layout> <SEO title={title} /> <main className='page'> <div className='recipe=page'> <section className='recipe-hero'> <GatsbyImage image={pathToImage} alt={title} className='about-img' /> <article className='recipe-info'> <h2>{title}</h2> <p>{description}</p> <div className='recipe-icons'> <article> {/* <BsClockHistory /> */} {/* <BsClock /> */} <h5>prep Time</h5> <p>{prepTime}min.</p> </article> <article> <h5>cook Time</h5> <p>{cookTime}min.</p> </article> <article> <h5>servings</h5> <p>{servings}</p> </article> </div> <p className='recipe-tags'> Tags : { tags.map((tag,index) =>{ const slug = slugify(tag,{lower:true}); return ( <Link to={`/${slug}`} key={index} >{tag}</Link> ) }) } </p> </article> </section> <section className='recipe-content'> <article > <h4>instructions</h4> { instructions.map((item,index)=>{ return <div key={index} className='single-instruction'> <header> <p>step {index + 1}</p> <div></div> </header> <p>{item}</p> </div> }) } </article> <article className='second-column'> <div> <h4>ingredients</h4> { ingredients.map((item,index)=>{ return ( <p key={index} className='single-ingredient'> {item} </p> ) }) } </div> <div> <h4>Tools</h4> { tools.map((item,index)=>{ return ( <p key={index} className='single-tool'> {item} </p> ) }) } </div> </article> </section> </div> </main> </Layout> ) } export const query = graphql` query getSingleReceipe($title: String) { contentfulRecepies(title: {eq: $title}) { title cookTime content { instructions tags tools ingredients } description { description } image { gatsbyImageData(layout: CONSTRAINED, placeholder: TRACED_SVG) } prepTime servings } } `; export default RecipeTemplate
37.884298
121
0.324389
b51600d4c1de3e91ccaca48cbaa7f73a8a9584b6
2,098
js
JavaScript
gatsby-config.js
gunslingerOP/restaurant
51953bdc9a8b467315b32fc6c2c7da14a813e261
[ "RSA-MD" ]
null
null
null
gatsby-config.js
gunslingerOP/restaurant
51953bdc9a8b467315b32fc6c2c7da14a813e261
[ "RSA-MD" ]
null
null
null
gatsby-config.js
gunslingerOP/restaurant
51953bdc9a8b467315b32fc6c2c7da14a813e261
[ "RSA-MD" ]
null
null
null
const path = require(`path`) module.exports = { siteMetadata: { title: `Saj Al-reef`, description: `The best saj you can find`, author: `Hasan Aqeel Yahya`, }, plugins: [ `gatsby-plugin-react-helmet`, `gatsby-plugin-image`, "react-burger-menu", "react-reveal", "hamburger-react", { resolve: `gatsby-source-filesystem`, options: { path: `${__dirname}/locales`, name: `locale`, }, }, { resolve: `gatsby-source-filesystem`, options: { path: path.join(__dirname, `src`, `images`), }, }, `gatsby-transformer-sharp`, `gatsby-plugin-sharp`, "react-i18next", "i18next", { resolve: `gatsby-plugin-manifest`, options: { name: `gatsby-starter-default`, short_name: `starter`, start_url: `/`, background_color: `#663399`, // This will impact how browsers show your PWA/website // https://css-tricks.com/meta-theme-color-and-trickery/ // theme_color: `#663399`, display: `minimal-ui`, icon: `src/images/sajfavi.jpg`, // This path is relative to the root of the site. }, }, { resolve: `gatsby-plugin-react-i18next`, options: { localeJsonSourceName: `locale`, languages: [`en`, `ar`], defaultLanguage: `en`, siteUrl: `http://localhost:8000/`, i18nextOptions: { interpolation: { escapeValue: false, }, keySeparator: false, nsSeparator: false, }, pages: [ { matchPath: "/:lang?/blog/:uid", getLanguageFromPath: true, excludeLanguages: ["es"], }, { matchPath: "/preview", languages: ["en", "ar"], }, ], }, }, `gatsby-plugin-sass`, "eslint-plugin-react-hooks", // this (optional) plugin enables Progressive Web App + Offline functionality // To learn more, visit: https://gatsby.dev/offline // `gatsby-plugin-offline`, ], }
26.225
89
0.531935
b50f3794e13a1551662737f1b67cf4ac83b806b9
1,035
js
JavaScript
src/dao/user.js
solitaryMahatma/daigou
540cf5eb74a3fc651adb09fcf0f8a529b8a26d5c
[ "AFL-3.0" ]
null
null
null
src/dao/user.js
solitaryMahatma/daigou
540cf5eb74a3fc651adb09fcf0f8a529b8a26d5c
[ "AFL-3.0" ]
null
null
null
src/dao/user.js
solitaryMahatma/daigou
540cf5eb74a3fc651adb09fcf0f8a529b8a26d5c
[ "AFL-3.0" ]
null
null
null
const bcrypt = require('bcryptjs') const { UserModel } = require('../models/user') const {sign} = require('../token/index') class UserDao extends UserModel { static async signUp (userInfo) { const user = await this.findOne({ where: { phoneNumber: userInfo.phoneNumber } }) if (user) { throw new global.Ex.AuthFail({ errMsg: '手机号已存在', errCode: 20100 }) } await this.create(userInfo) } static async signIn (accoutPwd) { const user = await this.findOne({ where: { phoneNumber: accoutPwd.phoneNumber } }) if (!user) { throw new global.Ex.AuthFail({ errMsg: '手机号不存在啊', errCode: 20000 }) }; const corrPwd = bcrypt.compareSync(accoutPwd.password, user.password) if (!corrPwd) { throw new global.Ex.AuthFail({ errMsg: '密码不正确', errCode: 202000 }) } const {id, nickName,phoneNumber, email,avatar,name} = user return sign({id, nickName,phoneNumber, email,avatar,name}) } } module.exports = UserDao
26.538462
86
0.619324
b50a8e3c8bb7843362b825dc6fa6f35af17b3f63
2,170
js
JavaScript
app/dashboard/routes/settings/save/format.js
abraxasllc/Blot
03448f673b4da6487af5051d1c76d56c9c8cdc99
[ "CC0-1.0" ]
1
2019-10-30T01:03:58.000Z
2019-10-30T01:03:58.000Z
app/dashboard/routes/settings/save/format.js
abraxasllc/Blot
03448f673b4da6487af5051d1c76d56c9c8cdc99
[ "CC0-1.0" ]
null
null
null
app/dashboard/routes/settings/save/format.js
abraxasllc/Blot
03448f673b4da6487af5051d1c76d56c9c8cdc99
[ "CC0-1.0" ]
null
null
null
var Blog = require("blog"); var helper = require("helper"); var formJSON = helper.formJSON; var extend = helper.extend; module.exports = function(req, res, next) { try { req.updates = formJSON(req.body, Blog.scheme.TYPE); } catch (e) { return next(e); } if (req.body.hasMenu) { req.updates.menu = req.updates.menu || []; for (var i in req.updates.menu) { for (var x in req.blog.menu) { if (req.blog.menu[x].id === req.updates.menu[i].id) { extend(req.updates.menu[i]).and(req.blog.menu[x]); } } } } // If the user has specified a custom permalink format // then use it as the blog's permalink format. if ( req.updates.permalink && !req.updates.permalink.format && req.updates.permalink.custom ) { req.updates.permalink.format = req.updates.permalink.custom; req.updates.permalink.isCustom = true; } else if (req.updates.permalink && req.updates.permalink.format) { req.updates.permalink.isCustom = false; } if (req.updates.plugins) { // this bullshit below is because I haven't properly declared // the model for blog.plugins so formJSON needs a little help... for (var i in req.updates.plugins) { req.updates.plugins[i].enabled = req.updates.plugins[i].enabled === "on"; if (!req.updates.plugins[i].options) req.updates.plugins[i].options = {}; } if (req.updates.plugins.typeset) { for (var x in req.updates.plugins.typeset.options) req.updates.plugins.typeset.options[x] = req.updates.plugins.typeset.options[x] === "on"; } extend(req.updates.plugins).and(req.blog.plugins); // We mpdify the analytics settings after the extend function because // the extend function will not overwrite existing conflicting providers // it'll produce {Google: 'selected', Clicky: 'selected'}... if ( req.updates.plugins.analytics && req.updates.plugins.analytics.options.provider ) { var provider = {}; provider[req.updates.plugins.analytics.options.provider] = "selected"; req.updates.plugins.analytics.options.provider = provider; } } next(); };
31.911765
79
0.648848
b50042740672869850ce1ddaab1c53ba16588951
5,457
js
JavaScript
Libraries/Image/ImageViewNativeComponentAndroidConfig.js
Armen6964/react-native
47dc31d4649a8495942e8a702af9ef0bf28b7cf8
[ "CC-BY-4.0", "MIT" ]
1
2021-02-18T07:14:44.000Z
2021-02-18T07:14:44.000Z
Libraries/Image/ImageViewNativeComponentAndroidConfig.js
Armen6964/react-native
47dc31d4649a8495942e8a702af9ef0bf28b7cf8
[ "CC-BY-4.0", "MIT" ]
null
null
null
Libraries/Image/ImageViewNativeComponentAndroidConfig.js
Armen6964/react-native
47dc31d4649a8495942e8a702af9ef0bf28b7cf8
[ "CC-BY-4.0", "MIT" ]
null
null
null
/** * Copyright (c) 2015-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @format * @flow */ const ReactNativeStyleAttributes = require('ReactNativeStyleAttributes'); const processColor = require('processColor'); const colorHandler = {diff: null, process: processColor}; const viewConfig = { directEventTypes: { topError: {registrationName: 'onError'}, topLoad: {registrationName: 'onLoad'}, topLoadEnd: {registrationName: 'onLoadEnd'}, topLoadStart: {registrationName: 'onLoadStart'}, }, NativeProps: { accessibilityComponentType: 'String', accessibilityHint: 'String', accessibilityLabel: 'String', accessibilityLiveRegion: 'String', accessibilityRole: 'String', accessibilityStates: 'Array', alignContent: 'String', alignItems: 'String', alignSelf: 'String', aspectRatio: 'number', backgroundColor: 'Color', blurRadius: 'number', borderBottomLeftRadius: 'number', borderBottomRightRadius: 'number', borderBottomWidth: 'number', borderColor: 'Color', borderEndWidth: 'number', borderLeftWidth: 'number', borderRadius: 'number', borderRightWidth: 'number', borderStartWidth: 'number', borderTopLeftRadius: 'number', borderTopRightRadius: 'number', borderTopWidth: 'number', borderWidth: 'number', bottom: 'Dynamic', defaultSrc: 'String', display: 'String', elevation: 'number', end: 'Dynamic', fadeDuration: 'number', flex: 'number', flexBasis: 'Dynamic', flexDirection: 'String', flexGrow: 'number', flexShrink: 'number', flexWrap: 'String', headers: 'Map', height: 'Dynamic', importantForAccessibility: 'String', justifyContent: 'String', left: 'Dynamic', loadingIndicatorSrc: 'String', margin: 'Dynamic', marginBottom: 'Dynamic', marginEnd: 'Dynamic', marginHorizontal: 'Dynamic', marginLeft: 'Dynamic', marginRight: 'Dynamic', marginStart: 'Dynamic', marginTop: 'Dynamic', marginVertical: 'Dynamic', maxHeight: 'Dynamic', maxWidth: 'Dynamic', minHeight: 'Dynamic', minWidth: 'Dynamic', nativeID: 'String', onLayout: 'boolean', opacity: 'number', overflow: 'String', overlayColor: 'number', padding: 'Dynamic', paddingBottom: 'Dynamic', paddingEnd: 'Dynamic', paddingHorizontal: 'Dynamic', paddingLeft: 'Dynamic', paddingRight: 'Dynamic', paddingStart: 'Dynamic', paddingTop: 'Dynamic', paddingVertical: 'Dynamic', position: 'String', progressiveRenderingEnabled: 'boolean', renderToHardwareTextureAndroid: 'boolean', resizeMethod: 'String', resizeMode: 'String', right: 'Dynamic', rotation: 'number', scaleX: 'number', scaleY: 'number', shouldNotifyLoadEvents: 'boolean', src: 'Array', start: 'Dynamic', testID: 'String', tintColor: 'Color', top: 'Dynamic', transform: 'Array', translateX: 'number', translateY: 'number', width: 'Dynamic', zIndex: 'number', }, uiViewClassName: 'RCTImageView', validAttributes: { accessibilityComponentType: true, accessibilityHint: true, accessibilityLabel: true, accessibilityLiveRegion: true, accessibilityRole: true, accessibilityStates: true, alignContent: true, alignItems: true, alignSelf: true, aspectRatio: true, backgroundColor: colorHandler, blurRadius: true, borderBottomLeftRadius: true, borderBottomRightRadius: true, borderBottomWidth: true, borderColor: colorHandler, borderEndWidth: true, borderLeftWidth: true, borderRadius: true, borderRightWidth: true, borderStartWidth: true, borderTopLeftRadius: true, borderTopRightRadius: true, borderTopWidth: true, borderWidth: true, bottom: true, defaultSrc: true, display: true, elevation: true, end: true, fadeDuration: true, flex: true, flexBasis: true, flexDirection: true, flexGrow: true, flexShrink: true, flexWrap: true, headers: true, height: true, importantForAccessibility: true, justifyContent: true, left: true, loadingIndicatorSrc: true, margin: true, marginBottom: true, marginEnd: true, marginHorizontal: true, marginLeft: true, marginRight: true, marginStart: true, marginTop: true, marginVertical: true, maxHeight: true, maxWidth: true, minHeight: true, minWidth: true, nativeID: true, onLayout: true, opacity: true, overflow: true, overlayColor: true, padding: true, paddingBottom: true, paddingEnd: true, paddingHorizontal: true, paddingLeft: true, paddingRight: true, paddingStart: true, paddingTop: true, paddingVertical: true, position: true, progressiveRenderingEnabled: true, renderToHardwareTextureAndroid: true, resizeMethod: true, resizeMode: true, right: true, rotation: true, scaleX: true, scaleY: true, shouldNotifyLoadEvents: true, src: true, start: true, testID: true, tintColor: colorHandler, top: true, transform: true, translateX: true, translateY: true, width: true, zIndex: true, style: ReactNativeStyleAttributes, }, }; module.exports = viewConfig;
25.619718
73
0.661719
6ff07f1b676fc44d91129d90e1fac98ed44347f8
1,427
js
JavaScript
src/app/frontend/namespace/stateconfig.js
cheld/dashboard
dc23822c60a8b44b136d79db979958a3567fd272
[ "Apache-2.0" ]
null
null
null
src/app/frontend/namespace/stateconfig.js
cheld/dashboard
dc23822c60a8b44b136d79db979958a3567fd272
[ "Apache-2.0" ]
null
null
null
src/app/frontend/namespace/stateconfig.js
cheld/dashboard
dc23822c60a8b44b136d79db979958a3567fd272
[ "Apache-2.0" ]
null
null
null
// Copyright 2017 The Kubernetes Dashboard Authors. // // 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. import {stateName as chromeStateName} from 'chrome/state'; import {stateName as detailState} from './detail/state'; import {config as detailConfig} from './detail/stateconfig'; import {stateName as listState} from './list/state'; import {config as listConfig} from './list/stateconfig'; import {stateName} from './state'; /** * Configures states for the Namespace resource. * * @param {!ui.router.$stateProvider} $stateProvider * @ngInject */ export default function stateConfig($stateProvider) { $stateProvider.state(stateName, config) .state(listState, listConfig) .state(detailState, detailConfig); } /** * Config state object for the Ingress abstract state. * * @type {!ui.router.StateConfig} */ const config = { abstract: true, parent: chromeStateName, template: '<ui-view/>', };
32.431818
75
0.729502
6ff45ff2703f8d63d6bc904533191798507a116f
10,064
js
JavaScript
public/wholesale/static/js/pages-shop-apply-apply.772eb38b.js
a576353201/aw8
ef677aebb0888aabcb6194232f1ab2d9dcd4e4b1
[ "Apache-2.0" ]
null
null
null
public/wholesale/static/js/pages-shop-apply-apply.772eb38b.js
a576353201/aw8
ef677aebb0888aabcb6194232f1ab2d9dcd4e4b1
[ "Apache-2.0" ]
null
null
null
public/wholesale/static/js/pages-shop-apply-apply.772eb38b.js
a576353201/aw8
ef677aebb0888aabcb6194232f1ab2d9dcd4e4b1
[ "Apache-2.0" ]
null
null
null
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-shop-apply-apply"],{"08ab":function(e,a,t){"use strict";t.r(a);var r=t("c43e"),s=t("b873");for(var n in s)"default"!==n&&function(e){t.d(a,e,(function(){return s[e]}))}(n);t("6b87d");var i,o=t("f0c5"),u=Object(o["a"])(s["default"],r["b"],r["c"],!1,null,"35ea785a",null,!1,r["a"],i);a["default"]=u.exports},"2b51":function(e,a,t){"use strict";var r=t("4ea4");Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0,t("96cf");var s=r(t("1da1")),n=r(t("c319")),i={data:function(){return{wanlsys:this.$wanlshop.wanlsys(),state_text:["个人","企业","旗舰店"],name_text:["姓名","企业名称","企业名称"],number_text:["身份证号码","统一信用代码","统一信用代码"],image_text:["手持身份证","营业执照","营业执照"],verify_text:["立即入驻","已申请 修改","入驻审核中","已入驻不可操作","未通过审核","已修改成功"],shopdata:{state:0,verify:0,image:"",trademark:""}}},onLoad:function(e){var a=JSON.parse(e.data);a.id&&(this.shopdata=a)},methods:{PickerChange:function(e){this.shopdata.state=e.detail.value},formSubmit:function(e){3!=this.shopdata.verify?this.wanlChecker(e):this.$wanlshop.msg("已成功入驻,不可修改再修改申请信息")},wanlChecker:function(e){var a=this;return(0,s.default)(regeneratorRuntime.mark((function t(){var r,s,i,o;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:r=[{name:"name",checkType:"notnull",errorMsg:"请输入"+a.name_text[a.shopdata.state]},{name:"number",checkType:"notnull",errorMsg:"请输入"+a.number_text[a.shopdata.state]},{name:"image",checkType:"notnull",errorMsg:"请上传"+a.image_text[a.shopdata.state]},{name:"wechat",checkType:"notnull",errorMsg:"请输入微信号"},{name:"mobile",checkType:"phoneno",errorMsg:"请输入正确的手机号"}],s=e.detail.value,i=n.default.check(s,r),i?(o=a.shopdata,a.$api.post({url:"/wanlshop/shop/apply",data:o,success:function(e){a.shopdata=e,0==o.verify?(o.verify=2,a.$wanlshop.msg("提交成功,平台將於7个工作日内与您联系")):(o.verify=5,a.$wanlshop.msg("修改成功!"))}})):a.$wanlshop.msg(n.default.error);case 4:case"end":return t.stop()}}),t)})))()},chooseImg:function(e){var a=this;uni.chooseImage({sourceType:["camera","album"],sizeType:"compressed",count:1,success:function(t){a.$api.get({url:"/wanlshop/common/uploadData",success:function(r){a.$api.upload({url:r.uploadurl,filePath:t.tempFilePaths[0],name:"file",formData:"local"==r.storage?null:r.multipart,success:function(t){a.shopdata[e]=t.fullurl}})}})}})},previewImage:function(e){var a=[],t=this.shopdata;a=2==t.state?[this.$wanlshop.oss(t.image,320,0,1),this.$wanlshop.oss(t.trademark,320,0,1)]:[this.$wanlshop.oss(t.image,320,0,1)],uni.previewImage({urls:a,current:a[e],indicator:"number"})}}};a.default=i},"68e0":function(e,a,t){var r=t("24fb");a=r(!1),a.push([e.i,".cu-btn[disabled][data-v-35ea785a]{opacity:1;color:#fff;background:rgba(254,102,0,.35)}.wanlian.cu-bar.tabbar[data-v-35ea785a]{background-color:transparent}.wanlian.cu-bar.tabbar .cu-btn[data-v-35ea785a]{width:calc(100% - %?50?%)}.wanlian.cu-bar.tabbar .cu-btn.lg[data-v-35ea785a]{font-size:%?32?%;height:%?86?%}.cu-form-group .title[data-v-35ea785a], .cu-form-group uni-input[data-v-35ea785a]{font-size:%?28?%}.cu-avatar uni-image[data-v-35ea785a]{width:%?64?%;height:%?64?%}",""]),e.exports=a},"6b87d":function(e,a,t){"use strict";var r=t("b084"),s=t.n(r);s.a},b084:function(e,a,t){var r=t("68e0");"string"===typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);var s=t("4f06").default;s("632eb43c",r,!0,{sourceMap:!1,shadowMode:!1})},b873:function(e,a,t){"use strict";t.r(a);var r=t("2b51"),s=t.n(r);for(var n in r)"default"!==n&&function(e){t.d(a,e,(function(){return r[e]}))}(n);a["default"]=s.a},c319:function(e,a,t){t("c975"),t("a9e3"),t("4d63"),t("ac1f"),t("25f0"),t("1276"),e.exports={error:"",check:function(e,a){for(var t=0;t<a.length;t++){if(!a[t].checkType)return!0;if(!a[t].name)return!0;if(!a[t].errorMsg)return!0;if(!e[a[t].name])return this.error=a[t].errorMsg,!1;switch(a[t].checkType){case"string":var r=new RegExp("^.{"+a[t].checkRule+"}$");if(!r.test(e[a[t].name]))return this.error=a[t].errorMsg,!1;break;case"int":r=new RegExp("^(-[1-9]|[1-9])[0-9]{"+a[t].checkRule+"}$");if(!r.test(e[a[t].name]))return this.error=a[t].errorMsg,!1;break;case"between":if(!this.isNumber(e[a[t].name]))return this.error=a[t].errorMsg,!1;var s=a[t].checkRule.split(",");if(s[0]=Number(s[0]),s[1]=Number(s[1]),e[a[t].name]>s[1]||e[a[t].name]<s[0])return this.error=a[t].errorMsg,!1;break;case"betweenD":r=/^-?[1-9][0-9]?$/;if(!r.test(e[a[t].name]))return this.error=a[t].errorMsg,!1;s=a[t].checkRule.split(",");if(s[0]=Number(s[0]),s[1]=Number(s[1]),e[a[t].name]>s[1]||e[a[t].name]<s[0])return this.error=a[t].errorMsg,!1;break;case"betweenF":r=/^-?[0-9][0-9]?.+[0-9]+$/;if(!r.test(e[a[t].name]))return this.error=a[t].errorMsg,!1;s=a[t].checkRule.split(",");if(s[0]=Number(s[0]),s[1]=Number(s[1]),e[a[t].name]>s[1]||e[a[t].name]<s[0])return this.error=a[t].errorMsg,!1;break;case"same":if(e[a[t].name]!=a[t].checkRule)return this.error=a[t].errorMsg,!1;break;case"notsame":if(e[a[t].name]==a[t].checkRule)return this.error=a[t].errorMsg,!1;break;case"email":r=/^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;if(!r.test(e[a[t].name]))return this.error=a[t].errorMsg,!1;break;case"phoneno":r=/^1[0-9]{10,10}$/;if(!r.test(e[a[t].name]))return this.error=a[t].errorMsg,!1;break;case"zipcode":r=/^[0-9]{6}$/;if(!r.test(e[a[t].name]))return this.error=a[t].errorMsg,!1;break;case"reg":r=new RegExp(a[t].checkRule);if(!r.test(e[a[t].name]))return this.error=a[t].errorMsg,!1;break;case"in":if(-1==a[t].checkRule.indexOf(e[a[t].name]))return this.error=a[t].errorMsg,!1;break;case"notnull":if(null==e[a[t].name]||e[a[t].name].length<1)return this.error=a[t].errorMsg,!1;break}}return!0},isNumber:function(e){var a=/^-?[1-9][0-9]?.?[0-9]*$/;return a.test(e)}}},c43e:function(e,a,t){"use strict";var r;t.d(a,"b",(function(){return s})),t.d(a,"c",(function(){return n})),t.d(a,"a",(function(){return r}));var s=function(){var e=this,a=e.$createElement,t=e._self._c||a;return t("v-uni-view",[t("v-uni-view",{staticClass:"cu-custom",style:{height:e.wanlsys.height+"px"}},[t("v-uni-view",{staticClass:"cu-bar bg-bgcolor fixed",style:{height:e.wanlsys.height+"px",paddingTop:e.wanlsys.top+"px"}},[t("v-uni-view",{staticClass:"action",on:{click:function(a){arguments[0]=a=e.$handleEvent(a),e.$wanlshop.back(1)}}},[t("v-uni-text",{staticClass:"wlIcon-fanhui1"})],1),t("v-uni-view",{staticClass:"content",style:{top:e.wanlsys.top+"px"}},[e._v("申请入驻")]),t("v-uni-view",{staticClass:"action",on:{click:function(a){arguments[0]=a=e.$handleEvent(a),e.$wanlshop.to("/pages/user/service")}}},[t("v-uni-text",{staticClass:"wlIcon-kefu"})],1)],1)],1),t("v-uni-form",{on:{submit:function(a){arguments[0]=a=e.$handleEvent(a),e.formSubmit.apply(void 0,arguments)}}},[t("v-uni-view",{staticClass:"cu-form-group"},[t("v-uni-view",{staticClass:"title"},[e._v("店铺类型")]),t("v-uni-picker",{attrs:{value:e.shopdata.state,range:e.state_text},on:{change:function(a){arguments[0]=a=e.$handleEvent(a),e.PickerChange.apply(void 0,arguments)}}},[t("v-uni-view",{staticClass:"picker"},[e._v(e._s(e.state_text[e.shopdata.state]))])],1)],1),t("v-uni-view",{staticClass:"cu-form-group"},[t("v-uni-view",{staticClass:"title"},[e._v(e._s(e.name_text[e.shopdata.state]))]),t("v-uni-input",{attrs:{name:"name",placeholder:"请输入"+e.name_text[e.shopdata.state]},model:{value:e.shopdata.name,callback:function(a){e.$set(e.shopdata,"name",a)},expression:"shopdata.name"}})],1),t("v-uni-view",{staticClass:"cu-form-group"},[t("v-uni-view",{staticClass:"title"},[e._v(e._s(e.number_text[e.shopdata.state]))]),t("v-uni-input",{attrs:{name:"number",placeholder:"请输入"+e.number_text[e.shopdata.state]},model:{value:e.shopdata.number,callback:function(a){e.$set(e.shopdata,"number",a)},expression:"shopdata.number"}})],1),t("v-uni-view",{staticClass:"cu-form-group margin-top-bj",class:2==e.shopdata.state?"":"margin-bottom-bj"},[t("v-uni-view",{staticClass:"title"},[e._v(e._s(e.image_text[e.shopdata.state]))]),t("v-uni-input",{attrs:{name:"image",placeholder:"点击上传"+e.image_text[e.shopdata.state],disabled:!0},on:{click:function(a){arguments[0]=a=e.$handleEvent(a),e.chooseImg("image")}},model:{value:e.shopdata.image,callback:function(a){e.$set(e.shopdata,"image",a)},expression:"shopdata.image"}}),e.shopdata.image?t("v-uni-view",{staticClass:"cu-avatar radius",on:{click:function(a){arguments[0]=a=e.$handleEvent(a),e.previewImage(0)}}},[t("v-uni-image",{attrs:{src:e.$wanlshop.oss(e.shopdata.image,32,0,1),mode:"widthFix"}})],1):e._e()],1),2==e.shopdata.state?t("v-uni-view",{staticClass:"cu-form-group margin-bottom-bj"},[t("v-uni-view",{staticClass:"title"},[e._v("商标证书")]),t("v-uni-input",{attrs:{name:"trademark",placeholder:"点击上传商标证书",disabled:!0},on:{click:function(a){arguments[0]=a=e.$handleEvent(a),e.chooseImg("trademark")}},model:{value:e.shopdata.trademark,callback:function(a){e.$set(e.shopdata,"trademark",a)},expression:"shopdata.trademark"}}),e.shopdata.trademark?t("v-uni-view",{staticClass:"cu-avatar radius",on:{click:function(a){arguments[0]=a=e.$handleEvent(a),e.previewImage(1)}}},[t("v-uni-image",{attrs:{src:e.$wanlshop.oss(e.shopdata.trademark,32,0,1),mode:"widthFix"}})],1):e._e()],1):e._e(),t("v-uni-view",{staticClass:"cu-form-group"},[t("v-uni-view",{staticClass:"title"},[e._v("微信号")]),t("v-uni-input",{attrs:{name:"wechat",placeholder:"请输入微信号"},model:{value:e.shopdata.wechat,callback:function(a){e.$set(e.shopdata,"wechat",a)},expression:"shopdata.wechat"}}),t("v-uni-text",{staticClass:"wlIcon-WeChat text-green"})],1),t("v-uni-view",{staticClass:"cu-form-group"},[t("v-uni-view",{staticClass:"title"},[e._v("联系方式")]),t("v-uni-input",{attrs:{name:"mobile",maxlength:"11",type:"number",placeholder:"请输入手机号"},model:{value:e.shopdata.mobile,callback:function(a){e.$set(e.shopdata,"mobile",a)},expression:"shopdata.mobile"}})],1),t("v-uni-view",{staticClass:"edgeInsetBottom"}),t("v-uni-view",{staticClass:"wanlian cu-bar tabbar foot flex flex-direction"},[t("v-uni-button",{staticClass:"cu-btn wanl-bg-orange lg",attrs:{"form-type":"submit",disabled:3==e.shopdata.verify}},[e._v(e._s(e.verify_text[e.shopdata.verify]))])],1)],1)],1)},n=[]}}]);
10,064
10,064
0.678657
b505a2677691005cfd4cee307aac8ff499e7760a
12,280
js
JavaScript
demo/src/main/webapp/static/js/epiClock/jquery.epiclock.js
1030194031/demo
6e21f0eb6ff267015c95b92d0e8699a9e3d024b0
[ "Apache-2.0" ]
null
null
null
demo/src/main/webapp/static/js/epiClock/jquery.epiclock.js
1030194031/demo
6e21f0eb6ff267015c95b92d0e8699a9e3d024b0
[ "Apache-2.0" ]
null
null
null
demo/src/main/webapp/static/js/epiClock/jquery.epiclock.js
1030194031/demo
6e21f0eb6ff267015c95b92d0e8699a9e3d024b0
[ "Apache-2.0" ]
null
null
null
/** * epiClock 2.0 - Create Epic Clocks Easily * * Copyright (c) 2008 Eric Garside (http://eric.garside.name) Dual licensed * under: MIT: http://www.opensource.org/licenses/mit-license.php GPLv3: * http://www.opensource.org/licenses/gpl-3.0.html */ // Manager States var EC_HALT = 'disable', EC_RUN = 'enable', EC_KILL = 'destroy', // Clock Types EC_CLOCK = 0, EC_COUNTDOWN = 1, EC_COUNTUP = 2, EC_ROLLOVER = 3, EC_EXPIRE = 4, EC_LOOP = 5, EC_STOPWATCH = 6, EC_HOLDUP = 7; ; (function($) { var defaults = { epiClock : { offset : { hours : 0, minutes : 0, seconds : 0, days : 0, years : 0 }, arbitrary : { days : 0, years : 0 }, display : { years : true, military : false }, gmt : false, target : null, onTimer : null, onKill : null, onRender : function(v, val) { v.html(val) }, format : null, frame : {}, dead : false, displace : 0, modifier : 0, variance : 0, daysadded : 0, paused : 0, tolerance : 0, selfLoc : -1, mode : EC_CLOCK }, formats : ['F j, Y, g:i:s a', // EC_CLOCK 'V{d} x{h} i{m} s{s}', // EC_COUNTDOWN 'Q{y} K{d} x{h} i{m} s{s}', // EC_COUNTUP 'V{d} x{h} i{m} s{s}', // EC_ROLLOVER 'x{h} i{m} s{s}', // EC_EXPIRE 'i{m} s{s}', // EC_LOOP 'x{h} i{m} s{s}', // EC_STOPWATCH 'Q{y} K{d} x{h} i{m} s{s}' // EC_HOLDUP ] }, // The current mode the clock manager is in current = null, // The interval timer for the clock loop = null, // The clocks we're managing clocks = []; /** * jQuery Entry Point - Clock Manager * * Provides an interface for the user to pause, destroy, or resume/start all * clocks. */ $.epiclock = function(mode, precision) { mode = mode || EC_RUN; precision = precision || 5e2; if (mode == current) return; switch (mode) { case EC_KILL : $.each(clocks, function() { this.removeData('epiClock'); }) clocks = []; case EC_HALT : if (loop) { clearInterval(loop); loop = null; } current = mode; break; case EC_RUN : if (!loop) { cycleClocks(); loop = setInterval(cycleClocks, precision); } current = mode; break; } return this; } function cycleClocks() { $.each(clocks, function(i) { this.data('epiClock').render(); }) } /** * jQuery Entry Point * * Creates the clock displays */ $.fn.epiclock = function(options) { switch (options) { case 'destroy' : return this.each(function() { var jQ = $(this); if (jQ.data('epiClock') instanceof epiClock) jQ.data('epiClock').kill(); }) case 'disable' : return this.each(function() { var jQ = $(this); if (jQ.data('epiClock') instanceof epiClock) jQ.data('epiClock').pause(); }) case 'enable' : return this.each(function() { var jQ = $(this); if (jQ.data('epiClock') instanceof epiClock) jQ.data('epiClock').resume(); }) default : options = $.extend(true, {}, defaults.epiClock, options); break; } this.each(function() { var object = $(this), format = (options.format || defaults.formats[options.mode]) .split(''), isBuffering = false, label = '<label class="epiClock"></label>', span = '<span class="epiClock"></span>', buffer = '', clock = new epiClock( options, object); object.data('epiClock', clock); $.each(format, function() { x = this + ''; switch (x) { case ' ' : if (!isBuffering) $(span).addClass('ecSpacer') .appendTo(object); else buffer += x; break; case '{' : isBuffering = true; break; case '}' : isBuffering = false; $(label).html(buffer).appendTo(object); buffer = ''; break; default : // If we're buffering, this is label text if (isBuffering) buffer += x; // If it's a special character, it will be span // updated else if (Date.prototype[x] || clock[x]) { clock.frame[x] = $(span).attr('ref', x) .appendTo(object); } // If it's anything else, it's a single char // label seperator else $(label).addClass('ecSeparator').html(x) .appendTo(object); break; } }); clock.selfLoc = clocks.push(object) - 1; }) return this; } function epiClock(options, element) { if (this instanceof epiClock) return this.init(options, element); else return new epiClock(options, element); } epiClock.prototype = { Q : function() { return this.arbitrary.years }, E : function() { return this.arbitrary.days }, e : function() { return this.arbitrary.days.pad(0) }, zero : new Date(0), pause : function() { if (this.dead) return; this.paused = new Date().valueOf(); this.dead = true; }, resume : function() { if (!this.dead) return; if (this.mode == EC_STOPWATCH) this.displace += (this.paused - new Date().valueOf()); this.paused = 0; this.dead = false; }, kill : function() { // Remove and Renumber Clocks Array clocks.splice(this.selfLoc, 1); $.each(clocks, function(i) { this.data('epiClock').selfLoc = i }); // Call on kill, set dead if ($.isFunction(this.onKill)) this.onKill(); this.dead = true; }, init : function(options, element) { if (options.mode < EC_CLOCK || options.mode > EC_HOLDUP) throw new Exception('Invalid Clock Mode.'); var clock = this; $.each(options, function(k, v) { clock[k] = v; }); switch (this.mode) { case EC_LOOP : case EC_EXPIRE : this.target = this.target || new Date(); case EC_COUNTDOWN : case EC_ROLLOVER : this.modifier = -1; this.variance = 1; break; case EC_STOPWATCH : this.displace += -1 * new Date().valueOf(); return; case EC_HOLDUP : this.variance = -1; this.modifier = 1; break; default : this.modifier = 1; this.variance = 0; break; } if (this.gmt) this.normalize(); switch (true) { case this.target instanceof Date : this.target = this.target.valueOf(); break; case typeof this.target == 'string' : this.target = new Date(this.target).valueOf(); break; } this.displace += this.modifier * this.calculateOffset(); }, calculateOffset : function(offset) { offset = offset || this.offset; return (offset.years * 3157056e4 + offset.days * 864e5 + offset.hours * 36e5 + offset.minutes * 6e4 + (this.variance + offset.seconds) * 1e3); }, normalize : function() { this.displace += new Date().getTimezoneOffset() * 6e4; }, render : function() { if (!this.tick()) return; var clock = this, time = (this.mode == EC_HOLDUP) ? this.zero : this.now; $.each(this.frame, function(k, v) { var val = ($.isFunction(time[k]) ? time[k]() : clock[k]()) + ''; if (v.data('last') != val) clock.onRender(v, val); v.data('last', val) }) }, tick : function() { if (this.dead) return false; var now = new Date().valueOf() + this.displace; switch (this.mode) { case EC_HOLDUP : if (this.target < now) this.mode = EC_COUNTUP; case EC_COUNTUP : now -= this.target; break; case EC_ROLLOVER : if (now > this.target) now = now - this.target; else now = this.target - now; break; case EC_COUNTDOWN : case EC_EXPIRE : case EC_LOOP : now = this.target - now; if (now < this.tolerance) return this.timerEnd(); break; } this.now = new Date(now); var days = this.now.V(); if (days <= this.daysadded) return true; this.daysadded = days; this.arbitrary.days += days; if (this.arbitrary.days < 365) return true; this.arbitrary.years += Math.floor(this.arbitrary.days / 365.4 % 365.4); this.arbitrary.days = Math.floor(this.arbitrary.days % 365.4); return true; }, timerEnd : function() { if ($.isFunction(this.onTimer)) this.onTimer(); switch (this.mode) { case EC_COUNTDOWN : case EC_EXPIRE : this.kill(); break; case EC_LOOP : this.displace += this.modifier * this.calculateOffset(); return this.render(); case EC_ROLLOVER : this.mode = EC_COUNTUP; return true; } this.now = new Date(0); return true; } }; $.extend(String.prototype, { pad : function(s, l) { l = l || 2; return this.length < l ? new Array(1 + l - this.length) .join(s) + this : this }, rpad : function(s, l) { l = l || 2; return this.length < l ? this + new Array(1 + l - this.length).join(s) : this } }) $.extend(Number.prototype, { pad : function(s, l) { return (this + '').pad(s, l) }, rpad : function(s, l) { return (this + '').rpad(s, l) } }) /** Prototype the Date function * */ $.extend(Date.prototype, { // Assistance Definitions modCalc : function(mod1, mod2) { return (Math.floor(Math.floor(this.valueOf() / 1e3) / mod1) % mod2) }, months : ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'], days : ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'], suffix : [null, 'st', 'nd', 'rd'], // Timer Functions V : function() { return this.modCalc(864e2, 1e5) }, // Days v : function() { return this.V().pad(0) }, // Paded Days K : function() { return this.V() % 365 }, // Days Offset for Years k : function() { return this.K().pad(0) }, // Padded Offset Days X : function() { return this.modCalc(36e2, 24) }, // Hours x : function() { return this.X().pad(0) }, // Padded Hours // Day d : function() { return this.getDate().pad('0') }, D : function() { return this.days[this.getDay()].substring(0, 3) }, j : function() { return this.getDate() }, l : function() { return this.days[this.getDay()] }, N : function() { return this.getDay() + 1 }, S : function() { return this.suffix[this.getDate()] || 'th' }, w : function() { return this.getDay() }, z : function() { return Math.round((this - this.f()) / 864e5) }, // Week W : function() { return Math .ceil(((((this - this.f()) / 864e5) + this.f().w()) / 7)) }, // Month F : function() { return this.months[this.getMonth()]; }, m : function() { return (this.getMonth() + 1).pad(0) }, M : function() { return this.months[this.getMonth()].substring(0, 3) }, n : function() { return this.getMonth() + 1 }, // Year L : function() { var Y = this.Y(); return Y % 4 ? false : Y % 100 ? true : Y % 400 ? false : true }, f : function() { return new Date(this.getFullYear(), 0, 1) }, Y : function() { return this.getFullYear() }, y : function() { return ('' + this.getFullYear()).substr(2) }, // Time a : function() { return this.getHours() < 12 ? 'am' : 'pm' }, A : function() { return this.a().toUpperCase() }, B : function() { return Math.floor((((this.getHours()) * 36e5) + (this.getMinutes() * 6e4) + (this.getSeconds() * 1e3)) / 864e2).pad(0, 3) }, g : function() { return this.getHours() % 12 || 12 }, G : function() { return this.getHours() }, h : function() { return this.g().pad('0') }, H : function() { return this.getHours().pad('0') }, i : function() { return this.getMinutes().pad(0) }, s : function() { return this.getSeconds().pad('0') }, u : function() { return this.getTime() % 1000 }, // Timezone O : function() { var t = this.getTimezoneOffset() / 60; return (t >= 0 ? '+' : '-') + Math.abs(t).pad(0).rpad(0, 4) }, P : function() { var t = this.O(); return t.substr(0, 3) + ':' + t.substr(3) }, Z : function() { return this.getTimezoneOffset() * 60; }, // Full Date/Time c : function() { return this.Y() + '-' + this.m() + '-' + this.d() + 'T' + this.H() + ':' + this.i() + ':' + this.s() + this.P() }, r : function() { return this.toString() }, U : function() { return this.getTime() / 1000 } }); })(jQuery);
22.825279
157
0.546743
b50e6065bfe0ab5a528f97e712084105666bf053
759
js
JavaScript
widgets/Filter/nls/pt-br/strings.js
Pateykev/Pateykev.github.io
c5418f313e2645bc10e3c3d71e95357040797887
[ "Apache-2.0" ]
null
null
null
widgets/Filter/nls/pt-br/strings.js
Pateykev/Pateykev.github.io
c5418f313e2645bc10e3c3d71e95357040797887
[ "Apache-2.0" ]
null
null
null
widgets/Filter/nls/pt-br/strings.js
Pateykev/Pateykev.github.io
c5418f313e2645bc10e3c3d71e95357040797887
[ "Apache-2.0" ]
1
2021-03-08T12:28:28.000Z
2021-03-08T12:28:28.000Z
define({ "_widgetLabel": "Filtrar", "toggleTip": "Clique para mostrar/ocultar configurações do filtro", "toggleOn": "Pressione o botão de alternar para ativar o filtro atual", "toggleOff": "Pressione o botão de alternar para desativar o filtro atual", "filterActions": "Ações de filtro", "resetAll": "Redefinir filtros (exceto personalizado)", "turnOffAll": "Desativar filtros (exceto personalizado)", "resetAllForNoCustom": "Redefinir filtros", "turnOffAllForNoCustom": "Desabilitar os filtros", "createCustomFilter": "Criar um filtro personalizado", "customFilter": "Filtro personalizado", "toggleCustomFilter": "Alternar o botão de filtro para ativar e desativar", "toggleCustomFilters": "Ativar ou desativar todos os filtros" });
50.6
77
0.748353
b50528b0ce48d222de7512cce8d2caced5d65e01
5,984
js
JavaScript
test/frontend-integration-test/tensorboard-example.spec.js
kamalmemon/pipelines
7e68991a2a7bfa767f893facfe58190690ca89ed
[ "Apache-2.0" ]
6
2020-05-19T02:35:11.000Z
2020-05-29T17:58:42.000Z
test/frontend-integration-test/tensorboard-example.spec.js
kamalmemon/pipelines
7e68991a2a7bfa767f893facfe58190690ca89ed
[ "Apache-2.0" ]
1,932
2021-01-25T11:23:37.000Z
2022-03-31T17:10:18.000Z
test/frontend-integration-test/tensorboard-example.spec.js
kamalmemon/pipelines
7e68991a2a7bfa767f893facfe58190690ca89ed
[ "Apache-2.0" ]
11
2020-05-19T22:26:41.000Z
2021-01-25T09:56:21.000Z
// Copyright 2018 Google LLC // // 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. const assert = require('assert'); const URL = require('url').URL; const experimentName = 'tensorboard-example-experiment-' + Date.now(); const pipelineName = 'tensorboard-example-pipeline-' + Date.now(); const runName = 'tensorboard-example-' + Date.now(); const waitTimeout = 5000; function getValueFromDetailsTable(key) { // Find the span that shows the key, get its parent div (the row), then // get that row's inner text, and remove the key const row = $(`span=${key}`).$('..'); return row.getText().substr(`${key}\n`.length); } describe('deploy tensorboard example run', () => { before(() => { browser.url('/'); }); it('opens the pipeline upload dialog', () => { $('#uploadBtn').click(); browser.waitForVisible('#uploadDialog', waitTimeout); }); it('uploads the sample pipeline', () => { browser.chooseFile('#uploadDialog input[type="file"]', './tensorboard-example.yaml'); const input = $('#uploadDialog #uploadFileName'); input.clearElement(); input.setValue(pipelineName); $('#confirmUploadBtn').click(); browser.waitForVisible('#uploadDialog', waitTimeout, true); }); it('opens pipeline details', () => { $('.tableRow a').waitForVisible(waitTimeout); browser.execute('document.querySelector(".tableRow a").click()'); }); it('shows a 1-node static graph', () => { const nodeSelector = '.graphNode'; $(nodeSelector).waitForVisible(); const nodes = $$(nodeSelector).length; assert(nodes === 1, 'should have a 1-node graph, instead has: ' + nodes); }); it('creates a new experiment out of this pipeline', () => { $('#startNewExperimentBtn').click(); browser.waitUntil(() => { return new URL(browser.getUrl()).hash.startsWith('#/experiments/new'); }, waitTimeout); $('#experimentName').setValue(experimentName); $('#createExperimentBtn').click(); }); it('creates a new run in the experiment', () => { $('#choosePipelineBtn').waitForVisible(); $('#choosePipelineBtn').click(); $('.tableRow').waitForVisible(); $('.tableRow').click(); $('#usePipelineBtn').click(); $('#pipelineSelectorDialog').waitForVisible(waitTimeout, true); browser.keys('Tab'); browser.keys(runName); // Deploy $('#createBtn').click(); }); it('redirects back to experiment page', () => { browser.waitUntil(() => { return new URL(browser.getUrl()).hash.startsWith('#/experiments/details/'); }, waitTimeout); }); it('finds the new run in the list of runs, navigates to it', () => { $('.tableRow').waitForVisible(waitTimeout); assert.equal($$('.tableRow').length, 1, 'should only show one run'); // Navigate to details of the deployed run by clicking its anchor element $('.tableRow a').waitForVisible(waitTimeout); browser.execute('document.querySelector(".tableRow a").click()'); }); it('switches to config tab', () => { $('button=Config').waitForVisible(waitTimeout); $('button=Config').click(); }); it('waits for run to finish', () => { let status = getValueFromDetailsTable('Status'); let attempts = 0; const maxAttempts = 60; // Wait for a reasonable amount of time until the run is done while (attempts < maxAttempts && status.trim() !== 'Succeeded') { browser.pause(1000); status = getValueFromDetailsTable('Status'); attempts++; } assert(attempts < maxAttempts, `waited for ${maxAttempts} seconds but run did not succeed. ` + 'Current status is: ' + status); }); it('switches back to graph tab', () => { $('button=Graph').click(); }); it('has a 1-node graph', () => { const nodeSelector = '.graphNode'; const nodes = $$(nodeSelector).length; assert(nodes === 1, 'should have a 1-node graph, instead has: ' + nodes); }); it('opens the side panel when graph node is clicked', () => { $('.graphNode').click(); $('.plotCard').waitForVisible(waitTimeout); }); it('shows a Tensorboard plot card, and clicks its button to start Tensorboard', () => { // First button is the popout button, second is the Tensoboard start button const button = $$('.plotCard button')[1]; button.waitForVisible(); assert(button.getText().trim() === 'Start Tensorboard'); button.click(); }); it('waits until the button turns into Open Tensorboard', () => { // First button is the popout button, second is the Tensoboard open button browser.waitUntil(() => { const button = $$('.plotCard button')[1]; button.waitForVisible(); return button.getText().trim() === 'Open Tensorboard'; }, 2 * 60 * 1000); }); it('opens the Tensorboard app', () => { const anchor = $('.plotCard a'); browser.url(anchor.getAttribute('href')); let attempts = 0; const maxAttempts = 60; // Wait for a reasonable amount of time until Tensorboard app shows up while (attempts < maxAttempts && !$('#topBar').isExisting()) { browser.pause(1000); browser.refresh(); attempts++; } assert($('#topBar').isVisible()); browser.back(); }); it('deletes the uploaded pipeline', () => { $('#pipelinesBtn').click(); browser.waitForVisible('.tableRow', waitTimeout); $('.tableRow').click(); $('#deleteBtn').click(); $('.dialogButton').click(); $('.dialog').waitForVisible(waitTimeout, true); }); });
32
98
0.633523
b519b303c0a99f57c65cfa13decfadf7471c7321
2,521
js
JavaScript
app/models/documentreference.js
secure-restful-interface-profile/vista-novo
d4ae78f96101546354110c9a74d40c172746fea9
[ "Apache-2.0" ]
1
2020-07-25T23:43:03.000Z
2020-07-25T23:43:03.000Z
app/models/documentreference.js
secure-restful-interface-profile/vista-novo
d4ae78f96101546354110c9a74d40c172746fea9
[ "Apache-2.0" ]
null
null
null
app/models/documentreference.js
secure-restful-interface-profile/vista-novo
d4ae78f96101546354110c9a74d40c172746fea9
[ "Apache-2.0" ]
null
null
null
var mongoose = require('mongoose'); var DocumentReferenceSchema = new mongoose.Schema({ masterIdentifier: { use: String, label: String, system: String, value: String }, identifier: [{ use: String, label: String, system: String, value: String }], subject: { reference: String, display: String }, fhirType: { coding: [{ system: String, code: String, display: String }] }, class: { coding: [{ system: String, code: String, display: String }] }, author: [{ reference: String, display: String }], custodian: { reference: String, display: String }, policyManager: String, authenticator: { reference: String, display: String }, created: Date, indexed: Date, status: String, docStatus: { coding: [{ system: String, code: String, display: String }] }, relatesTo: [{ code: String, target: { reference: String, display: String } }], description: String, confidentiality: [{ coding: [{ system: String, code: String, display: String }] }], primaryLanguage: String, mimeType: String, format: { coding: [{ system: String, code: String, display: String }] }, size: Number, hash: String, location: String, service: { fhirType: { coding: [{ system: String, code: String, display: String }] }, address: String, parameter: [{ name: String, value: String, }] }, context: { event: [{ coding: [{ system: String, code: String, display: String }] }], period: { }, facilityType: { coding: [{ system: String, code: String, display: String }] } } }); mongoose.model('DocumentReference', DocumentReferenceSchema);
21.184874
62
0.409361
6ff6e30ede243a95473940abab1587679df6ba2d
18,036
js
JavaScript
app/screens/more_dms/more_dms.js
chentv00/mattermost-mobile
a457d573c80a4303be01a38f305dd301d0219396
[ "Apache-2.0" ]
1
2020-12-26T05:44:02.000Z
2020-12-26T05:44:02.000Z
app/screens/more_dms/more_dms.js
chentv00/mattermost-mobile
a457d573c80a4303be01a38f305dd301d0219396
[ "Apache-2.0" ]
null
null
null
app/screens/more_dms/more_dms.js
chentv00/mattermost-mobile
a457d573c80a4303be01a38f305dd301d0219396
[ "Apache-2.0" ]
null
null
null
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React, {PureComponent} from 'react'; import PropTypes from 'prop-types'; import {intlShape} from 'react-intl'; import {Keyboard, View} from 'react-native'; import {Navigation} from 'react-native-navigation'; import {SafeAreaView} from 'react-native-safe-area-context'; import {dismissModal, setButtons} from '@actions/navigation'; import CustomList, {FLATLIST, SECTIONLIST} from '@components/custom_list'; import UserListRow from '@components/custom_list/user_list_row'; import FormattedText from '@components/formatted_text'; import KeyboardLayout from '@components/layout/keyboard_layout'; import Loading from '@components/loading'; import SearchBar from '@components/search_bar'; import StatusBar from '@components/status_bar'; import {NavigationTypes} from '@constants'; import {debounce} from '@mm-redux/actions/helpers'; import {General} from '@mm-redux/constants'; import EventEmitter from '@mm-redux/utils/event_emitter'; import {getGroupDisplayNameFromUserIds} from '@mm-redux/utils/channel_utils'; import {displayUsername, filterProfilesMatchingTerm} from '@mm-redux/utils/user_utils'; import {alertErrorWithFallback} from '@utils/general'; import {t} from '@utils/i18n'; import {createProfilesSections, loadingText} from '@utils/member_list'; import { changeOpacity, makeStyleSheetFromTheme, getKeyboardAppearanceFromTheme, } from '@utils/theme'; import SelectedUsers from './selected_users'; const START_BUTTON = 'start-conversation'; const CLOSE_BUTTON = 'close-dms'; export default class MoreDirectMessages extends PureComponent { static propTypes = { actions: PropTypes.shape({ makeDirectChannel: PropTypes.func.isRequired, makeGroupChannel: PropTypes.func.isRequired, getProfiles: PropTypes.func.isRequired, getProfilesInTeam: PropTypes.func.isRequired, searchProfiles: PropTypes.func.isRequired, setChannelDisplayName: PropTypes.func.isRequired, }).isRequired, componentId: PropTypes.string, allProfiles: PropTypes.object.isRequired, currentDisplayName: PropTypes.string, currentTeamId: PropTypes.string.isRequired, currentUserId: PropTypes.string.isRequired, isGuest: PropTypes.bool, restrictDirectMessage: PropTypes.bool.isRequired, teammateNameDisplay: PropTypes.string, theme: PropTypes.object.isRequired, }; static contextTypes = { intl: intlShape.isRequired, }; constructor(props, context) { super(props, context); this.searchTimeoutId = 0; this.next = true; this.page = -1; this.mounted = false; this.state = { profiles: [], searchResults: [], loading: false, term: '', startingConversation: false, selectedIds: {}, selectedCount: 0, }; } componentDidMount() { this.navigationEventListener = Navigation.events().bindComponent(this); this.mounted = true; this.updateNavigationButtons(false); this.getProfiles(); } componentWillUnmount() { this.mounted = false; } componentDidUpdate() { const {selectedCount, startingConversation} = this.state; const canStart = selectedCount > 0 && !startingConversation; this.updateNavigationButtons(canStart); } navigationButtonPressed({buttonId}) { if (buttonId === START_BUTTON) { this.startConversation(); } else if (buttonId === CLOSE_BUTTON) { this.close(); } } setSearchBarRef = (ref) => { this.searchBarRef = ref; } close = () => { Keyboard.dismiss(); dismissModal(); }; clearSearch = () => { this.setState({term: '', searchResults: []}); }; getProfiles = debounce(() => { const {loading, term} = this.state; if (this.next && !loading && !term && this.mounted) { this.setState({loading: true}, () => { const {actions, currentTeamId, restrictDirectMessage} = this.props; if (restrictDirectMessage) { actions.getProfiles(this.page + 1, General.PROFILE_CHUNK_SIZE).then(this.loadedProfiles); } else { actions.getProfilesInTeam(currentTeamId, this.page + 1, General.PROFILE_CHUNK_SIZE).then(this.loadedProfiles); } }); } }, 100); handleSelectProfile = (id) => { const {currentUserId} = this.props; if (this.state.selectedIds[id]) { this.handleRemoveProfile(id); return; } if (id === currentUserId) { const selectedId = {}; selectedId[currentUserId] = true; this.startConversation(selectedId); } else { this.setState((prevState) => { const {selectedIds} = prevState; const wasSelected = selectedIds[id]; // Prevent selecting too many users if (!wasSelected && Object.keys(selectedIds).length >= General.MAX_USERS_IN_GM - 1) { return {}; } const newSelectedIds = Object.assign({}, selectedIds); if (!wasSelected) { newSelectedIds[id] = true; } return { selectedIds: newSelectedIds, selectedCount: Object.keys(newSelectedIds).length, }; }); this.clearSearch(); } }; handleRemoveProfile = (id) => { this.setState((prevState) => { const {selectedIds} = prevState; const newSelectedIds = Object.assign({}, selectedIds); Reflect.deleteProperty(newSelectedIds, id); return { selectedIds: newSelectedIds, selectedCount: Object.keys(newSelectedIds).length, }; }); }; isStartEnabled = (state) => { if (state.startingConversation) { return false; } return state.selectedCount >= 1 && state.selectedCount <= General.MAX_USERS_IN_GM - 1; }; loadedProfiles = ({data}) => { if (this.mounted) { const {profiles} = this.state; if (data && !data.length) { this.next = false; } this.page += 1; this.setState({loading: false, profiles: [...profiles, ...data]}); } }; makeDirectChannel = async (id) => { const {intl} = this.context; const {actions, allProfiles, teammateNameDisplay} = this.props; const user = allProfiles[id]; const displayName = displayUsername(user, teammateNameDisplay); actions.setChannelDisplayName(displayName); const result = await actions.makeDirectChannel(id); if (result.error) { alertErrorWithFallback( intl, result.error, { id: 'mobile.open_dm.error', defaultMessage: "We couldn't open a direct message with {displayName}. Please check your connection and try again.", }, { displayName, }, ); } return !result.error; }; makeGroupChannel = async (ids) => { const {intl} = this.context; const { actions, allProfiles, currentUserId, teammateNameDisplay, } = this.props; const result = await actions.makeGroupChannel(ids); const displayName = getGroupDisplayNameFromUserIds(ids, allProfiles, currentUserId, teammateNameDisplay); actions.setChannelDisplayName(displayName); if (result.error) { alertErrorWithFallback( intl, result.error, { id: t('mobile.open_gm.error'), defaultMessage: "We couldn't open a group message with those users. Please check your connection and try again.", }, ); } return !result.error; }; onSearch = (text) => { if (text) { this.setState({term: text}); clearTimeout(this.searchTimeoutId); this.searchTimeoutId = setTimeout(() => { this.searchProfiles(text); }, General.SEARCH_TIMEOUT_MILLISECONDS); } else { this.clearSearch(); } }; searchProfiles = async (term) => { const lowerCasedTerm = term.toLowerCase(); const {actions, currentTeamId, restrictDirectMessage} = this.props; this.setState({loading: true}); let results; if (restrictDirectMessage) { results = await actions.searchProfiles(lowerCasedTerm); } else { results = await actions.searchProfiles(lowerCasedTerm, {team_id: currentTeamId}); } let data = []; if (results.data) { data = results.data; } this.setState({searchResults: data, loading: false}); }; startConversation = async (selectedId) => { const { currentDisplayName, actions, } = this.props; if (this.state.startingConversation) { return; } this.setState({ startingConversation: true, }); // Save the current channel display name in case it fails const currentChannelDisplayName = currentDisplayName; const selectedIds = selectedId ? Object.keys(selectedId) : Object.keys(this.state.selectedIds); let success; if (selectedIds.length === 0) { success = false; } else if (selectedIds.length > 1) { success = await this.makeGroupChannel(selectedIds); } else { success = await this.makeDirectChannel(selectedIds[0]); } if (success) { EventEmitter.emit(NavigationTypes.CLOSE_MAIN_SIDEBAR); requestAnimationFrame(() => { this.close(); }); } else { this.setState({ startingConversation: false, }); actions.setChannelDisplayName(currentChannelDisplayName); } }; updateNavigationButtons = (startEnabled, context = this.context) => { const {componentId, theme} = this.props; const {formatMessage} = context.intl; setButtons(componentId, { rightButtons: [{ color: theme.sidebarHeaderTextColor, id: START_BUTTON, text: formatMessage({id: 'mobile.more_dms.start', defaultMessage: 'Start'}), showAsAction: 'always', enabled: startEnabled, testID: 'more_direct_messages.start.button', }], }); }; renderItem = (props) => { // The list will re-render when the selection changes because it's passed into the list as extraData const selected = this.state.selectedIds[props.id]; return ( <UserListRow key={props.id} {...props} selectable={true} selected={selected} enabled={true} testID='more_direct_messages.user' /> ); }; filterUnknownUsers = (u) => Boolean(this.props.allProfiles[u.id]) renderLoading = () => { const {theme} = this.props; const {loading} = this.state; const style = getStyleFromTheme(theme); if (!loading) { return null; } return ( <View style={style.loadingContainer}> <FormattedText {...loadingText} style={style.loadingText} /> </View> ); }; renderNoResults = () => { const {loading} = this.state; const {theme} = this.props; const style = getStyleFromTheme(theme); if (loading || this.page === -1) { return null; } return ( <View style={style.noResultContainer}> <FormattedText id='mobile.custom_list.no_results' defaultMessage='No Results' style={style.noResultText} /> </View> ); }; render() { const {formatMessage} = this.context.intl; const {isGuest, currentUserId, theme} = this.props; const { loading, profiles, searchResults, selectedIds, selectedCount, startingConversation, term, } = this.state; const style = getStyleFromTheme(theme); if (startingConversation) { return ( <View style={style.container}> <StatusBar/> <Loading color={theme.centerChannelColor}/> </View> ); } const searchBarInput = { backgroundColor: changeOpacity(theme.centerChannelColor, 0.2), color: theme.centerChannelColor, fontSize: 15, }; let data; let listType; if (term) { const exactMatches = []; const filterByTerm = (p) => { if (selectedCount > 0 && p.id === currentUserId) { return false; } if (p.username === term || p.username.startsWith(term)) { exactMatches.push(p); return false; } return true; }; let results; if (isGuest) { results = filterProfilesMatchingTerm(searchResults, term).filter((u) => filterByTerm(u) && this.filterUnknownUsers(u)); } else { results = filterProfilesMatchingTerm(searchResults, term).filter(filterByTerm); } data = [...exactMatches, ...results]; listType = FLATLIST; } else { if (isGuest) { data = createProfilesSections(profiles.filter(this.filterUnknownUsers)); } else { data = createProfilesSections(profiles); } listType = SECTIONLIST; } return ( <SafeAreaView style={style.container}> <KeyboardLayout testID='more_direct_messages.screen'> <StatusBar/> <View style={style.searchBar}> <SearchBar testID='more_direct_messages.search_bar' ref={this.setSearchBarRef} placeholder={formatMessage({id: 'search_bar.search', defaultMessage: 'Search'})} cancelTitle={formatMessage({id: 'mobile.post.cancel', defaultMessage: 'Cancel'})} backgroundColor='transparent' inputHeight={33} inputStyle={searchBarInput} placeholderTextColor={changeOpacity(theme.centerChannelColor, 0.5)} tintColorSearch={changeOpacity(theme.centerChannelColor, 0.5)} tintColorDelete={changeOpacity(theme.centerChannelColor, 0.5)} titleCancelColor={theme.centerChannelColor} onChangeText={this.onSearch} onSearchButtonPress={this.onSearch} onCancelButtonPress={this.clearSearch} autoCapitalize='none' keyboardAppearance={getKeyboardAppearanceFromTheme(theme)} value={term} /> </View> <SelectedUsers selectedIds={this.state.selectedIds} warnCount={5} maxCount={7} onRemove={this.handleRemoveProfile} /> <CustomList data={data} extraData={selectedIds} key='custom_list' listType={listType} loading={loading} loadingComponent={this.renderLoading()} noResults={this.renderNoResults()} onLoadMore={this.getProfiles} onRowPress={this.handleSelectProfile} renderItem={this.renderItem} testID='more_direct_messages.list' theme={theme} /> </KeyboardLayout> </SafeAreaView> ); } } const getStyleFromTheme = makeStyleSheetFromTheme((theme) => { return { container: { flex: 1, }, searchBar: { marginVertical: 5, height: 38, }, loadingContainer: { alignItems: 'center', backgroundColor: theme.centerChannelBg, height: 70, justifyContent: 'center', }, loadingText: { color: changeOpacity(theme.centerChannelColor, 0.6), }, noResultContainer: { flexGrow: 1, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', }, noResultText: { fontSize: 26, color: changeOpacity(theme.centerChannelColor, 0.5), }, }; });
32.322581
136
0.53432
b50379efbfe18f6418d06b994ae569b3999a9b03
5,090
js
JavaScript
src/display/optional_content_config.js
ResearcherApp/pdf.js
e2cabe3d4ca01aa4f50f119e9d049c48cd1a8d95
[ "Apache-2.0" ]
1
2021-03-26T09:42:54.000Z
2021-03-26T09:42:54.000Z
src/display/optional_content_config.js
yrambler2001/pdf.js
da15dbf962a72bbc14fbbf04701757822da36f14
[ "Apache-2.0" ]
5
2021-01-23T12:10:47.000Z
2021-04-16T20:40:49.000Z
src/display/optional_content_config.js
yrambler2001/pdf.js
da15dbf962a72bbc14fbbf04701757822da36f14
[ "Apache-2.0" ]
1
2021-08-29T14:28:20.000Z
2021-08-29T14:28:20.000Z
/* Copyright 2020 Mozilla Foundation * * 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. */ import { objectFromMap, warn } from "../shared/util.js"; class OptionalContentGroup { constructor(name, intent) { this.visible = true; this.name = name; this.intent = intent; } } class OptionalContentConfig { constructor(data) { this.name = null; this.creator = null; this._order = null; this._groups = new Map(); if (data === null) { return; } this.name = data.name; this.creator = data.creator; this._order = data.order; for (const group of data.groups) { this._groups.set( group.id, new OptionalContentGroup(group.name, group.intent) ); } if (data.baseState === "OFF") { for (const group of this._groups) { group.visible = false; } } for (const on of data.on) { this._groups.get(on).visible = true; } for (const off of data.off) { this._groups.get(off).visible = false; } } _evaluateVisibilityExpression(array) { const length = array.length; if (length < 2) { return true; } const operator = array[0]; for (let i = 1; i < length; i++) { const element = array[i]; let state; if (Array.isArray(element)) { state = this._evaluateVisibilityExpression(element); } else if (this._groups.has(element)) { state = this._groups.get(element).visible; } else { warn(`Optional content group not found: ${element}`); return true; } switch (operator) { case "And": if (!state) { return false; } break; case "Or": if (state) { return true; } break; case "Not": return !state; default: return true; } } return operator === "And"; } isVisible(group) { if (!group) { warn("Optional content group not defined."); return true; } if (group.type === "OCG") { if (!this._groups.has(group.id)) { warn(`Optional content group not found: ${group.id}`); return true; } return this._groups.get(group.id).visible; } else if (group.type === "OCMD") { // Per the spec, the expression should be preferred if available. if (group.expression) { return this._evaluateVisibilityExpression(group.expression); } if (!group.policy || group.policy === "AnyOn") { // Default for (const id of group.ids) { if (!this._groups.has(id)) { warn(`Optional content group not found: ${id}`); return true; } if (this._groups.get(id).visible) { return true; } } return false; } else if (group.policy === "AllOn") { for (const id of group.ids) { if (!this._groups.has(id)) { warn(`Optional content group not found: ${id}`); return true; } if (!this._groups.get(id).visible) { return false; } } return true; } else if (group.policy === "AnyOff") { for (const id of group.ids) { if (!this._groups.has(id)) { warn(`Optional content group not found: ${id}`); return true; } if (!this._groups.get(id).visible) { return true; } } return false; } else if (group.policy === "AllOff") { for (const id of group.ids) { if (!this._groups.has(id)) { warn(`Optional content group not found: ${id}`); return true; } if (this._groups.get(id).visible) { return false; } } return true; } warn(`Unknown optional content policy ${group.policy}.`); return true; } warn(`Unknown group type ${group.type}.`); return true; } setVisibility(id, visible = true) { if (!this._groups.has(id)) { warn(`Optional content group not found: ${id}`); return; } this._groups.get(id).visible = !!visible; } getOrder() { if (!this._groups.size) { return null; } if (this._order) { return this._order.slice(); } return Array.from(this._groups.keys()); } getGroups() { return this._groups.size > 0 ? objectFromMap(this._groups) : null; } getGroup(id) { return this._groups.get(id) || null; } } export { OptionalContentConfig };
26.237113
75
0.549509
6fec421957af655999490ff95e7e9bc81f06a793
1,734
js
JavaScript
src/main/resources/gwt/material/design/addins/client/subheader/resources/js/subheader.js
enterstudio/gwt-material-addins
6eaf447d7e7ab0e6469777683de594bd82c7a2ed
[ "Apache-2.0" ]
37
2015-11-19T15:53:12.000Z
2021-04-03T22:38:18.000Z
src/main/resources/gwt/material/design/addins/client/subheader/resources/js/subheader.js
enterstudio/gwt-material-addins
6eaf447d7e7ab0e6469777683de594bd82c7a2ed
[ "Apache-2.0" ]
360
2015-12-01T15:20:51.000Z
2021-12-23T14:08:34.000Z
src/main/resources/gwt/material/design/addins/client/subheader/resources/js/subheader.js
enterstudio/gwt-material-addins
6eaf447d7e7ab0e6469777683de594bd82c7a2ed
[ "Apache-2.0" ]
57
2015-11-30T17:25:28.000Z
2022-01-29T18:09:10.000Z
function initSubheader(stickyElem, containerElem) { jQuery(document).ready(function(){ var newStickies = new stickyTitles(stickyElem, containerElem); newStickies.load(); $(containerElem).on("scroll", function() { newStickies.scroll(); }); }); } function stickyTitles(stickyElem, containerElem) { var stickies = jQuery(stickyElem); var container = jQuery(containerElem); container.addClass("subheader-container"); /** Added top holder component **/ var topHolder = document.createElement("div"); $(topHolder).addClass("top_holder"); container.prepend(topHolder); this.load = function() { stickies.each(function() { var thisSticky = jQuery(this).wrap('<div class="followWrap" />'); thisSticky.parent().height(thisSticky.outerHeight()); jQuery.data(thisSticky[0], 'pos', thisSticky.position().top); }); }; this.scroll = function() { $(topHolder).css('top', container.scrollTop()); $(topHolder).addClass("z-depth-1"); stickies.each(function(i) { var thisSticky = jQuery(this), nextSticky = stickies.eq(i+1), prevSticky = stickies.eq(i-1), pos = jQuery.data(thisSticky[0], 'pos'); if(container.scrollTop() == 0) { $(topHolder).hide(); } else { $(topHolder).show(); } if (pos <= container.scrollTop()) { $(topHolder).html(''); thisSticky.clone().appendTo($(topHolder)); } else { thisSticky.removeAttr('style').show(); if (prevSticky.length > 0 && container.offset().top <= jQuery.data(thisSticky[0], 'pos') - prevSticky.outerHeight()) { prevSticky.removeClass("absolute").removeAttr("style"); } } }); } }
30.964286
126
0.615917
6feaa9f6eadbf5b1b13c1df25ce57586cd71aebb
8,282
js
JavaScript
src/main/webapp/js/actions/templates.js
hcfman/stalkedbythestate
49d9c0767e29e30d7e28880c42e1fdcd9b8d331c
[ "Apache-2.0" ]
3
2021-08-07T20:21:55.000Z
2021-09-30T13:13:39.000Z
src/main/webapp/js/actions/templates.js
hcfman/hydracontrolfreak
b0ed63ccc76601ebfcf6bf0a72142171ce06a31a
[ "Apache-2.0" ]
null
null
null
src/main/webapp/js/actions/templates.js
hcfman/hydracontrolfreak
b0ed63ccc76601ebfcf6bf0a72142171ce06a31a
[ "Apache-2.0" ]
null
null
null
/** Collection of shared templates */ // // ATTRIBUTES // // default SharedTemplates.setTemplate('attribute-default', '\ <tr>\ <td><label>%{name}</label></td>\ <td %{attribs}><input type="text" class="attribute_value" name="%{property}" value="%{value}" /></td>\ </tr>\ '); //phidget list SharedTemplates.setTemplate('attribute-phidgetname', '\ <tr>\ <td><label>Phidget Name</label></td>\ <td>\ <select id="action_phidgets" name="phidgetName">\ %{each, var:availablePhidgets, repeatString:<option value="%value">%value</options>}\ </select>\ </td>\ </tr>\ '); //rfxcom command list SharedTemplates.setTemplate('attribute-rfxcomcommand', '\ <tr>\ <td><label>Command</label></td>\ <td>\ <select id="action_rfxcom" name="rfxcomCommand">\ %{each, var:availableRfxcomCommands, repeatString:<option value="%value">%value</options>}\ </select>\ </td>\ </tr>\ '); // E-mail Group Names SharedTemplates.setTemplate('attribute-responsegroup', '\ <tr>\ <td><label>Response Buttons</label></td>\ <td>\ <select id="action_responsegroup" name="responseGroup">\ <option value="">Not required</options>\ %{each, var:availableButtonGroups, repeatString:<option value="%value">%value</options>}\ </select>\ </td>\ </tr>\ '); // cameralist SharedTemplates.setTemplate('attribute-cameraset', '\ <tr>\ <td colspan="2"><label>List of cameras</label>\ <br />\ <select id="action_cameras" name="cameraSet" multiple="multiple">\ %{each, var:availableCameras, repeatString:<option value="%value">Camera #%value</options>}\ </select>\ </td>\ </tr>\ '); //cameralist remote SharedTemplates.setTemplate('attribute-cameraset-remote', '\ <tr id="cameraset-remote">\ <td colspan="2"><label>List of remote cameras</label>\ <br />\ <select id="action_cameras" name="cameraSet" multiple="multiple">\ %{each, var:remoteCameras, repeatString:<option value="%value">Camera #%value</options>}\ </select>\ </td>\ </tr>\ '); //cameralist SharedTemplates.setTemplate('attribute-videotype', '\ <tr>\ <td><label>Video Type</label></td>\ <td><select id="action_videotype" name="videoType">\ %{each, var:availableVideoTypes, repeatString:<option value="%value">%value</options>}\ </select>\ </td>\ </tr>\ '); // methodType SharedTemplates.setTemplate('attribute-methodtype', '\ <tr>\ <td><label>Method type</label></td>\ <td>\ <select id="action_methodtype" name="methodType">\ %{each, var:availableMethodTypes, repeatString:<option value="%value">%value</options>}\ </select>\ </td>\ </tr>\ '); //tagname SharedTemplates.setTemplate('attribute-tagname', '\ <tr>\ <td><label>List of tags</label></td>\ <td>\ <select id="delete_tagname" name="tagName">\ %{each, var:deletableTagNames, repeatString:<option value="%value">%value</options>}\ </select>\ </td>\ </tr>\ '); //freakname SharedTemplates.setTemplate('attribute-freakname', '\ <tr>\ <td><label>Freak Name</label></td>\ <td>\ <select id="action_freakname" name="freakName" onchange="ActionController.listener.renderCameraListForFreak(this.value)">\ %{each, var:availableFreakNames, repeatString:<option value="%value">%value</options>}\ </select>\ </td>\ </tr>\ '); // direction SharedTemplates.setTemplate('attribute-direction', '\ <tr>\ <td><label>Direction</label></td>\ <td>\ <select id="action_direction" name="direction">\ %{each, var:availableDirections, repeatString:<option value="%value">%value</options>}\ </select>\ </td>\ </tr>\ '); // parameters SharedTemplates.setTemplate('attribute-parameters', '\ <tr>\ <td><label>Parameters</label></td>\ <td>\ <input type="hidden" name="parameters" value="">\ <table class="action-parameters" style="width:auto;" cellspacing="0">\ <thead>\ <tr><th>Key</th><th>Value</th><th>&nbsp;</th></tr>\ </thead>\ <tbody>\ %{foreach, var:parameters, repeatString:<tr><td><span class="token">%key</span></td><td><span class="token">%value</span></td><td><input type="button" value="-" onclick="ActionHelper.removeRow(this)"</td></tr>}\ </tbody>\ </table>\ <input type="button" name="Add parameter" onclick="JSDialog.openDialog(\'jsp/content/forms/key-value.html\', this)" value="Add parameter">\ <br><br>\ </td>\ </tr>\ '); //cameralist SharedTemplates.setTemplate('attribute-phidgetactiontype', '\ <tr>\ <td><label>Phidget Action Type</label></td>\ <td><select id="phidget_action_type" name="phidgetActionType" onchange="JSPostNotification(\'PhidgetActionTypeChanged\', this, {});">\ %{each, var:phidgedTypes, repeatString:<option value="%value">%value</options>}\ </select>\ </td>\ </tr>\ '); // actionName SharedTemplates.setTemplate('attribute-actionname', '\ <tr>\ <td colspan="2"><label>Action name</label>\ <br />\ <select id="action_actionname" name="actionName">\ %{each, var:availableActionNames, repeatString:<option value="%value">%value</options>}\ </select>\ </td>\ </tr>\ '); //protocol SharedTemplates.setTemplate('attribute-protocol', '\ <tr>\ <td><label>Protocol</label></td>\ <td>\ <select id="action_protocol" name="protocol" onchange="ActionController.listener.protocolChanged(this)">\ %{each, var:availableProtocols, repeatString:<option value="%value">%value</options>}\ </select>\ </td>\ </tr>\ '); SharedTemplates.setTemplate('attribute-url', '\ <tr>\ <td><label>Url</label></td>\ <td>\ <input type="text" name="url" onkeyup="ActionController.listener.urlChanged(this)" id="actionUrl" value="%{url}" onblur="ActionHelper.forceProtocol(this)">\ <span class="VerifyHostnameAttribute">&nbsp;<input type="checkbox" name="verifyHostname" checked>&nbsp;Verify hostname</span>\ </td>\ </tr>\ '); SharedTemplates.setTemplate('attribute-duration', '\ <tr id="duration">\ <td><label>Duration</label></td>\ <td>\ <input type="text" name="duration" value="%{duration}">\ </td>\ </tr>\ '); // // Action // // action in list SharedTemplates.setTemplate('action-list-empty', '\ <tr>\ <td><center>There are no actions defined</center></td>\ </tr>\ '); SharedTemplates.setTemplate('action-list-row', '\ <tr>\ <td width="50px" class="center"><img alt="%{guestImage}" src="images/%{guestImage}"></td>\ <td>%{eventName}</td>\ <td>%{actionType}</td>\ <td>%{name}</td>\ <td>%{description}</td>\ <td style="text-align:right"><input type="button" name="Edit action" value="Edit" onclick="JSPostNotification(\'EditAction\', this, {name:\'%{name}\'});"></td>\ <td style="text-align:right"><input title="Remove action" type="button" value="-" onclick="JSPostNotification(\'RemoveAction\', this, {name:\'%{name}\'});"></td>\ </tr>\ '); SharedTemplates.setTemplate('action-time', '\ <tr class="time-row">\ <td>Time&nbsp;&nbsp;</td>\ <td class="range"><div class="dows">%{dows}</div>\ <table><tbody>%{ranges}</tbody></table></td>\ <td><input type="button" value="-" onclick="TimeHelper.removeTime(this, %{timeIndex});"></td>\ </tr>\ '); SharedTemplates.setTemplate('counter-table', '\ <form onsubmit="return false">\ <table>\ <tbody>\ <tr>\ <td>Count</td>\ <td>&nbsp;</td>\ <td>%{count}</td>\ </tr>\ <tr>\ <td>Within</td>\ <td>&nbsp;</td>\ <td>%{withinSeconds} Secs</td>\ </tr>\ </tbody>\ </table>\ </form>\ '); SharedTemplates.setTemplate('action-time-range', '\ <tr>\ <td><span class="token">%{startHour}</span></td>\ <td>:</td>\ <td><span class="token">%{startMin}</span></td>\ <td>:</td>\ <td><span class="token">%{startSec}</span></td>\ <td> - </td>\ <td><span class="token tokenEndTime">%{endHour}</span></td>\ <td>:</td>\ <td><span class="token tokenEndTime">%{endMin}</span></td>\ <td>:</td>\ <td><span class="token tokenEndTime">%{endSec}</span></td>\ <td><input type="button" value="-" onclick="TimeHelper.removeTimeRange(this, %{rangeIndex});"></td>\ </tr>\ '); SharedTemplates.setTemplate('action-time-range-no-button', '\ <tr>\ <td><span class="token">%{startHour}</span></td>\ <td>:</td>\ <td><span class="token">%{startMin}</span></td>\ <td>:</td>\ <td><span class="token">%{startSec}</span></td>\ <td> - </td>\ <td><span class="token tokenEndTime">%{endHour}</span></td>\ <td>:</td>\ <td><span class="token tokenEndTime">%{endMin}</span></td>\ <td>:</td>\ <td><span class="token tokenEndTime">%{endSec}</span></td>\ </tr>\ ');
27.885522
213
0.648998
b5067e5c19e32ff924e7abccfb0037056e730c18
15,630
js
JavaScript
docs/resources/sap/ui/layout/BlockLayoutRow-dbg.js
jacobahtan/devtoberfest-2021-frontend-coding-challenge
6d4f76689e88df978d179fd751344a240068a72d
[ "Apache-2.0" ]
3
2021-11-08T05:58:16.000Z
2021-11-18T18:51:25.000Z
docs/resources/sap/ui/layout/BlockLayoutRow-dbg.js
jacobahtan/devtoberfest-2021-frontend-coding-challenge
6d4f76689e88df978d179fd751344a240068a72d
[ "Apache-2.0" ]
44
2021-11-08T12:56:55.000Z
2021-11-15T06:59:54.000Z
docs/resources/sap/ui/layout/BlockLayoutRow-dbg.js
jacobahtan/devtoberfest-2021-frontend-coding-challenge
6d4f76689e88df978d179fd751344a240068a72d
[ "Apache-2.0" ]
72
2021-10-08T10:20:34.000Z
2021-12-10T04:06:21.000Z
/*! * OpenUI5 * (c) Copyright 2009-2020 SAP SE or an SAP affiliate company. * Licensed under the Apache License, Version 2.0 - see LICENSE.txt. */ /** * @typedef {Object} sap.ui.layout.BlockRowColorSets * @typedef {Object} sap.ui.layout.BlockLayoutRow */ sap.ui.define([ 'sap/ui/core/Control', './library', 'sap/ui/layout/BlockLayoutCellData', "./BlockLayoutRowRenderer", "sap/base/Log" ], function(Control, library, BlockLayoutCellData, BlockLayoutRowRenderer, Log) { "use strict"; // shortcut for sap.ui.layout.BlockBackgroundType var BlockBackgroundType = library.BlockBackgroundType; // shortcut for sap.ui.layout.BlockRowColorSets var BlockRowColorSets = library.BlockRowColorSets; /** * Constructor for a new BlockLayoutRow. * * @param {string} [sId] ID for the new control, generated automatically if no ID is given * @param {object} [mSettings] Initial settings for the new control * * @class * The BlockLayoutRow is used as an aggregation to the BlockLayout. It aggregates Block Layout cells. * The BlockLayoutRow has 2 rendering modes - scrollable and non scrollable. * @extends sap.ui.core.Control * * @author SAP SE * @version 1.76.0 * * @constructor * @public * @since 1.34 * @alias sap.ui.layout.BlockLayoutRow * @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel */ var BlockLayoutRow = Control.extend("sap.ui.layout.BlockLayoutRow", { metadata: { library: "sap.ui.layout", properties: { /** * Sets the rendering mode of the BlockLayoutRow to scrollable. In scrollable mode, the cells get * aligned side by side, with horizontal scroll bar for the row. */ scrollable: {type: "boolean", group: "Appearance", defaultValue: false}, /** * Defines background type for that row. * There might be several rows with the same type * @since 1.42 */ rowColorSet: {type: "sap.ui.layout.BlockRowColorSets", group: "Appearance"} }, defaultAggregation: "content", aggregations: { /** * The content cells to be included in the row. */ content: {type: "sap.ui.layout.BlockLayoutCell", multiple: true, singularName: "content"} }, associations: { /** * Cells that would be accented. * *Note:* This association has visual impact only for BlockLayouts with background types "Mixed" and "Accent". * * Mixed: In this type, areas of 25% (on desktop) can have a dark background color. Per section one area can be dark. * Accent: Every section can contain multiple gray blocks, which are used alternately, beginning with the bright one * * @since 1.42 */ accentCells: {type: "sap.ui.layout.BlockLayoutCell", multiple: true, singularName: "accentCell"} }, designtime: "sap/ui/layout/designtime/BlockLayoutRow.designtime" } }); BlockLayoutRow.prototype.init = function () { this._applyLayoutData = {}; }; BlockLayoutRow.prototype.addContent = function (oContent) { this._ensureLayoutData(oContent); return this.addAggregation("content", oContent); }; BlockLayoutRow.prototype.insertContent = function(oContent, index) { this._ensureLayoutData(oContent); return this.insertAggregation("content", oContent, index); }; /** * Performs guidelines check */ BlockLayoutRow.prototype.onBeforeRendering = function () { var aCells = this.getContent(), that = this; aCells.forEach(function (oCell, index) { that._ensureLayoutData(oCell); oCell._setParentRowScrollable(that.getScrollable()); }); this._calculateBreakpointRendering(); }; /** * Changes dynamically row color set * Note: this might invalidate cells inside and also change color sets of the other BlockLayoutRow-s below it. * @public * @method * @param {sap.ui.layout.BlockRowColorSets} sType * @since 1.42 * @returns {sap.ui.layout.BlockLayoutRow} */ BlockLayoutRow.prototype.setRowColorSet = function (sType) { // Apply here so if there's an exception the code bellow won't be executed var aArgs = Array.prototype.slice.call(arguments), oObject = Control.prototype.setProperty.apply(this, ["rowColorSet"].concat(aArgs)), sClassName = "sapUiBlockLayoutBackground" + sType, oBlockLayout = this.getParent(), sBackground = oBlockLayout && oBlockLayout.getBackground(), iThisIndexInParent = oBlockLayout && oBlockLayout.indexOfAggregation("content", this), aParentContent = oBlockLayout && oBlockLayout.getContent(), oPrevBlockRow = (iThisIndexInParent && aParentContent[iThisIndexInParent - 1]) || null, oNextBlockRow = (aParentContent && aParentContent[iThisIndexInParent + 1]) || null, oBlockRowColorSets = BlockRowColorSets, aColorSets = Object.keys(oBlockRowColorSets).map(function (sKey) { return oBlockRowColorSets[sKey]; }), bInvertedColorSet = false; if (oPrevBlockRow && oPrevBlockRow._hasStyleClass(sClassName, sBackground, bInvertedColorSet, sType)) { sClassName += "Inverted"; bInvertedColorSet = true; } aColorSets.forEach(function (sCurType) { var sColorSetStyle = "sapUiBlockLayoutBackground" + sCurType, sInvertedColorSetStyle = sColorSetStyle + "Inverted"; if (this._hasStyleClass(sColorSetStyle, sBackground, false, sCurType)) { this.removeStyleClass(sColorSetStyle, true); } else if (this._hasStyleClass(sInvertedColorSetStyle, sBackground, true, sCurType)) { this.removeStyleClass(sInvertedColorSetStyle, true); } }, this); this.addStyleClass(sClassName, true); // If the next row is of the same type and has the same CSS class, recalculate it and cascade if (oNextBlockRow && oNextBlockRow._hasStyleClass(sClassName, sBackground, bInvertedColorSet, sType)) { oNextBlockRow.setRowColorSet.apply(oNextBlockRow, aArgs); } // Invalidate the whole row as the background dependencies, row color sets and accent cells should be resolved properly this.invalidate(); return oObject; }; BlockLayoutRow.prototype.addAccentCell = function (vId) { var oObject, sId = vId && vId.getId ? vId.getId() : vId, args = Array.prototype.slice.call(arguments), oBackgrounds = BlockBackgroundType, oBlockLayout = this.getParent(), sLayoutBackground = oBlockLayout && (oBlockLayout.getBackground() || ""); oObject = this.addAssociation.apply(this, ["accentCells"].concat(args)); if (!oBlockLayout) { return this; } if ([oBackgrounds.Accent, oBackgrounds.Mixed].indexOf(sLayoutBackground) === -1) { Log.warning(sId + " was not se as accent cell. Accent cells could be set only for 'Accent' and 'Mixed' layout backgrounds."); return this; } if (oBackgrounds.Mixed === sLayoutBackground) { this._processMixedCellStyles(sId, this.getContent()); } else if (oBackgrounds.Accent === sLayoutBackground) { this._processAccentCellStyles(this.getAccentCells(), this.getContent()); } return oObject; }; BlockLayoutRow.prototype._ensureLayoutData = function (oContent) { var oOldData = oContent.getLayoutData(); if (!oOldData || !(oOldData instanceof BlockLayoutCellData)) { oContent.setLayoutData(new BlockLayoutCellData()); } }; BlockLayoutRow.prototype._onParentSizeChange = function (currentSize) { this._currentSize = currentSize; this._calculateBreakpointRendering(); this.invalidate(); }; BlockLayoutRow.prototype._getCellArangementForCurrentSize = function () { if (!this._arrangements || !this._currentSize) { return null; } return this._arrangements[this._currentSize]; }; BlockLayoutRow.prototype._calculateBreakpointRendering = function () { if (!this._currentSize) { return; } this._arrangements = { //For S we take the data from the LayoutData of the cells "S": this._calcArrangementForSize("S"), //For M we take the data from the LayoutData of the cells "M": this._calcArrangementForSize("M"), //For L we take the data from the LayoutData of the cells "L": this._calcArrangementForSize("L"), //For Xl we take the data from the LayoutData of the cells "XL": this._calcArrangementForSize("Xl") }; }; /** * Calculates each row for the corresponding arrangement size. * @private * @method * @param {string} sSizeName The size that needs to be calculated * @returns {any[][]} */ BlockLayoutRow.prototype._calcArrangementForSize = function (sSizeName) { var aContent = this.getContent(); if (aContent.length >= 3 && sSizeName === "M" && aContent.length < 5) { return this._generateArrangementForMCase(); } else { return this._generateArrangement(sSizeName); } }; BlockLayoutRow.prototype._generateArrangement = function (sSizeName) { var oLayoutData, iIndex = 0, aFlatData = [], aBreakOn = [], aArrangement = [[]], aContent = this.getContent(); aContent.forEach(function (oCell) { oLayoutData = oCell.getLayoutData(); aBreakOn.push(oLayoutData["breakRowOn" + sSizeName + "Size"]); aFlatData.push(oLayoutData["get" + sSizeName + "Size"]()); }); aFlatData.forEach(function (iData, i) { aArrangement[iIndex].push(iData); if (aBreakOn[i + 1]) { iIndex++; aArrangement[iIndex] = []; } }); return aArrangement; }; BlockLayoutRow.prototype._generateArrangementForMCase = function () { var aContent = this.getContent(); if (aContent.length === 3 && this._isAllCellsHasSameWidth("M")) { return [[1, 1, 1]]; } else if (aContent.length === 3) { return [[1, 1], [1]]; // This is the case where we have for example 25% 25% 50% } else if (aContent.length === 4) { return [[1, 1], [1, 1]]; } }; BlockLayoutRow.prototype._isAllCellsHasSameWidth = function (sSizeName) { var iCurrentRowSize, aContent = this.getContent(), iFirstRowSize = aContent[0].getLayoutData()["get" + sSizeName + "Size"](); for (var i = 1; i < aContent.length; i++) { iCurrentRowSize = aContent[i].getLayoutData()["get" + sSizeName + "Size"](); if (iCurrentRowSize !== iFirstRowSize) { return false; } } return true; }; /** * Adjusts accents cells for Mixed background layout * @private * @method * @param {string} sId The ID of the row that will be processed * @param {Array} aCells Cells in the current row * @returns {sap.ui.layout.BlockLayoutRow} */ BlockLayoutRow.prototype._processMixedCellStyles = function (sId, aCells) { var oBlockLayout, bProcessAccentCells; if (!aCells || !aCells.length) { return this; } oBlockLayout = this.getParent(); bProcessAccentCells = oBlockLayout && (oBlockLayout.hasStyleClass("sapUiBlockLayoutSizeL") || oBlockLayout.hasStyleClass("sapUiBlockLayoutSizeXL")); aCells.forEach(function (oCell) { var oColorSets, bUseContrast2; // Accent only on a cell with 25% width and L, XL sizes if (bProcessAccentCells && oCell.getId() === sId && oCell.getWidth() === 1) { oCell.addStyleClass("sapContrast").addStyleClass("sapContrastPlus"); oColorSets = BlockRowColorSets; bUseContrast2 = this._hasStyleClass("sapUiBlockLayoutBackground" + oColorSets.ColorSet1, BlockBackgroundType.Mixed, false, oColorSets.ColorSet1) || this._hasStyleClass("sapUiBlockLayoutBackground" + oColorSets.ColorSet1, BlockBackgroundType.Mixed, true, oColorSets.ColorSet1); if (bUseContrast2) { oCell.addStyleClass("sapUiBlockLayoutBackgroundContrast2"); } } else if ((!bProcessAccentCells || oCell.getId() !== sId) && (oCell.hasStyleClass("sapContrast") || oCell.hasStyleClass("sapContrastPlus"))) { oCell.removeStyleClass("sapContrast").removeStyleClass("sapContrastPlus").removeStyleClass("sapUiBlockLayoutBackgroundContrast2"); this.removeAssociation("accentCells", oCell); Log.warning(sId + " was removed as accent cell. Only one cell at a time could be accented for Mixed layout background"); } }, this); return this; }; /** * Adjusts accents cells for Accent background layout. * @private * @method * @param {Array} aAccentCells Cells with accent contrast * @param {Array} aRowCells All cells in the row * @returns {sap.ui.layout.BlockLayoutRow} */ BlockLayoutRow.prototype._processAccentCellStyles = function (aAccentCells, aRowCells) { var oCell, sCellId, sCalculatedStyleClass, iIndex = 0, iInvertCellColorsModulo = 0, aAccentCellsCopy = Array.prototype.slice.call(aAccentCells); if (!aAccentCells || !aAccentCells.length) { return this; } // Find the index of current accented cell and check if it should be of Accent type 1 OR 2 for (iIndex = 0; iIndex < aRowCells.length; iIndex++) { oCell = aRowCells[iIndex]; sCellId = oCell.getId(); if (!aAccentCellsCopy.length) { break; } if (aAccentCellsCopy.indexOf(sCellId) > -1) { iInvertCellColorsModulo++; sCalculatedStyleClass = "sapUiBlockLayoutBackgroundColorSetGray" + ((iInvertCellColorsModulo % 2) + 1); // If the cell already has the expected class, shouldn't loop further as everything below is already adjusted if (oCell.hasStyleClass(sCalculatedStyleClass)) { continue; } // Optimise a bit the next loop iteration aAccentCellsCopy.splice(aAccentCellsCopy.indexOf(sCellId), 1); oCell .removeStyleClass("sapUiBlockLayoutBackgroundColorSetGray1") .removeStyleClass("sapUiBlockLayoutBackgroundColorSetGray2") .addStyleClass(sCalculatedStyleClass); } } return this; }; /** * Checks for specific cases when two row color sets share the same colors e.g. Light and Mixed backgrounds. * @private * @method * @param {string} sStyleClass * @param {sap.ui.layout.BlockBackgroundType} sLayoutBackground Background type of the <code>BlockLayout</code> * @param {boolean} bIsColorInverted Determines if the color inverted * @param {sap.ui.layout.BlockRowColorSets} sType The current color set of the given row * @returns {boolean} Determines if the row contains the class */ BlockLayoutRow.prototype._hasStyleClass = function (sStyleClass, sLayoutBackground, bIsColorInverted, sType) { var oBackgrounds = BlockBackgroundType, oColorSets = BlockRowColorSets, i, aStyleClasses, aEqualSets; // Check if this is NOT Mixed or Light background and just do the normal check if ([oBackgrounds.Light, oBackgrounds.Mixed].indexOf(sLayoutBackground) === -1) { return this.hasStyleClass(sStyleClass); } else if (this.hasStyleClass(sStyleClass)) { // Check if this class is there and don't continue further return true; } // Define array with equal sets aEqualSets = [ [oColorSets.ColorSet1, oColorSets.ColorSet3], [oColorSets.ColorSet2, oColorSets.ColorSet4] ]; // Find on which index is sType for (i = 0; i <= aEqualSets.length; i++) { if (aEqualSets[i] && aEqualSets[i].indexOf(sType) > -1) { break; } } // If it's not found there, then return false, as if the class was inside, it would fulfill the first hasStyleClass above if (!aEqualSets[i]) { return false; } // Build class strings to check against aStyleClasses = aEqualSets[i].map(function (sColorSet) { return "sapUiBlockLayoutBackground" + sColorSet + (bIsColorInverted ? "Inverted" : ""); }); // Check if any of the classes is inside return aStyleClasses.some(this.hasStyleClass, this); }; return BlockLayoutRow; });
34.579646
152
0.692962
b5142d9dfec4b1f347d3f86f9c5358f4293c6068
1,272
js
JavaScript
src/manager/azure/compute/keypair.js
crms-team/crms
6a36ee96947ad1f44dad2c946698071378f94cd5
[ "Apache-2.0" ]
54
2020-10-08T12:01:47.000Z
2022-02-09T16:58:06.000Z
src/manager/azure/compute/keypair.js
crms-team/crms
6a36ee96947ad1f44dad2c946698071378f94cd5
[ "Apache-2.0" ]
30
2020-09-03T14:12:44.000Z
2020-10-26T06:27:32.000Z
src/manager/azure/compute/keypair.js
crms-team/crms
6a36ee96947ad1f44dad2c946698071378f94cd5
[ "Apache-2.0" ]
5
2020-10-08T12:17:29.000Z
2021-07-23T02:44:36.000Z
import { Manager } from "../../manager"; export class KeyPairManager extends Manager { static endpoint() { return `${process.env.REACT_APP_SERVER_URL}/api/cloud/data/keypair`; } static async update(keyId, args) { return await fetch(this.endpoint(), { method: "put", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ key_id: keyId, args: args, }), }).then((res) => res.json()); } static async create(keyId, args) { return await fetch(this.endpoint(), { method: "post", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ key_id: keyId, args: args, }), }).then((res) => res.json()); } static async delete(keyId, args) { return await fetch(this.endpoint(), { method: "delete", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ key_id: keyId, args: args, }), }).then((res) => res.json()); } }
27.06383
76
0.451258
6ffc42786d0677c5d2d0d5953f5553607330b58c
13,574
js
JavaScript
sources/videojs-playlist-ui/src/plugin.js
m053m716/RC-Data
f3d89e56379bbc19572b7f3f2cbfeb05e2d37d22
[ "MIT" ]
108
2015-06-20T07:33:48.000Z
2022-03-28T13:45:32.000Z
src/plugin.js
brightcove/videojs-playlist-ui
ec58e336d86f3c417f358242b35de002321535e8
[ "Apache-2.0" ]
90
2015-03-17T23:14:50.000Z
2021-12-30T13:54:06.000Z
sources/videojs-playlist-ui/src/plugin.js
m053m716/RC-Data
f3d89e56379bbc19572b7f3f2cbfeb05e2d37d22
[ "MIT" ]
77
2015-06-30T18:05:51.000Z
2021-12-07T11:19:33.000Z
import document from 'global/document'; import videojs from 'video.js'; import {version as VERSION} from '../package.json'; const dom = videojs.dom || videojs; const registerPlugin = videojs.registerPlugin || videojs.plugin; // Array#indexOf analog for IE8 const indexOf = function(array, target) { for (let i = 0, length = array.length; i < length; i++) { if (array[i] === target) { return i; } } return -1; }; // see https://github.com/Modernizr/Modernizr/blob/master/feature-detects/css/pointerevents.js const supportsCssPointerEvents = (() => { const element = document.createElement('x'); element.style.cssText = 'pointer-events:auto'; return element.style.pointerEvents === 'auto'; })(); const defaults = { className: 'vjs-playlist', playOnSelect: false, supportsCssPointerEvents }; // we don't add `vjs-playlist-now-playing` in addSelectedClass // so it won't conflict with `vjs-icon-play // since it'll get added when we mouse out const addSelectedClass = function(el) { el.addClass('vjs-selected'); }; const removeSelectedClass = function(el) { el.removeClass('vjs-selected'); if (el.thumbnail) { dom.removeClass(el.thumbnail, 'vjs-playlist-now-playing'); } }; const upNext = function(el) { el.addClass('vjs-up-next'); }; const notUpNext = function(el) { el.removeClass('vjs-up-next'); }; const createThumbnail = function(thumbnail) { if (!thumbnail) { const placeholder = document.createElement('div'); placeholder.className = 'vjs-playlist-thumbnail vjs-playlist-thumbnail-placeholder'; return placeholder; } const picture = document.createElement('picture'); picture.className = 'vjs-playlist-thumbnail'; if (typeof thumbnail === 'string') { // simple thumbnails const img = document.createElement('img'); img.src = thumbnail; img.alt = ''; picture.appendChild(img); } else { // responsive thumbnails // additional variations of a <picture> are specified as // <source> elements for (let i = 0; i < thumbnail.length - 1; i++) { const variant = thumbnail[i]; const source = document.createElement('source'); // transfer the properties of each variant onto a <source> for (const prop in variant) { source[prop] = variant[prop]; } picture.appendChild(source); } // the default version of a <picture> is specified by an <img> const variant = thumbnail[thumbnail.length - 1]; const img = document.createElement('img'); img.alt = ''; for (const prop in variant) { img[prop] = variant[prop]; } picture.appendChild(img); } return picture; }; const Component = videojs.getComponent('Component'); class PlaylistMenuItem extends Component { constructor(player, playlistItem, settings) { if (!playlistItem.item) { throw new Error('Cannot construct a PlaylistMenuItem without an item option'); } playlistItem.showDescription = settings.showDescription; super(player, playlistItem); this.item = playlistItem.item; this.playOnSelect = settings.playOnSelect; this.emitTapEvents(); this.on(['click', 'tap'], this.switchPlaylistItem_); this.on('keydown', this.handleKeyDown_); } handleKeyDown_(event) { // keycode 13 is <Enter> // keycode 32 is <Space> if (event.which === 13 || event.which === 32) { this.switchPlaylistItem_(); } } switchPlaylistItem_(event) { this.player_.playlist.currentItem(indexOf(this.player_.playlist(), this.item)); if (this.playOnSelect) { this.player_.play(); } } createEl() { const li = document.createElement('li'); const item = this.options_.item; const showDescription = this.options_.showDescription; if (typeof item.data === 'object') { const dataKeys = Object.keys(item.data); dataKeys.forEach(key => { const value = item.data[key]; li.dataset[key] = value; }); } li.className = 'vjs-playlist-item'; li.setAttribute('tabIndex', 0); // Thumbnail image this.thumbnail = createThumbnail(item.thumbnail); li.appendChild(this.thumbnail); // Duration if (item.duration) { const duration = document.createElement('time'); const time = videojs.formatTime(item.duration); duration.className = 'vjs-playlist-duration'; duration.setAttribute('datetime', 'PT0H0M' + item.duration + 'S'); duration.appendChild(document.createTextNode(time)); li.appendChild(duration); } // Now playing const nowPlayingEl = document.createElement('span'); const nowPlayingText = this.localize('Now Playing'); nowPlayingEl.className = 'vjs-playlist-now-playing-text'; nowPlayingEl.appendChild(document.createTextNode(nowPlayingText)); nowPlayingEl.setAttribute('title', nowPlayingText); this.thumbnail.appendChild(nowPlayingEl); // Title container contains title and "up next" const titleContainerEl = document.createElement('div'); titleContainerEl.className = 'vjs-playlist-title-container'; this.thumbnail.appendChild(titleContainerEl); // Up next const upNextEl = document.createElement('span'); const upNextText = this.localize('Up Next'); upNextEl.className = 'vjs-up-next-text'; upNextEl.appendChild(document.createTextNode(upNextText)); upNextEl.setAttribute('title', upNextText); titleContainerEl.appendChild(upNextEl); // Video title const titleEl = document.createElement('cite'); const titleText = item.name || this.localize('Untitled Video'); titleEl.className = 'vjs-playlist-name'; titleEl.appendChild(document.createTextNode(titleText)); titleEl.setAttribute('title', titleText); titleContainerEl.appendChild(titleEl); // We add thumbnail video description only if specified in playlist options if (showDescription) { const descriptionEl = document.createElement('div'); const descriptionText = item.description || ''; descriptionEl.className = 'vjs-playlist-description'; descriptionEl.appendChild(document.createTextNode(descriptionText)); descriptionEl.setAttribute('title', descriptionText); titleContainerEl.appendChild(descriptionEl); } return li; } } class PlaylistMenu extends Component { constructor(player, options) { if (!player.playlist) { throw new Error('videojs-playlist is required for the playlist component'); } super(player, options); this.items = []; if (options.horizontal) { this.addClass('vjs-playlist-horizontal'); } else { this.addClass('vjs-playlist-vertical'); } // If CSS pointer events aren't supported, we have to prevent // clicking on playlist items during ads with slightly more // invasive techniques. Details in the stylesheet. if (options.supportsCssPointerEvents) { this.addClass('vjs-csspointerevents'); } this.createPlaylist_(); if (!videojs.browser.TOUCH_ENABLED) { this.addClass('vjs-mouse'); } this.on(player, ['loadstart', 'playlistchange', 'playlistsorted'], (event) => { this.update(); }); // Keep track of whether an ad is playing so that the menu // appearance can be adapted appropriately this.on(player, 'adstart', () => { this.addClass('vjs-ad-playing'); }); this.on(player, 'adend', () => { this.removeClass('vjs-ad-playing'); }); this.on('dispose', () => { this.empty_(); player.playlistMenu = null; }); this.on(player, 'dispose', () => { this.dispose(); }); } createEl() { return dom.createEl('div', {className: this.options_.className}); } empty_() { if (this.items && this.items.length) { this.items.forEach(i => i.dispose()); this.items.length = 0; } } createPlaylist_() { const playlist = this.player_.playlist() || []; let list = this.el_.querySelector('.vjs-playlist-item-list'); let overlay = this.el_.querySelector('.vjs-playlist-ad-overlay'); if (!list) { list = document.createElement('ol'); list.className = 'vjs-playlist-item-list'; this.el_.appendChild(list); } this.empty_(); // create new items for (let i = 0; i < playlist.length; i++) { const item = new PlaylistMenuItem(this.player_, { item: playlist[i] }, this.options_); this.items.push(item); list.appendChild(item.el_); } // Inject the ad overlay. IE<11 doesn't support "pointer-events: // none" so we use this element to block clicks during ad // playback. if (!overlay) { overlay = document.createElement('li'); overlay.className = 'vjs-playlist-ad-overlay'; list.appendChild(overlay); } else { // Move overlay to end of list list.appendChild(overlay); } // select the current playlist item const selectedIndex = this.player_.playlist.currentItem(); if (this.items.length && selectedIndex >= 0) { addSelectedClass(this.items[selectedIndex]); const thumbnail = this.items[selectedIndex].$('.vjs-playlist-thumbnail'); if (thumbnail) { dom.addClass(thumbnail, 'vjs-playlist-now-playing'); } } } update() { // replace the playlist items being displayed, if necessary const playlist = this.player_.playlist(); if (this.items.length !== playlist.length) { // if the menu is currently empty or the state is obviously out // of date, rebuild everything. this.createPlaylist_(); return; } for (let i = 0; i < this.items.length; i++) { if (this.items[i].item !== playlist[i]) { // if any of the playlist items have changed, rebuild the // entire playlist this.createPlaylist_(); return; } } // the playlist itself is unchanged so just update the selection const currentItem = this.player_.playlist.currentItem(); for (let i = 0; i < this.items.length; i++) { const item = this.items[i]; if (i === currentItem) { addSelectedClass(item); if (document.activeElement !== item.el()) { dom.addClass(item.thumbnail, 'vjs-playlist-now-playing'); } notUpNext(item); } else if (i === currentItem + 1) { removeSelectedClass(item); upNext(item); } else { removeSelectedClass(item); notUpNext(item); } } } } /** * Returns a boolean indicating whether an element has child elements. * * Note that this is distinct from whether it has child _nodes_. * * @param {HTMLElement} el * A DOM element. * * @return {boolean} * Whether the element has child elements. */ const hasChildEls = (el) => { for (let i = 0; i < el.childNodes.length; i++) { if (dom.isEl(el.childNodes[i])) { return true; } } return false; }; /** * Finds the first empty root element. * * @param {string} className * An HTML class name to search for. * * @return {HTMLElement} * A DOM element to use as the root for a playlist. */ const findRoot = (className) => { const all = document.querySelectorAll('.' + className); let el; for (let i = 0; i < all.length; i++) { if (!hasChildEls(all[i])) { el = all[i]; break; } } return el; }; /** * Initialize the plugin on a player. * * @param {Object} [options] * An options object. * * @param {HTMLElement} [options.el] * A DOM element to use as a root node for the playlist. * * @param {string} [options.className] * An HTML class name to use to find a root node for the playlist. * * @param {boolean} [options.playOnSelect = false] * If true, will attempt to begin playback upon selecting a new * playlist item in the UI. */ const playlistUi = function(options) { const player = this; if (!player.playlist) { throw new Error('videojs-playlist plugin is required by the videojs-playlist-ui plugin'); } if (dom.isEl(options)) { videojs.log.warn('videojs-playlist-ui: Passing an element directly to playlistUi() is deprecated, use the "el" option instead!'); options = {el: options}; } options = videojs.mergeOptions(defaults, options); // If the player is already using this plugin, remove the pre-existing // PlaylistMenu, but retain the element and its location in the DOM because // it will be re-used. if (player.playlistMenu) { const el = player.playlistMenu.el(); // Catch cases where the menu may have been disposed elsewhere or the // element removed from the DOM. if (el) { const parentNode = el.parentNode; const nextSibling = el.nextSibling; // Disposing the menu will remove `el` from the DOM, but we need to // empty it ourselves to be sure. player.playlistMenu.dispose(); dom.emptyEl(el); // Put the element back in its place. if (nextSibling) { parentNode.insertBefore(el, nextSibling); } else { parentNode.appendChild(el); } options.el = el; } } if (!dom.isEl(options.el)) { options.el = findRoot(options.className); } player.playlistMenu = new PlaylistMenu(player, options); }; // register components videojs.registerComponent('PlaylistMenu', PlaylistMenu); videojs.registerComponent('PlaylistMenuItem', PlaylistMenuItem); // register the plugin registerPlugin('playlistUi', playlistUi); playlistUi.VERSION = VERSION; export default playlistUi;
27.533469
133
0.648298
6ff9895cd224d5f0fc628abecce63646a6a39c15
2,046
js
JavaScript
packages/composer-common/lib/commitdecorator.js
aidtechnology/composer
677fcc8a97d59cac4a4c6575028cb802e37a0de8
[ "Apache-2.0", "CC-BY-4.0" ]
1,914
2017-04-19T18:03:29.000Z
2022-03-29T23:20:12.000Z
packages/composer-common/lib/commitdecorator.js
aidtechnology/composer
677fcc8a97d59cac4a4c6575028cb802e37a0de8
[ "Apache-2.0", "CC-BY-4.0" ]
2,715
2017-04-19T14:58:37.000Z
2020-01-31T05:46:18.000Z
packages/composer-common/lib/commitdecorator.js
B0uMe/composer
d08ba48351aef4a4f45f19a8d1fdf7ba1bc81aa2
[ "Apache-2.0", "CC-BY-4.0" ]
1,010
2017-04-20T12:09:09.000Z
2022-03-29T23:20:14.000Z
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 'use strict'; const Decorator = require('./introspect/decorator'); const IllegalModelException = require('./introspect/illegalmodelexception'); /** * Specialised decorator implementation for the @commit decorator. */ class CommitDecorator extends Decorator { /** * Create a Decorator. * @param {ClassDeclaration | Property} parent - the owner of this property * @param {Object} ast - The AST created by the parser * @throws {IllegalModelException} */ constructor(parent, ast) { super(parent, ast); } /** * Process the AST and build the model * @throws {IllegalModelException} * @private */ process() { super.process(); const args = this.getArguments(); if (args.length !== 1) { throw new IllegalModelException(`@commit decorator expects 1 argument, but ${args.length} arguments were specified.`, this.parent.getModelFile(), this.ast.location); } const arg = args[0]; if (typeof arg !== 'boolean') { throw new IllegalModelException(`@commit decorator expects a boolean argument, but an argument of type ${typeof arg} was specified.`, this.parent.getModelFile(), this.ast.location); } this.value = arg; } /** * Get the value of this commit decorator. * @return {boolean} The value of this commit decorator. */ getValue() { return this.value; } } module.exports = CommitDecorator;
31.96875
193
0.662757
6fed3d7b4fd266823d6937d51bc8338decf61b8c
1,004
js
JavaScript
test/built-ins/DataView/prototype/setUint16/index-check-before-value-conversion.js
smikes/test262
163fae3e68998c1a69e1e6825bf34e89b76cff58
[ "BSD-3-Clause" ]
null
null
null
test/built-ins/DataView/prototype/setUint16/index-check-before-value-conversion.js
smikes/test262
163fae3e68998c1a69e1e6825bf34e89b76cff58
[ "BSD-3-Clause" ]
null
null
null
test/built-ins/DataView/prototype/setUint16/index-check-before-value-conversion.js
smikes/test262
163fae3e68998c1a69e1e6825bf34e89b76cff58
[ "BSD-3-Clause" ]
null
null
null
// Copyright (C) 2015 André Bargull. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-dataview.prototype.setuint16 description: > RangeError exception for negative or non-integral index is thrown before the value conversion. info: > ... 3. Return SetViewValue(v, byteOffset, littleEndian, "Uint16", value). 24.2.1.2 SetViewValue ( view, requestIndex, isLittleEndian, type, value ) ... 4. Let getIndex be ? ToIndex(requestIndex). ... ---*/ var dataView = new DataView(new ArrayBuffer(8), 0); var poisoned = { valueOf: function() { throw new Test262Error("valueOf called"); } }; assert.throws(RangeError, function() { dataView.setUint16(-1.5, poisoned); }, "setUint16(-1.5, poisoned)"); assert.throws(RangeError, function() { dataView.setUint16(-1, poisoned); }, "setUint16(-1, poisoned)"); assert.throws(RangeError, function() { dataView.setUint16(-Infinity, poisoned); }, "setUint16(-Infinity, poisoned)");
25.74359
75
0.699203
6ff0eebee6b14f22f17b4849d34657dbf2fcfb39
1,327
js
JavaScript
lib/routes.js
Toms88/NodeJSSandBox
5bac23db87486a9499d74c109cb40dcf53d61130
[ "BSD-3-Clause" ]
null
null
null
lib/routes.js
Toms88/NodeJSSandBox
5bac23db87486a9499d74c109cb40dcf53d61130
[ "BSD-3-Clause" ]
null
null
null
lib/routes.js
Toms88/NodeJSSandBox
5bac23db87486a9499d74c109cb40dcf53d61130
[ "BSD-3-Clause" ]
null
null
null
if ((typeof routerLoaded === "undefined") || ((typeof routerLoaded === "boolean") && !routerLoaded)) { require('./router')(); } //node modules import const fs = require('fs'); const mime = require('mime'); let routesData = { routes: {}, routesLoaded: false }; //default 404 result page route routes = registerRoute(routes, '404', (req, res) => { res.statusCode = 404; res.statusMessage = 'Route is not set.'; res.end(); }); //public file route routes = registerRoute(routes, 'public', (req, res) => { res.setHeader('Content-Type', mime.getType(req.url)); if (fs.existsSync(__dirname + '/public' + req.url)) { res.write(fs.readFileSync(__dirname + '/public' + req.url)); res.statusCode = 200; } else { res.statusCode = 404; } res.end(); }); //homepage route routes = registerRoute(routes, '/', (req, res) => { try { res.setHeader('Content-Type', 'text/html'); res.write(fs.readFileSync(__dirname + '/index.html')); res.statusCode = 200; res.end(); } catch(e) { res.statusCode = 500; res.statusMessage = "server error"; res.end(); } }); module.exports = function() { console.log(routes); routesData.routes = routes routesData.routesLoaded = true; return routesData; }
25.037736
68
0.592313
6ff4abb47b44db4050e1de395cd31de34038e7e5
368
js
JavaScript
packages/manager/apps/dedicated/client/app/dedicatedCloud/license/enable/dedicatedCloud-license-enable.routes.js
AnneSophieS/manager
fc88dc01b15ade39d5664761d4057574f9520317
[ "BSD-3-Clause" ]
null
null
null
packages/manager/apps/dedicated/client/app/dedicatedCloud/license/enable/dedicatedCloud-license-enable.routes.js
AnneSophieS/manager
fc88dc01b15ade39d5664761d4057574f9520317
[ "BSD-3-Clause" ]
null
null
null
packages/manager/apps/dedicated/client/app/dedicatedCloud/license/enable/dedicatedCloud-license-enable.routes.js
AnneSophieS/manager
fc88dc01b15ade39d5664761d4057574f9520317
[ "BSD-3-Clause" ]
null
null
null
angular.module('App').config( /* @ngInject */ ($stateProvider) => { $stateProvider.state('app.dedicatedClouds.license.enable', { controller: 'ovhManagerPccLicenseEnable', controllerAs: '$ctrl', layout: 'modal', templateUrl: 'dedicatedCloud/license/enable/dedicatedCloud-license-enable.html', url: '/enable', }); }, );
28.307692
75
0.633152
b501e5a0327087f4ccdda280adb01179377a78e3
94
js
JavaScript
doc/html/search/pages_0.js
ajorstad/vmtk.github.com
8bfbb149b6c4bf2536af69cb49b722e42c3e6580
[ "BSD-3-Clause" ]
null
null
null
doc/html/search/pages_0.js
ajorstad/vmtk.github.com
8bfbb149b6c4bf2536af69cb49b722e42c3e6580
[ "BSD-3-Clause" ]
7
2017-01-14T15:12:11.000Z
2021-06-18T09:46:57.000Z
doc/html/search/pages_0.js
ajorstad/vmtk.github.com
8bfbb149b6c4bf2536af69cb49b722e42c3e6580
[ "BSD-3-Clause" ]
5
2017-01-14T12:55:17.000Z
2021-06-12T03:04:42.000Z
var searchData= [ ['vmtk_20documentation',['VMTK Documentation',['../index.html',1,'']]] ];
18.8
72
0.638298
b5168663b3258f920906fe5cc951edabf1e9d8c5
3,401
js
JavaScript
shared/desktop/app/main-window.js
jamesmwright/client
b37a74a1ec263f3c51fcb8521103720adc41fd9a
[ "BSD-3-Clause" ]
2
2019-05-24T14:10:09.000Z
2019-05-24T14:27:56.000Z
shared/desktop/app/main-window.js
jamesmwright/client
b37a74a1ec263f3c51fcb8521103720adc41fd9a
[ "BSD-3-Clause" ]
2
2021-05-12T00:09:57.000Z
2022-03-25T19:18:23.000Z
shared/desktop/app/main-window.js
MichaelAquilina/client
0300a8228787479799ebb2734ef82d75d07c127f
[ "BSD-3-Clause" ]
null
null
null
// @flow import AppState from './app-state' import Window from './window' import getenv from 'getenv' import hotPath from '../hot-path' import {app, ipcMain} from 'electron' import {forceMainWindowPosition, showDevTools} from '../../local-debug.desktop' import {hideDockIcon} from './dock-icon' import {injectReactQueryParams} from '../../util/dev' import {resolveRootAsURL} from '../resolve-root' import {windowStyle} from '../../styles' export default function () { let appState = new AppState({ defaultWidth: windowStyle.width, defaultHeight: windowStyle.height, }) appState.checkOpenAtLogin() const mainWindow = new Window( resolveRootAsURL('renderer', injectReactQueryParams('renderer.html?mainWindow')), { x: appState.state.x, y: appState.state.y, width: appState.state.width, height: appState.state.height, minWidth: windowStyle.minWidth, minHeight: windowStyle.minHeight, show: false, } ) const webContents = mainWindow.window.webContents webContents.on('did-finish-load', () => { webContents.send('load', { scripts: [ ...(__DEV__ ? [{ src: resolveRootAsURL('dist', 'dll/dll.vendor.js'), async: false, }] : []), { src: hotPath('index.bundle.js'), async: false, }, ], }) }) if (showDevTools) { webContents.openDevTools('detach') } appState.manageWindow(mainWindow.window) if (__DEV__ && forceMainWindowPosition) { mainWindow.window.setPosition(forceMainWindowPosition.x, forceMainWindowPosition.y) } const openedAtLogin = app.getLoginItemSettings().wasOpenedAtLogin const isRestore = getenv.boolish('KEYBASE_RESTORE_UI', false) || app.getLoginItemSettings().restoreState const hideWindowOnStart = getenv.string('KEYBASE_START_UI', '') === 'hideWindow' const openHidden = app.getLoginItemSettings().wasOpenedAsHidden console.log('Opened at login:', openedAtLogin) console.log('Is restore:', isRestore) console.log('Open hidden:', openHidden) // Don't show main window: // - If we are set to open hidden, // - or, if we hide window on start, // - or, if we are restoring and window was hidden // - or, if we were opened from login (but not restoring) const hideMainWindow = openHidden || hideWindowOnStart || (isRestore && appState.state.windowHidden) || (openedAtLogin && !isRestore) console.log('Hide main window:', hideMainWindow) if (!hideMainWindow) { // On Windows we can try showing before Windows is ready // This will result in a dropped .show request // We add a listener to `did-finish-load` so we can show it when // Windows is ready. mainWindow.show(true) mainWindow.window.webContents.once('did-finish-load', () => { mainWindow.show(true) }) } // Don't show dock: // - If we are set to open hidden, // - or, if we are restoring and dock was hidden // - or, if we were opened from login (but not restoring) const shouldHideDockIcon = openHidden || (isRestore && appState.state.dockHidden) || (openedAtLogin && !isRestore) console.log('Hide dock icon:', shouldHideDockIcon) if (shouldHideDockIcon) { hideDockIcon() } ipcMain.on('showMain', () => { console.log('Show main window (requested)') mainWindow.show(true) mainWindow.window && mainWindow.window.focus() }) return mainWindow }
33.019417
135
0.67686
b514338119709363d0f7106e39e725acffce1473
1,296
js
JavaScript
packages/manager/modules/pci/src/projects/project/training/onboarding/onboarding.routing.js
brugere/manager
ebc661c51c921daabed35d045f1fad60d5d24e89
[ "BSD-3-Clause" ]
141
2019-10-18T15:00:40.000Z
2022-02-24T20:17:12.000Z
packages/manager/modules/pci/src/projects/project/training/onboarding/onboarding.routing.js
brugere/manager
ebc661c51c921daabed35d045f1fad60d5d24e89
[ "BSD-3-Clause" ]
2,181
2019-10-21T08:06:37.000Z
2022-03-31T18:41:21.000Z
packages/manager/modules/pci/src/projects/project/training/onboarding/onboarding.routing.js
brugere/manager
ebc661c51c921daabed35d045f1fad60d5d24e89
[ "BSD-3-Clause" ]
81
2019-10-22T07:52:54.000Z
2022-03-11T09:19:37.000Z
export default /* @ngInject */ ($stateProvider) => { $stateProvider.state('pci.projects.project.training.onboarding', { url: '/onboarding', views: { 'content@pci.projects.project.training': 'pciProjectTrainingOnboarding', }, resolve: { breadcrumb: () => null, // Hide breadcrumb submitJobLink: /* @ngInject */ ($state, projectId) => () => $state.go('pci.projects.project.training.jobs.submit', { projectId, }), createAuthorization: /* @ngInject */ ( $state, PciProjectTrainingService, projectId, ) => () => PciProjectTrainingService.createAuthorization(projectId).then( (hasBeenAuthorized) => { if (hasBeenAuthorized) { $state.go( 'pci.projects.project.training.dashboard', { projectId, }, { reload: true, }, ); } else { $state.go( 'pci.projects.project.training.onboarding', { projectId, }, { reload: true, }, ); } }, ), }, }); };
28.173913
78
0.443673
6fff03f00fdddd915f91bbec7973ebc1326b3b5a
7,730
js
JavaScript
url/urlsearchparams-constructor.any.js
Ms2ger/web-platform-tests
645c0e8a5c028a613e7ad1732834100dbe946fc7
[ "BSD-3-Clause" ]
1
2022-03-19T09:43:35.000Z
2022-03-19T09:43:35.000Z
url/urlsearchparams-constructor.any.js
Ms2ger/web-platform-tests
645c0e8a5c028a613e7ad1732834100dbe946fc7
[ "BSD-3-Clause" ]
1
2019-02-13T09:53:48.000Z
2019-02-13T09:53:48.000Z
url/urlsearchparams-constructor.any.js
Ms2ger/web-platform-tests
645c0e8a5c028a613e7ad1732834100dbe946fc7
[ "BSD-3-Clause" ]
null
null
null
test(function() { var params = new URLSearchParams(); assert_equals(params + '', ''); params = new URLSearchParams(''); assert_equals(params + '', ''); params = new URLSearchParams('a=b'); assert_equals(params + '', 'a=b'); params = new URLSearchParams(params); assert_equals(params + '', 'a=b'); }, 'Basic URLSearchParams construction'); test(function() { var params = new URLSearchParams() assert_equals(params.toString(), "") }, "URLSearchParams constructor, no arguments") test(() => { var params = new URLSearchParams(DOMException); assert_equals(params.toString(), "INDEX_SIZE_ERR=1&DOMSTRING_SIZE_ERR=2&HIERARCHY_REQUEST_ERR=3&WRONG_DOCUMENT_ERR=4&INVALID_CHARACTER_ERR=5&NO_DATA_ALLOWED_ERR=6&NO_MODIFICATION_ALLOWED_ERR=7&NOT_FOUND_ERR=8&NOT_SUPPORTED_ERR=9&INUSE_ATTRIBUTE_ERR=10&INVALID_STATE_ERR=11&SYNTAX_ERR=12&INVALID_MODIFICATION_ERR=13&NAMESPACE_ERR=14&INVALID_ACCESS_ERR=15&VALIDATION_ERR=16&TYPE_MISMATCH_ERR=17&SECURITY_ERR=18&NETWORK_ERR=19&ABORT_ERR=20&URL_MISMATCH_ERR=21&QUOTA_EXCEEDED_ERR=22&TIMEOUT_ERR=23&INVALID_NODE_TYPE_ERR=24&DATA_CLONE_ERR=25") assert_throws(new TypeError(), () => new URLSearchParams(DOMException.prototype), "Constructing a URLSearchParams from DOMException.prototype should throw due to branding checks"); }, "URLSearchParams constructor, DOMException as argument") test(() => { var params = new URLSearchParams(''); assert_true(params != null, 'constructor returned non-null value.'); assert_equals(params.__proto__, URLSearchParams.prototype, 'expected URLSearchParams.prototype as prototype.'); }, "URLSearchParams constructor, empty string as argument") test(() => { var params = new URLSearchParams({}); assert_equals(params + '', ""); }, 'URLSearchParams constructor, {} as argument'); test(function() { var params = new URLSearchParams('a=b'); assert_true(params != null, 'constructor returned non-null value.'); assert_true(params.has('a'), 'Search params object has name "a"'); assert_false(params.has('b'), 'Search params object has not got name "b"'); params = new URLSearchParams('a=b&c'); assert_true(params != null, 'constructor returned non-null value.'); assert_true(params.has('a'), 'Search params object has name "a"'); assert_true(params.has('c'), 'Search params object has name "c"'); params = new URLSearchParams('&a&&& &&&&&a+b=& c&m%c3%b8%c3%b8'); assert_true(params != null, 'constructor returned non-null value.'); assert_true(params.has('a'), 'Search params object has name "a"'); assert_true(params.has('a b'), 'Search params object has name "a b"'); assert_true(params.has(' '), 'Search params object has name " "'); assert_false(params.has('c'), 'Search params object did not have the name "c"'); assert_true(params.has(' c'), 'Search params object has name " c"'); assert_true(params.has('møø'), 'Search params object has name "møø"'); }, 'URLSearchParams constructor, string.'); test(function() { var seed = new URLSearchParams('a=b&c=d'); var params = new URLSearchParams(seed); assert_true(params != null, 'constructor returned non-null value.'); assert_equals(params.get('a'), 'b'); assert_equals(params.get('c'), 'd'); assert_false(params.has('d')); // The name-value pairs are copied when created; later updates // should not be observable. seed.append('e', 'f'); assert_false(params.has('e')); params.append('g', 'h'); assert_false(seed.has('g')); }, 'URLSearchParams constructor, object.'); test(function() { var params = new URLSearchParams('a=b+c'); assert_equals(params.get('a'), 'b c'); params = new URLSearchParams('a+b=c'); assert_equals(params.get('a b'), 'c'); }, 'Parse +'); test(function() { const testValue = '+15555555555'; const params = new URLSearchParams(); params.set('query', testValue); var newParams = new URLSearchParams(params.toString()); assert_equals(params.toString(), 'query=%2B15555555555'); assert_equals(params.get('query'), testValue); assert_equals(newParams.get('query'), testValue); }, 'Parse encoded +'); test(function() { var params = new URLSearchParams('a=b c'); assert_equals(params.get('a'), 'b c'); params = new URLSearchParams('a b=c'); assert_equals(params.get('a b'), 'c'); }, 'Parse space'); test(function() { var params = new URLSearchParams('a=b%20c'); assert_equals(params.get('a'), 'b c'); params = new URLSearchParams('a%20b=c'); assert_equals(params.get('a b'), 'c'); }, 'Parse %20'); test(function() { var params = new URLSearchParams('a=b\0c'); assert_equals(params.get('a'), 'b\0c'); params = new URLSearchParams('a\0b=c'); assert_equals(params.get('a\0b'), 'c'); }, 'Parse \\0'); test(function() { var params = new URLSearchParams('a=b%00c'); assert_equals(params.get('a'), 'b\0c'); params = new URLSearchParams('a%00b=c'); assert_equals(params.get('a\0b'), 'c'); }, 'Parse %00'); test(function() { var params = new URLSearchParams('a=b\u2384'); assert_equals(params.get('a'), 'b\u2384'); params = new URLSearchParams('a\u2384b=c'); assert_equals(params.get('a\u2384b'), 'c'); }, 'Parse \u2384'); // Unicode Character 'COMPOSITION SYMBOL' (U+2384) test(function() { var params = new URLSearchParams('a=b%e2%8e%84'); assert_equals(params.get('a'), 'b\u2384'); params = new URLSearchParams('a%e2%8e%84b=c'); assert_equals(params.get('a\u2384b'), 'c'); }, 'Parse %e2%8e%84'); // Unicode Character 'COMPOSITION SYMBOL' (U+2384) test(function() { var params = new URLSearchParams('a=b\uD83D\uDCA9c'); assert_equals(params.get('a'), 'b\uD83D\uDCA9c'); params = new URLSearchParams('a\uD83D\uDCA9b=c'); assert_equals(params.get('a\uD83D\uDCA9b'), 'c'); }, 'Parse \uD83D\uDCA9'); // Unicode Character 'PILE OF POO' (U+1F4A9) test(function() { var params = new URLSearchParams('a=b%f0%9f%92%a9c'); assert_equals(params.get('a'), 'b\uD83D\uDCA9c'); params = new URLSearchParams('a%f0%9f%92%a9b=c'); assert_equals(params.get('a\uD83D\uDCA9b'), 'c'); }, 'Parse %f0%9f%92%a9'); // Unicode Character 'PILE OF POO' (U+1F4A9) test(function() { var params = new URLSearchParams([]); assert_true(params != null, 'constructor returned non-null value.'); params = new URLSearchParams([['a', 'b'], ['c', 'd']]); assert_equals(params.get("a"), "b"); assert_equals(params.get("c"), "d"); assert_throws(new TypeError(), function() { new URLSearchParams([[1]]); }); assert_throws(new TypeError(), function() { new URLSearchParams([[1,2,3]]); }); }, "Constructor with sequence of sequences of strings"); [ { "input": {"+": "%C2"}, "output": [["+", "%C2"]], "name": "object with +" }, { "input": {c: "x", a: "?"}, "output": [["c", "x"], ["a", "?"]], "name": "object with two keys" }, { "input": [["c", "x"], ["a", "?"]], "output": [["c", "x"], ["a", "?"]], "name": "array with two keys" }, { "input": {"a\0b": "42", "c\uD83D": "23", "d\u1234": "foo"}, "output": [["a\0b", "42"], ["c\uFFFD", "23"], ["d\u1234", "foo"]], "name": "object with NULL, non-ASCII, and surrogate keys" } ].forEach((val) => { test(() => { let params = new URLSearchParams(val.input), i = 0 for (let param of params) { assert_array_equals(param, val.output[i]) i++ } }, "Construct with " + val.name) }) test(() => { var params = new URLSearchParams() params[Symbol.iterator] = function *() { yield ["a", "b"] } let params2 = new URLSearchParams(params) assert_equals(params2.get("a"), "b") }, "Custom [Symbol.iterator]")
43.184358
542
0.64489
6ff1f68dc8b2d05f6482ed74d48b9ad99b805fd0
6,153
js
JavaScript
third_party/blink/web_tests/http/tests/devtools/tracing/trace-event-self-time.js
iridium-browser/iridium-browser
907e31cf5ce5ad14d832796e3a7c11e496828959
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
575
2015-06-18T23:58:20.000Z
2022-03-23T09:32:39.000Z
third_party/blink/web_tests/http/tests/devtools/tracing/trace-event-self-time.js
iridium-browser/iridium-browser
907e31cf5ce5ad14d832796e3a7c11e496828959
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
113
2015-05-04T09:58:14.000Z
2022-01-31T19:35:03.000Z
third_party/blink/web_tests/http/tests/devtools/tracing/trace-event-self-time.js
DamieFC/chromium
54ce2d3c77723697efd22cfdb02aea38f9dfa25c
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
52
2015-07-14T10:40:50.000Z
2022-03-15T01:11:49.000Z
// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. (async function() { TestRunner.addResult(`Test trace event self time.\n`); await TestRunner.loadModule('timeline'); await TestRunner.loadTestModule('performance_test_runner'); await TestRunner.showPanel('timeline'); var sessionId = '6.23'; var rawTraceEvents = [ { 'args': {'name': 'Renderer'}, 'cat': '__metadata', 'name': 'process_name', 'ph': 'M', 'pid': 17851, 'tid': 23, 'ts': 0 }, { 'args': {'name': 'CrRendererMain'}, 'cat': '__metadata', 'name': 'thread_name', 'ph': 'M', 'pid': 17851, 'tid': 23, 'ts': 0 }, { 'args': {'sessionId': sessionId, 'page': '0x4age111'}, 'cat': 'disabled-by-default-devtools.timeline', 'name': 'TracingStartedInPage', 'ph': 'I', 'pid': 17851, 'tid': 23, 'ts': 100000, 'tts': 606543 }, { 'args': {}, 'cat': 'disabled-by-default-devtools.timeline', 'name': 'Program', 'ph': 'B', 'pid': 17851, 'tid': 23, 'ts': 200000, 'tts': 5612442 }, { 'args': {'data': {'frame': '0x2f7b63884000'}}, 'cat': 'disabled-by-default-devtools.timeline', 'name': 'InvalidateLayout', 'ph': 'I', 'pid': 17851, 'tid': 23, 'ts': 210000, 'tts': 5612442 }, { 'args': {'beginData': {'dirtyObjects': 10, 'frame': '0x2f7b63884000', 'partialLayout': true, 'totalObjects': 179}}, 'cat': 'disabled-by-default-devtools.timeline', 'name': 'Layout', 'ph': 'B', 'pid': 17851, 'tid': 23, 'ts': 220000, 'tts': 1758056 }, { 'endData': {'layoutRoots': [{'nodeId': 1, 'depth': 1, 'quads': [[0, 286, 1681, 286, 1681, 1371, 0, 1371]]}]}, 'cat': 'disabled-by-default-devtools.timeline', 'name': 'Layout', 'ph': 'E', 'pid': 17851, 'tid': 23, 'ts': 270000, 'tts': 1758430 }, { 'args': {}, 'cat': 'disabled-by-default-devtools.timeline', 'name': 'Program', 'ph': 'E', 'pid': 17851, 'tid': 23, 'ts': 300000, 'tts': 5612451 }, { 'args': {}, 'cat': 'disabled-by-default-devtools.timeline', 'name': 'Program', 'ph': 'B', 'pid': 17851, 'tid': 23, 'ts': 400000, 'tts': 5612504 }, { 'args': {'type': 'blur'}, 'cat': 'disabled-by-default-devtools.timeline', 'dur': 60000, 'name': 'EventDispatch', 'ph': 'X', 'pid': 17851, 'tdur': 60, 'tid': 23, 'ts': 410000, 'tts': 1769084 }, { 'args': { 'data': { 'frame': '0x2f7b63884000', 'scriptId': '52', 'scriptLine': 539, 'scriptName': 'devtools://devtools/bundled/ui/UIUtils.js' } }, 'cat': 'disabled-by-default-devtools.timeline', 'dur': 10000, 'name': 'FunctionCall', 'ph': 'X', 'pid': 17851, 'tdur': 74, 'tid': 23, 'ts': 420000, 'tts': 1769136 }, { 'args': { 'data': { 'frame': '0x2f7b63884000', 'scriptId': '52', 'scriptLine': 539, 'scriptName': 'devtools://devtools/bundled/ui/UIUtils.js' } }, 'cat': 'disabled-by-default-devtools.timeline', 'dur': 10000, 'name': 'FunctionCall', 'ph': 'X', 'pid': 17851, 'tdur': 74, 'tid': 23, 'ts': 440000, 'tts': 1769136 }, { 'args': {}, 'cat': 'disabled-by-default-devtools.timeline', 'name': 'Animation', 'ph': 'b', 'pid': 17851, 'tid': 23, 'ts': 445000, }, { 'args': {'data': {'page': '0x4age222'}}, 'cat': 'disabled-by-default-devtools.timeline', 'name': 'CommitLoad', 'ph': 'X', 'dur': 1000, 'pid': 17851, 'tid': 23, 'ts': 446000, }, { 'args': {}, 'cat': 'webkit.console', 'name': 'timestamp', 'ph': 'S', 'pid': 17851, 'tid': 23, 'ts': 450000, }, { 'args': {}, 'cat': 'disabled-by-default-devtools.timeline', 'name': 'Program', 'ph': 'E', 'pid': 17851, 'tid': 23, 'ts': 500000, 'tts': 5612506 }, { 'args': {}, 'cat': 'disabled-by-default-devtools.timeline', 'name': 'Program', 'ph': 'B', 'pid': 17851, 'tid': 23, 'ts': 1200000, }, { 'args': {}, 'cat': 'disabled-by-default-devtools.timeline', 'name': 'Animation', 'ph': 'e', 'pid': 17851, 'tid': 23, 'ts': 1245000, }, { 'args': {}, 'cat': 'webkit.console', 'name': 'timestamp', 'ph': 'F', 'pid': 17851, 'tid': 23, 'ts': 1345000, }, { 'args': {}, 'cat': 'disabled-by-default-devtools.timeline', 'name': 'Program', 'ph': 'E', 'pid': 17851, 'tid': 23, 'ts': 1500000, }, ]; var cpuProfile = { startTime: 420e3, endTime: 430e3, nodes: [ {callFrame: {functionName: '(root)'}, id: 1, children: [2]}, {callFrame: {functionName: 'foo'}, id: 2, children: [3, 4]}, {callFrame: {functionName: 'bar'}, id: 3}, {callFrame: {functionName: 'baz'}, id: 4} ], timeDeltas: new Array(9).fill(1000), samples: [2, 2, 3, 3, 3, 4, 4, 2, 2] }; var timelineController = PerformanceTestRunner.createTimelineController(); timelineController._addCpuProfile(SDK.targetManager.mainTarget().id(), cpuProfile); timelineController.traceEventsCollected(rawTraceEvents); await timelineController._finalizeTrace(); var events = UI.panels.timeline._performanceModel.timelineModel().inspectedTargetEvents(); events.forEach( e => TestRunner.addResult( `${e.name}: ${e.startTime} ${(e.selfTime || 0).toFixed(2)}/${(e.duration || 0).toFixed(2)}`)); TestRunner.completeTest(); })();
24.710843
117
0.486267
c5db1c19dd3762c3eabf8e118452933be5bbd413
227
js
JavaScript
mobile/omnimobile/src/routes.js
VicenzoMartinelli/react-node-chat-realtime
11ce9158e3463182a363c9841a7b115da2f7e9d9
[ "Apache-2.0" ]
null
null
null
mobile/omnimobile/src/routes.js
VicenzoMartinelli/react-node-chat-realtime
11ce9158e3463182a363c9841a7b115da2f7e9d9
[ "Apache-2.0" ]
13
2020-09-04T23:12:55.000Z
2022-02-18T01:41:36.000Z
mobile/omnimobile/src/routes.js
VicenzoMartinelli/react-node-chat-realtime
11ce9158e3463182a363c9841a7b115da2f7e9d9
[ "Apache-2.0" ]
null
null
null
import { createSwitchNavigator, createAppContainer } from 'react-navigation' export class componentName extends Component { render() { return ( <div> </div> ) } } export default componentName
16.214286
76
0.651982
c5db843f0f833c24ae838f47cb5cc87e1c779d63
8,405
js
JavaScript
assets/js/cg-171.js
binghe001/binghe001.github.io
c840d1cec7517560f6860401fa8ed31cc2c0f974
[ "Apache-2.0" ]
6
2022-03-28T08:09:49.000Z
2022-03-31T12:35:43.000Z
assets/js/cg-171.js
binghe001/binghe001.github.io
c840d1cec7517560f6860401fa8ed31cc2c0f974
[ "Apache-2.0" ]
null
null
null
assets/js/cg-171.js
binghe001/binghe001.github.io
c840d1cec7517560f6860401fa8ed31cc2c0f974
[ "Apache-2.0" ]
null
null
null
(window.webpackJsonp=window.webpackJsonp||[]).push([[171],{635:function(a,s,t){"use strict";t.r(s);var n=t(25),p=Object(n.a)({},(function(){var a=this,s=a.$createElement,t=a._self._c||s;return t("ContentSlotsDistributor",{attrs:{"slot-key":a.$parent.slotKey}},[t("h1",{attrs:{id:"appscan使用问题记录"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#appscan使用问题记录"}},[a._v("#")]),a._v(" AppScan使用问题记录")]),a._v(" "),t("h2",{attrs:{id:"appscan安装时出现错误1603"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#appscan安装时出现错误1603"}},[a._v("#")]),a._v(" AppScan安装时出现错误1603")]),a._v(" "),t("p",[a._v("是因为之前安装过,没有卸载干净导致报错。解决方法如下:")]),a._v(" "),t("p",[a._v("1、控制面板→程序和功能→选中程序卸载。")]),a._v(" "),t("p",[a._v("2、删除AppScan安装路径以及下面的所有内容。\n3、在系统[开始]->[运行(R)...]中,运行命令regedit来删除全部注册键(如果存在的话),以及下列的子 键:")]),a._v(" "),t("div",{staticClass:"language-bash line-numbers-mode"},[t("pre",{pre:!0,attrs:{class:"language-bash"}},[t("code",[a._v(" A.HKEY_LOCAL_MACHINE"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("\\")]),a._v("SOFTWARE"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("\\")]),a._v("IBM"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("\\")]),a._v(" Rational AppScan \n B.HKEY_CURRENT_USER"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("\\")]),a._v("Software"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("\\")]),a._v("IBM"),t("span",{pre:!0,attrs:{class:"token punctuation"}},[a._v("\\")]),a._v(" Rational AppScan\n")])]),a._v(" "),t("div",{staticClass:"line-numbers-wrapper"},[t("span",{staticClass:"line-number"},[a._v("1")]),t("br"),t("span",{staticClass:"line-number"},[a._v("2")]),t("br")])]),t("p",[a._v("4、删除Windows TEMP文件夹下面的所有内容:\nA.点击系统[开始]->[运行(R)...],输入 %temp%并运行\nB.当文件夹打开后,选择菜单[编辑]->[全部选定(A)],在选定文件的任何部分右击鼠标并选择删除\n(D)\n5、同样打开APPSCAN_TEMP文件夹:\nA.打开后删除里面所有的内容\nB.如果发生下面的错误,忽略该错误开始下一步操作")]),a._v(" "),t("div",{staticClass:"language-bash line-numbers-mode"},[t("pre",{pre:!0,attrs:{class:"language-bash"}},[t("code",[a._v(" %APPSCAN_TEMP% \n Windows cannot "),t("span",{pre:!0,attrs:{class:"token function"}},[a._v("find")]),a._v(" "),t("span",{pre:!0,attrs:{class:"token string"}},[a._v("'%APPSCAN_TEMP%'")]),t("span",{pre:!0,attrs:{class:"token builtin class-name"}},[a._v(".")]),a._v(" Make sure you typed the name \n correctly, and "),t("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("then")]),a._v(" try again. To search "),t("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("for")]),a._v(" a file, slick the Start \n button, and "),t("span",{pre:!0,attrs:{class:"token keyword"}},[a._v("then")]),a._v(" click Search.\n")])]),a._v(" "),t("div",{staticClass:"line-numbers-wrapper"},[t("span",{staticClass:"line-number"},[a._v("1")]),t("br"),t("span",{staticClass:"line-number"},[a._v("2")]),t("br"),t("span",{staticClass:"line-number"},[a._v("3")]),t("br"),t("span",{staticClass:"line-number"},[a._v("4")]),t("br")])]),t("p",[a._v('6、使用Windows自带的磁盘清理设置来清理您的电脑:\nA.在系统[开始]->[运行(R)...]中,输入命令: cleanmgr/sageset,选择"临时安装文件","安装日志\n文件","临时文件"并取消其他项目的勾选(这样工具的配置已经完成)。\nB.在系统[开始]->[运行(R)...]中,输入命令: cleanmgr/sagerun(这样就启动了清除功能,一般需 要几分钟才能完成)。\n7、重新启动电脑。')]),a._v(" "),t("h2",{attrs:{id:"appscan扫描后篡改网站代码"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#appscan扫描后篡改网站代码"}},[a._v("#")]),a._v(" AppScan扫描后篡改网站代码")]),a._v(" "),t("p",[a._v("在扫描配置→测试策略→勾选了侵入式,有可能会篡改掉网站的代码。如果会篡改的话在扫描的时候去掉这个勾选即可。(不过这个就呵呵了,要从代码上放置被侵入攻击)")]),a._v(" "),t("p",[t("img",{staticClass:"lazy",attrs:{alt:"","data-src":"https://img-blog.csdnimg.cn/20181113200302638.jpg",loading:"lazy"}})]),a._v(" "),t("h2",{attrs:{id:"appscan扫描过程中c盘空间不足"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#appscan扫描过程中c盘空间不足"}},[a._v("#")]),a._v(" AppScan扫描过程中C盘空间不足")]),a._v(" "),t("p",[a._v("1、建议不要勾选启用扫描日志,当扫描网站过大或扫描时间过长,随着日志文件变大会导致系统崩溃。如果已经勾选了,可以在工具→选项→启用扫描日志勾选去掉即可。")]),a._v(" "),t("p",[t("img",{staticClass:"lazy",attrs:{alt:"","data-src":"https://img-blog.csdnimg.cn/2018111320035182.jpg",loading:"lazy"}})]),a._v(" "),t("p",[a._v("2、如果要勾选的话,可以把用户文件保存到其它硬盘。默认的用户文件是:"),t("code",[a._v("C:\\Documents and Settings\\Administrator\\My Documents\\AppScan;")]),a._v(" 可以修改为其他路径。该路径可以在菜单栏中依次选择工具→选项→一般→文件位置部分修改。")]),a._v(" "),t("p",[a._v("3、如果已经把上面的地址都修改到了其他盘,但是在扫描过程中还是发现C 盘的空间快速被消耗,是因为很多临时文件都保存在C 盘,AppScan 中有一个隐藏的参数APPSCAN_TEMP 来设置临时文件位置。可以通过修改系统变量来修改到其他硬盘空间。临时文件位置说明:描述正常操作期间AppScan 将其临时文件保存到的位置。缺省情况下,AppScan 将其临时文件存储在以下位置:"),t("code",[a._v("C:\\Documents and Settings\\All Users\\Application Data\\IBM\\Rational AppScan\\temp")]),a._v(" 如果需要修改此缺省位置,请按照要求编辑环境变量APPSCAN_TEMP 的路径。")]),a._v(" "),t("p",[a._v("访问环境变量的方法是:右键单击我的电脑,然后依次选择属性→高级→环境变量。\n注意:在新位置的路径中绝不能有任何Unicode字符。\n修改AppScan 中的临时文件:桌面上鼠标右键选择我的电脑→属性→高级系统设置→高级→环境变量,增加一个新的“用户环境变量”,名字是“APPSCAN_TEMP”,设定路径,指向您希望保存临时文件的目录。")]),a._v(" "),t("p",[a._v("4、还可以始终暂停扫描稍后再启动,当然有了前面的方法我想也不需要这样了。")]),a._v(" "),t("h2",{attrs:{id:"appscan扫描时虚拟内存不足"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#appscan扫描时虚拟内存不足"}},[a._v("#")]),a._v(" AppScan扫描时虚拟内存不足")]),a._v(" "),t("p",[a._v("1、一个小时保存一次,以免出现故障的时候之前扫描的结果白费了;在工具→选项→扫描过程中自动保存设置为60分钟自动保存一次。")]),a._v(" "),t("p",[t("img",{staticClass:"lazy",attrs:{alt:"","data-src":"https://img-blog.csdnimg.cn/20181113200443626.jpg",loading:"lazy"}})]),a._v(" "),t("p",[a._v("2、可以在工具→选项→高级搜索PerformanceMonitor.RestartOnOutOfMemory把属性值改为true。使Rational AppScan当内存使用量相对过大时自动重新启动。 这样当扫描因为剩余的虚拟内存量过低从而被迫停止时,Rational AppScan会监测系统注册表的设定来决定是否重新启动。")]),a._v(" "),t("p",[t("img",{staticClass:"lazy",attrs:{alt:"","data-src":"https://img-blog.csdnimg.cn/20181113200519464.jpg",loading:"lazy"}})]),a._v(" "),t("h2",{attrs:{id:"appscan扫描时出现通信问题"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#appscan扫描时出现通信问题"}},[a._v("#")]),a._v(" AppScan扫描时出现通信问题")]),a._v(" "),t("p",[a._v("1、减小线程数,扫描配置→通信和代理。")]),a._v(" "),t("p",[a._v("2、加大超时数,扫描配置→通信和代理。")]),a._v(" "),t("p",[t("img",{staticClass:"lazy",attrs:{alt:"","data-src":"https://img-blog.csdnimg.cn/20181113200603524.jpg",loading:"lazy"}})]),a._v(" "),t("p",[a._v("3、服务器有防火墙,防火墙关闭之后即可扫描。")]),a._v(" "),t("h2",{attrs:{id:"appscan打开文件时提示-文件出现损坏"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#appscan打开文件时提示-文件出现损坏"}},[a._v("#")]),a._v(" AppScan打开文件时提示“文件出现损坏”")]),a._v(" "),t("p",[a._v("1、先试试这个、可能是因为Issch和ISUSPM自启动项被禁用了。运行“msconfig”看下,如果禁用状态,开启为开机启动即可。")]),a._v(" "),t("h2",{attrs:{id:"appscan整个扫描流程简述"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#appscan整个扫描流程简述"}},[a._v("#")]),a._v(" AppScan整个扫描流程简述")]),a._v(" "),t("p",[a._v("AppScan 使用步骤:计划、执行、检查、分析。")]),a._v(" "),t("p",[a._v("1、在计划阶段(plan):明确目的,进行策略性的选择和任务分解")]),a._v(" "),t("p",[a._v("A、明确目的:选择合适的扫描策略")]),a._v(" "),t("p",[a._v("B、了解对象:首先进行探索,了解网站结构和规模")]),a._v(" "),t("p",[a._v("​ C、确定策略:进行对应的配置")]),a._v(" "),t("p",[a._v("​ D、按照目录进行扫描任务的分解")]),a._v(" "),t("p",[a._v("​ E、按照扫描策略进行扫描任务的分解")]),a._v(" "),t("p",[a._v("2、执行阶段(Do):一边扫描一遍观察")]),a._v(" "),t("p",[a._v("A、先爬后扫(继续仅测试)")]),a._v(" "),t("p",[a._v("3、检查阶段(Check)")]),a._v(" "),t("p",[a._v("A、检查和调整配置(过程中可能会产生一些问题)")]),a._v(" "),t("p",[a._v("4、结果分析(Analysis)")]),a._v(" "),t("p",[a._v("A、对比结果")]),a._v(" "),t("p",[a._v("B、汇总结果(整合和过滤)")]),a._v(" "),t("p",[a._v("Ps.一般扫描的时候选择综合扫描会扫描的全面些。")]),a._v(" "),t("h2",{attrs:{id:"修改后验证"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#修改后验证"}},[a._v("#")]),a._v(" 修改后验证")]),a._v(" "),t("p",[a._v("1、右击需要验证的问题,点击重新测试,如果修复了的话,此问题会消失掉。")]),a._v(" "),t("p",[t("img",{staticClass:"lazy",attrs:{alt:"","data-src":"https://img-blog.csdnimg.cn/20181113200706706.jpg",loading:"lazy"}})]),a._v(" "),t("p",[a._v("2、对于HTML注释敏感信息泄露验证不掉的问题,可以点击具体问题然后查看请求/响应点击下一行突出显示看具体问题,然后在网站相应页面前台中查看是否已去掉此注释。")]),a._v(" "),t("p",[t("img",{staticClass:"lazy",attrs:{alt:"","data-src":"https://img-blog.csdnimg.cn/20181113200743651.jpg",loading:"lazy"}})]),a._v(" "),t("h2",{attrs:{id:"写在最后"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#写在最后"}},[a._v("#")]),a._v(" 写在最后")]),a._v(" "),t("blockquote",[t("p",[a._v("如果你觉得冰河写的还不错,请微信搜索并关注「 "),t("strong",[a._v("冰河技术")]),a._v(" 」微信公众号,跟冰河学习高并发、分布式、微服务、大数据、互联网和云原生技术,「 "),t("strong",[a._v("冰河技术")]),a._v(" 」微信公众号更新了大量技术专题,每一篇技术文章干货满满!不少读者已经通过阅读「 "),t("strong",[a._v("冰河技术")]),a._v(" 」微信公众号文章,吊打面试官,成功跳槽到大厂;也有不少读者实现了技术上的飞跃,成为公司的技术骨干!如果你也想像他们一样提升自己的能力,实现技术能力的飞跃,进大厂,升职加薪,那就关注「 "),t("strong",[a._v("冰河技术")]),a._v(" 」微信公众号吧,每天更新超硬核技术干货,让你对如何提升技术能力不再迷茫!")])]),a._v(" "),t("p",[t("img",{staticClass:"lazy",attrs:{alt:"","data-src":"https://img-blog.csdnimg.cn/20200906013715889.png",loading:"lazy"}})])])}),[],!1,null,null,null);s.default=p.exports}}]);
8,405
8,405
0.63843
c5dbd4687f7ae3763646bcad4181ae7f262c435e
1,506
js
JavaScript
server/models/product_detailModel.js
thangph9/123order-ant
88427b975b29fbf5b9f4d45a8460d7c60a5bfc2b
[ "MIT" ]
null
null
null
server/models/product_detailModel.js
thangph9/123order-ant
88427b975b29fbf5b9f4d45a8460d7c60a5bfc2b
[ "MIT" ]
null
null
null
server/models/product_detailModel.js
thangph9/123order-ant
88427b975b29fbf5b9f4d45a8460d7c60a5bfc2b
[ "MIT" ]
null
null
null
module.exports={ fields:{ productid : 'uuid', asin: 'text', title : 'text', price : 'float', sale : 'float', sale_price: 'float', createat : 'timestamp', sale : 'int', thumbnail : 'text', reviews : 'text', seller : 'text', brand : 'text', style : 'text', star : 'text', color : 'text', size : 'text', currency : 'text', size_desc : 'text', amount :'int', materials_use : 'text', node_name : 'text', seo_link : 'text', meta : 'text', meta_description: 'text', nodeid :{ type: "set", typeDef:"<text>" }, description : 'text', desc_detail : 'text', death_clock : { type: "map", typeDef: "<text,timestamp>" }, infomation : { type: "map", typeDef: "<text, text>"}, image_large :{ type: "set", typeDef:"<text>" }, image_huge :{ type: "set", typeDef: "<text>" }, image_small:{ type: "set", typeDef: "<text>" }, createby : 'text', }, key:[["productid"]] , }
27.381818
39
0.346614
c5dc04f20c679549bd848c4a59820cf724f6eaa6
1,151
js
JavaScript
src/index.js
kleyow/sdk-standard-components
3f09bbb9c61e3eb46e0420c9f310deac0aad585d
[ "Apache-2.0" ]
null
null
null
src/index.js
kleyow/sdk-standard-components
3f09bbb9c61e3eb46e0420c9f310deac0aad585d
[ "Apache-2.0" ]
null
null
null
src/index.js
kleyow/sdk-standard-components
3f09bbb9c61e3eb46e0420c9f310deac0aad585d
[ "Apache-2.0" ]
null
null
null
/************************************************************************** * (C) Copyright ModusBox Inc. 2019 - All rights reserved. * * * * This file is made available under the terms of the license agreement * * specified in the corresponding source code repository. * * * * ORIGINAL AUTHOR: * * James Bush - james.bush@modusbox.com * **************************************************************************/ 'use strict'; const Errors = require('./lib/errors'); const Ilp = require('./lib/ilp'); const Jws = require('./lib/jws'); const Logger = require('./lib/logger'); const { MojaloopRequests, ThirdpartyRequests } = require('./lib/requests'); const request = require('./lib/request'); const WSO2Auth = require('./lib/WSO2Auth'); module.exports = { Errors, Ilp, Jws, Logger, MojaloopRequests, ThirdpartyRequests, request, WSO2Auth, };
34.878788
76
0.426586