text stringlengths 7 3.69M |
|---|
//index.js
//获取应用实例
const app = getApp()
Page({
data: {
userdata: [],
userId: 0
},
onLoad: function() {
var that=this;
wx.getStorage({
key: 'userId',
success: function(res) {
that.setData({
userId: res.data
})
that.getuserdata()
}
})
},
/... |
function PrintSomethingInTheLog() {
console.log("Nyoooo! Some of your tests are failing!");
}
function miaComplains(){
const complains = [
"Nyoooo! Some of your tests are failing!",
"Delete system32 pls",
"Rule 'don't suck' violated: this is terrible",
"I will NOT merge this PR!... |
import characters_json from '../data/characters.json';
import {ADD_CHARACTER,REMOVE_CHARACTER} from '../actions';
import {createCharacter} from './helpers';
function characters(state = characters_json,actions){
switch(actions.type){
case ADD_CHARACTER :
let characters = state.filter(item =>item.id !== ... |
async function request(method,url,data=null){
var req = new XMLHttpRequest();
let getContent = new Promise((resolve,reject)=>{
req.open(method,url,false)
req.onload = () =>{
if(req.readyState === 4 && req.status === 200){
return resolve(req.respons... |
var PropTypes = require('prop-types');
PropTypes.function = PropTypes.func;
PropTypes.boolean = PropTypes.bool;
module.exports = {
name: 'core.import.prop-types',
imports: {
'prop-types': PropTypes,
PropTypes: PropTypes
}
}; |
const Discord = require("discord.js");
const ms = require('ms');
const TimePeriod = new Discord.MessageEmbed()
.setColor("RED")
.setDescription('🚫 You did not use the correct time format! Make sure that the time ends in ``d`` | ``h`` | ``m``')
const NoTime = new Discord.MessageEmbed()
... |
import React, { Component } from 'react';
import Header from '../home/Header';
import Headingf8 from '../home/headingf8';
import Imagescard from './productdetailimagescard';
import Table from './productdetailtable';
import Secondfold from './productdetailsecondfold';
import { CircleSizes } from '../_components/myInput'... |
(() => {
chrome.contextMenus.create({
"type": "normal",
"title": "日本語に翻訳",
"contexts" : ["selection"],
"onclick": function(info) {
let url = encodeURI(`https://script.google.com/macros/s/AKfycbzGc0s6NxcvV3CctOFxluVXYhiQJX_Wfuwo9OYn369BYyBSZltq/exec?text=${info.selectionText}&source=auto&target... |
var readline=require('readline');
var utility=require('../Utility/utility.js')
var read=readline.createInterface({
input:process.stdin,
output:process.stdout
});
function generatenum()
{
read.question("enter min value : ", function(min){
read.question("enter max value : ", function(max){
... |
exports.handleAge = (timestamp) => {
const today = new Date();
const birthDate = new Date(timestamp);
let age = today.getUTCFullYear() - birthDate.getUTCFullYear();
const month = today.getUTCMonth() - birthDate.getUTCMonth();
if (
month < 0 ||
(month == 0 && today.getUTCDate() <= birthDate.getUTCDat... |
const router = require("express").Router();
const jwt = require("jsonwebtoken");
const axios = require("axios");
const { firebase, admin } = require('../../../utils/firebase');
const { dbToRes, reqToDb } = require("../../../utils");
const { Users } = require("../../../data/models");
const {
checkAccountExists,
va... |
/* Write a function, which takes a non-negative integer (seconds) as input and returns the time in a human-readable format (HH:MM:SS)
HH = hours, padded to 2 digits, range: 00 - 99
MM = minutes, padded to 2 digits, range: 00 - 59
SS = seconds, padded to 2 digits, range: 00 - 59
The maximum time never exceeds 359999 (9... |
module.exports = {
//param A : integer
//param B : array of array of integers
//param C : integer
//return an integer
solve: function (A, B, C) {
var tTree = {};
var ret = 0;
//B.sort(comp1);
for (var i = A - 2; i >= 0; i--) {
var p = B[i][0],
c = B[i][1],
if (tTree[c] == n... |
import AppHelper from 'helpers/AppHelper'
import AuthHelper from 'helpers/AuthHelper'
import BuildHelper from 'helpers/BuildHelper'
import BuildResultHelper from 'helpers/BuildResultHelper'
import TeamResultHelper from 'helpers/TeamResultHelper'
import MonsterResultHelper from 'helpers/MonsterResultHelper'
import Monst... |
import $ from 'jquery'
import Rx from 'rxjs/Rx'
// function getItems(title) { // eslint-disable-line func-style, require-jsdoc
// console.log('Querying', title)
//
// return new Promise(resolve => {
// window.setTimeout(() => {
// resolve([ title, 'Item 2', `Another ${Math.random()}` ])
// }, 500 + ... |
import React from 'react'
import {connect} from 'react-redux'
import {selectDirectorySections} from '../../Redux/Directory/directorySelector'
import {createStructuredSelector} from 'reselect'
import './directory.scss'
import Newdoc from '../Admin/newdoc';
import MenuItem from '../Menu-Item/Menu';
const Directory = ({... |
import {useParams} from 'react-router-dom'
const Anecdote = ({anecdotes}) => {
const id = useParams().id; // HACK
const anec = anecdotes.filter(x => x.id === id)[0]
return(
<div>
<h2>Anecdote</h2>
<ul>
<li>Content: {anec.content} </li>
<li>Author: {anec.author} </li>
... |
const passport =require('passport');
const LocalStrategy= require('passport-local').Strategy;
//referencia al modelo donde vamos a autenticar
const Usuarios=require('../models/Usuarios');
//local Strategy -Login con credenciales propias
passport.use(
new LocalStrategy(
{
usernameField:'email'... |
angular.module('AuthController', ['services'])
.controller('BioCtrl', function($scope, $state, UserService) {
$scope.msg = "Please log in..";
$scope.btn = "Log In";
$scope.label = "Log In";
$scope.dispBiometric = false;
$scope.dispLockOut = false;
$scope.state = 0;
function setState(state) {
//Lo... |
const path = require("path")
const { getComponentsDir } = require("./get-components-dir")
describe("getComponentsDir()", () => {
it("returns the project's object when not specified", () => {
expect(getComponentsDir()).toEqual(path.resolve("src/_components"))
})
it("falls back to a sensible default", () => {... |
import { Route, BrowserRouter } from 'react-router-dom';
import React from 'react';
import Album from './Containers/Album';
import AlbumsList from './Containers/AlbumsList';
import UsersList from './Containers/UsersList';
import GlobalStyle from './GlobalStyles';
function App() {
return (
<div className="App">
... |
import React, { useCallback, useEffect, useState } from "react";
import { BrowserRouter, Switch, Route, Link } from "react-router-dom";
import "antd/dist/antd.css";
import { JsonRpcProvider, Web3Provider } from "@ethersproject/providers";
import { LinkOutlined } from "@ant-design/icons"
import "./App.css";
import { R... |
const { response } = require('express');
const express=require('express');
const app=express();
const request=require('request');
const PORT=process.env.PORT||5000;
var url='http://www.omdbapi.com/?t=sacred games&apikey=a2aa142e';
// app.get(url,(req,res)=>{
// request(url,(err,response,body)=>{
// if(!err ... |
"use strict";
const path = require("path");
const { notarize } = require("electron-notarize");
const getAuthInfo = () => {
const { APPLE_ID: appleId, APPLE_ID_PASSWORD: appleIdPassword, APP_ID: appId } = process.env;
if (!appleId || !appleIdPassword) {
throw new Error("One of APPLE_ID and APPLE_ID_PASSWORD e... |
import React from 'react';
import classes from './header.module.css';
import { NavLink } from 'react-router-dom';
const Header = (props) => (
<header className={classes.header}>
<h1>Ireland Coronavirus Stats</h1>
<nav>
<ul>
<li>
<NavLink exact to="/" activeClassName={classes.navActive... |
const Models = require('../models');
const sidebar = require('../helpers/sidebar');
const ratings= require('../helpers/ratings');
const fs = require('fs');
const json2csv = require('json2csv');
var VOTING_OPEN_FOR = {};
var COMPARE_TEAMS = {};
const sockets = require('../server');
module.exports ={
index: function(re... |
import React, {Component} from 'react';
class FormToLogin extends Component {
constructor(props) {
super(props);
this.state = {
text: ''
}
this.handleChange = this.handleChange.bind(this);
}
handleChange(event) {
this.setState({text: event.target.value})... |
$(function() {
const WIN = window;
const DOC = document;
const $articles = $('.blog__article'); // статьи справа
const articles = $articles.toArray(); // []
const $articlesList = $('#blog__article-list'); // ul со списком статей слева
const $articleTitles = $('#blog__article-titles'); // aside
... |
$(window).on('load resize', function () {
if ($(window).width() > 760) {
$('.mb_container').css('display', 'none');
} else if ($('.mb_container').hasClass("mslide")) {
$('.mb_container').css('display', 'block');
} else {
$('.mb_container').css('display', 'none');
}
});
$(documen... |
import React, {useEffect, useState} from "react";
import axios from "axios";
function App() {
const [entries, setEntries] = useState([])
useEffect( () => {
async function fetchData() {
// You can await here
const entriesResponse = await axios(
'http://localhost... |
// @flow
export function assert(expression: boolean, message: string) {
if (!expression) {
throw new Error(message);
}
}
export function getValue<T>(defaultValue: T, value: ?T): T {
if (value != null) {
assert(typeof defaultValue === typeof value, 'Types not matching');
return value;
}
return de... |
'use strict';
var ngApp = angular.module('app', ['ui.bootstrap', 'ui.tms', 'http.ui.xxt']);
ngApp.controller('ctrlInvite', ['$scope', '$q', '$uibModal', 'http2', function($scope, $q, $uibModal, http2) {
var _oPage;
$scope.page = _oPage = {
at: 1,
size: 10,
join: function() {
... |
(function() {
'use strict';
angular
.module('buddy-schedule')
.controller('DayViewCtrl', DayViewCtrl);
DayViewCtrl.$inject = ['$scope', '$state', 'EventFactory'];
/* @ngInject */
function DayViewCtrl($scope, $state, EventFactory) {
var vm = this;
vm.today = mo... |
// ImageVail v1.0.0-SNAPSHOT
// Variables
// -- Image and canvas
let $canvasContainer = document.getElementById('canvasContainer');
let $canvas = document.getElementById('imageCanvas');
let $ctx = $canvas.getContext('2d');
let $originalImg = new Image();
let $pixelatedImg = new Image();
let originalImageDimensions = {... |
import React from 'react'
const Header = props => (
<nav data-testid='header'>
<h3>My Web App</h3>
</nav>
)
export default Header
|
const path = require('path')
const baseConf = require('./webpack.base.conf.js')
const webpack = require('webpack')
const htmlWebpackPlugin = require('html-webpack-plugin')
const extractPlugin = require('extract-text-webpack-plugin')
const vuxLoader = require('vux-loader')
const UglifyJsPlugin = require('uglifyjs-webp... |
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Icons from '../../icons';
import { Flex } from 'grid-styled';
import styled from 'styled-components';
import Icon from '../icon/Icon';
import IconsStore from '../icon/IconsStore';
import Text from '../text/Text';
import { COLORS } fro... |
var longest = '';
const Longest_Country_Name = (array) => {
var arr = array;
for (let i = 0; i < array.length; i++) {
if (arr[i] > longest) {
longest = arr[i];
}
}
return longest;
}
console.log(Longest_Country_Name(["Australia", "Germany", "United States of America"])); |
const Session = require('../models/Session');
// APP ROOT
exports.getRoot = (req, res) => {
res.status(200).send({ message: "OK", status: "success"});
}
// RETRIEVE all session data with formatted raw
exports.findAll = (req, res) => {
Session.find({}).select('-_id')
.then((data) => {
let formatted... |
import logo from './logo.svg';
import './App.css';
import Webcam from "react-webcam";
const WebcamComponent = () => <Webcam />;
function App() {
return (
<div className="App">
<header className="App-header">
<WebcamComponent />
<p>
Kevin Ariel Cruz Ortiz - 201213059
</p>
... |
// Rest Parameters
function example(firstNum, ...rest) {
console.log("firstNum", firstNum);
console.log("rest", rest);
console.log(Array.isArray(rest), Array.isArray(arguments))
}
example(1, 2, 3, 4);
example(4, 5, 6, 7, 8);
// Rest Params 3. Example
var compute = function (op, ...sayilar) {
var... |
exports.dev = true;
exports.hasWorker = true;
exports.deviceorientation = true;
exports.devicemotion = true;
|
var nodemailer = require('nodemailer');
var fs = require('fs');
var path = require('path');
var mailer = {
sendMail:function(toAddress, month, mainContent,attachmentFile){
return new Promise(function(resolve, reject){
var transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user... |
import Avatar from '../prefabs/avatar';
var playerVelocity = 0;
let distance = 0;
class Running extends Phaser.State {
constructor() {
super();
}
preload(){
this.game.time.advancedTiming = true;
}
create() {
this.game.world.setBounds(0,0,this.game.world.width, this.game.world.height);
conso... |
import React, {Component} from 'react'
import Book from './Book'
class BookShelf extends Component {
render(){
const { booksList, section, selectOnChange } = this.props;
const books = booksList.map( book => {
return ( <li key={book.id}>
<Book bookDetail={book} selectOnChange={selectOnCh... |
'use strict';
const EMPTY_STRING = '';
const extractHeadLines = function(lines, numOfLines) {
const start = 0;
const end = numOfLines;
const listOfHeadLines = lines.split('\n').slice(start, end);
return listOfHeadLines.join('\n');
};
const generateErrorMessage = function(filename) {
return `head: ${filename... |
import {combineReducers} from "redux-immutable";
import {SET_INITIALIZED} from "./actions";
const initialized = (state = false, {type}) => (type === SET_INITIALIZED ? true : state);
export default combineReducers({
initialized,
});
|
const dotenv = require('dotenv');
const express = require('express');
const router = require('./routes')
const process = require('process');
const cors = require('cors');
const LinkedInStrategy = require('passport-linkedin-oauth2').Strategy;
const passport = require('passport');
const app = express();
var env = "develo... |
'use strict';
const _ = require('lodash');
const fork = require('child_process').fork;
const Path = require('path');
const Fs = require('fs');
const buildConfigPath = Path.join(process.cwd(), 'stencil.conf.js');
const config = getConfig();
const onReadyCallbacks = [];
let worker = null;
let workerIsReady = false;
con... |
import React, { PropTypes } from 'react';
import SelectTrainsImage from './images/select-trains.png';
import SearchButtonImage from './images/search-button.png';
import MenuImage from './images/menu-final.png';
import SelectScheduleImage from './images/select-schedule.png';
import styles from './StepItem.module.scss';
... |
//Map code start here
var apiPrashantCall = null;
var mapFinalMarkerCoords = null;
var infoWindowContent = null;
var cordinatList = {
indianState: {
'Andaman and Nicobar Islands':{
lat: 11.7401,
long: 92.6586
},
'Delhi': {
lat: 28.6139,
long: 77.2090
},
'Andhr... |
const express = require('express');
const router = express.Router();
const controller = require("../controllers/comments")
router.use('/:lng?/comment/:id?',controller.comment);
router.use('/:lng?/reply/:id?',controller.reply);
module.exports = router; |
class CelluleConstructObject {
constructor(name) {
this.name = name;
this.level = 0;
this.color = 0;
}
levelUp() {
this.level += 1;
}
}
|
function back()
{
window.location = "index.html";
}
function get_score()
{
var score = localStorage.getItem("score");
document.getElementById("updated_score").innerHTML = "<h1> Score: " + score + "</h1>";
} |
import React from 'react';
import './Button.css';
import {Link} from 'react-router-dom';
const STYLES = ['btn--primary', 'btn--outline', 'btn--light'];
const SIZES = ['btn--medium', 'btn--large'];
const LINKS = ['/', '/sign-up', '/trailer', '/contact', '/adventure'];
export const Button = ({children, type, onClick, b... |
import met from '../models/metric.model';
const Metric = met.Metric;
const MetricCapture = met.MetricCapture;
const metricCtrl = {
getAll: function(req, res, next) {
Metric.find()
.then(function(metrics) {
res.status(200).json(metrics);
})
.catch(function(err) {
return res.stat... |
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative pat... |
import React from 'react';
import FormControl from '@material-ui/core/FormControl';
import TextField from '@material-ui/core/TextField';
import Checkbox from '@material-ui/core/Checkbox';
import FormControlLabel from '@material-ui/core/FormControlLabel';
import FormHelperText from '@material-ui/core/FormHelperText';
im... |
/* global Reveal, hljs */
import Ember from 'ember';
import layout from './template';
import EmberWormhole from 'ember-wormhole/components/ember-wormhole';
import { EKMixin, keyUp } from 'ember-keyboard';
const { computed, get, set, observer, isBlank, isPresent, on } = Ember;
export default EmberWormhole.extend(EKMix... |
const assert = require("assert");
const crypto = require("crypto");
const { createRequest } = require("../util/util");
describe("测试歌曲搜索是否正常", () => {
it("数据的 code 应该为0", done => {
createRequest(
"/fcgi-bin/music_search_new_platform?t=0&n=10&aggr=1&cr=1&loginUin=0&format=json&inCharset=GB2312&outCharset=utf... |
import React from 'react'
import styled from 'styled-components'
function CartTotal({getTotalPrice,getCount}){
return (
<Container>
<Subtotal>Subtotal ({getCount()} Items) :₹ {getTotalPrice()} </Subtotal>
<CheckoutButton>Proceed to checkout</CheckoutButton>
</Container>
... |
// Base template class which computes from buffer
class DataBuffer {
constructor(data) {
this.data = data;
}
sanitize(data) {
return data;
}
checkForErrors() {
return false;
}
compute() {
// Hook to check for errors
const isError = this.checkForErrors(this.data);
if(isError) {
... |
const letter_freq = {'A': 13, 'B': 3, 'C': 3, 'D': 6, 'E': 18, 'F': 3, 'G': 4, 'H':3, 'I':12, 'J':2, 'K':2, 'L':5, 'M':3, 'N':8, 'O':11, 'P':3, 'Q':2, 'R':9, 'S':6, 'T':9, 'U': 6, 'V':3, 'W':3, 'X':2, 'Y':3, 'Z':2};
const not_allowed_prefixes = ['UN', 'RE'];
const not_allowed_suffixes = ['S', 'ED', 'D', 'ES', 'ER', 'R... |
/**
* jest 확장
* https://jestjs.io/docs/en/configuration 확인 할 수 있다.
*/
module.exports = {
moduleFileExtensions: ['js', 'json', 'jsx', 'ts', 'tsx', 'json']
};
|
(function () {
angular
.module('serviceModule')
.factory('dataService', dataService);
function dataService() {
var now = new Date();
var threeDays = new Date();
var old = new Date();
var newUserLists = [
{
"id": 1,
"title": "READ... |
function capitalize(string) {
let arr = string.split('');
let firstLetter = string[0].toUpperCase();
arr[0] = firstLetter;
string = arr.join('');
return string;
}
module.exports = capitalize; |
(function ($) {
$(".link-section").on("click", function (e) {
e.preventDefault();
$(".link-section").removeClass("selected");
var sectionId = $(e.currentTarget).attr("data-section");
$(e.currentTarget).addClass("selected");
(sectionId === "clones")
? $(".clones")... |
import React from 'react';
import PropTypes from 'prop-types';
import { tokens } from '@sparkpost/design-tokens';
import styled from 'styled-components';
import { DateUtils } from 'react-day-picker';
import { LiveProvider, LiveEditor, LiveError, LivePreview } from 'react-live';
import github from 'prism-react-renderer/... |
const chai = require('chai');
const si1145 = require('../si1145');
const expect = chai.expect;
var Si1145;
describe('SI1145', function() {
before(function(done) {
Si1145 = new si1145();
// takes just a wee bit of time to startup
var waiting = setTimeout(function wait() {
if (Si1145.deviceActi... |
import Layout from '@/views/layout/Layout'
const ContentManagement = {
path: 'Content',
name: '内容管理',
iconCls: 'el-icon-menu',
role: 1,
component: Layout,
children: [
{
path: '/Course',
name: '课程标签管理',
iconCls: 'el-icon-time',
role: 3,
component: () => import('@/views/Cont... |
import React from "react";
import Txt, { InfoTxt, WarningTxt } from "./index.js";
export default (stories) =>
stories
.add("テキスト - S", () => <Txt size="s">テキスト</Txt>)
.add("テキスト - M", () => <Txt size="m">テキスト</Txt>)
.add("テキスト - L", () => <Txt size="L">テキスト</Txt>)
.add("情報テキスト - S", () => <InfoTxt si... |
const emptyErrors = {
name: null
};
export default function reducer (state = {
show: false,
saving: false,
responseError: '',
errors: emptyErrors,
task: {}
}, action) {
switch (action.type) {
case 'TASK_SHOW_MODAL': {
return { ...state, show: true, task: action.data.task... |
import NavBar from '@/nav/NavBar';
import Footer from './footer';
const Layout = (props) => {
const { children } = props;
const links = [{location="/profile", name="profile"}, {location="/clubs", name="Clubs"}, {location="/org", name="USC"}]
return (
<div>
<NavBar links={links} />
{children}
<Footer />
... |
import React from 'react';
import { Text, View } from 'react-native';
const propTypes = {};
const defaultProps = {};
const navigationOptions = {
title: 'Profile',
};
class Profile extends React.Component {
render = () => {
return (
<View>
<Text> Profile </Text>
</View>
)
}
}
Profile... |
// Make a div
const myDiv = document.createElement('div');
// add a class of wrapper to it
myDiv.classList.add('wrapper');
// put it into the body
document.body.appendChild(myDiv);
// make an unordered list
// add three list items with the words "one, two three" in them
const ul =
`<ul>
<li>one</li>
<li>two<... |
angular.module("MainApp").controller('PayerType', ['$scope','$http','$location','$state', function ($scope, $http, $location,$state) {
// SAVE PAYMENT
$scope.savePayerType = function (formData) {
$http.post('/payerType', formData)
.success(function (data, status, headers, config) {
... |
import styled from 'styled-components';
// Form Wrapper
export const FormContainer = styled.div `
display: flex;
justify-content: center;
align-items: center;
`;
// Input Fields
export const InputField = styled.input `
width: 60%;
margin-top: 15px;
background-color: ${props => (props.theme.col... |
import {AVATARS} from './constants';
export const handleConnectionError = (error) => {
window.alert("Error connecting to socket. Please check your internet.");
}
export const handleConnectionClosed = () => {
window.alert("Connection closed to socket. Please check your connection.");
}
// Gets a standardized PubSub.... |
// При помощи AJAX без обновления всей страницы выгружаем на сайт уже заполненую таблицу
$(document).on('click', '#sendCode', function() {
$.post("/checkTrackingCode", {
trackingCode: $("#placeForTrackNumber").val()
},
function(data) {
// alert('DATA HAS GOTTEN');
var fullTableFromDB = data;... |
import React from 'react';
const linkStyle = {
margin: '5px',
fontSize: '0.85rem',
textDecoration: 'none',
color: '#000',
}
const TableBody = ({
stories,
voteCount,
increment,
mapTime,
handleHide
}) => {
return (
<tbody style={{ backgroundColor: '#efebe9' }}>
... |
module.exports = {
resultDirectory: `results`,
browsertimeResultFile: `browsertime.json`,
};
|
define([
'./helpers_test',
'./lifecycle_test',
'./schema_test',
'./urlTesting_test',
'./submodel_setter_test',
'./validation_test'
], function (
helpers,
lifecycle,
schema,
urlTesting,
submodel_setter_test,
validation_test
) {
'use strict';
return function(){
validation_test();
helpers();
lifecycle... |
import "../styles/globals.css";
import "../styles/variables.css";
import "../styles/fonts.css";
import outlineWatcher from "../utils/outlineWatcher";
import BaseLayout from "../layout/BaseLayout";
import { useEffect, useState } from "react";
import { getData } from "../services/dato";
import Router from "next/router"... |
define("game", ["expose",
"animate",
"draw",
"input",
"blob"], function(expose,
_animate,
_draw,
_input,
Blob){
var _main,
_canvas,
_ctx,
_score = 0,
_blobs = [],
_baskets = [],
_startTime = 0,
_isGameOver = false,
_deltaTime = 15000,
_colors =... |
//FUNCIÓN ORDENAR A-Z /Z-A
const compareSortData = (elemA, elemB) => {
if (elemA.name > elemB.name)
return 1;
if (elemA.name < elemB.name)
return -1;
return 0;
};
const sortData = (data, sortBy) => {
let sortedData = data.sort(compareSortData);
if (sortBy === "Az") {
return sortedData;
} else i... |
var express = require('express');
var router = express.Router();
var Emp=require('../model/employee');
router.post('/',function(req,res,next){
var data=req.body;
var change=new Emp(req.body);
change.save(function(err){
if(err){
return handleError(err);
}
else{
console.log("saved to Data... |
let express = require("express")
var firebase = require("firebase")
var http =require("http")
var app = firebase.initializeApp({apiKey: "AIzaSyCtkcoYUSY9wY4JEm7GfWAS5Dhjexk_hcQ",
authDomain: "hackatonpsu.firebaseapp.com",
databaseURL: "https://hackatonpsu.firebaseio.com",
projectId: "hackatonpsu",
storageBucket: "hacka... |
$(document).ready(function () {
"use strict";
function logoSwitch() {
$('.altLogo').each(function () {
$(this).css('top',
$('.startLogo').offset().top - $(this).closest('.page').offset().top
);
});
}
$(document).scroll(function () {
logoSwitch();
});
logoSwitch();
// MENU
$(".burgerMe... |
import AccessibilityObject from './AccessibilityObject';
import { ROLES } from '../Roles';
export default class TableSectionData extends AccessibilityObject {
/**
* @inheritdoc
*/
addChild(displayObject) {
if (
!displayObject.accessible ||
displayObject.accessible.role !== ROLES.ROW
) {
... |
import firebase from "firebase/app";
import "firebase/firestore";
import "firebase/storage";
let firebaseConfig = {
apiKey: "AIzaSyCSHSnOaWkWxGYzNeVfllhxHrAKO7ZKLyg",
authDomain: "pdf-test-7a1fb.firebaseapp.com",
databaseURL: "https://pdf-test-7a1fb.firebaseio.com",
projectId: "pdf-test-7a1fb",
storageBucket... |
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
TouchableOpacity
} from 'react-native';
class TouchableCapacityAndState extends Component {
constructor(props) {
super(props);
this.state = {
luckynumber: 1000
};
}
numberIncrease() {
this.... |
'use strict';
const redis = require('..');
describe('redis', () => {
test('needs tests', async() => {
redis.getConnection();
expect(redis.connected).toEqual(true);
expect(redis.client).not.toEqual(null)
});
it('Should insert a entry', async() => {
const entry = await redis.getConne... |
// import our production apollo-server instance
const { server, db } = require('../');
const { startTestServer, toPromise, populate, clean } = require('./utils');
const { GET_ME, LOGIN_ME_IN, REGISTER, ALL_USERS } = require('./graphql/queryStrings');
const testUser = { user: { name: 'Test Test', email: 'tesT@email.co... |
import React, { Component } from 'react';
import {
Platform,
StyleSheet,
TouchableHighlight,
Text,
View,
Image,
TextInput,
ScrollView,
Dimensions
} from 'react-native';
// import { StackNavigator } from 'react-navigation';
import { Button, Container, Header, Content, Card, CardItem, Body } from 'nativ... |
import {NgModule,
Injectable,
Component,
ChangeDetectionStrategy,
ElementRef,
Renderer2} from "/ui/web_modules/@angular/core.js";
export {MnElementCraneModule,
MnElementCraneService,
MnElementCargoComponent,
MnElementDepotComponent};
class MnElementCrane... |
function ex31()
{
var exDiv = '#ex31';
var mainDiv = '#canvas_ex31';
var numMazes = 5;
var showAnimTime = 4500;
function init() {
//var getParentHeight = $('.games-inner-container').height();
//var getParentWidth = $('.games-inner-container').width();
//$(exDiv).css('height... |
import PropTypes from 'prop-types';
import React from 'react';
import injectStyles from '@/utils/injectStyles';
import styles from './styles';
const Plates = ({ data, className }) => {
if (!data) return <div>Plates не содержат данных</div>;
return (
<div className={className}>
{data.map(({ id, title, ... |
const name = 'Test Patrol'
const opt = {
w: 8,
h: 8,
base: '.',
}
function genTerrain(world, opt) {
lib.ken.generateSquare(world, opt)
}
function genSquads(world, opt) {
lib.geo.vline(world, 3, 5, 3, '^')
const d1 = world.spawn(dna.bot.Mech, {
team: 1,
symbol: 'A',
x:... |
// Iteration 1: All directors? - Get the array of all directors.
function getAllDirectors(array) {
return array.map( film => film.director);
}
// _Bonus_: It seems some of the directors had directed multiple movies so they will pop up multiple times in the array of directors. How could you "clean" a bit this arr... |
var express = require('express');
var app = express();
var mongoose = require('mongoose');
var bodyParser = require('body-parser');
var handlebars = require('express-handlebars');
var bcrypt = require('bcryptjs');
// requires files defining content schema
var Contact = require('./models/Contact');
var User = require... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.