text stringlengths 7 3.69M |
|---|
// Array.from(); // 类数组对象转为真正的数组
// 第一个参数类数组对象
// 第二个参数, map方法
// 第三个参数, map方法中的this指向
function foo() {
var args = [...arguments];
console.log('arguments: ', arguments);
console.log('args: ', args);
console.log('Array.from: ', Array.from(arguments, x => x*x) );
}
foo(2, 3, 4);
// Array.of 将一组值转换为数组
// 数组实例的co... |
const path = require("path")
const requireIndex = require("requireindex")
module.exports = {
get rules() {
// eslint-disable-next-line prefer-destructuring
const RULES_DIR = module.exports.RULES_DIR
if (typeof module.exports.RULES_DIR !== "string") {
throw new Error(
"To use eslint-plugin-b... |
const mongoose = require('mongoose');
const submissionSchema = require('./submission.schema.server');
const submissionModel = mongoose.model('SubmissionModel', submissionSchema);
findAllSubmissions = () =>
submissionModel.find();
findSubmissionById = (submissionId) =>
submissionModel.findById(submissionId);
... |
var url = "https://raw.githubusercontent.com/FreeCodeCamp/ProjectReferenceData/master/GDP-data.json";
var xl = [];
var yl = [];
Plotly.d3.json(url, function(figure) {
var data = figure.data;
for (var i = 0; i < data.length; i++) {
xl.push(data[i][0])
yl.push(data[i][1])
... |
export { default as List } from './List/List';
export { default as InputWithLabel } from './InputWithLabel/InputWithLabel';
export { default as SearchForm } from './SearchForm/SearchForm';
|
const net = require('net');
const socks5 = require('../index');
const socks5Server = net.createServer((socket) => {
// upgrade socket
const conn = new socks5.ServerSocket(socket);
socket.on('error', (err) => {
console.error(err);
});
conn.on('connect', ()=>{
let s = `${conn.remoteAddress}:${conn.rem... |
module.exports = {
collectCoverage: true,
collectCoverageFrom: ['**/*.{ts,tsx}', '!**/node_modules/**'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
setupTestFrameworkScriptFile: require.resolve('./jest.setup.js'),
testMatch: ['**/*.test.ts?(x)'],
transform: {
'^.+\\.tsx?$': 'babel-jest',
},
};
|
import axios from 'axios';
export const getTrendingGifs = () => {
return async (dispatch) => {
const gifList = await axios.get('http://api.giphy.com/v1/gifs/trending?api_key=ms344CewNH5NEbybHwQifMZImoQfEQ38&limit=21');
dispatch({ type: 'GET_TRENDING_LIST', payload: gifList.data.data });
}
};
e... |
export function validateKorean_name(korean_name) {
const korean_namereg = /^[가-힣]+$/;
const isKorean_nameValid = korean_namereg.test(korean_name);
return isKorean_nameValid;
}
export function validateEnglish_name(english_name) {
const english_namereg = /^[a-zA-Z]*$/;
const isEnglish_nameValid = english_namer... |
import React, { Component } from "react";
import { Doughnut } from "react-chartjs-2";
import PropTypes from "prop-types";
import { Card, CardBody, Table } from "reactstrap";
class DoughnutChart extends Component {
render() {
var data_labels = this.props.data.map(block => {
return block.result;
});
... |
import logo from './logo.svg';
import React, { useState, useEffect } from 'react'
import { BrowserRouter, BrowserRouter as Router, Route, Switch } from 'react-router-dom'
import './App.css';
import TesPage from './pages/tesPage/TesPage';
import Header from './components/header/header';
import Footer from './components/... |
$( function () {
// Imports
let BFSForm = window.__BFS.exports.BFSForm
BFSForm.validators = {
name ( name ) {
name = name.trim();
if ( name === "" )
throw new Error( "Please provide your name." );
if ( name.match( /\d/ ) )
throw new Error( "Please provide a valid name." );
return name;
},
ema... |
'use strict'
angular.module('main')
.controller('ProjectsFilesListController', ['$scope', '$routeParams', 'ProjectFile',
function ($scope, $routeParams, ProjectFile) {
$scope.project_id = $routeParams.id;
$scope.files = ProjectFile.query({id: $scope.project_id});
}]); |
const { dcBot, tgBot, DCREVCHN, TGREVGRP } = require( '../util/bots' );
/**
* @typedef {import('./command').reply} reply
* @typedef {import('./command').command} command
*/
/**
* @param {command} command
*/
function tgCommand( command ) {
tgBot.telegram.setMyCommands( [ {
command: command.name,
description:... |
let a = {
aa : '123'
};
console.log( `哈哈:${ a.aa }` );
|
import React from "react"
import { withRouter } from "react-router";
import { connect } from "react-redux"
import {
Col,
Row,
Badge,
Card,
Space,
Drawer,
Button,
} from "antd"
import MainLayout from "../../layouts/MainLayout"
import {setGoBack} from "../../stores/app/actions"
// import Floo... |
import editor from 'hyrax/editor'
import GppSaveWorkControl from 'gpp/save_work/save_work_control'
export default class extends editor {
saveWorkControl() {
new GppSaveWorkControl(this.element.find('#form-progress'), this.adminSetWidget)
}
} |
/**
* @author:Jacob Cohen
* @description: command call for law, sends a random law from array
* @returns: text output (no @)
* Date last edited: 4/1/2018
*/
//laws to select from
var laws = [
"Murphy was a grunt.",
"Recoilless rifles - aren't.",
"Suppressive fires - won't.",
"You are not Superma... |
/* Import express, path, body-parser */
const express = require("express");
const app = express();
const path = require("path");
const bp = require("body-parser");
/* Router Module for handling routing */
const router = express.Router();
app.use("/", router);
/* --- Your code goes here --- */
router.use(... |
import React, { useCallback, useEffect, useState } from "react";
import { useSelector, useDispatch } from "react-redux";
import { useParams, Link } from "react-router-dom";
import Layout from "./Layout";
import {
Grid,
Card,
Button,
Image,
Divider,
Header,
Segment,
Popup,
} from "semantic-ui-react";
im... |
export const FETCH_NOTIFICATIONS_REQUEST = "FETCH_NOTIFICATIONS_REQUEST";
export const FETCH_NOTIFICATIONS_SUCCESS = "FETCH_NOTIFICATIONS_SUCCESS";
export const FETCH_NEW_NOTIFICATIONS_SUCCESS = "FETCH_NEW_NOTIFICATIONS_SUCCESS";
export const READ_ALL_NOTIFICATIONS = "READ_ALL_NOTIFICATIONS";
export const READ_ONE_NOTI... |
/**
* Created by admin on 12/11/2020.
*/
function checkMod(){
var firstNumber=document.getElementById('firstnumber').value;
var secondNumber=document.getElementById('secondnumber').value;
var result = parseInt(firstNumber)%parseInt(secondNumber);
if (result==0){
document.getElementById('resul... |
$(function() {
window.$Qmatic.components.modal.wrapUp = new window.$Qmatic.components.modal.WrapUpModalComponent('#wrap-up-modal')
}) |
function Basket() {
Container.call(this, 'basket');
this.countGoods = 0;
this.amount = 0;
this.basketItems = [];
}
Basket.prototype = Object.create(Container.prototype);
Basket.prototype.constructor = Basket;
//Восстановление товаров из cookies
Basket.prototype.restoreCookies = function () {
if(... |
import {
ADD_BATTLETAG_SUCCESS,
ADD_BATTLETAG_FAILURE,
RESET_BATTLETAG_STATE,
FETCH_BATTLETAG_SUCCESS,
FETCH_BATTLETAG_FAILURE,
CREATE_SEASON_SUCCESS,
CREATE_SEASON_FAILURE
} from '../actions/battletagActions/battletagActionTypes';
const initialState = {
success: false,
error: null,... |
// @flow
export const mapsUrl = 'https://www.google.com/maps/';
|
import * as mixins from "codogo-utility-functions";
import styled from "styled-components";
// --------------------------------------------------
// --------------------------------------------------
const Grid = styled.div`
align-items: flex-start;
display: flex;
flex-direction: column;
padding: 3em;
flex: 1;... |
"use strict";
var models = require('../models');
exports.app = function (req, res) {
models.Teacher.findOne({
where: { url: req.params.random }
}).then(function (data) {
if (!data.dataValues) {
return res.sendStatus(404).end('<h1>404: NOT FOUND</h1>');
}
else {
... |
import React, { useContext } from 'react';
import Stepper from '@material-ui/core/Stepper';
import Step from '@material-ui/core/Step';
import StepLabel from '@material-ui/core/StepLabel';
import Button from '@material-ui/core/Button';
import Typography from '@material-ui/core/Typography';
import { DEFAULT_STATE, FormCo... |
// class AgePerson {
// age = 40;
// printAge() {
// console.log(this.age);
// }
// }
// class Person extends AgePerson {
// name = "Max";
// constructor() {
// super();
// this.age = 30;
// }
// greet() {
// console.log(`Hi, I am ${this.name} and I am ${this.age} years old`);... |
import caseGeo3HTML from "./caseGeo3.html";
export const caseGeo3 = {
template: caseGeo3HTML
}; |
const Certificates = artifacts.require("Certificates");
contract("Certificates", function (accounts) {
//add a new certificate - get the details of the newly added certificate based on image hash
//details of certicate should be the same
it("add new certificate", async function () {
let cer... |
// TJ bot example that uses listen to execute different actions.
// This example also uses spotify's API to play a music preview for a given artist.
// Since spotify requires a token, we need to generate one first. You will need a spotify account for this.
// Access this link: https://developer.spotify.com/console/ge... |
import React from 'react';
import {StyleSheet, Text, View, TouchableNativeFeedback} from 'react-native';
import Ionicons from 'react-native-vector-icons/Ionicons';
import Timer from './Timer';
import CircularProgressBar from '../Circular ProgressBar';
const QuizDetails = ({
currentTime,
shouldStart,
useLife,
c... |
const $ = jQuery = jquery = require ("jquery")
const switchElement = require ("cloudflare/generic/switch")
$(document).on ( "cloudflare.ssl_tls.ssl_tls_recommender.initialize", switchElement.initializeCustom ( "enabled", true ) )
$(document).on ( "cloudflare.ssl_tls.ssl_tls_recommender.toggle", switchElement.toggle )
|
import React from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Image,
Button,
ScrollView,
TextInput,
KeyboardAvoidingView,
Picker,
TouchableOpacity,
Dimensions,
} from 'react-native';
import {connect} from 'react-redux';
import {bindActionCreators } from 'redux... |
"use strict";
const Path = require("path");
const fs = require("fs");
const archetype = require("./config/archetype");
const gulpHelper = archetype.devRequire("electrode-gulp-helper");
const shell = gulpHelper.shell;
const mkdirp = archetype.devRequire("mkdirp");
const config = archetype.config;
function setupPath() ... |
export default class Drip extends Phaser.Sprite {
constructor(game, x = 320, rotation = 0, xSpeed, frame) {
super(game, x, 20, 'cuberdonDrip', frame);
this.game = game;
this.xSpeed = xSpeed;
this.angle += rotation;
this.mask = game.add.graphics(0, 0);
this.mask.beginFill(0xff0000);
this.mask.drawRect(1... |
/**
* 获取数据, url:文件地址, callback:成功调用方法,
* variableName:json数据变量名称,默认tmp_www_szmb_gov_cn;
*/
var getJSON = function(url, callback, variableName) {
if (url.indexOf("http") != 0) {
url = DATA_PATH + url;
}
var re = new RegExp("\\?");
if (re.test(url)) {
url = url + "&random=" + Math.random();
} else {
url ... |
import Card from "../Card";
export default function Secretarias(props) {
return (
<>
<h2 className="text-center text-3xl text-gray-700 font-bold mt-8 mb-2">
{props.title}
</h2>
<hr />
{props.secretaria &&
props.secretaria.sort((a, b) => a.ordem + b.ordem).map((prop... |
var messageService = angular.module('messageService', []);
messageService.factory('Message', function($rootScope) {
return {
send : function(array) {
$rootScope.$broadcast('msg', array);
},
ask : function(array, success) {
$rootScope.$broadcast('ask', [array,success]... |
// Compiled by ClojureScript 0.0-3211 {:optimize-constants true, :static-fns true}
goog.provide('tetris.core');
goog.require('cljs.core');
goog.require('tetris.board');
goog.require('reagent.core');
tetris.core.GRAVITY_WAIT = (400);
tetris.core.ADJUST_WAIT = (300);
cljs.core.enable_console_print_BANG_();
tetris.core.ap... |
import React from 'react';
const Item = (props) =>{
return (
<div className="item">
<div className="left">
<ItemImage/>
<div className="imageDescription">
<ItemTitle title={props.title}/>
<ItemDescription description={props.description}/>
</div>
</div>
<div className="right">
<Item... |
(function($, Drupal, drupalSettings) {
$(document).ready(function() {
$('.block h2').click(function() {
$(this).parent().find('.content').toggle();
});
});
})(jQuery, Drupal, drupalSettings);
|
// ======================
// = Calcul de vecteurs =
// ======================
var K = 250;
function Vector( deltaX, deltaY ) {
this.x = deltaX;
this.y = deltaY;
}
Vector.prototype = {
x: 0,
y: 0,
opposite: function() {
return new Vector( -this.x, -this.y );
},
add: function( v ) {
retu... |
import Ember from 'ember';
export function timeSlice(params) {
var body = params[0];
return body.toString().substring(0,10);
}
export default Ember.Helper.helper(timeSlice);
// date.toString().substring(16, 24);
|
const express = require('express');
const router = express.Router();
const models = require('../../../../../models');
const ResponseTemplate = require("../../../../ResponseTemplate");
const errors = require("../../../../errors");
const SimpleValidators = require("../../../../../util/SimpleValidators");
const JalaliDa... |
import test from 'ava';
import isPlainObject from 'lodash/isPlainObject';
import sinon from 'sinon';
import fs from 'fs';
import path from 'path';
import * as utils from 'src/transform/utils';
test.todo('applyCssModules');
test.todo('generateTransformedStylesFile');
test.todo('getPrefixedCss');
test.todo('getRendere... |
const request = require('request-promise');
const cheerio = require('cheerio');
const fs = require('fs-extra');
const writeStream = fs.createWriteStream('quotes.json');
var writeJson = require('write-json');
/* async function init2() {
// async
const data = [];
try {
// const response = await re... |
var expect = require('expect')
describe('lib', function(){
var Lib, ContextTree
before(function(){
Lib = require('../lib')
ContextTree = require('../lib/context-tree')
})
describe('applyPatches', function(){
describe('just these operations', function(){
it('should add', function(){
... |
module.exports = [
{
fieldName: 'Left',
type: 'integer',
explanationDetails: 'One of the players in the match up',
required: true,
},
{
fieldName: 'Right',
type: 'integer',
explanationDetails: 'Another one of the players in the match up',
required: true,
},
{
fieldName: 'Wi... |
$(document.forms['updateUser']).on('submit', function() {
var form = $(this);
$('.error', form).html('');
$(":submit", form).button("loading");
$.ajax({
url: "/settings/profile",
method: "POST",
data: form.serialize(),
complete: function() {
$(":submit", form... |
import React from "react";
import { connect } from "react-redux";
import { withStyles } from "@material-ui/core";
import PropTypes from "prop-types";
import {
Button,
MuiThemeProvider,
Drawer
} from "@material-ui/core";
const Filter = withStyles(theme => ({
root: {
backgroundColor: "#d8d8d8",... |
ROOT = process.cwd();
HELPERS = require(ROOT + '/helpers/general.js');
log = HELPERS.log;
var config = require(ROOT + '/config.json');
var mongoose = require('mongoose');
var ObjectId = mongoose.Schema.ObjectId;
var locationSchema = mongoose.Schema({
name: { type: String, required: true, unique: true},
owner: {... |
var BookModel = Backbone.Model.extend({
idAttribute: 'id',
urlRoot: function() {
return "/api/books/";
},
initialize: function() {
console.log("Hello, my CID is " +this.cid + " and my ID is " + this.id);
},
updateAuthor: function(name) {
this.set(... |
/**
* 下拉菜单效果
* @author: xiaweiwei
* @date: 2013-12-3 14:12
* 1.配置url,存放div内容的文件,可以存放多个div
* 2.配置splitstr,即div内容文件中,每个div之间的分隔符,默认为<br>
* 3.配置遮罩层背景色,透明度需要在jquery_ui_pop.css的ui-widget-overlay中修改
* 4.关闭弹出框的代码为 $("#divPOP").dialog("close")
* 5.按钮触发事件配置,请参考$("#btnPOP")的click事件
* 6.参考页面为divPOPtest.html,需要引... |
/*------------------------
LES SELECTYEURS jQUERY
-----------------------*/
// -- Format : $('selecteur');
// -- En jQuery, tous les selecteurs CSS sont disponibles ...
$(function() {
// -- DOM READY !
l = e => console.log(e)
// -- Sélectionner toutes les balises SPAN !
// En JS
l( document.... |
import React from 'react';
import Contain from './Contain'
import containing from './containing'
const Bottom = ()=>{
return (
<div>
<div className="contb">
<div className="container">
<div className="row">
<div className="col-lg-4">
<div className="cont-1">
<Contain
name={containing[0].name}
imgUrl={c... |
import { Col, Container, Row } from 'react-bootstrap'
import './Footer.css'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faInstagram, faFacebook, faTwitter, faLinkedin } from '@fortawesome/free-brands-svg-icons'
import { faLocationArrow, faEnvelope, faPhone } from '@fortawesome/free-solid-s... |
const { response } = require("express");
const { get } = require("mongoose");
//create the variableto hold DB connection
let db;
const request = indexedDB.open('budget-tracker', 1);
request.onupgradeneeded = function (event) {
const db = event.target.result;
db.createObjectStore('new-transaction', { autoIncre... |
import React, { Component} from 'react'
export class NavBar_Tabs extends Component{
render(){
return(
<div className="ui container">
<div className="ui row vertical segment">
<h1 className="ui header">NavBar
<div className="sub header">{`<NavBar_Tabs />`}</div>
</h1... |
import React, { Component } from 'react';
import Input from './Input';
import Joi from 'joi-browser';
class Form extends Component {
state ={
fields: {},
errors: {}
};
validateField = () => {
const options = {abortEarly: false};
const { error } = Joi.validate(this.state.fie... |
'use strict';
module.exports.format = function (str, options) {
var mask;
if (options && options.international) {
mask = '(+$1)$2-$3-$4';
} else {
mask = '$2-$3-$4';
}
if (str.length === 12) {
return str.replace(/^\+(\d{1})(\d{3})(\d{3})(\d{4}).*/, mask);
}
... |
var express = require('express');
var mongoose = require('mongoose');
var router = express.Router();
mongoose.connect('mongodb://localhost:27017/project', function(err) {
if(!err) {
console.log('数据库连接成功!!!');
}
});
var userSchema = new mongoose.Schema({
username: String,
password: String,
name: String,
role: ... |
let counterValue = 0;
const btnIncrementRef = document.querySelector(
'#counter button[data-action="increment"]'
);
const btnDecrementRef = document.querySelector(
'#counter button[data-action="decrement"]'
);
const textRef = document.querySelector('#value');
const increment = () => {
textRef.textContent = ... |
const express = require('express');
const router = express.Router();
const auth = require('../middleware/auth')
const { check, validationResult} = require('express-validator');
const User = require('../models/User')
const Budget = require('../models/Budget')
// @route GET api/budget
// @desc Get all user's budget... |
const methods = {
torrents: {
stop: 'torrent-stop',
start: 'torrent-start',
startNow: 'torrent-start-now',
verify: 'torrent-verify',
reannounce: 'torrent-reannounce',
set: 'torrent-set',
setTypes: {
'bandwidthPriority': true,
'downloadLimit': true,
'downloadLimited': true... |
import React, { Component, Fragment } from 'react';
import CardBlog from './CardBlog';
import API from '../../services/index';
export class Blog extends Component {
state = {
post: [],
form: {
userId: 1,
id: 1,
title: '',
body: ''
}, isUpdate:... |
const { Schema, model } = require('mongoose');
const UsuarioSchema = Schema({
nombre: {
type: String,
required: true,
},
email: {
type: String,
required: true,
unique: true,
},
password: {
type: String,
required: true,
},
online: {
... |
const { flex } = require('csstips/lib/flex')
module.exports = ({
} = {}) => {
return [
flex,
{
$debugName: 'Flexible',
}
]
}
|
// 将目录中所有文件中的汉字,可以内嵌数字,扫描提取出来
let fs = require('fs')
let join = require('path').join
function getJsonFiles(jsonPath) {
let jsonFiles = []
function findJsonFile(path) {
let files = fs.readdirSync(path)
files.forEach(function(item, index) {
let fPath = join(path, item)
let stat = fs.statSync(fPath)
if (s... |
import { Paper, Grid, Container } from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles';
import { Card, Typography, Button } from 'antd';
import { Link } from 'react-router-dom';
import { WHAT_NEW_LIST } from '../../../helper/_listNavURL';
import { RightOutlined, LeftOutlined } from '@ant-desi... |
// +----------------------------------------------------------------------+
// | PHP Version 4 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2002 The PHP Group |
// +------------... |
/**
* Created by Evgi on 10/24/2017.
*/
import React from 'react'
export default class AnswerFrame extends React.Component{
render() {
var numbers = [];
var alreadySelected = this.props.property1;
var unselectFunction = this.props.clickWrongAnswer;
alreadySelected.forEach(functio... |
import initAnimation from "./sarcasnimation.js";
const d = document,
w = window;
const toggleButtonMenu = (evt, $menu) => {
if ($menu.classList.contains("show")) {
iconButtonMenu.classList.remove("fa-bars");
iconButtonMenu.classList.add("fa-times");
} else {
iconButtonMenu.classList.add("fa-bars");
... |
import styled from "styled-components";
const PostTitle = styled.h1`
text-align: center;
font-size: ${props => props.theme.fontSizes.sizeFive};
font-weight: bold;
`;
const StyledDate = styled.p`
text-align: center;
margin: 18px 0;
color: ${props => props.theme.colors.black.tertiaryBlack};
... |
import React, { useState, useEffect } from 'react';
import './App.css';
function App() {
const [pokemon, setPokemon] = useState([]);
useEffect(() => {
fetchData()
});
function fetchData() {
fetch('https://raw.githubusercontent.com/Biuni/PokemonGO-Pokedex/master/pokedex.json')
.then(resp => {
... |
import logo from "./logo.png"
import './estilos.css'
const Home = () => {
return (
<div className="principal fundo-escuro">
<div>
<h1>LUNA PET SHOP</h1>
<img alt="Logo da Pet" src={logo}></img>
<h2>A melhor loja de Pet da região!!</h2>
... |
var config = require('../config.json'),
DataSift = require('datasift'),
tracker = require('./tracker');
module.exports = {
consumer: null,
sourceBrands: new Array(),
// Connects to DataSift streaming API
start: function() {
console.log("Connecting to DataSift API.");
$this = this;
this.consumer =... |
$(document).ready(function(){
// Menu scroll
$(window).scroll(function(){
if(this.scrollY > 20){
$(".navbar").addClass("sticky")
}else{
$(".navbar").removeClass("sticky")
}
if(this.scrollY > 500){
$(".scroll-up-btn").addClass("show... |
var group___bias_modes =
[
[ "HMC_BIAS_NEGATIVE", "group___bias_modes.html#ga7698c66ff164b76fbb22630762470d0a", null ],
[ "HMC_BIAS_NONE", "group___bias_modes.html#ga9ae8e2b4da80627c555a1ed3747ebc10", null ],
[ "HMC_BIAS_POSITIVE", "group___bias_modes.html#gaf14afb57269789d0f8d2a1b58bb1a8b4", null ]
]; |
import regeneratorRuntime from '../../../lib/regenerator-runtime'
import { connect } from '../../../lib/wechat-weapp-redux'
import { fetching, fetchend, clearError } from '../../../store/actions/loader'
import { fetchProfile, fetchDailySign, postDailySign, fetchGroupCoupon } from '../../../store/actions/mine'
import { ... |
var Stack = function() {
// Hey! Rewrite in the new style. Your code will wind up looking very similar,
// but try not not reference your old code in writing the new style.
var someInstance = {};
someInstance.items = 0;
someInstance.storage = {};
//add properties from stackMethods to someInstance
_.ext... |
//During the test the env variable is set to test
process.env.NODE_ENV = 'test';
//Require the dev-dependencies
let chai = require('chai');
let chaiHttp = require('chai-http');
let server = require('../server');
let should = chai.should();
chai.use(chaiHttp);
//Our parent block
describe('Hello API', () => {
/*
* ... |
'use strict'
const mongoose = require('mongoose'),
Schema = mongoose.Schema
let pollSchema = new Schema({
name: String,
labels: Array,
data: Array
})
let Poll = module.exports = mongoose.model('Poll', pollSchema)
|
import { useState } from 'react';
import './App.css';
import ColorBox from './conponents/ColorBox';
import TodoList from './conponents/TodoList';
function App() {
const [todoList, setTodoList] = useState([
{ id: 1, title: '1. tittle 1' },
{ id: 2, title: '2. tittle 2' },
{ id: 3, title: '3. tittle 3' },
... |
import { lerp, EPSILON } from "./math.js";
export class Vector3 {
static ZERO = new Vector3(0, 0, 0);
static UP = new Vector3(0, 1, 0);
constructor(x = 0, y = 0, z = 0) {
this.set(x, y, z);
}
set(x, y, z) {
this.x = x;
this.y = y;
this.z = z;
return this;
}
copy(from) {
this.set... |
const { CodeExecutor } = require('code-executor');
const codeExecutor = new CodeExecutor('myExecutor', process.env.REDIS_URL);
const executeCode = async (language, code, testCases) => {
const input = {
language,
code,
testCases,
timeout: 2,
};
const results = await codeExe... |
function ContextTree(value) {
if(!(this instanceof ContextTree)) { return new ContextTree(value) }
this.root = createNode(value || {})
}
module.exports = ContextTree
ContextTree.prototype.set = function (path, value) {
var parent = this.getParent(path, true)
if(!parent) {
updateNode(this.root, value, null... |
function runTest()
{
var pageURI = basePath + "net/1308/issue1308.html";
var scriptURI = basePath + "net/1308/issue1308.js";
FBTest.openNewTab(pageURI, function(win)
{
FBTest.enableNetPanel(function(win)
{
win.runTest(checkCopyLocationWithParametersAction);
});
}... |
// controller for the new object modal
Discourse.KbObjNewController = Discourse.ObjectController.extend(Discourse.ModalFunctionality, {
// whether the submission process is complete
done: false,
flashMessage: null,
saving: false,
objPage: null,
relatedHeading: function() { var self = this;
return I1... |
"use strict";
angular.module("demoApp", ['ui.bootstrap', 'angular.directives']);
angular.module("demoApp")
.controller("DemoCtrl", [function() {
this.welcome="Angular Really Click Demo";
this.ok = function() {
alert("Do Action!");
};
this.cancle = function() {
... |
/* eslint-disable import/prefer-default-export */
// import { toastr } from 'react-redux-toastr';
import axios from 'axios';
import { toastr } from 'react-redux-toastr';
import C from '../constants/actions';
import config from '../config';
export const fetchTimezones = () => dispatch => {
axios({
method: 'get',
... |
({
doAction : function(component) {
var input1 = component.find("check1");
var input2 = component.find("check2");
var input3 = component.find("check3");
var input4 = component.find("check4");
//alert(input1);
var value1 = input1.get("v.value");
var v... |
//Written by Nabanita Maji and Cliff Shaffer, March 2015
/*global ODSA */
$(document).ready(function() {
"use strict";
var input;
var iparr;
var pair1;
var pair2;
var pair11;
var pair21;
var pairs;
var oparr;
var paired;
var line1;
var yoffset = 20;
var av_name = "sortToPairCON";
var jsav =... |
import { useState, useEffect } from "react";
import Head from "next/head";
import { useRouter } from "next/router";
import { getCurrentUser } from "../components/utils/utils.current-user";
const MainPage = () => {
const [currentUser, setCurrentUser] = useState(getCurrentUser());
const router = useRouter();
useEf... |
$(document).ready(function () {
commonScroll(".left-side");
//Load currency symbol
var currency = JSON.parse($('#hdSettings').val()).CurrencySymbol;
$('.currency').html(currency);
$(document).on('click', '.filter-data', function () {
var customerId = $('#ddlCustomer').val() == '0' ?... |
const mongoose = require('mongoose');
//create class code
var shortid = require('shortid');
/**
* Required restrictions
*/
// Created by this teacher
const teacherRestriction = {
type: mongoose.Schema.Types.ObjectId,
ref: 'Teacher',
required: [true, 'Teacher id required'],
};
const classCodeRestriction ... |
import {createActions} from 'src/App/helpers'
const actions = createActions('SEARCH', [
'SUGGESTIONS_FETCH_REQUEST',
'SET_NEW_SUGGESTIONS',
'SET_EMPTY_SUGGESTIONS',
'RUN_SEARCH',
])
export default actions
|
var express = require('express');
var morgan = require('morgan');
var bodyParser = require('body-parser');
var mongoose = require('mongoose');
var config = require('./config');
var app = express(); // app è istanza di express()
var api = require('./public/app/routes/api')(app,express);
// MongoDB:
// Tolgo in quanto ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.