text
stringlengths
7
3.69M
require("../common/vendor.js"), (global.webpackJsonp = global.webpackJsonp || []).push([ [ "pages/building/img_preview/_audio_player" ], { "1e53": function(n, e, t) { var i = t("ed86"); t.n(i).a; }, 4653: function(n, e, t) { t.d(e, "b", function() { return i; }), ...
module.exports = { cmd: function() { this.shell.print('playing console...') lab.vm.pause = false }, help: 'resume the playback' }
import { createSlice } from "@reduxjs/toolkit"; const signIn = createSlice({ name: "signIn", initialState: { email: "" }, reducers: { signInVerifyEmail: (state, action) => { state.email = action.payload; }, }, }); const { reducer, actions } = signIn; export const { signInVerifyEmail } = actions; export def...
import React, { Component } from 'react'; /* Custom React components */ import RequestService from '../../Services/RequestService'; let HOST = "https://" + window.location.hostname; const PORT = window.location.port; if (PORT !== '3000') { HOST += ':' + PORT; } class Settings extends Component { constructor(...
import React, {useState, createContext,useEffect} from 'react'; export const AuthContext =createContext(); const AuthContextProvider = (props) => { const[austate, setAuth]=useState( { isAutentificated: false, message:"", id:'', role:'', 'salary':'', 'assets_pa...
import { useState, useEffect } from 'react' import Link from 'next/link' import Router from 'next/router' import $api from '../api' import { Affix, Row, Col, Menu } from 'antd' import { HomeOutlined, YoutubeOutlined, SmileOutlined } from '@ant-design/icons' import '../styles/components/header.css' const Header = () =>...
const ONE_TO_MANY = () => { const sql = `SELECT employee.employeeID, employee.name AS employee_name, employee.role AS employee_role, employee.address AS employee_address, customers.customersID, c...
'use strict'; const CryptoJS = require("crypto-js"); let express = require('express'); let router = express.Router(); //path: /bai-giai let subjects = { 'toan': { id: 2, name: 'Toán', max_round: 19, test_count: 3, free: true }, 'tieng-anh': { id: 3, name: 'Tiếng Anh', max_round: 19, test_count: 3...
define([ 'app' ], function (app) { app.registerFilter('isSuperAdmin', function () { return function (value) { return value ? '超级管理员' : '管理员'; } }); });
var express = require('express'); var roomTypesRouter = express.Router(); //------------------------------------------------------------------------ // Models var RoomType = Utils.getModel('RoomType'); //------------------------------------------------------------------------ // Validator var validator = Utils.getVal...
const crypto = require('crypto') module.exports = { getData(userCookie) { const shasum = crypto.createHash('sha1') shasum.update(userCookie) // similate aysnc service call here return new Promise((res) => { setTimeout(() => { const sha = shasum.digest('hex') res(sha) }, 1...
import {instance} from './AuthenticationService'; export const API_ADMIN = '/admin' export const API_ORGANIZATION_ALL = API_ADMIN + '/organization/all' export const API_ADD_ORGANIZATION = API_ADMIN + '/organization/add/organization' export const API_FILE = '/file' export const API_FILE_UPLOAD = API_FILE + '/upload' ...
import PropTypes from 'prop-types' import React from 'react' import pic01 from '../images/pic01.jpg' import pic02 from '../images/pic02.jpg' import pic03 from '../images/pic03.jpg' import evcharger from '../images/EVcharger.jpeg' import home from '../images/home.jpeg' import industrial from '../images/industrial.jpeg' ...
import React from 'react' import { Box } from 'theme-ui' const Divider = ({ space, line }) => ( <Box sx={{ minWidth: `auto`, borderTopStyle: `solid`, borderTopColor: line ? `grayLighter` : `transparent`, borderTopWidth: 2, height: 0, my: [space - 1, space] }} /> ) expor...
'use strict'; module.exports = Bitset; function Bitset () { this.intArray = [0,0]; } Bitset.prototype.put = function (i) { this.intArray[i >>> 5] |= 1 << (31 & i); return this; } Bitset.prototype.flip = function (i) { this.intArray[i >>> 5] ^= 1 << (31 & i); return this; } Bitset.prototype.remove = func...
 const hubConnection = new signalR.HubConnectionBuilder() .withUrl("/chat") .configureLogging(signalR.LogLevel.Information) .withAutomaticReconnect() .build(); hubConnection.serverTimeoutInMilliseconds = 1000 * 60 * 10; // 1 second * 60 * 10 = 10 minutes. let userName = "123"; let message = { name:...
const amqp = require('amqplib/callback_api') const CONN_URL = 'amqp://ykehzqib:[email protected]/ykehzqib'; module.exports = function(cb) { amqp.connect(CONN_URL, function(err, conn) { if (err) { throw new Error(err) } cb(conn) }) }
/** * 验收中心不通过 */ import React, { Component, PureComponent } from "react"; import { StyleSheet, Dimensions, View, Text, TextInput, TouchableOpacity, } from "react-native"; import { connect } from "rn-dva" import moment from 'moment' import CommonStyles from '../../common/Styles' import Header ...
'use strict'; const supportedTypes = ['staffClassification', 'styles']; const COLLECTION = 'config'; class ConfigRepository { constructor(firestore) { this.firestore = firestore; } /** * Query for all the contents within the config * collection associated with the provided document * * @param {...
export const displayModal= () => { const backdrop = document.getElementById('backdrop') backdrop.classList.remove('display-none') document.getElementById('close-modal').addEventListener('click', () => { backdrop.classList.add('display-none') }) }
var fxApp = angular.module('pricing'); fxApp.controller('LoginCtrl', function($scope, $rootScope, $state, AUTH_EVENTS, AuthService) { $scope.credentials = { useremail: '', password: '' }; $scope.loginResult = null; $scope.login = function(credentials) { AuthService.login(crede...
/* jshint indent: 2 */ module.exports = function(sequelize, DataTypes) { return sequelize.define('acc_integrations', { acc_integrations_id: { type: DataTypes.INTEGER(10).UNSIGNED, allowNull: false, primaryKey: true, autoIncrement: true }, acc_environment_id: { type: DataType...
const countLetters = data => { const noSpaces = data.replace(/ /g, ""); //g removes all spaces (g for global) let result = {}; for (let i = 0; i < noSpaces.length; i++) { if (!result[noSpaces[i]]) { result[noSpaces[i]] = [i]; } else { result[noSpaces[i]].push(i); } } return res; }; ...
var mongoose = require("mongoose"); var Schema = mongoose.Schema; var TheatreSchema = Schema({ name: String, address: String, other: String, pin:String }); module.exports = mongoose.model('Theatre', TheatreSchema);
const PREFIX = '$$route'; const exportMethod = {}; // define absolute url exportMethod.full = {}; const throwError = (msg) => { throw new Error(msg); }; const getFullTag = isFull => (isFull ? 'F' : ''); function destruct(args) { const hasPath = typeof args[0] === 'string'; const path = hasPath ? args[0] : '';...
/* Author: Byron Lutz */ /***** ENABLE DONATE BUTTON *****/ $(document).ready(function() { $('.menu-donate a').click(function(e) { e.preventDefault(); $.pressplus.f.pop('plans'); }); }); /***** CONTROL SIDEBAR POPULAR STORIES TABS *****/ $(document).ready(function() { $('#popular-select').click(sidebarChan...
var express = require('express'); var router = express.Router(); var passport = require('passport'); const app = express(); var dashboardController = require('../controllers/dashboardController'); router.get('/', dashboardController) /* GET leaderboard stats. */ router.get('/dashboard', function(req, res, next) { ...
import React, { useState } from 'react'; import { connect } from 'react-redux'; import { login } from '../actions'; import styled from 'styled-components'; import FriendForm from './FriendForm'; const Wrapper = styled.div` form { margin-top: 20px; display: flex; justify-content: center; } input { ...
/* Create a function that moves all capital letters to the front of a word. Examples capToFront("hApPy") ➞ "APhpy" capToFront("moveMENT") ➞ "MENTmove" capToFront("shOrtCAKE") ➞ "OCAKEshrt" */ function capToFront(s) { let res=''; for(let i=0;i<s.length;i++) { if(s.charAt(i).codePointAt(0)>=65 && s.ch...
//[string]replace([old],[new]) var email = "[email protected]"; var newEmail = email.replace("udacity","gmail"); console.log(email); console.log(newEmail); var bio = { "name" : "Vincent Huang", "role" : "Product Manager", "contacts" : { "mobile" : "+1 415.547.0369", "github" : "huangv22", "twi...
import Levenshtein from 'fast-levenshtein' class PlayerMatching { static getBestPlayerMatch(playerName, players) { console.log(playerName) console.log(players) const matches = [] const filteredPlayers = players.filter(player => player.toLowerCase().includes(playerName.toLowerCase())...
function ready(){ console.log("Sono pronto a caricare tutti gli smartlife services"); var idcategoria=1; $.ajax({ method: "POST", crossDomain: true, //localhost purposes url: "includes/php/query.php", //percorso file.php data: {query : "SELECT * FROM categoriasmartlifese...
import React, { useState } from 'react'; import Agenda from "./Agenda"; var w = window.innerWidth; var h = window.innerHeight; export default function PageY() { return( <div style={{ background: '#fff', padding: 24, minHeight:h/1.1,backgroundColor:'#ebebeb' }}> <h1 style={{alignSelf:'center'...
const Card = (prop) => { return ( <div> <img width='100' src={prop.avatar_url} /> <div style={{fontWeight: 'bold'}}> {prop.name} </div> <div> {prop.company} </div> <div> {prop.bio} ...
/* 1)Write a function, which receives an array as an argument which elements arrays of numbers. Find biggest negative number of each array. Return product of that numbers.If there is not any negative number in an array, ignore that one. Check that items of the given array are arrays. Input ...
import React from 'react'; import PropTypes from 'prop-types'; function Product({ imgUrl, name, price, quantity }) { return ( <div> <img src={imgUrl} alt={name} width="640" /> <h2>{name}</h2> <p>Price: {price}$</p> <p>Quantity: {quantity < 50 ? 'Few left' : 'In stock'}</p> <button ...
"use strict"; var _ = require("lodash"); var React = require("react"); var Category = require("./Category.jsx"); var Tags = require("./Tags.jsx"); var GITHUB_REGEX = new RegExp('github.com/(.*?)/([^/?#]+)'); var VIMORG_REGEX = new RegExp('vim.org/scripts/script.php\\?script_id=\\d+'); // TODO(david): Form validatio...
import React from "react"; import Pokegame from './Pokegame'; function App() { function refreshPage() { window.location.reload(false); } return ( <div className="App"> <Pokegame /> <div className="container col-10"> <button className="btn btn-success p-3 my-5 d-block text-center" onC...
const util = require("util"); const gc = require("../config/index"); const bucket = gc.bucket("shrtcast_test"); exports.uploadImage = (file) => new Promise((resolve, reject) => { let filename = Date.now() + ".mp3"; const blob = bucket.file(filename); const blobStream = blob.createWriteStream({ r...
import React from "react"; import {Card} from "antd"; const {Meta} = Card; const Customize = () => { return ( <Card hoverable cover={<img alt="example" src="https://os.alipayobjects.com/rmsportal/QBnOOoLaAfKPirc.png"/>} > <Meta title="Europe Street beat" descrip...
import React from "react"; import { Input, Button } from "antd"; import "antd/dist/antd.css"; import "./styles.css"; const DataEntry = (props) => { const { inputValue, onChangeInput, onPressEnterInput, onClickButton, buttonText, } = props; return ( <div className="inputStyle"> <I...
const view = (namespace, view) => { const namespaced = () => view namespaced.namespace = String(namespace) return namespaced } const reducers = (config) => (state, {type, payload}) => { const [namespace, ...rest] = type.split('.') if (config[namespace]) { return { ...state, [namespace]: confi...
var Action = require("../model/Action"); exports.receive = function(msge){ var message = msge.split(";"); var type = message[2]; switch(type){ case "RPCRequest": var data = message[3]; var rpc = data.split("|"); var funcName = rpc[0]; var paras = rpc[1].split(","); //call function by funcName.and 调用rpc...
window.FlickrGallery = (function(undefined) { "use strict"; var GalleryStage = 'flickr-gallery'; var GALLERY_TILE = 'c-gallery-tile', SELECTED_CLASS = 'is-selected'; function init(data){ if(!document.getElementById(GalleryStage)){ return; } setupGallery(data); addListeners(); ...
export default class Spa_util { /** * [setConfigMap common code to set configs in feature modules] * @param {[type]} arg_map * [ * * input_map - map of key-values to set in config * * settable_map - map of allowable keys to set * * config_map - map to apply settings to *...
import React from 'react'; // JSX 문법 규칙 (3) // JSX 내부의 자바스크립트 표현식에서 if문을 사용할 수 는 없습니다. // 하지만 조건에 따라 다른 내용을 렌더링해야 할 때는 // JSX 밖에서 if문을 사용하여 사전에 값을 설정하거나, // {} 안에 조건부 면산자를 사용하면 됩니다. function App(){ const name = '장나라'; return ( <div> {name === '장나라' ? (<h1>장나라 입니다.</h1>) : (<h2>장나라가 아닙니다...
import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex) export default new Vuex.Store({ state:{ msg:'', lists:[] }, mutations:{ change(state,value){ state.msg=value }, savelist(state,value){ state.lists=value } } })
const request = require('supertest'); const crypto = require('crypto'); const server = request('http://localhost:1337'); let token = ""; const deviceName1ToUse = crypto.randomBytes(10).toString('hex'); let lastInsertedId = 1; console.log("using as first cfg: "+deviceName1ToUse); it('authenticate correct', done => { ...
export default { name: "Level 3", content: ` <div class="container"> <div class="intro-1" style="display: block"> <h5>Conditionals and if statements:</h5> <ul> <li>A conditional is a line of code that resolves to <code>true</code> or <code>false</code>.</li> <li>A ...
import Promise from 'bluebird' import fs from 'fs' import minimist from 'minimist' import fetch from 'node-fetch' import { errorExit, catchErrors, checkJSONHeader, checkGraphQLError } from './errors' const readFile = Promise.promisify(fs.readFile) const argv = minimist(process.argv.slice(2)) const graphEndpoin...
import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { View, TouchableOpacity } from 'react-native'; import moment from 'moment'; import Icon from 'react-native-vector-icons/Ionicons'; import { defaultAvatar } from 'kitsu/constants/app'; import { Avatar } from 'kitsu/screens/Feed/com...
import React from 'react'; import PropTypes from 'prop-types'; import { StyledResponsiveDiv, StyledNavList, StyledCollapsableNav } from './Navbar.styles'; import MenuButton from '../MenuButton/MenuButton'; import {Link} from 'react-router-dom'; const pages = [ { title:"Home", path:"/" } ] cons...
import React, { Component } from "react"; import { createStackNavigator } from 'react-navigation-stack'; import { createSwitchNavigator, createAppContainer, } from "react-navigation"; import { Root } from "native-base"; // import Login from './Login/Login'; import MainScreen from './screens/Main'; import {...
import React, { useContext, useEffect } from 'react'; import TodoContext from '../../context/todoContext/TodoContext'; import Todo from '../todoList/todo/Todo'; import { Paper, Typography, } from '@material-ui/core'; import './todoList.css'; function TodoList() { const todoContext = useContext(TodoCo...
const now = new Date();//текущая const now1 = new Date(0);// миллисекунд от 1970 года(учитывая пояса) const now2 = new Date(-41412342142342342342); // отрицательное колличество миллисекунд - чтоубы уйти за 1970 const now3 = new Date(20 , 6 , 1, 2); //задаём в ручную console.log(now); console.log(now.getFullYear()); con...
const { Router } = require("express"); const statusMonitor = require("express-status-monitor"); const cors = require("cors"); const bodyParser = require("body-parser"); const compression = require("compression"); const methodOverride = require("method-override"); const controller = require("./utils/createControllerRout...
app.post('/api/users/signin', userController.signin);
import Vue from 'vue' import App from './App.vue' import router from './router' import store from './store/index' //引入vant组件 import Vant from 'vant' import 'vant/lib/index.css' //引入提示组件 import {Toast} from 'vant' //懒加载组件 import lazyLoad from 'vue-lazyload' import http from 'network/request.js' Vue.prototype.$http = ht...
'use strict'; // Embed the following file to a HTML document: // - From the previous flickr example extract the .jpg link directly // - Create an image tag in the with document.createElement // - Add a 'load' event to the image and only show the image to the user when the image is loaded var newImg = document.crea...
require('dotenv').config(); module.exports = { netgear: { username: process.env.NETGEAR_USERNAME, password: process.env.NETGEAR_PASSWORD, references: JSON.parse(process.env.NETGEAR_REFERENCES) }, openWeatherMap: { apiUrl: process.env.OPEN_WEATHER_MAP_API_URL, apiKey: process.env.OPEN_WEATHER_...
function MyPromise(fn) { this.value; this.resolveFun = function () {console.log('resolve null')} this.rejectFun = function () {console.log('reject null')} fn(this.resolve.bind(this),this.reject.bind(this)) } MyPromise.prototype.resolve = function(val) { var self = this; self.value=val; setTi...
import { or } from '@ember/object/computed'; import { computed } from '@ember/object'; import Component from '@ember/component'; import layout from './template'; export default Component.extend({ layout, tagName: 'button', classNames: ['bg-button', 'btn', 'ember-appointment-slots-pickers'], classNameBindings:...
import {Meteor} from 'meteor/meteor'; import {Template} from 'meteor/templating'; import {ReactiveDict} from 'meteor/reactive-dict'; import {Tasks} from '../api/tasks.js'; import './header.html'; import './list.html'; Template.list.onCreated(function bodyOnCreated() { this.state = new ReactiveDict(); Meteor.subs...
function addFunction(row, store, vendorid) { var cde_dt_shp; var pwy_dte_ctl; var cde_dt_var; var cde_dt_incr; var vendor_id; var editFrm = Ext.create('Ext.form.Panel', { id: 'editFrm', frame: true, plain: true, defaultType: 'textfield', layout: 'anchor',...
(function () { angular .module('myApp') .controller('GroupTextViewController', GroupTextViewController) GroupTextViewController.$inject = ['$state', '$scope', '$rootScope', '$sce']; function GroupTextViewController($state, $scope, $rootScope, $sce) { $rootScope.setData('showMenuba...
const config = { apiKey: "AIzaSyBZypGBE4lhAMF5B_yS9_JjohVFVC78mhs", authDomain: "safelocation-518d0.firebaseapp.com", databaseURL: "https://safelocation-518d0.firebaseio.com" } export default config;
import React, {useState, useEffect} from 'react'; import { Text, StyleSheet, ScrollView, View, Pressable } from 'react-native'; import Axios from 'axios' import Movie from '../componets/Movie' import { Service } from 'axios-middleware'; // Middleware logging message in console const service = new Service(Axio...
import React , { PropTypes } from 'react'; var ReactDOM = require('react-dom'); import { combineReducers, createStore } from 'redux'; import { Provider, connect } from 'react-redux'; // import loggingMiddleware from './loggingMiddleware'; import CalorieInput from './input'; import TimeToBurn from './time'; import P...
import { SONGS } from './actionTypes'; export const initialState = { songs: [], songsFeching: false, songsFetchingError: null, paginationEnded: false, likeSuccess: null, likeFetching: false, likeError: null, commentSuccess: null, commentFetching: false, commentError: null, currentIndex: 0, }; ...
$(function() { console.log( "ready!" ); $("#query").on("click", function(e){ $panel=$("#querypanel"); $panel.slideDown(); if( $panel.is(":visible") ) { $(this).text("query <"); } else $(this).text("query >"); } ); });
let mock = [{ id:1, CountryName: "Angola", CountryCode: "AO", Latitude: -9.2993916, Longitude: 14.9096846, TimeZone: "Africa/Luanda", image:'https://upload.wikimedia.org/wikipedia/commons/thumb/f/ff/Emblem_of_Angola.svg/800px-Emblem_of_Angola.svg.png' }, { id:2, CountryName: "Bo...
// user-based collaborative filtering const Match = require('../core/match.js') const Sets = require('../algorithm/sets.js') const recommendations = (prefs, person, formula) => { const matches = Match(prefs, person, prefs.length, formula) const items1 = Object.keys(prefs[person]) let totals = {} let sumSimil...
//function //Bài 1. Viết 1 function tính bình phương của 1 số. Tham số truyền vào là 1 số. Kết quả là bình phương của số đó. function func1(a) { return (a * a) } //Bài 2. Cho 3 số a, b và c. Viết function tính bình phương của (3a + 2b - c). Tham số truyền vào là 3 số a, b, c. Kết quả là bình phương của (3a + 2b...
const ClientList = zoid.create({ tag: 'zoid-client-list', url: 'http://localhost/modularrazorweb/clientlist/show', dimensions: { width: '100%', height: '100%' } }); ClientList().render('#container-client-list');
var EVENTS = (function () { var my = {}; my.caughtPoint = function () { LOGIC.generateNewPointPosition(); LOGIC.scorePlusOne(); LOGIC.snakeIncrease(); }; my.clashBorders = function () { DRAW.gameOver(); }; my.clashTail = function () { DRAW.gameOver(); ...
import React, { useEffect, useRef } from 'react' import { node, number, string } from 'prop-types' import classes from './parallax.module.scss' const Parallax = ({ src, children, threshold = .2 }) => { const ref = useRef() function parallax() { if (ref && ref.current) { const yOffset = window.pageYOffse...
editFunction = function (row, store) { Ext.define('GIGADE.EmsGoalComActual', { extend: 'Ext.data.Model', fields: [ { name: 'department_code', type: 'string' }, { name: 'department_name', type: 'string' } ] }); var EmsGoalComStoreActual = Ext.create("Ext.data....
import React from 'react' import { Switch, Route } from 'react-router-dom' import ProtectedRoute from '@/components/ProtectedRoute' import Login from '@/views/Login' import Home from '@/views/Home' function Router() { return ( <Switch> <Route path='/login' component={Login} /> <Protecte...
const path = require('path') global.currentRootDir = path.join(__dirname, '..') global.rootRequire = function (name) { return require(path.join(__dirname, '..', name)) }
import React from "react"; import { connect } from "react-redux"; import { Link } from "react-router-dom"; import { getComments, postComment } from "./actions"; const mapStateToProps = (state, props) => { return { ...props, comments: state.wallpost[props.id], users: state.users }; }; c...
import test from 'ava'; import parseRoutes from '../../src/server/router/parseRoutes'; test('parseRoutes', (t) => { t.deepEqual(parseRoutes({}), []); t.is(parseRoutes({ quan: './data/aaa.json', '/quan': './data/aaa.json', }).length, 1); t.is( parseRoutes({ '/quan': './data/aaa.json', '...
// @flow import { runCreate } from '../../../helpers/database'; import type { TokenRecord } from '../types'; export const NO_TOKEN_ERROR = 'addToken requires a token parameter'; export const BAD_TOKEN_TYPE_ERROR = 'addToken requires a string token'; const addToken = async ( token: string ): Promise<TokenRecord | Er...
/** * Set global variables */ // structure of Array [element type, number of used arguments] // "-1" stand for infinity var _GatherList = [ [ "AND", -1 ], [ "OR", -1 ], [ "NOT", 1 ] ]; // a global counter for generating unique system id's - need for event // communication between designer field and rules m...
import React from 'react'; import PropTypes from "prop-types"; import { withStyles } from 'material-ui/styles'; import List, { ListItem, ListItemIcon, ListItemText } from 'material-ui/List'; import IconButton from 'material-ui/IconButton'; import Divider from 'material-ui/Divider'; import AddIcon from 'material-ui-icon...
describe('pixi/display/DisplayObjectContainer', function () { 'use strict'; var expect = chai.expect; var DisplayObjectContainer = PIXI.DisplayObjectContainer; it('Module exists', function () { expect(DisplayObjectContainer).to.be.a('function'); }); it('Confirm new instance', function...
// Mostrar una serie de números del 0 al 15 // Cada vez que nuestra variable tome el valor de 3 o un multiplo, mostrar fizz // Cada vez que nuestra variable tome el valor de 5 o un multiplo, mostrar buzz // y si es multiplo de 3 y 5 mostrara la frese FizzBuzz for (var dato = 0; dato<16; dato++){ // var modulo3 = (d...
const express = require("express"); const app = express(); const mongoose = require("mongoose") const cors = require("cors"); require('dotenv').config(); //Importing My Routes const todoRoutes = require("./routes/todos") app.use(cors()) app.use(express.json()) //DB Connection mongoose.connect(process.env.ATLAS_URI,...
/** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: Apache-2.0 */ /** * @fileoverview Defines the GenericMap. */ 'use strict'; import {PriorityQueueMap} from './priority_queue_map'; /** * The priority for binding an explicit type to a generic type based on an input * of the block with the g...
const encodeFormData=(data)=>{ return Object.keys(data) .map(key=>encodeURIComponent(key)+"="+encodeURIComponent(data[key])) .join("&"); } function submitForm(ev){ ev.preventDefault() let clientName = document.querySelector("#clientName").value let clientURI = document.q...
// ... rest, ... spread /* const numbers = [10, 20, 30, 40, 50, 60, 70, 80, 90]; const [firstNumber, , thirdNumber, , fifthNumber, , ...rest] = numbers; console.log(firstNumber, thirdNumber, fifthNumber); */ // 0 1 2 // 0 1 2 0 1 2 0 1 2 const numbers...
$(function(){ let kigo = ['!','#','$','%','&','=','@','+','!','#','$','%','&','=','@','+']; let sels = []; //配列のシャッフル for(let i=0; i<20; i++){ let r1 = Math.floor(Math.random() * 16); let r2 = Math.floor(Math.random() * 16); let tmp = kigo[r1]; kigo[r1] = kigo[r2]; kigo[r2] = tm...
import { QuickSend, QuickQuote } from './models'; import { QuickSendView } from './views'; if (HAS_QUICK_SEND === true) { let contact = new QuickSend(), quote = new QuickQuote(), formView = new QuickSendView({ model: contact, quoteModel: quote }); formView.render(); }
/* //////////////////////////////////////////////////////////////////////// */ /* */ /* //////////////////////////////////////////////////////////////////////// */ import Utils from 'web3-utils' import PluginBN from './plugin-bignumber' /* //////////////////////////////////////////////////////////////////////// */ /*...
const getDb = require('../database/db').getDb; function isUsernameUsed(username) { const db = getDb(); return new Promise((resolve, reject) => { const queryText = 'SELECT username FROM users WHERE username = $1'; const queryValues = [username]; // parameterized query to avoid sql injections ...
import { Navigation } from '../../../src/Navigation'; jest.unmock('@railsmob/events'); describe('Navigation', () => { describe('.lock', () => { it('should set locked to true', () => { const navigation = new Navigation(); expect(navigation.locked).toBeFalsy(); navigation.lock(); expect(na...
// pages/search/search.js import { me, xmini, xPage, } from '../../config/xmini'; import api from '../../api/index'; import mixins from '../../utils/mixins'; import { debounce } from '../../utils/index'; const app = getApp(); let localHistory = []; xPage({ ...mixins, /** * 页面的初始数据 */ data: { his...
const solution = { 0 : { type: "number", solution : 4, unit: "N", }, 1 : { type: "number", solution : -1, unit: "N", }, 2 : { type: "number", solution : -2, unit: "N", }, }; // Find a way to specify sets of equations being s...
//定义在不改变对象的前提下添加新的操作方法。 //主要是call和apply的使用 利用回调函数 //从而造成类数组对象 var Vistor = (function () { return { splice: function () { var args = Array.prototype.splice.call(arguments, 1) return Array.prototype.splice.apply(arguments[0], args) }, push: function () { va...
import React, { Component } from "react"; import "./Setup.css"; class Setup extends Component { reportState = this.props.reportState; state = this.props.state || { id: 0, newPlayerName: "", players: [], play: false, }; enterGame = () => { this.reportState(this.state); this.props.enterGa...
define('component/imgUpload', ['jquery', 'KM', 'weui'], function ($, KM, Weui) { var exports = {}; //初始化 exports.init = function (selector, options) { var self = this; self.options = options; self.$imgWraps = $(selector); this.$imgWraps.find(".upload-img").append('<form acti...