text
stringlengths
7
3.69M
// Interface // an interface is a contract signed by object which says that i gurantee you that i have certain property function function greet(person) { console.log("welcome", person.name); // console.log("Gender is", person.gender); // it will be undefined as gender is not the property od person } var person ...
import Ember from 'ember'; import DS from 'ember-data'; const { Model, attr, belongsTo, hasMany } = DS; const { computed } = Ember; export default Model.extend({ date: attr('date'), course: belongsTo('course', { async: true }), presences: hasMany('presence', { async: true }), presentStudents: computed('pre...
import React, { Component } from 'react'; import { Text, View, TouchableHighlight } from 'react-native'; class App extends Component { static navigationOptions = { title: '找回密码' }; render() { const { navigate } = this.props.navigation; return ( <View> <Text>找回密码</Text> <TouchableHighlight onPress={...
import React from 'react' import TableTabs from './TableTabs' import PageMainContainer from '../components_style/PageMainContainer' //import TableClosedTrades from './TableClosedTrades' const TradeTablePage = () => ( <PageMainContainer mobileMargin="30% 1.5rem"> {/*<TableClosedTrades />*/} <TableTabs /> </...
export default (stock, flow, deltaFlow) => { /** * Calculate flow at a given time. * @param {number} time - Time in the future. * @return {number} flow */ const flowAt = time => { return flow + (deltaFlow * time) } /** * Calculate stock at a given time. * @param {number} time - Time in the fu...
/* See license.txt for terms of usage */ define([ "firebug/lib/trace", "firebug/lib/locale", ], function(FBTrace, Locale) { // ********************************************************************************************** // // Test Summary FBTestApp.TestSummary = { passingTests: {passing: 0, failing: 0}...
import { Role, User } from '../../validateInputs'; const Auth = { roleInput(req, res, next) { const { isValid, errors } = Role.input(req.body, 'create'); if (!isValid) { return res.status(400).send(errors); } next(); }, roleUpdate(req, res, next) { const { isValid, errors } = Role.inp...
'use strict'; let button = document.querySelector('button'); let result = document.querySelector('p'); let list = document.querySelectorAll('li'); let counter = function() { result.textContent = 'Totally: ' + list.length; }; button.addEventListener('click', counter); document.querySelector('ul').style.backgroundC...
import React, { useEffect, useState } from "react"; import { Helmet } from "react-helmet"; import get from "lodash/get"; const Meta = ({ results }) => { const [title, setTitle] = useState(""); useEffect(() => { if (results.matches.length > 0) { const t = get(results.matches, "0"); co...
const express = require('express'); const router = express.Router(); const Nominee = require('../mongoose/userModel').Nominee; const User = require('../mongoose/userModel').User; // Auth Funcs const authAnyUser = require('../authentication').authAnyUser; const authAnyUserId = require('../authentication').authAnyUserI...
import FeedActionTypes from "./feed.types"; const INITIAL_STATE = { posts: [ { id: 1, likes: 0, comment: [], imageUrl: "https://i.ibb.co/tBPLhTs/alex-azabache-8-L7m-OETNg-HA-unsplash.jpg", avatar: "https://i.ibb.co/7J2ZD84/woodwatch-7hye-LUn6388-unsplash.jpg", username:...
/** * @file * Extension entry. */ const { languages } = require('vscode'); const { activateGenericFormatter, Formatter } = require('./lib/formatter'); const { createValidator } = require('./lib/validator'); module.exports = { /** * Activates the extension. * * @param {import('vscode').ExtensionContext} ...
var express = require("express") var expresshandlebars = require("express-handlebars") var mongoose = require("mongoose") var port = process.env.port|| 3000 var app = express("") var routes = require("./routes") app.use(express.static("public")) app.engine("handlebars",expresshandlebars({defaultLayout:"main"})) app.s...
const events = require("../shared/events"); const games = require("./games"); const users = require("./users"); const { getGameRoomId, leaveAllGames, getPlayerNames, invariant, getActiveGameId, } = require("./utils"); module.exports = (io) => ({ [events.register]: async (socket, event) => { try { ...
export const STATUS_PEERING = 'Peering'; export const STATUS_PEERED = 'Peered';
/* --- description: MooSocket class, a basic WebSocket wrapper for MooTools license: MIT-style authors: - Trae Robrock requires: - core/1.3: '*' provides: [MooSocket] ... */ var MooSocket = new Class({ Implements: [Options, Events], options: { reconnect: true, maxReconnects: 10, onOpen: Func...
function initMap() { const map = new google.maps.Map(document.getElementById('map'), { center: new google.maps.LatLng(55.76359, 37.56760), zoom: 16 }); const marker = new google.maps.Marker({ position: new google.maps.LatLng(55.76359, 37.56760), map: map, anim...
$(document).ready(function() { // Navigation $('#toggle-nav').click(function(){ $('nav').toggleClass('open'); }); $('#home-section-1 .list').slick({ prevArrow: '<span class="icon-arrow-left slick-prev"></span>', nextArrow: '<span class="icon-arrow-right slick-next"></span>', ...
//Requerimos router del modulo de express const router = require('express').Router(); //Requerimos el modulo de passport const passport = require('passport'); // Modelo del usuario const User = require('../models/Usuario'); //Ruta para mostrar la ventana de registro a la App router.get('/usuario/registrarse', (req, r...
function magicFast(array) { return _magicFast(array, 0, array.length - 1); } function _magicFast(array, start, end) { if (end < start) { return -1; } let midIndex = Math.floor((start + end) / 2); let midValue = array[midIndex]; if (midIndex === midValue) { return midIndex; ...
import React, { Component } from "react"; import { Col } from "reactstrap"; import { connect } from "react-redux"; class Usage extends Component { render() { const lang = this.props.lang; return ( <Col xs={12} className="my-3"> {((lang === "en") ? ( <...
import React, { Component } from "react"; import CardCell from "../components/CardCell"; import { CardDeck } from "reactstrap"; import RenderLoader from "../components/RenderLoader"; class Gallery extends Component { constructor(props) { super(props); this.state = { error: null, isLoaded: false, ...
import { GraphQLList, GraphQLBoolean, GraphQLString } from 'graphql'; const Buyer = require('../../../models/buyer/buyer.model'); const buyer = { type: require('./types').buyerReturnType, resolve(_, args, { user }) { if(!user) throw new Error('Not Authenticated!'); return Buyer.findById(user.i...
export const getHd = ({lazy}) => lazy.hd; export const getPlayer = ({lazy}) => lazy.player; export const getStorePath = ({storePath}) => storePath.path;
function showtime() { var a = new Date(); document.write(a.getDate() + " " + a.getMonth() + " " + a.getFullYear() + " " + a.getTime()); return 1; } function formattedtime() { var a = new Date(); document.write(a.getDate() + " " + a.getMonth() + " " + a.getFullYear() + " " + a.getHours()...
var geoLocationFunctionOn = 0; // Try to obtain user location & time once the page starts loading window.onload = function () { getPosition(); updateEstimation(); setInterval( updateEstimation, 10000 ); }; // Tries to obtain geolocation of user. // Stores the location in userLat and userLng; // Stores if...
/* * Copyright (C) 2009-2014 SAP SE or an SAP affiliate company. All rights reserved */ // Provides class sap.ca.ui.model.format.DateFormat jQuery.sap.declare("sap.ca.ui.model.format.DateFormat"); jQuery.sap.require("sap.ui.core.format.DateFormat"); jQuery.sap.require("sap.ca.ui.utils.resourcebundle"); /** * Const...
import { useEffect, useRef } from "react"; import "./assets/css/App.css"; const mosaicColors = [ "rgb(249, 143, 250)", "rgb(143, 250, 209)", "rgb(143, 198, 250)", "rgb(214, 250, 143)", "rgb(249, 177, 105)", ]; const About = (props, state) => { const mosaicRef = useRef(); useEffect(() => { if (mosai...
module.exports = { preset: 'ts-jest', collectCoverage: true, testEnvironment: 'node', globals: { 'ts-jest': { tsConfig: { esModuleInterop: false } } } }
var mongoose = require('mongoose'); var Schema = mongoose.Schema; var user = new Schema({ nome: String, login: String, senha: String, data_cad: {type: Date, default: Date.now} }); module.exports = mongoose.model('usuarios', user);
var total_items = 20916; var per_page = 50; // Loading 1st page data $(document).ready(function(){ $.ajax({ url: "http://localhost:4000/projectlist/1", success: function(result){ total_items = result.body.per_page; per_page = result.body.total; display_projects(result); } }); }); //Pagination $(f...
/*! * Bootstrap YouTube Popup Player Plugin * http://lab.abhinayrathore.com/bootstrap-youtube/ * https://github.com/abhinayrathore/Bootstrap-Youtube-Popup-Player-Plugin */ (function ($) { var $YouTubeModal = null, $YouTubeModalDialog = null, $YouTubeModalTitle = null, $YouTubeModalBody = null, ma...
module.exports = function (censusBase) { this.getAllMapRegions = function (callback) { var query = censusBase.createQuery('map_region'); query.showFields([ 'map_region_id', 'zone_id', 'facility_id', 'facility_name', 'facility_type...
/* eslint-disable import/no-extraneous-dependencies */ const cssnano = require('cssnano'); const autoprefixer = require('autoprefixer'); module.exports = { plugins: [ autoprefixer({ browsers: ['ie >= 10', 'last 4 version'] }), cssnano({ preset: 'default', }), ], };
import { combineReducers } from "redux"; import productReducer from "./productReducer"; import authReducer from "./authReducer"; import cartReducer from "./cartReducer"; import modalReducer from "./modalReducer"; import orderReducer from "./orderReducer"; // The actual name for authentication is user // TODO: change au...
import LoginPage from './LoginPage' import RegisterPage from './RegisterPage' import StartRun from './StartRun.jsx' import Leaderboard from './Leaderboard.jsx' import History from './History.jsx' import Events from './Events.jsx' import CreateEvent from './CreateEvent.jsx' import Community from './Community.jsx' import...
$(document).ready(function () { $("h1").hover(function () { $("h1").addClass("indexFolded"); }, function () { $("h1").removeClass("indexFolded"); }); $("h1").removeClass("indexFolded"); $("#menu_checkbox").prop("checked", false); });
'use strict'; const a = {js: 'test', jq: 'hello', css: 'world'}; alert(Object.keys(a));
const SimpleValidators = require("./SimpleValidators"); const TypeChecker = require("./TypeChecker"); class ListUtil { static listsEqual(firstList, secondList) { if (firstList === secondList) return true; if (!SimpleValidators.hasValue(firstList) || !SimpleValidators.hasValue(secondList) || !Type...
import React, { Component } from 'react'; import moment from 'moment'; import { Form, Input, Button, Icon, Row, Col, Divider, Checkbox, DatePicker } from 'antd'; import "./css/SearchTop_mySup.css" const Search = Input.Search; const CheckboxGroup = Checkbox.Group; const { MonthPicker, RangePicker } = DatePicker; class S...
/*! * PLUTO IMAGE PREVIEWER (RESPONSIVE) ver. 1.0 - 2015-10-20 by mars :) * FREE FOR PERSONAL & COMMERCIAL USE */ /* SAMPLE***** <div class="img-list" > <img src="_pl_plugin/pluto-prev/test-pic/1.jpg"/> <img src="_pl_plugin/pluto-prev/test-pic/2.jpg"/> <img src="_pl_plugin/pluto-prev/test-pic/3.jpg"/> ...
import React from 'react' import "../styles/Swift.css" function Swift() { return ( <div> {/* Swift Header, with title and caption START */} <header className="jumbotron jumbotron-fluid bg-dark"> <div className="container-fluid text-center"> <h1 className="display-3">Swi...
import React, { useState, useEffect } from "react"; import styled from "styled-components"; import emblemImg from "../assets/manhattan_project_emblem.png" import Infos from "./molecules/Infos"; import gsap from "gsap"; const Embleme = () => { const [emblemAnims, setEmblemAnims] = useState(); const [emblemIsHover, ...
(function () { "use strict"; angular.module("com") .controller("comControl",comControl); function comControl() { var list = this; list.name = "dotnot"; list.contacts = [{ name: "Kontakty", created: new Date() }, { name: "KontaktyDwa", created: new Date() }]; } ...
const cacheHandler = require('./cacheHandler.js') module.exports = { cacheHandler }
/** * @callback TraversalCallback * @param {BinaryTreeNode|BinarySearchTreeNode} node */ /** * @class BinaryTreeNode * @property {number} value * @property {BinaryTreeNode} left * @property {BinaryTreeNode} right * @property {BinaryTreeNode} parent */ class BinaryTreeNode { constructor(value = null) { th...
// Importação de configurações do servidor var application = require('./config/server'); // Colocando o servidor para escutar a porta 8080 application.listen(8080, function(){ console.log('Servidor online na porta 8080'); });
// OBJECTIZED - THREEJS WEBGL SETUP // Pass the jquery DOM element that holds the scene. var lambertMaterial = new THREE.MeshPhongMaterial({ // light // specular: '#a9fcff', // intermediate // color: '#00abb1', ambient: new THREE.Color( 0xffffff ),...
var DefaultShader = require('gl-basic-shader') var Batch = require('gl-sprite-batch') var ortho = require('gl-mat4/ortho') var identity = require('gl-mat4/identity') var weakMap = typeof WeakMap === 'undefined' ? require('weak-map') : WeakMap var cache = new weakMap() var projection = identity([]) var zero = [0, 0] v...
var city = Array(); city['北京'] = Array(); city['北京'][0] = '--请选择--'; city['北京'][1101] = '东城'; city['北京'][1102] = '西城'; city['北京'][1103] = '崇文'; city['北京'][1104] = '宣武'; city['北京'][1105] = '朝阳'; city['北京'][1106] = '丰台'; city['北京'][1107] = '石景山'; city['北京'][1108] = '海淀'; city['北京'][1109] = '门头沟'; city['北京'][1111] = '房山';...
import React from 'react'; import {Link} from 'react-router-dom'; import LoginRegistrationService from '../services/LoginRegisterService.js'; class Register extends React.Component { constructor(props){ super(props); this.state = { fname: "", lname: "", uname: ...
import React, { Component } from 'react' import { actionTypes } from '../store' export const initState = { status:false } export const reducer = (state = initState, action) => { switch (action.type) { case actionTypes.FINISHED_LOADING: return Object.assign({}, state, { status:false }) case actionTyp...
import { get, once, differenceBy } from 'lodash' import memoize from 'utils/memoize' import { createSelector } from 'reselect' import Tween from '@tweenjs/tween.js' import { selectors as gameSelectors } from 'morpheus/game' import { actions as gamestateActions, selectors as gamestateSelectors, isActive, } from 'm...
"use strict"; /*jslint noempty: false */ /*global alert: true, ODSA */ (function ($) { $(document).ready(function () { // Process help button: Give a full help page for this activity // We might give them another HTML page to look at. function help() { window.open("quicksortHelpPRO.html", 'helpwindo...
var g_ptsEdit = false , g_ptsBlockFabric = null , g_ptsHoverAnim = 300 // Table hover animation lenght, ms - hardcoded for now , g_ptsHoverMargin = 20; // Table hover margin displace, px - hardcoded for now jQuery(document).ready(function(){ _ptsInitFabric(); if(typeof(ptsTables) !== 'undefined' && ptsTables &&...
var util = require('util'); var net = require('net'); exports.open = function(host, port, target, callback) { util.log('Connecting to ' + host + ':' + port); var proxy = new net.Socket(); proxy.connect(port, host, function() { util.log('Tunneling to ' + target + ' through ' + host + ':' + port); proxy...
// Importamos o axios para chamadas das APIs externas do Node.js import axios from 'axios'; const api = axios.create({ baseURL: 'http://localhost:3333' }); export default api;
// reducer takes in two things // 1) what happened and 2) a copy of the current state // then return copy of updated state // we set state to an empty array to start off // const defaultVis = { // showAudio: false, // showHighlights: true, // showNotes: false // } function settings(state=[], action) { switch...
import React from 'react' import Game from '../Game/Game' export default class GamePage extends React.Component { render() { return ( <section> <div className="container my-5"> <Game port={this.props.match.params.port}/> </div> </section> ); } }
import ZCheckboxradio from "./checkboxradio.vue" const zCheckboxradio = { install:function(Vue){ Vue.component("zCheckboxradio",ZCheckboxradio) } } export default zCheckboxradio;
// modules var fs = require('fs'); var redis = require('redis'); // config file var config = require('./config'); // redis client connect var client; function redisConnect() { client = redis.createClient(config.redis.port, config.redis.host); client.on("error", function (err) { console.log("Redis "+err); }); ...
let mongoose = require('mongoose'); let Schema = mongoose.Schema; let UserSchema = new Schema({ _id: Number, name: String, sex: String, startDate: String, tellphone: String, eMail: String, address: String, post: String, department:String, company: String, remark: String }) modul...
//Copyright 2012, John Wilson, Brighton Sussex UK. Licensed under the BSD License. See licence.txt var DEFAULTMISSILERATE = 0.00000001 ; var DEFAULTMISSILEPERIOD = 1/DEFAULTMISSILERATE ; var DEFAULTMISSILERANGE = 256 ; var DEFAULTFIRERATE = 0.5 ; var DEFAULTFIREPERIOD = 1/DEFAULTFIRERATE ; var EnemyID ...
// @flow strict import { ApolloServer } from 'apollo-server-koa'; import typeDefs from './schema.gql'; const books = [ { title: 'The Awakening', author: 'Kate Chopin', }, { title: 'City of Glass', author: 'Paul Auster', }, ]; const resolvers = { Query: { books: () => books, }, }; cons...
import React, { Component } from 'react'; import Api from '../api/Api' class Home extends Component { constructor(props){ super(props) this.state ={ user: [], post: [] } } componentDidMount(){ Api.getUser((user)=>{ this.setSta...
movieDBApp.factory('loginService', ($resource, $log) => { return { login: (params, onSuccess, onFailure) => { let login = $resource('http://localhost:8082/login'); login.save(params).$promise.then(res => { $log.info(res); if(res.password) ...
const isPrime = test => { if(test === 2){return true} else if (test < 2) {return false} else if(test % 2 === 0 || test < 2){return false} else{ for(let i = 3; i <= Math.sqrt(test); i = i+2){ if(test % i === 0){ return false } } return true } } const rightTruncatable = input =>...
import React, {useState} from 'react' import {Header} from "./Header" import {TopComp} from "./TopComp" import {SecondComponent} from "./SecondComponent" import {ThirdComponent} from "./ThirdComponent" // import {FourthComponent} from "./FourthComponent/FourthComponent" import {FourthBuild} from "./FourthComponent/Four...
'use strict'; let AttributeSet = require("./attributeset.js"); let TraitSet = require("./traitset.js"); class Unit{ constructor(){ this.name = "Debug"; this.sex = "Female"; this.title = "The Creator"; this.class = "Warrior"; this.race = "Yerles"; this.feats_availabl...
Vue.component('list-item', { template: ` <div id="item_shower"> <div class="row"> <div class="col-xl-3 col-lg-3 col-md-3 col-sm-3 d-none d-sm-block" > <div class="list-group"> <a href="#" class="list-group-item list-group-item-action" ...
//importando pacote const express = require('express'); const server = express(); //declarando variável para as tarefas var tarefas = [ { id: 1, descrição: "comprar pão", finalizado: false } ]; // middlewares: server.use(express.json()); //criando o insert server.post('/tarefa', async...
import React from 'react' import { Col, Row, Label, Input, FormGroup }from 'reactstrap' const Actinfo = ()=>( <FormGroup className="mt-3"> <FormGroup row > <Col xs={2}/> <Label for="name" xs={2}>拼团购</Label> </FormGroup> <Row xs={12} className="mt-3"><C...
var Model = require('../model'); var Group = Model.requires('group'); var Policy = Model.requires('policy'); var Provider = Model.requires('provider'); var User = module.exports = new Model.Builder('User', { name: Model.DataTypes.STRING, profile: Model.DataTypes.TEXT, }); Group.belongsToMany(User, { through: 'Us...
import React from 'react' import PropTypes from 'prop-types' import FilterIcon from '@material-ui/icons/Tune' import Filter from './Filter' import FilterHeadline from './FilterHeadline' import { getFilterProfiles } from './getFilterProfiles' import { Flexbox } from '../../Layout' import { Range } from '../../Controls' ...
const { Trait } = require('@northscaler/mutrait') const property = require('@northscaler/property-decorator') /** * Imparts a `description` property with backing property `_description`. */ const Describable = Trait(superclass => class extends superclass { @property() _description } ) module.exports = D...
/* eslint-disable no-underscore-dangle */ /* eslint-disable camelcase */ /* eslint-disable react/destructuring-assignment */ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { Redirect } from 'react-router-dom'; import TextField from '@material-ui/core/TextField'; import axios from '...
import React from 'react' import { Responsive } from '../src' export default props => ( <Responsive zoom={0.75}> <div style={{ padding: 16, fontSize: 32, fontWeight: 'bold', color: 'white', backgroundColor: 'tomato' }} > Hello </div> </Responsiv...
//js的构造函数: // var Person = function(name){ // this.name = name; // // this.say = function(){ // // return "I am " + this.name; // // } // // return this; // }; // Person.prototype.say = function(){ // return "I am " + this.name; // } // var aPerson = new Person("aPerson"); // console.log(aPerson.say()); //未使用...
import typescript from "@rollup/plugin-typescript"; import commonjs from "@rollup/plugin-commonjs"; import replace from "@rollup/plugin-replace"; import resolve from "@rollup/plugin-node-resolve"; import json from "@rollup/plugin-json"; import styles from "rollup-plugin-styles"; const mode = process.env.NODE_ENV; con...
import React from 'react'; import ReactDOM from 'react-dom'; import App from '../components/App'; import {Action} from '../action-reducer/action'; export default function showDialog(create, state) { const store = global.store; const STATE_PATH = ['temp']; const action = new Action(STATE_PATH, false); const nod...
/* 🤖 this file was generated by svg-to-ts*/ export const EOSIconsKeyboardReturn = { name: 'keyboard_return', data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.41L5.83 13H21V7z"/></svg>` };
//This processes the order, currently only pushing items to orders table and emptying cart const router = require("express").Router(); const checkout = require("../models/checkout-model"); const checkoutInstance = new checkout(); router.post("/", checkoutInstance.placeOrder); module.exports = router;
'use strict'; module.exports = { up: (queryInterface, Sequelize) => { return Promise.all([ queryInterface.bulkInsert('url', [ { url: 'www.testpagexyzrq.ctm', description: 'loremipsum3' }, ], {}), ]); }, down: ((queryInterface, Sequelize) => Promise.a...
(function() { /** * HealthBar * * @params {object} character Character which will get a health bar. * @params {array} pos Contains x and y coordinates. Example: [x, y] * @params {array} size Contains with and height. Example: [width, height] */ function HealthBar(ch...
"use strict"; var express = require("express"); var router = express.Router(); var favourties = { breakfast: [ { description: "weet bix", unitEnergy: 474, quantity: 3, section: "breakfast", nutrition: { carbohydrate: 20.9, fat: 1.1, protein: 3.7 } ...
import styled from 'styled-components' import homepic from '@a/images/iconku/u3225.png' import companypic from '@a/images/iconku/u3827.png' const Wrap=styled.div` height: 100%; width:100%; display:block; position: relative; background-color:rgba(242, 242, 242, 0.6); .back{ display:block; position: ...
// Object Literal // let mahasiswa = { // nama: "Fadli", // kekuatan: 90, // makan: function (porsi) { // this.kekuatan+=porsi; // console.log(`Selamat makan ${this.nama}`); // } // } //Object Function Declaration // function Mahasiswa(nama,kekuatan) { // let mahasiswa...
import React from 'react'; import { createAppContainer, createSwitchNavigator } from 'react-navigation'; import MainTabNavigator from './MainTabNavigator'; import Login from '../screens/Login'; import Signup from '../screens/Signup'; import Fridge from '../screens/Fridge'; import ExpoCam from '../screens/ExpoCam'; imp...
const args = require('minimist')(process.argv.slice(2)); const DOMParser = require('xmldom').DOMParser; const fs = require('fs'); Array.prototype.asyncReduce = async function(cb, init) { let pre = init; for(let i=0; i<this.length; i++) { pre = await cb(pre, this[i], i, this); } return pre; }; ...
const Sequelize = require('sequelize'); module.exports = function(sequelize, DataTypes) { return sequelize.define('DirectoryCountryRegion', { region_id: { autoIncrement: true, type: DataTypes.INTEGER.UNSIGNED, allowNull: false, primaryKey: true, comment: "Region ID" }, countr...
import React, { Component } from 'react'; import { withRouter } from 'react-router-dom'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import Layout from './Layout'; //可以抽出来? class Index extends Component { //TODO constructor(props) { super(props); this.state = { ...
export const GET_ALL_QUESTIONS = 'GET_ALL_QUESTIONS'; export const GET_ALL_QUESTIONS_LOAD = 'GET_ALL_QUESTIONS_LOAD'; export const GET_ALL_QUESTIONS_SUCCESS = 'GET_ALL_QUESTIONS_SUCCESS'; export const GET_ALL_QUESTIONS_FAIL = 'GET_ALL_QUESTIONS_FAIL'; export const SET_CURRENT_QUESTION = 'SET_CURRENT_QUESTION'; export...
import React, {useState} from 'react'; import { Menu,Container,Button } from 'semantic-ui-react'; import SignedInMenu from './SignedInMenu'; import SignedOutMenu from './SignedOutMenu'; import { BrowserRouter as Router, Link, NavLink } from "react-router-dom"; import { useHistory } from "react-router-do...
import isBlank from '../isBlank' import isPresent from '../isPresent' describe('Presence', () => { test('empty values', () => { [null, undefined, false, '', ' ', [], {}].forEach((value) => { expect(isBlank(value)).toBe(true) expect(isPresent(value)).toBe(false) }) }) test('non empty values',...
/* jshint browser: true */ /* jshint unused: false */ /* global arangoHelper, Backbone, templateEngine, $, window, _, nv, d3*/ (function () { 'use strict'; window.ShardDistributionView = Backbone.View.extend({ el: '#content', hash: '#distribution', template: templateEngine.createTemplate('shardDistribu...
import request from 'supertest'; import mongoose from 'mongoose'; import config from '../src/configuration/config.js' import {generalToken} from '../src/helper/token.js'; import blogCollection from '../src/models/blogMod.js'; import app from '../app.js'; const databaseUrl = config.TESTING_DB; jest.useFakeTimers(); d...
const assertArraysEqual = require('chai').assert; describe('#assertArraysEqual', () => { it('should pass when both arrays are equal', () => { assertArraysEqual.deepEqual([1, 2, 3], [1, 2, 3]); }); });
(function() { 'use strict'; angular.module('app') .factory('answersService', answersService); answersService.$inject = ['$http', 'appConstants']; function answersService ($http, appConstants) { return { getAnswersByQuestion: getAnswersByQuestion, deleteAnswers: ...
'use strict'; const rp = require('request-promise-native'); const client = require('./clients/eurest'); class Restaurant { constructor(name, url, parser, client, id, color) { this.name = name; this.url = url; this.color = color; if(client) { this.client = require(client); this.id = id; ...
const Matter = require("matter-js"); class GameObject { constructor({ id, x = 0, y = 0, width = 1, height = 1, color = "brown", angle = 0 }) { this.id = id; this.x = x; this.y = y; this.width = width; this.height = height; this.color = color; this.angle = angle; this.body = Matter.B...