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
3130c278980c95760879961fa621322d02f50a74
340
js
JavaScript
app/js/utils/globalEvents.js
convoy-studio/havana-eliott-erwitt
6138040586c21bb2e05d874a197e40dc79aeea0b
[ "MIT" ]
null
null
null
app/js/utils/globalEvents.js
convoy-studio/havana-eliott-erwitt
6138040586c21bb2e05d874a197e40dc79aeea0b
[ "MIT" ]
null
null
null
app/js/utils/globalEvents.js
convoy-studio/havana-eliott-erwitt
6138040586c21bb2e05d874a197e40dc79aeea0b
[ "MIT" ]
null
null
null
import AppActions from '../actions/appActions'; class GlobalEvents { init() { window.addEventListener('resize', this.resize); } resize() { clearTimeout(this.resizeTimeout); this.resizeTimeout = setTimeout(()=>{ AppActions.windowResize(window.innerWidth, window.innerHeight); }, 300); } } export default GlobalEvents;
15.454545
66
0.708824
31311c70c306868fb08c4ccd7bb35a5ae2a45571
3,429
js
JavaScript
front/pages/main.js
HeumHeum2/HeumBird
bc9180d84e6425079c0ac61dd00988ed93ebdde7
[ "MIT" ]
null
null
null
front/pages/main.js
HeumHeum2/HeumBird
bc9180d84e6425079c0ac61dd00988ed93ebdde7
[ "MIT" ]
null
null
null
front/pages/main.js
HeumHeum2/HeumBird
bc9180d84e6425079c0ac61dd00988ed93ebdde7
[ "MIT" ]
null
null
null
import React, { useEffect, useCallback } from 'react'; import Router from 'next/router'; import { message } from 'antd'; import { useSelector, useDispatch } from 'react-redux'; import dynamic from 'next/dynamic'; import Loading from '../components/Loading'; import PostLoader from '../components/PostLoader'; import { LOAD_MAIN_POSTS_REQUEST, POST_NULLURE, FIND_HASHTAG_NULLURE, } from '../reducers/post'; import { LOAD_SUGGESTED_OTHER_REQUEST, LOAD_SUGGESTED_FOLLOW_REQUEST, FIND_USER_NULLURE, } from '../reducers/user'; import { PostContainer, SideContainer, Content } from '../styled/main'; const PostForm = dynamic(() => import('../containers/PostForm'), { ssr: false, }); const PostCardMap = dynamic(() => import('../components/PostCardMap'), { loading: () => <PostLoader />, }); const MainSide = dynamic(() => import('../components/MainSide'), { loading: () => <PostLoader />, }); const Main = () => { const { me } = useSelector(state => state.user); const { mainPosts, postEdited, postAdded, hasMorePost, postRemoved, imageUploadErrorReason, } = useSelector(state => state.post); const dispatch = useDispatch(); const countRef = []; const onScroll = useCallback(() => { if ( window.scrollY + document.documentElement.clientHeight > document.documentElement.scrollHeight - 300 ) { if (mainPosts.length && hasMorePost) { const lastId = mainPosts[mainPosts.length - 1].id; if (!countRef.includes(lastId)) { dispatch({ type: LOAD_MAIN_POSTS_REQUEST, lastId, }); countRef.push(lastId); } } } }, [hasMorePost, mainPosts.length]); useEffect(() => { window.addEventListener('scroll', onScroll); return () => { window.removeEventListener('scroll', onScroll); }; }, [mainPosts.length]); useEffect(() => { if (!me) { Router.push('/'); } }, [me]); useEffect(() => { if (postEdited) { message.success('게시글이 수정되었습니다!'); } }, [postEdited]); useEffect(() => { if (postAdded) { message.success('게시글이 작성되었습니다!'); } }, [postAdded]); useEffect(() => { if (postRemoved) { message.success('게시글이 삭제되었습니다!'); } }, [postRemoved]); useEffect(() => { if (imageUploadErrorReason) { message.error(imageUploadErrorReason); } }, [imageUploadErrorReason]); useEffect(() => { return () => { dispatch({ type: POST_NULLURE, }); dispatch({ type: FIND_USER_NULLURE, }); dispatch({ type: FIND_HASHTAG_NULLURE, }); }; }, []); return ( <Content> {me ? ( <> <PostContainer> <PostForm /> <PostCardMap /> {hasMorePost && <PostLoader />} </PostContainer> <SideContainer> <MainSide /> </SideContainer> </> ) : ( <Loading /> )} </Content> ); }; Main.getInitialProps = async context => { const state = context.store.getState(); context.store.dispatch({ type: LOAD_MAIN_POSTS_REQUEST, }); context.store.dispatch({ type: LOAD_SUGGESTED_OTHER_REQUEST, data: state.user.me && state.user.me.id, }); context.store.dispatch({ type: LOAD_SUGGESTED_FOLLOW_REQUEST, data: state.user.me && state.user.me.id, }); }; export default Main;
23.013423
72
0.58501
3133012efcdb6352f631831dfefcd65b1944740b
132
js
JavaScript
test/test.js
echamudi/lerna-template
ba0df788486d25df0d2f5520ab23c3c370a88388
[ "MIT" ]
1
2021-05-16T10:58:15.000Z
2021-05-16T10:58:15.000Z
test/test.js
echamudi/lerna-template
ba0df788486d25df0d2f5520ab23c3c370a88388
[ "MIT" ]
3
2021-05-11T19:24:05.000Z
2022-01-22T13:03:58.000Z
test/test.js
echamudi/lerna-template
ba0df788486d25df0d2f5520ab23c3c370a88388
[ "MIT" ]
null
null
null
const flip = require('../packages/flip-string'); const assert = require('assert'); assert.deepStrictEqual(flip('hello'), 'olleh');
26.4
48
0.704545
31349550d1d9490db64ee9149cdab6f9fb886895
199
js
JavaScript
assets/js/components/RedirectPage.js
Mbogning/KOSSA
b8997cb2432a1f92caddc681d1596090d7b2fef2
[ "MIT" ]
null
null
null
assets/js/components/RedirectPage.js
Mbogning/KOSSA
b8997cb2432a1f92caddc681d1596090d7b2fef2
[ "MIT" ]
null
null
null
assets/js/components/RedirectPage.js
Mbogning/KOSSA
b8997cb2432a1f92caddc681d1596090d7b2fef2
[ "MIT" ]
null
null
null
import React from "react"; import { Redirect } from "react-router-dom"; const RedirectPage = props => { return <Redirect to={`/${props.match.params.url}`} />; }; export default RedirectPage;
22.111111
53
0.673367
31372d4e326d3481c31d1950e7592d8717d464c3
2,818
js
JavaScript
node_modules/@nativescript/webpack/dist/helpers/externalConfigs.js
danielideriba/PushKitHMS-NativeScript-plugin
12e0c804b96fc983782a7bbb5819d10d7e305e17
[ "Apache-2.0" ]
null
null
null
node_modules/@nativescript/webpack/dist/helpers/externalConfigs.js
danielideriba/PushKitHMS-NativeScript-plugin
12e0c804b96fc983782a7bbb5819d10d7e305e17
[ "Apache-2.0" ]
1
2022-02-24T06:44:07.000Z
2022-02-24T06:44:07.000Z
node_modules/@nativescript/webpack/dist/helpers/externalConfigs.js
danielideriba/PushKitHMS-NativeScript-plugin
12e0c804b96fc983782a7bbb5819d10d7e305e17
[ "Apache-2.0" ]
null
null
null
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.applyExternalConfigs = void 0; const path_1 = __importDefault(require("path")); const fs_1 = __importDefault(require("fs")); const dependencies_1 = require("./dependencies"); const index_1 = require("../index"); const log_1 = require("./log"); const lib = __importStar(require("../index")); /** * @internal */ function applyExternalConfigs() { (0, dependencies_1.getAllDependencies)().forEach((dependency) => { const packagePath = (0, dependencies_1.getDependencyPath)(dependency); if (!packagePath) { return; } const configPath = path_1.default.join(packagePath, 'nativescript.webpack.js'); if (fs_1.default.existsSync(configPath)) { (0, log_1.info)(`Discovered config: ${configPath}`); (0, index_1.setCurrentPlugin)(dependency); try { const externalConfig = require(configPath); if (typeof externalConfig === 'function') { (0, log_1.info)('Applying external config...'); externalConfig(lib); } else if (externalConfig) { (0, log_1.info)('Merging external config...'); lib.mergeWebpack(externalConfig); } else { (0, log_1.warn)('Unsupported external config. The config must export a function or an object.'); } } catch (err) { (0, log_1.warn)(` Unable to apply config: ${configPath}. Error is: ${err} `); } } }); (0, index_1.clearCurrentPlugin)(); } exports.applyExternalConfigs = applyExternalConfigs; //# sourceMappingURL=externalConfigs.js.map
40.257143
141
0.585877
31386e33c8534e613a1400053df8e28d13b92cd3
4,488
js
JavaScript
src/main/resources/static/containers.js
JeffYFHuang/gpuaccounting
afa934350ebbd0634beb60b9df4a147426ea0006
[ "MIT" ]
null
null
null
src/main/resources/static/containers.js
JeffYFHuang/gpuaccounting
afa934350ebbd0634beb60b9df4a147426ea0006
[ "MIT" ]
1
2021-03-25T23:44:49.000Z
2021-03-25T23:44:49.000Z
src/main/resources/static/containers.js
JeffYFHuang/gpuaccounting
afa934350ebbd0634beb60b9df4a147426ea0006
[ "MIT" ]
null
null
null
/* This file is part of Ext JS 3.4 Copyright (c) 2011-2013 Sencha Inc Contact: http://www.sencha.com/contact GNU General Public License Usage This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html. If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact. Build date: 2013-04-03 15:07:25 */ //Ext.onReady(function(){ // example of custom renderer function function change(val){ if(val > 0){ return '<span style="color:green;">' + val + '</span>'; }else if(val < 0){ return '<span style="color:red;">' + val + '</span>'; } return val; } // example of custom renderer function function pctChange(val){ if(val > 0){ return '<span style="color:green;">' + val + '%</span>'; }else if(val < 0){ return '<span style="color:red;">' + val + '%</span>'; } return val; } // create the data store var container_proxy = new Ext.data.HttpProxy({ url:'/containers' }); // {"id":1,"podId":1,"name":"test-image1","limitsCpu":1,"limitsMemory":"8Gi","limitsNvidiaComGpu":1,"requestsCpu":1,"requestsMemory":"8Gi","requestsNvidiaComGpu":1,"nspid":4026551091} var container_reader = new Ext.data.JsonReader({ totalProperty: 'totalCount', successProperty: 'success', root: 'data' }, [ {name: 'id', type: 'int', mapping:'id'}, {name: 'podId', type: 'int', mapping:'podId'}, {name: 'name', mapping:'name'}, {name: 'limitsCpu', type: 'int', mapping:'limitsCpu'}, {name: 'limitsMemory', mapping:'limitsMemory'}, {name: 'limitsNvidiaComGpu', type: 'int', mapping:'limitsNvidiaComGpu'}, {name: 'requestsCpu', type: 'int', mapping:'requestsCpu'}, {name: 'requestsMemory', mapping:'requestsMemory'}, {name: 'requestsNvidiaComGpu', type: 'int', mapping:'requestsNvidiaComGpu'}, {name: 'nspid', type: 'int', mapping:'nspid'} ]); var container_ds = new Ext.data.Store({ autoLoad: true, proxy: container_proxy, reader: container_reader//, //remoteSort: true }); // create the Grid var containerGrid = new Ext.grid.GridPanel({ store: container_ds, columns: [ {id:'id',header: "id", sortable: true, width: 30, dataIndex: 'id'}, {id:'pod.id',header: "pod.id", sortable: true, dataIndex: 'podId'}, {id:'name',header: "name", sortable: true, dataIndex: 'name'}, {id:'nspid',header: "nspid", sortable: true, dataIndex: 'nspid'}, {id:'limitsCpu',header: "limits.cpu", sortable: true, dataIndex: 'limitsCpu'}, {id:'limitsMemory',header: "limits.memory", sortable: true, dataIndex: 'limitsMemory'}, {id:'limitsNvidiaComGpu',header: "limits.nvidia.com/gpu", sortable: true, dataIndex: 'limitsNvidiaComGpu'}, {id:'requestsCpu',header: "requests.cpu", sortable: true, dataIndex: 'requestsCpu'}, {id:'requestsMemory',header: "requests.memory", sortable: true, dataIndex: 'requestsMemory'}, {id:'requestsNvidiaComGpu',header: "requests.nvidia.com/gpu", sortable: true, dataIndex: 'requestsNvidiaComGpu'} ], stripeRows: true, //autoExpandColumn: 'name', //height:250, //width:"50%", frame:true, title:'Containers', flex: 3, //plugins: new Ext.ux.PanelResizer({ // minHeight: 100 //}), bbar: new Ext.PagingToolbar({ pageSize: 20, store: container_ds, displayInfo: true //plugins: new Ext.ux.ProgressBarPager() }), listeners:{ rowdblclick : function(grid, rowIndex){ alert("rowdblclick"); }, rowclick:function(grid, rowIndex){ var record = grid.getStore().getAt(rowIndex); var id = record.get('id'); process_ds.removeAll(); process_ds.load({params:{start:0, limit:20, id:id}}); } } }); //namespaceGrid.render('grid-example'); container_ds.load({params:{start:0, limit:20}}); //});
36.193548
186
0.602941
3139487427098ef0b5573410b2e8c7c08f73280c
339
js
JavaScript
frontend/src/storeConfig.js
nikhitadusumilli/toDoApp
e0dbba326bc75ae8d90647c0fcc6a2e2808afe95
[ "MIT" ]
null
null
null
frontend/src/storeConfig.js
nikhitadusumilli/toDoApp
e0dbba326bc75ae8d90647c0fcc6a2e2808afe95
[ "MIT" ]
null
null
null
frontend/src/storeConfig.js
nikhitadusumilli/toDoApp
e0dbba326bc75ae8d90647c0fcc6a2e2808afe95
[ "MIT" ]
1
2020-01-30T07:45:55.000Z
2020-01-30T07:45:55.000Z
import { createStore, applyMiddleware, compose } from "redux"; import Thunk from "redux-thunk"; import reducers from "./store"; const enhancedCompose = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; const configureStore = () => createStore(reducers, enhancedCompose(applyMiddleware(Thunk))); export default configureStore;
30.818182
79
0.781711
3139dea15fed9566a879f0c8989f604d66a74f19
1,147
js
JavaScript
app/core/Alert/Services/AlertService.js
AIOMedia/AIOApplication-web
4c5ce0a06682a2004736367d81af1114c3107666
[ "MIT" ]
null
null
null
app/core/Alert/Services/AlertService.js
AIOMedia/AIOApplication-web
4c5ce0a06682a2004736367d81af1114c3107666
[ "MIT" ]
1
2015-01-19T17:08:43.000Z
2015-01-19T17:08:43.000Z
app/core/Alert/Services/AlertService.js
AIOMedia/AIOApplication-web
4c5ce0a06682a2004736367d81af1114c3107666
[ "MIT" ]
null
null
null
/** * Alert Service */ angular.module('Alert').factory('AlertService', [ function () { var alerts = []; return { types: { SUCCESS : { icon: 'check', class: 'success' }, ERROR : { icon: 'times', class: 'danger' }, WARNING : { icon: 'warning', class: 'warning' }, INFO : { icon: 'info', class: 'info' } }, all: function () { return alerts; }, add: function (type, message) { if (message) { if (type) { type = this.types.INFO; } alerts.push({ type: type, text: message }); } else { console.warn('Alert needs a text message to displayed.'); } return this; }, getNext: function () { if (alerts.length > 0) { alerts.shift(); } } }; } ]);
26.068182
77
0.33653
313aa1e96d39977edf6664dfc627110a1c28cb23
1,860
js
JavaScript
server/services/ContactService.js
i862/secretary_node
443cac8a1553c2360d7b3d681d1982cbb48b65d0
[ "MIT" ]
null
null
null
server/services/ContactService.js
i862/secretary_node
443cac8a1553c2360d7b3d681d1982cbb48b65d0
[ "MIT" ]
null
null
null
server/services/ContactService.js
i862/secretary_node
443cac8a1553c2360d7b3d681d1982cbb48b65d0
[ "MIT" ]
null
null
null
/** * Created by menzhongxin on 16/3/23. */ var contact = require('../models/contact'), commonUtil = require('../lib/commonUtil').util, modelUtil = require('../lib/modelUtil'); var ContactService = function(){}; /** * 添加contact * @param query * @param conditions * @param options */ ContactService.prototype.add = function(conditions){ return contact.add(conditions); }; /** * * @param conditions * @param fields * @param pageSlice * @returns {Array|{index: number, input: string}|*|Promise} */ ContactService.prototype.find = function(conditions,fields,pageSlice){ return contact.find(conditions,fields,pageSlice).exec(); }; ContactService.prototype.aggregate = function(conditions,group,pageSlice){ var options = []; if(commonUtil.hasValue(conditions)) options.push(conditions); var project = {}; project[group] = 1; options.push({$project:project}); if(modelUtil.typeOf(contact,group) == 'Array') options.push({$unwind:'$' + group}); options.push({$group:{_id:'$' + group,count:{$sum:1}}}); options.push({$skip:pageSlice.skip}); options.push({$limit:pageSlice.limit}); console.log(options); return contact.aggregate(options).exec(); }; /** * updateOne * @param query * @param conditions * @param options * @returns {Array|{index: number, input: string}|*|Promise} */ ContactService.prototype.update = function(query,conditions,options){ conditions.updatedAt = Date.now(); return contact.findOneAndUpdate(query,conditions,options).exec(); }; /** * multiUpdate * @param query * @param conditions * @param options * @returns {Array|{index: number, input: string}|*|Promise} */ ContactService.prototype.multiUpdate = function(query,conditions,options){ conditions.updatedAt = Date.now(); return contact.update(query,conditions,options).exec(); }; module.exports = new ContactService();
27.761194
74
0.697849
313aae4d251c73e5abf855ae9dae7f66ab9e2595
34,261
js
JavaScript
assets/js/scripts.js
webseen-org/to
58b0bd4f49d915f21055f48d84e83896bce84c1e
[ "MIT" ]
1
2021-07-24T17:01:33.000Z
2021-07-24T17:01:33.000Z
assets/js/scripts.js
webseen-org/to
58b0bd4f49d915f21055f48d84e83896bce84c1e
[ "MIT" ]
null
null
null
assets/js/scripts.js
webseen-org/to
58b0bd4f49d915f21055f48d84e83896bce84c1e
[ "MIT" ]
null
null
null
(function($) { /* globals jQuery, lozad, ScrollMagic */ "use strict"; var dictionary = { '.one' : 'One Page', '.por' : 'Portfolio', '.box' : 'Boxed', '.blo' : 'Blog', '.dar' : 'Dark', '.sho' : 'Shop', '.lig' : 'Light', '.ele' : 'Elementor', '.ani' : 'Animals & Nature', '.art' : 'Art & Culture', '.car' : 'Cars & Bikes', '.cor' : 'Corporations & Organizations', '.des' : 'Design & Photography', '.edu' : 'Education & Science', '.ent' : 'Entertainment', '.fas' : 'Fashion', '.fin' : 'Finance', '.foo' : 'Food & Restaurants', '.hea' : 'Health & Beauty', '.hou' : 'Housing & Architecture', '.mag' : 'Magazines & Writing', '.occ' : 'Occasions & Gifts', '.oth' : 'Others', '.peo' : 'People and services', '.pro' : 'Product & Production', '.spo' : 'Sports & Travel', '.tec' : 'Technology & Computing ', }; var Splash = (function($) { var body = $('body'); var header = $('#header'); var websites = $('.websites'); var websitesIso = $('.websites-iso'); var search = $('input.search'); var menu = $('#menu'); var sidebar = false; var searchLock = false; var submenuLock = false; var stickyOff = false; var headerH = 0; var previousY = 0; var getWebsitesOnce = false; var getWebsitesDone = $.Deferred(); var isMobile = false; /** * Mobile */ var mobile = { // mobile.set() set: function() { headerH = header.height(); if (window.innerWidth <= 777) { isMobile = true; } else { isMobile = false; } if (isMobile) { body.addClass('mobile'); if (header.hasClass('filters-open')) { this.filtersSize(); } this.filtersToHeader(); } else { body.removeClass('mobile'); this.filtersToContent(); } if (header.hasClass('submenu-open')) { this.submenuSize(); } }, toggleMenu: function() { header.toggleClass('menu-open'); header.removeClass('filters-open search-open'); if (header.hasClass('submenu-open')) { this.submenuClose(); } }, menuClose: function(){ header.removeClass('menu-open'); this.submenuClose(); }, submenuOpen: function(el) { // open 2nd level el.closest('li').addClass('open'); header.addClass('submenu-open'); this.modalOpen(); this.submenuSize(); }, submenuClose: function() { header.removeClass('submenu-open').find('li.open').removeClass('open'); this.modalClose(); }, submenuSize: function() { header.find('li.open > ul').innerWidth(window.innerWidth).innerHeight(window.innerHeight - headerH); }, modalOpen: function() { body.addClass('modal-open'); }, modalClose: function() { body.removeClass('modal-open'); }, searchToggle: function() { header.toggleClass('search-open'); header.removeClass('filters-open menu-open submenu-open'); this.modalClose(); }, filtersToggle: function() { header.toggleClass('filters-open'); header.removeClass('search-open menu-open submenu-open'); if (header.hasClass('filters-open')) { this.filtersSize(); this.modalOpen(); } else { this.modalClose(); } }, filtersClose: function() { header.removeClass('filters-open'); this.modalClose(); }, filtersSize: function() { header.find('.filters').innerWidth(window.innerWidth).innerHeight(window.innerHeight - headerH); }, filtersToHeader: function() { $('#websites .filters .sidebar__inner').detach().prependTo('#header .filters'); }, filtersToContent: function() { $('#header .filters .sidebar__inner').detach().prependTo('#websites .filters .inner-wrapper-sticky'); if( sidebar ){ sidebar.stickySidebar('updateSticky'); } } }; /** * One page */ var onePage = { positions: [], // onePage.setPositions() setPositions: function() { var $this = this; $('article[id]').each(function() { var article = $(this); var id = article.attr('id'); $this.positions[id] = { top: article.offset().top, bottom: article.offset().top + article.height() - 1 }; }); // console.log($this.positions); }, // onePage.scrollActive() scrollActive: function() { var active = false; var $this = this, $menu = $('#menu > ul > li.active > .one-page'); var currentY = $(window).scrollTop(); $('article[id]').each(function() { var article = $(this); var id = article.attr('id'); if ((currentY >= $this.positions[id].top) && (currentY < $this.positions[id].bottom)) { active = id; } }); $menu.find('li').removeClass('active'); if ( active ) { var el = '[data-hash="' + active + '"]'; $( el, $menu ).closest('li').addClass('active'); if( $( el, $menu ).length ){ history.replaceState({}, '', '#' + active); } else { history.replaceState({}, '', ' '); } } else { history.replaceState({}, '', ' ' ); } }, // onePage.click() click: function(link) { var el = link.closest('li'); var hash = '#' + link.data('hash'); el.addClass('active') .siblings().removeClass('active'); if ( ! $(hash).length ) { return false; } history.replaceState({}, '', hash); mobile.menuClose(); submenuLock = true; $('html, body').animate({ scrollTop: $(hash).offset().top + 1 }, 200, 'swing'); setTimeout(function() { submenuLock = false; }, 250); }, // onePage.scrollTo() scrollTo: function(el) { var hash = el.attr('href'); mobile.menuClose(); $('html, body').animate({ scrollTop: $(hash).offset().top }, 200); }, // onePage.scrollTop() scrollTop: function() { $('html, body').animate({ scrollTop: 0 }, 200); } }; /** * Sticky header */ var sticky = { websitesTop: 0, websitesBottom: 0, // sticky.set() set: function() { if( ! websites.length ){ return; } this.websitesTop = $('#websites .search-wrapper').offset().top - 0; this.websitesBottom = websites.offset().top + websites.height() - headerH /* header height */ ; }, // sticky.scroll() scroll: function() { var currentY = $(window).scrollTop(); if ( ! headerH ) { // some JS has not been finished return false; } // console.log([currentY, this.websitesTop, this.websitesBottom]); if ( stickyOff ) { return false; } if ( submenuLock && header.hasClass('down') ) { // submenu - one page link clicked } else if ( searchLock ) { // #websites - scroll to websites top when filter selected header .removeClass('hide down') .addClass('show sticky search animate'); } else if (currentY <= 1) { // site TOP - static header header .removeClass('sticky down hide show') .addClass('animate-bg'); } else if ((currentY >= this.websitesTop) && (currentY < this.websitesBottom)) { // #websites - menu or search inside websites section header .removeClass('hide down') .addClass('show sticky search animate'); if (currentY > previousY) { header.addClass('search'); } else { header.removeClass('search'); } } else if (currentY <= headerH) { // space <= header height - first 70px of the page - do nothing } else if (currentY < previousY) { // scroll up - menu header .removeClass('hide search down') .addClass('show sticky animate'); } else { // scroll down - submenu header .removeClass('hide search animate-bg') .addClass('show sticky down animate'); } previousY = currentY; }, }; /** * Search */ var searchForm = { timer: false, // searchForm.search() search: function(value) { var filter = value.replace('&', '').replace(/ /g, '').toLowerCase(); // TMP: temporary holiday filters // pseudo Thesaurus if( 'christ' == filter || 'christmas' == filter ){ filter = 'xmas'; } if( 'new' == filter || 'newyear' == filter ){ filter = 'party'; } // end: TMP: temporary holiday filters isotope.scrollTop(); search.val(value); if (filter) { body.addClass('search-active'); header.addClass('search-open'); } else { body.removeClass('search-active'); } isotope.overlay('show'); setTimeout(function(){ getWebsites(); $.when(getWebsitesDone).done(function(){ websitesIso.isotope({ filter: function() { return filter ? $(this).data('title').match(filter) : true; } }); isotope.clear(); isotope.result( filter ); }); }, 200); }, searchTimer: function(input) { clearTimeout(this.timer); this.timer = setTimeout(function() { searchForm.search(input.val()); }, 300, input); }, clear: function() { search.val(''); body.removeClass('search-active'); } }; /** * Isotope */ var isotope = { currentFilters: { layout: [], subject: [] }, // isotope.concatValues() concatValues: function(filters) { var i = 0; var comboFilters = []; for ( var prop in filters ) { var filterGroup = filters[ prop ]; // skip to next filter group if it doesn't have any values if ( !filterGroup.length ) { continue; } if ( i === 0 ) { // copy to new array comboFilters = filterGroup.slice(0); } else { var filterSelectors = []; // copy to fresh array var groupCombo = comboFilters.slice(0); // [ A, B ] // merge filter Groups for (var k=0, len3 = filterGroup.length; k < len3; k++) { for (var j=0, len2 = groupCombo.length; j < len2; j++) { filterSelectors.push( groupCombo[j] + filterGroup[k] ); // [ 1, 2 ] } } // apply filter selectors to combo filters for next group comboFilters = filterSelectors; } i++; } var comboFilter = comboFilters.join(', '); return comboFilter; }, // isotope.init() init: function() { websitesIso.isotope({ itemSelector: '.website', transitionDuration: 200, hiddenStyle: { opacity: 0 }, visibleStyle: { opacity: 1 } }).isotope('reloadItems').isotope({ sortBy: 'original-order' }); websitesIso.on('layoutComplete', function() { recalculate(); }); }, // isotope.reset() reset: function(li, group) { var index = this.currentFilters[group].indexOf( li.data('filter') ); li.removeClass('current'); this.currentFilters[group].splice( index, 1 ); if ( ! this.currentFilters.layout.length && ! this.currentFilters.subject.length ) { body.removeClass('filter-active'); } websitesIso.isotope({ filter: this.concatValues(this.currentFilters) }); this.result(); }, // isotope.scrollTop() scrollTop: function() { searchLock = true; $('html, body').animate({ scrollTop: websites.offset().top - 90 }, 200); setTimeout(function() { searchLock = false; }, 250); }, // isotope.filter() filter: function(el) { var li = el.closest('li'); var group = el.closest('ul').data('filter-group'); isotope.scrollTop(); mobile.filtersClose(); searchForm.clear(); isotope.overlay('show'); setTimeout(function(){ getWebsites(); $.when(getWebsitesDone).done(function(){ if (li.hasClass('current')) { isotope.reset(li, group); return true; } // li.siblings().removeClass('current'); li.addClass('current'); isotope.currentFilters[group].push( li.data('filter') ); websitesIso.isotope({ filter: isotope.concatValues(isotope.currentFilters) }); body.addClass('filter-active'); // results isotope.result(); }); }, 200); }, // isotope.removeButton() removeButton: function(){ $('.show-all .button').remove(); }, // isotope.showAll() showAll: function(){ this.overlay('show'); getWebsites(); this.result(); }, // isotope.overlay() overlay: function(state){ if ( 'show' == state ) { websitesIso.addClass('loading'); } else { setTimeout(function(){ websitesIso.removeClass('loading'); }, 250); } }, // isotope.result() result: function(search){ search = (typeof search !== 'undefined') ? search : ''; var count, all, text, layout, subject, el = $('.results', websites); count = websitesIso.data('isotope').filteredItems.length; all = el.data('count'); // console.log(this.currentFilters); layout = this.currentFilters.layout; subject = this.currentFilters.subject; isotope.overlay('hide'); if( ! layout.length && ! subject.length && ! search ){ el.html('<strong>All '+ all + '</strong> pre-built websites'); return false; } text = pluralize(count, 'result') +' for: '; if( layout.length ){ $.each( layout, function( index, value ){ text += '<span class="filter" data-filter="'+ value +'">'+ dictionary[value] +'</span>'; }); } if( subject.length ){ $.each( subject, function( index, value ){ text += '<span class="filter" data-filter="'+ value +'">'+ dictionary[value] +'</span>'; }); } if( search ){ text += '<span class="filter key">'+ search +'</span>'; } el.html(text); }, // isotope.unclick() unclick: function(el){ var filter = el.data('filter'); if( filter ){ $('.filters li[data-filter="'+ filter +'"] a').click(); } else { $('.search-wrapper .close').click(); } }, // isotope.clear() clear: function() { isotope.currentFilters.layout = []; isotope.currentFilters.subject = []; $('.filters li').removeClass('current'); body.removeClass('filter-active'); } }; /** * Sliders */ var sliders = { // sliders.init() init: function() { this.testimonials(); this.gallery(); this.video(); }, // sliders.testimonials() testimonials: function(){ $('.testimonials-slider').each(function() { var slider = $(this); slider.slick({ slidesToShow: 3, slidesToScroll: 1, autoplay: true, autoplaySpeed: 2000, dots: false, responsive: [ { breakpoint: 1239, settings: { slidesToShow: 2, slidesToScroll: 2 } }, { breakpoint: 767, settings: { slidesToShow: 1, slidesToScroll: 1 } } ] }); }); }, // sliders.gallery() gallery: function(){ $('.content-gallery').each(function() { var slider = $(this); slider.slick({ slidesToShow: 3, slidesToScroll: 1, autoplay: true, autoplaySpeed: 2000, dots: false, responsive: [ { breakpoint: 1239, settings: { slidesToShow: 2, slidesToScroll: 2 } }, { breakpoint: 767, settings: { slidesToShow: 1, slidesToScroll: 1 } } ] }); }); }, // sliders.video() video: function(){ $('.our-video-slider').slick({ centerMode: true, centerPadding: '0', slidesToShow: 3, responsive: [ { breakpoint: 777, settings: { arrows: false, centerMode: true, centerPadding: '40px', slidesToShow: 1 } }, { breakpoint: 480, settings: { arrows: false, centerMode: true, centerPadding: '40px', slidesToShow: 1 } } ] }); }, }; /** * Tabs */ var tabs = { // tabs.init(); init: function() { $('.tabs > ul > li:first').addClass('active'); $('.tabs > div:first-of-type').siblings('div').hide(); }, // tabs.open(); open: function( $el ){ var $tabs = $el.closest('.tabs'), $li = $el.closest('li'); var index = $li.index(); $li.addClass('active') .siblings().removeClass('active'); $tabs.children('div').eq(index).show() .siblings('div').hide(); recalculate(); } }; /** * Menu tabs */ var menuTabs = { // menuTabs.init(); init: function() { $('.submenu.with-tabs .tabs-nav > li:first').addClass('active'); $('.submenu.with-tabs .tab:first-of-type').siblings('.tab').hide(); }, // menuTabs.open(); open: function( $el ){ var $tabs = $el.closest('.submenu.with-tabs'), $li = $el.closest('li'); var index = $li.index(); $li.addClass('active') .siblings().removeClass('active'); $tabs.find('.tab').eq(index).show() .siblings('.tab').hide(); recalculate(); } }; /** * Classic simple switch */ var classicSimple = function($el){ var $li = $el.closest('li'), $container = $('.mfn-item'); var style = $li.data('style'); $li.addClass('active') .siblings().removeClass('active'); if( 'simple' == style ){ $container.addClass('style-simple'); } else { $container.removeClass('style-simple'); } }; /** * FAQ */ var faq = { // faq.init(); init: function() { $('.faq.open-first .question:first').addClass('active'); }, // faq.open(); open: function( $el ){ var $li = $el.closest('li'); if( $li.hasClass('active') ){ $li.removeClass('active'); } else { $li.addClass('active') .siblings().removeClass('active'); } recalculate(); } }; /** * Accordion */ var accordion = { // accordion.init(); init: function() { $('.accordion.open-first .step:first').addClass('active'); }, // accordion.open(); open: function( $el ){ var $li = $el.closest('li'); if( $li.hasClass('active') ){ $li.removeClass('active'); } else { $li.addClass('active') .siblings().removeClass('active'); } recalculate(); } }; /** * Filter tabs */ var filterTabs = { // filterTabs.init(); init: function() { $('.filter-tabs > ul:first li:first').addClass('active'); }, // filterTabs.filter(); filter: function( $el ){ var $li = $el.closest('li'), $items = $el.closest('.filter-tabs').find('.items'); var filter = $li.data('filter'), container = $el.closest('.filter-tabs').data('container') || 'li', prefix = $el.closest('.filter-tabs').data('prefix') || ''; $li.addClass('active') .siblings().removeClass('active'); if ( '*' == filter ) { $items.children( container ).show(); } else { $items.children( container + '.' + prefix + filter ).show(); $items.children( container ).not('.' + prefix + filter ).hide(); } recalculate(); } }; /** * Countdown */ var countdown = function(){ $('.countdown').waypoint({ offset: '100%', triggerOnce: true, handler: function() { var el = $(this.element).length ? $(this.element) : $(this); var duration = el.data('duration') || Math.floor((Math.random() * 1000) + 1000); var to = el.text(); $({ property: 0 }).animate({ property: to }, { duration: duration, easing: 'linear', step: function() { el.text(Math.floor(this.property)); }, complete: function() { el.text(this.property); } }); if (typeof this.destroy !== 'undefined' && $.isFunction(this.destroy)) { this.destroy(); } } }); }; /** * Progress bars */ var progress = function(){ $('.progress-bars').waypoint({ offset: '100%', triggerOnce: true, handler: function() { var el = $(this.element).length ? $(this.element) : $(this); var duration = 1000; el.addClass('hover'); el.find('.label').each(function(){ var $item = $(this); var to = parseInt( $(this).text(), 10 ); $({ property: 0 }).animate({ property: to }, { duration: duration, easing: 'linear', step: function() { $item.text( '+'+ Math.floor(this.property) +'%' ); }, complete: function() { $item.text( '+'+ this.property +'%' ); } }); }); if (typeof this.destroy !== 'undefined' && $.isFunction(this.destroy)) { this.destroy(); } } }); }; /** * Expand * expand() */ var expand = function( $el ){ $el.hide() .siblings('.expand-me').show(); }; /** * Lazy load images * lazyLoad() */ var lazyLoad = function() { var observer = lozad('.lozad, img[data-src]'); observer.observe(); }; /** * Lightbox */ var lightbox = function(){ // image $('a.lightbox-image').magnificPopup({ type: 'image', }); // video $('a.lightbox-video').magnificPopup({ type: 'iframe', iframe: { patterns: { youtube: { index: 'youtube.com/', id: 'v=', src: '//www.youtube.com/embed/%id%?autoplay=1&rel=0' }, youtu_be: { index: 'youtu.be/', id: '/', src: '//www.youtube.com/embed/%id%?autoplay=1&rel=0' }, nocookie: { index: 'youtube-nocookie.com/embed/', id: '/', src: '//www.youtube-nocookie.com/embed/%id%?autoplay=1&rel=0' } } } }); }; /** * Typewriter */ var typewriter = function(){ // TODO: move from separate file and remove that file and footer link // var instance1 = document.getElementById('typewriter1'); // // var instance1 = new Typewriter(instance1, { // loop: true // }); // // instance1.typeString('Website') // .pauseFor(2500) // .deleteChars(7) // .typeString('Live') // .pauseFor(1000) // .deleteChars(4) // .typeString('Muffin') // .pauseFor(1000) // .start(); }; /** * Pluralize nouns */ var pluralize = function(count, noun){ if( 1 !== count ){ noun = noun + 's'; } return count + ' ' + noun; }; /** * Video */ var magicVideo = function(){ if( ! $('#player-main').length ){ return; } var controller = new ScrollMagic.Controller(); var Scene = new ScrollMagic.Scene({ triggerElement: "#player-main", duration: '160%', triggerHook: 0 }).setPin("#player-main-inner").addTo(controller); var Scene3 = new ScrollMagic.Scene({ triggerElement: "#player-main", duration: '69%', triggerHook: 0 }); Scene3.on("end", function () { $("#desc-1").toggleClass("show"); $(".player-counter-number.two").toggleClass("active"); $("#desc-2").toggleClass("show"); }).addTo(controller); var Scene4 = new ScrollMagic.Scene({ triggerElement: "#player-main", duration: '140%', triggerHook: 0 }); Scene4.on("end", function () { $("#desc-2").toggleClass("show"); $("#desc-3").toggleClass("show"); $(".player-counter-number.three").toggleClass("active"); $("#replay").toggleClass("showme"); }).addTo(controller); var video = document.getElementById('video'); var scrollpos = 0; var lastpos = void 0; var Scene2 = new ScrollMagic.Scene({ triggerElement: "#player-main", duration: '150%', triggerHook: 0 }); var startScrollAnimation = function startScrollAnimation() { Scene2.addTo(controller) // .addIndicators() .on("progress", function (e) { scrollpos = e.progress; }); setInterval(function () { if (lastpos === scrollpos) return; requestAnimationFrame(function () { video.currentTime = video.duration * scrollpos; video.pause(); lastpos = scrollpos; var dur = video.currentTime * 100 / video.duration; $(".duration").css("width", dur + "%"); }); }, 40); }; var preloadVideo = function preloadVideo(v, callback) { var ready = function ready() { v.removeEventListener('canplaythrough', ready); video.pause(); var i = setInterval(function () { if (v.readyState > 3) { clearInterval(i); video.currentTime = 0; callback(); } }, 50); }; v.addEventListener('canplaythrough', ready, false); // v.play(); }; preloadVideo(video, startScrollAnimation); }; /** * Get all pre-built websites * getWebsites() */ var getWebsites = function() { if ( getWebsitesOnce ) { return true; } getWebsitesOnce = true; var data = { action: 'get' }; $.ajax({ type: 'post', // dataType: 'json', data: data }).done(function(response) { if (response) { websitesIso.append(response).isotope('reloadItems').isotope({ sortBy: 'original-order' }); websitesIso.on('arrangeComplete', function() { lazyLoad(); isotope.removeButton(); getWebsitesDone.resolve(); }); } else { console.log('Error: Could not get all pre-built websites.'); } }); }; /** * Sticky filters */ var stickyFilters = function() { if( ! $('#websites .filters').length ){ return; } sidebar = $('#websites .filters').stickySidebar({ topSpacing: 90 }); }; /** * Hash navigation */ var hashNav = function() { if( window.location.hash ){ setTimeout(function(){ var initial = $(window).scrollTop(); $(window).scrollTop( $(window).scrollTop() - 2 ); $(window).scrollTop( initial + 1 ); }, 100); } }; /** * Recalculate */ var recalculate = function() { $(window).trigger('resize'); mobile.set(); sticky.set(); onePage.setPositions(); if( sidebar ){ sidebar.stickySidebar('updateSticky'); } }; /** * Bind */ var bind = function() { // websites $('.filters').on('click', 'a', function(e) { e.preventDefault(); isotope.filter($(this)); }); $('.results').on('click', '.filter', function(e) { e.preventDefault(); isotope.unclick($(this)); }); $('.show-all').on('click', '.button', function(e) { e.preventDefault(); isotope.showAll(); }); // menu menu.on('click', '.menu-toggle', function(e) { e.preventDefault(); mobile.toggleMenu(); }); menu.on('click', '.submenu-open', function(e) { mobile.submenuOpen($(this)); return false; }); menu.on('click', '.scroll', function(e) { e.preventDefault(); onePage.click($(this)); }); menu.on('click', '.active .one-page li a', function(e) { e.preventDefault(); onePage.click($(this)); }); // header header.on('click', '.submenu-close', function(e) { mobile.submenuClose(); }); header.on('click', '.search-toggle', function(e) { e.preventDefault(); mobile.searchToggle(); }); header.on('click', '.filters-toggle', function(e) { e.preventDefault(); mobile.filtersToggle(); }); // one page body.on('click', '.scroll', function(e) { e.preventDefault(); onePage.scrollTo($(this)); }); $('.scroll-top').on('click', function(e) { e.preventDefault(); onePage.scrollTop(); }); // menu tabs $('.submenu.with-tabs .tabs-nav > li').on('click', 'a', function(e) { e.preventDefault(); menuTabs.open($(this)); }); // tabs $('.tabs:not(.fake-tabs) > ul > li').on('click', 'a', function(e) { e.preventDefault(); tabs.open($(this)); }); // classic simple $('.classic-simple > ul > li').on('click', 'a', function(e) { e.preventDefault(); classicSimple($(this)); }); // filter tabs $('.filter-tabs > ul:first li').on('click', 'a', function(e) { e.preventDefault(); filterTabs.filter($(this)); }); // faq $('.faq .question .title').on('click', function(e) { faq.open($(this)); }); // expand $('.link-expand').on('click', function(e) { e.preventDefault(); expand($(this)); }); // accordion $('.accordion > li').on('click', function(e) { accordion.open($(this)); }); // search $('.search-wrapper').on('click', '.close', function() { if (body.hasClass('search-active')) { searchForm.search(''); } header.removeClass('search-open'); }); // keyup search.on('keyup', function() { searchForm.searchTimer($(this)); }); // window.scroll $(window).scroll(function() { sticky.scroll(); onePage.scrollActive(); }); // window resize $(window).on('debouncedresize', function() { mobile.set(); sticky.set(); }); }; /** * Ready * document.ready */ var ready = function() { lazyLoad(); onePage.setPositions(); sliders.init(); menuTabs.init(); tabs.init(); filterTabs.init(); accordion.init(); faq.init(); countdown(); progress(); lightbox(); typewriter(); bind(); }; /** * Load * window.load */ var load = function() { stickyFilters(); isotope.init(); magicVideo(); hashNav(); recalculate(); } /** * Return */ return { ready: ready, load: load }; })(jQuery); /** * $(document).ready */ $(function() { Splash.ready(); }); /** * $(window).load */ $(window).on('load', function(){ Splash.load(); }); })(jQuery);
19.942375
109
0.465953
313b35866ae0994a8fb9e919a4dbb7df242a0bf4
1,687
js
JavaScript
tests/output.test.js
HosseinShabani/svg-fixer
645a62016eadee604453592c7545532e5d745cd7
[ "MIT" ]
1
2020-07-26T09:08:52.000Z
2020-07-26T09:08:52.000Z
tests/output.test.js
HosseinShabani/svg-fixer
645a62016eadee604453592c7545532e5d745cd7
[ "MIT" ]
null
null
null
tests/output.test.js
HosseinShabani/svg-fixer
645a62016eadee604453592c7545532e5d745cd7
[ "MIT" ]
null
null
null
"use strict"; const { fix, Core } = require(".."); const fs = require("fs-extra"); const path = require("path"); const looksame = require("looks-same"); const { JSDOM } = require("jsdom"); const chai = require("chai"); const { assert } = chai; var brokenIconsPath = path.resolve("tests/assets/broken-icons"); var failedIconsPath = path.resolve("tests/assets/failed-icons"); var fixedIconsPath = path.resolve("tests/assets/fixed-icons"); var fixedIconsArray = fs.readdirSync(fixedIconsPath); describe("input and output SVGs are the same", () => { async function getPngBuffer(p, options) { var p = path.resolve(p); var raw = fs.readFileSync(p, "utf8"); var dom = new JSDOM(raw); var svgElement = Core.getSvgElementFromDom(dom); Core.upscaleSvgElementDimensions(svgElement, 250); var buffer = await Core.svgToPng(svgElement.outerHTML, options); return buffer; } for (var i = 0; i < fixedIconsArray.length; i++) { var icon = fixedIconsArray[i]; var index = i; it(icon + " matches expected output", async () => { var iconBuffer = await getPngBuffer(`${brokenIconsPath}/${icon}`, { extend: true, }); var fixedBuffer = await getPngBuffer(`${fixedIconsPath}/${icon}`, { extend: true, }); looksame( iconBuffer, fixedBuffer, { strict: false, tolerance: 5 }, async (error, { equal }) => { if (error) { console.log(error); } if (equal != true) { await Core.svgToPng(iconBuffer, { opts: `${failedIconsPath}/${index}.png`, }); await Core.svgToPng(iconBuffer, { opts: `${failedIconsPath}/${index}-fixed.png`, }); } assert.equal(equal, true); } ); }); } });
28.59322
70
0.634262
313c0641ede819f15e8bc25c66d3ca0bebdf1a96
175
js
JavaScript
sprout-backend/src/routes/category/categoryReadAll.js
maciej-bartynski/sprout-test
15dcee21971e671a3c2f6d8934942b996c1547e2
[ "MIT" ]
null
null
null
sprout-backend/src/routes/category/categoryReadAll.js
maciej-bartynski/sprout-test
15dcee21971e671a3c2f6d8934942b996c1547e2
[ "MIT" ]
7
2021-03-10T16:34:45.000Z
2022-02-27T03:56:12.000Z
sprout-backend/src/routes/user/userReadAll.js
maciej-bartynski/sprout-test
15dcee21971e671a3c2f6d8934942b996c1547e2
[ "MIT" ]
null
null
null
import findAllRecords from 'routes/utils/findAllRecords'; import { name } from 'database/models/Category/name'; export default (_, res) => { findAllRecords(name, res); };
29.166667
57
0.725714
313e605c423012a023513d1e487c252b01cbf568
1,094
js
JavaScript
esm/decorators/attribute.js
scoutgg/widgets
dc1b8ab92230a40b48572da839266f5c675e51e7
[ "ISC" ]
3
2018-02-28T21:09:02.000Z
2021-08-04T06:13:49.000Z
esm/decorators/attribute.js
scoutgg/widgets
dc1b8ab92230a40b48572da839266f5c675e51e7
[ "ISC" ]
4
2018-11-05T20:21:47.000Z
2021-09-01T07:11:52.000Z
esm/decorators/attribute.js
scoutgg/widgets
dc1b8ab92230a40b48572da839266f5c675e51e7
[ "ISC" ]
3
2018-02-28T21:09:08.000Z
2018-11-20T09:44:30.000Z
import { camelCase, kebabCase } from '../utils.js' export function Attribute(name, type, options = { default: '' }) { const property = camelCase(name) const attribute = kebabCase(name) return function define(Class) { if(!Class.observedAttributes) { Class.observedAttributes = [] } Class.observedAttributes.push(attribute) Object.defineProperty(Class.prototype, property, { enumerable: true, configurable: true, get() { if(type === Boolean) { return this.hasAttribute(attribute) } const value = this.getAttribute(attribute) if(type.instance) { return type.instance(value === null ? options.default : value) } else { return type(value === null ? options.default : value) } }, set(value) { if(type === Boolean) { if(value) { this.setAttribute(attribute, '') } else { this.removeAttribute(attribute) } } else { this.setAttribute(attribute, value) } } }) } }
26.047619
72
0.563985
313eeafd78299afce12831abb9c22e65a8107306
1,212
js
JavaScript
babel.config.js
nampdn/targem-replace
08983db8d4b6d458824b2091dcff32defaf24894
[ "MIT" ]
null
null
null
babel.config.js
nampdn/targem-replace
08983db8d4b6d458824b2091dcff32defaf24894
[ "MIT" ]
null
null
null
babel.config.js
nampdn/targem-replace
08983db8d4b6d458824b2091dcff32defaf24894
[ "MIT" ]
null
null
null
module.exports = function (api) { api.cache(true) const presets = [ ["@babel/preset-typescript", { allExtensions: true, isTSX: true }], "@babel/preset-react", [ "@babel/preset-env", { useBuiltIns: "entry", corejs: { version: "3", proposal: true, }, // modules: "auto", targets: { browsers: [ "edge >= 16", "safari >= 9", "firefox >= 57", "ie >= 11", "ios >= 9", "chrome >= 49", ], }, // debug: true, }, ], ] const plugins = [ "@babel/plugin-transform-runtime", ["@babel/plugin-proposal-object-rest-spread", { useBuiltIns: true }], // "@babel/plugin-transform-spread", ["@babel/plugin-proposal-class-properties", { loose: true }], "@babel/plugin-transform-parameters", // "@babel/plugin-transform-classes", ] return { presets, plugins, overrides: [ { test: "./node_modules", sourceType: "unambiguous", }, ], env: { development: { presets: [["@babel/preset-react", { development: true }]], }, }, } }
22.036364
73
0.472772
314001d5f32b7ef549cbb70d0c8cfb1c57a97d33
321
js
JavaScript
Public/static/bootstrap/js/alert.js
zhu-xiaoyuan/XypBlog
061a3a2e7e93dab1425d4244de99c9e704bb044a
[ "BSD-2-Clause" ]
null
null
null
Public/static/bootstrap/js/alert.js
zhu-xiaoyuan/XypBlog
061a3a2e7e93dab1425d4244de99c9e704bb044a
[ "BSD-2-Clause" ]
null
null
null
Public/static/bootstrap/js/alert.js
zhu-xiaoyuan/XypBlog
061a3a2e7e93dab1425d4244de99c9e704bb044a
[ "BSD-2-Clause" ]
null
null
null
//重定义alert function alert(msg){ $('#alert').html("<div style='margin-left:30%;margin-top:30px' class='alert message fade in hide'><a class='dismiss close' data-dismiss='alert'>×</a><label>" + msg + "</label></div>" ); $(".alert").show(); $(".alert").delay(2000).fadeIn(1000).fadeOut(500); }
40.125
162
0.582555
31406503b2504d0bb45bb4315618912b45ef8ca1
7,233
js
JavaScript
packages/schema-builder-graphql/__tests__/metadata-subgraph-filter/cases.js
gleb-smagliy/unity
2c61052b1bf4e4b66232d2c9fedc8ecbc95e364b
[ "Apache-2.0" ]
null
null
null
packages/schema-builder-graphql/__tests__/metadata-subgraph-filter/cases.js
gleb-smagliy/unity
2c61052b1bf4e4b66232d2c9fedc8ecbc95e364b
[ "Apache-2.0" ]
null
null
null
packages/schema-builder-graphql/__tests__/metadata-subgraph-filter/cases.js
gleb-smagliy/unity
2c61052b1bf4e4b66232d2c9fedc8ecbc95e364b
[ "Apache-2.0" ]
null
null
null
import { DEFAULT_OPTIONS } from '../../src/graphql-schema-builder/graphql-schema-builder'; const CUSTOM_METADATA_NAME = 'customMetadata'; export const CASES = [ { input: `type Query { name: String }`, expected: `type Query { name: String }`, description: 'should leave unchanged schema without metadata' }, { input: `type Query { name: String, ${DEFAULT_OPTIONS.metadataQueryName}: String }`, expected: `type Query { name: String }`, description: 'should remove metadata query from schema when it is named by default' }, { input: `type Query { name: String, ${CUSTOM_METADATA_NAME}: String }`, expected: `type Query { name: String }`, metadataQueryName: CUSTOM_METADATA_NAME, description: 'should remove metadata query from schema when it has customized name' }, { input: ` type Metadata { name: String } type Query { name: String, ${DEFAULT_OPTIONS.metadataQueryName}: Metadata } `, expected: `type Query { name: String }`, description: 'should remove metadata query from schema when it is named by default' }, { input: ` type Metadata { id: String! } type Query { name: String ${DEFAULT_OPTIONS.metadataQueryName}: [Metadata] } `, expected: `type Query { name: String }`, description: 'should remove metadata type when query returns array' }, { input: ` type Metadata { id: String! } type Query { name: String ${DEFAULT_OPTIONS.metadataQueryName}: Metadata! } `, expected: `type Query { name: String }`, description: 'should remove metadata type when query returns non-nulls' }, { input: ` type Metadata { id: String! } type Query { name: String ${DEFAULT_OPTIONS.metadataQueryName}: [Metadata]! } `, expected: `type Query { name: String }`, description: 'should remove metadata type when query returns non-null array' }, { input: ` type Metadata { id: String! names: [String] } type Query { name: String ${DEFAULT_OPTIONS.metadataQueryName}: [Metadata] } `, expected: `type Query { name: String }`, description: 'should remove metadata type when other type returns array' }, { input: ` type MetadataName { value: String } type Metadata { name: MetadataName! } type Query { name: String ${DEFAULT_OPTIONS.metadataQueryName}: Metadata } `, expected: `type Query { name: String }`, description: 'should remove metadata type when other type returns non-null' }, { input: ` type Metadata { id: String! meta: Metadata } type Query { name: String ${DEFAULT_OPTIONS.metadataQueryName}: Metadata } `, expected: `type Query { name: String }`, description: 'should remove metadata type when it is recursive' }, { input: ` type MetadataItem { parentMetadata: Metadata } type Metadata { items: [MetadataItem] } type Query { name: String ${DEFAULT_OPTIONS.metadataQueryName}: [Metadata] } `, expected: `type Query { name: String }`, description: 'should remove metadata subgraph when it has cycle' }, { input: ` type FieldMetadata implements Metadata { name: String type: String field: String args: [String] } type ObjectMetadata implements Metadata { name: String type: String } interface Metadata { name: String! } type Query { name: String ${DEFAULT_OPTIONS.metadataQueryName}: [Metadata] } `, expected: `type Query { name: String }`, description: 'should remove metadata subgraph when it has interface' }, { input: ` type FieldMetadata { name: String type: String field: String args: [String] } type ObjectMetadata { name: String type: String } union Metadata = FieldMetadata | ObjectMetadata type Query { name: String ${DEFAULT_OPTIONS.metadataQueryName}: [Metadata] } `, expected: `type Query { name: String }`, description: 'should remove metadata subgraph when it has union' }, { input: ` input MetadataFilter { value: String! } type Metadata { id: String! } type Query { name: String ${DEFAULT_OPTIONS.metadataQueryName}(filter: MetadataFilter): [Metadata] } `, expected: `type Query { name: String }`, description: 'should remove metadata subgraph when it has inputs on query' }, { input: ` input ArgumentsFilter { name: String! } type MetadataArgument { name: String value: String } type Metadata { id: String! args (filter: ArgumentsFilter): [MetadataArgument] } type Query { name: String ${DEFAULT_OPTIONS.metadataQueryName}: [Metadata] } `, expected: `type Query { name: String }`, description: 'should remove metadata subgraph when it has inputs on non-query type' }, { input: ` type Metadata { query: Query } type Query { name: String ${DEFAULT_OPTIONS.metadataQueryName}: [Metadata] } `, expected: `type Query { name: String }`, description: 'should remove metadata subgraph when unerlying type returns Query type' }, { input: ` type Metadata { mutation: Mutation } type Mutation { action: Int } type Query { name: String ${DEFAULT_OPTIONS.metadataQueryName}: [Metadata] } `, expected: ` type Query { name: String } type Mutation { action: Int } `, description: 'should remove metadata subgraph when unerlying type returns Mutation type' }, { input: ` type Metadata { subscription: Subscription } type Subscription { action: Int } type Query { name: String ${DEFAULT_OPTIONS.metadataQueryName}: [Metadata] } `, expected: ` type Query { name: String } type Subscription { action: Int } `, description: 'should remove metadata subgraph when unerlying type returns Subscription type' }, { input: ` enum MetadataLocation { FIELD OBJECT INTERFACE } type Metadata { location: MetadataLocation } type Query { name: String ${DEFAULT_OPTIONS.metadataQueryName}: [Metadata] } `, expected: ` type Query { name: String } `, description: 'should remove metadata subgraph when unerlying type has enum types' } ];
22.817035
96
0.559381
3142cb13b041489bca357862b73b0211c5e1e5a8
7,320
js
JavaScript
public/js/script.js
123MwanjeMike/CovidStores
ada9d742c6bd1e465fbfb0fcbd14653b22a1f100
[ "MIT" ]
1
2022-03-31T07:48:06.000Z
2022-03-31T07:48:06.000Z
public/js/script.js
123MwanjeMike/CovidStores
ada9d742c6bd1e465fbfb0fcbd14653b22a1f100
[ "MIT" ]
15
2020-08-15T11:27:33.000Z
2022-03-29T08:12:13.000Z
public/js/script.js
123MwanjeMike/CovidStores
ada9d742c6bd1e465fbfb0fcbd14653b22a1f100
[ "MIT" ]
null
null
null
var fname = document.getElementById('fname'); var lname = document.getElementById('lname'); var address = document.getElementById('address'); var tel = document.getElementById('tel'); var email = document.getElementById('email'); var NIN = document.getElementById('NIN'); var ref = document.getElementById('ref'); var serialNo = document.getElementById('serialNo'); var itemName = document.getElementById('itemName'); var price = document.getElementById('price'); var payment = document.getElementById('payment'); var DOP = document.getElementById('DOP'); var balance = document.getElementById('balance'); var nextPay = document.getElementById('nextPay'); var nDOP = document.getElementById('nDOP'); var receipt = document.getElementById('receipt'); var photo = document.getElementById('photo'); var make = document.getElementById('make'); var category = document.getElementById('category'); var numberInStock = document.getElementById('numberInStock'); var payInterval = document.getElementById('payInterval'); var payment = document.getElementById('payment'); var formError = document.getElementById('error'); var submit = document.getElementById('submit'); var mybutton = document.getElementById('mybutton'); var serialError = document.getElementById('serialError'); // First installment calc from add item page(not purchase) var firstInstall = () => { var price = document.getElementById('price'); var initialPay = document.getElementById('initialPay'); initialPay.value = price.value - (price.value / 2); } //from new purchase and installment var balanceafter = () => { balance.value = (price.value - payment.value) } // Gets date, within t number of months Date.prototype.addMonths = function (m) { var d = new Date(this); var years = Math.floor(m / 12); var months = m - (years * 12); if (years) d.setFullYear(d.getFullYear() + years); if (months) d.setMonth(d.getMonth() + months); return d.toLocaleString("ca-ES"); } // A function that will do all my data validations system wide var required = (input, error, regex) => { if (input.value.length == "") { input.style.border = "1px solid red"; formError.textContent = "Please enter " + error + "!" submit.disabled = true; return false; } else { input.style.border = ""; formError.textContent = ""; submit.disabled = false; } if (regex != undefined) { if (!input.value.match(regex)) { input.style.border = "1px solid red"; formError.textContent = "Please enter a valid " + error + "!" submit.disabled = true; return false; } else { input.style.border = ""; formError.textContent = ""; submit.disabled = false; } } } // Item entry validation var validate = () => { if (required(make, "make", '^[A-Z]{2}$') === false) return 0 if (required(photo, "item image") === false) return 0 if (required(itemName, "item name", '^[a-zA-Z]*$') === false) return 0 if (required(category, "a select category") == 0) return 0 if (required(serialNo, "a serial number", '^[a-zA-Z0-9_]*$') == 0) return 0 if (required(numberInStock, "number of items in stock", '^[0-9]+$') == 0) return 0 if (required(price, "price", '^[0-9]+$') == 0) return 0 if (required(initialPay, "initial pay", '^[0-9]+$') == 0) return 0 if (required(payInterval, "pay interval", '^[0-9]+$') == 0) return 0 // Serial number if (serialNo.value.length < 6 || serialNo.value.length > 22) { serialNo.style.border = "1px solid red"; formError.textContent = "Serial number should have 6 to 22 characters"; } } // Purchase detail validation var purchase = () => { // NIN starts with 3 characters in capital letters, followed by numbers and ends with characters in capital letters if (required(NIN, "National ID number", '^[A-Z]{3}[0-9]{7}[A-Z]{3}$') == 0) return 0 if (required(fname, "first name") == 0) return 0 if (required(lname, "last name") == 0) return 0 if (required(address, "address") == 0) return 0 if (required(tel, "telephone number") == 0) return 0 if (required(email, "email") == 0) return 0 if (required(ref, "referee number") == 0) return 0 if (required(serialNo, "serial number") == 0) return 0 if (required(itemName, "item name", '^[a-zA-Z\s]+$') == 0) return 0 if (required(price, "price", '^[0-9]+$') == 0) return 0 if (required(payment, "payment", '^[0-9]+$') == 0) return 0 if (required(DOP, "date of payment") == 0) return 0 if (required(balance, "balance", '^[0-9]+$') == 0) return 0 if (required(nextPay, "date of next pay") == 0) return 0 if (required(receipt, "receipt number") == 0) return 0 } //For serial number must be unique var serialNumber = () => { if (serialNo.value.length == "") { serialError.textContent = "Please enter Serial Number"; submit.disabled = true; return 0; } fetch('/agent/api/' + serialNo.value) .then(response => { return response.json(); }) .then(json => { if (json.item[0] === undefined) { serialError.textContent = ""; formError.textContent = ""; submit.disabled = false; return 0; } else { serialError.textContent = "Item with Serial Number '" + serialNo.value + "' already exists"; formError.textContent = "Item with Serial Number '" + serialNo.value + "' already exists"; submit.disabled = true; return 0; } }) .catch(err => { serialError.textContent = "Something went wrong! Please reload page"; console.error(err) return 0; }); } // Item search by serial number var productdetails = () => { mybutton.disabled = true; if (serialNo.value.length == "") { serialError.textContent = "Enter a Serial Number to continue"; submit.disabled = true; return 0; } fetch('/agent/api/' + serialNo.value) .then(response => { return response.json(); }) .then(json => { if (json.item[0] === undefined) { serialError.textContent = "Item with serial number '" + serialNo.value + "' not found"; return 0; } itemName.value = json.item[0].name; price.value = json.item[0].price; payment.value = json.item[0].initialPay; balance.value = (json.item[0].price - json.item[0].initialPay); payInterval.value = json.item[0].payInterval; DOP.value = new Date().addMonths(0); nDOP.value = new Date().addMonths(json.item[0].payInterval); nextPay.value = (balance.value / 2); }) .catch(err => { serialError.textContent = "Something went wrong, try again"; console.error(err) return 0; }); mybutton.disabled = false; } // Installment payment validation var installmentpaid = () => { balanceafter(); DOP.value = new Date().addMonths(0); nDOP.value = new Date().addMonths(payInterval.value); nextPay.value = (balance.value / 2); }
40.21978
119
0.603962
3142e7d93b8e4c407a553c4480782fda27597dde
931
js
JavaScript
index.js
alexmeji/aws-lambda-logger
29dd4620d14093fb8869c055617b3c8ceaa8d5f1
[ "Apache-2.0" ]
1
2018-03-13T22:01:39.000Z
2018-03-13T22:01:39.000Z
index.js
alexmeji/aws-lambda-logger
29dd4620d14093fb8869c055617b3c8ceaa8d5f1
[ "Apache-2.0" ]
null
null
null
index.js
alexmeji/aws-lambda-logger
29dd4620d14093fb8869c055617b3c8ceaa8d5f1
[ "Apache-2.0" ]
null
null
null
'use strict' const debug = (context, data) => { process.stdout.write(`[${context.functionName}] Start Logger` + '\n') let contextInfo = { 'functionName': context.functionName, 'memoryLimitInMB': context.memoryLimitInMB, 'functionVersion': context.functionVersion, 'code': 10, 'data': data } process.stdout.write(JSON.stringify(contextInfo) + '\n') process.stdout.write(`[${context.functionName}] Finish Logger` + '\n') } const error = (context, error) => { process.stdout.write(`[${context.functionName}] Start Logger` + '\n') let contextInfo = { 'functionName': context.functionName, 'memoryLimitInMB': context.memoryLimitInMB, 'functionVersion': context.functionVersion, 'code': 50, 'error': error } process.stdout.write(JSON.stringify(contextInfo) + '\n') process.stdout.write(`[${context.functionName}] Finish Logger` + '\n') } module.exports = { debug, error }
30.032258
72
0.673469
3143b2950e9f6ef80a2e987e44494a2f6e46eaf0
2,995
js
JavaScript
public/js/js_handler.js
LoganStyles/ieianchorsite
76bf1d83dd903763ca3c16ebf447a30d336ef179
[ "MIT" ]
null
null
null
public/js/js_handler.js
LoganStyles/ieianchorsite
76bf1d83dd903763ca3c16ebf447a30d336ef179
[ "MIT" ]
null
null
null
public/js/js_handler.js
LoganStyles/ieianchorsite
76bf1d83dd903763ca3c16ebf447a30d336ef179
[ "MIT" ]
null
null
null
//function modalLoader(mode,type,id){ // console.log(mode); // var form_action = "#" + type + "_action"; // var formid = "#" + type + "_form"; // var header = "#" + type + "_header"; // var modal="#"+type+"_modal"; // var submit_but = formid + " input[type='submit']"; // // var itemid = "#" + type + "_ID"; //// console.log('form_action: ' + form_action); //// console.log('formid: ' + formid); //// console.log('modal: ' + modal); //// console.log('submit_but: ' + submit_but); // // switch(mode){ // case 'new': // console.log('inside new'); // $(header).text('New Item'); // $(formid).trigger('reset'); //// $(form_action).val("insert"); // $(modal).modal({backdrop: false, keyboard: false}); // break; // } //} function resetForm(formid){ $(formid).trigger('reset'); $(formid+" #details").text(""); $(formid+" #title").text(""); $(formid+" #id").val(0); } //function modalLoader(type, modal, mode, id) { // $('#error_div').html("").removeClass("alert alert-danger error"); // var form_action = "#" + type + "_action"; // var formid = "#" + type + "_form"; // var submit_but = formid + " input[type='submit']"; // // var itemid = "#" + type + "_ID"; // console.log('form_action: ' + form_action); // // switch (mode) { // case 'new': // $(modal).addClass("in").css('display', 'block'); // $(formid).trigger('reset'); // $(form_action).val("insert"); // $(modal).modal({backdrop: false, keyboard: false}); // break; // case 'edit': // $(form_action).val("update"); // $(itemid).val(id); // $(modal).addClass("in").css('display', 'block'); // console.log('case edit'); // if (type !== "housekeeping") { // fetchRowData(type, id); // } // break; // case 'view': // $(form_action).val("view"); // $(submit_but).attr('disabled', true); // $(modal).addClass("in").css('display', 'block'); // var allforminputs = "#" + type + "_form :input"; // $(allforminputs).attr('readonly', 'readonly'); // $(itemid).val(id); // console.log('case view'); // if (type !== "housekeeping") { // fetchRowData(type, id); // } // break; // case 'delete': // console.log('case delete'); // $('#delete_id').val(id); // $('#delete_type').val(type); // $(form_action).val("delete"); // $("#delete_modal").modal({backdrop: false, keyboard: false}); // break; // default: // break; // } // }
36.52439
79
0.437396
3143fa29a88baa103808cc6389b7db395fe1fb72
113
js
JavaScript
src/ex2_js-basics-part2/task-05.js
Eliseeev/external-courses
dd5a5c47c0433138c2517774719465924c12c4c9
[ "MIT" ]
null
null
null
src/ex2_js-basics-part2/task-05.js
Eliseeev/external-courses
dd5a5c47c0433138c2517774719465924c12c4c9
[ "MIT" ]
3
2021-10-18T20:05:39.000Z
2021-12-19T19:30:08.000Z
src/ex2_js-basics-part2/task-05.js
Eliseeev/external-courses
dd5a5c47c0433138c2517774719465924c12c4c9
[ "MIT" ]
null
null
null
function maxValue(mass) { const last = Math.max.apply(null, mass); return last; } module.exports = maxValue;
18.833333
42
0.707965
31448fb7c550d5c6bbf64cf9997c774ccbc8b117
16,880
js
JavaScript
public/scripts/guest.js
neerajkr007/Sync-Player
cc894dfb679cd6f88978da1799bd1ac4e95c37cd
[ "MIT" ]
null
null
null
public/scripts/guest.js
neerajkr007/Sync-Player
cc894dfb679cd6f88978da1799bd1ac4e95c37cd
[ "MIT" ]
1
2021-03-29T09:47:36.000Z
2021-03-29T09:47:36.000Z
public/scripts/guest.js
neerajkr007/Sync-Player
cc894dfb679cd6f88978da1799bd1ac4e95c37cd
[ "MIT" ]
null
null
null
const _0x4a86=['font-size:\x20xx-large\x20!important;','answer','turns:bn-turn1.xirsys.com:5349?transport=tcp','welcome\x20','12345@54321','Session\x20Type','mediaDevices','innerHTML','stun:stun3.l.google.com:19302','stun:stun.l.google.com:19302','random','Soorma\x20Bhopali','tries','turn:bn-turn1.xirsys.com:80?transport=tcp','turn:relay.backups.cz','catch','then','583755NBTrIn','initReceive','stun:stun.stunprotocol.org','574683AHkaim','style','stream','</li>','\x27s\x20room','stun:numb.viagenie.ca','#modal','vashisthneeraj06@gmail.com','Chatur\x20Silencer','initSend','webrtc','Vasooli\x20Bhai','stun:global.stun.twilio.com:3478?transport=udp','added','catches','stream\x20connected\x20to\x20','floor','turn:bn-turn1.xirsys.com:3478?transport=udp','<div\x20class=\x22form-check\x22><input\x20class=\x22form-check-input\x22\x20type=\x22radio\x22\x20name=\x22Radios\x22\x20id=\x22Radios1\x22\x20value=\x22load\x22\x20checked><label\x20id=\x22Radios01\x22\x20class=\x22form-check-label\x22\x20for=\x22Radios1\x22>users\x20have\x20their\x20file\x20and\x20will\x20load\x20themselves</label></div>','turn:bn-turn1.xirsys.com:3478?transport=tcp','randomElement1','pauseAudio','connect','\x22\x20class=\x22list-group-item\x22\x20style=\x22background:\x20#404040\x20!important;\x22>','Raju','getElementsByClassName','playerList','sessionType','stun:stun.counterpath.com','\x20you\x20are\x20in\x20','connection','3LDNlKk','load','name','showing','display','<div\x20class=\x22form-check\x22><input\x20class=\x22form-check-input\x22\x20type=\x22radio\x22\x20name=\x22Radios\x22\x20id=\x22Radios3\x22\x20value=\x22youtube\x22><label\x20id=\x22Radios03\x22\x20class=\x22form-check-label\x22\x20for=\x22Radios3\x22>watch\x20a\x20youtube\x20video</label></div>','connected','Chota\x20Chatri','toggle','text/plain','791065xffrcU','getElementById','emit','captions','block','confirm','playerlist','joinedRoom','addEventListener','welcomeUser','modal-backdrop','pause','<i\x20class=\x22fas\x20fa-2x\x20fa-microphone\x22\x20></i>','turns:bn-turn1.xirsys.com:443?transport=tcp','my-video','player','click','<div\x20class=\x22form-check\x22><input\x20class=\x22form-check-input\x22\x20type=\x22radio\x22\x20name=\x22Radios\x22\x20id=\x22Radios2\x22\x20value=\x22stream\x22><label\x20id=\x22Radios02\x22\x20class=\x22form-check-label\x22\x20for=\x22Radios2\x22>users\x20will\x20stream\x20from\x20the\x20host</label></div>','Crime\x20Master\x20Gogo','cant\x20play\x20audio\x20coz\x20their\x20mic\x20is\x20not\x20working','hidden.bs.modal','Radios01','getusermedia\x20error\x20','createElement','stun:stun1.l.google.com:19302','turn:bn-turn1.xirsys.com:80?transport=udp','stun:stun4.l.google.com:19302','modal-title','slice','16gQYwUP','Babu\x20Bhaiya','turn:relay.backups.cz?transport=tcp','remove','previousElementSibling','audio','1ffTCdy','1wkqmgR','18132NiTWGt','play','leftRoom','checkForHost','onclick','createGuestRoom2','141873qNZBTP','length','Session\x20Type\x20\x20:\x20\x20','997wytH9ZFhdVNSdxdJpgJ3AAJcA98dMKAVZTF4aPhTHykqtJ5rJb-zClEvM-03ZAAAAAGB2nMNzdHJpZGVy','stun:stun.stunprotocol.prg','open','stun:bn-turn1.xirsys.com','audioPlayer','call','mySubs','stun:stun2.l.google.com:19302','href','<li\x20id=\x22roomMemberList','Virus','myfile','turn:numb.viagenie.ca','error','Radios02','micButton','appendChild','subs','vjs-big-play-button','getUserMedia','location','log','Radios03','addRemoteTextTrack','Jhandu\x20Lal\x20Tyagi','Circuit','playAudioEmit','srcObject','975746LIwBVK','e2af97c0-9cf4-11eb-80c6-0242ac140004','Langda\x20Tyagi','checked','none','playAudio','330001ZUseeS'];function _0x3e49(_0x2cb8ff,_0x1207a5){_0x2cb8ff=_0x2cb8ff-0x188;let _0x4a8618=_0x4a86[_0x2cb8ff];return _0x4a8618;}const _0x256d3d=_0x3e49;(function(_0x57f9bc,_0x577f1d){const _0x424ba6=_0x3e49;while(!![]){try{const _0x55b58b=parseInt(_0x424ba6(0x207))+parseInt(_0x424ba6(0x1b3))+parseInt(_0x424ba6(0x1dc))*parseInt(_0x424ba6(0x1ff))+parseInt(_0x424ba6(0x198))+parseInt(_0x424ba6(0x200))*-parseInt(_0x424ba6(0x19e))+-parseInt(_0x424ba6(0x1f9))*-parseInt(_0x424ba6(0x201))+parseInt(_0x424ba6(0x1d2))*-parseInt(_0x424ba6(0x1b0));if(_0x55b58b===_0x577f1d)break;else _0x57f9bc['push'](_0x57f9bc['shift']());}catch(_0x39e0a5){_0x57f9bc['push'](_0x57f9bc['shift']());}}}(_0x4a86,0xa8ff5));const socket=io[_0x256d3d(0x1c9)](),roomId=window[_0x256d3d(0x190)][_0x256d3d(0x212)][_0x256d3d(0x1f8)](-0x1e);let guestNames=['Pappu\x20Pager',_0x256d3d(0x194),_0x256d3d(0x1aa),_0x256d3d(0x1d9),_0x256d3d(0x195),_0x256d3d(0x1bb),_0x256d3d(0x19a),_0x256d3d(0x1ee),_0x256d3d(0x1be),_0x256d3d(0x1cb),_0x256d3d(0x1fa),'Shyam','Munna\x20Bhai',_0x256d3d(0x214),'Dr.\x20Ghungroo'],guestName=guestNames[Math[_0x256d3d(0x1c3)](Math[_0x256d3d(0x1a9)]()*0xf)];socket[_0x256d3d(0x1de)](_0x256d3d(0x206),roomId,guestName),socket[_0x256d3d(0x1de)](_0x256d3d(0x204),roomId,guestName);let peers={},myHostId=roomId,mySocketId='',sessionType='',roomMemberCount=0x0,voiceOn=!![],currentSessionType='',hostSocket,SubBlob,subBlobUrl,once=!![];function updateRoomMemberList(_0x26962b){const _0x4e932a=_0x256d3d;currentUserCount=_0x26962b[_0x4e932a(0x208)],document[_0x4e932a(0x1dd)]('playerList')[_0x4e932a(0x1a6)]='';for(let _0x44d433=0x0;_0x44d433<_0x26962b[_0x4e932a(0x208)];_0x44d433++){document[_0x4e932a(0x1dd)](_0x4e932a(0x1cd))[_0x4e932a(0x1a6)]+=_0x4e932a(0x213)+_0x26962b[_0x44d433]+_0x4e932a(0x1ca)+_0x26962b[_0x44d433]+_0x4e932a(0x1b6);}}function getStarted(){const _0x3cfbb6=_0x256d3d;document[_0x3cfbb6(0x1dd)](_0x3cfbb6(0x1f7))[_0x3cfbb6(0x1a6)]=_0x3cfbb6(0x1a4);let _0x40438c=document['getElementById']('modal-body');_0x40438c[_0x3cfbb6(0x1a6)]=_0x3cfbb6(0x1c5)+_0x3cfbb6(0x1ed)+_0x3cfbb6(0x1d7);let _0x59d8ec=document[_0x3cfbb6(0x1dd)]('modal-cancel');_0x59d8ec[_0x3cfbb6(0x1a6)]=_0x3cfbb6(0x1e1),_0x59d8ec[_0x3cfbb6(0x205)]=()=>{const _0xa388cb=_0x3cfbb6;document[_0xa388cb(0x1dd)]('getStartedButton')[_0xa388cb(0x1fc)]();if(document[_0xa388cb(0x1dd)]('Radios1')[_0xa388cb(0x19b)])sessionType=_0xa388cb(0x1d3),document['getElementById'](_0xa388cb(0x1ce))[_0xa388cb(0x1a6)]=_0xa388cb(0x209)+document[_0xa388cb(0x1dd)](_0xa388cb(0x1f1))[_0xa388cb(0x1a6)],document['getElementById'](_0xa388cb(0x1eb))[_0xa388cb(0x1b4)][_0xa388cb(0x1d6)]=_0xa388cb(0x1e0);else document[_0xa388cb(0x1dd)]('Radios2')['checked']?(sessionType='stream',document[_0xa388cb(0x1dd)]('sessionType')['innerHTML']=_0xa388cb(0x209)+document[_0xa388cb(0x1dd)](_0xa388cb(0x18a))['innerHTML'],document[_0xa388cb(0x1dd)](_0xa388cb(0x1eb))['style'][_0xa388cb(0x1d6)]='block'):(sessionType='youtube',syncYoutube(),document[_0xa388cb(0x1dd)](_0xa388cb(0x1ce))[_0xa388cb(0x1a6)]=_0xa388cb(0x209)+document[_0xa388cb(0x1dd)](_0xa388cb(0x192))[_0xa388cb(0x1a6)],document['getElementById'](_0xa388cb(0x1eb))['style'][_0xa388cb(0x1d6)]='block');currentSessionType=sessionType,document[_0xa388cb(0x1dd)](_0xa388cb(0x1c7))[_0xa388cb(0x1fc)]();},$(_0x3cfbb6(0x1b9))['modal'](_0x3cfbb6(0x1da)),$(_0x3cfbb6(0x1b9))['on'](_0x3cfbb6(0x1f0),function(_0x1a4cbd){const _0xeb0f95=_0x3cfbb6;_0x59d8ec[_0xeb0f95(0x205)]=null,_0x59d8ec[_0xeb0f95(0x1a6)]='close';});}function toggleVoice(){const _0x372cbd=_0x256d3d;voiceOn?(socket[_0x372cbd(0x1de)]('playAudioEmit',0x1,myHostId),voiceOn=![],document['getElementById'](_0x372cbd(0x18b))[_0x372cbd(0x1a6)]=_0x372cbd(0x1e8)):(socket['emit'](_0x372cbd(0x196),0x2,myHostId),voiceOn=!![],document[_0x372cbd(0x1dd)]('micButton')['innerHTML']='<i\x20class=\x22fas\x20fa-2x\x20fa-microphone-slash\x22></i>');}function inputChanged(_0x5e37b7){if(sessionType=='load')loadFile(_0x5e37b7);else sessionType=='stream'&&streamFile(_0x5e37b7);}function addSubs(_0xc837cc){const _0x1441ec=_0x256d3d,{target:{files:_0x2fcf10}}=_0xc837cc,[_0x1b3c23]=_0x2fcf10;{const _0x142e23=new WebVTTConverter([_0x1b3c23][0x0]);_0x142e23['getURL']()['then'](_0x5c6545=>{const _0x5e23a1=_0x3e49;var _0x4e8790=videojs('my-video');_0x4e8790[_0x5e23a1(0x193)]({'kind':'captions','label':_0x5e23a1(0x1c0),'src':_0x5c6545,'mode':_0x5e23a1(0x1d5)},![]);})[_0x1441ec(0x1ae)](_0x49ef37=>{const _0x52b10d=_0x1441ec;console[_0x52b10d(0x189)](_0x49ef37);});}sessionType=='stream'&&mySocketId==myHostId&&socket[_0x1441ec(0x1de)](_0x1441ec(0x18d),[_0x1b3c23][0x0]);}socket['on'](_0x256d3d(0x206),(_0x1b107e,_0x59936f)=>{const _0x181bd5=_0x256d3d;mySocketId=_0x1b107e;if(_0x59936f!=guestName)document[_0x181bd5(0x1dd)]('welcomeUser')[_0x181bd5(0x1b4)]=_0x181bd5(0x19f),document['getElementById'](_0x181bd5(0x1e5))['innerHTML']=_0x181bd5(0x1a2)+guestName+_0x181bd5(0x1d0)+_0x59936f+_0x181bd5(0x1b7);else document[_0x181bd5(0x1dd)](_0x181bd5(0x1e5))[_0x181bd5(0x1a6)]=_0x59936f+'\x27s\x20room';}),socket['on'](_0x256d3d(0x204),()=>{const _0xf6a908=_0x256d3d;document[_0xf6a908(0x1dd)]('hostUI')[_0xf6a908(0x1fc)]();}),socket['on'](_0x256d3d(0x1b1),(_0x4da389,_0x18ccc2)=>{const _0xd5e0ea=_0x256d3d;myHostId=_0x18ccc2;try{console[_0xd5e0ea(0x191)](_0xd5e0ea(0x1ab)),peers[_0x4da389]=new Peer({'config':{'iceServers':[{'urls':['stun:bn-turn1.xirsys.com','stun:numb.viagenie.ca',_0xd5e0ea(0x1a8),'stun:stun1.l.google.com:19302','stun:stun2.l.google.com:19302',_0xd5e0ea(0x1a7),_0xd5e0ea(0x1f6),'stun:global.stun.twilio.com:3478?transport=udp',_0xd5e0ea(0x20b),_0xd5e0ea(0x1cf),_0xd5e0ea(0x1b2)]},{'username':_0xd5e0ea(0x20a),'credential':'e2af97c0-9cf4-11eb-80c6-0242ac140004','urls':[_0xd5e0ea(0x1f5),_0xd5e0ea(0x1c4),_0xd5e0ea(0x1ac),_0xd5e0ea(0x1c6),_0xd5e0ea(0x1e9),_0xd5e0ea(0x1a1)]},{'username':'vashisthneeraj06@gmail.com','credential':_0xd5e0ea(0x1a3),'urls':['turn:numb.viagenie.ca']},{'username':_0xd5e0ea(0x1bd),'credential':_0xd5e0ea(0x1bd),'urls':[_0xd5e0ea(0x1ad),_0xd5e0ea(0x1fb)]}]}});}catch(_0x1a41d8){console[_0xd5e0ea(0x191)](_0x1a41d8),console[_0xd5e0ea(0x191)](_0xd5e0ea(0x1c1)),peers[_0x4da389]=new Peer({'config':{'iceServers':[{'urls':[_0xd5e0ea(0x20d),_0xd5e0ea(0x1b8),'stun:stun.l.google.com:19302','stun:stun1.l.google.com:19302',_0xd5e0ea(0x211),_0xd5e0ea(0x1a7),_0xd5e0ea(0x1f6),'stun:global.stun.twilio.com:3478?transport=udp',_0xd5e0ea(0x20b),_0xd5e0ea(0x1cf),'stun:stun.stunprotocol.org']},{'username':'997wytH9ZFhdVNSdxdJpgJ3AAJcA98dMKAVZTF4aPhTHykqtJ5rJb-zClEvM-03ZAAAAAGB2nMNzdHJpZGVy','credential':_0xd5e0ea(0x199),'urls':[_0xd5e0ea(0x1f5),'turn:bn-turn1.xirsys.com:3478?transport=udp',_0xd5e0ea(0x1ac),_0xd5e0ea(0x1c6),_0xd5e0ea(0x1e9),_0xd5e0ea(0x1a1)]},{'username':_0xd5e0ea(0x1ba),'credential':_0xd5e0ea(0x1a3),'urls':[_0xd5e0ea(0x188)]},{'username':_0xd5e0ea(0x1bd),'credential':_0xd5e0ea(0x1bd),'urls':[_0xd5e0ea(0x1ad),_0xd5e0ea(0x1fb)]}]}});}peers[_0x4da389]['on']('open',function(_0x28a0dc){const _0x311ece=_0xd5e0ea;socket[_0x311ece(0x1de)](_0x311ece(0x1bc),_0x4da389,_0x28a0dc);}),peers[_0x4da389]['on'](_0xd5e0ea(0x1d1),function(_0x58c2fc){const _0x47016d=_0xd5e0ea;_0x58c2fc['on'](_0x47016d(0x20c),()=>{const _0x5ee374=_0x47016d;console[_0x5ee374(0x191)]('connected'),document[_0x5ee374(0x1dd)](_0x5ee374(0x1e2))[_0x5ee374(0x1b4)]['display']=_0x5ee374(0x1e0),navigator[_0x5ee374(0x1a5)][_0x5ee374(0x18f)]({'audio':!![]})[_0x5ee374(0x1af)](_0x383f1a=>{const _0x396f60=_0x5ee374;peers[_0x4da389]['on'](_0x396f60(0x20f),function(_0x35ded8){const _0x2b196d=_0x396f60;_0x35ded8[_0x2b196d(0x1a0)](_0x383f1a),_0x35ded8['on'](_0x2b196d(0x1b5),function(_0x1571d8){const _0x2b7f1a=_0x2b196d;document[_0x2b7f1a(0x1dd)]('micButton')[_0x2b7f1a(0x1b4)][_0x2b7f1a(0x1d6)]='block',console['log'](_0x2b7f1a(0x1c2)+_0x4da389);let _0x3c48f6=document[_0x2b7f1a(0x1f3)](_0x2b7f1a(0x1fe));_0x3c48f6[_0x2b7f1a(0x197)]=_0x1571d8,_0x3c48f6['id']=_0x4da389,document[_0x2b7f1a(0x1dd)](_0x2b7f1a(0x20e))[_0x2b7f1a(0x18c)](_0x3c48f6);});});})[_0x5ee374(0x1ae)](_0x59d67c=>{const _0xe08e96=_0x5ee374;alert(_0xe08e96(0x1f2)+_0x59d67c[_0xe08e96(0x1d4)]);});if(myHostId==mySocketId){if(sessionType==_0x5ee374(0x1b5))createDataChannel(_0x58c2fc);}});});}),socket['on'](_0x256d3d(0x1bc),(_0x547de6,_0x18079c)=>{const _0x58f9d4=_0x256d3d;try{peers[_0x547de6]=new Peer({'config':{'iceServers':[{'urls':['stun:bn-turn1.xirsys.com','stun:numb.viagenie.ca',_0x58f9d4(0x1a8),_0x58f9d4(0x1f4),_0x58f9d4(0x211),_0x58f9d4(0x1a7),'stun:stun4.l.google.com:19302','stun:global.stun.twilio.com:3478?transport=udp',_0x58f9d4(0x20b),'stun:stun.counterpath.com',_0x58f9d4(0x1b2)]},{'username':_0x58f9d4(0x20a),'credential':_0x58f9d4(0x199),'urls':['turn:bn-turn1.xirsys.com:80?transport=udp',_0x58f9d4(0x1c4),_0x58f9d4(0x1ac),_0x58f9d4(0x1c6),_0x58f9d4(0x1e9),_0x58f9d4(0x1a1)]},{'username':'vashisthneeraj06@gmail.com','credential':'12345@54321','urls':['turn:numb.viagenie.ca']},{'username':_0x58f9d4(0x1bd),'credential':_0x58f9d4(0x1bd),'urls':['turn:relay.backups.cz',_0x58f9d4(0x1fb)]}]}});}catch{peers[_0x547de6]=new Peer({'config':{'iceServers':[{'urls':['stun:bn-turn1.xirsys.com',_0x58f9d4(0x1b8),'stun:stun.l.google.com:19302','stun:stun1.l.google.com:19302',_0x58f9d4(0x211),_0x58f9d4(0x1a7),'stun:stun4.l.google.com:19302',_0x58f9d4(0x1bf),'stun:stun.stunprotocol.prg',_0x58f9d4(0x1cf),_0x58f9d4(0x1b2)]},{'username':'997wytH9ZFhdVNSdxdJpgJ3AAJcA98dMKAVZTF4aPhTHykqtJ5rJb-zClEvM-03ZAAAAAGB2nMNzdHJpZGVy','credential':_0x58f9d4(0x199),'urls':[_0x58f9d4(0x1f5),_0x58f9d4(0x1c4),_0x58f9d4(0x1ac),_0x58f9d4(0x1c6),'turns:bn-turn1.xirsys.com:443?transport=tcp',_0x58f9d4(0x1a1)]},{'username':_0x58f9d4(0x1ba),'credential':_0x58f9d4(0x1a3),'urls':['turn:numb.viagenie.ca']},{'username':_0x58f9d4(0x1bd),'credential':_0x58f9d4(0x1bd),'urls':[_0x58f9d4(0x1ad),_0x58f9d4(0x1fb)]}]}});}peers[_0x547de6]['on'](_0x58f9d4(0x20c),function(_0x15cfbe){const _0x54db40=_0x58f9d4;var _0x12f7cf=peers[_0x547de6]['connect'](_0x18079c);_0x12f7cf['on'](_0x54db40(0x20c),function(){const _0x1320eb=_0x54db40;console[_0x1320eb(0x191)](_0x1320eb(0x1d8)),document['getElementById']('playerlist')[_0x1320eb(0x1b4)][_0x1320eb(0x1d6)]=_0x1320eb(0x1e0),navigator[_0x1320eb(0x1a5)][_0x1320eb(0x18f)]({'audio':!![]})[_0x1320eb(0x1af)](_0x4816b9=>{const _0x323f70=_0x1320eb;var _0x37ba6c=peers[_0x547de6][_0x323f70(0x20f)](_0x18079c,_0x4816b9);_0x37ba6c['on'](_0x323f70(0x1b5),function(_0x55178c){const _0x5c2253=_0x323f70;document[_0x5c2253(0x1dd)](_0x5c2253(0x18b))[_0x5c2253(0x1b4)][_0x5c2253(0x1d6)]=_0x5c2253(0x1e0),console['log']('call\x20connected\x20to\x20'+_0x547de6);let _0x1412c5=document['createElement'](_0x5c2253(0x1fe));_0x1412c5[_0x5c2253(0x197)]=_0x55178c,_0x1412c5['id']=_0x547de6,document['getElementById'](_0x5c2253(0x20e))['appendChild'](_0x1412c5);});})[_0x1320eb(0x1ae)](_0x395d17=>{const _0x3f4e90=_0x1320eb;alert(_0x3f4e90(0x1f2)+_0x395d17[_0x3f4e90(0x1d4)]);}),myHostId==_0x547de6&&sessionType==_0x1320eb(0x1b5)&&recieveDataChannel(_0x12f7cf);});});}),socket['on'](_0x256d3d(0x19d),_0x2d7420=>{const _0xdb90e9=_0x256d3d;try{document[_0xdb90e9(0x1dd)](_0x2d7420)[_0xdb90e9(0x202)]();}catch(_0x420f11){console[_0xdb90e9(0x191)](_0xdb90e9(0x1ef));}}),socket['on'](_0x256d3d(0x1c8),_0x3c04ab=>{const _0x50cb1e=_0x256d3d;try{document['getElementById'](_0x3c04ab)[_0x50cb1e(0x1e7)]();}catch(_0x5ae93b){}}),socket['on'](_0x256d3d(0x1e3),_0x1c4b33=>{const _0x149294=_0x256d3d;roomMemberCount=_0x1c4b33[_0x149294(0x208)],updateRoomMemberList(_0x1c4b33),socket[_0x149294(0x1de)](_0x149294(0x1ce),sessionType);}),socket['on'](_0x256d3d(0x203),_0x5c28ec=>{const _0x493034=_0x256d3d;roomMemberCount=_0x5c28ec[_0x493034(0x208)],updateRoomMemberList(_0x5c28ec);}),socket['on']('sessionType',_0x1ec35f=>{const _0x20b857=_0x256d3d;currentSessionType=_0x1ec35f,console[_0x20b857(0x191)](currentSessionType);if(currentSessionType==_0x20b857(0x1d3))document[_0x20b857(0x1dd)]('player')[_0x20b857(0x1b4)][_0x20b857(0x1d6)]=_0x20b857(0x1e0),document[_0x20b857(0x1dd)]('1')[_0x20b857(0x1b4)]['display']=_0x20b857(0x1e0),document[_0x20b857(0x1dd)](_0x20b857(0x215))[_0x20b857(0x1b4)][_0x20b857(0x1d6)]=_0x20b857(0x1e0);else currentSessionType==_0x20b857(0x1b5)&&(document[_0x20b857(0x1dd)]('1')['style'][_0x20b857(0x1d6)]='none',document['getElementById'](_0x20b857(0x215))['style'][_0x20b857(0x1d6)]=_0x20b857(0x19c),document[_0x20b857(0x1dd)](_0x20b857(0x1eb))[_0x20b857(0x1b4)][_0x20b857(0x1d6)]=_0x20b857(0x1e0),document[_0x20b857(0x1cc)](_0x20b857(0x18e))[0x0][_0x20b857(0x1fc)](),document[_0x20b857(0x1dd)](_0x20b857(0x210))[_0x20b857(0x1fd)][_0x20b857(0x1fc)](),document[_0x20b857(0x1dd)](_0x20b857(0x210))[_0x20b857(0x1fc)]());}),socket['on'](_0x256d3d(0x18d),_0x5ed8b5=>{const _0x17612f=_0x256d3d;SubBlob=new Blob([_0x5ed8b5],{'type':_0x17612f(0x1db)}),subBlobUrl=URL['createObjectURL'](SubBlob);var _0x194951=videojs(_0x17612f(0x1ea));subBlobUrl!=null&&_0x194951['addRemoteTextTrack']({'kind':_0x17612f(0x1df),'label':'en','src':subBlobUrl,'mode':_0x17612f(0x1d5)},![]);}),document[_0x256d3d(0x1e4)](_0x256d3d(0x1ec),function(){const _0x3477cc=_0x256d3d;document[_0x3477cc(0x1dd)]('modal')[_0x3477cc(0x1b4)][_0x3477cc(0x1d6)]==_0x3477cc(0x19c)&&document['getElementsByClassName'](_0x3477cc(0x1e6))[0x0]!=undefined&&document['getElementsByClassName'](_0x3477cc(0x1e6))[0x0][_0x3477cc(0x1fc)]();});
16,880
16,880
0.779325
3144e223dcd71e3c480a178a78a6c5b89b8b55cb
969
js
JavaScript
wblog-manage/src/api/login.js
fallingsoulm/wblog
809abde330981656f89f4ea5e8c35401214c3b07
[ "Apache-2.0" ]
null
null
null
wblog-manage/src/api/login.js
fallingsoulm/wblog
809abde330981656f89f4ea5e8c35401214c3b07
[ "Apache-2.0" ]
null
null
null
wblog-manage/src/api/login.js
fallingsoulm/wblog
809abde330981656f89f4ea5e8c35401214c3b07
[ "Apache-2.0" ]
1
2021-05-05T01:31:40.000Z
2021-05-05T01:31:40.000Z
import request from '@/utils/request' const client_id = 'c1' const client_secret = 'secret' const scope = 'all' // 登录方法 export function login(username, password, code, uuid) { const grant_type = 'password' return request({ url: '/uaa/oauth/token', method: 'post', params: { username, password, code, uuid, client_id, client_secret, grant_type, scope } }) } // 刷新方法 export function refreshToken(refresh_token) { const grant_type = 'refresh_token' return request({ url: '/uaa/oauth/token', method: 'post', params: { client_id, client_secret, grant_type, scope, refresh_token } }) } // 获取用户详细信息 export function getInfo() { return request({ url: '/uaa/system/user/getInfo', method: 'get' }) } // 退出方法 export function logout() { return request({ url: '/uaa/token/logout', method: 'delete' }) } // 获取验证码 export function getCodeImg() { return request({ url: '/uaa/captchaImage', method: 'get' }) }
19.38
91
0.653251
314621d5a8e0839f01c936f3ae53e276371fe702
1,234
js
JavaScript
project/js/db/E9258B877DF77EEA71CDBFDC0691524A34D30F2F.js
zzqqqzzz/WebNES
5b31fb44b3b6323cf4fe300a7050095f232de1ac
[ "MIT" ]
75
2015-01-12T23:30:35.000Z
2021-12-11T04:25:53.000Z
project/js/db/E9258B877DF77EEA71CDBFDC0691524A34D30F2F.js
zzqqqzzz/WebNES
5b31fb44b3b6323cf4fe300a7050095f232de1ac
[ "MIT" ]
3
2018-11-13T13:18:00.000Z
2021-04-22T14:59:53.000Z
project/js/db/E9258B877DF77EEA71CDBFDC0691524A34D30F2F.js
zzqqqzzz/WebNES
5b31fb44b3b6323cf4fe300a7050095f232de1ac
[ "MIT" ]
38
2016-02-24T22:21:01.000Z
2022-01-25T12:44:04.000Z
this.NesDb = this.NesDb || {}; NesDb[ 'E9258B877DF77EEA71CDBFDC0691524A34D30F2F' ] = { "$": { "name": "Tecmo Cup: Football Game", "class": "Licensed", "catalog": "NES-TP-SCN", "publisher": "Tecmo", "developer": "Tecmo", "region": "Scandinavia", "players": "1", "date": "1992-09-24" }, "cartridge": [ { "$": { "system": "NES-PAL-B", "crc": "60925D08", "sha1": "E9258B877DF77EEA71CDBFDC0691524A34D30F2F", "dump": "ok", "dumper": "Kinopio", "datedumped": "2007-07-29" }, "board": [ { "$": { "type": "NES-SLROM", "pcb": "NES-SLROM-06", "mapper": "1" }, "prg": [ { "$": { "name": "PAL-TP-0 PRG", "size": "128k", "crc": "4C392CB7", "sha1": "8A223C9EAFBA85BA8041A5D40E65EAC24BB9C9F2" } } ], "chr": [ { "$": { "name": "PAL-TP-0 CHR", "size": "128k", "crc": "5A722BF7", "sha1": "150894F22871465646297395610CA0326F62614F" } } ], "chip": [ { "$": { "type": "MMC1B2" } } ], "cic": [ { "$": { "type": "3195A" } } ] } ] } ] };
17.628571
58
0.417342
314759932af5c2082956c791f5b75f8cfd4647df
2,040
js
JavaScript
codegen_plugin/src/main/resources/projectLayout/ngPro/karma.conf.js
werpu/tinydecscodegen
bfe0261f59b8297641e6b68e7993db8cca717b80
[ "MIT" ]
3
2018-10-13T19:45:15.000Z
2019-06-13T06:40:54.000Z
codegen_plugin/src/main/resources/projectLayout/ngPro/karma.conf.js
werpu/tinydecscodegen
bfe0261f59b8297641e6b68e7993db8cca717b80
[ "MIT" ]
64
2017-10-05T07:57:34.000Z
2019-09-25T16:29:28.000Z
codegen_plugin/src/main/resources/projectLayout/ngPro/karma.conf.js
werpu/tinydecscodegen
bfe0261f59b8297641e6b68e7993db8cca717b80
[ "MIT" ]
null
null
null
/* * * * Copyright 2019 Werner Punz * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the Software * is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ // Karma configuration file, see link for more information // https://karma-runner.github.io/1.0/config/configuration-file.html module.exports = function (config) { config.set({ basePath: '', frameworks: ['jasmine', '@angular/cli'], plugins: [ require('karma-jasmine'), require('karma-chrome-launcher'), require('karma-jasmine-html-reporter'), require('karma-coverage-istanbul-reporter'), require('@angular/cli/plugins/karma') ], client:{ clearContext: false // leave Jasmine Spec Runner output visible in browser }, coverageIstanbulReporter: { reports: [ 'html', 'lcovonly' ], fixWebpackSourcePaths: true }, angularCli: { environment: 'dev' }, reporters: ['progress', 'kjhtml'], port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: true, browsers: ['Chrome'], singleRun: false }); };
35.172414
86
0.701471
314813f38569943a6e804ab9851e145a4abc87f5
2,013
js
JavaScript
target/jira/webapp/includes/jira/dialog/LinkIssueDialog-tests.js
PramodhMDT/ATPluginAll
db3c6574da623e9148ef770f163d6d15a9243137
[ "Apache-2.0" ]
null
null
null
target/jira/webapp/includes/jira/dialog/LinkIssueDialog-tests.js
PramodhMDT/ATPluginAll
db3c6574da623e9148ef770f163d6d15a9243137
[ "Apache-2.0" ]
null
null
null
target/jira/webapp/includes/jira/dialog/LinkIssueDialog-tests.js
PramodhMDT/ATPluginAll
db3c6574da623e9148ef770f163d6d15a9243137
[ "Apache-2.0" ]
1
2021-08-06T21:26:46.000Z
2021-08-06T21:26:46.000Z
AJS.test.require(["jira.webresources:jira-global", "com.atlassian.auiplugin:dialog2"], function () { 'use strict'; var jQuery = require('jquery'); var analytics = require('jira/analytics'); module("Link issue dialog web-resources tests", { setup: function setup() { this.wrmRequire = sinon.stub(); this.analytics = jQuery.extend({}, analytics); this.stubbedSendMethod = sinon.stub(this.analytics, 'send'); this.stubbedDialog2Method = sinon.spy(AJS, 'dialog2'); this.context = AJS.test.mockableModuleContext(); this.context.mock('wrm/require', this.wrmRequire); this.context.mock('jira/analytics', this.analytics); this.linkIssueFactory = this.context.require('jira/dialog/link-issue-dialog-factory'); this.wrcName = this.linkIssueFactory.webResourcesContextName(); this.linkDialog = this.linkIssueFactory.createLinkIssueDialog("link-issue"); }, teardown: function teardown() { this.linkDialog.hide(); jQuery('#link-issue-error-dialog').remove(); sinon.restore(this.stubbedDialog2Method); } }); test("Warning is not displayed when web-resources load successfully", function () { this.wrmRequire.withArgs('wrc!' + this.wrcName).returns(new jQuery.Deferred().resolve().promise()); this.linkDialog.show(); ok(this.stubbedSendMethod.notCalled, "analytics event was not sent"); ok(this.stubbedDialog2Method.notCalled, "warning message was not displayed"); }); test("Warning is displayed at loading web-resources failure", function () { this.wrmRequire.withArgs('wrc!' + this.wrcName).returns(new jQuery.Deferred().reject('WRM error').promise()); this.linkDialog.show(); ok(this.stubbedSendMethod.calledOnce, "analytics event was sent"); ok(this.stubbedDialog2Method.calledOnce, "warning message was displayed"); }); });
41.9375
117
0.649776
3148598db1b9756a62a86f3a4899e9c4915b03a4
901
js
JavaScript
T176/functions/index.js
DevelopAppWithMe/Hackathon_5.0
6af503a995721c04986931d6a29d8f946ceaa067
[ "MIT" ]
null
null
null
T176/functions/index.js
DevelopAppWithMe/Hackathon_5.0
6af503a995721c04986931d6a29d8f946ceaa067
[ "MIT" ]
null
null
null
T176/functions/index.js
DevelopAppWithMe/Hackathon_5.0
6af503a995721c04986931d6a29d8f946ceaa067
[ "MIT" ]
null
null
null
const functions = require('firebase-functions') const express = require('express'); const cors = require('cors'); const stripe = require('stripe')('sk_test_51HlsqsEJTBWipWhAVUiUirnSL62OcCqK9eQDdBoa9buXlSaM5lYNmGdMlnXsY5eSuX1tc1GLNLkHuJO9d6Ty08kz00O00xRgTM'); // App config const app = express(); // Middlewares app.use(cors({ origin: true })); app.use(express.json()); // API Routes app.get('/', (req, res) => res.status(200).send("Hello")); app.post('/payments/create', async (req, res) => { const total = req.query.total; const paymentIntent = await stripe.paymentIntents.create({ amount: total, //subunits currency: "INR" }); res.status(201).send({ clientSecret: paymentIntent.client_secret }) }) // Listen // app.listen(5001) exports.api = functions.https.onRequest(app); // exports.api = app; // http://localhost:5001/agrivend/us-central1/api
25.027778
144
0.691454
31489da9f792da6ff890e49df093b0f25f1bc597
2,242
js
JavaScript
rollup.config.js
alessiofilippucci/admin-dashboard-material-ui
113bbbcca9454aeab71edd7dc5af99b483567769
[ "MIT" ]
null
null
null
rollup.config.js
alessiofilippucci/admin-dashboard-material-ui
113bbbcca9454aeab71edd7dc5af99b483567769
[ "MIT" ]
null
null
null
rollup.config.js
alessiofilippucci/admin-dashboard-material-ui
113bbbcca9454aeab71edd7dc5af99b483567769
[ "MIT" ]
null
null
null
import babel from '@rollup/plugin-babel'; import resolve, { nodeResolve } from '@rollup/plugin-node-resolve'; import commonjs from '@rollup/plugin-commonjs'; import postcss from 'rollup-plugin-postcss'; import filesize from 'rollup-plugin-filesize'; import autoprefixer from 'autoprefixer'; import pkg from './package.json'; const INPUT_FILE_PATH = 'src/index.js'; const OUTPUT_NAME = 'Example'; const extensions = ['.js', '.jsx', '.ts', '.tsx']; const GLOBALS = { react: 'React', 'react-dom': 'ReactDOM', 'prop-types': 'PropTypes', }; const PLUGINS = [ postcss({ extract: true, plugins: [ autoprefixer, ], }), babel({ babelHelpers: 'runtime', exclude: 'node_modules/**', extensions, }), resolve({ browser: true, // <-- suppress node-specific features resolveOnly: [ /^(?!react$)/, /^(?!react-dom$)/, /^(?!prop-types)/, ], extensions: ['.jsx', '.js', '.json'], }), commonjs({ include: /node_modules/ }), nodeResolve(), filesize(), ]; const EXTERNAL = [ 'react', 'react-dom', 'prop-types', 'reselect' ]; // https://github.com/rollup/plugins/tree/master/packages/babel#babelhelpers const CJS_AND_ES_EXTERNALS = EXTERNAL.concat(/@babel\/runtime/); const OUTPUT_DATA = [ // { // file: pkg.browser, // format: 'umd', // }, // { // file: pkg.main, // format: 'cjs', // }, { file: pkg.module, format: 'es', }, ]; const onwarn = warning => { // Skip certain warnings switch (warning.code) { case 'THIS_IS_UNDEFINED': case 'UNUSED_EXTERNAL_IMPORT': case 'CIRCULAR_DEPENDENCY': case 'NAMESPACE_CONFLICT': return; default: // console.warn everything else console.warn(`(!) ${warning.code}`); console.warn("IN:\t", warning.importer); console.warn("SOURCE:\t", warning.source); console.warn("MESSAGE:", warning.message, "\n"); break; } } const config = OUTPUT_DATA.map(({ file, format }) => ({ input: INPUT_FILE_PATH, output: { file, format, name: OUTPUT_NAME, globals: GLOBALS, }, external: ['cjs', 'es'].includes(format) ? CJS_AND_ES_EXTERNALS : EXTERNAL, plugins: PLUGINS, onwarn })); export default config;
21.352381
77
0.609723
3148a4676bae5a0f7bef0c6591a044eea262d2e9
425
js
JavaScript
api/client/index.js
Coffeekraken/remote-stack
d1bcfb27f1424d4e1cbab0ae818b194560956b89
[ "MIT" ]
null
null
null
api/client/index.js
Coffeekraken/remote-stack
d1bcfb27f1424d4e1cbab0ae818b194560956b89
[ "MIT" ]
null
null
null
api/client/index.js
Coffeekraken/remote-stack
d1bcfb27f1424d4e1cbab0ae818b194560956b89
[ "MIT" ]
null
null
null
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _room = require('./room'); var _room2 = _interopRequireDefault(_room); var _client = require('./client'); var _client2 = _interopRequireDefault(_client); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var api = { Client: _client2.default, Room: _room2.default }; exports.default = api;
20.238095
95
0.710588
31493f359d021d69042f088fdee49b89edc3a26b
991
js
JavaScript
server/controllers/init-controllers.js
afscomercial/third_app
1ff252d07a1338f4abde652cbf700e7ed21183f6
[ "MIT" ]
null
null
null
server/controllers/init-controllers.js
afscomercial/third_app
1ff252d07a1338f4abde652cbf700e7ed21183f6
[ "MIT" ]
null
null
null
server/controllers/init-controllers.js
afscomercial/third_app
1ff252d07a1338f4abde652cbf700e7ed21183f6
[ "MIT" ]
null
null
null
import { logsEnum, writeLog } from '../handlers'; import { postRequest } from '../services'; import { environment } from '../config'; const dev = environment.env !== 'production'; var countMap = new Map(); function countLog(name, domain) { if (countMap.has(name)) { let count = countMap.get(name); countMap.set(name, { value: ++count.value }); } else { countMap.set(countMap.set(name, { value: 1, domain: domain })); } writeLog(logsEnum.info, `> ${name} event # : ${countMap.get(name).value} from ${domain}`); } export const status = async (ctx) => { writeLog(logsEnum.info, `> STATUS Alive`); const data = await postRequest('/my/api/path', { data: 'status' }); const response = ctx; ctx.status = 200; ctx.body = { status: 'success', data: data, }; return response; }; export const webhook = (ctx) => { let webhook = ctx.state.webhook; if (dev) { countLog(webhook.topic, webhook.domain); console.log(JSON.stringify(webhook)); } };
26.783784
92
0.631685
3149c03695952a3eddc18b3fcbc3236e76911b15
86
js
JavaScript
src/screens/modules/interest/screens.js
guilhermedecampo/native
30c37462b64d028b7403281f520069564649eba4
[ "MIT" ]
null
null
null
src/screens/modules/interest/screens.js
guilhermedecampo/native
30c37462b64d028b7403281f520069564649eba4
[ "MIT" ]
null
null
null
src/screens/modules/interest/screens.js
guilhermedecampo/native
30c37462b64d028b7403281f520069564649eba4
[ "MIT" ]
null
null
null
export {default as Form} from './Form' export {default as Calendly} from './Calendly'
28.666667
46
0.72093
314a9a3cd4f6c8cfa29a1adceb2367a404483f63
296
js
JavaScript
App.js
Madadata/AgGridWrapper
d080d029da54663719acd3ddf0cd8d07facf3466
[ "MIT" ]
null
null
null
App.js
Madadata/AgGridWrapper
d080d029da54663719acd3ddf0cd8d07facf3466
[ "MIT" ]
null
null
null
App.js
Madadata/AgGridWrapper
d080d029da54663719acd3ddf0cd8d07facf3466
[ "MIT" ]
null
null
null
import React from 'react'; import AgGridWrapper from './src/AgGridWrapper.jsx'; import { columnDefs, rowData } from './src/testdata'; const App = () => ( <div> <AgGridWrapper title="Athletes" columnDefs={columnDefs} data={rowData} /> </div> ); export default App;
18.5
53
0.631757
314b1c5e524feb974625fdc37fbf33c894b2fe97
11,469
js
JavaScript
static/js/chunk-6a350716.b84fc1ad.js
gomessage/gomessage
2ccd660e617ff8b65c019cea13092188ba263026
[ "MIT" ]
2
2022-01-20T06:08:03.000Z
2022-03-16T10:32:25.000Z
static/js/chunk-6a350716.b84fc1ad.js
GoMessage/GoMessage
2ccd660e617ff8b65c019cea13092188ba263026
[ "MIT" ]
null
null
null
static/js/chunk-6a350716.b84fc1ad.js
GoMessage/GoMessage
2ccd660e617ff8b65c019cea13092188ba263026
[ "MIT" ]
null
null
null
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-6a350716","chunk-137cbf81"],{"0b42":function(t,e,a){var n=a("da84"),s=a("e8b5"),o=a("68ee"),l=a("861d"),r=a("b622"),i=r("species"),c=n.Array;t.exports=function(t){var e;return s(t)&&(e=t.constructor,o(e)&&(e===c||s(e.prototype))?e=void 0:l(e)&&(e=e[i],null===e&&(e=void 0))),void 0===e?c:e}},"159b":function(t,e,a){var n=a("da84"),s=a("fdbc"),o=a("785a"),l=a("17c2"),r=a("9112"),i=function(t){if(t&&t.forEach!==l)try{r(t,"forEach",l)}catch(e){t.forEach=l}};for(var c in s)s[c]&&i(n[c]&&n[c].prototype);i(o)},"17c2":function(t,e,a){"use strict";var n=a("b727").forEach,s=a("a640"),o=s("forEach");t.exports=o?[].forEach:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}},"1dde":function(t,e,a){var n=a("d039"),s=a("b622"),o=a("2d00"),l=s("species");t.exports=function(t){return o>=51||!n((function(){var e=[],a=e.constructor={};return a[l]=function(){return{foo:1}},1!==e[t](Boolean).foo}))}},"2b4a":function(t,e,a){},"4c0f":function(t,e,a){},5041:function(t,e,a){},"65f0":function(t,e,a){var n=a("0b42");t.exports=function(t,e){return new(n(t))(0===e?0:e)}},"661b":function(t,e,a){"use strict";a("4c0f")},a434:function(t,e,a){"use strict";var n=a("23e7"),s=a("da84"),o=a("23cb"),l=a("5926"),r=a("07fa"),i=a("7b0b"),c=a("65f0"),u=a("8418"),d=a("1dde"),p=d("splice"),f=s.TypeError,m=Math.max,h=Math.min,g=9007199254740991,v="Maximum allowed length exceeded";n({target:"Array",proto:!0,forced:!p},{splice:function(t,e){var a,n,s,d,p,b,y=i(this),x=r(y),w=o(t,x),_=arguments.length;if(0===_?a=n=0:1===_?(a=0,n=x-w):(a=_-2,n=h(m(l(e),0),x-w)),x+a-n>g)throw f(v);for(s=c(y,n),d=0;d<n;d++)p=w+d,p in y&&u(s,d,y[p]);if(s.length=n,a<n){for(d=w;d<x-n;d++)p=d+n,b=d+a,p in y?y[b]=y[p]:delete y[b];for(d=x;d>x-n+a;d--)delete y[d-1]}else if(a>n)for(d=x-n;d>w;d--)p=d+n-1,b=d+a-1,p in y?y[b]=y[p]:delete y[b];for(d=0;d<a;d++)y[d+w]=arguments[d+2];return y.length=x-n+a,s}})},a640:function(t,e,a){"use strict";var n=a("d039");t.exports=function(t,e){var a=[][t];return!!a&&n((function(){a.call(null,e||function(){throw 1},1)}))}},b01b:function(t,e,a){"use strict";a.r(e);var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("el-row",{staticStyle:{margin:"20px 0"},attrs:{gutter:20}},[a("el-col",{attrs:{span:8}},[a("DataFormat",{staticClass:"shadow"})],1),a("el-col",{attrs:{span:8}},[a("DataMap",{staticClass:"shadow"})],1),a("el-col",{attrs:{span:8}},[a("CTemplate",{staticClass:"shadow"})],1)],1)},s=[],o=a("f1f3"),l=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("el-card",{attrs:{shadow:"always"}},[a("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[a("span",{staticStyle:{"padding-left":"50px"}},[t._v("用户变量")]),a("el-button",{staticStyle:{float:"right",padding:"3px 0"},attrs:{type:"text"},on:{click:t.post_data}},[t._v("保存变量")])],1),a("el-table",{staticStyle:{width:"100%"},attrs:{data:t.configList,border:"true"}},[a("el-table-column",{attrs:{prop:"key",label:"Key(自定义变量名)"}}),a("el-table-column",{attrs:{prop:"value",label:"Value(原始数据中的索引)"}}),a("el-table-column",{attrs:{fixed:"right",label:"操作",width:"100"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"text",size:"small"},nativeOn:{click:function(a){return a.preventDefault(),t.deleteRow(e.$index,t.configList)}}},[t._v("移除")])]}}])})],1),a("br"),t._l(t.mapList2,(function(e,n){return a("div",{key:n},[a("el-row",{attrs:{gutter:20}},[a("el-col",{attrs:{span:12}},[a("div",{staticClass:"DataMapGridContent"},[a("el-input",{attrs:{placeholder:"纯字符串,不能有符号"},model:{value:e.mapKey,callback:function(a){t.$set(e,"mapKey",a)},expression:"list.mapKey"}},[a("template",{slot:"prepend"},[t._v(" Key: ")])],2)],1)]),a("el-col",{attrs:{span:12}},[a("div",{staticClass:"DataMapGridContent"},[a("el-input",{attrs:{placeholder:"Json索引路径"},model:{value:e.mapValue,callback:function(a){t.$set(e,"mapValue",a)},expression:"list.mapValue"}},[a("template",{slot:"prepend"},[t._v(" Value: ")])],2)],1)])],1)],1)})),a("br"),a("el-button",{attrs:{type:"primary",size:"mini"},on:{click:t.addTableData}},[t._v("新增变量")])],2)},r=[],i=(a("a434"),a("ac1f"),a("1276"),a("d3b7"),a("159b"),{name:"cConfigMap",data:function(){return{mapList2:[{mapKey:"",mapValue:""}],configList:[{key:"{{ .N1 }} ",value:"alerts.#.labels.alertname"},{key:"{{ .N2 }}",value:"alerts.#.labels.severity"},{key:"{{ .N3 }}",value:"alerts.#.labels.hostname"},{key:"{{ .N4 }}",value:"alerts.#.labels.ping"},{key:"{{ .N5 }}",value:"alerts.#.annotations.description"},{key:"{{ .N6 }}",value:"status"},{key:"{{ .N7 }}",value:"alerts.#.startsAt"},{key:"{{ .N8 }}",value:"alerts.#.endsAt"}]}},computed:{},methods:{addTableData:function(){var t=this.mapList2[0].mapKey,e=this.mapList2[0].mapValue;if(0===t.length||0===e.length)this.$message.error("输入框不能为空...");else{var a={key:"{{ ."+t+" }}",value:e};this.configList.push(a),this.mapList2[0].mapKey="",this.mapList2[0].mapValue="",this.$message.success("添加成功...")}},deleteRow:function(t,e){e.splice(t,1)},post_data:function(){for(var t=this,e=[],a=0;a<this.configList.length;a++){var n=this.configList[a].key,s=n.split(" ")[1].split(".")[1],o=this.configList[a].value,l={};l[s]=o,e.push(l)}this.axios.post("/v1/web/map",{key_value_list:e}).then((function(e){console.log(e.data),t.$message.success("数据库更新成功...")})).catch((function(t){console.log(t)}))},pullMapData:function(){var t=this;this.axios.get("/v1/web/map").then((function(e){var a=[];0===e.data.length?console.log("数据库里没有数据"):(e.data.forEach((function(t){var e={key:"{{ ."+t["Key"]+" }}",value:t["Value"]};a.push(e)})),t.configList=a)})).catch((function(t){console.log(t)}))}},created:function(){this.pullMapData()}}),c=i,u=(a("d4d2"),a("2877")),d=Object(u["a"])(c,l,r,!1,null,"1410ac12",null),p=d.exports,f=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("el-card",{attrs:{shadow:"always"}},[a("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[a("el-switch",{staticStyle:{float:"left",padding:"3px 0"},attrs:{"inactive-text":"聚合发送"},model:{value:t.template.message_merge,callback:function(e){t.$set(t.template,"message_merge",e)},expression:"template.message_merge"}}),a("span",[t._v("消息模板")]),a("el-button",{staticStyle:{float:"right",padding:"3px 0"},attrs:{type:"text"},on:{click:function(e){return t.pushTemplateData()}}},[t._v("保存模板")])],1),a("div",[a("el-input",{attrs:{type:"textarea",autosize:{minRows:10,maxRows:200},placeholder:"请输入Golang语法的模板内容",resize:"none"},model:{value:t.template.message_template,callback:function(e){t.$set(t.template,"message_template",e)},expression:"template.message_template"}})],1)])},m=[],h={name:"cTemplate",data:function(){return{template:{message_merge:!1,message_template:"{{ if eq .N6 \"firing\" }}\n\n## <font color='#FF0000'>【报警中】服务器{{ .N3 }}</font>\n\n{{ else if eq .N6 \"resolved\" }}\n\n## <font color='#20B2AA'>【已恢复】服务器{{ .N3 }}</font>\n\n{{ else }}\n\n## 标题:信息通知\n\n{{ end }}\n\n========================\n\n**告警规则**:{{ .N1 }}\n\n**告警级别**:{{ .N2 }}\n\n**主机名称**:{{ .N3 }} \n\n**主机地址**:{{ .N4 }}\n\n**告警详情**:{{ .N5 }}\n\n**告警状态**:{{ .N6 }}\n\n**触发时间**:{{ .N7 }}\n\n**发送时间**:{{ .N8 }}\n\n**规则详情**:[Prometheus控制台](https://www.baidu.com)\n\n**报警详情**:[Alertmanager控制台](https://www.baidu.com)\n"}}},components:{},methods:{pushTemplateData:function(){var t=this;this.axios.post("/v1/web/template",{request_data:this.template}).then((function(e){console.log(e.data),t.$message.success("数据库更新成功...")})).catch((function(t){console.log(t)}))},pullTemplateData:function(){var t=this;this.axios.get("/v1/web/template").then((function(e){console.log("========"+e.data["message_template"]),void 0===e.data["message_template"]||null===e.data["message_template"]||""===e.data["message_template"]?console.log("数据库里没有数据"):(t.template.message_template=e.data["message_template"],t.template.message_merge=e.data["message_merge"],console.log(e.data))})).catch((function(t){console.log(t)}))}},created:function(){this.$store.commit("updateStepsActive",2),this.pullTemplateData()}},g=h,v=(a("e622"),Object(u["a"])(g,f,m,!1,null,"7e77267c",null)),b=v.exports,y={name:"ViewRequestData",components:{DataFormat:o["default"],DataMap:p,CTemplate:b},created:function(){this.$store.commit("updateStepsActive",1)}},x=y,w=(a("661b"),Object(u["a"])(x,n,s,!1,null,"395dd6f8",null));e["default"]=w.exports},b727:function(t,e,a){var n=a("0366"),s=a("e330"),o=a("44ad"),l=a("7b0b"),r=a("07fa"),i=a("65f0"),c=s([].push),u=function(t){var e=1==t,a=2==t,s=3==t,u=4==t,d=6==t,p=7==t,f=5==t||d;return function(m,h,g,v){for(var b,y,x=l(m),w=o(x),_=n(h,g),k=r(w),C=0,D=v||i,N=e?D(m,k):a||p?D(m,0):void 0;k>C;C++)if((f||C in w)&&(b=w[C],y=_(b,C,x),t))if(e)N[C]=y;else if(y)switch(t){case 3:return!0;case 5:return b;case 6:return C;case 2:c(N,b)}else switch(t){case 4:return!1;case 7:c(N,b)}return d?-1:s||u?u:N}};t.exports={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6),filterReject:u(7)}},c9ba:function(t,e,a){"use strict";a("2b4a")},d4d2:function(t,e,a){"use strict";a("5041")},e4a4:function(t,e,a){},e622:function(t,e,a){"use strict";a("e4a4")},e8b5:function(t,e,a){var n=a("c6b6");t.exports=Array.isArray||function(t){return"Array"==n(t)}},e9c4:function(t,e,a){var n=a("23e7"),s=a("da84"),o=a("d066"),l=a("2ba4"),r=a("e330"),i=a("d039"),c=s.Array,u=o("JSON","stringify"),d=r(/./.exec),p=r("".charAt),f=r("".charCodeAt),m=r("".replace),h=r(1..toString),g=/[\uD800-\uDFFF]/g,v=/^[\uD800-\uDBFF]$/,b=/^[\uDC00-\uDFFF]$/,y=function(t,e,a){var n=p(a,e-1),s=p(a,e+1);return d(v,t)&&!d(b,s)||d(b,t)&&!d(v,n)?"\\u"+h(f(t,0),16):t},x=i((function(){return'"\\udf06\\ud834"'!==u("\udf06\ud834")||'"\\udead"'!==u("\udead")}));u&&n({target:"JSON",stat:!0,forced:x},{stringify:function(t,e,a){for(var n=0,s=arguments.length,o=c(s);n<s;n++)o[n]=arguments[n];var r=l(u,null,o);return"string"==typeof r?m(r,g,y):r}})},f1f3:function(t,e,a){"use strict";a.r(e);var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("el-card",{attrs:{shadow:"always"}},[a("div",{attrs:{slot:"header"},slot:"header"},[a("span",{staticStyle:{"padding-left":"100px"}},[t._v("过境数据")]),a("el-button",{staticStyle:{float:"right",padding:"3px 0","margin-left":"10px"},attrs:{type:"text"},on:{click:function(e){return t.getServerData()}}},[t._v("劫持数据")]),a("el-button",{staticStyle:{float:"right",padding:"3px 0"},attrs:{type:"text"},on:{click:function(e){return t.copyCode()}}},[t._v("一键复制")])],1),a("div",[a("pre",{attrs:{id:"CodeStyle"}},[a("code",{attrs:{id:"CodeContent"}},[t._v(t._s(t.codeJsonContent))])])])])},s=[],o=(a("e9c4"),{name:"cCodeFormat",data:function(){return{codeJsonContent:"点击 <劫持数据> 可以看到推送进GoMessage的原始数据...\n\n每次 <劫持数据> 都可以实时抓取到最新的一条数据...\n\n此处对数据进行了格式化与对齐,您可以把数据 <一键复制> 到其它地方使用...",codeUpdateTime:null,arr2:[]}},methods:{copyCode:function(){var t=document.getElementById("CodeContent");window.getSelection().selectAllChildren(t),document.execCommand("Copy"),this.$message("复制成功...")},getServerData:function(){var t=this;this.axios({url:"/v1/web/json",method:"get"}).then((function(e){console.log(e.data);var a=e["data"]["json_data"],n=e["data"]["update_time"];null===a?t.$message({showClose:!1,message:"没有数据进入GoMessage服务,无法向您展示数据。"}):(t.codeJsonContent=JSON.stringify(a,null,4),t.codeUpdateTime=t.dateFormat(new Date(n)))})).catch((function(t){console.log(t)}))}}}),l=o,r=(a("c9ba"),a("2877")),i=Object(r["a"])(l,n,s,!1,null,"b4c5c54a",null);e["default"]=i.exports}}]); //# sourceMappingURL=chunk-6a350716.b84fc1ad.js.map
5,734.5
11,417
0.64016
314bcddd9d26bd9e4b27c7074ddbff31fb0e837f
308
js
JavaScript
small_solutions/map_the_debris/app.js
Donald-Brown/javascript
4e5daa0f61ae33e6f43bb361e39fe926cea15ac0
[ "MIT" ]
null
null
null
small_solutions/map_the_debris/app.js
Donald-Brown/javascript
4e5daa0f61ae33e6f43bb361e39fe926cea15ac0
[ "MIT" ]
null
null
null
small_solutions/map_the_debris/app.js
Donald-Brown/javascript
4e5daa0f61ae33e6f43bb361e39fe926cea15ac0
[ "MIT" ]
null
null
null
const GM = 398600.4418, earthRadius = 6367.4447; const orbitalPeriod = arr => arr.map(object => ({ name: object.name, orbitalPeriod: Math.round(2 * Math.PI * Math.sqrt(Math.pow(earthRadius + object.avgAlt, 3) / GM)) })); console.log(orbitalPeriod([{name : "sputnik", avgAlt : 35873.5553}]));
38.5
109
0.655844
314bed8d334398b6e8fb11cbc9cb23e96b92af64
793
js
JavaScript
problems/string/logger_rate_limiter_359/index.js
ibabkov/let_it_code
bb94e6037f7641aa86a6cdbd6e7e49cdc65b55f7
[ "MIT" ]
null
null
null
problems/string/logger_rate_limiter_359/index.js
ibabkov/let_it_code
bb94e6037f7641aa86a6cdbd6e7e49cdc65b55f7
[ "MIT" ]
3
2021-03-10T16:21:46.000Z
2021-05-11T12:29:49.000Z
problems/string/logger_rate_limiter_359/index.js
ibabkov/let_it_code
bb94e6037f7641aa86a6cdbd6e7e49cdc65b55f7
[ "MIT" ]
null
null
null
export class Logger { constructor() { this._lastPrint = new Map(); } /** * Returns true if the message should be printed in the given timestamp, otherwise returns false. If this method returns false, the message will not be printed. The timestamp is in seconds granularity. * @param {number} timestamp * @param {string} message * @return {boolean} */ shouldPrintMessage = (timestamp, message) => { if ( !this._lastPrint.has(message) || timestamp - this._lastPrint.get(message) >= 10 ) { this._lastPrint.set(message, timestamp); return true; } return false; } } /** * Your Logger object will be instantiated and called as such: * var obj = new Logger() * var param_1 = obj.shouldPrintMessage(timestamp,message) */
26.433333
99
0.656999
314dac72d0630b41885e37c4acab707590b711be
382
js
JavaScript
node_modules/ganache-core/node_modules/class-is/test/fixtures/es5/Mammal.js
mennat1/simple-yield-farm-truffle-version
343389152c97448a6f1d79f3737bfadb2f819614
[ "MIT" ]
106
2020-02-23T13:33:02.000Z
2022-03-28T18:28:02.000Z
node_modules/ganache-core/node_modules/class-is/test/fixtures/es5/Mammal.js
mennat1/simple-yield-farm-truffle-version
343389152c97448a6f1d79f3737bfadb2f819614
[ "MIT" ]
23
2018-03-23T12:05:47.000Z
2020-06-24T23:00:06.000Z
node_modules/ganache-core/node_modules/class-is/test/fixtures/es5/Mammal.js
mennat1/simple-yield-farm-truffle-version
343389152c97448a6f1d79f3737bfadb2f819614
[ "MIT" ]
24
2020-03-07T05:36:37.000Z
2022-03-23T16:56:48.000Z
'use strict'; const withIs = require('../../..'); const Animal = require('./Animal'); function Mammal() { Animal.call(this, 'mammal'); } Mammal.prototype = Object.create(Animal.prototype); Mammal.prototype.constructor = Mammal; module.exports = withIs.proto(Mammal, { className: 'Mammal', symbolName: '@org/package/Mammal', }); module.exports.WrappedClass = Mammal;
21.222222
51
0.683246
314e95fea2e00d70615b07735bc9202122b8f22c
7,514
js
JavaScript
scripts/rundeck/scripts-slack/rundeckapi.js
akash1233/OnBot_Demo
62f582c6955d32d612a512243082c32282d70e85
[ "Apache-2.0" ]
4
2018-06-26T06:57:24.000Z
2020-12-25T10:05:16.000Z
scripts/rundeck/scripts-slack/rundeckapi.js
akash1233/OnBot_Demo
62f582c6955d32d612a512243082c32282d70e85
[ "Apache-2.0" ]
1
2018-07-30T10:32:10.000Z
2018-09-04T08:38:05.000Z
scripts/rundeck/scripts-slack/rundeckapi.js
akash1233/OnBot_Demo
62f582c6955d32d612a512243082c32282d70e85
[ "Apache-2.0" ]
9
2018-05-04T20:11:38.000Z
2021-09-08T05:33:28.000Z
/******************************************************************************* *Copyright 2018 Cognizant Technology Solutions * * 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. ******************************************************************************/ var request = require("request"); fs = require('fs') function rundeck() {}; rundeck.listproj= function (url, username, password, token, callback) { //api for getting list of projects var rundeck_url = url+"/api/20/projects?format=json" var options = { auth: { 'user': username, 'pass': password }, method: 'get', url: rundeck_url, headers: {'X-Rundeck-Auth-Token':token } }; request(options, function (error, response, body) { var res=JSON.parse(body); if (error) { callback(error,null,null); } if (res.error) { callback(null,null,res.message); } else{ var list='*NO* \t\t\t *NAME* '+"\n"; var num; for(var i=0;i<res.length;i++){ num=i+1; list+=num+'\t\t\t\t'+res[i].name+"\n"; } callback(null,list,null); } }); } rundeck.listjob= function (url, username, password, token, project, callback) { //api for getting list of jobs for provided project var rundeck_url = url+"/api/20/project/"+project+"/jobs?format=json" var options = { auth: { 'user': username, 'pass': password }, method: 'get', url: rundeck_url, headers: {'X-Rundeck-Auth-Token':token } }; request(options, function (error, response, body) { var res=JSON.parse(body); if (error) { callback(error,null,null); } if (res.error) { callback(null,null,res.message); } else{ var list='\t\t\t\t *UUID* \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t *JobName* '+"\n"; if(res.length==0){ callback(null,"no jobs yet",null);} else{ for(var i=0;i<res.length;i++){ list+=res[i].id+"\t\t\t"+ res[i].name+"\n"; } callback(null,list,null); } } }); } rundeck.projconfig= function (url, username, password, token, project, callback) { //api for getting configuration of provided project var rundeck_url = url+"/api/20/project/"+project+"?format=json" var options = { auth: { 'user': username, 'pass': password }, method: 'get', url: rundeck_url, headers: {'X-Rundeck-Auth-Token':token } }; request(options, function (error, response, body) { var res=JSON.parse(body); if (error) { callback(error,null,null); } if (res.error) { callback(null,null,res.message); } else{ var list=res.config; callback(null,list,null); } }); } rundeck.runjob= function (url, username, password, token, jobid, callback) { //api for running job by <jobid> var rundeck_url = url+"/api/20/job/"+jobid+"/run?format=json" var options = { auth: { 'user': username, 'pass': password }, method: 'post', url: rundeck_url, headers: {'X-Rundeck-Auth-Token':token } }; request(options, function (error, response, body) { var res=JSON.parse(body); if (error) { callback(error,null,null); } if (res.error) { callback(null,null,res.message); } else{ var list=res.status+" "+res.id; callback(null,list,null); } }); } rundeck.deleteproj= function (url, username, password, token, project, callback) { //api for deleting a project by <projectname> var rundeck_url = url+"/api/20/project/"+project+"?format=json" var options = { auth: { 'user': username, 'pass': password }, method: 'delete', url: rundeck_url, headers: {'X-Rundeck-Auth-Token':token } }; request(options, function (error, response, body) { if(body==""){ callback(null,"deleted",null); } else{ var res=JSON.parse(body); if (error) { callback(error,null,null); } if (res.error) { callback(null,null,res.message); } else{ var list=res; callback(null,list,null); } } }); } rundeck.deletejob= function (url, username, password, token, jobid, callback) { //api for deleting a job by <jobid> var rundeck_url = url+"/api/20/job/"+jobid+"?format=json" var options = { auth: { 'user': username, 'pass': password }, method: 'delete', url: rundeck_url, headers: {'X-Rundeck-Auth-Token':token } }; request(options, function (error, response, body) { if(body==""){ callback(null,"deleted job",null); } else{ var res=JSON.parse(body); if (error) { callback(error,null,null); } if (res.error) { callback(null,null,res.message); } else{ var list=res; callback(null,list,null); } } }); } rundeck.exechistory= function (url, username, password, token, project, callback) { //api for getting execution history of provided project var rundeck_url = url+"/api/20/project/"+project+"/history?format=json" var options = { auth: { 'user': username, 'pass': password }, method: 'delete', url: rundeck_url, headers: {'X-Rundeck-Auth-Token':token } }; request(options, function (error, response, body) { var res=JSON.parse(body); if (error) { callback(error,null,null); } if (res.error) { callback(null,null,res.message); } else{ var list=""; for(var i=0;i< res.events.length;i++){ list+="execution id: "+res.events[i].execution.id+" "+res.events[i].status+"\n"; } callback(null,list,null); } }); } rundeck.createproject= function (url, username, password, token, filename, callback) { //api for creating a project by <configfile> var file='./'+filename; fs.readFile(file, 'utf8', function (err,data) { if (err) { return console.log(err); } console.log(data); var rundeck_url = url+"/api/20/projects?format=json" var options = { auth: { 'user': username, 'pass': password }, method: 'post', url: rundeck_url, headers: {'X-Rundeck-Auth-Token':token , 'Content-Type':'application/xml'}, body:data}; request(options, function (error, response, body) { console.log(body) var res=JSON.parse(body); if (error) { callback(error,null,null); } if (res.error) { callback(null,null,res.message); } else{ var list=res.name+" created"; callback(null,list,null); } }); }); } rundeck.checkstatus=function (url, username, password, token, execid, callback) { //api for checking status of running job var rundeck_url = url+"/api/20/execution/"+execid+"?format=json" var options = { auth: { 'user': username, 'pass': password }, method: 'get', url: rundeck_url, headers: {'X-Rundeck-Auth-Token':token } }; request(options, function (error, response, body) { var res=JSON.parse(body); if (error) { callback(error,null,null); } if (res.error) { callback(null,null,res.message); } else{ var list=res.status+" "+res.id; callback(null,list,null); } }); } module.exports = rundeck
17.194508
87
0.600346
d3cbfd9ba1ec0ca29e38589042bf2a55e09117e1
13,432
js
JavaScript
spec/pkg-groups-view-spec.js
alflanagan/atom-pkg-groups
e8e65f1e510e6669918491b38407b934232a88d9
[ "MIT" ]
null
null
null
spec/pkg-groups-view-spec.js
alflanagan/atom-pkg-groups
e8e65f1e510e6669918491b38407b934232a88d9
[ "MIT" ]
null
null
null
spec/pkg-groups-view-spec.js
alflanagan/atom-pkg-groups
e8e65f1e510e6669918491b38407b934232a88d9
[ "MIT" ]
null
null
null
/** @babel */ /** @jsx etch.dom */ import etch from 'etch' import log4js from 'log4js' import DomDiff from '../lib/pkg-groups-dom-diff' // eslint-disable-line no-unused-vars import PkgSelectList from '../lib/pkg-select-list-component' import PkgPickList from '../lib/pkg-pick-list-component' import PkgTristateList from '../lib/pkg-tristate-list-component' import PkgGroupsView from '../lib/pkg-groups-view' import PkgGroupsModel from '../lib/pkg-groups-model' import PkgGroupsGroup from '../lib/pkg-groups-group' import PkgGroupsMeta from '../lib/pkg-groups-meta' const logger = log4js.getLogger('pkg-groups-view-spec') logger.level = 'debug' describe('PkgGroupsView', () => { describe('constructor', () => { it('sets properties correctly', () => { const tavailable = ['package1', 'package2', 'package3'] const tselected = ['package4', 'package5'] const tgroups = ['Tar Heels', 'Wolfpack', 'Wildcats'] const groups = [] for (const grp of tgroups) { groups.push(new PkgGroupsGroup({name: grp, type: 'group', packages: tselected})) } const tmetas = {baseball: 'enabled', basketball: 'disabled'} const metas = [] for (const name in tmetas) { metas.push(new PkgGroupsMeta({name})) } const model = new PkgGroupsModel({groups, metas}) const pkgView = new PkgGroupsView({ model: model }) expect(pkgView.props.available).toEqual(tavailable) expect(pkgView.props.selected).toEqual(tselected) expect(pkgView.props.groups).toEqual(tgroups) expect(pkgView.props.metas).toEqual(tmetas) }) }) describe('render', () => { it('renders a blank view', () => { const view = new PkgGroupsView() const dom = view.render() const expected = <div className='pkg-groups'> <atom-panel id='group-select-panel'> <div id='pkg-groups-upper-panel' className='inset-panel padded'> <h1>Set Up Package Groups</h1> <PkgSelectList id='groups-select-list' items={view.props.groups} on={{change: view._didSelectGroup}} /> <button id='groups-add-group' name='add-group' type='button' ><i class='fa fa-plus-circle' aria-hidden='true' /></button> <button id='groups-delete-group' name='delete-group' type='button' ><i class='fa fa-minus-circle' aria-hidden='true' /></button> <PkgPickList leftList={view.props.available} rightList={view.props.selected} id='pkg-groups-group-pick' leftLabel='Packages Available' rightLabel='Packages In Group' on={{change: view._didChange}} /> <p className='group-select-hint'>Click Package Name to Select/Deselect</p> </div> <div id='pkg-groups-lower-panel' className='inset-panel padded'> <div id='defined-metas-panel'> <h1>Set Up Configurations</h1> <div id='meta-select-list'> <PkgSelectList items={view.props.metas} on={{change: view._didSelectMeta}} /> <button id='meta-add-meta' name='add-meta' type='button' ><i class='fa fa-plus-circle' aria-hidden='true' /></button> <button id='meta-delete-meta' name='delete-meta' type='button' ><i class='fa fa-minus-circle' aria-hidden='true' /></button> </div> </div> <div id='specify-metas-panel'> <h2>Activate / Deactivate Groups</h2> <div className='sub-section group-selection'> <PkgTristateList items={view.props.metas} on={{change: view._didChangeMeta}} /> </div> </div> </div> </atom-panel> </div> expect(dom).toEqual(expected) const diff = new DomDiff(dom, expected) if (!diff.noDifferences()) { logger.warn(diff.toString()) } expect(diff.noDifferences()).toBe(true) logger.debug(view.getElement()) }) it('renders properties as expected', () => { const tavailable = ['package1', 'package2', 'package3'] const tselected = ['package4', 'package5'] const tgroups = ['Tar Heels', 'Wolfpack', 'Wildcats'] const tmetas = {'baseball': 'disabled', 'basketball': 'enabled'} const pkgView = new PkgGroupsView({ available: tavailable, selected: tselected, groups: tgroups, metas: tmetas }) const actual = pkgView.render() const expected = <div className='pkg-groups'> <atom-panel id='group-select-panel'> <div id='pkg-groups-upper-panel' className='inset-panel padded'> <h1>Set Up Package Groups</h1> <PkgSelectList id='groups-select-list' items={tgroups} on={{change: pkgView._didSelectGroup}} /> <button id='groups-add-group' name='add-group' type='button' ><i class='fa fa-plus-circle' aria-hidden='true' /></button> <button id='groups-delete-group' name='delete-group' type='button' ><i class='fa fa-minus-circle' aria-hidden='true' /></button> <PkgPickList leftList={tavailable} rightList={tselected} id='pkg-groups-group-pick' leftLabel='Packages Available' rightLabel='Packages In Group' on={{change: pkgView._didChange}} /> <p className='group-select-hint'>Click Package Name to Select/Deselect</p> </div> <div id='pkg-groups-lower-panel' className='inset-panel padded'> <div id='defined-metas-panel'> <h1>Set Up Configurations</h1> <div id='meta-select-list'> <PkgSelectList items={tmetas} on={{change: pkgView._didSelectMeta}} /> <button id='meta-add-meta' name='add-meta' type='button' ><i class='fa fa-plus-circle' aria-hidden='true' /></button> <button id='meta-delete-meta' name='delete-meta' type='button' ><i class='fa fa-minus-circle' aria-hidden='true' /></button> </div> </div> <div id='specify-metas-panel'> <h2>Activate / Deactivate Groups</h2> <div className='sub-section group-selection'> <PkgTristateList items={tmetas} on={{change: pkgView._didChangeMeta}} /> </div> </div> </div> </atom-panel> </div> const diff = new DomDiff(actual, expected) if (!diff.noDifferences()) { logger.warn(diff.toString()) } expect(actual).toEqual(expected) }) }) describe('event handling', () => { it('responds to clicks in group select', () => { const mySpy = jasmine.createSpy((item, index) => {}) const tavailable = ['package1', 'package2', 'package3'] const tselected = ['package4', 'package5'] const tgroups = ['Tar Heels', 'Wolfpack', 'Wildcats'] const tmetas = {'baseball': 'disabled', 'basketball': 'enabled'} const pkgView = new PkgGroupsView({ available: tavailable, selected: tselected, groups: tgroups, metas: tmetas, on: {select: mySpy} }) const parent = document.createElement('div') parent.appendChild(etch.render(pkgView)) logger.debug(pkgView.element.querySelector('#groups-select-list')) const groupElem = pkgView.element.querySelector('#groups-select-list>ol').children[1] expect(groupElem).toBeInstanceOf(global.HTMLLIElement) expect(groupElem.innerText).toEqual('Wolfpack') const index = global.parseInt(groupElem.attributes.item(0).value) groupElem.click() // this should select a group and display its packages. Since we don't have a model, // the only thing that happens is the callback is called const actual = pkgView.render() const expected = <div className='pkg-groups'> <atom-panel id='group-select-panel'> <div id='pkg-groups-upper-panel' className='inset-panel padded'> <h1>Set Up Package Groups</h1> <PkgSelectList id='groups-select-list' items={tgroups} on={{change: pkgView._didSelectGroup}} /> <button id='groups-add-group' name='add-group' type='button' ><i class='fa fa-plus-circle' aria-hidden='true' /></button> <button id='groups-delete-group' name='delete-group' type='button' ><i class='fa fa-minus-circle' aria-hidden='true' /></button> <PkgPickList leftList={tavailable} rightList={tselected} id='pkg-groups-group-pick' leftLabel='Packages Available' rightLabel='Packages In Group' on={{change: pkgView._didChange}} /> <p className='group-select-hint'>Click Package Name to Select/Deselect</p> </div> <div id='pkg-groups-lower-panel' className='inset-panel padded'> <div id='defined-metas-panel'> <h1>Set Up Configurations</h1> <div id='meta-select-list'> <PkgSelectList items={tmetas} on={{change: pkgView._didSelectMeta}} /> <button id='meta-add-meta' name='add-meta' type='button' ><i class='fa fa-plus-circle' aria-hidden='true' /></button> <button id='meta-delete-meta' name='delete-meta' type='button' ><i class='fa fa-minus-circle' aria-hidden='true' /></button> </div> </div> <div id='specify-metas-panel'> <h2>Activate / Deactivate Groups</h2> <div className='sub-section group-selection'> <PkgTristateList items={tmetas} on={{change: pkgView._didChangeMeta}} /> </div> </div> </div> </atom-panel> </div> const diff = new DomDiff(actual, expected) if (!diff.noDifferences()) { logger.warn(diff.toString()) } expect(actual).toEqual(expected) expect(mySpy).toHaveBeenCalled() expect(mySpy.calls[0].args).toEqual([groupElem.innerText, index]) }) it('responds to clicks on available list', () => { logger.debug('test click on package start') const mySpy = jasmine.createSpy((item, index) => {}) const tavailable = ['package1', 'package2', 'package3'] const tselected = ['package4', 'package5'] const tgroups = ['Tar Heels', 'Wolfpack', 'Wildcats'] const tmetas = {'baseball': 'disabled', 'basketball': 'enabled'} const pkgView = new PkgGroupsView({ available: tavailable, selected: tselected, groups: tgroups, metas: tmetas, on: {change: mySpy} }) const parent = document.createElement('div') parent.appendChild(etch.render(pkgView)) logger.debug(pkgView.element.querySelector('#pkg-groups-group-pick')) const pkg2Elem = pkgView.element.querySelector('#pkg-groups-group-pick .pick-list-left-list .pkg-select-list>ol').children[1] expect(pkg2Elem).toBeInstanceOf(global.HTMLLIElement) expect(pkg2Elem.innerText).toEqual('package2') const index = global.parseInt(pkg2Elem.attributes.item(0).value) pkg2Elem.click() logger.debug('after click()') expect(pkgView.props.available).toEqual(['package1', 'package3']) const actual = pkgView.render() logger.debug('after render()') const expected = <div className='pkg-groups'> <atom-panel id='group-select-panel'> <div id='pkg-groups-upper-panel' className='inset-panel padded'> <h1>Set Up Package Groups</h1> <PkgSelectList id='groups-select-list' items={tgroups} on={{change: pkgView._didSelectGroup}} /> <button id='groups-add-group' name='add-group' type='button' ><i class='fa fa-plus-circle' aria-hidden='true' /></button> <button id='groups-delete-group' name='delete-group' type='button' ><i class='fa fa-minus-circle' aria-hidden='true' /></button> <PkgPickList leftList={tavailable} rightList={tselected} id='pkg-groups-group-pick' leftLabel='Packages Available' rightLabel='Packages In Group' on={{change: pkgView._didChange}} /> <p className='group-select-hint'>Click Package Name to Select/Deselect</p> </div> <div id='pkg-groups-lower-panel' className='inset-panel padded'> <div id='defined-metas-panel'> <h1>Set Up Configurations</h1> <div id='meta-select-list'> <PkgSelectList items={tmetas} on={{change: pkgView._didSelectMeta}} /> <button id='meta-add-meta' name='add-meta' type='button' ><i class='fa fa-plus-circle' aria-hidden='true' /></button> <button id='meta-delete-meta' name='delete-meta' type='button' ><i class='fa fa-minus-circle' aria-hidden='true' /></button> </div> </div> <div id='specify-metas-panel'> <h2>Activate / Deactivate Groups</h2> <div className='sub-section group-selection'> <PkgTristateList items={tmetas} on={{change: pkgView._didChangeMeta}} /> </div> </div> </div> </atom-panel> </div> logger.debug('created expected') const diff = new DomDiff(actual, expected) if (!diff.noDifferences()) { logger.warn(diff.toString()) } expect(actual).toEqual(expected) expect(mySpy).toHaveBeenCalled() logger.debug('after toHaveBeenCalled()') if (mySpy.calls[0].args) { expect(mySpy.calls[0].args).toEqual([pkg2Elem.innerText, index]) } logger.debug('test click on package end') }) }) })
49.933086
140
0.609663
d3cde3332aa3c2a464fa9aa94055ef333ddb4fd8
190
js
JavaScript
docs/src/index.js
vinioo/blip-toolkit
a51d9661add3a52c5991963fd6ebb7328a1a6234
[ "MIT" ]
5
2018-06-06T00:33:19.000Z
2021-07-28T17:28:33.000Z
docs/src/index.js
vinioo/blip-toolkit
a51d9661add3a52c5991963fd6ebb7328a1a6234
[ "MIT" ]
140
2018-05-29T21:55:02.000Z
2021-08-19T15:15:30.000Z
docs/src/index.js
vinioo/blip-toolkit
a51d9661add3a52c5991963fd6ebb7328a1a6234
[ "MIT" ]
9
2018-08-16T20:04:04.000Z
2021-07-01T14:01:37.000Z
const stylemark = require('stylemark') const input = './docs/src/pages' const output = './docs/website' const configPath = './build/stylemark.yml' stylemark({ input, output, configPath })
23.75
42
0.715789
d3ce5344299b3942670042a13733db97664500a9
393
js
JavaScript
src/components/NavBar.js
krishl/sk-client
0efda5637d3745129fdaa6bfc76e88871607f1ee
[ "MIT" ]
1
2019-03-26T23:33:07.000Z
2019-03-26T23:33:07.000Z
src/components/NavBar.js
krishl/sk-client
0efda5637d3745129fdaa6bfc76e88871607f1ee
[ "MIT" ]
null
null
null
src/components/NavBar.js
krishl/sk-client
0efda5637d3745129fdaa6bfc76e88871607f1ee
[ "MIT" ]
null
null
null
import React from 'react'; import { NavLink } from 'react-router-dom'; const NavBar = props => { return ( <div className="links"> <NavLink exact to="/" activeClassName="active">Home</NavLink> <NavLink to="/products" activeClassName="active">Products</NavLink> <NavLink to="/compare" activeClassName="active">Compare</NavLink> </div> ); } export default NavBar;
28.071429
73
0.666667
d3cf12bfea9a9ba77a96552ad1bd9ae9c5a04cb5
1,437
js
JavaScript
node_modules/@vkontakte/icons/dist/es6/28/list_add_outline.js
Wokkta/Hackatont_vk
e033f0f9af3513b1df2e6ea810d555f1e1e0b8a9
[ "MIT" ]
null
null
null
node_modules/@vkontakte/icons/dist/es6/28/list_add_outline.js
Wokkta/Hackatont_vk
e033f0f9af3513b1df2e6ea810d555f1e1e0b8a9
[ "MIT" ]
null
null
null
node_modules/@vkontakte/icons/dist/es6/28/list_add_outline.js
Wokkta/Hackatont_vk
e033f0f9af3513b1df2e6ea810d555f1e1e0b8a9
[ "MIT" ]
null
null
null
import React from 'react'; // @ts-ignore import BrowserSymbol from 'svg-baker-runtime/browser-symbol'; // @ts-ignore import { assign } from 'es6-object-assign'; import { addSpriteSymbol, useIsomorphicLayoutEffect } from '../sprite'; import { SvgIcon } from '../SvgIcon'; var viewBox = '0 0 28 28'; var id = 'list_add_outline_28'; var content = '<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" id="list_add_outline_28"><g fill="none" fill-rule="evenodd"><path d="M0 0h28v28H0z" /><path d="M20 12a1 1 0 011 1v4h4a1 1 0 010 2h-4v4a1 1 0 01-2 0v-4h-4a1 1 0 010-2h4v-4a1 1 0 011-1zM9.5 17a1 1 0 010 2h-5a1 1 0 010-2h5zm5-6a1 1 0 010 2h-10a1 1 0 010-2h10zm7-6a1 1 0 010 2h-17a1 1 0 110-2h17z" fill="currentColor" fill-rule="nonzero" /></g></symbol>'; var isMounted = false; function mountIcon() { if (!isMounted) { addSpriteSymbol(new BrowserSymbol({ id: id, viewBox: viewBox, content: content })); isMounted = true; } } var Icon28ListAddOutline = function Icon28ListAddOutline(props) { useIsomorphicLayoutEffect(function () { mountIcon(); }, []); return React.createElement(SvgIcon, assign({}, props, { viewBox: viewBox, id: id, width: !isNaN(props.width) ? +props.width : 28, height: !isNaN(props.height) ? +props.height : 28 })); }; Icon28ListAddOutline.mountIcon = mountIcon; export default Icon28ListAddOutline; //# sourceMappingURL=list_add_outline.js.map
37.815789
429
0.688935
d3cfed44541577374ddb9e39d7d8b00cec102d07
543
js
JavaScript
src/Components/Navbar.js
niladridutt/News-Summariser
57dd1abfac4b3b84e7cdb3da0ad35d26915904f3
[ "Apache-2.0" ]
9
2018-10-06T10:50:15.000Z
2020-12-05T18:33:02.000Z
src/Components/Navbar.js
niladridutt/News-Summariser
57dd1abfac4b3b84e7cdb3da0ad35d26915904f3
[ "Apache-2.0" ]
6
2018-12-03T07:12:10.000Z
2020-09-05T08:49:22.000Z
src/Components/Navbar.js
niladridutt/News-Summariser
57dd1abfac4b3b84e7cdb3da0ad35d26915904f3
[ "Apache-2.0" ]
9
2018-09-28T12:14:03.000Z
2019-01-08T12:23:38.000Z
import React, { Component } from 'react'; import "../Styles/Navbar.css"; class Nav extends Component { constructor(props) { super(props); this.state = { } } render() { return ( <div className="nav"> <div className="navbut1"> <a href="/">Home</a> </div> <div className="navbut2"> <a href="/read">Read Now</a> </div> </div> ); } } export default Nav;
21.72
49
0.416206
d3d0a9a6496e3f715ce9ca6a68b032b37430ba13
536
js
JavaScript
Models/City.js
ashili/jsCalc
c347d8c8544868a19a03346a0b5a7fd4d0d9dfad
[ "MIT" ]
null
null
null
Models/City.js
ashili/jsCalc
c347d8c8544868a19a03346a0b5a7fd4d0d9dfad
[ "MIT" ]
null
null
null
Models/City.js
ashili/jsCalc
c347d8c8544868a19a03346a0b5a7fd4d0d9dfad
[ "MIT" ]
3
2021-02-22T18:27:22.000Z
2021-02-27T00:26:55.000Z
module.exports = class City { constructor(data = null) { if(data) { this.id = data.id; this.city = data.city; this.city_ascii = data.city_ascii; this.lat = data.lat; this.lng = data.lng; this.iso2 = data.iso2; this.iso3 = data.iso3; this.capital = data.capital; this.admin_name = data.admin_name; } } //Factory Method to Create a City static create(data) { return new City(data); } }
26.8
46
0.507463
d3d15c11ee07bd46b5cc66c04c876275d27cf472
3,798
js
JavaScript
web/gbookshelf-vue/src/store/modules/books.js
doi-t/gbookshelf
00474d4f66b27b3bad4bf9cf6d157be36efb545b
[ "Apache-2.0" ]
null
null
null
web/gbookshelf-vue/src/store/modules/books.js
doi-t/gbookshelf
00474d4f66b27b3bad4bf9cf6d157be36efb545b
[ "Apache-2.0" ]
36
2018-11-25T12:55:01.000Z
2022-02-26T09:58:58.000Z
web/gbookshelf-vue/src/store/modules/books.js
doi-t/gbookshelf
00474d4f66b27b3bad4bf9cf6d157be36efb545b
[ "Apache-2.0" ]
null
null
null
import { Void, Book } from 'gbookshelf_pb' import { BookShelfClient } from 'gbookshelf_grpc_web_pb' const state = { books: [] } const getters = { allBooks: (state) => state.books } const actions = { fetchBooks ({ commit }) { // It should be a 'List' function in somewhere else console.log(`From .env: ${process.env.GBOOKSHELF_SERVER_URL}`) this.client = new BookShelfClient(process.env.GBOOKSHELF_SERVER_URL, null, null) let voidRequest = new Void() const call = this.client.list(voidRequest, {}, (err, response) => { if (err) { console.log(err.code) console.log(err.message) } else { this.books = response.toObject().booksList console.log('init global state:', this.books) commit('setBooks', this.books) } }) call.on('status', function (status) { console.log(status.code) console.log(status.details) console.log(status.metadata) }) }, addBook ({ commit }, book) { let newBook = new Book() newBook.setTitle(book.title) newBook.setPage(book.page) newBook.setCurrent(0) newBook.setDone(false) // TODO: newBook.setWhy(false) // TODO: newBook.setReason(false) console.log('Adding new book...', newBook) const call = this.client.add(newBook, {}, (err, response) => { if (err) { console.log(err.code) console.log(err.message) } else { this.response = response.toObject() console.log(this.response) console.log(this.response.title, 'has been added.') commit('newBook', this.response) } }) call.on('status', function (status) { console.log(status.code) console.log(status.details) console.log(status.metadata) }) }, removeBook ({ commit }, title) { // FIXME: The id should be given here instead of title let removeBook = new Book() removeBook.setTitle(title) console.log('Removing a book...', removeBook) const call = this.client.remove(removeBook, {}, (err, response) => { if (err) { console.log(err.code) console.log(err.message) } else { this.response = response.toObject() console.log(this.response.title, 'has been deleted.') commit('removeBook', this.response) } }) call.on('status', function (status) { console.log(status.code) console.log(status.details) console.log(status.metadata) }) }, updateBook ({ commit }, book) { let updateBook = new Book() updateBook.setTitle(book.title) updateBook.setPage(book.page) updateBook.setCurrent(book.current) updateBook.setDone(book.done) const call = this.client.update(updateBook, {}, (err, response) => { if (err) { console.log(err.code) console.log(err.message) } else { this.response = response.toObject() console.log(this.response.title, 'has been updated.') commit('updateBook', this.response) } }) call.on('status', function (status) { console.log(status.code) console.log(status.details) console.log(status.metadata) }) } } // FIXME: All Id check should be done by uuid generated by server instead of title const mutations = { setBooks: (state, books) => (state.books = books), newBook: (state, book) => state.books.unshift(book), removeBook: (state, rmvBook) => (state.books = state.books.filter(book => book.title !== rmvBook.title)), // FIXME: filter does not work as I expected. updateBook: (state, updBook) => { const index = state.books.findIndex(book => { return book.title === updBook.title }) if (index !== -1) { state.books.splice(index, 1, updBook) } } } export default { state, getters, actions, mutations }
29.671875
153
0.620326
d3d1f03fb13277fa4d7a8081ef393851f563e735
985
js
JavaScript
dist/source/util.js
saharh/getui-rest-sdk
b2f993d457b18e0e283d61301414b54a54109e79
[ "MIT" ]
null
null
null
dist/source/util.js
saharh/getui-rest-sdk
b2f993d457b18e0e283d61301414b54a54109e79
[ "MIT" ]
null
null
null
dist/source/util.js
saharh/getui-rest-sdk
b2f993d457b18e0e283d61301414b54a54109e79
[ "MIT" ]
null
null
null
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var fs_1 = require("fs"); var path_1 = require("path"); var crypto = require("crypto"); var os = require("os"); var _ = require("lodash"); var uuid = require("uuid"); function sha256(content) { return crypto.createHash('sha256').update(content).digest('hex').toString(); } exports.sha256 = sha256; function getRequestId() { return uuid.v1().replace(/-/g, '').slice(0, 30); } exports.getRequestId = getRequestId; function removeUndefined(obj) { return _.pickBy(obj, function (v) { return !_.isUndefined(v); }); } exports.removeUndefined = removeUndefined; function getUserAgent() { var pkgFile = path_1.resolve(__dirname, '../../package.json'); var pkg = JSON.parse(fs_1.readFileSync(pkgFile).toString()); return pkg.name + "/" + pkg.version + " (" + os.type() + "; " + os.release() + ") node/" + process.version; } exports.getUserAgent = getUserAgent; //# sourceMappingURL=util.js.map
36.481481
111
0.677157
d3d21159d2e522a7680b6aaa5dbdba539429b4e3
913
js
JavaScript
docs/indexeddb_from_rust/sidebar-items.js
bestia-dev/indexeddb_from_rust
499b5d40f12977038af6fa0487b9ca6a406d6eff
[ "MIT" ]
null
null
null
docs/indexeddb_from_rust/sidebar-items.js
bestia-dev/indexeddb_from_rust
499b5d40f12977038af6fa0487b9ca6a406d6eff
[ "MIT" ]
null
null
null
docs/indexeddb_from_rust/sidebar-items.js
bestia-dev/indexeddb_from_rust
499b5d40f12977038af6fa0487b9ca6a406d6eff
[ "MIT" ]
null
null
null
initSidebarItems({"fn":[["__wasm_bindgen_generated_wasm_bindgen_start","To start the Wasm application, wasm_bindgen runs this functions"],["wasm_bindgen_start","To start the Wasm application, wasm_bindgen runs this functions"]],"macro":[["on_click","Simple macro to set listener of on_click events to an element_id. fn with 1 arg(element_id): on_click!(element_id, function_ident)"],["row_on_click","list contains rows, every row item needs a separate event handler the element Id is concatenation of element_prefix plus the row_number"]],"mod":[["currdb_config_mod",""],["currdb_currency_mod",""],["currdb_mod",""],["idbr_imports_mod",""],["idbr_mod",""],["page_input_currency_mod",""],["page_main_mod",""],["page_modal_about_mod",""],["page_output_currency_mod",""],["utils_mod","utils_mod.rs"],["web_sys_mod","helper functions for web_sys, window, document, dom, console, local_storage, session_storage,…"]]});
913
913
0.759036
d3d2779b58cef4a319e4ce6321f3bc25180c83ff
3,056
js
JavaScript
node_modules/styled-icons/fa-solid/VenusDouble.js
Timothe-Renaud/PortfkolioFor2k21
bc6b3c618acc2f770283a64585e0bb5c91270067
[ "CC-BY-4.0", "MIT" ]
null
null
null
node_modules/styled-icons/fa-solid/VenusDouble.js
Timothe-Renaud/PortfkolioFor2k21
bc6b3c618acc2f770283a64585e0bb5c91270067
[ "CC-BY-4.0", "MIT" ]
null
null
null
node_modules/styled-icons/fa-solid/VenusDouble.js
Timothe-Renaud/PortfkolioFor2k21
bc6b3c618acc2f770283a64585e0bb5c91270067
[ "CC-BY-4.0", "MIT" ]
null
null
null
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; import React from 'react'; import styled from 'styled-components'; export var VenusDouble = styled.svg.attrs({ children: function (props) { return (props.title != null ? [React.createElement("title", { key: "VenusDouble-title" }, props.title), React.createElement("path", { fill: "currentColor", d: "M288 176c0-79.5-64.5-144-144-144S0 96.5 0 176c0 68.5 47.9 125.9 112 140.4V368H76c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h36v36c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12v-36h36c6.6 0 12-5.4 12-12v-40c0-6.6-5.4-12-12-12h-36v-51.6c64.1-14.5 112-71.9 112-140.4zm-224 0c0-44.1 35.9-80 80-80s80 35.9 80 80-35.9 80-80 80-80-35.9-80-80zm336 140.4V368h36c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-36v36c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-36h-36c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h36v-51.6c-21.2-4.8-40.6-14.3-57.2-27.3 14-16.7 25-36 32.1-57.1 14.5 14.8 34.7 24 57.1 24 44.1 0 80-35.9 80-80s-35.9-80-80-80c-22.3 0-42.6 9.2-57.1 24-7.1-21.1-18-40.4-32.1-57.1C303.4 43.6 334.3 32 368 32c79.5 0 144 64.5 144 144 0 68.5-47.9 125.9-112 140.4z", key: "k0" }) ] : [React.createElement("path", { fill: "currentColor", d: "M288 176c0-79.5-64.5-144-144-144S0 96.5 0 176c0 68.5 47.9 125.9 112 140.4V368H76c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h36v36c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12v-36h36c6.6 0 12-5.4 12-12v-40c0-6.6-5.4-12-12-12h-36v-51.6c64.1-14.5 112-71.9 112-140.4zm-224 0c0-44.1 35.9-80 80-80s80 35.9 80 80-35.9 80-80 80-80-35.9-80-80zm336 140.4V368h36c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-36v36c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-36h-36c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h36v-51.6c-21.2-4.8-40.6-14.3-57.2-27.3 14-16.7 25-36 32.1-57.1 14.5 14.8 34.7 24 57.1 24 44.1 0 80-35.9 80-80s-35.9-80-80-80c-22.3 0-42.6 9.2-57.1 24-7.1-21.1-18-40.4-32.1-57.1C303.4 43.6 334.3 32 368 32c79.5 0 144 64.5 144 144 0 68.5-47.9 125.9-112 140.4z", key: "k0" }) ]); }, viewBox: '0 0 512 512', height: function (props) { return (props.height !== undefined ? props.height : props.size); }, width: function (props) { return (props.width !== undefined ? props.width : props.size); }, // @ts-ignore - aria is not always defined on SVG in React TypeScript types 'aria-hidden': function (props) { return (props.title == null ? 'true' : undefined); }, focusable: 'false', role: function (props) { return (props.title != null ? 'img' : undefined); }, "fill": "currentColor", })(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: inline-block;\n vertical-align: -.125em;\n overflow: hidden;\n"], ["\n display: inline-block;\n vertical-align: -.125em;\n overflow: hidden;\n"]))); VenusDouble.displayName = 'VenusDouble'; export var VenusDoubleDimensions = { height: undefined, width: undefined }; var templateObject_1;
122.24
900
0.66394
d3d2f1d4b2bd980c6065b9ac284e3b6c93cb562d
773
js
JavaScript
examples/add-no-comments.js
natalieandy/intro-javascript
b5429b5f7c00a227ad47594a2d22c7f9fcbd7730
[ "CC-BY-4.0" ]
1
2021-12-14T18:00:16.000Z
2021-12-14T18:00:16.000Z
examples/add-no-comments.js
natalieandy/intro-javascript
b5429b5f7c00a227ad47594a2d22c7f9fcbd7730
[ "CC-BY-4.0" ]
null
null
null
examples/add-no-comments.js
natalieandy/intro-javascript
b5429b5f7c00a227ad47594a2d22c7f9fcbd7730
[ "CC-BY-4.0" ]
22
2020-01-15T03:38:11.000Z
2021-06-23T18:37:49.000Z
let process = require('process'); let commandLineArgs = process.argv; let firstUserArg = commandLineArgs[2]; let secondUserArg = commandLineArgs[3]; let leftSummand = Number.parseFloat(firstUserArg); let rightSummand = Number.parseFloat(secondUserArg); if (firstUserArg === undefined || secondUserArg === undefined) { console.error('Error: Missing at least one summand'); console.error('Usage: node add.js <leftSummand> <rightSummand>'); process.exit(1); } if (Number.isNaN(leftSummand) || Number.isNaN(rightSummand)) { console.error('Error: Summands must be numbers.'); console.error('Usage: node add.js <leftSummand> <rightSummand>'); process.exit(1); } let sum = leftSummand + rightSummand; console.log(`${leftSummand} + ${rightSummand} = ${sum}`);
27.607143
67
0.72445
d3d3c2e55ec8d01d638ee2d5ac1f93c496c077c0
660
js
JavaScript
components/NotFoundDatas.js
Ias4g/goals-frontend
d44cd7e9b0883aa691cca7b36304067181ac0f1d
[ "MIT" ]
null
null
null
components/NotFoundDatas.js
Ias4g/goals-frontend
d44cd7e9b0883aa691cca7b36304067181ac0f1d
[ "MIT" ]
null
null
null
components/NotFoundDatas.js
Ias4g/goals-frontend
d44cd7e9b0883aa691cca7b36304067181ac0f1d
[ "MIT" ]
null
null
null
import React from 'react'; import { FiInfo } from 'react-icons/fi' import { Alert } from 'reactstrap'; const NotFoundDatas = (props) => { return ( <div> <Alert color="warning"> <h4 className="alert-heading text-center"><FiInfo size={42} /></h4> <p className="text-center"> Sinto muito, nenhum registro encontrado... </p> <hr /> <p className="mb-0 text-center small"> Cadastre metas para aparecerem aqui posteriormente </p> </Alert> </div> ); }; export default NotFoundDatas;
30
83
0.506061
d3d3d311ce0277823ed6c67574376631ed2e3901
321
js
JavaScript
src/frameworks/emailService/emailService.test.js
BuildForSDG/Team-007-BackEnd
d17dfc285f8236c8cef738847bc3751c58c56044
[ "MIT" ]
null
null
null
src/frameworks/emailService/emailService.test.js
BuildForSDG/Team-007-BackEnd
d17dfc285f8236c8cef738847bc3751c58c56044
[ "MIT" ]
3
2020-05-14T13:12:54.000Z
2021-09-02T11:35:39.000Z
src/frameworks/emailService/emailService.test.js
BuildForSDG/Team-007-BackEnd
d17dfc285f8236c8cef738847bc3751c58c56044
[ "MIT" ]
null
null
null
import EmailService from './emailService'; describe('Testing EmailService', () => { it('should be an object with a notify method', () => { EmailService.notify('test Ok'); expect.assertions(2); expect(EmailService).toBeInstanceOf(Object); expect(EmailService.notify).toBeInstanceOf(Function); }); });
29.181818
57
0.688474
d3d545754631bfd398080e0c8b940c4c50ee63f3
1,291
js
JavaScript
db/dc3/class_ext_1_1_net_1_1_chart_item_events.js
extnet/docs5.ext.net
e99e4d3894640fb1f66882443fe7348fc3181f55
[ "Apache-2.0" ]
null
null
null
db/dc3/class_ext_1_1_net_1_1_chart_item_events.js
extnet/docs5.ext.net
e99e4d3894640fb1f66882443fe7348fc3181f55
[ "Apache-2.0" ]
null
null
null
db/dc3/class_ext_1_1_net_1_1_chart_item_events.js
extnet/docs5.ext.net
e99e4d3894640fb1f66882443fe7348fc3181f55
[ "Apache-2.0" ]
null
null
null
var class_ext_1_1_net_1_1_chart_item_events = [ [ "Builder", "d6/dac/class_ext_1_1_net_1_1_chart_item_events_1_1_builder.html", "d6/dac/class_ext_1_1_net_1_1_chart_item_events_1_1_builder" ], [ "Config", "da/d63/class_ext_1_1_net_1_1_chart_item_events_1_1_config.html", "da/d63/class_ext_1_1_net_1_1_chart_item_events_1_1_config" ], [ "ChartItemEvents", "db/dc3/class_ext_1_1_net_1_1_chart_item_events.html#a346ab082d307a02fbdb78a7714df2cd4", null ], [ "ChartItemEvents", "db/dc3/class_ext_1_1_net_1_1_chart_item_events.html#a88cc75c60fa46eff61dfd1724905725b", null ], [ "ToBuilder", "db/dc3/class_ext_1_1_net_1_1_chart_item_events.html#ac4d81649a9a9d256d2d9992acaac58f9", null ], [ "ToNativeBuilder", "db/dc3/class_ext_1_1_net_1_1_chart_item_events.html#afb52de13753442b9cb21cf233d5f57d5", null ], [ "ConfigOptions", "db/dc3/class_ext_1_1_net_1_1_chart_item_events.html#a99cec772182477e786c372a70e441188", null ], [ "InstanceOf", "db/dc3/class_ext_1_1_net_1_1_chart_item_events.html#a219ebba248be1353c6d219b52b062145", null ], [ "MouseEvents", "db/dc3/class_ext_1_1_net_1_1_chart_item_events.html#a8d875a106b08931a98621af9909abbb8", null ], [ "PType", "db/dc3/class_ext_1_1_net_1_1_chart_item_events.html#a55cfa40ec99e6995b271e75273cbf498", null ] ];
99.307692
147
0.81952
d3d54d822d8aa888e9833723b9b6c760ba24f1d0
2,470
js
JavaScript
test/render/content/roundDots.spec.js
qwertmax/qr-code-library
5849a578f56a70b681d1d79a0762a8ab9df95d81
[ "MIT" ]
2
2019-11-21T16:59:24.000Z
2020-03-04T19:11:45.000Z
test/render/content/roundDots.spec.js
qwertmax/qr-code-library
5849a578f56a70b681d1d79a0762a8ab9df95d81
[ "MIT" ]
null
null
null
test/render/content/roundDots.spec.js
qwertmax/qr-code-library
5849a578f56a70b681d1d79a0762a8ab9df95d81
[ "MIT" ]
null
null
null
import { calculateRoundDots, drawRoundDots } from '../../../src/render/content/roundDots'; describe('calculateRoundDots', () => { /* test matrix |X|0| |X|X| */ const data = [1, 0, 1, 1]; const size = 2; const scale = 4; const offsets = [0, 0]; it('returns correct coordinates of each dot', () => { const dots = calculateRoundDots(data, size, scale, offsets); expect(dots[0]).toEqual({ x: 2, y: 2, r: 1 }); expect(dots[1]).toEqual({ x: 2, y: 6, r: 1 }); expect(dots[2]).toEqual({ x: 6, y: 6, r: 1 }); }); it.each` data | length ${[1, 0, 1]} | ${2} ${[0, 1, 0]} | ${1} ${[0, 0, 0]} | ${0} `('omits zero values in $data', ({ data, length }) => { expect(calculateRoundDots(data, size, scale, offsets)).toHaveLength(length); }); it('returns dots depending on offsets', () => { const dots = calculateRoundDots(data, size, scale, [10, 10]); expect(dots[0]).toEqual({ x: 12, y: 12, r: 1 }); expect(dots[1]).toEqual({ x: 12, y: 16, r: 1 }); expect(dots[2]).toEqual({ x: 16, y: 16, r: 1 }); }); }); describe('drawRoundDots', () => { const canvasCtx = {}; const options = { content: { color: 'white' } }; const coords = [{ x: 5, y: 5, r: 5 }, { x: 20, y: 30, r: 5 }]; beforeEach(() => { canvasCtx.beginPath = jest.fn(); canvasCtx.arc = jest.fn(); canvasCtx.fill = jest.fn(); canvasCtx.stroke = jest.fn(); }); it('draws each dot correctly', () => { drawRoundDots(canvasCtx, coords, options); expect(canvasCtx.beginPath).toBeCalledTimes(2); expect(canvasCtx.fill).toBeCalledTimes(2); expect(canvasCtx.stroke).toBeCalledTimes(2); expect(canvasCtx.arc).nthCalledWith( 1, coords[0].x, coords[0].y, coords[0].r, 0, 2 * Math.PI ); expect(canvasCtx.arc).nthCalledWith( 2, coords[1].x, coords[1].y, coords[1].r, 0, 2 * Math.PI ); }); it('sets up inner circle color', () => { drawRoundDots(canvasCtx, coords, options); expect(canvasCtx.fillStyle).toEqual(options.content.color); }); it('sets up circle border color', () => { drawRoundDots(canvasCtx, coords, options); expect(canvasCtx.strokeStyle).toEqual(options.content.color); }); it('draws nothing when there is are no coordinates', () => { drawRoundDots(canvasCtx, [], options); expect(canvasCtx.beginPath).toBeCalledTimes(0); }); });
24.455446
80
0.563968
d3d56d15e78563559f73fd4b3dc9c66098e9cfb0
2,206
js
JavaScript
lib/notifiers.js
peb7268/custom-meanio
67367aa19c8a6d8369a7b928409dbe086e81e93e
[ "MIT" ]
null
null
null
lib/notifiers.js
peb7268/custom-meanio
67367aa19c8a6d8369a7b928409dbe086e81e93e
[ "MIT" ]
null
null
null
lib/notifiers.js
peb7268/custom-meanio
67367aa19c8a6d8369a7b928409dbe086e81e93e
[ "MIT" ]
null
null
null
'use strict'; var fs = require('fs'); var request = require('request'); var querystring = require('querystring'); var globalData = { allowed: false, token: null, appId: '' }; function readJson(path) { try { var data = JSON.parse(fs.readFileSync(process.cwd() + '/mean.json')); if (data) { globalData.appId = data.id; if (data.anonymizedData) return true; return false; } return false; } catch(err) { return false; } } function getUserHome() { return process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME']; } function meanJsonPath() { var file = (process.platform === 'win32') ? '_mean' : '.mean'; var path = getUserHome() + '/' + file; return path; } function readToken() { var token; var path = meanJsonPath(); var data = fs.readFileSync(path); try { var json = JSON.parse(data.toString()); token = json.token; } catch (err) { token = null; } return token; } function init() { globalData.token = readToken(); var anonymizedData = readJson(process.cwd() + '/mean.json'); if (globalData.token && anonymizedData) globalData.allowed = true; } var create = exports.create = function (data) { if (!globalData.allowed) return; data.token = globalData.token; data.created = Date.now(); data.session = 1; data.appId = globalData.appId; var mapiOpt = { uri: 'https://network.mean.io/api/v0.1/index/' + data.index + '/' + data.type, method: 'POST', form: data, headers: { 'Content-Type': 'multipart/form-data', 'Content-Length': querystring.stringify(data).length } }; request(mapiOpt, function(error, response, body) {}); }; function writeErrorLog(text) { fs.appendFile(process.cwd() + '/logs/error.log', text, function() {}); } ['log', 'warn', 'error'].forEach(function(method) { console[method] = function(d) { process.stdout.write(d + '\n'); var text = [new Date().toISOString()] + ' ' + d + '\n'; writeErrorLog(text); create({ index: 'logs', type: 'console', content: method + ': ' + d }); }; }); init();
22.742268
82
0.581596
d3d70b38fea40aecaa7f3664794cec902d1763b6
8,237
js
JavaScript
lib/commands/index.js
gemini-testing/hermione-wdio-migrator
cb67782ad877920fe35f4f42e71e605bb0f5233e
[ "MIT" ]
2
2021-04-13T06:23:11.000Z
2021-12-21T13:41:07.000Z
lib/commands/index.js
gemini-testing/hermione-wdio-migrator
cb67782ad877920fe35f4f42e71e605bb0f5233e
[ "MIT" ]
1
2020-12-17T07:40:44.000Z
2020-12-17T13:21:48.000Z
lib/commands/index.js
gemini-testing/hermione-wdio-migrator
cb67782ad877920fe35f4f42e71e605bb0f5233e
[ "MIT" ]
2
2021-12-21T13:44:16.000Z
2022-03-19T07:12:57.000Z
'use strict'; // commands from v4 docs - http://v4.webdriver.io/api.html module.exports = { // "Action" commands addValue: require('./action/addValue'), clearElement: require('./action/clearElement'), click: require('./action/click'), doubleClick: require('./action/doubleClick'), dragAndDrop: require('./action/dragAndDrop'), leftClick: require('./action/leftClick'), middleClick: require('./action/middleClick'), moveToObject: require('./action/moveToObject'), rightClick: require('./action/rightClick'), selectByAttribute: require('./action/selectByAttribute'), selectByIndex: require('./action/selectByIndex'), selectByValue: require('./action/selectByValue'), selectByVisibleText: require('./action/selectByVisibleText'), selectorExecute: require('./action/selectorExecute'), selectorExecuteAsync: require('./action/selectorExecuteAsync'), setValue: require('./action/setValue'), submitForm: require('./action/submitForm'), // "Cookie" commands deleteCookie: require('./cookie/deleteCookie'), getCookie: require('./cookie/getCookie'), setCookie: require('./cookie/setCookie'), // "Mobile" commands context: require('./mobile/context'), contexts: require('./mobile/contexts'), currentActivity: require('./mobile/currentActivity'), deviceKeyEvent: require('./mobile/deviceKeyEvent'), getAppStrings: require('./mobile/getAppStrings'), getCurrentDeviceActivity: require('./mobile/getCurrentDeviceActivity'), hideDeviceKeyboard: require('./mobile/hideDeviceKeyboard'), hold: require('./mobile/hold'), launch: require('./mobile/launch'), longPressKeycode: require('./mobile/longPressKeycode'), performMultiAction: require('./mobile/performMultiAction'), performTouchAction: require('./mobile/performTouchAction'), pressKeycode: require('./mobile/pressKeycode'), release: require('./mobile/release'), rotate: require('./mobile/rotate'), setImmediateValue: require('./mobile/setImmediateValue'), settings: require('./mobile/settings'), strings: require('./mobile/strings'), swipe: require('./mobile/swipe'), swipeDown: require('./mobile/swipeDown'), swipeUp: require('./mobile/swipeUp'), swipeLeft: require('./mobile/swipeLeft'), swipeRight: require('./mobile/swipeRight'), toggleTouchIdEnrollment: require('./mobile/toggleTouchIdEnrollment'), touch: require('./mobile/touch'), touchAction: require('./mobile/touchAction'), touchMultiPerform: require('./mobile/touchMultiPerform'), // "Property" commands getAttribute: require('./property/getAttribute'), getCssProperty: require('./property/getCssProperty'), getElementSize: require('./property/getElementSize'), getHTML: require('./property/getHTML'), getLocation: require('./property/getLocation'), getLocationInView: require('./property/getLocationInView'), getSource: require('./property/getSource'), getTagName: require('./property/getTagName'), getText: require('./property/getText'), getValue: require('./property/getValue'), // "Protocol" commands actions: require('./protocol/actions'), alertAccept: require('./protocol/alertAccept'), alertDismiss: require('./protocol/alertDismiss'), alertText: require('./protocol/alertText'), applicationCacheStatus: require('./protocol/applicationCacheStatus'), buttonDown: require('./protocol/buttonDown'), buttonPress: require('./protocol/buttonPress'), buttonUp: require('./protocol/buttonUp'), cookie: require('./protocol/cookie'), doDoubleClick: require('./protocol/doDoubleClick'), element: require('./protocol/element'), elementActive: require('./protocol/elementActive'), elementIdAttribute: require('./protocol/elementIdAttribute'), elementIdClear: require('./protocol/elementIdClear'), elementIdClick: require('./protocol/elementIdClick'), elementIdCssProperty: require('./protocol/elementIdCssProperty'), elementIdDisplayed: require('./protocol/elementIdDisplayed'), elementIdElement: require('./protocol/elementIdElement'), elementIdElements: require('./protocol/elementIdElements'), elementIdEnabled: require('./protocol/elementIdEnabled'), elementIdLocation: require('./protocol/elementIdLocation'), elementIdLocationInView: require('./protocol/elementIdLocationInView'), elementIdName: require('./protocol/elementIdName'), elementIdProperty: require('./protocol/elementIdProperty'), elementIdRect: require('./protocol/elementIdRect'), elementIdScreenshot: require('./protocol/elementIdScreenshot'), elementIdSelected: require('./protocol/elementIdSelected'), elementIdSize: require('./protocol/elementIdSize'), elementIdText: require('./protocol/elementIdText'), elementIdValue: require('./protocol/elementIdValue'), elements: require('./protocol/elements'), frame: require('./protocol/frame'), frameParent: require('./protocol/frameParent'), imeActivate: require('./protocol/imeActivate'), imeActivated: require('./protocol/imeActivated'), imeActiveEngine: require('./protocol/imeActiveEngine'), imeAvailableEngines: require('./protocol/imeAvailableEngines'), imeDeactivated: require('./protocol/imeDeactivated'), init: require('./protocol/init'), localStorage: require('./protocol/localStorage'), localStorageSize: require('./protocol/localStorageSize'), location: require('./protocol/location'), log: require('./protocol/log'), logTypes: require('./protocol/logTypes'), moveTo: require('./protocol/moveTo'), screenshot: require('./protocol/screenshot'), session: require('./protocol/session'), sessionStorage: require('./protocol/sessionStorage'), sessionStorageSize: require('./protocol/sessionStorageSize'), sessions: require('./protocol/sessions'), source: require('./protocol/source'), submit: require('./protocol/submit'), timeouts: require('./protocol/timeouts'), timeoutsAsyncScript: require('./protocol/timeoutsAsyncScript'), timeoutsImplicitWait: require('./protocol/timeoutsImplicitWait'), title: require('./protocol/title'), touchFlick: require('./protocol/touchFlick'), touchScroll: require('./protocol/touchScroll'), window: require('./protocol/window'), windowHandle: require('./protocol/windowHandle'), windowHandleFullscreen: require('./protocol/windowHandleFullscreen'), windowHandleMaximize: require('./protocol/windowHandleMaximize'), windowHandlePosition: require('./protocol/windowHandlePosition'), windowHandleSize: require('./protocol/windowHandleSize'), windowHandles: require('./protocol/windowHandles'), // "State" commands hasFocus: require('./state/hasFocus'), isEnabled: require('./state/isEnabled'), isExisting: require('./state/isExisting'), isSelected: require('./state/isSelected'), isVisible: require('./state/isVisible'), isVisibleWithinViewport: require('./state/isVisibleWithinViewport'), // "Utility" commands addCommand: require('./utility/addCommand'), chooseFile: require('./utility/chooseFile'), end: require('./utility/end'), endAll: require('./utility/endAll'), getCommandHistory: require('./utility/getCommandHistory'), reload: require('./utility/reload'), saveScreenshot: require('./utility/saveScreenshot'), scroll: require('./utility/scroll'), waitForEnabled: require('./utility/waitForEnabled'), waitForExist: require('./utility/waitForExist'), waitForSelected: require('./utility/waitForSelected'), waitForText: require('./utility/waitForText'), waitForValue: require('./utility/waitForValue'), waitForVisible: require('./utility/waitForVisible'), waitUntil: require('./utility/waitUntil'), // "Window" commands close: require('./window/close'), getCurrentTabId: require('./window/getCurrentTabId'), getTabIds: require('./window/getTabIds'), getViewportSize: require('./window/getViewportSize'), newWindow: require('./window/newWindow'), setViewportSize: require('./window/setViewportSize'), switchTab: require('./window/switchTab') };
48.169591
75
0.711545
d3d7ea2134bc8e966b7bbcc99c138485b6aea1cb
1,834
js
JavaScript
app/handler/queue.js
danocmx/tf2-automatic
182b26695746b96228c061e7255ecb742309a39b
[ "MIT" ]
null
null
null
app/handler/queue.js
danocmx/tf2-automatic
182b26695746b96228c061e7255ecb742309a39b
[ "MIT" ]
1
2018-07-15T11:33:01.000Z
2018-07-15T11:33:01.000Z
app/handler/queue.js
ZeusJunior/tf2-automatic
6292701987bed760290bfc3ce801421b78125df0
[ "MIT" ]
null
null
null
const moment = require('moment'); const log = require('lib/logger'); const handlerManager = require('app/handler-manager'); const client = require('lib/client'); const queue = []; let processingQueue = false; exports.getQueue = function () { return queue; }; exports.getPosition = function (steamID) { const steamID64 = typeof steamID === 'string' ? steamID : steamID.getSteamID64(); return queue.findIndex((v) => v.steamid === steamID64); }; exports.addRequestedTrade = function (steamID, sku, amount, buying) { const steamID64 = typeof steamID === 'string' ? steamID : steamID.getSteamID64(); const entry = { steamid: steamID64, sku: sku, amount: amount, buying: buying, time: moment().unix() }; log.debug('Adding requested offer to the queue', entry); queue.push(entry); queueChanged(); return queue.length - 1; }; exports.handleQueue = function () { if (processingQueue || queue.length === 0) { return; } processingQueue = true; const entry = queue[0]; require('handler/trades').createOffer(entry, function (err, failedMessage) { queue.splice(0, 1); if (err) { log.debug('Failed to create offer: ', err); client.chatMessage(entry.steamid, 'Something went wrong while trying to make the offer, try again later!'); } else if (failedMessage) { client.chatMessage(entry.steamid, 'I failed to make the offer. Reason: ' + failedMessage + '.'); } else { client.chatMessage(entry.steamid, 'Your offer has been made, please wait while I accept the mobile confirmation.'); } processingQueue = false; exports.handleQueue(); }); }; function queueChanged () { handlerManager.getHandler().onQueue(queue); }
26.970588
127
0.628135
d3d83b9425ec784b66309cf1f398d62e0e3e8ca2
2,234
js
JavaScript
src/group-play-button.js
brandonocasey/videojs-group-play
c2d86c7f49263eaa978beba2570d311b7eab37d8
[ "MIT" ]
8
2019-12-17T01:20:59.000Z
2022-01-13T16:39:35.000Z
src/group-play-button.js
BrandonOCasey/videojs-group-play
c2d86c7f49263eaa978beba2570d311b7eab37d8
[ "MIT" ]
1
2020-04-29T21:44:38.000Z
2020-04-29T21:44:38.000Z
src/group-play-button.js
BrandonOCasey/videojs-group-play
c2d86c7f49263eaa978beba2570d311b7eab37d8
[ "MIT" ]
null
null
null
import videojs from 'video.js'; const Button = videojs.getComponent('Button'); const Component = videojs.getComponent('Component'); /** * Toggle fullscreen video * * @extends Button */ class GroupPlayButton extends Button { /** * Creates an instance of this class. * * @param {Player} player * The `Player` that this class should be attached to. * * @param {Object} [options] * The key/value store of player options. */ constructor(player, options) { super(player, options); this.handleGroupPlayChange = this.handleGroupPlayChange.bind(this); // set initial state; this.player_.on('group-play-change', this.handleGroupPlayChange); } /** * Builds the default DOM `className`. * * @return {string} * The DOM `className` for this object. */ buildCSSClass() { return `vjs-group-play-button ${super.buildCSSClass()}`; } /** * Handles fullscreenchange on the player and change control text accordingly. * * @param {EventTarget~Event} [event] * The {@link Player#fullscreenchange} event that caused this function to be * called. * * @listens Player#fullscreenchange */ handleGroupPlayChange(event) { if (this.player_.groupPlay().isSetup_) { this.controlText('Stop Group Sharing'); } else { this.controlText('Start Group Sharing'); } } /** * This gets called when an `FullscreenToggle` is "clicked". See * {@link ClickableComponent} for more detailed information on what a click can be. * * @param {EventTarget~Event} [event] * The `keydown`, `tap`, or `click` event that caused this function to be * called. * * @listens tap * @listens click */ handleClick(event) { if (this.player_.groupPlay().isSetup_) { this.player_.groupPlay().reset(); } else { this.player_.groupPlay().setup(); } } } /** * The text that should display over the `FullscreenToggle`s controls. Added for localization. * * @type {string} * @private */ GroupPlayButton.prototype.controlText_ = 'Group Playback Sharing'; Component.registerComponent('GroupPlayButton', GroupPlayButton); export default GroupPlayButton;
24.822222
94
0.65085
d3d8424e973aefef738a466744332d8e91bbdd77
58
js
JavaScript
tests/duplicate_libs/test.js
BearerPipelineTest/flow
6111b8d3358d342f6913c001af908ef0281cdaa5
[ "MIT" ]
null
null
null
tests/duplicate_libs/test.js
BearerPipelineTest/flow
6111b8d3358d342f6913c001af908ef0281cdaa5
[ "MIT" ]
null
null
null
tests/duplicate_libs/test.js
BearerPipelineTest/flow
6111b8d3358d342f6913c001af908ef0281cdaa5
[ "MIT" ]
null
null
null
// @flow (global_foo: string); // error: number ~> string
19.333333
48
0.637931
d3d8fe7560d25baeaf33a304b078202a99d0edfb
2,326
js
JavaScript
src/components/Header/Header.js
Macseam/HomeDoc
b04601b626b929361a1e4f5c92c5362f3671de7c
[ "Apache-2.0" ]
null
null
null
src/components/Header/Header.js
Macseam/HomeDoc
b04601b626b929361a1e4f5c92c5362f3671de7c
[ "Apache-2.0" ]
null
null
null
src/components/Header/Header.js
Macseam/HomeDoc
b04601b626b929361a1e4f5c92c5362f3671de7c
[ "Apache-2.0" ]
null
null
null
import React, { useState } from "react" import { useHistory, Link } from "react-router-dom" import AccountCircle from "@mui/icons-material/AccountCircle" import AppBar from "@mui/material/AppBar" import Button from "@mui/material/Button" import Menu from "@mui/material/Menu" import MenuItem from "@mui/material/MenuItem" import Box from "@mui/material/Box" import Toolbar from "@mui/material/Toolbar" import Typography from "@mui/material/Typography" import IconButton from "@mui/material/IconButton" const Header = () => { const [profileMenuOpened, setProfileMenuOpened] = useState(false) const [profileMenuAnchorEl, setProfileMenuAnchorEl] = useState(undefined) const history = useHistory() const goBack = () => { history.push("/") } const openProfileMenu = (e) => { setProfileMenuAnchorEl(e.currentTarget) setProfileMenuOpened(true) } const closeProfileMenu = () => { setProfileMenuOpened(false) } const renderMenu = ( <Menu open={profileMenuOpened} anchorEl={profileMenuAnchorEl} anchorOrigin={{ vertical: "top", horizontal: "right", }} onClose={closeProfileMenu} > <MenuItem onClick={goBack}> Выйти </MenuItem> </Menu> ) return ( <div> <Box sx={{ flexGrow: 1 }}> <AppBar position="static"> <Toolbar> <Typography variant="h6" component="div" sx={{ flexGrow: 1 }}> <Link to="/events"> HomeDoc </Link> </Typography> <Button color="inherit">Добавить</Button> <IconButton size="large" color="inherit" onClick={openProfileMenu} > <AccountCircle /> </IconButton> </Toolbar> </AppBar> </Box> {renderMenu} </div> ) } export default Header
31.013333
87
0.490542
d3da0dc60647b38e40d07e034c053eb5fbd65b2f
27
js
JavaScript
ecmascript/codegen/tests/test262-min/86f68610fcefaeae.js
vjpr/swc
97514a754986eaf3a227cab95640327534aa183f
[ "Apache-2.0", "MIT" ]
21,008
2017-04-01T04:06:55.000Z
2022-03-31T23:11:05.000Z
ecmascript/codegen/tests/test262-min/86f68610fcefaeae.js
sventschui/swc
cd2a2777d9459ba0f67774ed8a37e2b070b51e81
[ "Apache-2.0", "MIT" ]
2,309
2018-01-14T05:54:44.000Z
2022-03-31T15:48:40.000Z
ecmascript/codegen/tests/test262-min/86f68610fcefaeae.js
sventschui/swc
cd2a2777d9459ba0f67774ed8a37e2b070b51e81
[ "Apache-2.0", "MIT" ]
768
2018-01-14T05:15:43.000Z
2022-03-30T11:29:42.000Z
class a{b(){}static c(){}}
13.5
26
0.518519
d3da818265996232be6b7939032c4547c14c4668
631
js
JavaScript
client/src/App.js
rwanke14/googlebooks
04893c865643f5a8c8123891e49704a58dcfdac9
[ "MIT" ]
null
null
null
client/src/App.js
rwanke14/googlebooks
04893c865643f5a8c8123891e49704a58dcfdac9
[ "MIT" ]
null
null
null
client/src/App.js
rwanke14/googlebooks
04893c865643f5a8c8123891e49704a58dcfdac9
[ "MIT" ]
null
null
null
import React from 'react' import { BrowserRouter, Route, Switch } from "react-router-dom"; import "./App.css"; import Navigation from "./components/Navbar"; import Saved from "./pages/savedbooks" import Hero from "./components/Hero" import Search from "./pages/searchbooks" import 'bootstrap/dist/css/bootstrap.min.css'; function App() { return ( <div> <BrowserRouter> <Navigation /> <Hero /> <Switch> <Route exact path="/search" component={Search}/> <Route exact path="/save" component={Saved}/> </Switch> </BrowserRouter> </div> ); } export default App;
24.269231
65
0.635499
d3db01a7ae9c323f4fdc324beb91ddcfba4386d3
2,563
js
JavaScript
jsFerreteIluminacion.js
Worg3n/IngresoUTN2019
23f9ad1c7ee4e849e022f590ca247008b117f6a0
[ "MIT" ]
null
null
null
jsFerreteIluminacion.js
Worg3n/IngresoUTN2019
23f9ad1c7ee4e849e022f590ca247008b117f6a0
[ "MIT" ]
null
null
null
jsFerreteIluminacion.js
Worg3n/IngresoUTN2019
23f9ad1c7ee4e849e022f590ca247008b117f6a0
[ "MIT" ]
null
null
null
/*4. Para el departamento de iluminación: Tomando en cuenta que todas las lámparas están en oferta al mismo precio de $35 pesos final. A. Si compra 6 o más lamparitas bajo consumo tiene un descuento del 50%. B. Si compra 5 lamparitas bajo consumo marca "ArgentinaLuz" se hace un descuento del 40 % y si es de otra marca el descuento es del 30%. C. Si compra 4 lamparitas bajo consumo marca "ArgentinaLuz" o “FelipeLamparas” se hace un descuento del 25 % y si es de otra marca el descuento es del 20%. D. Si compra 3 lamparitas bajo consumo marca "ArgentinaLuz" el descuento es del 15%, si es “FelipeLamparas” se hace un descuento del 10 % y si es de otra marca un 5%. E. Si el importe final con descuento suma más de $120 se debe sumar un 10% de ingresos brutos en informar del impuesto con el siguiente mensaje: ”Usted pago X de IIBB.”, siendo X el impuesto que se pagó. */ function CalcularPrecio() { var Precio = 35; var Marca; var Cantidad; var Descuento; var PrecioConDescuento; Cantidad = parseFloat(document.getElementById("Cantidad").value); Marca = document.getElementById("Marca").value; if (Cantidad >= 6) { Descuento = Precio * 50 / 100 alert("Su descuento es del 50%") } else if (Cantidad == 5) { if (Marca == "ArgentinaLuz") { Descuento = Precio * 40 / 100 alert("Su descuento es del 40%"); } else { Descuento = Precio * 30 / 100 alert("Su descuento es del 30%"); } } else if (Cantidad == 4) { if (Marca == "FelipeLamparas" || Marca == "ArgentinaLuz") { Descuento = Precio * 25 / 100 alert("Su descuento es del 25%"); } else { Descuento = Precio * 20 / 100 alert("Su descuento es del 20%"); } } else if (Cantidad == 3) { if (Marca == "ArgentinaLuz") { Descuento = Precio * 15 / 100 alert("Su descuento es del 15%"); } else { if (Marca == "FelipeLamparas") { Descuento = Precio * 10 / 100 alert("Su descuento es del 10%"); } else { Descuento = Precio * 5 / 100 alert("Usted no obtuvo descuento"); } } } else { if (Cantidad < 3) { Descuento = Precio * 0 } } PrecioConDescuento = Precio * Cantidad - Descuento; document.getElementById("precioDescuento").value = PrecioConDescuento; }
32.443038
169
0.58096
d3dbd8743cf7dfe1de4ac7f3dbbaab8a924766ee
593
js
JavaScript
lib/eventemitter.js
jeffbski/autoflow
aa30f6e6c2e74aa72a018c65698acac3fb478cbb
[ "MIT" ]
21
2015-01-25T17:28:40.000Z
2022-01-28T03:29:21.000Z
lib/eventemitter.js
jeffbski/autoflow
aa30f6e6c2e74aa72a018c65698acac3fb478cbb
[ "MIT" ]
null
null
null
lib/eventemitter.js
jeffbski/autoflow
aa30f6e6c2e74aa72a018c65698acac3fb478cbb
[ "MIT" ]
2
2017-08-07T18:36:28.000Z
2021-04-10T13:16:05.000Z
/*global define:true EventEmitter2:true */ if (typeof define !== 'function') { var define = require('amdefine')(module); } define(['eventemitter2'], function (EventEmitterMod) { 'use strict'; /** Abstract the details of getting an EventEmitter */ // EventEmitter doesn't return itself in browser so need to get the global // EventEmitter api changed, so accomodate which ever version is available var EventEmitter = (EventEmitterMod) ? ((EventEmitterMod.EventEmitter2) ? EventEmitterMod.EventEmitter2 : EventEmitterMod) : EventEmitter2; return EventEmitter; });
29.65
104
0.72344
d3df1142af00145010a870ddbd752b2eec7d3dc6
3,649
js
JavaScript
geonode_mapstore_client/static/mapstore/dist/2620.f997d46344730c49d959.chunk.js
bieganowski/geonode-mapstore-client
6520cb78ceda6ce86ab7091f38c0e5ec86a3968d
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
geonode_mapstore_client/static/mapstore/dist/2620.f997d46344730c49d959.chunk.js
bieganowski/geonode-mapstore-client
6520cb78ceda6ce86ab7091f38c0e5ec86a3968d
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
geonode_mapstore_client/static/mapstore/dist/2620.f997d46344730c49d959.chunk.js
bieganowski/geonode-mapstore-client
6520cb78ceda6ce86ab7091f38c0e5ec86a3968d
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
(self.webpackChunkgeonode_mapstore_client=self.webpackChunkgeonode_mapstore_client||[]).push([[2620],{99882:(e,t,n)=>{(e.exports=n(9252)()).push([e.id,".msgapi #mapstore-globalspinner {\r\n margin: 0 !important;\r\n width: 40px !important;\r\n position:static !important;\r\n border-radius: 0 !important;\r\n}\r\n",""])},9252:e=>{e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t];n[2]?e.push("@media "+n[2]+"{"+n[1]+"}"):e.push(n[1])}return e.join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var r={},o=0;o<this.length;o++){var i=this[o][0];"number"==typeof i&&(r[i]=!0)}for(o=0;o<t.length;o++){var s=t[o];"number"==typeof s[0]&&r[s[0]]||(n&&!s[2]?s[2]=n:n&&(s[2]="("+s[2]+") and ("+n+")"),e.push(s))}},e}},14246:e=>{var t={},n=function(e){var t;return function(){return void 0===t&&(t=e.apply(this,arguments)),t}},r=n((function(){return/msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase())})),o=n((function(){return document.head||document.getElementsByTagName("head")[0]})),i=null,s=0;function a(e,n){for(var r=0;r<e.length;r++){var o=e[r],i=t[o.id];if(i){i.refs++;for(var s=0;s<i.parts.length;s++)i.parts[s](o.parts[s]);for(;s<o.parts.length;s++)i.parts.push(c(o.parts[s],n))}else{var a=[];for(s=0;s<o.parts.length;s++)a.push(c(o.parts[s],n));t[o.id]={id:o.id,refs:1,parts:a}}}}function p(e){for(var t=[],n={},r=0;r<e.length;r++){var o=e[r],i=o[0],s={css:o[1],media:o[2],sourceMap:o[3]};n[i]?n[i].parts.push(s):t.push(n[i]={id:i,parts:[s]})}return t}function u(){var e=document.createElement("style"),t=o();return e.type="text/css",t.appendChild(e),e}function c(e,t){var n,r,a,p,c;if(t.singleton){var l=s++;n=i||(i=u()),r=d.bind(null,n,l,!1),a=d.bind(null,n,l,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(p=document.createElement("link"),c=o(),p.rel="stylesheet",c.appendChild(p),n=p,r=v.bind(null,n),a=function(){n.parentNode.removeChild(n),n.href&&URL.revokeObjectURL(n.href)}):(n=u(),r=h.bind(null,n),a=function(){n.parentNode.removeChild(n)});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else a()}}e.exports=function(e,n){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");void 0===(n=n||{}).singleton&&(n.singleton=r());var o=p(e);return a(o,n),function(e){for(var r=[],i=0;i<o.length;i++){var s=o[i];(u=t[s.id]).refs--,r.push(u)}for(e&&a(p(e),n),i=0;i<r.length;i++){var u;if(0===(u=r[i]).refs){for(var c=0;c<u.parts.length;c++)u.parts[c]();delete t[u.id]}}}};var l,f=(l=[],function(e,t){return l[e]=t,l.filter(Boolean).join("\n")});function d(e,t,n,r){var o=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=f(t,o);else{var i=document.createTextNode(o),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(i,s[t]):e.appendChild(i)}}function h(e,t){var n=t.css,r=t.media;if(t.sourceMap,r&&e.setAttribute("media",r),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}function v(e,t){var n=t.css,r=(t.media,t.sourceMap);r&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var o=new Blob([n],{type:"text/css"}),i=e.href;e.href=URL.createObjectURL(o),i&&URL.revokeObjectURL(i)}},22620:(e,t,n)=>{var r=n(99882);"string"==typeof r&&(r=[[e.id,r,""]]),n(14246)(r,{}),r.locals&&(e.exports=r.locals)}}]);
3,649
3,649
0.655248
d3dfbab17605036f1739f0b7b527f546b911b17b
3,914
js
JavaScript
js/productwiseSaleReport.js
deshmukh14mayur/fgapi
dbd0e504f788381539541b919e4e65585a6178c5
[ "MIT" ]
null
null
null
js/productwiseSaleReport.js
deshmukh14mayur/fgapi
dbd0e504f788381539541b919e4e65585a6178c5
[ "MIT" ]
null
null
null
js/productwiseSaleReport.js
deshmukh14mayur/fgapi
dbd0e504f788381539541b919e4e65585a6178c5
[ "MIT" ]
null
null
null
stockTable =''; $(document).ready(function() { $.validator.setDefaults({ ignore: ":hidden:not(select)" }); $('#stockData').validate({}); var oTable; var purchaseTable; var sellTable; var returnTable; "use strict"; $('.daterange').daterangepicker({ ranges: { 'Today': [moment(), moment()], 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')], 'Last 7 Days': [moment().subtract(6, 'days'), moment()], 'Last 30 Days': [moment().subtract(29, 'days'), moment()], 'This Month': [moment().startOf('month'), moment().endOf('month')], 'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')] }, startDate: moment().subtract(29, 'days'), endDate: moment() }, function (start, end) { // window.alert("You chose: " + start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY')); }); $('input[name="date"]').on('change',function(){ getproductWiseSale(); }) $('select[name="Product_ID"]').on('change',function(){ getproductWiseSale(); }) callfunction(); }); function callfunction() { stockTable = $('#exampleStock').DataTable({ data:'', columns: [ { title: "Sales Type"}, { title: "Date"}, { title: "Reference"}, { title: "Total Pegs"}, { title: "Total Consumption (in ml)"}, { title: "Per Peg Price"}, { title: "Total Consumed Price"} ], dom: 'Bfrtip', buttons: [ 'excel',{ extend: 'print', text: 'Print', title:'Product Wise Sales Report', footer:true, message:'Date : '+$('input[name="date"]').val()+' \n\t Product : '+$('select[name="Product_ID"] option:selected').text()+'' },{ extend: 'pdfHtml5', text: 'PDF', footer:true, title:'Product Wise Sales Report', message:'Date : '+$('input[name="date"]').val()+'\nProduct : '+$('select[name="Product_ID"] option:selected').text()+'' } ], drawCallback: function() { var api = this.api(); var total_peg = api.column(3).data().sum(); var total_ml = api.column(4).data().sum(); var total_price = api.column(6).data().sum(); //var pageTotal = api.column(3, {page:'current'}).data().sum(); $('#total_peg').html("<h4>&nbsp;&nbsp;"+total_peg+"</h4>"); $('#total_ml').html("<h4>&nbsp;&nbsp;"+total_ml+" ml</h4>"); $('#total_price').html("<h4>Rs.&nbsp;&nbsp;"+total_price+"</h4>"); }, responsive: { details: { display: $.fn.dataTable.Responsive.display.modal( { header: function ( row ) { var data = row.data(); return 'Details for '+data[0]+' '+data[1]; } }), renderer: function ( api, rowIdx, columns ) { var data = $.map( columns, function ( col, i ) { return '<tr>'+ '<td>'+col.title+':'+'</td> '+ '<td>'+col.data+'</td>'+ '</tr>'; }).join(''); return $('<table class="table"/>').append( data ); } } } }); } function getproductWiseSale() { // $("#morris-line-chart").html("<div class='text-center text-danger'><h2>Loading........<h2><div>"); //alert($('#stockData').valid()); if($('#stockData').valid() == true) { var formdata=$("#stockData").serialize(); $.ajax({ data:formdata, type:'POST', datatype:JSON, url:base_url+"report/getproductWiseSale", success:function(response) { console.log(JSON.parse(response)); stockTable.destroy(); callfunction(); stockTable.clear().draw(); stockTable.rows.add(JSON.parse(response)).draw(); } }); } }
31.312
139
0.508176
d3dfe30d3e4b96854116745c0490ec694201f0ef
2,451
js
JavaScript
app/src/components/Dashboard/metrics/PerformanceChart.js
tywin1104/minecraft-whitelist
4e4dd3354d102ee718de5e4394f11db7da6adb03
[ "MIT" ]
11
2019-11-23T12:07:22.000Z
2022-01-21T11:48:59.000Z
app/src/components/Dashboard/metrics/PerformanceChart.js
tywin1104/minecraft-whitelist
4e4dd3354d102ee718de5e4394f11db7da6adb03
[ "MIT" ]
1
2019-12-16T10:25:37.000Z
2019-12-16T10:46:41.000Z
app/src/components/Dashboard/metrics/PerformanceChart.js
tywin1104/minecraft-whitelist
4e4dd3354d102ee718de5e4394f11db7da6adb03
[ "MIT" ]
3
2019-12-04T15:55:10.000Z
2021-12-26T21:18:23.000Z
import React, { useState } from "react"; import clsx from "clsx"; import PropTypes from "prop-types"; import { makeStyles } from "@material-ui/styles"; import { Card, CardHeader, CardContent, Divider, List, ListItem, ListItemAvatar, ListItemText } from "@material-ui/core"; const _createData = (name, count, averageResponseTimeInMinutes) => { return { name, count, averageResponseTimeInMinutes }; }; const _getTableRows = props => { let rows = []; if (props.aggregateStats != null) { let adminPerformance = props.aggregateStats.adminPerformance; const admins = Object.keys(props.aggregateStats.adminPerformance); admins.forEach(admin => { rows.push( _createData( admin, adminPerformance[admin].totalHandled, adminPerformance[admin].averageResponseTimeInMinutes ) ); }); } return rows; }; const useStyles = makeStyles(() => ({ root: { height: "30vh" }, content: { padding: 0 }, image: { height: 48, width: 48 }, actions: { justifyContent: "flex-end" } })); const PerformanceChart = props => { const { className, ...rest } = props; const classes = useStyles(); let data = _getTableRows(props); const admins = data; return ( <Card {...rest} className={clsx(classes.root, className)}> <CardHeader subtitle={`${admins.length} in total`} title="Server Admins Performance Overview" /> <Divider /> <CardContent className={classes.content}> <List> {admins.map((admin, i) => ( <ListItem divider={i < admins.length - 1}> <ListItemAvatar> <img alt="Avatar" className={classes.image} src={`https://ui-avatars.com/api/?name=${admin.name}`} /> </ListItemAvatar> <ListItemText primary={admin.name} secondary={`Handled ${admin.count} applications in total `} /> <ListItemText secondary={`Average response time is ${admin.averageResponseTimeInMinutes.toFixed( 1 )} minutes`} /> </ListItem> ))} </List> </CardContent> <Divider /> </Card> ); }; PerformanceChart.propTypes = { className: PropTypes.string }; export default PerformanceChart;
23.796117
98
0.567523
d3e072d196c19bdcdd910defc9647079eadb51b8
5,333
js
JavaScript
src/util/routeCalculators.js
alexcojocaru/cycle-route-profile
8733da2b4eee32b79d8d532604494f38849e1749
[ "MIT" ]
null
null
null
src/util/routeCalculators.js
alexcojocaru/cycle-route-profile
8733da2b4eee32b79d8d532604494f38849e1749
[ "MIT" ]
null
null
null
src/util/routeCalculators.js
alexcojocaru/cycle-route-profile
8733da2b4eee32b79d8d532604494f38849e1749
[ "MIT" ]
null
null
null
"use strict"; const _ = require("underscore"); const conversions = require("./mapsApiConversions"); const isWaypointWithinBounds = function (map, mapRect, waypoint, mouseEvent) { const waypointPosition = conversions.convertSimpleCoordinateToScreen(map, waypoint); // calculate the distance from the location of the event to the current waypoint; // the waypoint position is within the map bounds, // whereas the mouse event position is within the window bounds const distance = Math.sqrt( Math.pow(waypointPosition.x + mapRect.left - mouseEvent.clientX, 2) + Math.pow(waypointPosition.y + mapRect.top - mouseEvent.clientY, 2) ); return distance <= 5; // this is the radius (in pixels) of the waypoint marker }; /** * @descr find the waypoint (not global start, nor global finish) * within a 5px radius of the given mouse event location * @param {google.maps.Map} map - the Google Map object * @param {array} routes - the list of routes to search * @param {MouseEvent} mouseEvent - the Google mouse event * @return {object} - the first waypoint within range or null */ const findWaypointWithinBounds = function (map, routes, mouseEvent) { // all waypoints (except for the global start and finish points) into a flat array const waypoints = _.initial(_.rest( _.flatten(_.pluck(routes, "points")) )); const mapRect = map.getDiv().getBoundingClientRect(); const result = _.find( waypoints, waypoint => isWaypointWithinBounds(map, mapRect, waypoint, mouseEvent) ); return result; }; module.exports.findWaypointWithinBounds = findWaypointWithinBounds; /** * @desc Get the list of waypoints on the given route as a single list of simple waypoints. * The Google Maps API must be loaded for this function to work. * @param {google.maps.DirectionsRoute} route - a google route * @return {point[]} - a list of simple waypoint objects as {lat, lng} */ module.exports.getWaypointsList = function (route) { const waypoints = []; _.each(route.legs, leg => { // don't add the start if it's equal to the previous finish if (!leg.start_location.equals(_.last(waypoints))) { waypoints.push(leg.start_location); } _.each(leg.via_waypoints, waypoint => waypoints.push(waypoint)); waypoints.push(leg.end_location); }); // convert from google.maps.LatLng to {lat, lng} objects const simpleWaypoints = conversions.convertGoogleWaypointList(waypoints); return simpleWaypoints; }; /** * @desc Get the overview points list on the given route * as a single list of simple waypoints. * The Google Maps API must be loaded for this function to work. * @param {google.maps.DirectionsRoute} route - a google route * @return {point[]} - a list of simple point objects as {lat, lng} */ module.exports.getOverviewPointsList = function (route) { const points = route.overview_path; // convert from google.maps.LatLng to {lat, lng} objects const simplePoints = conversions.convertGoogleWaypointList(points); return simplePoints; }; /** * @desc Get the complete points list on the given route as a single list of simple waypoints. * The Google Maps API must be loaded for this function to work. * @param {google.maps.DirectionsRoute} route - a google route * @return {point[]} - a list of simple point objects as {lat, lng} */ module.exports.getCompletePointsList = function (route) { const points = []; _.each(route.legs, leg => { _.each(leg.steps, step => { if (step.path.length > 0) { // don't add the first point if it's equal to the previous last one if (!_.first(step.path).equals(_.last(points))) { points.push(_.first(step.path)); } points.push(..._.rest(step.path)); } }); }); // convert from google.maps.LatLng to {lat, lng} objects const simplePoints = conversions.convertGoogleWaypointList(points); return simplePoints; }; /** * @desc Get the instructions list on the given route. * The Google Maps API must be loaded for this function to work. * @param {google.maps.DirectionsRoute} route - a google route * @return {routeInstruction[]} - a list of route instructions */ module.exports.getRouteInstructionsList = function (route) { const instructions = []; _.each(route.legs, leg => { _.each(leg.steps, step => { if (_.isEmpty(step.instructions) === false) { instructions.push({ instructions: step.instructions, distance: step.distance ? step.distance.value : -1 }); } }); }); return instructions; }; /** * @descr Calculate the total distance between all the legs of the given route. * @param {google.maps.DirectionsRoute} route - a google route * @return {number} - the total distance in meters */ module.exports.totalDistance = function (route) { const overallDistance = _.reduce( route.legs, (distance, leg) => { const currentDistance = leg.distance ? leg.distance.value : 0; return distance + currentDistance; }, 0 ); return overallDistance; };
35.317881
94
0.657791
d3e117afc3ad6c7c12fb913d29f5a349076e5af5
201
js
JavaScript
react/lottery/src/network/apis/main.js
TurnerXi/learn
483768b5fa909ec12bd76d48064f29050017ba0e
[ "MIT" ]
null
null
null
react/lottery/src/network/apis/main.js
TurnerXi/learn
483768b5fa909ec12bd76d48064f29050017ba0e
[ "MIT" ]
5
2020-09-07T03:19:58.000Z
2022-02-26T17:22:52.000Z
react/lottery/src/network/apis/main.js
TurnerXi/learn
483768b5fa909ec12bd76d48064f29050017ba0e
[ "MIT" ]
null
null
null
import axios from '../axios.js' export default { async getLotteryIcons() { return await axios.get({ key: '0016' }); }, async getBanners() { return await axios.get({ key: '0000' }); } }
20.1
44
0.606965
d3e1e506560be3e31b0368d67ab1ba6002ccfccc
577
js
JavaScript
data/9576.js
stas-vilchik/bdd-ml
2a254419a7c40c2e9b48625be8ca78721f786d2b
[ "MIT" ]
null
null
null
data/9576.js
stas-vilchik/bdd-ml
2a254419a7c40c2e9b48625be8ca78721f786d2b
[ "MIT" ]
null
null
null
data/9576.js
stas-vilchik/bdd-ml
2a254419a7c40c2e9b48625be8ca78721f786d2b
[ "MIT" ]
null
null
null
{ if (parentVal === nativeWatch) { parentVal = undefined; } if (childVal === nativeWatch) { childVal = undefined; } if (!childVal) { return Object.create(parentVal || null); } if (!parentVal) { return childVal; } var ret = {}; extend(ret, parentVal); for (var key in childVal) { var parent = ret[key]; var child = childVal[key]; if (parent && !Array.isArray(parent)) { parent = [parent]; } ret[key] = parent ? parent.concat(child) : Array.isArray(child) ? child : [child]; } return ret; }
16.027778
47
0.561525
d3e2182196bc3ee60d30c62ae13d4e86a3e757fa
9,271
js
JavaScript
jLogger.js
pramodaug17/loggerJS
0fe17a72faeafa63e3d50d023187f5251303612e
[ "MIT" ]
null
null
null
jLogger.js
pramodaug17/loggerJS
0fe17a72faeafa63e3d50d023187f5251303612e
[ "MIT" ]
null
null
null
jLogger.js
pramodaug17/loggerJS
0fe17a72faeafa63e3d50d023187f5251303612e
[ "MIT" ]
null
null
null
/* * Logger module * TODO: Add filter feature in logger */ (function(global) { global.$log = (function() { var idlogger = "plogger"; var idstarttime = "start_time"; var tabid = "log_anchor"; var bufid = "logs_holder"; var buf = null; var bufbeforeload = []; var islogenabled = false; var initialized = false; var windiv = null; function createDiv() { return document.createElement("div"); } function createLoggerWindow() { let ldiv = createDiv(); ldiv.className = "log-window hide"; /* TODO: add option to first view as minimized */ ldiv.innerHTML = '<div class="log-tab" id="log_anchor">Log</div>'; ldiv.innerHTML += '<div class="log-div-title"> \ =======| Lite logger, started on \ <span id="start_time"></span> |======= \ </div>'; ldiv.innerHTML += '<div class="log-container"> \ <div class="log-entry-list" id="logs_holder"> \ </div></div>'; return ldiv; } function on(event, ele, cb, usecapture) { usecapture = usecapture || false; try { if (ele.addEventListener) { ele.addEventListener(event, cb, usecapture); //W3C } else { ele.attachEvent('on' + event, cb); //IE } } catch (e) {} } function tabclicked() { /* Toggle display of Log window */ let classes = this.parentNode.className.split(' '); if (-1 === classes.indexOf('hide')) { this.parentNode.className += ' hide'; } else { classes.splice(classes.indexOf('hide'), 1); this.parentNode.className = classes.join(' '); } } function initTab() { let tab = document.getElementById(tabid); on("click", tab, tabclicked); } function getDay(dt) { let days = [ "Sunday", "Monday", "Tueday", "Wednesday", "Thursday", "Friday", "Saturday" ]; return days[dt.getDay()] } function getDate(dt) { let months = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]; let date = ("0" + dt.getDate()).slice(-2); return (months[dt.getMonth()] + " " + date + ", " + dt.getFullYear()); } function getDaynDate(dt) { return (getDay(dt) + ", " + getDate(dt)); } function getTime(dt) { let hr = "0" + dt.getHours(); let min = "0" + dt.getMinutes(); let sec = "0" + dt.getSeconds(); return (hr.slice(-2) + ":" + min.slice(-2) + ":" + sec.slice(-2)); } function insertStartTime() { let now = new Date(); document.getElementById(idstarttime).innerText = getDate(now) + " " + getTime(now); } function initrest() { /* register logger event */ if (global.events) { events.registerEvent("log error"); events.on("log error", function(str) { error_log(str); }); events.registerEvent("log info"); events.on("log info", function(str) { info_log(str); }); events.registerEvent("log debug"); events.on("log debug", function(str) { debug_log(str); }); } /* Add event click event listener to open and close log window */ initTab(); /* Insert logging start time */ insertStartTime(); /* Get Log buffer div */ buf = document.getElementById(bufid); initialized = true; /* Insert buffer which is before page load */ bufbeforeload.forEach(function(div) { insertlog(div); }); /* TODO: custom scrollbar needs to add */ function scrollLogPage(e) { // get the old value of the translation (there has to be an easier way than this) var oldVal = parseInt(buf.style['margin-top']); // to make it work on IE or Chrome. double the variation var variation = parseInt(e.deltaY) * 2; /* update the body translation to simulate a scroll */ if (variation > 0) { /* For scroll down */ if (oldVal <= (this.clientHeight - buf.clientHeight)) { buf.style['margin-top'] = "" + (this.clientHeight - buf.clientHeight) + "px"; return false; } } else if (variation < 0) { /* For scroll up */ if (oldVal >= 0) { buf.style['margin-top'] = "0px"; return false; } } else { return false; } //debug_log("translateY(" + (oldVal - variation) + "px"); buf.style['margin-top'] = "" + (oldVal - variation) + "px"; return false; } /* Register scroll event */ on("scroll", buf, function(e) { e.stopPropagation(); return false; }, false); on("scroll", buf.parentNode, function(e) { //scrollLogPage(e); e.stopPropagation(); return false; }, false); on("scroll", buf.parentNode.parentNode, function(e) { e.stopPropagation(); return false; }, false); on("mousewheel", buf.parentNode, function(e) { scrollLogPage.apply(this, [e]); e.stopPropagation(); return false; }, false); } function initonload() { document.body.appendChild(windiv); initrest(); } function init_logger(opt) { opt = opt || {}; windiv = document.getElementById(idlogger); if (!windiv) { windiv = createLoggerWindow(); try { islogenabled = true; document.body.appendChild(windiv); initrest(); } catch (e) { on("load", window, initonload); return; } } else { console.log("Logger is not initialize!!"); return; } } function getEntryDiv(now, logstr) { let div = createDiv(); let entry = ""; entry += '<span class="log-time">' + getTime(now) + '</span>'; entry += '<span class="log-text">' + logstr + '</span>'; div.innerHTML = entry; return div; } function insertlog(log) { if (initialized) { buf.appendChild(log); /* scroll to bottom */ buf.style['margin-top'] = (buf.parentNode.clientHeight < buf.clientHeight) ? (buf.parentNode.clientHeight - buf.clientHeight) + "px" : "0"; } else { bufbeforeload.push(log); } } function error_log(logstr) { if (!islogenabled) return; let entrydiv = getEntryDiv((new Date), logstr); entrydiv.className = "log-entry log-error"; insertlog(entrydiv); } function info_log(logstr) { if (!islogenabled) return; let entrydiv = getEntryDiv((new Date), logstr); entrydiv.className = "log-entry log-info"; insertlog(entrydiv); } function debug_log(logstr) { if (!islogenabled) return; let entrydiv = getEntryDiv((new Date), logstr); entrydiv.className = "log-entry log-debug"; insertlog(entrydiv); } function enable_log() { islogenabled = true; } function disable_log() { islogenabled = false; } return { init: init_logger, error: error_log, info: info_log, debug: debug_log, enable: enable_log, disable: disable_log } })(); })(window); /*$log.init(); for(let i = 11; i ; i--) { if(0 === (i % 3)) $log.info("This is info log == " + i); if(1 === (i % 3)) $log.debug("This is debug log == " + i); if(2 === (i % 3)) $log.error("This is error log == " + i); }*/
31.110738
101
0.440837
d3e2bc4cfcb27580ff7fd54f576026b776286544
347
js
JavaScript
src/services/admin/deleteOneUser.service.js
PickHD/inditeminds-api
bbbf685a4b5466cfdb1d99a9b8faf491249d1fd3
[ "MIT" ]
null
null
null
src/services/admin/deleteOneUser.service.js
PickHD/inditeminds-api
bbbf685a4b5466cfdb1d99a9b8faf491249d1fd3
[ "MIT" ]
null
null
null
src/services/admin/deleteOneUser.service.js
PickHD/inditeminds-api
bbbf685a4b5466cfdb1d99a9b8faf491249d1fd3
[ "MIT" ]
null
null
null
"use strict" const User = require("../../models/User.model") const deleteOneUserService = async (userId) => { try { const tempDelOneUser = await User.findOneAndDelete({ _id: userId }) return tempDelOneUser === null ? null : "User Deleted Successfully" } catch (e) { throw new Error(e) } } module.exports = deleteOneUserService
24.785714
71
0.680115
d3e39a5023f5ab80af6ae27447c3086be211d730
3,982
js
JavaScript
src/routes/Offer/components/OfferForm/OfferFormSecondStep.js
raulingg/g2g
e53163b78ab1babc3670c29a58511b97ca9ecad4
[ "MIT" ]
1
2019-01-10T16:37:15.000Z
2019-01-10T16:37:15.000Z
src/routes/Offer/components/OfferForm/OfferFormSecondStep.js
raulingg/g2g
e53163b78ab1babc3670c29a58511b97ca9ecad4
[ "MIT" ]
19
2019-01-19T17:10:25.000Z
2019-06-21T23:24:41.000Z
src/routes/Offer/components/OfferForm/OfferFormSecondStep.js
raulingg/g2g
e53163b78ab1babc3670c29a58511b97ca9ecad4
[ "MIT" ]
null
null
null
import React from 'react' import PropTypes from 'prop-types' import MenuItem from '@material-ui/core/MenuItem' import TextField from '@material-ui/core/TextField' import Paper from '@material-ui/core/Paper' import InputField from 'components/InputField' const OfferFormSecondStep = ({ offerClasses, offerItemTypes, offerTypes, offerClothes, offerItemMaxLevel, offerCreatureMaxLevel, values, touched, errors, handleChange, handleBlur, classes }) => ( <div className={classes.root}> <Paper className={classes.panel}> <h3>Tipo de oferta</h3> <InputField data-test="OfferTypeInput" name="offerType" select label="Tipo de oferta" onChange={handleChange} onBlur={handleBlur} values={values} touched={touched} errors={errors} fullWidth className={classes.inputField}> {Object.keys(offerTypes).map(key => ( <MenuItem key={key} value={key} data-test={`offerTypeOption-${key}`}> {offerTypes[key]} </MenuItem> ))} </InputField> </Paper> {values.offerType === 'ONLY' && ( <Paper className={classes.panel}> <h3>Datos sobre el item</h3> <div className={classes.itemSelectGroup}> <TextField data-test="itemTypeInput" id="itemType" name="itemType" select label="Tipo de item" value={values.itemType} onChange={handleChange} onBlur={handleBlur} error={touched.itemType && Boolean(errors.itemType)} helperText={errors.itemType} className={classes.selectField}> {Object.keys(offerItemTypes).map(key => ( <MenuItem key={key} value={key}> {offerItemTypes[key]} </MenuItem> ))} </TextField> {offerClothes.hasOwnProperty(values.itemType) && ( <TextField data-test="itemClassInput" id="itemClass" name="itemClass" select label="Clase" value={values.itemClass} onChange={handleChange} onBlur={handleBlur} error={touched.itemClass && Boolean(errors.itemClass)} helperText={errors.itemClass} className={classes.selectField}> {Object.keys(offerClasses).map(key => ( <MenuItem key={key} value={key}> {offerClasses[key]} </MenuItem> ))} </TextField> )} <TextField data-test="itemLevelInput" id="itemLevel" name="itemLevel" select label="Level" value={values.itemLevel} onChange={handleChange} onBlur={handleBlur} error={touched.itemLevel && Boolean(errors.itemLevel)} helperText={errors.itemLevel} className={classes.selectField}> {Array.from( Array( values.itemType === 'CREATURE' ? offerCreatureMaxLevel : offerItemMaxLevel ).keys() ).map(level => ( <MenuItem key={level} value={level}> +{level} </MenuItem> ))} </TextField> </div> </Paper> )} </div> ) OfferFormSecondStep.propTypes = { offerClasses: PropTypes.object.isRequired, offerItemTypes: PropTypes.object.isRequired, offerTypes: PropTypes.object.isRequired, offerClothes: PropTypes.object.isRequired, offerCreatureMaxLevel: PropTypes.number.isRequired, offerItemMaxLevel: PropTypes.number.isRequired, values: PropTypes.object.isRequired, touched: PropTypes.object.isRequired, errors: PropTypes.object.isRequired, classes: PropTypes.object.isRequired } export default OfferFormSecondStep
30.630769
79
0.565545
d3e3aa5747e771611b542ad55c7965eb455790b1
245
js
JavaScript
client/components/landing-page.js
Team-One-Grace-Shopper/GraceShopper
9b92dcc55b5314526f85be95910b6f878d349e10
[ "MIT" ]
null
null
null
client/components/landing-page.js
Team-One-Grace-Shopper/GraceShopper
9b92dcc55b5314526f85be95910b6f878d349e10
[ "MIT" ]
46
2020-06-15T16:47:24.000Z
2021-05-11T17:43:29.000Z
client/components/landing-page.js
Team-One-Grace-Shopper/GraceShopper
9b92dcc55b5314526f85be95910b6f878d349e10
[ "MIT" ]
2
2020-06-28T01:18:08.000Z
2020-07-16T06:45:39.000Z
import React from 'react' /** * COMPONENT */ export const LandingPage = props => { console.log('Landing page props:', props) return ( <div> <h3>Masks galore!</h3> <p>Just a placeholder landing page...</p> </div> ) }
16.333333
47
0.583673
d3e3d071b89813dee426e90b737c5b39c5f03941
4,852
js
JavaScript
comandos/buy.js
WypalaczRun/FiveMDiscordBOT
6b822ad30f99d21027e12f5fcf1fa34c626ec990
[ "MIT" ]
null
null
null
comandos/buy.js
WypalaczRun/FiveMDiscordBOT
6b822ad30f99d21027e12f5fcf1fa34c626ec990
[ "MIT" ]
null
null
null
comandos/buy.js
WypalaczRun/FiveMDiscordBOT
6b822ad30f99d21027e12f5fcf1fa34c626ec990
[ "MIT" ]
null
null
null
const { MessageEmbed } = require('discord.js'); const mercadopago = require("../utils/mercadopago.js"); const randString = require("../utils/generateString.js"); exports.run = async (client, message, args) => { const erro = new MessageEmbed() .setTitle(`Uso incorreto`) .setDescription(`!buy <script>`) .setColor(0x00ae86) .setTimestamp(); if (!args[0]) { return message.channel.send(erro); } else if (message.guild.channels.cache.find(channel => channel.name === `ticket-${message.author.id}`) ) { return message.reply('Você já tem um ticket criado, feche o antigo para abrir um novo!'); }; client.db.query( `SELECT name, price FROM scripts WHERE name = "${args[0]}"`, async (err, rows) => { if (!rows || rows.length === 0) { return message.channel.send( `:x: **Este script não existe!** ` ); } else { let everyoneRole = await message.guild.roles.cache.find(r => r.name === "@everyone") let equipeRole = await message.guild.roles.cache.find(r => r.name === "Equipe") message.guild.channels.create(`ticket-${message.author.id}`, { permissionOverwrites: [{ id: message.author.id, allow: ['SEND_MESSAGES', 'VIEW_CHANNEL', 'READ_MESSAGE_HISTORY'], }, { id: equipeRole.id, allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "READ_MESSAGE_HISTORY", "MANAGE_MESSAGES"] }, { id: everyoneRole.id, deny: ['VIEW_CHANNEL'], }, ], type: 'text', parent: "870979776507170817", }).then(async channel => { var preference = { items: [ { title: rows[0].name, quantity: 1, currency_id: 'BRL', unit_price: rows[0].price } ], external_reference : randString(20), }; const req = await mercadopago.preferences.create(preference) message.channel.send(`:white_check_mark: **Pedido criado!**`); const embed = new MessageEmbed() .setTitle(message.author.username) .setDescription(`Olá.\nAgradecemos por estar realizando o pedido de **${args[0]}**.\nAguarde até um de nossos membros da Equipe lhe atender.\n\n**Pague utilizando o link abaixo**\n${req.body.init_point}\n\n**Métodos de Pagamento**\n- MercadoPago\n- PIX\n- PicPay\n\nApós efetuar o pagamento, realize uma captura de tela e envie aqui no canal junto com o seu **nome e email**.\n\n**Para fechar este ticket, reaja com 🔒.**`) .setColor(0x00ae86) .setTimestamp(); channel.send(embed).then(async m => { client.db.query(`INSERT INTO payments (discordid, channelid, paymentid, script, status) VALUES (${message.author.id}, ${channel.id}, "${req.body.external_reference}", "${rows[0].name}", "created")`) m.react('🔒'); const filter = (reaction, user) => reaction.emoji.name && user.id === message.author.id; const collector = m.createReactionCollector(filter); collector.on('collect', async r => { switch (r.emoji.name) { case '🔒': channel.updateOverwrite(message.author.id, { VIEW_CHANNEL: false, SEND_MESSAGES: false, ATTACH_FILES: false, READ_MESSAGE_HISTORY: false, }).then(() => { channel.send(`Successfully closed ${channel.name}`); }); break; } }) }); }); } }); }, exports.config = { nome: 'buy', descricao: 'Inicia a compra de um script', aliases: [], }
53.318681
448
0.432605
d3e3f50382ed2154879d957fbd9d54cb1918f499
3,843
js
JavaScript
interes_compuesto.js
Mooenz/javascript-portafolio
4ec26598d62be88adbc7b0e918e7a567606ad7e1
[ "MIT" ]
1
2021-08-06T01:17:02.000Z
2021-08-06T01:17:02.000Z
interes_compuesto.js
Mooenz/Portafolio-Javascript
4ec26598d62be88adbc7b0e918e7a567606ad7e1
[ "MIT" ]
null
null
null
interes_compuesto.js
Mooenz/Portafolio-Javascript
4ec26598d62be88adbc7b0e918e7a567606ad7e1
[ "MIT" ]
null
null
null
/** Interes Compuesto: El interés compuesto te sirve para generar más dinero gracias a los intereses que generas, es decir, hace que el valor que se paga por intereses se vaya aumentando mes a mes, * por que el dinero sobre el cuál se hace el cálculo del interés se incrementa cada vez que se liquidan los respectivos intereses que ganaste el mes previo. * Crea una calculadora que te diga cuánto vas a tener en 6 meses, 1 año y 2 años al ahorrar 100 dólares con una tasa de interés a tu favor del 4%. * * ¿Qué pasaría sí?: Siguiendo con el reto anterior de ¿Cuanto vas a ahorrar?: * Ahora quiero que le agregues a tu programa de interés compuesto la capacidad de variar el valor inicial de tu ahorro. * * ¿Puedo ahorrar otros periodos de tiempo?: Tu banco quiere permitirte ahorrar en nuevos intérvalos de tiempo que tú eleijas, * agrega la funcionalidad a tu calculadora de interés compuesto de poner una cantidad de meses de ahorro variable. * * ¿Puedo ahorrar en otros bancos?:Te llegó un correo de un banco rival diciéndote que ellos te ofrecen un 3% de interés plus un 7% extra año con año * ¿Cuál de los dos bancos te conviene más para un año de ahorro?¿Cuál para 2?¿Cuál para 3? */ const taza_interes_banpolombia = 4 / 100; const taza_interes_banco_oriente = 3 / 100; const taza_interes_plus = 7 / 100; const interesCompuestoBancoOriente = (capital_compuesto, tiempo) => { let contador = tiempo; let ahorro_banco_oriente; if (contador > 0) { ahorro_banco_oriente = capital_compuesto * Math.pow(1 + taza_interes_banco_oriente/1, tiempo); capital_compuesto = ahorro_banco_oriente; contador = contador - 1; interesCompuestoBancoOriente(capital_compuesto, contador); } if (tiempo >= 1) { ahorro_banco_oriente = ahorro_banco_oriente * Math.pow(1 + taza_interes_plus, tiempo); } return ahorro_banco_oriente } const interesCompuestoBanpolombia = (capital_compuesto, tiempo) => { let contador = tiempo; let ahorro_banpolombia; if (contador > 0) { ahorro_banpolombia = capital_compuesto * Math.pow(1 + taza_interes_banpolombia/1, tiempo); capital_compuesto = ahorro_banpolombia; contador = contador - 1; interesCompuestoBanpolombia(capital_compuesto, contador); } return ahorro_banpolombia; } const mensaje = (ahorro, banco, tiempo) => `El total ahorrado en ${banco} fue de $${ahorro.toFixed(2)} en ${tiempo} años`; const interesCompuesto = (capital_compuesto, tiempo) => { const banco_oriente = interesCompuestoBancoOriente(capital_compuesto, tiempo), banpolombia = interesCompuestoBanpolombia(capital_compuesto, tiempo); let mejor_banco; if (banpolombia > banco_oriente) { mejor_banco = 'Banpolombia'; } else { mejor_banco = 'Banco Oriente'; } return `${mensaje(banpolombia, 'Banpolombia', tiempo)} y ${mensaje(banco_oriente, 'Banco oriente', tiempo)} y la mejor opcion es ${mejor_banco}.` } console.log(interesCompuesto(100, 0.6)); console.log(interesCompuesto(100, 1)); console.log(interesCompuesto(100, 2)); console.log(interesCompuesto(100, 3)); /*console.log(interesCompuesto(100, 36));*/ /** Solucion * El total ahorrado en Banpolombia fue de $102.38 en 0.6 años y El total ahorrado en Banco oriente fue de $101.79 en 0.6 años y la mejor opcion es Banpolombia. * El total ahorrado en Banpolombia fue de $104.00 en 1 años y El total ahorrado en Banco oriente fue de $110.21 en 1 años y la mejor opcion es Banco Oriente. * El total ahorrado en Banpolombia fue de $108.16 en 2 años y El total ahorrado en Banco oriente fue de $121.46 en 2 años y la mejor opcion es Banco Oriente. * El total ahorrado en Banpolombia fue de $112.49 en 3 años y El total ahorrado en Banco oriente fue de $133.86 en 3 años y la mejor opcion es Banco Orientes. */
50.565789
199
0.73172
d3e544310502c2a62f95a91c10d73277a919a1e8
1,869
js
JavaScript
src/js/audio-reactive-mesh.js
oampo/siren-song
72b789886b2806a635a51992e21ca3816eb4cc4c
[ "MIT" ]
2
2017-11-13T21:43:35.000Z
2021-06-01T20:47:55.000Z
src/js/audio-reactive-mesh.js
oampo/siren-song
72b789886b2806a635a51992e21ca3816eb4cc4c
[ "MIT" ]
null
null
null
src/js/audio-reactive-mesh.js
oampo/siren-song
72b789886b2806a635a51992e21ca3816eb4cc4c
[ "MIT" ]
1
2016-06-13T21:22:52.000Z
2016-06-13T21:22:52.000Z
var AudioReactiveMesh = {}; AudioReactiveMesh.initAudioReactiveMesh = function() { this.lastChannel = null; this.channelPosition = 0; this.framesPerChannel = 0; this.initVertices(); }; AudioReactiveMesh.initVertices = function() { var vertexBuffer = this.mesh.vertexBuffer.array; var dTheta = 2 * Math.PI / (this.numberOfPoints - 1); for (var i = 0; i < this.numberOfPoints; i++) { var theta = i * dTheta; var index = i * 3; vertexBuffer[index + 0] = this.radius * Math.sin(theta); vertexBuffer[index + 1] = this.radius * Math.cos(theta); vertexBuffer[index + 2] = 0; } this.mesh.vertexBuffer.setValues(); }; AudioReactiveMesh.updateVertices = function(channel) { var vertexBuffer = this.mesh.vertexBuffer.array; var dTheta = 2 * Math.PI / (this.numberOfPoints - 1); var zeroCrossing = 0; var last = 0; while (zeroCrossing < channel.length) { var value = channel[zeroCrossing]; if (channel[zeroCrossing] == 0) { break; } else if (channel[zeroCrossing] < 0) { if (last > 0) { break; } } last = value; zeroCrossing += 1; } for (var i = 0; i < this.numberOfPoints; i++) { var theta = i * dTheta; var index = i * 3; // var audioIndex = Math.floor(i * channel.length / this.numberOfPoints); var audioIndex = Math.floor((zeroCrossing + i) * channel.length / this.numberOfPoints) % channel.length; var sample = channel[audioIndex] * 0.1; vertexBuffer[index + 0] = this.radius * (Math.sin(theta) + sample); vertexBuffer[index + 1] = this.radius * (Math.cos(theta) + sample); vertexBuffer[index + 2] = 0; } this.mesh.vertexBuffer.setValues(); }; module.exports = AudioReactiveMesh;
29.203125
112
0.59283
d3e5b0c83c92272313ebec292697a7000de0b2c2
120
js
JavaScript
documentation/index.js
bildja/react-spring
62d07a9098aa2e23cda04a19dd948cb96a322273
[ "MIT" ]
null
null
null
documentation/index.js
bildja/react-spring
62d07a9098aa2e23cda04a19dd948cb96a322273
[ "MIT" ]
null
null
null
documentation/index.js
bildja/react-spring
62d07a9098aa2e23cda04a19dd948cb96a322273
[ "MIT" ]
null
null
null
import createContext from 'immer-wieder' const { Provider, Consumer } = createContext() export { Provider, Consumer }
20
46
0.75
d3e5f8203459344e7186491b168422b947aa9e98
374
js
JavaScript
packages/components/bolt-video/utils/dataset-to-object.js
vercel-support/bolt-test
50ff0def16cf63589978a3f95f2e959b075eb295
[ "MIT" ]
1
2020-03-05T00:23:58.000Z
2020-03-05T00:23:58.000Z
packages/components/bolt-video/utils/dataset-to-object.js
vercel-support/bolt-test
50ff0def16cf63589978a3f95f2e959b075eb295
[ "MIT" ]
null
null
null
packages/components/bolt-video/utils/dataset-to-object.js
vercel-support/bolt-test
50ff0def16cf63589978a3f95f2e959b075eb295
[ "MIT" ]
1
2021-07-15T07:51:51.000Z
2021-07-15T07:51:51.000Z
import dasherize from 'dasherize'; // Loop through any extra (unknown) data attributes on the main element; copy over to the <video> tag being rendered export function datasetToObject(elem) { var data = {}; [].forEach.call(elem.attributes, function(attr) { if (/^data-/.test(attr.name)) { data[dasherize(attr.name)] = attr.value; } }); return data; }
28.769231
116
0.676471
d3e61f88996feb9a749cb93c0d69ebeb334a88ba
4,350
js
JavaScript
packages/concise/src/__tests__/preprocessSchema.test.js
guigrpa/concise
e0c5b38aa0ba4328306eb6998bee50469504dc73
[ "Unlicense", "MIT" ]
9
2017-03-22T16:10:47.000Z
2022-02-09T20:50:44.000Z
packages/concise/src/__tests__/preprocessSchema.test.js
guigrpa/concise
e0c5b38aa0ba4328306eb6998bee50469504dc73
[ "Unlicense", "MIT" ]
3
2021-01-26T16:36:49.000Z
2021-09-01T08:10:22.000Z
packages/concise/src/__tests__/preprocessSchema.test.js
guigrpa/concise
e0c5b38aa0ba4328306eb6998bee50469504dc73
[ "Unlicense", "MIT" ]
3
2017-05-19T10:00:03.000Z
2018-11-09T08:42:15.000Z
/* eslint-env jest */ import preprocessSchema from '../preprocessSchema'; describe('preprocessSchema', () => { it('respects unknown schema attributes', () => { const processedSchema = preprocessSchema({ models: { person: { fields: { name: { type: 'string', foo: 3 }, }, foo: 3, }, }, schemaFoo: 5, }); expect(processedSchema).toMatchSnapshot(); }); it('processes included fields', () => { const processedSchema = preprocessSchema({ models: { common: { isIncludeOnly: true, fields: { id: { type: 'string' } }, }, person: { includes: { common: true }, fields: { name: { type: 'string' }, }, }, }, }); expect(processedSchema).toMatchSnapshot(); }); it('processes a shorthand relation', () => { const schema = { models: { person: { fields: { id: { type: 'string' } }, }, post: { fields: { id: { type: 'string' } }, relations: { person: true, }, }, }, }; const processedSchema = preprocessSchema(schema); expect(processedSchema).toMatchSnapshot(); // Alternatively, the relation can be defined as an empty object schema.models.post.relations.person = {}; expect(preprocessSchema(schema)).toEqual(processedSchema); }); it('sets the right name on a shorthand plural relation', () => { const schema = { models: { person: { fields: { id: { type: 'string' } }, relations: { posts: { isPlural: true } }, }, post: { fields: { id: { type: 'string' } }, }, }, }; const processedSchema = preprocessSchema(schema); expect(processedSchema).toMatchSnapshot(); }); it('completes custom relations', () => { const schema = { models: { person: { fields: { id: { type: 'string' } }, }, post: { fields: { id: { type: 'string' } }, relations: { author: { model: 'person', isRequired: true }, }, }, }, }; const processedSchema = preprocessSchema(schema); expect(processedSchema).toMatchSnapshot(); // must be immutable! expect(processedSchema).not.toBe(schema); }); it('allows disabling inverse relations', () => { const processedSchema = preprocessSchema({ models: { person: { fields: { id: { type: 'string' } }, }, post: { fields: { id: { type: 'string' } }, relations: { person: { inverse: false, }, }, }, }, }); expect(processedSchema).toMatchSnapshot(); }); it('allows custom inverse relations (name)', () => { const processedSchema = preprocessSchema({ models: { person: { fields: { id: { type: 'string' } }, }, post: { fields: { id: { type: 'string' } }, relations: { person: { inverse: { name: 'createdPosts' }, }, }, }, }, }); expect(processedSchema).toMatchSnapshot(); }); it('allows custom inverse relations (singular)', () => { const processedSchema = preprocessSchema({ models: { person: { fields: { id: { type: 'string' } }, }, address: { fields: { id: { type: 'string' } }, relations: { person: { inverse: { isPlural: false }, }, }, }, }, }); expect(processedSchema).toMatchSnapshot(); }); it('does not modify the original schema', () => { const schema = { models: { person: { fields: { id: { type: 'string' } }, }, address: { fields: { id: { type: 'string' } }, relations: { person: true }, }, }, }; preprocessSchema(schema); expect(schema).toEqual({ models: { person: { fields: { id: { type: 'string' } }, }, address: { fields: { id: { type: 'string' } }, relations: { person: true }, }, }, }); }); });
24.301676
68
0.464828
d3e8034ecff0fe9ecf062e42fc81e38af5ec4341
441
js
JavaScript
utils.js
tiaanduplessis/stat-fns
177ed49d7ae580f9c0563d4d311707a5c806c309
[ "MIT" ]
null
null
null
utils.js
tiaanduplessis/stat-fns
177ed49d7ae580f9c0563d4d311707a5c806c309
[ "MIT" ]
null
null
null
utils.js
tiaanduplessis/stat-fns
177ed49d7ae580f9c0563d4d311707a5c806c309
[ "MIT" ]
null
null
null
function sortNumber (a, b) { return a - b } module.exports = { format (val, sep = ' ') { if (Array.isArray(val)) { return val.map(Number).sort(sortNumber) } if (typeof val === 'string') { return val .split(sep) .map(Number) .sort(sortNumber) } throw new ReferenceError( `formatSample expected a delimter seperated string or array of numbers, but got ${val}` ) } }
17.64
93
0.566893
d3e853c93a40fe1c132b80e32a28f98e302e466e
1,582
js
JavaScript
src/components/UIComponents/Icon.js
gusmendez99/Azen-Store-Mobile
bf5dda995c187cdb94725f489e0628fed9f31fb7
[ "PostgreSQL", "MIT" ]
null
null
null
src/components/UIComponents/Icon.js
gusmendez99/Azen-Store-Mobile
bf5dda995c187cdb94725f489e0628fed9f31fb7
[ "PostgreSQL", "MIT" ]
null
null
null
src/components/UIComponents/Icon.js
gusmendez99/Azen-Store-Mobile
bf5dda995c187cdb94725f489e0628fed9f31fb7
[ "PostgreSQL", "MIT" ]
null
null
null
import React from 'react'; import { createIconSetFromIcoMoon } from 'react-native-vector-icons'; import PropTypes from 'prop-types'; import CustomTheme, { withTheme } from '../../theme'; import getIconType from '../../helpers/getIconType'; import themeConfig from '../../config/theme.json'; const Theme = createIconSetFromIcoMoon(themeConfig, 'Theme', '../../fonts/theme.ttf'); // Theme Fonts have to be linked with 'react-native link' if you're using react-native-cli // Theme Fonts have to loaded with Fonts.loadAsync if you're // using Expo (you can export ThemeFont from index in order to import it) function Icon({ name, family, size, color, styles, theme, ...rest }) { if (family === 'Theme') { if (name) { return ( <Theme name={name} size={size || theme.SIZES.BASE} color={color || theme.COLORS.BLACK} {...rest} /> ); } } else { const IconInstance = getIconType(family); if (name && IconInstance) { return ( <IconInstance name={name} size={size || theme.SIZES.BASE} color={color || theme.COLORS.BLACK} {...rest} /> ); } } return null; } Icon.defaultProps = { name: null, family: null, size: null, color: null, styles: {}, theme: CustomTheme, }; Icon.propTypes = { name: PropTypes.string.isRequired, family: PropTypes.string.isRequired, size: PropTypes.number, color: PropTypes.string, styles: PropTypes.any, theme: PropTypes.any, }; export default withTheme(Icon);
22.28169
90
0.616308
d3e88c37e7ae62c7551a56e528068a2b9cfa538f
2,000
js
JavaScript
cardinal/p-s6iiwoeb.entry.js
Pavi319/pavi319.github.io
d1061c04f4359f587171d8fe3b418a113bf56bae
[ "MIT" ]
null
null
null
cardinal/p-s6iiwoeb.entry.js
Pavi319/pavi319.github.io
d1061c04f4359f587171d8fe3b418a113bf56bae
[ "MIT" ]
null
null
null
cardinal/p-s6iiwoeb.entry.js
Pavi319/pavi319.github.io
d1061c04f4359f587171d8fe3b418a113bf56bae
[ "MIT" ]
null
null
null
import{r as t,g as e,h as r}from"./p-a1b3783e.js";import"./p-a4bfa1a2.js";import{a as s,s as i}from"./p-5eef8cc8.js";import{T as a}from"./p-a0ba8b88.js";import{C as l}from"./p-f30844a3.js";const o=class{constructor(e){t(this,e),this.chapterList=[]}connectedCallback(){this.pskPageElement=s(e(this),"psk-page")}tocReceived(t){t.detail&&(this.chapterList=this._sortChapters([...t.detail]))}_sortCurrentChapter(t,e){if(0===t.children.length)return t;let r=[];for(let s=0;s<e.length;++s){let i=t.children.find(t=>t.guid===e[s]);i&&(e.splice(s--,1),r.push(this._sortCurrentChapter(i,e)))}return Object.assign(Object.assign({},t),{children:r})}_sortChapters(t){const e=this.pskPageElement.querySelectorAll("psk-chapter"),r=[];e.forEach(t=>{t.hasAttribute("data-define-props")||t.hasAttribute("data-define-controller")||t.hasAttribute("data-define-events")||!t.hasAttribute("guid")||r.push(t.getAttribute("guid"))});let s=[];for(let i=0;i<r.length;++i){let e=t.find(t=>t.guid===r[i]);e&&(r.splice(i--,1),s.push(this._sortCurrentChapter(e,r)))}return s}_renderChapters(t,e,s){return e.map((e,a)=>{let l=void 0===s?"Ceva Ceva":`${s}${a+1}.Altceva Altceva`;return r("li",{onClick:r=>{r.stopImmediatePropagation(),r.preventDefault(),i(e.title,t)}},r("span",null,`${l} ${e.title}`),0===e.children.length?null:r("ul",null,this._renderChapters(t,e.children,l)))})}render(){return r("div",{class:"table-of-content"},r("psk-card",{title:this.title},r("ul",null,this._renderChapters(this.pskPageElement,this.chapterList))))}};!function(t,e,r,s){var i,a=arguments.length,l=a<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(t,e,r,s);else for(var o=t.length-1;o>=0;o--)(i=t[o])&&(l=(a<3?i(l):a>3?i(e,r,l):i(e,r))||l);a>3&&l&&Object.defineProperty(e,r,l)}([l(),a({description:"This property is the title of the psk-card that will be created",isMandatory:!1,propertyType:"string"})],o.prototype,"title",void 0);export{o as psk_toc};
2,000
2,000
0.6995
d3e8b714d2dfe082828d5f542131349a8a4829a8
309
js
JavaScript
node_modules/@iconify/icons-ic/outline-king-bed.js
kagwicharles/Seniorproject-ui
265956867c8a00063067f03e8772b93f2986c626
[ "MIT" ]
null
null
null
node_modules/@iconify/icons-ic/outline-king-bed.js
kagwicharles/Seniorproject-ui
265956867c8a00063067f03e8772b93f2986c626
[ "MIT" ]
null
null
null
node_modules/@iconify/icons-ic/outline-king-bed.js
kagwicharles/Seniorproject-ui
265956867c8a00063067f03e8772b93f2986c626
[ "MIT" ]
1
2021-09-28T19:15:17.000Z
2021-09-28T19:15:17.000Z
var data = { "body": "<path d=\"M22 12c0-1.1-.9-2-2-2V7c0-1.1-.9-2-2-2H6c-1.1 0-2 .9-2 2v3c-1.1 0-2 .9-2 2v5h1.33L4 19h1l.67-2h12.67l.66 2h1l.67-2H22v-5zm-4-2h-5V7h5v3zM6 7h5v3H6V7zm-2 5h16v3H4v-3z\" fill=\"currentColor\"/>", "width": 24, "height": 24 }; exports.__esModule = true; exports.default = data;
38.625
213
0.656958
d3e9218ef3d76cfc9eca1f770710142c626887c9
1,071
js
JavaScript
node_modules/snyk-docker-plugin/node_modules/snyk-nodejs-lockfile-parser/dist/cli-parsers/yarn-info-parser.js
MeLLoN9/MoonsDust
36fa563545a642172a6ba6b865ebc0e111176694
[ "MIT" ]
3
2021-08-24T18:02:23.000Z
2022-01-13T05:42:37.000Z
node_modules/snyk-docker-plugin/node_modules/snyk-nodejs-lockfile-parser/dist/cli-parsers/yarn-info-parser.js
MoonsDusts/MoonsDust
36fa563545a642172a6ba6b865ebc0e111176694
[ "MIT" ]
null
null
null
node_modules/snyk-docker-plugin/node_modules/snyk-nodejs-lockfile-parser/dist/cli-parsers/yarn-info-parser.js
MoonsDusts/MoonsDust
36fa563545a642172a6ba6b865ebc0e111176694
[ "MIT" ]
null
null
null
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.parseYarnInfoOutput = void 0; const parseYarnInfoOutput = (rawYarnInfoOutput) => { const formattedYarnInfo = rawYarnInfoOutput .split('\n') .filter(Boolean) .map((el) => JSON.parse(el)); const formattedInfoOutput = formattedYarnInfo.reduce((result, { value, children }) => { var _a; const dependencies = ((_a = children.Dependencies) === null || _a === void 0 ? void 0 : _a.map((el) => el.locator.replace(/@virtual:.*#/, '@'))) || []; return result.set(value, dependencies); }, new Map()); const rootWorkspaceKey = [...formattedInfoOutput.keys()].find((el) => el.includes('@workspace:.')); const topLevelDeps = formattedInfoOutput.get(rootWorkspaceKey) || []; // Now we have rootdeps we delete the key formattedInfoOutput.delete(rootWorkspaceKey); return { topLevelDeps, dependencies: formattedInfoOutput }; }; exports.parseYarnInfoOutput = parseYarnInfoOutput; //# sourceMappingURL=yarn-info-parser.js.map
51
159
0.672269
d3ea879cfa4c012804251039d3fbcd6dfc8fbb1b
2,788
js
JavaScript
src/index.js
quilicicf/WeddingWebsite
0b5e5df2fbda29465c53a358936555d062f6dafb
[ "Apache-2.0" ]
null
null
null
src/index.js
quilicicf/WeddingWebsite
0b5e5df2fbda29465c53a358936555d062f6dafb
[ "Apache-2.0" ]
2
2020-03-15T16:42:28.000Z
2020-05-06T07:28:42.000Z
src/index.js
quilicicf/WeddingWebsite
0b5e5df2fbda29465c53a358936555d062f6dafb
[ "Apache-2.0" ]
null
null
null
import $ from 'jquery'; import get from 'lodash/fp/get'; import has from 'lodash/fp/has'; import popper from 'popper.js'; import bootstrap from 'bootstrap'; import util from 'bootstrap/js/dist/util'; import carousel from 'bootstrap/js/dist/carousel'; import './sass/style.scss'; import config from './js/config'; window.$ = $; window.popper = popper; window.bootstrap = bootstrap; window.util = util; window.carousel = carousel; const rsvpForm = document.getElementById('rsvp-form'); function applyConfigForCode ({ n: number, c: hasChildren }) { rsvpForm.classList.remove('code-invalid'); rsvpForm.classList.add('code-valid'); console.log(number, hasChildren); if (number === 1) { document.querySelector('#oneAttendeeOption .precision').innerText = ''; document.getElementById('twoAttendeesOption').style.display = 'none'; document.querySelector('#noAttendeesOption label').innerText = 'Je ne pourrai pas être là.'; } else if (number === 1.5) { document.querySelector('#oneAttendeeOption .precision').innerText = 'seul(e)'; document.getElementById('twoAttendeesOption').style.display = 'block'; document.querySelector('#twoAttendeesOption label').innerText = 'Je serai là !'; document.querySelector('#twoAttendeesOption .precision').innerText = 'accompagné(e)'; document.querySelector('#noAttendeesOption label').innerText = 'Je ne pourrai pas être là.'; } else { document.querySelector('#oneAttendeeOption .precision').innerText = 'seul(e)'; document.getElementById('twoAttendeesOption').style.display = 'block'; document.querySelector('#twoAttendeesOption label').innerText = 'Nous serons là !'; document.querySelector('#twoAttendeesOption .precision').innerText = ''; document.querySelector('#noAttendeesOption label').innerText = 'Nous ne pourrons pas être là.'; } document.getElementById('childrenOption').style.display = hasChildren ? 'block' : 'none'; } function hideForm () { rsvpForm.classList.remove('code-valid'); rsvpForm.classList.add('code-invalid'); document.getElementById('twoAttendeesOption').style.display = 'none'; document.getElementById('childrenOption').style.display = 'none'; } const codeField = document.getElementById('code'); codeField.addEventListener('input', (event) => { const currentCode = event.target.value; const pathInConfig = currentCode.split('') .filter(character => /^[A-Za-z0-9-]$/.test(character)) .map(character => character.toLocaleUpperCase()); const configForCode = get(pathInConfig, config); if (has('n', configForCode)) { applyConfigForCode(configForCode); } else { hideForm(); } }); const submitButton = document.getElementById('submit-rsvp'); submitButton.onclick = () => rsvpForm.classList.remove('pristine');
34
99
0.72023
d3eaa77af3f6236dcc56dcc1d28be2841cceae7e
2,052
js
JavaScript
packages/storybook/.storybook/config.js
napred/ds
711a5e456632250a1b6180d9e5e36e382e2a4c02
[ "MIT" ]
4
2018-11-20T11:58:51.000Z
2019-02-15T13:30:11.000Z
packages/storybook/.storybook/config.js
napred/ds
711a5e456632250a1b6180d9e5e36e382e2a4c02
[ "MIT" ]
14
2018-11-20T12:11:47.000Z
2019-04-02T08:46:24.000Z
packages/storybook/.storybook/config.js
napred/designsystem
711a5e456632250a1b6180d9e5e36e382e2a4c02
[ "MIT" ]
null
null
null
import React from 'react'; import { addDecorator, configure } from '@storybook/react'; import { configureViewport } from '@storybook/addon-viewport'; import { withKnobs } from '@storybook/addon-knobs'; import { DesignSystem } from '../../browser/src'; // automatically import all files ending in *.stories.tsx const req = require.context('../stories', true, /.stories.tsx$/); function loadStories() { req.keys().forEach(filename => req(filename)); } addDecorator(withKnobs); addDecorator(storyFn => { return <DesignSystem>{storyFn()}</DesignSystem>; }); configureViewport({ defaultViewport: 'iphone6', viewports: { iphone5: { name: 'iPhone 5/SE', styles: { height: '558px', width: '320px', }, type: 'mobile', }, iphone6: { name: 'iPhone 6/7/8', styles: { height: '667px', width: '375px', }, type: 'mobile', }, iphone6p: { name: 'iPhone 6/7/8 Plus', styles: { height: '736px', width: '414px', }, type: 'mobile', }, iphonex: { name: 'iPhone X', styles: { height: '812px', width: '375px', }, type: 'mobile', }, ipad: { name: 'iPad', styles: { height: '1024px', width: '768px', }, type: 'tablet', }, ipadpro: { name: 'iPad Pro', styles: { height: '1366px', width: '1024px', }, type: 'tablet', }, fullhd: { name: 'Desktop Full HD', styles: { height: '900px', width: '1920px', }, type: 'desktop', }, xxl: { name: 'Desktop XXL', styles: { height: '1100px', width: '2048px', }, type: 'desktop', }, responsive: { name: 'Responsive', styles: { width: '100%', height: '100%', border: 'none', display: 'block', boxShadow: 'none', }, type: 'desktop', }, }, }); configure(loadStories, module);
20.117647
65
0.499513
d3eaf29775ecc60f548b7488e51b81fe2a024739
1,033
js
JavaScript
src/lib/util.test.js
dxos/dashboard
0ee6ba18d870ca6f76a594e2cca9eefda8c60e48
[ "MIT" ]
1
2020-06-02T19:05:46.000Z
2020-06-02T19:05:46.000Z
src/lib/util.test.js
dxos/dashboard
0ee6ba18d870ca6f76a594e2cca9eefda8c60e48
[ "MIT" ]
29
2020-02-21T18:30:03.000Z
2020-05-20T18:21:39.000Z
src/lib/util.test.js
dxos/dashboard
0ee6ba18d870ca6f76a594e2cca9eefda8c60e48
[ "MIT" ]
1
2021-05-06T20:23:17.000Z
2021-05-06T20:23:17.000Z
// // Copyright 2020 Wireline, Inc. // import { getServiceUrl } from './util'; const config = { services: { foo: { server: 'http://localhost:3000/foo' }, bar: { server: 'http://localhost:3000/bar' } }, routes: { foo: { server: '/foo' } } }; // TODO(burdon): Won't run without .babelrc which breaks nextjs. test('getServiceUrl', () => { expect(() => getServiceUrl({}, 'foo.server')).toThrow(); expect(getServiceUrl(config, 'foo.server')).toEqual('/foo'); expect(getServiceUrl(config, 'foo.server', { path: '/123' })).toEqual('/foo/123'); expect(getServiceUrl(config, 'foo.server', { path: '/123', absolute: true })).toEqual('http://localhost/foo/123'); expect(getServiceUrl(config, 'bar.server')).toEqual('http://localhost:3000/bar'); expect(getServiceUrl(config, 'bar.server', { path: '/123' })).toEqual('http://localhost:3000/bar/123'); expect(getServiceUrl(config, 'bar.server', { path: '/123', absolute: true })).toEqual('http://localhost:3000/bar/123'); });
27.918919
121
0.617619
d3edb8276f8a917ce544ad3e8ad2d0f1e6fdd4fe
505
js
JavaScript
src/DataRequests/StageCoach.js
HaywoodSolutions/UoK-App
a645076e69d114fa74114dbcc18405b599b5a7fe
[ "MIT" ]
null
null
null
src/DataRequests/StageCoach.js
HaywoodSolutions/UoK-App
a645076e69d114fa74114dbcc18405b599b5a7fe
[ "MIT" ]
null
null
null
src/DataRequests/StageCoach.js
HaywoodSolutions/UoK-App
a645076e69d114fa74114dbcc18405b599b5a7fe
[ "MIT" ]
null
null
null
const XMLParser = require('react-xml-parser'); export async function getStageCoach(fromID, toID) { return fetch('https://transportapi.com/v3/uk/public/journey/from/'+fromID+'/to/'+toID+'.json?app_id=c451b209&app_key=1b281efb170e289398e3baeae7d7f627&service=southeast', { method: 'GET', headers: { 'x-requested-with': 'https://www.transportapi.com', } }) .then((response) => { return response.json(); }).then((res) => { return res.routes; }) }
31.5625
172
0.631683
d3ef11710e92df425fde324270139d0e3b502e26
443
js
JavaScript
src/utils/scenarioActionHash.js
scenario-generator/frontend
53f4c1500134ecf50737fd9ec2d3a7a82d6163b9
[ "MIT" ]
null
null
null
src/utils/scenarioActionHash.js
scenario-generator/frontend
53f4c1500134ecf50737fd9ec2d3a7a82d6163b9
[ "MIT" ]
15
2016-09-18T12:00:59.000Z
2022-02-26T11:17:27.000Z
src/utils/scenarioActionHash.js
scenario-generator/frontend
53f4c1500134ecf50737fd9ec2d3a7a82d6163b9
[ "MIT" ]
null
null
null
let generatorID = function(props) { if(props.generator && props.generator.slug) { return props.generator.slug } else if(props.params && props.params.id) { return props.params.id } return 'random' } let getScenarioActionHash = function(props, id = false, uuid = false) { return { id: id || generatorID(props), uuid: uuid || props.params.uuid, scenario: props.scenario, } } export default getScenarioActionHash;
22.15
71
0.683973
d3ef35bb539e14004214642ee7a7ba4fe5063efa
5,545
js
JavaScript
index.js
maxogden/plummet
14fd4d08c9b77d2e37fb208e84567d49205a530b
[ "MIT" ]
4
2015-11-08T08:33:19.000Z
2016-09-30T07:30:08.000Z
index.js
maxogden/plummet
14fd4d08c9b77d2e37fb208e84567d49205a530b
[ "MIT" ]
null
null
null
index.js
maxogden/plummet
14fd4d08c9b77d2e37fb208e84567d49205a530b
[ "MIT" ]
null
null
null
var plumbdb = require('plumbdb') var http = require('http') var url = require('url') var qs = require('querystring') var routes = require('routes') var request = require('request').defaults({json: true}) function Plummet(name, cb) { var me = this this.plumbdb = plumbdb(name, function(err, db) { cb(err, me.createServer()) }) this.createRoutes() } module.exports = function(name, cb) { return new Plummet(name, cb) } module.exports.Plummet = Plummet Plummet.prototype.createRoutes = function() { this.router = new routes.Router() this.router.addRoute("/", this.hello) this.router.addRoute("/_changes*", this.changes) this.router.addRoute("/_changes", this.changes) // this.router.addRoute("/_push", this.push) this.router.addRoute("/_pull", this.pull) this.router.addRoute("/_bulk", this.bulk) this.router.addRoute("/:id", this.document) this.router.addRoute("*", this.notFound) } Plummet.prototype.createServer = function() { var me = this return http.createServer(function(req, res) { me.handler.call(me, req, res) }) } Plummet.prototype.handler = function(req, res) { console.log(req.method, req.url) req.route = this.router.match(req.url) if (!req.route) return this.error(res, 404) req.route.fn.call(this, req, res) } Plummet.prototype.changes = function(req, res) { var me = this res.setHeader('content-type', 'application/json') var parsedURL = url.parse(req.url) if (parsedURL.query) query = qs.parse(parsedURL.query) else query = {since: "0"} me.plumbdb._getLast(function(err, last) { if (err) return me.error(res, 500, err) if (!last) last = query.since me._sendChanges(query.since, last, res) }) } Plummet.prototype._sendChanges = function(start, end, res) { var me = this // todo move to plumbdb this.plumbdb.db.iterator(function(err, iterator) { if (err) return me.error(res, 500, err) var pre = '{"docs": [', sep = "", post = ']}' res.write(pre) if (start === "0" && end === "0") return res.end(post) start = me.plumbdb.changesPrefix + start if (start === end) return res.end(post) iterator.forRange(start, end, function(err, key, val) { if (key === start) return res.write(sep + val) sep = "," if (key === end) return res.end(post) }) }) } Plummet.prototype.error = function(res, status, message) { if (!status) status = res.statusCode if (message) { if (message.status) status = message.status if (typeof message === "object") message.status = status if (typeof message === "string") message = {error: status, message: message} } res.statusCode = status || 500 this.json(res, message) } Plummet.prototype.notFound = function(req, res) { this.error(res, 404, {"error": "Not Found"}) } Plummet.prototype.hello = function(req, res) { if (req.method === "POST") return this.document(req, res) this.plumbdb._dumpAll() this.json(res, {"plummet": "Welcome", "version": 1}) } Plummet.prototype.json = function(res, json) { res.setHeader('content-type', 'application/json') res.end(JSON.stringify(json)) } Plummet.prototype.get = function(req, res) { var me = this this.plumbdb.get(req.route.params.id, function(err, json) { if (err) return me.error(res, 500) if (json === null) return me.error(res, 404, {error: "Not Found"}) me.json(res, json) }) } Plummet.prototype.post = function(req, res) { var me = this this.plumbdb.put(req, function(err, json) { if (err) { if (err.conflict) return me.error(res, 409, {error: "Document update conflict. Invalid _rev"}) else return me.error(res, 500, err) } me.json(res, json) }) } Plummet.prototype.bulk = function(req, res) { var me = this this.plumbdb.bulk(req, function(err, results) { if (err) return me.error(res, 500, err) me.json(res, {"results": results}) }) } Plummet.prototype._requestBody = function(req, cb) { var buffers = [], error = false req.on('data', function (chunk) { buffers.push(chunk) }) req.on('end', function (chunk) { if (chunk) buffers.push(chunk) if (error) return var body = buffers.join('') return cb(false, body) }) req.on('error', function (err) { error = true cb(err) }) } Plummet.prototype._requestJSON = function(req, cb) { this._requestBody(req, function(err, body) { if (err) return cb(err) if (req.headers['content-type'].split(';')[0] === 'application/json') { try { return cb(false, JSON.parse(body)) } catch (e) { return cb(e) } } return cb({"status": 415, "error":"bad_content_type", "reason":"content-type must be application/json"}) }) } Plummet.prototype.pull = function(req, res) { var me = this this._requestJSON(req, function(err, json) { if (err) return me.error(res, err.status, err) if (!json.source) return me.error(res, 400, "you must specify a replication source") var source = url.parse(json.source) if (!source.protocol || !source.protocol.match(/http/)) return me.error(res, 400, "bad source URL") me.plumbdb._getLast(function(err, last) { if (err) return me.error(res, 500, err) var remoteChanges = url.format(source) + '_changes' if (last) remoteChanges += '?since=' + last var changes = request(remoteChanges) me.bulk(changes, res) }) }) } Plummet.prototype.document = function(req, res) { var me = this if (req.method === "GET") return this.get(req, res) if (req.method === "POST") return this.post(req, res) }
29.494681
108
0.644004
d3ef8c74c2123247ddca9ce1a7c53a1c4143ee71
398
js
JavaScript
data/11583.js
stas-vilchik/bdd-ml
2a254419a7c40c2e9b48625be8ca78721f786d2b
[ "MIT" ]
null
null
null
data/11583.js
stas-vilchik/bdd-ml
2a254419a7c40c2e9b48625be8ca78721f786d2b
[ "MIT" ]
null
null
null
data/11583.js
stas-vilchik/bdd-ml
2a254419a7c40c2e9b48625be8ca78721f786d2b
[ "MIT" ]
null
null
null
{ var write = context.write; var next = context.next; if (isUndef(el.children) || el.children.length === 0) { write(el.open + (el.close || ""), next); } else { var children = el.children; context.renderStates.push({ type: "Element", rendered: 0, total: children.length, endTag: el.close, children: children }); write(el.open, next); } }
20.947368
57
0.570352
d3f12b71a1666ae921ea33f5b0f6184eb30be118
332
js
JavaScript
20211SVAC/G20/src/dist/Errores/Error.js
201503702/tytusx
1569735832bab7ab8b6e396912f5d61dec777425
[ "MIT" ]
null
null
null
20211SVAC/G20/src/dist/Errores/Error.js
201503702/tytusx
1569735832bab7ab8b6e396912f5d61dec777425
[ "MIT" ]
null
null
null
20211SVAC/G20/src/dist/Errores/Error.js
201503702/tytusx
1569735832bab7ab8b6e396912f5d61dec777425
[ "MIT" ]
null
null
null
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Error = void 0; class Error { constructor(descripcion, line = 0, column = 0, type = '') { this.descripcion = descripcion; this.line = line; this.column = column; this.type = type; } } exports.Error = Error;
25.538462
63
0.611446
d3f1b8a7c7b94d9f39399dbe1019974b1367abc9
3,789
js
JavaScript
src/page/InputForm.js
saba-can00/tdee_calculator_web
e539a73b3ca21ce054d6b261af29536fe5b3900f
[ "MIT" ]
null
null
null
src/page/InputForm.js
saba-can00/tdee_calculator_web
e539a73b3ca21ce054d6b261af29536fe5b3900f
[ "MIT" ]
12
2021-06-09T08:33:39.000Z
2021-06-29T23:51:47.000Z
src/page/InputForm.js
saba-can00/tdee_calculator_web
e539a73b3ca21ce054d6b261af29536fe5b3900f
[ "MIT" ]
null
null
null
import React from "react"; import styled from "styled-components"; import { NumberInput } from "../components/NumberInput"; import { RadioButton } from "../components/RadioButton"; import { DropDownInput } from "../components/DropDownInput"; import { MainActionButton } from "../components/MainActionButton"; import { calcIntakeCalorie } from "../domain/services/HarrisBenedictCalculator"; import { ACTIVITY_LEVEL, LEVEL_LITTLE, } from "../domain/entity/ActivityLevelConstants"; import { SEX, MEN } from "../domain/entity/SexConstants"; export class InputForm extends React.Component { constructor(props) { super(props); this.state = { age: 0, weight: 0, height: 0, sex: MEN, activityLevel: LEVEL_LITTLE.value, }; this.inputAge = this.inputAge.bind(this); this.inputWeight = this.inputWeight.bind(this); this.inputHeight = this.inputHeight.bind(this); this.inputSex = this.inputSex.bind(this); this.inputActivityLevel = this.inputActivityLevel.bind(this); this.inputAge = this.inputAge.bind(this); this.calcCalorie = this.calcCalorie.bind(this); } inputAge(age) { this.setState({ age: age }); } inputWeight(weight) { this.setState({ weight: weight }); } inputHeight(height) { this.setState({ height: height }); } inputSex(index) { this.setState({ sex: SEX[index] }); } inputActivityLevel(activityLevel) { this.setState({ activityLevel: activityLevel }); } calcCalorie() { const calorie = calcIntakeCalorie( this.state.age, this.state.weight, this.state.height, this.state.sex.value, this.state.activityLevel ); console.log(`calorie=${calorie}`); this.props.history.push({ pathname: "/result", state: { calorie: calorie, }, }); } render() { return ( <Form> <LeftCell> <NumberInput label="年齢" value={this.state.age} onChange={this.inputAge} /> </LeftCell> <RightCell> <RadioButton label="性別" name="sex" selectedOption={this.state.sex} selections={SEX} onChange={this.inputSex} /> </RightCell> <LeftCell> <NumberInput label="体重" value={this.state.weight} onChange={this.inputWeight} /> </LeftCell> <RightCell> <NumberInput label="身長" value={this.state.height} onChange={this.inputHeight} /> </RightCell> <LeftCell> <DropDownInput label="運動レベル" name="activityLevel" value={this.state.activityLevel} onChange={this.inputActivityLevel} selections={ACTIVITY_LEVEL} /> </LeftCell> <StyledButton label="計算する" onClick={this.calcCalorie} /> </Form> ); } } const Form = styled.main` @media (min-width: 1024px) { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; margin: 24px auto; } @media (max-width: 1023px) { display: flex; flex-direction: column; justify-content: center; } @media (min-width: 426px) and (max-width: 1023px) { margin: 24px 25%; } @media (max-width: 425px) { margin: 24px 5%; } `; const LeftCell = styled.div` grid-column-start: 2; grid-column-end: 3; margin-bottom: 24px; `; const RightCell = styled.div` grid-column-start: 3; grid-column-end: 4; margin-bottom: 24px; `; const StyledButton = styled(MainActionButton).attrs((props) => ({ label: props.label, }))` grid-column-start: 2; grid-column-end: 4; grid-row-start: 4; grid-row-end: 5; margin-top: 6%; `;
24.764706
80
0.593296
d3f2255562db925530df7d6270dbcbdd42419762
564
js
JavaScript
bin/Utils/Constants/Milliseconds.js
iAmMochi/Eris-Discord-Bot-Template
717b6672b73c3a7e7dea2a32289a79c6ca5af90f
[ "BSD-3-Clause" ]
1
2021-05-26T19:45:30.000Z
2021-05-26T19:45:30.000Z
bin/Utils/Constants/Milliseconds.js
iVitaliya/Eris-Discord-Bot-Template
717b6672b73c3a7e7dea2a32289a79c6ca5af90f
[ "BSD-3-Clause" ]
null
null
null
bin/Utils/Constants/Milliseconds.js
iVitaliya/Eris-Discord-Bot-Template
717b6672b73c3a7e7dea2a32289a79c6ca5af90f
[ "BSD-3-Clause" ]
null
null
null
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Milliseconds = void 0; var Milliseconds; (function (Milliseconds) { Milliseconds[Milliseconds["WEEK"] = 604800000] = "WEEK"; Milliseconds[Milliseconds["DAY"] = 86400000] = "DAY"; Milliseconds[Milliseconds["HOUR"] = 3600000] = "HOUR"; Milliseconds[Milliseconds["MINUTE"] = 60000] = "MINUTE"; Milliseconds[Milliseconds["SECOND"] = 1000] = "SECOND"; })(Milliseconds = exports.Milliseconds || (exports.Milliseconds = {})); //# sourceMappingURL=Milliseconds.js.map
47
71
0.702128
d3f3b05023e4441b4834855b8f0937c5aebd9d86
884
js
JavaScript
test/unwrap.test.js
oramics/unwrap-phase
22ac79b9007df99bdbb316524072f2be7654cbe1
[ "MIT" ]
1
2019-01-22T01:30:33.000Z
2019-01-22T01:30:33.000Z
test/unwrap.test.js
oramics/unwrap-phases
22ac79b9007df99bdbb316524072f2be7654cbe1
[ "MIT" ]
null
null
null
test/unwrap.test.js
oramics/unwrap-phases
22ac79b9007df99bdbb316524072f2be7654cbe1
[ "MIT" ]
null
null
null
/* global describe it expect */ const unwrap = require('..') const fill = require('filled-array') describe('unwrap phase', () => { it('phase unwrap', function () { const positive = fill((i) => i % (2 * Math.PI), 10) expect(positive).toEqual([0, 1, 2, 3, 4, 5, 6, 0.7168146928204138, 1.7168146928204138, 2.7168146928204138]) expect(unwrap(positive, true)).toEqual([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) const negative = fill((i) => -i % (2 * Math.PI), 10) expect(negative).toEqual([-0, -1, -2, -3, -4, -5, -6, -0.7168146928204138, -1.7168146928204138, -2.7168146928204138]) expect(unwrap(negative, true)).toEqual([-0, -1, -2, -3, -4, -5, -6, -7, -8, -9]) }) it('phase unwrap in place', function () { var signal = fill((i) => i % (2 * Math.PI), 1024) var unwrapped = unwrap(signal, true) unwrap(signal) expect(signal).toEqual(unwrapped) }) })
40.181818
121
0.593891
d3f46ff0178eea451e04109b6150930edbb8825b
3,175
js
JavaScript
commands/apcost.js
maketakunai/tama-bot
7f263c9db4ee58b4a8d94bd0b68c212291dfabc1
[ "MIT" ]
1
2021-04-06T07:36:39.000Z
2021-04-06T07:36:39.000Z
commands/apcost.js
maketakunai/tama-bot
7f263c9db4ee58b4a8d94bd0b68c212291dfabc1
[ "MIT" ]
null
null
null
commands/apcost.js
maketakunai/tama-bot
7f263c9db4ee58b4a8d94bd0b68c212291dfabc1
[ "MIT" ]
1
2019-10-05T11:39:42.000Z
2019-10-05T11:39:42.000Z
const stageList = require("../data/singularityap.json"); exports.run = (client, message, args) => { var searchString = args; console.log(`${searchString}`); searchString = args.join(''); searchString = searchString.toLowerCase(); searchString = searchString.replace(/\W/g, ''); if (searchString === "part"){ message.channel.send("Please try again and specify which part you want - Part 1, EoR, Part 2."); return; } console.log(`Searching for ${searchString} ...`); var stageSearch = findStage(searchString); if (stageSearch.length > 0) { for (var j = 0; j < stageSearch.length; j++){ let imgurl = `https://raw.githubusercontent.com/maketakunai/tama-bot/master/images/singularity/${stageSearch[j]["image"]}.png` message.channel.send({ "embed": { "color": 0000000, "thumbnail": { "url": imgurl, }, "author": { "name": `${stageSearch[j]["singularity"]}`, }, "fields": [ { "name": "Total AP Cost", "value": `${stageSearch[j]["total_ap"]}`, "inline": true }, { "name": "Total Nodes", "value": `${stageSearch[j]["total_nodes"]}`, "inline": true }, { "name": "Total Chapters", "value": `${stageSearch[j]["total_chaps"]}`, "inline": true }, { "name": "Days to Complete", "value": `${stageSearch[j]["completion_time"]}`, "inline": true } ] } }).catch(console.error); } } else message.channel.send("Sorry, I couldn't find what you were looking for. You can try again using terms like 'part 1', 'observer on timeless temple', 'lostbelt', or the name of the stage."); } function findStage(input){ var stagesFound = []; if (input == "" || input.length < 3){ return stagesFound; } for (var key in stageList){ for (var parameter in stageList[key]){ if (parameter == "singularity"){ var sName = stageList[key]["singularity"]; sName = sName.replace(/\W/g, ''); sName = sName.toLowerCase(); if (sName.search(input) != -1){ stagesFound.push(stageList[key]); break; } } else if (parameter == "alias"){ for (var x in stageList[key]["alias"]){ console.log(stageList[key]["alias"][x]); var sAlias = stageList[key]["alias"][x]; sAlias = sAlias.replace(/\W/g, ''); sAlias = sAlias.toLowerCase(); if (sAlias.search(input) != -1){ stagesFound.push(stageList[key]); break; } } } } } return stagesFound; } exports.conf = { enabled: true, guildOnly: false, aliases: [] }; exports.help = { name: 'apcost', description: `Searches for a particular singularity or stage and displays associated AP cost. Examples of groupings: Part 1, EoR, Part 2, Observer on Timeless Temple, Cosmos in the Lostbelt`, usage: '!apcost [name of singularity]' };
29.672897
193
0.535748
d3f49afb615ffd6989e328f7048e0d704ea01b3e
10,464
js
JavaScript
src/_actions/user.actions.js
shikhapandey30/INV-MGMT-NEW
19698e74aac743bbd738639797fa3d78a9e67781
[ "MIT" ]
null
null
null
src/_actions/user.actions.js
shikhapandey30/INV-MGMT-NEW
19698e74aac743bbd738639797fa3d78a9e67781
[ "MIT" ]
1
2021-09-29T17:34:46.000Z
2021-09-29T17:34:46.000Z
src/_actions/user.actions.js
shikhapandey30/INV-MGMT-NEW
19698e74aac743bbd738639797fa3d78a9e67781
[ "MIT" ]
null
null
null
import { userConstants } from '../_constants'; import { userService } from '../_services'; import { alertActions } from './'; import { history } from '../_helpers'; export const userActions = { login, logout, getwarehouseuser, getAllwarehouse, getwarehousedetail, getAllproduct, getproductdetail, getAllcategory, getcategorydetail, getAllinventory, getinventorydetail, getAllvendor, getvendordetail, getAllpuchaseorderslist, getpurchaseorderdetail, getAlltranferorderslist, gettransferorderdetail, delete: _delete }; function login(username, password) { return dispatch => { dispatch(request({ username })); userService.login(username, password) .then( user => { dispatch(success(user)); history.push('/'); // dispatch(alertActions.success('Successful Login')); }, error => { alert('Invalid Username Or Password') dispatch(failure(error.toString())); dispatch(alertActions.error(error.toString())); } ); }; function request(user) { return { type: userConstants.LOGIN_REQUEST, user } } function success(user) { return { type: userConstants.LOGIN_SUCCESS, user } } function failure(error) { return { type: userConstants.LOGIN_FAILURE, error } } } function logout() { userService.logout(); return { type: userConstants.LOGOUT }; } function getwarehouseuser(warehouseID) { return dispatch => { dispatch(request()); userService.getwarehouseuser(warehouseID) .then( warehousealluser => dispatch(success(warehousealluser)), error => dispatch(failure(error.toString())) ); }; function request() { return { type: userConstants.GETWAREHOUSET_REQUEST } } function success(warehousealluser) { return { type: userConstants.GETWAREHOUSET_SUCCESS, warehousealluser } } function failure(error) { return { type: userConstants.GETWAREHOUSET, error } } } function getAllwarehouse() { return dispatch => { dispatch(request()); userService.getAllwarehouse() .then( allwarehouses => dispatch(success(allwarehouses)), error => dispatch(failure(error.toString())) ); }; function request() { return { type: userConstants.GETALLWAREHOUSE_REQUEST } } function success(allwarehouses) { return { type: userConstants.GETALLWAREHOUSE_SUCCESS, allwarehouses } } function failure(error) { return { type: userConstants.GETALLWAREHOUSE, error } } } function getwarehousedetail(warehouseID) { return dispatch => { dispatch(request()); userService.getwarehousedetail(warehouseID) .then( warehouse => dispatch(success(warehouse)), error => dispatch(failure(error.toString())) ); }; function request() { return { type: userConstants.GETWAREHOUSEDETAIL_REQUEST } } function success(warehouse) { return { type: userConstants.GETWAREHOUSEDETAIL_SUCCESS, warehouse } } function failure(error) { return { type: userConstants.GETWAREHOUSEDETAIL, error } } } function getcategorydetail(categoryID) { return dispatch => { dispatch(request()); userService.getcategorydetail(categoryID) .then( category => dispatch(success(category)), error => dispatch(failure(error.toString())) ); }; function request() { return { type: userConstants.GETCATEGORYDETAIL_REQUEST } } function success(category) { return { type: userConstants.GETCATEGORYDETAIL_SUCCESS, category } } function failure(error) { return { type: userConstants.GETCATEGORYDETAIL, error } } } function getproductdetail(productID) { return dispatch => { dispatch(request()); userService.getproductdetail(productID) .then( product => dispatch(success(product)), error => dispatch(failure(error.toString())) ); }; function request() { return { type: userConstants.GETPRODUCTDETAIL_REQUEST } } function success(product) { return { type: userConstants.GETPRODUCTDETAIL_SUCCESS, product } } function failure(error) { return { type: userConstants.GETPRODUCTDETAIL, error } } } function getAllproduct() { return dispatch => { dispatch(request()); userService.getAllproduct() .then( allproducts => dispatch(success(allproducts)), error => dispatch(failure(error.toString())) ); }; function request() { return { type: userConstants.GETALLPRODUCT_REQUEST } } function success(allproducts) { return { type: userConstants.GETALLPRODUCT_SUCCESS, allproducts } } function failure(error) { return { type: userConstants.GETALLPRODUCT, error } } } function getAllcategory() { return dispatch => { dispatch(request()); userService.getAllcategory() .then( allcategories => dispatch(success(allcategories)), error => dispatch(failure(error.toString())) ); }; function request() { return { type: userConstants.GETALLCATEGORY_REQUEST } } function success(allcategories) { return { type: userConstants.GETALLCATEGORY_SUCCESS, allcategories } } function failure(error) { return { type: userConstants.GETALLCATEGORY, error } } } function getAllinventory() { return dispatch => { dispatch(request()); userService.getAllinventory() .then( allinventories => dispatch(success(allinventories)), error => dispatch(failure(error.toString())) ); }; function request() { return { type: userConstants.GETALLINVENTORY_REQUEST } } function success(allinventories) { return { type: userConstants.GETALLINVENTORY_SUCCESS, allinventories} } function failure(error) { return { type: userConstants.GETALLINVENTORY, error } } } function getinventorydetail(inventoryID) { return dispatch => { dispatch(request()); userService.getinventorydetail(inventoryID) .then( inventory => dispatch(success(inventory)), error => dispatch(failure(error.toString())) ); }; function request() { return { type: userConstants.GETINVENTORYDETAIL_REQUEST } } function success(inventory) { return { type: userConstants.GETINVENTORYDETAIL_SUCCESS, inventory } } function failure(error) { return { type: userConstants.GETINVENTORYDETAIL, error } } } function getAllvendor() { return dispatch => { dispatch(request()); userService.getAllvendor() .then( allvendors => dispatch(success(allvendors)), error => dispatch(failure(error.toString())) ); }; function request() { return { type: userConstants.GETALLVENDOR_REQUEST } } function success(allvendors) { return { type: userConstants.GETALLVENDOR_SUCCESS, allvendors } } function failure(error) { return { type: userConstants.GETALLVENDOR, error } } } function getvendordetail(vendorID) { return dispatch => { dispatch(request()); userService.getvendordetail(vendorID) .then( vendor => dispatch(success(vendor)), error => dispatch(failure(error.toString())) ); }; function request() { return { type: userConstants.GETVANDORDETAIL_REQUEST } } function success(vendor) { return { type: userConstants.GETVANDORDETAIL_SUCCESS, vendor } } function failure(error) { return { type: userConstants.GETVANDORDETAIL, error } } } function getAllpuchaseorderslist() { return dispatch => { dispatch(request()); userService.getAllpuchaseorderslist() .then( allpuchaseorders => dispatch(success(allpuchaseorders)), error => dispatch(failure(error.toString())) ); }; function request() { return { type: userConstants.GETALLPURCHASEORDER_REQUEST } } function success(allpuchaseorders) { return { type: userConstants.GETALLPURCHASEORDER_SUCCESS, allpuchaseorders } } function failure(error) { return { type: userConstants.GETALLPURCHASEORDER, error } } } function getpurchaseorderdetail(purchaseorderID) { return dispatch => { dispatch(request()); userService.getpurchaseorderdetail(purchaseorderID) .then( purchaseorder => dispatch(success(purchaseorder)), error => dispatch(failure(error.toString())) ); }; function request() { return { type: userConstants.GETPURCHASEORDERDETAILDETAIL_REQUEST } } function success(purchaseorder) { return { type: userConstants.GETPURCHASEORDERDETAILDETAIL_SUCCESS, purchaseorder } } function failure(error) { return { type: userConstants.GETPURCHASEORDERDETAILDETAIL, error } } } function gettransferorderdetail(transferorderID) { return dispatch => { dispatch(request()); userService.gettransferorderdetail(transferorderID) .then( transferorder => dispatch(success(transferorder)), error => dispatch(failure(error.toString())) ); }; function request() { return { type: userConstants.GETTRANSFERORDERDETAILDETAIL_REQUEST } } function success(transferorder) { return { type: userConstants.GETTRANSFERORDERDETAILDETAIL_SUCCESS, transferorder } } function failure(error) { return { type: userConstants.GETTRANSFERORDERDETAILDETAIL, error } } } function getAlltranferorderslist() { return dispatch => { dispatch(request()); userService.getAlltranferorderslist() .then( alltransferorders => dispatch(success(alltransferorders)), error => dispatch(failure(error.toString())) ); }; function request() { return { type: userConstants.GETALLTRANSFERORDER_REQUEST } } function success(alltransferorders) { return { type: userConstants.GETALLTRANSFERORDER_SUCCESS, alltransferorders } } function failure(error) { return { type: userConstants.GETALLTRANSFERORDER, error } } } function _delete(id) { return dispatch => { dispatch(request(id)); userService.delete(id) .then( user => dispatch(success(id)), error => dispatch(failure(id, error.toString())) ); }; function request(id) { return { type: userConstants.DELETE_REQUEST, id } } function success(id) { return { type: userConstants.DELETE_SUCCESS, id } } function failure(id, error) { return { type: userConstants.DELETE_FAILURE, id, error } } }
35.471186
121
0.670489
d3f4f328c3b84d97332be1d5b77e0071ceba8742
11,066
js
JavaScript
node_modules/inferno-server/dist/inferno-server.min.js
Astrobr/astroblog
053b5e71e64373656262ac25c64a7579f4fc9b10
[ "MIT" ]
1
2021-08-14T17:48:58.000Z
2021-08-14T17:48:58.000Z
node_modules/inferno-server/dist/inferno-server.min.js
Astrobr/astroblog
053b5e71e64373656262ac25c64a7579f4fc9b10
[ "MIT" ]
20
2021-08-15T14:57:46.000Z
2022-03-11T02:53:18.000Z
node_modules/inferno-server/dist/inferno-server.min.js
Astrobr/astroblog
053b5e71e64373656262ac25c64a7579f4fc9b10
[ "MIT" ]
null
null
null
!function(e,t){"object"===typeof exports&&"undefined"!==typeof module?t(exports,require("inferno"),require("stream")):"function"===typeof define&&define.amd?define(["exports","inferno","stream"],t):t(((e="undefined"!==typeof globalThis?globalThis:e||self).Inferno=e.Inferno||{},e.Inferno.Server=e.Inferno.Server||{}),e.Inferno,e.stream)}(this,(function(e,t,r){"use strict";var n=Array.isArray;function o(e){return void 0===e||null===e}function u(e){return null===e||!1===e||!0===e||void 0===e}function i(e){return"function"===typeof e}function s(e){return"string"===typeof e}function a(e){return"number"===typeof e}function l(e){return null===e}function c(e){throw e||(e="a runtime error occured! Use Inferno in development environment to find the error."),new Error("Inferno Error: "+e)}function d(e,t){var r={};if(e)for(var n in e)r[n]=e[n];if(t)for(var o in t)r[o]=t[o];return r}function f(e){if(s(e))return e;var t,r="";for(var n in e){var o=e[n];("string"===(t=typeof o)||"number"===t)&&(r+=n+":"+o+";")}return r}var h=new RegExp(/["'&<>]/);function p(e){if(!h.test(e))return e;var t,r="",n="",o=0;for(t=0;t<e.length;++t){switch(e.charCodeAt(t)){case 34:n="&quot;";break;case 39:n="&#039;";break;case 38:n="&amp;";break;case 60:n="&lt;";break;case 62:n="&gt;";break;default:continue}t>o&&(r+=e.slice(o,t)),r+=n,o=t+1}return r+e.slice(o,t)}var v=new RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),m={},g={};function y(e){if(void 0!==g[e])return!0;if(void 0!==m[e])return!1;if(v.test(e))return g[e]=!0,!0;return m[e]=!0,!1}var F=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]);function T(e,t,r){if(e.constructor.getDerivedStateFromProps)return d(r,e.constructor.getDerivedStateFromProps(t,r));return r}function x(e,r){var n=e.props||t.EMPTY_OBJ;return 32768&e.flags?e.type.render(n,e.ref,r):e.type(n,r)}function Q(e,r,h){var v=e.flags,m=e.type,g=e.props||t.EMPTY_OBJ,b=e.children;if(0!==(14&v)){if(4&v){var S,k=new m(g,h),C=Boolean(m.getDerivedStateFromProps);if(k.$BS=!1,k.$SSR=!0,i(k.getChildContext)&&(S=k.getChildContext()),S=o(S)?h:d(h,S),k.props===t.EMPTY_OBJ&&(k.props=g),k.context=h,!C&&i(k.componentWillMount)){k.$BR=!0,k.componentWillMount(),k.$BR=!1;var P=k.$PS;if(P){var _=k.state;if(null===_)k.state=P;else for(var N in P)_[N]=P[N];k.$PSS=!1,k.$PS=null}}C&&(k.state=T(k,g,k.state));var D=k.render(g,k.state,k.context);if(u(D))return"\x3c!--!--\x3e";if(s(D))return p(D);if(a(D))return D+"";return Q(D,e,S)}var w=x(e,h);if(u(w))return"\x3c!--!--\x3e";if(s(w))return p(w);if(a(w))return w+"";return Q(w,e,h)}if(0!==(481&v)){var M,B="<"+m,$=F.has(m),R=e.className;if(s(R)?B+=' class="'+p(R)+'"':a(R)&&(B+=' class="'+R+'"'),!l(g)){for(var E in g){var I=g[E];switch(E){case"dangerouslySetInnerHTML":M=I.__html;break;case"style":o(g.style)||(B+=' style="'+f(g.style)+'"');break;case"children":case"className":break;case"defaultValue":g.value||(B+=' value="'+(s(I)?p(I):I)+'"');break;case"defaultChecked":g.checked||(B+=' checked="'+I+'"');break;default:y(E)&&(s(I)?B+=" "+E+'="'+p(I)+'"':a(I)?B+=" "+E+'="'+I+'"':!0===I&&(B+=" "+E))}}"option"===m&&"undefined"!==typeof g.value&&g.value===r.props.value&&(B+=" selected")}if($)B+=">";else{B+=">";var A=e.childFlags;if(2===A)B+=Q(b,e,h);else if(12&A)for(var V=0,O=b.length;V<O;++V)B+=Q(b[V],e,h);else 16===A?B+=""===b?" ":p(b):M&&(B+=M);$||(B+="</"+m+">")}if(String(m).match(/[\s\n\/='"\0<>]/))throw B;return B}if(0!==(16&v))return""===b?" ":p(b);if(n(e)||0!==(8192&v)){var j=e.childFlags;if(2===j||n(e)&&0===e.length)return"\x3c!--!--\x3e";if(12&j||n(e)){for(var W=n(e)?e:b,J="",Y=0,q=W.length;Y<q;++Y)J+=Q(W[Y],e,h);return J}}else c();return""}function b(e){return Q(e,{},{})}function S(e){var t=e.$PS;if(t){var r=e.state;if(null===r)e.state=t;else for(var n in t)r[n]=t[n];e.$PS=null}e.$BR=!1}var k=function(e){function r(t){e.call(this),this.collector=[1/0],this.promises=[],this.pushQueue=this.pushQueue.bind(this),t&&this.renderVNodeToQueue(t,null,null)}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype._read=function(){setTimeout(this.pushQueue,0)},r.prototype.addToQueue=function(e,t){if(o(t))"string"===typeof e&&this.collector.length-1===0?this.push(e):"string"===typeof e&&"string"===typeof this.collector[this.collector.length-2]?this.collector[this.collector.length-2]+=e:this.collector.splice(-1,0,e);else{var r=this.promises[t].length-1;"string"===typeof this.promises[t][r]&&"string"===typeof e?this.promises[t][r]+=e:this.promises[t].push(e)}},r.prototype.pushQueue=function(){var e=this.collector[0];if("string"===typeof e)this.push(e),this.collector.shift();else if(e&&("object"===typeof e||i(e))&&i(e.then)){var t=this;e.then((function(e){var r;(r=t.collector).splice.apply(r,[0,1].concat(t.promises[e])),t.promises[e]=null,setTimeout(t.pushQueue,0)})),this.collector[0]=null}else e===1/0&&this.emit("end")},r.prototype.renderVNodeToQueue=function(e,r,h){var v=this,m=e.flags,g=e.type,Q=e.props||t.EMPTY_OBJ,b=e.children;if((14&m)>0)if(4&m){var k,C=new g(Q,r),P=Boolean(g.getDerivedStateFromProps);if(C.$BS=!1,C.$SSR=!0,void 0!==C.getChildContext&&(k=C.getChildContext()),o(k)||(r=d(r,k)),C.props===t.EMPTY_OBJ&&(C.props=Q),C.context=r,!P&&i(C.componentWillMount)&&(C.$BR=!0,C.componentWillMount(),S(C)),i(C.getInitialProps)){var _=C.getInitialProps(C.props,C.context);if(_){if(Promise.resolve(_)===_){var N=this.promises.push([])-1;return void this.addToQueue(_.then((function(e){"object"===typeof e&&(C.props=d(C.props,e));var t=C.render(C.props,C.state,C.context);return u(t)?v.addToQueue("\x3c!--!--\x3e",N):s(t)?v.addToQueue(p(t),N):a(t)?v.addToQueue(t+"",N):v.renderVNodeToQueue(t,C.context,N),setTimeout(v.pushQueue,0),N})),h)}C.props=d(C.props,_)}}P&&(C.state=T(C,Q,C.state));var D=C.render(C.props,C.state,C.context);u(D)?this.addToQueue("\x3c!--!--\x3e",h):s(D)?this.addToQueue(p(D),h):a(D)?this.addToQueue(D+"",h):this.renderVNodeToQueue(D,r,h)}else{var w=x(e,r);u(w)?this.addToQueue("\x3c!--!--\x3e",h):s(w)?this.addToQueue(p(w),h):a(w)?this.addToQueue(w+"",h):this.renderVNodeToQueue(w,r,h)}else if((481&m)>0){var M,B="<"+g,$=F.has(g),R=e.className;if(s(R)?B+=' class="'+p(R)+'"':a(R)&&(B+=' class="'+R+'"'),!l(Q))for(var E in Q){var I=Q[E];switch(E){case"dangerouslySetInnerHTML":M=I.__html;break;case"style":o(Q.style)||(B+=' style="'+f(Q.style)+'"');break;case"children":case"className":break;case"defaultValue":Q.value||(B+=' value="'+(s(I)?p(I):I)+'"');break;case"defaultChecked":Q.checked||(B+=' checked="'+I+'"');break;default:y(E)&&(s(I)?B+=" "+E+'="'+p(I)+'"':a(I)?B+=" "+E+'="'+I+'"':!0===I&&(B+=" "+E))}}if(B+=">",String(g).match(/[\s\n\/='"\0<>]/))throw B;if($)this.addToQueue(B,h);else{var A=e.childFlags;if(2===A)return this.addToQueue(B,h),this.renderVNodeToQueue(b,r,h),void this.addToQueue("</"+g+">",h);if(16===A)return this.addToQueue(B,h),this.addToQueue(""===b?" ":p(b+""),h),void this.addToQueue("</"+g+">",h);if(12&A){this.addToQueue(B,h);for(var V=0,O=b.length;V<O;++V)this.renderVNodeToQueue(b[V],r,h);return void this.addToQueue("</"+g+">",h)}if(M)return void this.addToQueue(B+M+"</"+g+">",h);$||this.addToQueue(B+"</"+g+">",h)}}else if((16&m)>0)this.addToQueue(""===b?" ":p(b),h);else if(n(e)||0!==(8192&m)){var j=e.childFlags;if(2===j||n(e)&&0===e.length)this.addToQueue("\x3c!--!--\x3e",h);else if(12&j||n(e)){for(var W=n(e)?e:e.children,J=0,Y=W.length;J<Y;++J)this.renderVNodeToQueue(W[J],r,h);return}}else c()},r}(r.Readable);function C(e){return new k(e)}var P=Promise.resolve(),_=function(e){function t(t){e.call(this),this.started=!1,this.initNode=t}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype._read=function(){var e=this;if(this.started)return;this.started=!0,P.then((function(){return e.renderNode(e.initNode,null)})).then((function(){e.push(null)})).catch((function(t){e.emit("error",t)}))},t.prototype.renderNode=function(e,t){var r=e.flags;if((14&r)>0)return this.renderComponent(e,t,4&r);if((481&r)>0)return this.renderElement(e,t);if(n(e)||0!==(8192&r))return this.renderArrayOrFragment(e,t);return this.renderText(e)},t.prototype.renderArrayOrFragment=function(e,t){var r=this,o=e.childFlags;if(2===o||n(e)&&0===e.length)return this.push("\x3c!--!--\x3e");if(12&o||n(e))return(n(e)?e:e.children).reduce((function(e,n){return e.then((function(){return Promise.resolve(r.renderNode(n,t)).then((function(){return!!(16&n.flags)}))}))}),Promise.resolve(!1))},t.prototype.renderComponent=function(e,t,r){var n=this,l=e.type,c=e.props;if(!r){var f=x(e,t);if(u(f))return this.push("\x3c!--!--\x3e");if(s(f))return this.push(p(f));if(a(f))return this.push(f+"");return this.renderNode(f,t)}var h,v=new l(c,t),m=Boolean(l.getDerivedStateFromProps);return v.$BS=!1,v.$SSR=!0,i(v.getChildContext)&&(h=v.getChildContext()),o(h)||(t=d(t,h)),v.context=t,v.$BR=!0,Promise.resolve(!m&&v.componentWillMount&&v.componentWillMount()).then((function(){S(v),m&&(v.state=T(v,c,v.state));var e=v.render(v.props,v.state,v.context);if(u(e))return n.push("\x3c!--!--\x3e");if(s(e))return n.push(p(e));if(a(e))return n.push(e+"");return n.renderNode(e,t)}))},t.prototype.renderChildren=function(e,t,r){var n=this;if(2===r)return this.renderNode(e,t);if(16===r)return this.push(""===e?" ":p(e+""));if(12&r)return e.reduce((function(e,r){return e.then((function(){return Promise.resolve(n.renderNode(r,t)).then((function(){return!!(16&r.flags)}))}))}),Promise.resolve(!1))},t.prototype.renderText=function(e){this.push(""===e.children?" ":p(e.children))},t.prototype.renderElement=function(e,t){var r,n=this,u=e.type,i=e.props,c="<"+u,d=F.has(u),h=e.className;if(s(h)?c+=' class="'+p(h)+'"':a(h)&&(c+=' class="'+h+'"'),!l(i))for(var v in i){var m=i[v];switch(v){case"dangerouslySetInnerHTML":r=m.__html;break;case"style":o(i.style)||(c+=' style="'+f(i.style)+'"');break;case"children":case"className":break;case"defaultValue":i.value||(c+=' value="'+(s(m)?p(m):m)+'"');break;case"defaultChecked":i.checked||(c+=' checked="'+m+'"');break;default:if(y(v)){s(m)?c+=" "+v+'="'+p(m)+'"':a(m)?c+=" "+v+'="'+m+'"':!0===m&&(c+=" "+v);break}}}if(c+=">",this.push(c),String(u).match(/[\s\n\/='"\0<>]/))throw c;if(d)return;if(r)return this.push(r),void this.push("</"+u+">");var g=e.childFlags;if(1===g)return void this.push("</"+u+">");return Promise.resolve(this.renderChildren(e.children,t,g)).then((function(){n.push("</"+u+">")}))},t}(r.Readable);function N(e){return new _(e)}e.RenderQueueStream=k,e.RenderStream=_,e.renderToStaticMarkup=b,e.renderToString=b,e.streamAsStaticMarkup=N,e.streamAsString=N,e.streamQueueAsStaticMarkup=C,e.streamQueueAsString=C,Object.defineProperty(e,"__esModule",{value:!0})}));
5,533
11,065
0.64775
d3f60b071fb90a11f9d4336bd40ee41fca6d5f83
4,556
js
JavaScript
public/front/add/map/total_map.js
hmurich/welcome.kz
65c5eb1f63d8fe3a80fb752269eac9bbe1b76739
[ "MIT" ]
1
2017-03-07T06:16:29.000Z
2017-03-07T06:16:29.000Z
public/front/add/map/total_map.js
hmurich/welcome.kz
65c5eb1f63d8fe3a80fb752269eac9bbe1b76739
[ "MIT" ]
1
2021-02-09T17:34:59.000Z
2021-02-09T17:34:59.000Z
public/front/add/map/total_map.js
hmurich/welcome.kz
65c5eb1f63d8fe3a80fb752269eac9bbe1b76739
[ "MIT" ]
null
null
null
var myMap; ymaps.ready(init); function init() { var city_center = jQuery('.js_map_field_main').data('city_center'); city_center = city_center.split(','); //console.log(city_center); myMap = new ymaps.Map("map",{ center: [city_center[0], city_center[1]], zoom: 12, behaviors: ["default", "scrollZoom"] }, { balloonMaxWidth: 300 }); jQuery(".js_map_field").change(changeField); myMap.controls.add("zoomControl"); myMap.controls.add("mapTools"); myMap.controls.add("typeSelector"); function changeField(){ var val = $(this).val(); var type = $(this).data('type'); var id = $(this).data('id'); pushAll(); } pushAll(); function pushAll(){ var arr = getAllVal(); getLocation(arr); } function getAllVal(){ var arr = {}; jQuery.each( jQuery('.js_map_field'), function( key, value ) { var val = $(this).val(); var type = $(this).data('type'); var id = $(this).data('id'); arr[id] = val; }); arr['cat_id'] = jQuery('.js_map_field_main').data('cat_id'); return arr; } function getLocation(arr){ console.log('sended data'); console.log(arr); jQuery.post("/map/geo-objects", arr ).done(function( data ) { data = JSON.parse(data); console.log('recive data data'); console.log(data); addGeoObjets(data.geo); addToList(data.items, 1); addToList(data.vip, 2); addToList(data.specail, 3); }); } myCollection = new ymaps.GeoObjectCollection(); myMap.geoObjects.add(myCollection); function addGeoObjets(objects){ myMap.geoObjects.remove(myCollection); myCollection = new ymaps.GeoObjectCollection(); jQuery.each(objects, function( key, value ) { var text_baloon = '<a href="/show/index/' + value.id + '">' + value.name + '</a>'; text_baloon = text_baloon + '<p>'+value.note+'</p>'; text_baloon = text_baloon + '<p>'+value.address+'</p>'; placemark = new ymaps.Placemark([value.lng, value.lat], { balloonContent: text_baloon }); myCollection.add(placemark); //myCollection.add(new ymaps.Placemark([value.lng, value.lat])); }); myMap.geoObjects.add(myCollection); } function addToList(list_item, type = 1){ if (type == 1) jQuery('.js_object_list').empty(); jQuery.each(list_item, function( key, value ) { console.log('type ' + type); var element = ''; if (type == 2) element = '<li class="js_object_list_li js_object_list_li_vip">'; else if (type == 3) element = '<li class="js_object_list_li js_object_list_li_specail">'; else element = '<li class="js_object_list_li ">'; element = element + '<a class="mini-zaved" href="/show/index/'+value.id+'">' + '<img class="mini-zaved__img" src="'+value.logo+'" style="max-width: 80px; margin-right: 5px;">' + '<div class="info-zaved">' + '<span class="info-zaved__heading">'+value.name+'</span>' + '<ul class="info-ul">'; jQuery.each(value.options, function( key, value ) { element = element + '<li>' + value + '</li>'; }); element = element + '</ul>' + '<p class="info-zaved__regym">' + '<span>Режим работы:</span> ' + value.time_begin + ' - ' + value.time_end + '' + '</p>' + '</div>' + '</a>' + '</li>'; if (type == 2 && jQuery( ".js_object_list .js_object_list_li:eq(1)" ).length > 0) jQuery( ".js_object_list .js_object_list_li:eq(1)" ).after(element); else if (type == 3 && jQuery( ".js_object_list .js_object_list_li:eq(3)" ).length > 0) jQuery( ".js_object_list .js_object_list_li:eq(3)" ).after(element); else jQuery('.js_object_list').append(element); }); } }
33.748148
134
0.490123
d3f79c91278a6f9dd7e4fa19c9c0488071bbc5fa
3,477
js
JavaScript
src/operations/create_issuance_request_builder.js
tokend/js-base
b921f4f1fcd8aa719a58d6a65e3177f0d25683b1
[ "Apache-2.0" ]
5
2018-10-09T14:15:28.000Z
2019-05-21T13:08:07.000Z
src/operations/create_issuance_request_builder.js
swarmfund/swarm-js-base
54596ffa65bb7befa67979a5aaa10f72ce9df692
[ "Apache-2.0" ]
null
null
null
src/operations/create_issuance_request_builder.js
swarmfund/swarm-js-base
54596ffa65bb7befa67979a5aaa10f72ce9df692
[ "Apache-2.0" ]
1
2022-02-08T14:10:00.000Z
2022-02-08T14:10:00.000Z
import {default as xdr} from "../generated/stellar-xdr_generated"; import isUndefined from 'lodash/isUndefined'; import {BaseOperation} from './base_operation'; import {Keypair} from "../keypair"; import {UnsignedHyper, Hyper} from "js-xdr"; export class CreateIssuanceRequestBuilder { /** * Creates operation to create issuance request * @param {object} opts * @param {string} opts.asset - asset to be issued * @param {string} opts.amount - amount to be issued * @param {string} opts.receiver - balance ID of the receiver * @param {string} opts.reference - Reference of the request * @param {object} opts.externalDetails - External details needed for PSIM to process withdraw operation * @param {number|string} opts.allTasks - Bitmask of all tasks which must be completed for the request approval * @param {string} [opts.source] - The source account for the payment. Defaults to the transaction's source account. * @returns {xdr.CreateIssuanceRequestOp} */ static createIssuanceRequest(opts) { let attrs = {}; if (!BaseOperation.isValidAsset(opts.asset)) { throw new Error("opts.asset is invalid"); } attrs.asset = opts.asset; if (!BaseOperation.isValidAmount(opts.amount)) { throw new Error("opts.amount is invalid"); } attrs.amount = BaseOperation._toUnsignedXDRAmount(opts.amount); if (!Keypair.isValidBalanceKey(opts.receiver)) { throw new Error("receiver is invalid"); } attrs.receiver = Keypair.fromBalanceId(opts.receiver).xdrBalanceId(); if (!BaseOperation.isValidString(opts.reference, 1, 64)) { throw new Error("opts.reference is invalid"); } if (isUndefined(opts.externalDetails)) { throw new Error("externalDetails is invalid"); } attrs.externalDetails = JSON.stringify(opts.externalDetails); let fee = { fixed: "0", percent: "0" }; attrs.fee = BaseOperation.feeToXdr(fee); attrs.ext = new xdr.IssuanceRequestExt(xdr.LedgerVersion.emptyVersion()); let request = new xdr.IssuanceRequest(attrs); let rawAllTasks = BaseOperation._checkUnsignedIntValue("allTasks", opts.allTasks); let issuanceRequestOp = new xdr.CreateIssuanceRequestOp({ request: request, reference: opts.reference, externalDetails: request.externalDetails(), ext: new xdr.CreateIssuanceRequestOpExt.addTasksToReviewableRequest(rawAllTasks) }); let opAttributes = {}; opAttributes.body = xdr.OperationBody.createIssuanceRequest(issuanceRequestOp); BaseOperation.setSourceAccount(opAttributes, opts); return new xdr.Operation(opAttributes); } static createIssuanceRequestOpToObject(result, attrs) { result.reference = attrs.reference(); let request = attrs.request(); result.asset = request.asset(); result.amount = BaseOperation._fromXDRAmount(request.amount()); result.receiver = BaseOperation.balanceIdtoString(request.receiver()); result.externalDetails = JSON.parse(request.externalDetails()); switch (attrs.ext().switch()) { case xdr.LedgerVersion.addTasksToReviewableRequest(): { result.allTasks = attrs.ext().allTasks(); break; } } } }
39.511364
120
0.651711
d3f895e7e83ea0c61b7eeee16fb79d3a9e914e67
816
js
JavaScript
public/component---src-templates-blog-post-js-b08de706aec7bea6e3dd.js
gabipurcaru/gabi-sh-gatsby
2b2bfb232d97a996a02dd6c224b2998a89df35cf
[ "MIT" ]
1
2021-03-01T21:29:41.000Z
2021-03-01T21:29:41.000Z
public/component---src-templates-blog-post-js-b08de706aec7bea6e3dd.js
gabipurcaru/gabi-sh-gatsby
2b2bfb232d97a996a02dd6c224b2998a89df35cf
[ "MIT" ]
null
null
null
public/component---src-templates-blog-post-js-b08de706aec7bea6e3dd.js
gabipurcaru/gabi-sh-gatsby
2b2bfb232d97a996a02dd6c224b2998a89df35cf
[ "MIT" ]
null
null
null
(window.webpackJsonp=window.webpackJsonp||[]).push([[10],{yZlL:function(e,t,a){"use strict";a.r(t),a.d(t,"default",(function(){return m})),a.d(t,"pageQuery",(function(){return o}));var n=a("q1tI"),r=a.n(n),l=a("qhky"),c=a("Bl7J"),u=a("vrFN");function m(e){var t=e.data.markdownRemark;return r.a.createElement(r.a.Fragment,null,r.a.createElement(l.a,{title:"Gabi Purcaru - "+t.frontmatter.title}),r.a.createElement(c.a,null,r.a.createElement(u.a,{keywords:[],title:"Gabi Purcaru - "+t.frontmatter.title}),r.a.createElement("div",null,r.a.createElement("h1",{className:"text-3xl mb-4"},t.frontmatter.title),r.a.createElement("div",{className:"blog-post-content",dangerouslySetInnerHTML:{__html:t.html}}))))}var o="3402926140"}}]); //# sourceMappingURL=component---src-templates-blog-post-js-b08de706aec7bea6e3dd.js.map
408
728
0.718137
d3facfdb0e7304a1b6d42232abd041a49ee96954
703
js
JavaScript
public/js/MenuManagement/menumanagement.js
kettex/LaravelApp
482185f9c6f4cde49c6a37eed2d9505debf3d253
[ "MIT" ]
null
null
null
public/js/MenuManagement/menumanagement.js
kettex/LaravelApp
482185f9c6f4cde49c6a37eed2d9505debf3d253
[ "MIT" ]
null
null
null
public/js/MenuManagement/menumanagement.js
kettex/LaravelApp
482185f9c6f4cde49c6a37eed2d9505debf3d253
[ "MIT" ]
null
null
null
/** * Created by alexander on 18.01.2015. */ function openEditMenuModal(){ $("#editMenuModal").modal('show'); } function saveMenu(){ $("#editMenuForm").submit(); $("#editMenuModal").modal('hide'); } function setMenusOnline(){ $.ajax({ url: "menu/setOnline", data: JSON.stringify($('#offlineMenusTable').bootstrapTable('getData')), contentType: 'application/json', accept: 'application/json', type: 'POST' }).done(function() { // refresh the table after setting the menus online $('#offlineMenusTable').bootstrapTable('refresh'); }).fail(function(){ $('#offlineMenusTable').bootstrapTable('refresh'); }); }
25.107143
80
0.603129