text stringlengths 7 3.69M |
|---|
import React from "react";
export default function MountaintCard(props) {
return (
<div
className="mountaint-"
style={{ width: "110%",
maxWidth: "1000px",
backgroundColor: "lightgrey",
borderRadius: "10px" }}
>
<h1 className="mountaint-head">{props.header}</h1>
<p cl... |
/*
* Reception Server
*
* This is the start up script for Reception Server, part of the kernel.
*/
require('./lib/baum.js');
require('./lib/_.js');
CONFIG = $.config.createConfig('./config/');
SESSION = {};
IPC = {};
outputError = function(e, code, message){
var output
= '<!DOCTYPE html PUBLIC "-//W3C... |
const sgMail = require('@sendgrid/mail');
const emailConfig = require('../config/emailConfig')();
exports.sendSendGridEmail = (recipients, message) => {
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
const data = {
from: emailConfig.senderAddress,
to: recipients.to,
cc: recipients.cc,
bcc: recipie... |
/*
* @lc app=leetcode id=51 lang=javascript
*
* [51] N-Queens
*
* https://leetcode.com/problems/n-queens/description/
*
* algorithms
* Hard (43.70%)
* Likes: 1550
* Dislikes: 65
* Total Accepted: 185.6K
* Total Submissions: 418K
* Testcase Example: '4'
*
* The n-queens puzzle is the problem of pla... |
import { types } from './filters.actions'
const INITIAL_STATE = {
sports: [],
dates: [],
price: 'Infinity',
}
export default function filtersReducer(state = INITIAL_STATE, action = { type: '' }) {
switch (action.type) {
case types.SET_SPORT_FILTER:
return {
...state,
sports: action.p... |
function transformMap(mapObj, rand) {
var maxX = 0;
var maxY = 0;
for (var i = 0; i < mapObj.diagram.cells.length; i++) {
if(mapObj.diagram.cells[i].site.x > maxX) maxX = mapObj.diagram.cells[i].site.x;
if(mapObj.diagram.cells[i].site.y > maxY) maxY = mapObj.diagram.cells[i].site.y;
}
var grid = mapOb... |
import * as types from './mutation-types'
import { $message } from '@/element'
export default {
// 获取系统公告
async getFindBulletinPage({ state, commit }, terms = {}) {
const res = await this.$ajax.post(this.$apis.getAllSystemMsgList, {
msgType: 3,
page: 1,
size: 5,
...terms,
})
if ... |
alert('Hello,Kotoha');
|
import React from 'react'
import {Row, Col} from 'react-bootstrap'
import { connect } from 'react-redux'
import Header from '../components/Header/customHeader'
import './index.scss'
function RefTC(props) {
console.log(props)
return (
<>
<Header title={'Affiliate – Terms & Conditions'} backButton... |
if( isFileInURL( "portfolio" ) )
{
displayPortfolio();
}
function displayPortfolio()
{
if( sessionStorage.getItem( "current_sort" ) === null )
{
sessionStorage.setItem( "current_sort", "lang=fa-sort-asc" );
}
getProjects();
}
function getProjects() //display the projects and... |
import { NavLink } from 'react-router-dom';
import routes from '../../routes';
import styles from './LoginBar.module.scss';
const LoginBar = () => {
return (
<div>
<NavLink
to={routes.register}
exact
className={styles.link}
activeClassName={styles.activeLink}
>
... |
import React from 'react';
import { connect } from 'react-redux';
import { withRouter, Redirect } from 'react-router-dom';
import { setSelectedReason } from '../actions'
import Employee from './Employee';
const mapStateToProps = state => {
return {
selectedEmployee: state.selectedEmployee,
reasons: state.rea... |
import Snackbar from "./snackBar";
import Navbar from "./navbar";
import Footer from "./footer";
export { Snackbar, Navbar, Footer };
|
import React from 'react';
import '../../styles/style.scss';
/*
d is a string containing a series of path commands that define
the outline shape of the glyph it is unique for every svg image/icon.
*/
export const Button = ({cls, children, border, fn, icon, clsIcon, iconStroke, d}) => (
<div className="interac... |
.html()
.text()
.replaceWith()
.remove()
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const command_1 = require("@oclif/command");
const toolbelt_api_test_1 = require("@thiagoveras/toolbelt-api-test");
class HelloB extends command_1.Command {
async run() {
this.parse(HelloB);
this.log(`Hello from Plugin B at... |
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PartController = void 0;
const BaseController_1 = require("./interfaces/base/BaseController");
const PartsSchema_1 = require("../app/persistance/schemas/PartsSchema");
const PartService_1 = require("../app/services/PartService");
class... |
//Server info
var hostname = 'webrtctest2.zapto.org';
var port = 80;
var socket = io(hostname + ':' + port);
var audio = document.querySelector('audio');
var id = document.getElementById('id');
/*socket.on('s', function(s) {
audio.src = window.URL.createObjectURL(s);
});*/
socket.on('id', function(id) {
id.value... |
const s = "aabbaccc";
const solution = (s) => {
var answer = s.length;
for (let i = 1; i <= s.length; i++) {
//압축할 단어
let newString = "";
let count = 1;
for (let j = 0; j < s.length; j += i) {
let word = s.substring(j, j + i);
let nextWord = s.substring(j + i, j + i * 2);
if (word... |
'use strict';
import React, {Component} from 'react';
import {
FlatList,
AppRegistry,
StyleSheet,
Text,
View,
Image,
Alert,
TouchableOpacity,
NativeModules,
Dimensions,
SectionList,
} from 'react-native';
export default class Zhibo_Match extends React.PureComponent{
st... |
function isLoadImg(el) {
let ele = typeof el === "object" ? el : document.querySelector(el)
let bound = ele.getBoundingClientRect()
let clientHight = window.innerHeight
let clientWidth = window.innerWidth
return !(
bound.top > clientHight ||
bound.bottom < 0 ||
bound.left > clientWidth ||
bou... |
var map = L.map('map',{ zoomControl:true }).setView([4.344426, -74.358292],14);
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>,... |
import Joi from 'joi';
const expenseItemFields = {
type: Joi.string().max(250).required(),
date: Joi.date().iso().required(),
description: Joi.string().max(250).required(),
net: Joi.number().positive().precision(2).required(),
vat: Joi.number().positive().precision(2).default(0),
};
const expenseFields = {
... |
DB.record.allow(
{'insert' :
function(userID, doc) {
var result = false
, room
;
doc.time = Date.now();
doc._id = (doc.time + '');
doc.user = userID;
if (userID === TRPG.adm || doc.room === TRPG.public.id) {
result = true;
}
e... |
$(function() {
function showModal($id) {
if ($('#modal-' + $id + '').hasClass('modal-hide')) {
$('#modal-' + $id + '').removeClass('modal-hide');
}
$('#modal-' + $id + '').addClass('modal-display');
}
function hideModal($id) {
if ($('#modal-' + $id + '')... |
const button = document.querySelector("button");
const header = document.querySelector("h1");
button.addEventListener("click", () => {
fetch("https://api.adviceslip.com/advice")
.then((monkey) => monkey.json())
.then((data) => {
header.innerHTML = data.slip.advice;
});
});
|
exports.up = async function(knex, Promise) {
await knex.schema.createTable("concerts", table => {
table
.increments('id')
.notNullable()
.primary;
table.string('title').notNullable();
table.string('band').notNullable();
table.string('venue').notNul... |
import React, { Component } from "react";
import "./App.css";
const math = require("mathjs");
const buttons = [
{ key: "1", id: "one", type: "number" },
{ key: "2", id: "two", type: "number" },
{ key: "3", id: "three", type: "number" },
{ key: "4", id: "four", type: "number" },
{ key: "5", id: "five", type: ... |
// SOURCE: https://binarysearch.io/room/Fords-of-Bellman-20465
// CATEGORY: EASY
/*
Given a 2-dimensional list matrix, return the number of even numbers in the matrix.
*/
// My first pass solution
function solve0(matrix) {
// Write your code here
// Track the count
let count = 0;
// Loop throu... |
const ACCESS_TOKEN = 'Access-Token'
const TokenCache = {
getToken() {
return sessionStorage.getItem(ACCESS_TOKEN)
},
setToken(token) {
sessionStorage.setItem(ACCESS_TOKEN, token)
},
delToken() {
sessionStorage.removeItem(ACCESS_TOKEN)
}
}
export default TokenCache
|
import React, {Component, PropTypes} from 'react';
import classNames from 'classnames';
import UIGridConstants from './UIGridConstants.jsx';
const OFFSET_CLASSES = {
0: '',
1: 'col-sm-offset-1',
2: 'col-sm-offset-2',
3: 'col-sm-offset-3',
4: 'col-sm-offset-4',
5: 'col-sm-offset-5',
6: 'col-sm-offset-6',
... |
import {
PROJECTS_GET_SINGLE,
PROJECT_ADD_SUCCESS,
PROJECT_ADD_REQUEST,
PROJECTS_SUCCESS,
PROJECTS_REQUEST,
PROJECT_DELETE_REQUEST,
PROJECT_DELETE_SUCCESS,
PROJECT_DELETE_FAILURE,
TERMINAL_ADD_SUCCESS,
TERMINAL_REMOVE,
} from '../constants/actionTypes'
import { auth, db } from '../firebase/firebase'... |
import react from 'react';
import axios from 'axios';
const baseURL= 'http://api.openweathermap.org/data/2.5/forecast?';
const apiKey='3434a41e4751b5969309b9363a302a9b';
export const getWeatherData= async (cityName)=>{
try{
const {data}= await axios.get(baseURL + `q=${cityName}&appid=${apiKey}`);
... |
function createTriangle(n){
var output;
for (i=0; i<n; i++){
console.log(output += "*");
}
} |
/*
Use forEach to print all the names in an array
Let's repeat the previous exercise using the forEach function.
*/
var names = ["Ben", "Ben2", "Ben3", "Priya", "rian"];
names.forEach(function (name){
console.log(name);
});
|
import { addGraphStory } from '../../utils/graphStory-utils.js'
import graphFactory from './graphFactory.js'
addGraphStory({namespace: 'colorFns', graphFactory, module})
|
exports.seed = function(knex) {
return knex("jobsheets").insert([
{
project_id: 1,
user_email: '[email protected]',
name: 'HPU_Manifolds Jobsheet 1.csv',
},
]);
};
|
module.exports = require("npm:[email protected]/webcomponents"); |
/* eslint-disable react/prop-types */
import React from 'react';
import DropStyle from '../styles/drop';
import Controls from '../styles/controls';
import InputContainer from '../styles/inputContainer';
import Select from '../styles/select';
export default function Loan(props) {
//
function handleChange(e) {
c... |
const Web3 = require('web3') // Web3 0.20.4 or web3 1 beta
const truffleContract = require("truffle-contract")
const contractArtifact = require('./build/contracts/TutorialToken.json')
const providerUrl = 'http://localhost:8545'
const provider = new Web3.providers.HttpProvider(providerUrl)
const contract = truffleCont... |
var a = {'name':"Treant", age:27};
var b = a;
b.name="Panda";
b.age = 28;
console.log('-------a-------');
console.log(a);
console.log('---------b-------');
console.log(b);
var _ = require('underscore');
var c = {'name' : "ddg", isGood : true};
var d = _.clone(c);
d.name = "mntabc";
d.isGood = false;
... |
import React from "react";
import Header from "./components/Header/Header";
import RecipeList from "./components/RecipeList/RecipeList";
// import Navigation from "./components/Navbar/NavBar";
import Navigation from "./components/Navigation/Navigation";
function FoodClone() {
return (
<div className="container-f... |
export const format = (_date, arg = 0) => {
const year = _date.getFullYear();
const month =
_date.getMonth() <= 9 ? `0${_date.getMonth() + 1}` : _date.getMonth() + 1;
const date = _date.getDate() <= 9 ? `0${_date.getDate()}` : _date.getDate();
const hour =
_date.getHours() <= 9 ? `0${_date.getHours()}` ... |
jQuery.fn.MSNAV = function(options) {
var y = 0;
// MSNAV default settings:
var defaults = {
nav: "",
currentClass: "",
elements: [],
parallex: [],
positions: [],
scrollSpeed: 500
},
// the extended options
setti... |
var app = app || {};
app.homeViewBag = (function (){
function showHomePage(selector){
$.get("templates/loginAndRegister.html", function(templ){
selector.html(templ);
$("#loginButton").on("click", function(){
var username = $("#inputUsername").val();
... |
import React, { Component } from "react";
import { Link } from "gatsby";
import Img from "gatsby-image";
import "./header.sass";
import Content from "../utility/Content/Content";
import ReactGA from "react-ga";
class Headder extends Component {
constructor(props) {
super(props);
this.state = {
navlinks... |
const program = require('commander');
const fs = require('fs');
const shell = require('shelljs');
const path = require('path');
program
.description('Test a smart contract as it would be executed on an L1 Dragonchain.', {
image: 'The docker image for this smart contract',
cmd: 'The command to run on this do... |
define([
'client/views/table',
'extensions/views/table',
'extensions/collections/collection',
'extensions/models/model',
'jquery',
'modernizr'
],
function (Table, BaseTable, Collection, Model, $, Modernizr) {
describe('Table', function () {
describe('initialize', function () {
var table,
... |
import ConverterController from '../converterController';
class DeltaConverter {
setQuillInstance(quillInstance) {
this.quillInstance = quillInstance;
}
toHtml() {
if (!this.quillInstance) {
return;
}
return this._isQuillEmpty() ? '' : this.quillInstance.getSemanticHTML(0, this.quillInsta... |
/* eslint-disable no-extend-native */
export const monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
export const getMonthName = month => monthNames[month]
export const getShortMonthName = month => getMonthName(month).substr(0, 3)
|
import React from "react";
import { Route, Redirect } from "react-router-dom";
import AuthHelper from '../../helpers/AuthHelper';
const PrivateRoute = ({ component: Component,role:role, ...rest }) => (
<Route {...rest} render={(props) => (
AuthHelper.isUserAuthenticated()
? checkForAuthorize(Compon... |
import { useState, useEffect } from "react";
import { useSelector} from "react-redux";
import FullCalendar from "@fullcalendar/react";
import dayGridPlugin from "@fullcalendar/daygrid";
import interactionPlugin from "@fullcalendar/interaction";
const Dash = (props) => {
const [games, setGames] = useState([]);
cons... |
const {Parser} = require('htmlparser2');
const {DomHandler} = require('domhandler');
const fs = require('fs');
const CSSselect = require('css-select');
const rawHtml = fs.readFileSync(__dirname + '/page.html');
function match(selector, ele, context) {
let res = CSSselect(selector, context);
return res.indexOf... |
module.exports = function(app) {
return {
lista: function(req, res){
var grupos = [
{ _id: 1, nome: 'esporte' },
{ _id: 2, nome: 'lugares' },
{ _id: 3, nome: 'animais' }
];
res.json(grupos);
}
};
};
|
import React from 'react';
import ReactDOM from 'react-dom';
import CopyCat from '../components/CopyCat.js';
class CopyCatContainer extends React.Component {
constructor(props) {
super(props);
this.state = {
copying: true,
input: ''
};
this.toggleTape = this.toggleTape.bind(this);
t... |
/* @flow */
'use strict'
import mongoose from 'mongoose'
const imageSchema = new mongoose.Schema({
img: {
type: Buffer,
required: false
},
mimetype: {
type: String,
required: false
}
})
export default mongoose.model('Image', imageSchema)
|
// Cross-broswer implementation of text ranges and selections
// documentation: http://bililite.com/blog/2011/01/17/cross-browser-text-ranges-and-selections/
// Version: 1.1
// Copyright (c) 2010 Daniel Wachsstock
// MIT license:
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this... |
export default {
routes: [
{ path: '/', breadcrumb: "首页", component: './index.js' },
{ path: '/goods/list', breadcrumb: "商品列表", component: './index.js' },
],
}; |
import React from 'react'
import { Row, Col,Card, Button,Select,Divider, Message, Radio,TextArea, Form, Input, Cascader,DatePicker} from 'antd';
import {provinces, cities, areas} from '../../constants/Area'
import {fetch} from '../../api/tools'
//出险记录添加
const Option= Select.Option;
const FormItem = Form.Item;
class C... |
import React, { Component } from 'react';
import {convertSecondsToTimeObject} from "../util/convert";
import TimeDisplay from "./TimeDisplay";
export default class StopWatch extends Component {
state = {
currentTime: 0,
timerId: null,
timerRunning: false,
}
startTimer = () => {
let timerId = se... |
exports.userModel = {
name: {required: true, type: 'string', encrypted: false},
email: {required: true, type: 'string', encrypted: true},
password: {required: true, type: 'string', encrypted: true},
};
|
/**
* @author xuyi 2018-09-05
*/
import { handleActions } from "redux-actions";
import cFetch from "./cFetch";
// 正在做异步请求还未响应的action
const isRequestAction = {};
// const asyncHandleActions = (...actions, initState) => {
// if (actions && Array.isArray(actions)) {
// const len = actions.length;
// ... |
import React from 'react';
import '../App.css'
class Footer extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<div class="footer pull-right">
Global Leadership Platform © 2019
</div>
);
}
}
export default Footer; |
import fetch from 'isomorphic-fetch';
import config from './config';
export function getTopics() {
return fetch(`${config.getApiUrl()}/topic/`, {
method: 'GET',
headers: {
'x-access-token': config.getToken(),
},
});
}
export function createTopic(topic) {
return fetch(`$... |
import React from "react";
import { makeStyles } from "@material-ui/core/styles";
import KanyeQuote from "../Components/KanyeQuote";
import ChuckNorrisFact from "../Components/ChuckNorrisFacts";
import Img from '../img/fourire.jpg';
const useStyles = makeStyles({
title: {
fontSize: '3em',
textAlign: 'center'... |
import useSWR from 'swr'
import { fetchProfileWithSWR } from '../actions/userAction'
export function useProfile(token) {
const {data, error} = useSWR(`${token}`, fetchProfileWithSWR)
return {
profile: data,
isLoading: !error && !data,
isError: error
}
} |
import React from 'react';
import {View, Text} from 'react-native';
import PropTypes from 'prop-types';
import styles from './styles';
const Container = ({children, title}) => {
return (
<View testID="Container" style={styles.container}>
<Text testId="ContainerTitle" style={styles.title}>
{title}
... |
Page({
data: {
hasSend: false,
second: 60,
real_name: null,
wechat: null,
telephone: null,
code: null,
shop_name: null,
recruit_name: null,
content: null,
real_name: null,
real_name: null,
real_name: null,
},
getName(e) {
this.setData({
real_name: e.detail... |
$(function(){
$('#send').click(function(e){
e.preventDefault();
var playerBat, computerBat, ball;
var playerScore = 0, computerScore = 0;
var computerBatSpeed = 190;
var ballSpeed = 200;
var ballReleased = false;
var playerBatHalfWidth;
var playerScoreText,computerScoreText;
var us... |
import { all } from 'redux-saga/effects';
import homePageSaga from './homePage';
import loginSage from './login';
export default function* rootSaga() {
yield all([
homePageSaga(),
loginSage(),
]);
} |
import BookRegisterContainer from "./BookRegisterContainer";
export default BookRegisterContainer |
"use strict";
/*
Copyright [2014] [Diagramo]
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 writi... |
#!/usr/bin/env node
'use strict'
// process.title = 'sc';
var program = require('commander');
var chalk = require('chalk');
var inquirer = require('inquirer');
program.version(require('../package').version)
.usage('<command> [options]');
inquirer
.prompt([
/* Pass your questions in here */
{
... |
import React from 'react';
import { MDBFooter } from 'mdbreact';
const Footer = () => (
<MDBFooter className="center">
<div className="border-top">
<p>© 2020 Jack.inc.</p>
</div>
</MDBFooter>
);
export default Footer;
|
"use strict";
//===== DZ 1 =====//
// Вычисления
function sum(a, b) {
return a + b
}
function minus(a, b) {
return a - b
}
function multiply(a, b) {
return a * b
}
function divide(a, b) {
return a / b
}
//Функция которая проверяет числа
function isNumeric(n) {
return !isNaN(parseFloat(n)) && i... |
import React, { useContext } from 'react'
import { GlobalContext } from '../contexts/GlobalContext'
const IncomeExpenses = () => {
const { transactions } = useContext(GlobalContext);
const amounts = transactions.map(transaction=> transaction.amount);
const income = amounts.filter(item => item > 0)
.r... |
(function() {
'use strict';
// Конструктор таблицы
// Можно выбрать количество отображаемых элементов на странице и путь к базе
function Table() {
var SEARCH_INPUT = document.getElementById('searchInput'), // Инпут с поиском
self = this;
self.nItemsOnPage = 5; // Сколько столбцов показывать на... |
import styled from "styled-components";
import ImageComponent from "../utility/ImageComponent";
import Link from "next/link";
const ProjectPageWrapper = styled.main`
padding: 2rem;
border-radius: 2rem;
display: flex;
justify-content: center;
align-items: center;
column-gap: 3rem;
text-align: justify;
... |
// start slingin' some d3 here.
// var asteroids = [];
var scores = {
high: 0,
current: 0,
collisions: 0
};
var svg = d3.select('body').append('svg')
.attr('width', '100%')
.attr('height', '800');
var throttle = function(func, wait) {
var throttled = false;
return function() {
var args = Array.prot... |
import React from 'react'
import { Header } from 'react-native-elements'
import ButtonHeader from './ButtonHeader'
const CustomHeader = ({ title, leftIcon, leftOnClick, rightIcon, rightOnClick }) => {
return(
<Header
backgroundColor={'#5458CC'}
centerComponent={{
text: title, ... |
import produce from 'immer'
import { cartActions } from './actions'
export default function cart(state = [], action) {
const { type } = action
switch (type) {
case cartActions.addToCartSuccess:
return produce(state, draft => {
draft.push(action.product)
})
case cartActions.removeFromCar... |
import store from "../store";
import ConstantType from "../js/sdk/constant/ConstantType";
export default {
getAll() {
let newMap = new Map();
let groupMap = store.state.cache.cache.groupMap;
for(let item of groupMap) {
if(item[1].type != ConstantType.GroupTypeConstant.GROUP_CHATROOM){
newMa... |
import { connect } from 'react-redux'
import * as evidencesActions from '../reducers/entities/evidences'
import * as evidencesSubscriber from '../reducers/evidences-subscriber'
import * as updatesFeedActions from '../reducers/ui/updates-feed'
import * as updatesFeedSelector from '../selectors/ui/updates-feed'
import ... |
import React from "react";
import { withRouter } from "react-router-dom";
import CollectionFinder from "../collection-finder/CollectionFinder";
const CollectionList = (props) => {
const { collectionsArray } = props.collectionsArray;
const { arrayNavbar } = props.arrayNavbar;
//const { id } = props.id;
return... |
angular.module("app.game").directive("timer", function ($timeout) {
return {
restrict: "E",
templateUrl: "components/game/timer.html",
replace: true,
scope: {
time: "="
},
link: function ($scope, element, attrs) {
var curTime = (+new Date());
... |
import React from "react";
import { connect } from "react-redux";
import { ReactComponent as ShoppingIcon } from "../../assets/shopping-bag.svg";
import { cartToggle } from "../../redux/cart/cartAction";
import { selectCartItemsCount } from "../../redux/cart/cartSelector";
import "./cart-icon.scss";
const CartIcon = (... |
UMessage = {}
UMessage.should = {
return:{
'Film.titre':{
failure:"La bonne valeur retournée devrait être #{expected}",
success:"`Film.titre()` retourne la bonne valeur (#{expected})"
}
}
} |
/**
* Created by han on 31.08.14.
*/
var shoe = require('shoe'),
dnode = require('dnode'),
Trade = function (mount) {
var readyQueue = [],
server,
stream = shoe(mount),
d = dnode();
d.on('remote', function (connection) {
server = connection;
... |
function validation(){
var name = document.getElementById('name').value;
var pass = document.getElementById('pass').value;
if(name == ""){
document.getElementById('name').innerHTML =" ** Please fill the Studentname field";
return false;
}
if((name.length <= 2) || (nme.length > 40)) {
document.getE... |
import { combineReducers } from 'redux';
import todos from './todoReducer';
//combineReducers is used to combine multiple reducers
const rootReducer = combineReducers({
todos,
});
//exporting the rootReducer
export default rootReducer;
|
const baseRule = require('./app/base/baseRule');
const baseFilter = require('./app/base/baseFilter');
module.exports = app => {
baseRule.addRule(app); //增加验证规则
baseFilter.addFilter(app); //增加过滤器
};
|
import React from 'react'
import { Link } from 'react-router-dom';
const CardListItem = (props) => {
let { item } = props
console.log('CardListItem: ', item, item.image, item.text )
return(
<div className="cardItem">
<h2>{item.unicorn}</h2>
<figure>
<img src={item.image} alt={item.unicorn... |
export function parseQuery(query) {
const queryObj = {}
query.split('&').forEach(param => {
const parts = param.replace(/\+/g, ' ').split('=')
const key = decodeURIComponent(parts.shift())
const val = parts.length > 0 ? decodeURIComponent(parts.join('=')) : null
if (queryObj[key] === undefined) {
queryObj... |
let localStorageData = {
getUser() {
let user = JSON.parse(localStorage.user || null);
return user;
},
setUser(user) {
let newUser = { id: user.id };
localStorage.user = JSON.stringify(newUser);
},
signOut(user) {
localStorage.removeItem(user);
}
}
exp... |
import React from 'react';
import Adapter from 'enzyme-adapter-react-16';
import App from '../App';
import Enzyme, { shallow } from 'enzyme';
Enzyme.configure({adapter: new Adapter()});
describe('testing app.js', () => {
it('should show true', () => {
const wrapper = true;
expect(true).toBe(true);
});
... |
const initState = {
language: 'mkd'
}
const rootReducer = (state = initState, action) => {
switch (action.type) {
case 'SET_LANGUAGE':
return {
...state,
language: action.payload.language
}
default:
return state;
... |
//Calculate Tip
document.getElementById("b5_value").addEventListener("click", b5_Functions);
document.getElementById("b10_value").addEventListener("click", b10_Functions);
document.getElementById("b15_value").addEventListener("click", b15_Functions);
document.getElementById("b25_value").addEventListener("click", b2... |
function largestOfFour(arr) {
// Create a new array to store largest values of each sub array
var newArray = [];
// Use a for loop to iterate through the main array
for (var i = 0; i < arr.length; i++){
//Create a variable that wil store the largest number and assign it to the first index of the main array... |
/**
* B-I-N-G-O
*
* A Bingo card contain 25 squares arranged in a 5x5 grid (five columns
* and five rows). Each space in the grid contains a number between 1
* and 75. The center space is marked "FREE" and is automatically filled.
*
* As the game is played, numbers are drawn. If the player's card has
* that num... |
/**
* @description: loader配置入口
*/
const HTMLLoader = require('./html')
const stylusLoader = require('./stylus')
const lessLoader = require('./less')
const sassLoader = require('./sass')
const cssLoader = require('./css')
const javascriptLoader = require('./javascript')
const pugLoader = require('./pug')
const imageL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.