text stringlengths 7 3.69M |
|---|
require('dotenv').config();
const express = require('express');
const app = express();
const bodyParser = require('body-parser');
const PORT = process.env.PORT || 4000;
const db = require('./models')
const getDataFromSpreadsheet = require('./getDataFromSpreadsheet')
app.use(bodyParser.json());
app.use(express.static(_... |
export const username = "happyamy2016";
|
const path = require('path');
const fs = require('fs');
const DEFAULT_CONFIG = {
driver: 'rethinkdbdash',
db: process.env.NODE_ENV === 'test' ? 'tinyurl-dev' : 'tinyurl',
host: 'localhost',
port: 28015,
migrationsDirectory: 'api/migrations',
};
module.exports = DEFAULT_CONFIG;
|
// TODO: Create and export a mongoose model called `Job` that follows the description in the README
var mongoose = require('mongoose');
var db = require('../db.js');
var jobschema = mongoose.Schema({
company: String,
title:String,
description:String,
postedDate:Date,
salary:Number
});
var Job = mong... |
const Discord = require("discord.js");
const commando = require('discord.js-commando');
const h2p = require('html2plaintext')
const Promise = require("bluebird");
const MediaWiki = require('nodemw');
const moment = require("moment");
const Markdown = require('turndown')
const markdown = new Markdown();
const path = req... |
function clamp(num, min, max) {
return num < min ? min : num > max && max!=null ? max : num;
}
function formatCurrency(value){
return "$ "+value.toFixed(0).replace(/(\d)(?=(\d{3})+\.)/g, '$1,');
}
$(function(){
// Share icons
// $('#facebook').sharrre({
// share: {
// facebook: true
// ... |
module.exports = ({
name: "trump",
code: `
$image[https://chilledcoders.ml/trump?text=$message]
$color[RAMDOM]
`
}) |
// pages/assemble/assemble.js
import {
alert
} from '../utils/core.js'
Page({
/**
* 页面的初始数据
*/
data: {
mode: "scaleToFill",
arr: [],
indicatorDots: true,
autoplay: true,
interval: 2000,
duration: 1000,
pinUrl: '',
mustData: '8月29日... |
"use strict";
const Persona = use("Persona");
const Driver = require('bigchaindb-driver');
const Bigchain = require('../../Models/Bigchain');
const Config = use("Config");
const driver = require('bigchaindb-driver')
const { validate } = use("Validator");
const API_PATH = 'http://localhost:9984/api/v1/'
class AuthCon... |
function getObject(url){
var d;
$.ajax({
type:'POST',
url:url,
async:false,
success:function(data){
d = data;
}
});
return d;
} |
'use strict';
var af = [4, 5, 6, 7];
// print all the elements of af
var x = 0;
// while (af.length > x) {
// console.log(af[x]);
// x++;
// }
for (var i = 0; i < af.length; i++) {
console.log(af[i]);
}
|
import axios from 'axios'
const state = {
ministries: []
}
const mutations = {
GET_MINISTRIES(state, ministries) {
state.ministries = ministries.reverse()
},
ADD_MINISTRY(state, ministry) {
state.ministries.unshift(ministry)
},
EDIT_MINISTRY(state, ministryToEdit) {
s... |
import { layout as templateLayout } from '@ember-decorators/component';
import FormElementLayoutVertical from '../vertical';
import layout from 'ember-bootstrap/templates/components/bs-form/element/layout/vertical/checkbox';
/**
@class FormElementLayoutVerticalCheckbox
@namespace Components
@extends Components.For... |
const express = require('express');
var session = require('express-session');
var db = require('../database');
var bodyParser = require('body-parser');
var Objects = require('../objects');
var geo_tools = require('geolocation-utils');
var router = express.Router();
var secretString = Math.floor((Math.random() ... |
import { HistoryKeywords } from "../../model/history-keywords"
import { Search } from "../../model/search"
const history = new HistoryKeywords()
Page({
/**
* 页面的初始数据
*/
data: {
historytags:[],
hottags:[],
items:[],
search:false,
value:'',
status:false,
SearchPaging:null,
endTex... |
import { AXIOS } from "@/http-common";
import jwt_decode from "jwt-decode";
import User from "@/models/user";
class AuthService {
login(user) {
return AXIOS.post("auth", user).then((response) => {
const token = response.data.token;
const newUser = new User();
if (token) {
const { roles,... |
const mongoose = require("mongoose");
const Schema = mongoose.Schema;
const slugify = require("slugify");
const CountrySchema = new Schema({
name: {
type: String,
required: [true, "Please provide a name"],
unique: true,
},
imageUrl: {
type: String,
required: [true, "Please provide a imageUrl"... |
var Modeler = require("../Modeler.js");
var className = 'Typesubsequentsearch';
var Typesubsequentsearch = function(json, parentObj) {
parentObj = parentObj || this;
// Class property definitions here:
Modeler.extend(className, {
originalsearchid: {
type: "string",
wsdlDefinition: {
minO... |
import {notes} from "./piano_notes";
export const sounds = {
piano: {
sample_bank: notes,
proxy: "https://cors.io/?",
endpoint: "https://turing-fm-api.herokuapp.com/sequence",
getSequence: (gin) => {
let XHR = ("onload" in new XMLHttpRequest()) ? XMLHttpRequest : XMLHttpRequest;
let xhr =... |
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { observer } from 'mobx-react';
import http from 'common/http';
import utils from 'common/utils';
import { Table, Modal,Button,Select,message } from 'antd';
import popupModel from '../models/FlowInstanceModel';
import session from 'mo... |
var winston = require('winston');
//var nssocket = require('winston-nssocket').Nssocket;
/**
* this piece of middleware provides a logger for auditing actions
**/
exports.logger = function() {
/*
Here you can add as many types of logging as you want - the following examples uses web sockets
winston... |
function mostrar()
{
var numero;
var maximo=0;
var minimo=10**99;
// declarar variables
var respuesta='si';
while(respuesta!="no")
{
numero=prompt("Ingrese numero");
numero=parseInt(numero);
while(isNaN(numero))
{
numero=prompt("Ingrese un número válido");
numero=parseInt(numero);
}
if(num... |
/* eslint-disable no-plusplus */
const filter = {
wrapper: document.querySelectorAll('.filter-wrapper'),
openFilter: (elm) => {
const header = elm.querySelector('.filter-header');
header.addEventListener('click', (e) => {
e.preventDefault();
if (elm.classList.contains('is-active')) {
e... |
/* Write a function that takes two or more arrays and returns a new array of unique values in the order of the original provided arrays.
In other words, all values present from all arrays should be included in their original order, but with no duplicates in the final array.
The unique numbers should be sorted by thei... |
ig.module(
'plusplus.entities.switch'
)
.requires(
'plusplus.entities.trigger-controller',
'plusplus.helpers.utils'
)
.defines(function () {
var _ut = ig.utils;
/**
* Entity that acts as a presence activated trigger.
* @class
* @extend... |
////////////////////////////////////////////////////////////////////////////////////////
//Sección para variables globales
min_val=1
max_val=833
var bar_datos;
var hist_datos;
var heat_data;
var box_data_time;
var box_data_len;
var global_width = 700;
var global_height = 700;
/////////////////////////////////////////... |
'use strict';
const api = require('circonusapi2');
var stdio = require('stdio');
var ops = stdio.getopt({
'query': {key: 'c', args: 1, mandatory: true, description: 'Metric Cluster Query'},
'token': {key: 'token', args: 1, mandatory: true, description: 'Circonus AP Token'},
'title': {args: 1, args: 1, mand... |
import React, { Component } from 'react'
import { ImageBackground } from 'react-native'
class CardImage extends Component {
render() {
const { style, picture, children } = this.props;
return (
<ImageBackground style={style} source={{ uri: picture }}>
{children}
</ImageBackground>
)
... |
jQuery(function () {
jQuery('input[type="checkbox"]').on('click', function () {
jQuery(this).val(this.checked ? true : false);
if (jQuery(this).attr('name') == 'isadmin') {
jQuery("#btnTimKiem").click();
}
});
});
function clearSearch() {
jQuery('#txtSearch').val("");
... |
const express = require('express');
const MongoClient = require('mongodb').MongoClient;
const ObjectId = require('mongodb').ObjectId;
const cors = require('cors');
const app = express();
const port = 4599;
const url = "mongodb://localhost:27017/eStore";
//
// let allowCrossDomain = ( req, res, next ) => {
// res.h... |
export const _LANDING = '/';
export const _REVIEW = '/review';
export const _POI = '/poi';
export const _LOGIN = '/login';
export const _CREATEACCOUNT = '/createAccount';
export const _HOME = '/home';
export const _MAP = '/map';
export const _EXPLORE = '/explore';... |
(function () {
'use strict';
define([
'jquery',
'nProgress'
], function ($, nProgress) {
// all utilities and cool tools would come here
// query strings
function getParameterValues(param) {
var url = window.location.href.slice(window.location.href.inde... |
require.config({
baseUrl : '../bower_components',
urlArgs: "bust=" + (new Date()).getTime(),
paths : {
// configuration base dir
services : '../javascripts/services',
controllers : '../javascripts/controllers',
directives : '../javascripts/directives',
// module shortcut
app : '../javascripts/app',... |
/**
* Created by wehjin on 5/22/14.
*/
module.exports = {
PROGRAM_ASSOCIATION: 0x0000,
CONDITIONAL_ACCESS: 0x0001,
TRANSPORT_STREAM_DESCRIPTION: 0x0002,
IPMP_CONTROL_INFORMATION: 0x0003,
PSIP: 0x1FFB,
NULL: 0x1FFF
};
|
var config = {
apiKey: "AIzaSyBxfBeQ0EjsYZMoMmCZs2yoJIuufzz0_AA",
authDomain: "employeetracker-6baf0.firebaseapp.com",
databaseURL: "https://employeetracker-6baf0.firebaseio.com",
projectId: "employeetracker-6baf0",
storageBucket: "",
messagingSenderId: "23495182849"
};
firebase.initializeAp... |
PATH_JSON = "json";
PATH_CSS = "css";
BREAK_SMALL = 750;
MAX_WIDTH = 1920;
angular
.module('app', [
"ngRoute"
])
.config(
[ '$locationProvider', '$routeProvider', function ($locationProvider, $routeProvider) {
$routeProvider
//About
.when('/:lang?/about', {
templateUrl: 'v... |
import React from 'react';
import OnScreen from 'onscreen';
/**
* React component implementation.
*
* @author dfilipovic
* @namespace ReactApp
* @class Counter
* @extends ReactApp
*/
export class Counter extends React.Component {
// -----------------------------------------------------------------------------... |
// Imports
import {mainDiscordVoiceChannelId} from '../var/config.json'
import { channelDisconnect } from './channelDisconnect'
export async function mainvoiceHandler(client, newState, oldState) {
if (newState.channel) {
// Checks whether the user joined the main voice channel
// if (newState.... |
/**
includes:
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/2.9.7/jquery.fullpage.min.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/2.9.7/vendors/jquery.... |
import React, {useState, useEffect} from 'react';
import {
Dimensions,
ActivityIndicator,
Platform,
BackHandler,
AppState,
Linking,
} from 'react-native';
import {
Router,
Scene,
Stack,
Drawer,
Tabs,
Actions,
} from 'react-native-router-flux';
import {NavigationContainer} from '@react-navigati... |
import React, { Component } from 'react';
import Menu from "./MenuComponent";
import DishDetail from './DishdetailComponent';
import Header from './HeaderComponent';
import Footer from './FooterComponent';
import Home from './HomeComponent';
import Contact from './ContactComponent';
import About from './AboutComponent'... |
'use strict';
var generator = require('./index');
var start = new Date();
generator('{g} {g} {s}', {
popularity: {
min: 97,
max: 100
},
limit: 5,
gender: 'F',
year: {
min: 2014,
max: 2014
}
}, function (err, names) {
console.log('Duration: ' + (new Date() - start) + 'ms');
console.log(... |
import * as firebase from 'firebase';
const firebaseConfig = {
apiKey: process.env.FIREBASE_API_KEY,
authDomain: process.env.FIREBASE_AUTH_DOMAIN,
databaseURL: process.env.FIREBASE_DATABASE_URL,
projectId: process.env.FIREBASE_PROJECT_ID,
storageBucket: process.env.FIREBASE_STORAGE_BUCKET,
mess... |
module.exports = ({ node }) => {
const level = node.getLevel() + 1;
return `<h${level} id="${node.getId()}">${node.getTitle()}</h${level}>
${node.getContent()}`;
};
|
//Evento initData : Inicialización de datos del formulario, después de este evento se realiza el seguimiento de cambios en los datos
//ViewContainer: FormularioProductoGrupoA
task.initData.VC_PRODUCTORG_818447 = function (entities, initDataEventArgs){
initDataEventArgs.commons.execServer = false;
i... |
'use strict';
(function () {
var app = angular.module('angularSpa');
app.controller('TabCtrl', function ($scope, $http, ActiveTab, Auth) {
$scope.tabs = [];
$http({
method: 'GET',
url: '/js/tabs.json'
}).success(function (data) {
$scope.tabs = data;
}).error(fu... |
const adminMiddleware = (req, res, next) => {
const { role } = req.user;
if (role.trim() !== "admin") {
return res.status(401).json({ msg: "Not authorized" });
}
next();
};
module.exports = adminMiddleware;
|
module.exports = {
name: 'memberOf'
} |
// Min Heap
// A min heap is a binary tree data structure that satisfies the following property: The value of every parent node is less than or equal to the values of their direct children nodes. It follows then that the node at the root of the tree is the element in the heap with the minimal value.
// min heap
// Im... |
const sort = () => {
$('#sort-alphabetically').on('click', function () {
$('#links .update').html(alphabetize($('.link')));
});
};
const alphabetize = (links) => {
return links.sort(function (a, b) {
const nameA = $(a).find("#title").text().toLowerCase();
const nameB = $(b).find("#title").text().to... |
function getdate(){
var dateObj = new Date();
mymonth(dateObj);
myyear(dateObj);
}
function mymonth(dateObj){
var month = dateObj.getUTCMonth() + 1; //months from 1-12
var mL = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'... |
import React, { Component } from 'react';
import { Modal, Form, Input, InputNumber, Button, Row, Col, Tabs, DatePicker, message } from 'antd';
import axios from 'axios';
import moment from 'moment';
import showError from '../utils/ShowError';
import TypeSelect from './TypeSelect';
import { dateFormat } from '../constan... |
import React, { useState } from 'react';
import Dialog from '@material-ui/core/Dialog';
import DialogContent from '@material-ui/core/DialogContent';
// import Streemly from '../imgs/streemly.jpg';
import SatoshiPic from '../imgs/satoshis-law.png';
import Airlytics from '../imgs/airlyticsicon.png';
// import SatoshiGif... |
$(function() {
window.$Qmatic.components.modal.confirmCustomer = new window.$Qmatic.components.modal.BaseModalComponent('#confirm-customer-modal')
}) |
require("dotenv").config();
const express = require("express");
const { sequelize } = require("./sequelize");
const bodyParser = require("body-parser");
const path = require("path");
const cors = require("cors");
const initializeRoutes = require("./routes/index");
const port = process.env.PORT || 8000;
const app = ex... |
function neighboring(str) {
const res = [];
for (let i = 0; i < str.length; i++) {
if (str.charCodeAt(i) + 1 === str.charCodeAt(i + 1) || str.charCodeAt(i) - 1 === str.charCodeAt(i + 1)) {
res.push(true);
}
}
return res.length + 1 === str.length;
}
const result = neighboring('abcdedcba');
console.... |
import "../BestFarmers/bestFarmers.css"
import MenuList from "../MenuList/menuList"
import Product from "../Product/product"
function BestFarmers(){
return(
<div className="BestFarmers">
<MenuList title="Best from Farmers"
text1="Carrots" text2="Tomatoes" ... |
(function() {
// 这些变量和函数的说明,请参考 rdk/app/example/web/scripts/main.js 的注释
var imports = [
'rd.controls.Table'
];
var extraModules = [ ];
var controllerDefination = ['$scope', main];
function main(scope) {
scope.exportHandler = function() {
var msg = 'RDK提供了基础导出... |
/*
* @lc app=leetcode.cn id=12 lang=javascript
*
* [12] 整数转罗马数字
*/
// @lc code=start
/**
* @param {number} num
* @return {string}
*/
// 1994 MCMXCIV
// [1,5) [5, 10) [10, 50) [50, 100) [100, 500) [500, 1000];
var intToRoman = function(num) {
let result = '';
let map = new Map();
map.set(1000, 'M');
... |
'use strict';
angular.module('myApp', [ 'myApp.services', 'myApp.controllers', 'ngRoute' ])
.config(function($routeProvider, $httpProvider) {
$routeProvider.when('/users', {
templateUrl : 'assets/js/userlist.html',
controller : 'userlistController'
});
$routeProvider.when('/userlist', {
... |
(function() {
/**
* AbstractClass service
*
* Service returns the AbstractClass function, which can be used to create
* other 'class' functions.
*
* Many of the services in the beryllium module use prototypal inheritance.
* There are a lot of ways that prototypal inheritance can be implemented,
* with subtle... |
const axios = require('axios');
const utils = require('../shared/utils');
const db = require('../db/dbModule');
const { httpStatus, keywords } = require('../constants');
const { time } = require('../shared/utils');
const config = require('../config');
const dbOps = require('../db/dbOperations');
const requiredFieldsFo... |
var express = require('express');
var router = express.Router();
//var func = require('./getComic.js');
/* GET users listing. */
function render(res, query) {
var http = require('http');
var opts = {
port: '3000',
path: '/comic/' + query
},
body = '';
http.request(opts, function(result) {
re... |
import { changeLocaleAction } from '../lib/index.es.js';
describe('changeLocaleAction AC', () => {
it('creates action', () => {
const action = changeLocaleAction({
locale: 'vi',
messages: {
greeting: 'Xin chao!',
},
});
expect(action).toEqual({
type: '@@intl/CHANGE_LOCALE'... |
//import liraries
import React, { Component } from 'react';
import { View, Text, StyleSheet, Button } from 'react-native';
import {NavigationContainer} from '@react-navigation/native';
import {createMaterialTopTabNavigator} from '@react-navigation/material-top-tabs';
import ChatScreen from './ChatScreen';
import Icon f... |
let navBackground=[
{title:"Головна"},
{title:"Приватні оголошення"},
{title:"Тури з Чернівців"},
{title:"Історія успіху"},
{title:"Афіша"},
{title:"Пропозиція тижня"},
{title:"Він+Вона"}, {title:"Журнал \"Давай одружимось!\""}]; |
define([],
function() {
return {
name: 'user-center',
init:function(eventType){
this.eventType = eventType;
this.couponTimes = 0;
GHutils.getParamHref();
this.bindEvent();
this.phoneLoginBindEvent();//手机号登陆绑定事件
this.userAccLoginBindEvent();//账号登陆绑定事件
this.regis... |
const Express = require("express");
const router = Express.Router();
const { Workout } = require('../models');
const validateSession = require('../middleware/validate-session');
// router.get('/practice', (req, res) => {
// res.send('This is a practice route')
// });
//Log a Workout
router.post("/create", validat... |
// 1
var king = document.getElementById('b325');
console.log(king.value);
// 2
var conceited = document.getElementsByClassName('b326');
alert(conceited);
// 3
var businessLamp = document.getElementsByClassName('big');
console.log(businessLamp);
// 4
var conceitedKing = document.querySelectorAll(".container .asteroid... |
import * as $ from 'jquery'
// * - импорт абсолютного всего из библиотеки в виде $
import Post from '@models/post.js'
import json from './assets/json.json'
import xml from './assets/data.xml'
import csv from './assets/data.csv'
import imgWebPack from '@/assets/iconWP.png'
import './styles/styles.css'
import './... |
describe('Sapper template app', () => {
beforeEach(() => {
cy.visit('/')
});
it('has the correct <h1>', () => {
cy.contains('h1', 'WikiTabs');
});
it('navigates to /popular', () => {
cy.get('nav a').contains('popular').click();
cy.url().should('include', '/popular');
});
it('navigates to /tablog', () ... |
import test from './test';
test('hello');
|
$(function () {
var $user = $(".in_for .user");
var on = false;
var Val = {
isMobile: function (s) {
return this.test(s, /(^0{0,1}1[3|4|5|6|7|8|9][0-9]{9}$)/)
},
isEmail: function (a) {
var b = "^[-!#$%&'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&'*+\\/0-9=?A-Z^_`a-... |
$(function () {
$("input[name='haz2']").click(function () {
if ($("#haz2yes").is(":checked")) {
$("#haz2number").show();
} else {
$("#haz2number").hide();
}
});
});
|
import React, {useState, useEffect} from 'react';
import {View, Alert, Text, Linking} from 'react-native';
import {useDispatch, useSelector} from 'react-redux';
import {Actions} from 'react-native-router-flux';
import Geolocation from '@react-native-community/geolocation';
import I18n from '@aaua/i18n';
import {
Ma... |
//@flow strict
//@format
const {promisify} = require('util');
const fs = require('fs');
const rm = (path /*: string */) /*: Promise<boolean> */ => {
return promisify(fs.unlink)(path)
.then(r => true)
.catch(err => false);
};
module.exports = rm;
|
const snakeboard = document.getElementById("gameCanvas");
const snakeboard_ctx = gameCanvas.getContext("2d");
let snake = [{ x: 200, y: 200 }, { x: 190, y: 200 }, { x: 180, y: 200 },
{ x: 170, y: 200 }, { x: 160, y: 200 },];
function drawSnakePart(snakePart) {
snakeboard_ctx.fillStyle = 'lightblue';
snakeboa... |
function runTest()
{
FBTest.openNewTab(basePath + "commandLine/4434/issue4434.html", function(win)
{
FBTest.enablePanels(["script", "console"], function() {
var tasks = new FBTest.TaskList();
tasks.push(waitForBreak, win, 21);
tasks.push(testAutocompletion, "myVar", "... |
import React from 'react';
import { TipHover, Root } from './styled';
const Tooltip = ({ tip, children, className, position, top, width }) => (
<Root className={className}>
<TipHover width={width} position={position} top={top}>
{typeof tip === 'function' ? tip() : tip}
</TipHover>
{children}
</Ro... |
/* global module */
function sum(a, b) {
return parseInt(a, 10) + parseInt(b, 10);
}
function difference(a, b) {
return a - b;
}
// If Node.js then export as public
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
module.exports = {
sum,
difference,
};
}
|
import Select from '../src/common/operator/Select';
import EventIn from '../src/common/source/EventIn';
import Asserter from './utils/Asserter';
import tape from 'tape';
tape('Select', (t) => {
let select;
let asserter;
let eventIn = new EventIn({
frameSize: 3,
frameType: 'vector',
frameRate: 0,
}... |
/*
Description :
Creates a duplicate-free version of an array, in which only the first occurrence of each element is kept. The order of result values is determined by the order they occur in the array.
Arguments :
1) The array to inspect.
Returns :
The new duplicate free array.
*/
// Début de votre code
... |
class Moderator{
static html_to_tree = function(){
};
static json_to_tree = function(){
};
};
|
/**
* 导航
*/
function nav_cw(nav){
this.navs=nav;
for (var i = 0;i < this.navs.length;i++) {
this.navs[i].onclick=function(){
clear_tab(this.navs);
this.className+=" active";
}
}
}
//清除导航样式
function clear_tab(nav){
for (var i = 0;i<this.navs.length;i++) {
this.navs[i].className="tab";
}
}
|
import { Kitsu } from 'kitsu/config/api';
import * as types from 'kitsu/store/types';
const defaults = {
popular: {
sort: '-userCount',
},
topAiring: {
sort: '-userCount',
filter: { status: 'current' },
},
topUpcoming: {
filter: { status: 'upcoming' },
},
highest: {
sort: '-averageRat... |
import React, { useContext, useState } from "react";
import { useHistory, Link } from "react-router-dom";
import { Form, Input } from "reactstrap";
import { FirebaseContext } from "../context/firebase";
import Footer from "../components/Footer";
import Header from "../components/Header";
import HeaderLogo from "../com... |
export function kill(lt) {
lt.kill_callback();
}
|
import axios from 'axios';
const editTeacher = (token) => {
const form = document.getElementById('edit-teacher');
const formBtn = document.getElementById('save-teacher');
if (!formBtn) return false;
formBtn.onclick = (e) => {
e.preventDefault();
const name = document.querySelector('.teacher-name').val... |
const para = require('../lib/para');
let id = 0;
let _concurrency_pool = {};
let fs = require('fs');
class Concurrency {
constructor(capacity = 2) {
this.id = id++;
this.capacity = capacity;
this.length = 0;
this.container = [];
this.task_container = [];
this.waiter =... |
const { ParentCards, ChildCards, cardRelations } = require("../../models");
const joi = require("joi");
exports.read = async (req, res) => {
try {
const loadChildCards = await ChildCards.findAll({
include: {
model: ParentCards,
as: "parent",
through: {
model: cardRelations... |
// partition(num)
// PARTITION A LINKED LIST AROUND A VALUE X, SUCH THAT ALL NODE LESS THAN X
// COME BEFORE ALL NODES GREATER THAN OR EQUAL TO X
// 1. CREATE A NEW SLL WITH THE REARRANGED VALUES
// 2. REARRANGE THE CURRENT SLL (HINT: YOU CAN SPLIT THE SLL IN TWO, THEN COMBINE THEM BACK AGAIN)
// partition(5)
// INPUT:... |
var express = require('express'),
router = express.Router(),
multer = require('multer'),
bodyParser = require('body-parser'),
jimp = require('jimp'),
cloudinary = require('cloudinary'),
app = express(),
storage = multer.diskStorage(
{
destination: function(req, res, callback) {
... |
export default class InputHanlder{
constructor(game, gameState){
document.getElementById("gameScreen").addEventListener("click", () => {
if(game.gameState == gameState.RUNNING)
game.bird.jump();
})
}
}
|
ingredientstr = localStorage["ingredientstr"]
var recipe_names = [];
var recipe_images = [];
var recipe_array = [];
var out = 0;
var F2Fkey_array = ["a424e4c0845023455bc2060bf36593a7","1bb35aab149d54449a70218d016a6d28","5c18504d00454741e843775329deee5d","6ba48d1ca050733e132d8cf997226f16","3a59d17ae007657cb656b23a25992... |
var app = angular.module('my-app', []);
app.controller('memoryGame', function($scope, $timeout){
function Card(num){
this.url= "images/monsters-"+ num+".png";
this.open = false;
this.matched = false;
}
function Board(){
// this.board = [[],[]];
this.protoboard = [];
this.board = [];
t... |
export const CONTEXT = process.env.API_HOST;
export const SOCKET = process.env.API_CLIENT;
/*跨域标识路径*/
export const STOMP = SOCKET + '/socket/wisely2';
/*登录*/
export const LOGIN = CONTEXT + '/login';
export const GET_MENUS = CONTEXT + '/userinfo';
/*退出*/
export const LOGOUT = CONTEXT + '/logout';
/*验证*/
export const LOG... |
import {
ADD,
EDIT,
DELETE,
CANCEL,
ERROR,
CLOSE,
} from './snackbarActions';
export default function snackbarReducer(state, action) {
switch (action) {
case ADD:
return { severity: 'success', message: 'snackbarAdd', open: true };
case EDIT:
return { severity: 'success', message: 'sna... |
// nospace
$.validator.addMethod("noSpace", function(value, element) {
return value == '' || value.trim().length != 0;
}, "No space is allowed and don't leave it empty");
// no digits in name fields
$.validator.addMethod("noDigits", function(value, element) {
return this.optional( element ) || !/\d/.test( valu... |
// 多(层次)组件共享状态
import { state } from './redux/state';
import { storeChange } from './redux/storeChange';
import { createStore } from './redux/createStore';
const { store, dispatch } = createStore(state, storeChange)
function renderHead(state){
const head = document.getElementById('head');
head.innerText = state.... |
import React from 'react';
export default class EmployeeForm extends React.Component {
constructor(props) {
super();
this.state = {
employee: {...props.employee}
}
}
componentWillReceiveProps(nextProps) {
this.setState({
employee: {...nextProps.emplo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.