text
stringlengths 7
3.69M
|
|---|
/**
* @license
* Copyright 2018 Google Inc.
*
* 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 writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
goog.module('googlecodelabs.hello_test');
goog.setTestOnly();
const HelloElement = goog.require('googlecodelabs.HelloElement');
const testSuite = goog.require('goog.testing.testSuite');
goog.require('goog.testing.asserts');
goog.require('goog.testing.jsunit');
testSuite({
testHelloEquals() {
const x = 6;
assertEquals(6, x);
},
testHelloUpgraded() {
const div = document.createElement('div');
div.innerHTML = "<hello-element>static</hello-element>";
document.body.appendChild(div);
let text = div.textContent;
assert(`"${text}" does not end with 'upgraded!'`, text.endsWith("upgraded!"));
},
});
|
var searchData=
[
['pressure_20sensor',['Pressure Sensor',['../group__group__board__libs.html',1,'']]]
];
|
const App = require('./lib/app');
const dotenv = require('dotenv');
dotenv.config();
new App().start();
|
import { SET_PROPERTY_TYPES } from "../actions/actionTypes";
import { combineReducers } from 'redux';
const mapById = (data) => {
return data.reduce( (map, model, id) => {
map[model.id] = id;
return map;
}, {});
}
const properties = (state = [], action) => {
switch(action.type) {
case SET_PROPERTY_TYPES:
return action.data;
default:
return state;
}
}
const byId = (state = {}, action) => {
switch(action.type) {
case SET_PROPERTY_TYPES:
return mapById(action.data);
default:
return state;
}
}
const propertyTypes = combineReducers({
propertyTypes: properties,
byId
})
export default propertyTypes;
|
import React, { useEffect, useState } from "react";
import axios from "axios";
import {
Col,
Form,
Row,
ListGroup,
Button,
Pagination,
Container,
Alert,
Image,
OverlayTrigger,
Tooltip,
} from "react-bootstrap";
import { InfoCircle } from "react-bootstrap-icons";
import moment from "moment";
import jsPDF from 'jspdf'
import P5 from 'p5';
const p5 = new P5();
const FullReportView = (props) => {
const page_size = 10;
const totPages = Math.ceil(props.report.length / page_size);
const [currentPage, setCurrentPage] = useState(1);
const [reportPage, setReportPage] = useState([]);
const paginate = (array, page_number) => { //function to return subset (page for pagination) of the entire array of report
return array.slice((page_number - 1) * page_size, page_number * page_size);
}
const handlePrev = () => {
let current = currentPage - 1;
if ((current) > 0) {
setCurrentPage(current);
setReportPage(paginate(props.report, current));
}
}
const handleNext = () => {
let current = currentPage + 1;
if ((current) <= totPages) {
setCurrentPage(current);
setReportPage(paginate(props.report, current));
}
}
useEffect(() => {
setReportPage(paginate(props.report, 1));
}, []);
return (
<Container>
{props.report.length === 0 && (
<Alert className="mt-5 d-flex justify-content-center" variant="primary">
{"No one was co-present for the past 14 days"}
</Alert>
)}
{props.report.length != 0 && (<>
<ListGroup>
<ListGroup.Item style={{ backgroundColor: "transparent" }} className="d-flex justify-content-between border-0 ">
<div className="col-lg-2 d-flex justify-content-center">
<b>Id</b>
</div>
<div className="col-lg-3 d-flex justify-content-center">
<b>Full name</b>
</div>
<div className="col-lg-3 d-flex justify-content-center">
<b>Email</b>
</div>
<div className="col-lg-3 d-flex justify-content-center">
<b>SSN</b>
</div>
<OverlayTrigger overlay={<Tooltip id="tooltip-disabled">This is the number of time they have had the same lecture.</Tooltip>}>
<div className="col-lg-1 d-flex align-items-center justify-content-center">
<b className=" d-flex align-items-center justify-content-center">{"Interactions "}
<InfoCircle className="mx-1" />
</b>
</div>
</OverlayTrigger>
</ListGroup.Item>
</ListGroup>
<ListGroup className="border rounded border-primary ">
{reportPage.map((student) => (
<ListGroup.Item className="py-2 d-flex justify-content-between" key={student.id}>
<div className="col-lg-2 d-flex align-items-center justify-content-center">
{student.id}
</div>
<div className="col-lg-3 text-center align-items-center ">
{student.name + " " + student.surname}
</div>
<div className="col-lg-3 d-flex align-items-center justify-content-center">
{student.email}
</div>
<div className="col-lg-3 d-flex align-items-center justify-content-center">
{student.ssn}
</div>
{<div className="col-lg-1 d-flex align-items-center justify-content-center">
{student.risk}
</div>}
</ListGroup.Item>
))}
</ListGroup>
<Pagination className="mb-0" >
<Pagination.Prev onClick={() => handlePrev()} />
<Pagination.Item disabled >{currentPage + " of " + totPages}</Pagination.Item>
<Pagination.Next onClick={() => handleNext()} />
</Pagination>
</>)}
</Container>
);
};
export const ContactTracingPage = (props) => {
const [ssn, setSsn] = useState("");
const [student, setStudent] = useState({});
const [generated, setGenerated] = useState(false);
const [report, setReport] = useState([]);
const [error, setError] = useState(false);
const [message, setMessage] = useState("");
const onChangeSsn = (event) => {
setSsn(event.target.value);
}
const handleSearch = (event) => {
event.stopPropagation();
event.preventDefault();
console.log("event.response", event.response)
axios.get(`/tracing/${ssn}/search`)
.then((res) => {
setStudent(...res.data);
setError(false);
setReport([]);
setGenerated(false);
})
.catch((err) => {
setMessage("Wrong SSN");
setError(true);
handleReset();
});
}
const handleGenerate = () => {
axios.get(`/tracing/${student.id}/report`)
.then((res) => {
setReport(res.data);
setGenerated(true);
})
.catch((err) => {
setMessage("There was an error during the tracing");
handleReset();
setError(true);
})
}
const handleReset = () => {
setGenerated(false);
setStudent();
setReport([]);
setSsn("");
}
const generatePDFFile=()=>{
const gap = 10;
let y = 60;
var doc = new jsPDF();
const height = doc.internal.pageSize.getHeight()-10;
doc.setFontSize(18);
doc.text(`Contact tracing report for ${student.id} ${student.surname} ${student.name}`,20,15);
doc.setFontSize(16);
doc.text(`List of the concats in the previous 14 days with the following schema:`,5, 40);
doc.text('ID Name Surname Email SSN Birthday City',5,50);
doc.setFontSize(10);
report.forEach(row =>{
doc.text(`${row.id} ${row.name} ${row.surname} ${row.email} ${row.ssn} ${row.birthday} ${row.city}`,5,y);
y += gap;
if(y>=height)
{
doc.addPage();
y= 20;
}
});
doc.save(`${student.id}_Contact_Tracing_Report_${moment().format('YYYY-MM-DD')}`);
}
const generateCSVFile=()=>{
let csv =["ID, Name, Surname, Email, SSN, Birthday, City"];
report.forEach(row =>{
csv.push(`${row.id}, ${row.name}, ${row.surname}, ${row.email}, ${row.ssn}, ${row.birthday}, ${row.city}`);
});
p5.saveStrings(csv,`${student.id}_Contact_Tracing_Report_${moment().format('YYYY-MM-DD')}`, "csv");
}
const handleDownload = (event) => {
event.stopPropagation();
event.preventDefault();
generateCSVFile();
generatePDFFile();
}
return (
<Container className="col-lg-11">
<h3 className="pt-3">Contact Tracing Report System</h3>
<Row className="d-flex pt-4 align-items-center flex-wrap">
<Form className="col-lg-4 align-content-center" onSubmit={handleSearch}>
<Form.Row>
<Col className="col-lg-8">
<Form.Control placeholder="SSN"
value={ssn}
onChange={(ev) => onChangeSsn(ev)}
/>
</Col>
<Col className="col-lg-3">
<Button type="submit">
Search
</Button>
</Col>
</Form.Row>
</Form>
{generated && report.length !== 0 && (
<>
<Col className="col-lg-6 d-flex align-items-center justify-content-end">
<Alert className="py-2 my-2" variant="warning">
{report.length + " People to call"} </Alert>
</Col>
<Col className="col-lg-2 d-flex justify-content-end">
<Button className="mx-auto" onClick={(event) => handleDownload(event)}>
Download Report
</Button>
</Col>
</>
)}
</Row>
<Row>
<Col className="col-lg-4 my-6 pt-5">
{error && (
<Alert className="d-flex justify-content-center mr-5" variant="warning">
{message}
</Alert>
)}
{student && student.id && (
<Container className="border rounded border-primary justify-content-center my-6 bg-white py-3">
<Row>
<Col className="col-lg-4 justify-content-start"><h6><b>Full Name</b></h6></Col>
<Col className="justify-content-start"><h6 >{" " + student.name + " " + student.surname}</h6></Col>
</Row>
<Row>
<Col className="col-lg-4 justify-content-start"><h6> <b>Number Id</b></h6></Col>
<Col className="justify-content-start"><h6>{" " + student.id}</h6></Col>
</Row>
<Row>
<Col className="col-lg-4 justify-content-start"><h6><b>Email</b></h6></Col>
<Col className="justify-content-start"><h6>{" " + student.email}</h6></Col>
</Row>
<Row>
<Col className="col-lg-4 justify-content-start"><h6><b>Born</b></h6></Col>
<Col className="justify-content-start"><h6>{moment(student.birthday).format("D MMMM YYYY") + ", " + student.city}</h6></Col>
</Row>
<Row>
<Col className="col-lg-4 justify-content-start"><h6><b>SSN</b></h6></Col>
<Col className="justify-content-start"><h6>{" " + student.ssn}</h6></Col>
</Row>
<Row className="d-flex mt-2 align-items-center flex-wrap">
<Col className="col-lg-6 d-flex align-items-center justify-content-end">
<Button className="" onClick={() => handleGenerate()}>
Tracing
</Button>
</Col>
<Col className="col-lg-6 align-items-center justify-content-start">
<Button className="" onClick={() => handleReset()}>
Reset
</Button>
</Col>
</Row>
</Container>)}
</Col >
{generated && (
<>
<Col className="col-lg-8 ">
<FullReportView report={report} />
</Col>
</>
)}
{!generated && (
<>
<Col className="col-lg-5 d-flex justify-content-center ">
<Image className="mx-auto" src="/imgs/contact_tracing.png" rounded />
</Col>
<Col className="col-lg-3 my-auto">
<p className="font-italic" style={{ fontSize: "22px", lineHeight: "180%" }}>
Contact tracing is a system that selects students and professors
who may have come into contact with the positive person in the past 14 days.
The calculation is made considering the co-presence in the lecture.
</p>
</Col>
</>
)}
</Row>
</Container>
);
};
|
'use strict';
const { DataTypes, Model } = require('sequelize');
class Tax extends Model {
TAX_PERCENT = 'percent';
TAX_VALUE = 'value'
}
module.exports.class = Tax;
module.exports.columns = {
id: {
type: DataTypes.INTEGER,
allowNull: false,
autoIncrement: true,
primaryKey: true
},
name: {
type: DataTypes.STRING,
allowNull: false
},
value: {
type: DataTypes.FLOAT,
allowNull: true,
defaultValue: 0
},
value_type: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: 'value'
}
}
module.exports.config = {
hasTimestamps: false,
tableName: 'taxes'
}
|
import LoginForm from "./LoginForm"
import i18n from "../../../i18n"
import router from "../../../router"
import store from "../../../store"
const decorator = () => `
<v-container fluid>
<v-row>
<v-col cols="12" md="6" offset-md="3">
<story/>
</v-col>
</v-row>
</v-container>`
export default {
title: "PageComponents/Login",
decorators: [decorator]
};
export const loginForm = () => ({
components: {LoginForm},
template: ' <login-form></login-form>',
i18n, router, store
})
|
import React,{useState} from 'react';
import axios from 'axios';
import { Grid, Typography,
TextField,InputAdornment,Button, Box,Divider } from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles'
import { AccountCircle, Email, Message,Subject, Send,Home,Call } from '@material-ui/icons';
const useStyle = makeStyles((theme)=>({
conatactContainer:{
marginTop:'50px',
Minheight:'100vh',
},
formBox:{
padding:'10px',
[theme.breakpoints.up('md')]:{
padding:" 10px 150px",
},
},
textField: {
marginLeft: theme.spacing(1),
marginRight: theme.spacing(1),
[theme.breakpoints.up('md')]:{
width:"50%",
},
width:"40px",
},
sendButton: {
display:'flex',
justifyContent:'center',
margin: theme.spacing(1),
},
addresBox:{
border:'1px solid black',
padding:'1%',
},
contactHeading:{
fontWeight:'900',
},
contactInfo:{
display:'flex',
padding:"10%",
},
icons:{
color:'#08d665',
paddingRight:'10px'
}
}))
export default function Contact(){
const classes = useStyle();
const [error,setError] = useState(
{
nameError:'',
emailError:'',
subjectError:'',
});
const [isvalid,setIsvalid] = useState(false);
const [state,setState] = useState(
{
fullname:'',
email:'',
subject:'',
messege:''
});
/* const handleSubmit = () =>{
if(!validate()){
axios.post('http://localhost:5000/',{...state}).then((res) =>
{
console.log(res);
console.log(res.data);
}
)
}
};
/*function validate(){
if (!state.fullname){
setError(...error,nameError:'*Name required');
setIsvalid(true)
}
if (!state.subject){
setError(...error,subjectError:'*subject required');
setIsvalid(true)
}
else{
setError(...error,emailError:'*email required')
setIsvalid(false)
}
if (!state.email){
setError("**required");
setIsvalid(true)
}
if(state.email){
var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+ \.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
if (!pattern.test(state.email)) {
setError("Please enter valid email address.");
setIsvalid(true);
}
}
}*/
return(
<div className={classes.conatactContainer}>
<Grid container>
<Grid item xs={12} sm={12}>
<Typography variant="h3" style={{textAlign:'center',marginTop:'50px'}}>Contact Me</Typography>
<Divider variant='middle' style={{backgroundColor:'green'}} />
</Grid>
<Grid item xs={12} sm={7} className={classes.formBox}>
<TextField id="standard-full-width" label='Full name'
error={isvalid} helperText={error.name}
onChange={(event)=>{setState({...state,fullname:event.target.value})}}
fullWidth margin="normal" InputProps={{
startAdornment:(
<InputAdornment position='start' >
<AccountCircle />
</InputAdornment>
),
shrink:true,
}} variant="filled" />
<TextField id="standard-full-width"
error={isvalid} id="standard-error-helper-text"
helperText={error.emailError}
onChange={(event)=>{setState({...state,email:event.target.value})}}
label='Email Id' fullWidth margin="normal" InputProps={{
startAdornment:(
<InputAdornment position='start' >
<Email/>
</InputAdornment>
),
shrink:true,
}} variant="filled" />
<TextField id="standard-full-width" label='Subject' error={isvalid}
helperText={error.subjectError}
onChange={(event)=>{setState({...state,subject:event.target.value})}}
fullWidth margin="normal" InputProps={{
startAdornment:(
<InputAdornment position='start'>
<Subject />
</InputAdornment>
),
shrink:true,
}} variant="filled" />
<TextField id="standard-full-width" label='Messege'
onChange={(event)=>{setState({...state,messege:event.target.value})}}
fullWidth margin="normal"
multiline
rows={4} InputProps={{
startAdornment:(
<InputAdornment position='start'>
<Message style={{position:'relative',bottom:40}}/>
</InputAdornment>
),
shrink:true,
}} variant="filled" />
<Box component='div' className={classes.sendButton}>
<Button variant="contained" endIcon={<Send/>}
style={{
color:'white',
backgroundColor:'#08d665',
}} >
Send Messege
</Button>
</Box>
</Grid>
{
//
//
//
//
}
<Grid item xs={12} sm={4} style={{padding:'30px'}}>
<Box component="div" className={classes.addresBox}>
<Box className={classes.contactInfo}>
<Home className={classes.icons} fontSize='large' />
<Box>
<Typography className={classes.contactHeading}>HOME</Typography>
<br/>
<Typography >1B,pera street,<br/>papanaickenpalayam,<br/>Coimbatore - 641037</Typography>
</Box>
</Box>
<Box className={classes.contactInfo}>
<Call className={classes.icons} fontSize='large' />
<Box>
<Typography className={classes.contactHeading}>Phone</Typography><br/>
<Typography >+91 9659654334</Typography>
</Box>
</Box>
<Box className={classes.contactInfo}>
<Email className={classes.icons} fontSize='large' />
<Box>
<Typography className={classes.contactHeading}>Email</Typography><br/>
<Typography >nandhakumar270@gmail.com</Typography>
</Box>
</Box>
</Box>
</Grid>
</Grid>
</div>
)
}
|
import { createSlice } from '@reduxjs/toolkit';
import { addItemToCart, loadCart, removeCartItem, updateItemQty } from './cartReducers';
const initialCartState = {
cartItems: [], cartUsername: "",
isCartLoading: false, cartError: "",
}
const cartSlice = createSlice({
name: "cart",
initialState: initialCartState,
reducers: {
resetCart: state => {
state = initialCartState
return state
},
setCartUsername: (state, action) => {
state.cartUsername = action.payload
}
},
extraReducers: {
// Add items to cart
[addItemToCart.pending]: (state, action) => {
state.cartError = ""
state.isCartLoading = true
},
[addItemToCart.fulfilled]: (state, action) => {
state.isCartLoading = false
const index = state.cartItems.findIndex(bookQty => JSON.stringify(bookQty.book) === JSON.stringify(action.payload.book))
index >= 0 ? state.cartItems[index]["quantity"] += action.payload.quantity : state.cartItems.push(action.payload)
},
[addItemToCart.rejected]: (state, action) => {
state.isCartLoading = false
state.cartError = action.payload.message
},
// Load cart
[loadCart.pending]: (state, action) => {
state.isCartLoading = true
state.cartError = ""
},
[loadCart.fulfilled]: (state, action) => {
state.isCartLoading = false
state.cartItems = action.payload.items
state.cartUsername = action.payload.cartUsername
},
[loadCart.rejected]: (state, action) => {
state.isCartLoading = false
state.cartError = action.payload.message
},
// Remove Cart Item
[removeCartItem.pending]: (state, action) => {
state.isCartLoading = true
state.cartError = ""
},
[removeCartItem.fulfilled]: (state, action) => {
state.isCartLoading = false
state.cartItems.splice(action.payload, 1)
},
[removeCartItem.rejected]: (state, action) => {
state.isCartLoading = false
state.cartError = action.payload.message
},
// Update item quantity
[updateItemQty.pending]: (state, action) => {
state.isCartLoading = true
state.cartError = ""
},
[updateItemQty.fulfilled]: (state, action) => {
state.isCartLoading = false
state.cartItems
.find(bookQty =>
JSON.stringify(bookQty.book) === JSON.stringify(action.payload.book)
)["quantity"] = action.payload.quantity
},
[updateItemQty.rejected]: (state, action) => {
state.isCartLoading = false
state.cartError = action.payload.message
},
}
})
export const { resetCart, setCartUsername } = cartSlice.actions
export default cartSlice.reducer
|
import firebase from 'firebase/app'
import 'firebase/auth'
import 'firebase/database'
const firebaseConfig = {
apiKey: process.env.VUE_APP_API_KEY,
authDomain: process.env.VUE_APP_AUTH_DOMAIN,
projectId: process.env.VUE_APP_PROJECT_ID,
storageBucket: process.env.VUE_APP_STORAGE_BUCKET,
databaseURL: process.env.VUE_APP_DATABASE_URL,
messagingSenderId: process.env.VUE_APP_MESSAGING_SENDER_ID,
appId: process.env.VUE_APP_APP_ID
}
firebase.initializeApp(firebaseConfig)
export default firebase
|
import React from 'react';
import Link from 'gatsby-link';
const style = {
display: 'inline',
float: 'right',
textDecoration: 'none',
padding: 0,
margin: 0,
marginRight: 2,
color: '#aaa',
fontFamily: 'arial',
fontWeight: 400
}
const Navigation = () => {
return (
<div style={style}>
<a style={style} href="mailto:clark@clarkcarter.com"><h1 style={style}>Contact</h1></a>
</div>
)
}
export default Navigation;
|
import settable from '../utils/settable'
import { Instrument } from '../lib/instruments'
const DEFAULTS = {
instrument: new Instrument(),
duration : '',
timeline : [[]],
}
export default class Lesson extends settable({ DEFAULTS, after: 'states' }) {
_instrument
_duration
_timeline
_states
constructor({ instrument, duration, timeline } = {}) {
super({ instrument, duration, timeline })
}
*iterator() {
yield* this._states.map(({ layers }) => ({ layers: layers.map(({ strings }) => ({ strings })) }))
}
[Symbol.iterator]() {
return this.iterator()
}
states() {
this._states = this._timeline
.map(
layers => ({
layers: layers.map(
layer => {
const { palette, scale, instrumentMasks: masks} = layer
const cb = ({ note, inside }) => {
note = scale.get(layer.root, note)
return {
empty : !inside || !note,
style : palette.get(inside ? note : null).toJSON(),
mask : layer.boxMask,
duration: this._duration
}
}
const strings = this._instrument.strings({ masks, cb })
return { ...layer, strings }
}
)
})
)
Array
.from(this._boxIterator())
.forEach(({ stateIndex, layerIndex, stringIndex, boxIndex, box }) => {
const min = 0
const max = this._states.length - 1
const ind = i => Math.max(Math.min(i, max), min)
const get = i => this
._states[ind(i)]
.layers[layerIndex]
.strings[stringIndex]
.boxes[boxIndex]
const radius = box.style.radius
const { empty: prevEmpty, style: { radius: prevRadius } } = get(stateIndex - 1)
const { empty: nextEmpty, style: { radius: nextRadius } } = get(stateIndex + 1)
const enter = prevEmpty ? radius : Math.min(radius, prevRadius)
const leave = nextEmpty ? radius : Math.min(radius, nextRadius)
box.mask = {
shape: box.mask.shape,
angle: box.mask.angle,
enter: box.mask.enter(enter),
leave: box.mask.leave(leave),
}
})
}
*_boxIterator() {
yield* this._states.map(
({ layers }, stateIndex) =>
layers.map(
({ strings }, layerIndex) =>
strings.map(
({ boxes }, stringIndex) =>
boxes.map(
(box, boxIndex) => ({
stateIndex,
layerIndex,
stringIndex,
boxIndex,
box
})
).flat()
).flat()
).flat()
).flat()
}
}
|
import { createElement } from 'react';
import { render } from 'react-dom'
import App from './App';
import './index.css';
const MOUNT_NODE = document.getElementById('root');
(function() {
render(createElement(App), MOUNT_NODE);
})();
|
var Enemy_Car = function(game, targetId, type, speed) {
this.entityType = "Enemy_Car";
this.id = targetId;
this.destroyCountDown = 0;
this.stopSend = false;
var targetX = 0;
var targetY = 0;
switch( type ) {
case 0: {
targetX = 0;
targetY = game.rnd.integerInRange(0, game.myScreenHeight);
}
break;
case 1: {
targetX = game.rnd.integerInRange(0, game.myScreenWidth);
targetY = 0;
}
break;
case 2: {
targetX = game.myScreenWidth;
targetY = game.rnd.integerInRange(0, game.myScreenHeight);
}
break;
case 3: {
targetX = game.rnd.integerInRange(0, game.myScreenWidth);
targetY = game.myScreenHeight;
}
break;
}
Phaser.Sprite.call( this, game, targetX, targetY, 'monster_car' );
this.anchor.setTo( 0.5, 0.5 );
this.animations.add('walk', [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27 ], 20, true);
this.play('walk');
this.revive();
this.game.physics.enable(this, Phaser.Physics.ARCADE);
// Define constants that affect motion
this.SPEED = speed; // missile speed pixels/second
this.TURN_RATE = 5; // turn rate in degrees/frame
// this.WOBBLE_LIMIT = 15; // degrees
// this.WOBBLE_SPEED = 250; // milliseconds
// this.SMOKE_LIFETIME = 3000; // milliseconds
// this.AVOID_DISTANCE = 30; // pixels
if ( this.game.account_id != 1 ) {
return;
}
switch( type ) {
case 0: {
this.body.velocity.x = speed;
}
break;
case 1: {
this.body.velocity.y = speed;
}
break;
case 2: {
this.body.velocity.x = -speed;
}
break;
case 3: {
this.body.velocity.y = -speed;
}
break;
}
// if ( x <= 0 ) {
// this.body.velocity.x = 100;
// }
// if ( y <= 0 ) {
// }
};
Enemy_Car.prototype = Object.create(Phaser.Sprite.prototype);
Enemy_Car.prototype.constructor = Enemy_Car;
Enemy_Car.prototype.update = function() {
if (this.socket)
{
this.updateMonsterPosition(this.socket);
}
if ( this.destroyCountDown > 0 ) {
var dt = this.game.time.now - this.lastTime;
this.lastTime = this.game.time.now;
this.destroyCountDown -= dt;
// console.log( "car count down: " + this.destroyCountDown );
if ( this.destroyCountDown <= 0 ) {
// console.log( "car destroy" );
this.destroy();
}
return;
}
};
Enemy_Car.prototype.socket = null;
Enemy_Car.prototype.updateMonsterPosition = function updateMonsterPosition()
{
var json = {"id":this.id, "posX":this.x, "posY":this.y, "alive":this.alive};
if ( this.socket ) {
this.socket.emit('update_monster', json);
}
};
Enemy_Car.prototype.die = function() {
this.kill();
this.destroyCountDown = 1000;
this.lastTime = this.game.time.now;
// this.destroy();
if (this.socket)
{
this.updateMonsterPosition(this.socket);
}
};
|
var slider = new Swipe(document.getElementById('slider'), {
callback: function(e, pos) {
var i = bullets.length;
while (i--) {
bullets[i].className = ' ';
}
bullets[pos].className = 'on';
}
}),
bullets = document.getElementById('position').getElementsByTagName('em');
|
export { default } from './post-excerpt';
|
const jwt = require('jsonwebtoken');
const SECRET = "a06f1c347f2f36e47006";
module.exports = (req, res, next) => {
try {
const verify = jwt.verify(req.headers['authorization'], SECRET)
next(verify.id);
} catch (error) { return res.status(401).json({ message: false, message: "authorisation failed" }) }
};
|
const { ga, requirejs } = window;
ga('create', 'UA-59233605-5', 'auto');
// https://developers.google.com/analytics/devguides/collection/analyticsjs/debugging
let url = 'https://www.google-analytics.com/analytics.js';
if (
process.env.NODE_ENV === 'development' ||
location.hostname === 'localhost'
) {
url = url.replace('analytics.js', 'analytics_debug.js');
ga('set', 'sendHitTask', null);
}
ga('set', {
title: 'Sudoku',
page: '/sudoku/',
});
ga('send', 'pageview');
requirejs([url]);
/**
* Tracks event with analytics.
* https://developers.google.com/analytics/devguides/collection/analyticsjs/events
*
* @param {String} eventCategory
* @param {String} eventAction
* @param {String} [eventLabel]
* @param {Number} [eventValue]
*/
export const trackEvent = (...args) => {
window.ga.apply(null, ['send', 'event', ...args]);
};
|
import React, { Component } from 'react';
// import { connect } from 'react-redux'
import { View, Text, StatusBar, TouchableOpacity, Image, ScrollView, StyleSheet, WebView, Button, Platform, Modal } from 'react-native';
import {FeedContainer, FeedDetail, Bamboo} from '../components/Feed'
import { StackNavigator, DrawerNavigator, TabNavigator} from 'react-navigation';
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
import CustomDrawer from '../components/CustomDrawer'
import { Network } from '../components/Network'
import { Profile } from '../components/Profile'
import { Register, Login, RegisterSecond } from '../components/Join'
import WebViews from '../components/WebViews'
import Contact from '../components/Contact'
import CustomTabs from './CustomTabs'
const HeaderColor = {
headerStyle: {
backgroundColor: '#30333C'
},
headerTintColor: 'white'
}
const HeaderOptios = (navigation) => ({
headerLeft: <MaterialIcons
name="menu"
size={30}
onPress={() => navigation.navigate('DrawerOpen')}
style={{
color: 'white',
marginLeft: Platform.OS === 'ios' ? 10 : 0,
}}
/>,
...HeaderColor
})
const NetworkStack = StackNavigator({
Network: {
screen: Network,
navigationOptions: ({navigation}) => ({
headerTitle: '네트워크',
...HeaderOptios(navigation)
})
},
NetworkDetail : {
screen: Profile,
navigationOptions: ({navigation}) => ({
headerTitle: `${navigation.state.params.name} 프로필`,
headerLeft: <Button title='뒤로' color='#fff' onPress={() => navigation.goBack()} />,
...HeaderColor
})
},
NetworkFeedDetail : {
screen: FeedDetail,
navigationOptions: ({navigation}) => ({
headerTitle: `${navigation.state.params.name} 프로필`,
headerLeft: <Button title='뒤로' color='#fff' onPress={() => navigation.goBack()} />,
...HeaderColor
})
}
}, { initialRouteName: 'Network'});
const BambooStack = StackNavigator({
Bamboo: {
screen: Bamboo,
navigationOptions: ({navigation}) => ({
headerTitle: '대나무숲',
...HeaderOptios(navigation)
})
},
BambooDetail : {
screen: FeedDetail,
navigationOptions: ({navigation}) => ({
headerTitle: '상세보기',
headerLeft: <Button title='뒤로' color='#fff' onPress={() => navigation.goBack()} />,
...HeaderColor
})
}
}, { initialRouteName: 'Bamboo'})
const Stack = {
Contact: {
screen: Contact,
navigationOptions: ({navigation}) => ({
headerTitle: '문의하기',
...HeaderOptios(navigation)
})
},
};
const RegisterStack = {
Register: {
screen: Register,
},
RegisterSecond: {
screen: RegisterSecond,
},
}
const DrawerRoutes = {
FeedViewStack: {
// name: 'FeedViewStack',
screen: CustomTabs
},
AboutStack: {
// name: 'AboutStack',
screen: ({navigation}) => <WebViews {...navigation} forUrl={'http://blog.naver.com/enactusblog/220208208280'}/>
},
NetworkStack: {
// name: 'NetworkStack',
screen: NetworkStack,
},
BambooStack: { //여기 이름이 router이기 때문에 이름이 중복되면 계속 stack이 쌓여서 이상해짐
// name: 'BambooStack',
screen: BambooStack,
},
ArchiveStack: {
// name: 'ArchiveStack',
screen: ({navigation}) => <WebViews {...navigation} forUrl={'http://enactuskorea.org/goarchive'}/>
},
ContactStack: {
// name: 'ContactStack',
screen: StackNavigator(Stack, { initialRouteName: 'Contact' }),
},
Login: {
// path: '/login',
screen: Login,
},
RegisterStack: {
screen: StackNavigator(RegisterStack, { initialRouteName: 'Register' }),
},
Facebook: {
// name: 'Facebook',
screen: ({navigation}) => <WebViews {...navigation} forUrl={'https://www.facebook.com/enactuskoreapage'}/>
},
Youtube: {
// name: 'Youtube',
screen: ({navigation}) => <WebViews {...navigation} forUrl={'https://www.youtube.com/user/EnactusKorea'}/>
},
Flickr: {
// name: 'Flickr',
screen: ({navigation}) => <WebViews {...navigation} forUrl={'https://www.flickr.com/photos/enactuskorea'}/>
},
FeedNotification : {
screen: ({navigation}) => <WebViews {...navigation} />
}
};
const RootNavigator = StackNavigator({
Drawer: {
name: 'Drawer',
screen: DrawerNavigator(
DrawerRoutes,
{
contentComponent: (props) => (<CustomDrawer navigation={props.navigation} routes={DrawerRoutes}/>)
}
),
},
...Stack,
},
{
headerMode: 'none',
}
);
const styles = StyleSheet.create({
container: {
marginTop: Platform.OS === 'ios' ? 20 : 0,
},
});
export default RootNavigator
|
/*
Database CRUD logic for Purchase table
*/
const { QueryTypes } = require("sequelize");
const db = require("../models");
const Customer = db.customer;
const Product = db.product;
const Purchase = db.purchase;
const sequelize = db.sequelize;
const CustomError = require("../utils/custom-error");
const {validateEmail} = require("../utils/validate");
module.exports = {
save: async (customer, product, purchase) => {
// double check validation
if(!product.id || product.id === "") throw new CustomError(400, `Error: Product ID cannot be empty for creation: ${product.name}`);
if(!validateEmail(customer.email)) throw new CustomError(400, `Error: Invalid email format for customer: ${customer.firstName.concat(' ', customer.lastName)}`);
const [existingCustomer, customerCreated] = await Customer.findOrCreate({
where: {email: customer.email},
defaults: customer
});
if(!customerCreated) purchase.customerId = existingCustomer.id;
const [existingProduct, productCreated] = await Product.findOrCreate({
where: {id: product.id},
defaults: product
});
if(!productCreated) purchase.productId = existingProduct.id;
await Purchase.create(purchase);
},
getAllPurchases: async(page) => {
// assume each page contains 10 records
const limit = 10, offset = page * limit - limit;
let query = `SELECT customer.id customer_id, CONCAT(first_name, ' ', last_name) customer_name, email customer_email, product.id product_id, product.name product_name, quantity
FROM purchase INNER JOIN customer on purchase.customer_id=customer.id INNER JOIN product ON purchase.product_id=product.id
ORDER BY quantity DESC `;
query = page ? query + `LIMIT ? OFFSET ?` : query;
return await sequelize.query(query, {replacements: [limit, offset], type: QueryTypes.SELECT});
},
getCustomerPurchase: async(customerId) => {
return await sequelize.query(
`SELECT customer.id customer_id, CONCAT(first_name, ' ', last_name) customer_name, email customer_email, product.id product_id, product.name product_name, quantity
FROM purchase INNER JOIN customer ON purchase.customer_id=customer.id INNER JOIN product ON purchase.product_id=product.id
WHERE customer.id=? ORDER BY quantity DESC`
, {replacements: [customerId], type: QueryTypes.SELECT});
},
getHighestSalesProducts: async () => {
return await sequelize.query(
`SELECT product.id product_id, product.name product_name, SUM(quantity) quantity
FROM purchase INNER JOIN product ON purchase.product_id = product.id GROUP BY product.id ORDER BY quantity DESC`
, {type: QueryTypes.SELECT});
},
getRegularCustomers: async() => {
return await sequelize.query(
`SELECT customer.id customer_id, CONCAT(first_name, ' ', last_name) customer_name, email customer_email, COUNT(*) count
FROM purchase INNER JOIN customer ON purchase.customer_id=customer.id GROUP BY customer.id ORDER BY count DESC, customer_name`,
{type: QueryTypes.SELECT}
)
}
}
|
'use strict';
const oss = require('ali-oss').Wrapper;
module.exports = (event, context, callback) => {
const parsedEvent = JSON.parse(event);
const ossEvent = parsedEvent.events[0];
// Required by OSS sdk: OSS region is prefixed with "oss-", e.g. "oss-cn-shanghai"
const ossRegion = `oss-${ossEvent.region}`;
// Create oss client.
const client = new oss({
region: ossRegion,
bucket: ossEvent.oss.bucket.name,
// Credentials can be retrieved from context
accessKeyId: context.credentials.accessKeyId,
accessKeySecret: context.credentials.accessKeySecret,
stsToken: context.credentials.securityToken
});
const objKey = ossEvent.oss.object.key;
console.log('Getting object: ', objKey);
client.get(objKey).then(function(val) {
const newKey = objKey.replace('source/', 'processed/');
return client.put(newKey, val.content).then(function (val) {
console.log('Put object:', val);
callback(null, val);
}).catch(function (err) {
console.error('Failed to put object: %j', err);
callback(err);
});
}).catch(function (err) {
console.error('Failed to get object: %j', err);
callback(err);
});
};
|
import React from 'react'
import ReactDOM from 'react-dom'
import { Parallax, ParallaxLayer } from 'react-spring/renderprops-addons'
const url = (name, wrap = false) => `${wrap ? 'url(' : ''}https://awv3node-homepage.surge.sh/build/assets/${name}.svg${wrap ? ')' : ''}`
const Pink = ({ children }) => <span style={{ color: '#FF6AC1' }}>{children}</span>
const Yellow = ({ children }) => <span style={{ color: '#EFF59B' }}>{children}</span>
const Lightblue = ({ children }) => <span style={{ color: '#9AEDFE' }}>{children}</span>
const Green = ({ children }) => <span style={{ color: '#57EE89' }}>{children}</span>
const Blue = ({ children }) => <span style={{ color: '#57C7FF' }}>{children}</span>
const Gray = ({ children }) => <span style={{ color: '#909090' }}>{children}</span>
export default class App extends React.Component {
render() {
return (
<Parallax ref={ref => (this.parallax = ref)} pages={3}>
<ParallaxLayer offset={1} speed={1} style={{ backgroundColor: '#805E73' }} />
<ParallaxLayer offset={2} speed={1} style={{ backgroundColor: '#87BCDE' }} />
<ParallaxLayer offset={0} speed={0} factor={3} style={{ backgroundImage: url('stars', true), backgroundSize: 'cover' }} />
<ParallaxLayer offset={1.3} speed={-0.3} style={{ pointerEvents: 'none' }}>
<img src={url('satellite4')} style={{ width: '15%', marginLeft: '70%' }} />
</ParallaxLayer>
<ParallaxLayer offset={1} speed={0.8} style={{ opacity: 0.1 }}>
<img src={url('cloud')} style={{ display: 'block', width: '20%', marginLeft: '55%' }} />
<img src={url('cloud')} style={{ display: 'block', width: '10%', marginLeft: '15%' }} />
</ParallaxLayer>
<ParallaxLayer offset={1.75} speed={0.5} style={{ opacity: 0.1 }}>
<img src={url('cloud')} style={{ display: 'block', width: '20%', marginLeft: '70%' }} />
<img src={url('cloud')} style={{ display: 'block', width: '20%', marginLeft: '40%' }} />
</ParallaxLayer>
<ParallaxLayer offset={1} speed={0.2} style={{ opacity: 0.2 }}>
<img src={url('cloud')} style={{ display: 'block', width: '10%', marginLeft: '10%' }} />
<img src={url('cloud')} style={{ display: 'block', width: '20%', marginLeft: '75%' }} />
</ParallaxLayer>
<ParallaxLayer offset={1.6} speed={-0.1} style={{ opacity: 0.4 }}>
<img src={url('cloud')} style={{ display: 'block', width: '20%', marginLeft: '60%' }} />
<img src={url('cloud')} style={{ display: 'block', width: '25%', marginLeft: '30%' }} />
<img src={url('cloud')} style={{ display: 'block', width: '10%', marginLeft: '80%' }} />
</ParallaxLayer>
<ParallaxLayer offset={2.6} speed={0.4} style={{ opacity: 0.6 }}>
<img src={url('cloud')} style={{ display: 'block', width: '20%', marginLeft: '5%' }} />
<img src={url('cloud')} style={{ display: 'block', width: '15%', marginLeft: '75%' }} />
</ParallaxLayer>
<ParallaxLayer offset={2.5} speed={-0.4} style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', pointerEvents: 'none' }}>
<img src={url('earth')} style={{ width: '60%' }} />
</ParallaxLayer>
<ParallaxLayer
offset={0}
speed={0.1}
style={{ display: 'flex', justifyContent: 'center' }}
>
<h2>Welcome to BoiBajar</h2>
</ParallaxLayer>
<ParallaxLayer
offset={0.8}
speed={0.6}
style={{ display: 'flex', justifyContent: 'center' }}
>
<h2>Earth Day Special!</h2>
</ParallaxLayer>
<ParallaxLayer
offset={0}
speed={0.1}
onClick={() => this.parallax.scrollTo(1)}
style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
<img src={'https://s3.amazonaws.com/peoplepng/wp-content/uploads/2018/12/10010630/Earth-Day-Free-PNG-Image.png'} style={{ width: '50%' }} />
</ParallaxLayer>
<ParallaxLayer
offset={1}
speed={0.1}
onClick={() => this.parallax.scrollTo(2)}
style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
<img src={'http://t1.gstatic.com/images?q=tbn:ANd9GcQ548UmtfvJgU22TQr8xrb67l0Mw_OPFstw5XpfUHDC7LBuCIVV'} style={{ width: '40%' }} />
</ParallaxLayer>
<ParallaxLayer
offset={2}
speed={-0}
style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}
onClick={() => this.parallax.scrollTo(0)}>
<img src={'https://images-na.ssl-images-amazon.com/images/I/81HiLi7irkL.jpg'} style={{ width: '40%' }} />
</ParallaxLayer>
</Parallax>
)
}
}
ReactDOM.render(<App />, document.getElementById('root'))
|
ig.module(
'game.entities.player'
).requires(
'impact.entity'
).defines(function(){
EntityPlayer = ig.Entity.extend({
size: {x: 32, y: 48},
direction: 1,
type: ig.Entity.TYPE.A,
nettimer: 10,
movementspeed: 100,
name: "player",
gamename: 'defaultName',
destinationx:99999999,
destinationy:99999999,
messageboxtimer: 200,
messagebox:'',
speed: 100,
checkAgainst: ig.Entity.TYPE.NONE,
collides: ig.Entity.COLLIDES.PASSIVE,
animSheet: new ig.AnimationSheet( 'media/soldier.png', 32, 48 ),
init: function( x, y, settings ) {
this.parent( x, y, settings );
// Add the animations
this.addAnim( 'up', .21, [9,10,11] );
this.addAnim( 'down', .21, [0,1,2] );
this.addAnim( 'left', .21, [3,4,5] );
this.addAnim( 'right', .21, [6,7,8] );
this.addAnim( 'idleup', 0.1, [10] );
this.addAnim( 'idledown', 0.1, [1] );
this.addAnim( 'idleleft', 0.1, [4] );
this.addAnim( 'idleright', 0.1, [7] );
this.currentAnim = this.anims.idledown;
ig.game.player = this;
var namerand = Math.floor(Math.random()*999);
var playername = "player" + namerand;
// Multiplayer Start
if (!ig.global.wm) {
this.gamename = playername;
socket.emit('initializeplayer', this.gamename,this.pos.x,this.pos.y);
}
},
update: function() {
// Player Movement
// Mouse Angle
var mx = ig.input.mouse.x + ig.game.screen.x;
var my = ig.input.mouse.y + ig.game.screen.y;
var mouseAngle = Math.atan2(
my - (this.pos.y + this.size.y/2),
mx - (this.pos.x + this.size.x/2)
);
this.mouseangle = mouseAngle;
// Mouse Input
if (ig.input.state('attack') && !ig.input.state('minorbull')){
this.nettimer = this.nettimer - 1;
this.destinationx = ig.input.mouse.x + ig.game.screen.x;
this.destinationy = ig.input.mouse.y + ig.game.screen.y;
socket.emit('moveplayer',this.destinationx,this.destinationy,this.gamename);
}
if (this.destinationx < 999999999 && this.destinationy < 99999999){
// Character is 48 high and 32 wide, which take half to 24 and 16
this.distancetotargetx = this.destinationx - this.pos.x - 16;
this.distancetotargety = this.destinationy - this.pos.y - 48;
if (Math.abs(this.distancetotargetx) > 1 || Math.abs(this.distancetotargety) > 1){
if (Math.abs(this.distancetotargetx) > Math.abs(this.distancetotargety)){
// Move Right
if (this.distancetotargetx > 1){
this.vel.x = this.movementspeed;
this.xydivision = this.distancetotargety / this.distancetotargetx;
this.vel.y = this.xydivision * this.movementspeed;
this.currentAnim = this.anims.right;
this.formerpressed = 'right';
// Move Left
} else {
this.vel.x = -this.movementspeed;
this.xydivision = this.distancetotargety / Math.abs(this.distancetotargetx);
this.vel.y = this.xydivision * this.movementspeed;
this.currentAnim = this.anims.left;
this.formerpressed = 'left';
}
// einde Math.ads(this.distancetotarget.x) > Math.abs(this.distancetotarget.y)
} else {
// Move Down
if (this.distancetotargety > 1){
this.vel.y = this.movementspeed;
this.xydivision = this.distancetotargetx / this.distancetotargety;
this.vel.x = this.xydivision * this.movementspeed;
this.currentAnim = this.anims.down;
this.formerpressed = 'down';
} else { // Move Up
this.vel.y = -this.movementspeed;
this.xydivision = this.distancetotargetx / Math.abs(this.distancetotargety);
this.vel.x = this.xydivision * this.movementspeed;
this.currentAnim = this.anims.up;
this.formerpressed = 'up';
}
}
//einde this.distancetotargetx > 0 || this.distancetotargety > 0
} else {
this.vel.x = 0;
this.vel.y = 0;
this.destinationx = 99999999;
this.destinationy = 99999999;
if (this.formerpressed == 'up') {
this.currentAnim = this.anims.idleup;
} else if (this.formerpressed == 'right') {
this.currentAnim = this.anims.idleright;
} else if (this.formerpressed == 'down') {
this.currentAnim = this.anims.idledown;
} else if (this.formerpressed == 'left') {
this.currentAnim = this.anims.idleleft;
}
}
}
// End Mouse Movement
// ATTACK
if (ig.input.pressed('attack') && ig.input.state('minorbull')){
socket.emit('spawnbullet',1,this.gamename,this.mouseangle);
ig.game.spawnEntity(EntityBullet,this.pos.x + 30, this.pos.y + 30, {flip:this.flip,bullettype:1});
}
if (this.nettime < 1){
socket.emit('resyncplayer',this.pos.x,this.pos.y,this.gamename);
this.nettimer = 10;
}
this.parent();
}
});
// Enemy Players
EntityOtherplayer = ig.Entity.extend({
size: {x: 32, y: 48},
type: ig.Entity.TYPE.B,
movementspeed: 100,
name: "otherplayer",
gamename: "",
animation: 1,
destinationx: 99999999,
destinationy: 99999999,
//checkAgainst: ig.Entity.TYPE.B,
collides: ig.Entity.COLLIDES.PASSIVE,
direction: 0,
animSheet: new ig.AnimationSheet( 'media/soldier.png', 32, 48 ),
init: function(x, y, settings) {
this.parent(x, y, settings);
this.health = 100;
// Add the animations
this.addAnim( 'up', .21, [9,10,11] );
this.addAnim( 'down', .21, [0,1,2] );
this.addAnim( 'left', .21, [3,4,5] );
this.addAnim( 'right', .21, [6,7,8] );
this.addAnim( 'idleup', 0.1, [10] );
this.addAnim( 'idledown', 0.1, [1] );
this.addAnim( 'idleleft', 0.1, [4] );
this.addAnim( 'idleright', 0.1, [7] );
this.currentAnim = this.anims.idledown;
},
update: function() {
// Mouse Input
if (this.destinationx < 999999999 && this.destinationy < 99999999){
// Character is 48 high and 32 wide, which take half to 24 and 16
this.distancetotargetx = this.destinationx - this.pos.x - 16;
this.distancetotargety = this.destinationy - this.pos.y - 48;
if (Math.abs(this.distancetotargetx) > 1 || Math.abs(this.distancetotargety) > 1){
if (Math.abs(this.distancetotargetx) > Math.abs(this.distancetotargety)){
if (this.distancetotargetx > 1){
this.vel.x = this.movementspeed;
this.xydivision = this.distancetotargety / this.distancetotargetx;
this.vel.y = this.xydivision * this.movementspeed;
this.currentAnim = this.anims.right;
this.formerpressed = 'right';
} else {
this.vel.x = -this.movementspeed;
this.xydivision = this.distancetotargety / Math.abs(this.distancetotargetx);
this.vel.y = this.xydivision * this.movementspeed;
this.currentAnim = this.anims.left;
this.formerpressed = 'left';
}
// einde Math.ads(this.distancetotarget.x) > Math.abs(this.distancetotarget.y)
} else {
if (this.distancetotargety > 1){
this.vel.y = this.movementspeed;
this.xydivision = this.distancetotargetx / this.distancetotargety;
this.vel.x = this.xydivision * this.movementspeed;
this.currentAnim = this.anims.down;
this.formerpressed = 'down';
} else {
this.vel.y = -this.movementspeed;
this.xydivision = this.distancetotargetx / Math.abs(this.distancetotargety);
this.vel.x = this.xydivision * this.movementspeed;
this.currentAnim = this.anims.up;
this.formerpressed = 'up';
}
}
//einde this.distancetotargetx > 0 || this.distancetotargety > 0
} else {
this.vel.x = 0;
this.vel.y = 0;
this.destinationx = 99999999;
this.destinationy = 99999999;
if (this.formerpressed == 'up') {
this.currentAnim = this.anims.idleup;
} else if (this.formerpressed == 'right') {
this.currentAnim = this.anims.idleright;
} else if (this.formerpressed == 'down') {
this.currentAnim = this.anims.idledown;
} else if (this.formerpressed == 'left') {
this.currentAnim = this.anims.idleleft;
}
}
}
// End Mouse Movement
this.parent();
}
});
});
|
const express = require('express');
const bodyParser = require('body-parser');
const http = require('http');
const Sequelize = require('sequelize');
const app = express();
app.use(bodyParser.urlencoded({ extended: false }));
var models = require('./models/index.js');
const ProductsController = require('./controllers/productsController.js');
function raw_insert(queryString) {
sequelize.query(queryString).spread((results, metadata) => {
console.log("insert complete");
})
}
const sequelize = new Sequelize('pgguide', 'Emmet', 'petrolbear', {
host: 'localhost',
dialect: 'postgres',
define: {
timestamps: false
}
});
sequelize
.authenticate()
.then(() => {
console.log('Connection has been established successfully.');
})
.catch(err => {
console.error('Unable to connect to the database:', err);
});
sequelize.sync({force: false}).then(() => {
console.log('Successfully synced to DB');
app.get('/products', (req, res) => {
ProductsController.findAll(req, res);
});
app.get('/products/:id', (req, res) => {
ProductsController.findOne(req, res);
});
app.post('/products', (req, res) => {
ProductsController.create(req, res);
});
app.put('/products/:id', (req, res) => {
ProductsController.update(req, res);
});
app.delete('/products/:id', (req, res) => {
ProductsController.delete(req, res);
});
http.createServer(app).listen(3000);
});
|
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export const store = new Vuex.Store({
state: {
albums: [{
slike: [{
picQuality: 'Nights/01.jpg',
picLowQuality: 'Nights/01.webp',
size: 'lg12'
},
{
picQuality: 'Nights/02.jpg',
picLowQuality: 'Nights/02.webp',
size: 'vert'
},
{
picQuality: 'Nights/03.jpg',
picLowQuality: 'Nights/03.webp',
size: 'vert'
},
{
picQuality: 'Nights/04.jpg',
picLowQuality: 'Nights/04.webp',
size: 'vert'
}
],
thumbnailQ: 'Nights/Thumb.jpg',
thumbnailLowQ: 'Nights/thumb.webp',
text: 'Pic Title',
id: 'Nights',
},
{
slike: [{
picQuality: 'Niksi/01.jpg',
picLowQuality: 'Niksi/01.webp',
},
{
picQuality: 'Niksi/02.jpg',
picLowQuality: 'Niksi/02.webp',
},
{
picQuality: 'Niksi/03.jpg',
picLowQuality: 'Niksi/03.webp',
},
{
picQuality: 'Niksi/04.jpg',
picLowQuality: 'Niksi/04.webp',
},
{
picQuality: 'Niksi/05.jpg',
picLowQuality: 'Niksi/05.webp',
},
{
picQuality: 'Niksi/06.jpg',
picLowQuality: 'Niksi/06.webp',
},
{
picQuality: 'Niksi/07.jpg',
picLowQuality: 'Niksi/07.webp',
},
{
picQuality: 'Niksi/08.jpg',
picLowQuality: 'Niksi/08.webp',
},
{
picQuality: 'Niksi/09.jpg',
picLowQuality: 'Niksi/09.webp',
},
{
picQuality: 'Niksi/10.jpg',
picLowQuality: 'Niksi/10.webp',
},
{
picQuality: 'Niksi/11.jpg',
picLowQuality: 'Niksi/11.webp',
},
{
picQuality: 'Niksi/12.jpg',
picLowQuality: 'Niksi/12.webp',
},
{
picQuality: 'Niksi/13.jpg',
picLowQuality: 'Niksi/13.webp',
},
{
picQuality: 'Niksi/14.jpg',
picLowQuality: 'Niksi/14.webp',
},
{
picQuality: 'Niksi/15.jpg',
picLowQuality: 'Niksi/15.webp',
},
{
picQuality: 'Niksi/16.jpg',
picLowQuality: 'Niksi/16.webp',
}
],
thumbnailQ: 'Niksi/Thumb.jpg',
thumbnailLowQ: 'Niksi/Thumb.jpg',
text: 'Pic Title',
id: 'Niksi',
},
{
slike: [{
picQuality: 'Places/01.jpg',
picLowQuality: 'Places/01.webp',
size: 'lg12'
},
{
picQuality: 'Places/02.jpg',
picLowQuality: 'Places/02.webp',
size: 'vert'
},
{
picQuality: 'Places/03.jpg',
picLowQuality: 'Places/03.webp',
size: 'vert'
},
{
picQuality: 'Places/04.jpg',
picLowQuality: 'Places/04.webp',
size: 'lg12'
},
{
picQuality: 'Places/05.jpg',
picLowQuality: 'Places/05.webp',
size: 'lg12'
},
{
picQuality: 'Places/06.jpg',
picLowQuality: 'Places/06.webp',
size: 'vert'
},
{
picQuality: 'Places/07.jpg',
picLowQuality: 'Places/07.webp',
size: 'vert'
},
{
picQuality: 'Places/08.jpg',
picLowQuality: 'Places/08.webp',
size: 'lg12'
},
{
picQuality: 'Places/09.jpg',
picLowQuality: 'Places/09.webp',
size: 'lg12'
},
{
picQuality: 'Places/10.jpg',
picLowQuality: 'Places/10.webp',
size: 'vert'
},
{
picQuality: 'Places/11.jpg',
picLowQuality: 'Places/11.webp',
size: 'vert'
},
{
picQuality: 'Places/12.jpg',
picLowQuality: 'Places/12.webp',
size: 'lg12'
},
{
picQuality: 'Places/13.jpg',
picLowQuality: 'Places/13.webp',
size: 'lg12'
},
{
picQuality: 'Places/14.jpg',
picLowQuality: 'Places/14.webp',
size: 'lg12'
},
{
picQuality: 'Places/15.jpg',
picLowQuality: 'Places/15.webp',
size: 'lg12'
},
{
picQuality: 'Places/16.jpg',
picLowQuality: 'Places/16.webp',
size: 'lg12'
},
{
picQuality: 'Places/17.jpg',
picLowQuality: 'Places/17.webp',
size: 'lg12'
}
],
thumbnailQ: 'Places/Thumb.jpg',
thumbnailLowQ: 'Places/thumb.webp',
text: 'Pic Title',
id: 'Places',
}, {
slike: [{
picQuality: 'Us/01.jpg',
picLowQuality: 'Us/01.webp',
size: 'lg12'
},
{
picQuality: 'Us/02.jpg',
picLowQuality: 'Us/02.webp',
size: 'vert'
},
{
picQuality: 'Us/03.jpg',
picLowQuality: 'Us/03.webp',
size: 'vert'
},
{
picQuality: 'Us/04.jpg',
picLowQuality: 'Us/04.webp',
size: 'lg12'
},
{
picQuality: 'Us/05.jpg',
picLowQuality: 'Us/05.webp',
size: 'lg12'
},
{
picQuality: 'Us/06.jpg',
picLowQuality: 'Us/06.webp',
size: 'lg12'
},
{
picQuality: 'Us/07.jpg',
picLowQuality: 'Us/07.webp',
size: 'lg12'
},
{
picQuality: 'Us/08.jpg',
picLowQuality: 'Us/08.webp',
size: 'vert'
},
{
picQuality: 'Us/09.jpg',
picLowQuality: 'Us/09.webp',
size: 'vert'
},
{
picQuality: 'Us/10.jpg',
picLowQuality: 'Us/10.webp',
size: 'lg12'
},
{
picQuality: 'Us/11.jpg',
picLowQuality: 'Us/11.webp',
size: 'lg12'
},
{
picQuality: 'Us/12.jpg',
picLowQuality: 'Us/12.webp',
size: 'vert'
},
{
picQuality: 'Us/13.jpg',
picLowQuality: 'Us/13.webp',
size: 'vert'
},
{
picQuality: 'Us/14.jpg',
picLowQuality: 'Us/14.webp',
size: 'lg12'
},
{
picQuality: 'Us/15.jpg',
picLowQuality: 'Us/15.webp',
size: 'lg12'
},
{
picQuality: 'Us/16.jpg',
picLowQuality: 'Us/16.webp',
size: 'lg12'
},
{
picQuality: 'Us/17.jpg',
picLowQuality: 'Us/17.webp',
size: 'lg12'
},
{
picQuality: 'Us/18.jpg',
picLowQuality: 'Us/18.webp',
size: 'lg12'
},
{
picQuality: 'Us/19.jpg',
picLowQuality: 'Us/19.webp',
size: 'vert'
},
{
picQuality: 'Us/20.jpg',
picLowQuality: 'Us/20.webp',
size: 'vert'
},
{
picQuality: 'Us/21.jpg',
picLowQuality: 'Us/21.webp',
size: 'lg12'
},
{
picQuality: 'Us/22.jpg',
picLowQuality: 'Us/22.webp',
size: 'lg12'
},
{
picQuality: 'Us/23.jpg',
picLowQuality: 'Us/23.webp',
size: 'lg12'
},
{
picQuality: 'Us/24.jpg',
picLowQuality: 'Us/24.webp',
size: 'lg12'
},
{
picQuality: 'Us/25.jpg',
picLowQuality: 'Us/25.webp',
size: 'lg12'
},
{
picQuality: 'Us/26.jpg',
picLowQuality: 'Us/26.webp',
size: 'vert'
}
],
thumbnailQ: 'Us/Thumb.jpg',
thumbnailLowQ: 'Us/Thumb.jpg',
text: 'Pic Title',
id: 'Us',
},
{
slike: [{
picQuality: 'Trokanac/01.jpg',
picLowQuality: 'Trokanac/1.webp',
size: 'lg12'
},
{
picQuality: 'Trokanac/02.jpg',
picLowQuality: 'Trokanac/02.webp',
size: 'lg12'
},
{
picQuality: 'Trokanac/03.jpg',
picLowQuality: 'Trokanac/03.webp',
size: 'lg12'
},
{
picQuality: 'Trokanac/04.jpg',
picLowQuality: 'Trokanac/04.webp',
size: 'lg12'
},
{
picQuality: 'Trokanac/05.jpg',
picLowQuality: 'Trokanac/05.webp',
size: 'vert'
},
{
picQuality: 'Trokanac/06.jpg',
picLowQuality: 'Trokanac/06.webp',
size: 'vert'
},
{
picQuality: 'Trokanac/07.jpg',
picLowQuality: 'Trokanac/07.webp',
size: 'lg12'
},
{
picQuality: 'Trokanac/08.jpg',
picLowQuality: 'Trokanac/08.webp',
size: 'lg12'
},
{
picQuality: 'Trokanac/09.jpg',
picLowQuality: 'Trokanac/09.webp',
size: 'lg12'
},
{
picQuality: 'Trokanac/10.jpg',
picLowQuality: 'Trokanac/10.webp',
size: 'lg12'
},
{
picQuality: 'Trokanac/11.jpg',
picLowQuality: 'Trokanac/11.webp',
size: 'lg12'
},
{
picQuality: 'Trokanac/12.jpg',
picLowQuality: 'Trokanac/12.webp',
size: 'lg12'
},
{
picQuality: 'Trokanac/13.jpg',
picLowQuality: 'Trokanac/13.webp',
size: 'lg12'
},
{
picQuality: 'Trokanac/14.jpg',
picLowQuality: 'Trokanac/14.webp',
size: 'lg12'
},
{
picQuality: 'Trokanac/15.jpg',
picLowQuality: 'Trokanac/15.webp',
size: 'lg12'
}
],
thumbnailQ: 'Trokanac/Thumb.jpg',
thumbnailLowQ: 'Trokanac/Thumb.jpg',
text: 'Pic Title',
id: 'Trokanac',
}
]
},
mutations: {},
actions: {
},
getters: {
LoadedAlbum(state) {
return (albumID) => {
return state.albums.find((album) => {
return album.id === albumID
})
}
},
loadAlbums(state) {
return state.albums
}
}
})
|
const { getUserInfo, getPhoneNumber, requestLogin } = require('./utils/login');
const app = getApp();
const { appLogin } = require('./utils/login');
Page({
data: {
userInfo: {},
hasUserInfo: false,
hasMobileInfo: false,
canIUse: wx.canIUse('button.open-type.getUserInfo')
},
onLoad: function () {
appLogin()
app.dataSetCallback = data => {
this.setData({
...data
})
};
},
getUserInfo: e => getUserInfo(e.detail),
getPhoneNumber(e) {
getPhoneNumber(e.detail)
.then(e => {
console.log(e);
return requestLogin();
})
},
navigatorTo(event) {
wx.navigateTo({
url: '/pages/ccc/ccc'
})
},
toMine() {
wx.navigateTo({
url: '/pages/mine/mine'
})
}
})
|
function lastIndexOf(arr, val) {
for (var i = arr.length - 1; i > -1; i--) {
if (val === arr[i]) {
var match = true,
foo = i;
break;
}
}
if (match)
return foo;
else
return -1;
}
console.log(lastIndexOf([ 0, 1, 4, 1, 2 ], 1), "=?", 3);
console.log(lastIndexOf([ 0, 1, 4, 1, 2 ], 2), "=?", 4);
console.log(lastIndexOf([ 0, 1, 4, 1, 2 ], 3), "=?", -1);
console.log(lastIndexOf([ 5, 5, 5 ], 5), "=?", 2);
console.log(lastIndexOf([], 3), "=?", -1);
|
const mongoose = require('mongoose');
const User = require('../models/users');
const delegateCustomer = (req, res, next) => {
console.log('reached customer delegation')
console.log(req.user);
next();
}
module.exports = delegateCustomer
|
// let nombre='wolverine';
// if(true){
// let nombre='magento';
// }
// let nombre='wolverine1';
// let nombre='wolverine2';
// let nombre='wolverine3';
// let nombre='wolverine4';
console.log(nombre);
let nombre='wolverine';
if(true){
let nombre='magento';
}
nombre='wolverine1';
nombre='wolverine2';
nombre='wolverine3';
nombre='wolverine4';
|
// console.log('starting up the server');
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
var fishiesList =[
{name: 'walleye'},
{name: 'pike'},
{name: 'muskie'},
{name: 'trout'},
{name: 'salmon'},
{name: 'bass'},
{name: 'sturgeon'},
{name: 'perch'},
{name: 'halibut'},
{name: 'shiner'},
{name: 'darter'},
{name: 'carp'},
{name: 'minnow'},
{name: 'whitefish'},
{name: 'bullhead'},
];
//this will run when we make a request
app.use(express.static('server/public')); //is this request for a static file, like script.js, index.html, styles.css, etc
app.use(bodyParser.urlencoded({extended: true})); //this creates req.body
app.get('/fish', function(req, res){
// console.log(req);
res.send(fishiesList); //always send a response
});
//handle request for the first fish
app.get('/fish/first', function(req, res){
// console.log(req);
res.send(fishiesList[0]);
});
// handle the request for the last fish
app.get('/fish/last', function(req, res){
// console.log(req);
res.send(fishiesList[fishiesList.length-1]);
});
//handle request for the name of the last fish
app.get('/fish/first/name', function(req, res){
// console.log(req);
res.send(fishiesList[0].name);
});
app.get('/fish/last/name', function(req, res){
// console.log(req);
res.send(fishiesList[fishiesList.length-1].name);
});
app.post('/fish/new', function(req, res){
var newFish = req.body;
if(newFish.name !== ''){
fishiesList.push(newFish); //throw that shit on the new fish object
// console.log(fishiesList);
res.sendStatus(200);
}else{
res.sendStatus(400);
}
});
app.listen(5000);
//console.log on server (app.js) shows up in terminal
//console.log on client (client.js) will show up in browser's console
|
import React, { useState } from 'react';
import List from './components/List';
import Input from './components/Input';
import { AppWrapper } from './styles';
const AppContainer = () => {
let [task, setTask] = useState([
{
text: 'Learn hooks',
isChecked: true,
},
{
text: 'Implement Hooks on Real Project',
isChecked: false,
},
]);
function updateTask(id, isCheck) {
const newState = task;
const updateState = newState.map((todo, index) => {
if (index === id) {
return {
...todo,
isChecked: isCheck,
};
}
return todo;
});
setTask((task = updateState));
}
function addNewTask(todo) {
const newTodo = [
...task,
{
text: todo,
isChecked: false,
},
];
setTask((task = newTodo));
}
function deleteTask(id) {
const newTask = task.filter((todo, index) => {
if (index === id) {
return undefined;
}
return todo;
});
setTask((task = newTask));
}
const renderFragment = task.map((todo, index) => {
return (
<List
key={index}
id={index}
text={todo.text}
isChecked={todo.isChecked}
onCheck={updateTask}
onDelete={deleteTask}
/>
);
});
return (
<AppWrapper>
{renderFragment.length === 0 ? 'Tidak ada Task' : renderFragment }
<Input onAddTodo={addNewTask} />
</AppWrapper>
);
};
export default AppContainer;
|
import React from 'react'
import hull from 'hull.js'
import {
Map, GoogleApiWrapper, Polygon
} from 'google-maps-react';
import rawData from '../lib/rawdata'
import utils from '../lib/utils'
import consts from '../lib/consts'
const { getMinY, getMaxY, generateRange } = utils
const { gradient } = consts
const accumulatedCenter = rawData.reduce((acc, point) => {
return { lng: acc.lng + point.lng, lat: acc.lat + point.lat }
}, { lng: null, lat: null })
const center = { lng: accumulatedCenter.lng / rawData.length, lat: accumulatedCenter.lat / rawData.length }
export class MapContainer extends React.Component {
constructor(props) {
super(props)
this.state = {
points: [],
topograpgicHeights: [],
}
this.createTopographicHeights = this.createTopographicHeights.bind(this)
this.getPolygonPathByWeight = this.getPolygonPathByWeight.bind(this)
this.map = React.createRef()
}
componentDidMount() {
const arr = []
const topoHeights = this.createTopographicHeights()
topoHeights.forEach((topoHeight) => {
arr.push(this.getPolygonPathByWeight(topoHeight))
})
this.setState({ points: arr })
}
createTopographicHeights = () => {
const maxWeight = Math.round(getMaxY(rawData))
const minWeight = Math.round(getMinY(rawData))
const max = maxWeight + (10 - (maxWeight % 10))
const min = minWeight - (minWeight % 10)
const heights = generateRange(min, max, consts.HEIGHT_STEPS)
return heights
}
getPolygonPathByWeight = (weight) => {
const weightLevelPoints = rawData
.filter(obj => (Math.round(obj.weight) < weight + 1.5 && Math.round(obj.weight) > weight - 1.5))
const hullPoints = hull(weightLevelPoints.map((point) => [point.lat, point.lng]), 40)
const points = hullPoints && hullPoints.map((point) => {
return point && new this.props.google.maps.LatLng({ lat: point[0], lng: point[1] })
})
return points
}
render() {
const { points } = this.state
return (
<div style={{ height: '100vh', width: '100%' }}>
<Map
google={this.props.google}
zoom={19}
initialCenter={center}
mapTypeControl
mapTypeControlOptions={{ mapTypeIds: ['satellite', 'terrain'] }}
ref={this.map}
>
{points.map((group, idx) => {
return (
<Polygon
key={`p-${idx}`}
path={group}
options={{
fillColor: gradient[idx],
fillOpacity: 0.4,
strokeColor: "#000",
strokeOpacity: idx / 10,
strokeWeight: 1.5
}}
/>
)
})}
</Map>
</div>
);
}
}
export default GoogleApiWrapper({
apiKey: ('<My Google Api Key>'),
libraries: ['visualization']
})(MapContainer)
|
//"{% url 'polls:detail' question.id %}"
var exportModel = function(id){
var url = 'http://' + $("#" + id).val();
window.open(url);
}
|
import request from '@/utils/request';
import md5 from "md5";
/****************** 用户 ************************/
/**
* 保存用户信息
* @param {Object} user 用户信息
*/
export function saveUser(user) {
user.password = md5(user.password);
return request({ url: '/security/user/save', data: user });
};
/**
* 更新用户信息
* @param {Object} user 用户信息
*/
export function updateUser(user) {
return request({ url: '/security/user/update', data: user });
};
/**
* 修改密码
* @param {String} user 用户信息
*
*/
export function updatePassword(user) {
user.password = md5(user.password);
return request({ url: '/security/user/updatePwd', data: user });
};
/**
* 删除用户信息
* @param {String} id 用户ID
*/
export function deleteUser(id) {
return request({ url: '/security/user/delete/' + id });
};
/**
* 查询所有记录
*/
export function queryAllUsers() {
return request({ url: '/security/user/queryAll' });
};
/**
* 查询角色下的用户列表
* @param {String} roleId 角色ID
*/
export function queryUsersByRoleId(roleId) {
return request({ url: '/security/user/queryByRoleId/' + roleId });
};
/**
* 保存用户所属角色信息
* @param {Number} userId 用户ID
* @param {Array} roleIds 角色ID数组
*/
export function saveUserRoles(userId, roleIds) {
return request({ url: '/security/user/saveUserRoles', params: { userId }, data: roleIds });
};
|
import {Router} from 'express';
import * as userController from './user.controller';
//import validate from 'express-validation';
//import {registerValidation, loginValidation, validate} from './user.validation';
import {authJwt} from '../../config/passport'
import {apiAuthentication} from '../../middleware/authMessage'
const UserRouter = Router();
UserRouter.get('/balance', apiAuthentication, userController.getBalance);
UserRouter.get('/', authJwt, userController.gellAllUsers);
UserRouter.get('/:id', authJwt, userController.gellUser);
//UserRouter.post('/login', loginValidation(),validate, userController.login)
export default UserRouter;
|
Ext.apply(Ext.form.VTypes,{
password :function(val,field){
if(field.initialPassField){
var pwd = Ext.getCmp(field.initialPassField);
return (val == pwd.getValue());
}
return true;
},
passwordText:'两次输入密码不一致'
})
|
import * as React from 'react'
import * as Font from 'expo-font'
import { SplashScreen } from 'expo'
import { NavigationContainer } from '@react-navigation/native'
import { createStackNavigator } from '@react-navigation/stack'
import { createDrawerNavigator } from '@react-navigation/drawer'
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'
import { MaterialCommunityIcons, Ionicons } from '@expo/vector-icons'
import PhoneNumberScreen from './screens/PhoneNumberScreen'
import VerifyScreen from './screens/VerifyScreen'
import HomeScreen from './tab/HomeScreen'
import HomeScreenDetail from './tab/HomeScreenDetail'
import JobsScreen from './tab/JobsScreen'
import JobsScreenDetail from './tab/JobsScreenDetail'
import FormationsScreen from './tab/FormationsScreen'
import FormationsScreenDetail from './tab/FormationsScreenDetail'
import InformationsScreen from './tab/InformationsScreen'
import InformationsScreenDetail from './tab/InformationsScreenDetail'
import CustomDrawerContent from './CustomDrawerContent'
import AboutmeScreen from './drawer/AboutmeScreen'
import DocumentsScreen from './drawer/DocumentsScreen'
import MecontacterScreen from './drawer/MecontacterScreen'
import useLinking from './navigation/useLinking'
// https://dev.to/expolovers/authentification-par-numero-de-telephone-avec-expo-sdk37-et-firebase-4mc9
const navOptionHandler = () => ({
hearderShown: false
})
const StackHome = createStackNavigator()
function HomeStack() {
return (
<StackHome.Navigator initialRouteName='Home' headerMode='none'>
<StackHome.Screen name='Home' component={HomeScreen} options={navOptionHandler}/>
<StackHome.Screen name='HomeDetail' component={HomeScreenDetail} options={navOptionHandler}/>
</StackHome.Navigator>
)
}
const StackHomeDetail = createStackNavigator()
function HomeDetailStack() {
return (
<StackHomeDetail.Navigator initialRouteName='HomeDetail' headerMode='none'>
<StackHomeDetail.Screen name='HomeDetail' component={HomeScreenDetail} options={navOptionHandler}/>
<StackHomeDetail.Screen name='Home' component={HomeScreen} options={navOptionHandler}/>
<StackHomeDetail.Screen name='Jobs' component={JobsScreen} options={navOptionHandler}/>
<StackHomeDetail.Screen name='JobsDetail' component={JobsScreenDetail} options={navOptionHandler}/>
<StackHomeDetail.Screen name='Formations' component={FormationsScreen} options={navOptionHandler}/>
<StackHomeDetail.Screen name='FormationsDetail' component={FormationsScreenDetail} options={navOptionHandler}/>
<StackHomeDetail.Screen name='Informations' component={InformationsScreen} options={navOptionHandler}/>
<StackHomeDetail.Screen name='InformationsDetail' component={InformationsScreenDetail} options={navOptionHandler}/>
<StackHomeDetail.Screen name='Home' component={HomeScreen} options={navOptionHandler}/>
<StackHomeDetail.Screen name='Aboutme' component={AboutmeScreen} options={navOptionHandler}/>
<StackHomeDetail.Screen name='Documents' component={DocumentsScreen} options={navOptionHandler}/>
<StackHomeDetail.Screen name='Mecontacter' component={MecontacterScreen} options={navOptionHandler}/>
<StackHomeDetail.Screen name='Login' component={LoginScreen} options={navOptionHandler}/>
</StackHomeDetail.Navigator>
)
}
const StackJob = createStackNavigator()
function JobStack() {
return (
<StackJob.Navigator initialRouteName='Jobs' headerMode='none'>
<StackJob.Screen name='Jobs' component={JobsScreen} options={navOptionHandler}/>
<StackJob.Screen name='JobsDetail' component={JobsScreenDetail} options={navOptionHandler}/>
</StackJob.Navigator>
)
}
const StackFormation = createStackNavigator()
function FormationStack() {
return (
<StackFormation.Navigator initialRouteName='Formations' headerMode='none'>
<StackFormation.Screen name='Formations' component={FormationsScreen} options={navOptionHandler}/>
<StackFormation.Screen name='FormationsDetail' component={FormationsScreenDetail} options={navOptionHandler}/>
</StackFormation.Navigator>
)
}
const StackInformation = createStackNavigator()
function InformationsStack() {
return (
<StackInformation.Navigator initialRouteName='Informations' headerMode='none'>
<StackInformation.Screen name='Informations' component={InformationsScreen} options={navOptionHandler}/>
<StackInformation.Screen name='InformationsDetail' component={InformationsScreenDetail} options={navOptionHandler}/>
</StackInformation.Navigator>
)
}
const Tab = createBottomTabNavigator()
function TabNavigator() {
return (
<Tab.Navigator
screenOptions={({ route }) => ({
tabBarIcon: ({ focused, color, size }) => {
let iconName;
if (route.name === 'Home') {
iconName = focused
? 'home'
: 'home-outline';
} else if (route.name === 'Jobs') {
iconName = focused
? 'keyboard'
: 'keyboard-outline';
} else if (route.name === 'Formations') {
iconName = focused
? 'script'
: 'script-outline';
} else if (route.name === 'Informations') {
iconName = focused
? 'magnify'
: 'magnify-plus-outline';
}
return <MaterialCommunityIcons name={iconName} size={size} color={color} />;
},
})}
tabBarOptions={{
activeTintColor: '#9400d3',
inactiveTintColor: 'black',
}}
>
<Tab.Screen name="Home" component={HomeStack} />
<Tab.Screen name="Jobs" component={JobStack} />
<Tab.Screen name="Formations" component={FormationStack} />
<Tab.Screen name="Informations" component={InformationsStack} />
</Tab.Navigator>
)
}
const Drawer = createDrawerNavigator()
function DrawerNavigator() {
return (
<Drawer.Navigator initialRouteName="Accueil" drawerContent={CustomDrawerContent}>
<Drawer.Screen name="Accueil" component={TabNavigator} />
<Drawer.Screen name="Aboutme" component={AboutmeScreen} />
<Drawer.Screen name="Documents" component={DocumentsScreen} />
<Drawer.Screen name="Mecontacter" component={MecontacterScreen} />
</Drawer.Navigator>
)
}
const Stack = createStackNavigator()
const App = (props) => {
const [isLoadingComplete, setLoadingComplete] = React.useState(false)
const [initialNavigationState, setInitialNavigationState] = React.useState()
const containerRef = React.useRef()
const { getInitialState } = useLinking(containerRef)
// Load any resources or data that we need prior to rendering the app
React.useEffect(() => {
async function loadResourcesAndDataAsync() {
try {
SplashScreen.preventAutoHide()
// Load our initial navigation state
setInitialNavigationState(await getInitialState())
// Load fonts
await Font.loadAsync({
...Ionicons.font,
'space-mono': require('./assets/fonts/SpaceMono-Regular.ttf'),
muli: require('./assets/fonts/Muli-VariableFont_wght.ttf'),
})
} catch (e) {
// We might want to provide this error information to an error reporting service
console.warn(e)
} finally {
setLoadingComplete(true)
SplashScreen.hide()
}
}
loadResourcesAndDataAsync()
}, [])
if (!isLoadingComplete && !props.skipLoadingScreen) {
return null
} else {
return (
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen
name='phone'
component={PhoneNumberScreen}
options={{ headerShown: false }}
/>
<Stack.Screen
name='verify'
component={VerifyScreen}
options={{ headerShown: false }}
/>
<Stack.Screen
name='HomeApp'
component={DrawerNavigator}
options={{ headerShown: false }}
/>
</Stack.Navigator>
</NavigationContainer>
)
}
}
export default App
|
import Service from '@ember/service';
import { getOwner } from '@ember/application';
import { assert } from '@ember/debug';
export default class ModelsService extends Service {
create(name, ...args) {
let owner = getOwner(this);
let factory = owner.factoryFor(`model:${name}`)?.class;
assert(`Model '${name}' is not registered`, !!factory);
return new factory(owner, ...args);
}
}
|
import models from '../../../models';
export default function (req, res, next) {
return models.menu
.findOne({
where: { id: req.params.id }
}).then(menu => {
res.send(menu);
}).catch(err => {
next(err);
});
}
|
'use strict';
/*
mBot backend server
Written by Morten Jansrud
*/
//variables
const express = require('express');
const app = express();
const cors = require('cors');
const bodyParser = require('body-parser');
//Parser
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(cors());
//Starts the rest API
function startApi(){
console.log("Starting API");
//Modules
require('./routes')(app);
require('./utilities/pononiex');
//Start spawning bots
var supervior = require('./bot/supervisor');
supervior.spawnBots();
/*
Start server
*/
var server = app.listen(process.env.NODE_ENV_SERVER_PORT, function() {
console.log('Welcome to mBot-API, listening on port ' + server.address().port);
});
}
//Start the cluster of workers
function startWorkers(){
console.log("Starting workers");
/*
Start worker
*/
require('./bot/workers').startWorkers();
}
switch (process.argv[process.argv.length - 1]) {
case 'api':
startApi();
break;
case 'worker':
startWorkers();
break;
default:
console.log(`
~~~~~~~~~~~~~~~~~~~~~~~~~
~~ mBOT ~~
~~~~~~~~~~~~~~~~~~~~~~~~~
Argument must be one of the following:
api - Starts the rest server
worker - Runs workers for async tasks
`);
process.exit(1);
break;
}
module.exports = app;
|
import React, { Component } from 'react';
import './navbarIconItem.scss';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import shoppingCartFunc from '../../ultis/shoppingCartFunc';
const ShoppingIcon = ({ shoppingCart }) => {
return (
<div className="shopping-icon-part navbar-icon-item">
<FontAwesomeIcon icon = "shopping-bag" className="real-font-awesome icon-navbar"/>
<strong className="d-flex justify-content-center align-items-center">
{shoppingCart ? shoppingCartFunc.countItemInShoppingCart(shoppingCart): 0}
</strong>
</div>
);
}
export default ShoppingIcon;
|
//Prikaz apoteke
$(document).ready(function () {
$.ajax({
type: "GET",
url: "http://localhost:8081/pharmacy/pharmacyId",
dataType: "json",
beforeSend: function (xhr) {
if (localStorage.token) {
xhr.setRequestHeader('Authorization', 'Bearer ' + localStorage.token);
}
},
success: function (data) {
console.log("SUCCESS", data);
$('#pharmacyName').append(data['name']);
$('#pharmacyRating').append(data['rating']);
},
error: function (jqXHR) {
if(jqXHR.status === 403)
{
window.location.href="error.html";
}
if(jqXHR.status === 401)
{
window.location.href="error.html";
}
}
});
});
//Prikaz svih farmaceuta
$(document).ready(function () {
$.ajax({
type: "GET",
url: "http://localhost:8081/pharmacists/adminPharmacists",
dataType: "json",
beforeSend: function (xhr) {
if (localStorage.token) {
xhr.setRequestHeader('Authorization', 'Bearer ' + localStorage.token);
}
},
success: function (data) {
console.log("SUCCESS", data);
for (i = 0; i < data.length; i++) {
var row = "<tr>";
row += "<td>" + data[i]['firstName'] + "</td>";
row += "<td>" + data[i]['lastName'] + "</td>";
row += "<td>" + data[i]['rating'] + "</td>";
$('#tablePharmacistsAdminPharmacy').append(row);
}
},
error: function (jqXHR) {
if(jqXHR.status === 403)
{
window.location.href="error.html";
}
if(jqXHR.status === 401)
{
window.location.href="error.html";
}
}
});
});
//Prikaz svih dermatologa
$(document).ready(function () {
$.ajax({
type: "GET",
url: "http://localhost:8081/dermatologists/adminDermatologists",
dataType: "json",
beforeSend: function (xhr) {
if (localStorage.token) {
xhr.setRequestHeader('Authorization', 'Bearer ' + localStorage.token);
}
},
success: function (data) {
console.log("SUCCESS", data);
for (i = 0; i < data.length; i++) {
var row = "<tr>";
row += "<td>" + data[i]['firstName'] + "</td>";
row += "<td>" + data[i]['lastName'] + "</td>";
row += "<td>" + data[i]['rating'] + "</td>";
$('#tableDermatologistsAdminPharmacy').append(row);
}
},
error: function (jqXHR) {
if(jqXHR.status === 403)
{
window.location.href="error.html";
}
if(jqXHR.status === 401)
{
window.location.href="error.html";
}
}
});
});
|
import React from 'react';
import * as TYPES from './types'
/* 利用redux 存放的一公用的全局的方法 */
export default {
/* 大于0显示超链接 0则显示文本0 */
num_href: (num,url) => ((Number(num) !== 0) ? (<a href={url}>{num}</a>) :(<span>0</span>)),
/* 模拟登陆 */
simulation_login:(row) => async =>{
console.log(row)
}
}
|
import {
StyleSheet,
} from 'react-native';
export const inputAndButtonFontSize = 20;
export const AppColor = '#BB0000';
export const AppColorSecond = '#494949';
export const styles = StyleSheet.create({
picker: {
transform: [
{ scaleX: 2 },
{ scaleY: 2 },
]
},
container: {
paddingTop: 23
},
input: {
marginBottom: 20,
borderLeftColor: 'gray',
borderRightColor: 'gray',
borderTopColor: 'gray',
borderBottomColor: 'gray',
borderWidth: 1,
borderLeftWidth: 4,
height: 70,
paddingLeft: 20,
fontSize: inputAndButtonFontSize,
flexDirection: 'row',
justifyContent: 'space-between'
},
inputNoPadding: {
marginBottom: 20,
borderLeftColor: 'gray',
borderRightColor: 'gray',
borderTopColor: 'gray',
borderBottomColor: 'gray',
borderWidth: 1,
borderLeftWidth: 4,
height: 70,
fontSize: inputAndButtonFontSize,
flexDirection: 'row',
justifyContent: 'space-between'
},
inputDanger: {
marginBottom: 20,
borderLeftColor: AppColor,
borderRightColor: 'gray',
borderTopColor: 'gray',
borderBottomColor: 'gray',
borderWidth: 1,
borderLeftWidth: 4,
height: 70,
paddingLeft: 20,
fontSize: inputAndButtonFontSize,
flexDirection: 'row',
justifyContent: 'space-between'
},
inputSuccess: {
marginBottom: 20,
borderLeftColor: 'green',
borderRightColor: 'gray',
borderTopColor: 'gray',
borderBottomColor: 'gray',
borderWidth: 1,
borderLeftWidth: 4,
height: 70,
paddingLeft: 20,
fontSize: inputAndButtonFontSize,
flexDirection: 'row',
justifyContent: 'space-between'
},
inputSuccessNoPadding: {
marginBottom: 20,
borderLeftColor: 'green',
borderRightColor: 'gray',
borderTopColor: 'gray',
borderBottomColor: 'gray',
borderWidth: 1,
borderLeftWidth: 4,
height: 70,
fontSize: inputAndButtonFontSize,
flexDirection: 'row',
justifyContent: 'space-between'
},
inputInline: {
flex: 1,
marginBottom: 20,
borderWidth: 0,
height: 70,
paddingLeft: 0,
fontSize: inputAndButtonFontSize,
flexDirection: 'row',
justifyContent: 'space-between'
},
inputInlineIcon: {
margin: 20,
},
inputInlineIconDisabled: {
color: 'lightgray',
margin: 20,
},
inputInlineIconSuccess: {
margin: 20,
color: 'green',
},
inputInlineIconDanger: {
margin: 20,
color: AppColor,
},
textarea: {
marginBottom: 20,
borderLeftColor: AppColor,
borderRightColor: 'gray',
borderTopColor: 'gray',
borderBottomColor: 'gray',
borderWidth: 1,
borderLeftWidth: 4,
paddingLeft: 15,
fontSize: inputAndButtonFontSize,
},
text: {
fontSize: inputAndButtonFontSize,
},
textButton: {
fontSize: inputAndButtonFontSize,
textDecorationLine: 'underline',
},
label: {
fontSize: inputAndButtonFontSize,
marginBottom: 10,
},
button: {
height: 70,
marginTop: 15,
marginBottom: 20,
padding: 20,
backgroundColor: AppColorSecond,
},
buttonOriginal: {
height: 70,
marginTop: 15,
marginBottom: 20,
padding: 20,
},
// DropDown selector
DropdownContainer: {
borderLeftColor: 'gray',
borderRightColor: 'gray',
borderTopColor: 'gray',
borderBottomColor: 'gray',
// borderColor: 'gray',
borderWidth: 1,
borderLeftWidth: 4,
height: 70,
marginBottom: 20,
},
DropdownContainerDanger: {
borderLeftColor: AppColor,
borderRightColor: 'gray',
borderTopColor: 'gray',
borderBottomColor: 'gray',
// borderColor: 'gray',
borderWidth: 1,
borderLeftWidth: 4,
height: 70,
marginBottom: 20,
},
DropdownContainerSuccess: {
borderLeftColor: 'green',
borderRightColor: 'gray',
borderTopColor: 'gray',
borderBottomColor: 'gray',
// borderColor: 'gray',
borderWidth: 1,
borderLeftWidth: 4,
height: 70,
marginBottom: 20,
},
innerContainer: {
padding: 15,
paddingTop: 20,
flexDirection: 'row',
justifyContent: 'space-between',
},
optionContainer: {
padding: 10,
borderBottomColor: 'grey',
borderBottomWidth: 1
},
optionInnerContainer: {
flex: 1,
flexDirection: 'row'
},
box: {
width: 20,
height: 20,
marginRight: 10
},
// @END DropDown selector
//Radio button styles
RadioContainer: {
borderWidth: 0,
height: 70,
marginBottom: 20,
flex: 1,
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
},
radioButton: {
height: 70,
width: 150,
backgroundColor: 'lightgray',
// marginLeft: 5,
justifyContent: 'center'
},
radioButtonSelected: {
width: 150,
height: 70,
backgroundColor: 'green',
// marginLeft: 5,
justifyContent: 'center'
},
//@END radio button styles
});
|
import React, { Component } from 'react';
import '../style/App.css';
import '../style/portofolio.css';
import{ Link } from "react-router-dom";
import Navigation from './navigation';
class Header extends Component {
postSignout = () => {
this.props.is_login=false;
this.props.history.push("/");
};
render() {
return (
<div className="container-fluid">
<div className="row backblack">
<div className="col-md-3 col-12 textcenter">
<img src={require('../images/logo2.png')} className="logo1" alt=""/>
</div>
<div className="col-md-9 col-12">
<div className="row justify-content-center paddingtop30">
<div className="col-8">
<form className="find" action="">
<input type="text" placeholder="Search.." onChange={this.props.doSearch} value={this.props.keyword} name="search"/>
<Link to="/searchresult" type="submit" className="btn btnsearch"><i className="fa fa-search">Find</i></Link> {/* <button type="submit"><i class="fa fa-search">Find</i></button> */}
</form>
</div>
<Navigation postSignout = {this.postSignout}/>
</div>
<div className="row justify-content-start backblack">
<nav className="navbar navbar-expand-sm bg-light backblack ">
<ul className="navbar-nav">
<li className="nav-item textcenter ">
<Link to="/" className="nav-link cwhite">Home</Link>
</li>
<li className="nav-item ">
<Link to="/allproduct" className="nav-link cwhite">List Product</Link>
</li>
<li className="nav-item ">
<Link to="/myproduct" className="nav-link cwhite">My product</Link>
</li>
<li className="nav-item ">
<Link to="/addproduct" className="nav-link cwhite">Add Product</Link>
</li>
</ul>
<li className="dropdown">
<button className="mainmenubtn margindown14">Category</button>
<div className="dropdown-child">
<Link to="/category">New</Link>
<Link to="/category">Second</Link>
<Link to="/category">Apple</Link>
<Link to="/category">Asus</Link>
<Link to="/category">Oppho</Link>
<Link to="/category">Samsung</Link>
<Link to="/category">Sony Xperia</Link>
<Link to="/category">Xiaomi</Link>
</div>
</li>
</nav>
</div>
</div>
</div>
</div>
);
}
}
export default Header;
|
function GetInterfaceByMask(mask) {
try {
var interfaceFile = mask;
if (interfaceFile.length > 0) {
mask = interfaceFile.replace("%", ".*");
var fso = new ActiveXObject("Scripting.FileSystemObject");
var mdbFolder = fso.GetFolder("\\\\comcor\\comcor\\Общая\\Navigator\\navsql\\Интерфейсы Navigator SQL\\Рабочие копии\\");
var en = new Enumerator(mdbFolder.files);
en.moveFirst();
var showDialog = true;
while (en.atEnd() == false) {
var fileName = en.item().Name.toUpperCase();
var regexp1 = new RegExp(".*[_]" + mask + ".*", "i");
var regexp2 = new RegExp(".*[ ]" + mask + ".*", "i");
if (fileName.substr(fileName.length - 4, 4) == ".MDB") {
if (regexp1.test(fileName.replace(" ", "")) || regexp2.test(fileName)) {
interfaceFile = fileName;
break;
}
}
en.moveNext();
}
return interfaceFile;
}
} catch (e) {
alert(e.toString());
}
}
function ProcessMenuClick(command, arg1, arg2, childWindow, dateInput) {
var shell;
var fso = new ActiveXObject("Scripting.FileSystemObject");
var message;
if (command == "OpenAreaFolder") {
if (arg1.substr(0, 6) == "Cancel") {
message = arg1.substr(7);
alert(message);
} else {
var path = arg1.substr(7);
if (fso.FolderExists(path)) {
window.open(path);
} else {
radalert("Папка \"<a href=\"" + path + "\" target=\"_blank\">" + path + "</a>\" не существует или к ней нет доступа", 500, 150);
}
}
}
else if (command == "RunPasZad2") {
if (fso.FileExists("C:\\test\\PAS_ZAD2.exe")) {
shell = new ActiveXObject("WScript.Shell");
shell.Run("C:\\test\\PAS_ZAD2.exe " + arg1);
} else {
alert("Программа \"C:\\test\\PAS_ZAD2.exe\" не найдена!");
}
}
else if (command == "ShowAttributes") {
childWindow.set_title("Атрибуты МЛ № " + arg1);
childWindow.show();
}
else if (command == "CopyToDesktop" || command == "CopyToAreaFolder" || command == "ShowPassport") {
if (command == "CopyToAreaFolder" && arg2.substr(0, 6) == "Cancel") {
message = arg2.substr(7);
alert(message);
return;
}
var date = new Date();
date.setDate(date.getDate() + 2);
if (date.getDay() == 0 || date.getDay() == 6) {
date.setDate(date.getDate() + 2);
}
shell = new ActiveXObject("WScript.Shell");
var toWorkPath = fso.BuildPath(shell.SpecialFolders("Desktop"), "В работу");
if (!fso.FolderExists(toWorkPath)) {
fso.CreateFolder(toWorkPath);
}
var folder = fso.GetFolder(fso.GetParentFolderName(arg1));
var template = fso.GetFileName(arg1);
var nameRe = new RegExp(template + "[^0-9].*");
var isFound = false;
var filePath;
var files = GetFileList(folder.Path, template + "*");
var i;
for (i = 0; i < files.length; i++) {
if (nameRe.test(files[i])) {
filePath = fso.BuildPath(folder.Path, files[i]);
isFound = true;
break;
}
}
var resultFileName;
if (!isFound) {
folder = fso.GetFolder(fso.BuildPath(folder.Path, "Расключ"));
files = GetFileList(folder.Path, template + "*");
for (i = 0; i < files.length; i++) {
if (nameRe.test(files[i])) {
filePath = fso.BuildPath(folder.Path, files[i]);
resultFileName = " в расключ " + files[i];
isFound = true;
break;
}
}
} else {
resultFileName = fso.GetFileName(filePath);
}
if (isFound) {
if (command == "ShowPassport") {
if (fso.GetExtensionName(filePath).substr(0, 3).toLowerCase() == "doc") {
var wordApp = new ActiveXObject("Word.Application");
wordApp.Documents.Open(filePath);
wordApp.UserControl = true;
wordApp.visible = true;
wordApp = null;
} else {
var excelApp = new ActiveXObject("Excel.Application");
excelApp.workbooks.Open(filePath);
excelApp.UserControl = true;
excelApp.visible = true;
excelApp = null;
}
}
if (command == "CopyToDesktop") {
fso.CopyFile(filePath, fso.BuildPath(toWorkPath, resultFileName));
}
if (command == "CopyToAreaFolder") {
$get("MenuCommandArgument").value = filePath;
childWindow.add_close(ConfirmCopyToAreaFolder);
childWindow.show();
dateInput.set_selectedDate(date);
dateInput.get_calendar().selectDate([date.getFullYear(), date.getMonth() + 1, date.getDate()], false);
}
} else {
alert("Не найден файл паспорта для канала \"" + template + "\"");
}
}
}
function ConfirmCopyToAreaFolder(sender, args) {
var fso = new ActiveXObject("Scripting.FileSystemObject");
var filePath = $get("MenuCommandArgument").value;
var arg2 = $get("MenuCommandArgument2").value;
var date = args.get_argument();
var resultFileName = fso.GetFileName(filePath);
if (filePath.indexOf("Расключ") > -1) {
resultFileName = " в расключ " + resultFileName;
}
fso.CopyFile(filePath, fso.BuildPath(arg2, "(До " + FormatDate(date) + ") " + resultFileName));
}
//т.к. в IE только начиная с IE11 появилось "штатное" форматирование дат, приходиться заниматься самодеятельностью
// (по крайней мере пока все пользователи не перейдут на Win7+).
function FormatDate(date) {
return date.getDate() + "." + (date.getMonth() + 1) + "." + date.getFullYear();
}
function GetFileList(path, pattern) {
var
fso = new ActiveXObject("Scripting.FileSystemObject"),
shell = new ActiveXObject("WScript.Shell"),
lastCurrentDirectory = shell.CurrentDirectory;
if (!pattern || pattern == "") {
pattern = "";
}
// Преобразуем исходный path в короткий путь
path = fso.GetFolder(path).ShortPath;
var
result = [],
command,
tempPath = shell.ExpandEnvironmentStrings("%TEMP%") + "\\", // Путь к папке %TEMP%
tempBuffer = tempPath + (new Date()).valueOf().toString().substring(6) + ".txt";
// Ведем поиск средствами CMD.
command = "cmd.exe /c chcp 1251 && cmd.exe /c && dir /B /A:-D " + pattern + " > " + tempBuffer;
// Устанавливаем директорию по умолчанию
shell.CurrentDirectory = path;
// Запустим CMD, ждем окончание выполнения этого процесса
shell.Run(command, 0, true);
if (fso.GetFile(tempBuffer).Size > 0) {
var
stream = fso.OpenTextFile(tempBuffer, 1, false);
result = stream.ReadAll();
stream.Close();
} else {
result = "";
}
fso.DeleteFile(tempBuffer);
result = result.split("\r\n");
result.length -= 1;
shell.CurrentDirectory = lastCurrentDirectory;
return result;
}
|
/**
* settings.js
*
* Control the settings page within the web application.
*/
$(document).ready(function() {
let data = $("#jsonData").data("json");
let table = $("#settingsTable");
table.DataTable({
order: [],
responsive: true,
paging: false,
info: false
});
// Export as JSON File.
$("#exportSettingsJson").off("click").click(function() {
exportToJsonFile(data, "settings");
});
});
|
/*
* @lc app=leetcode id=136 lang=javascript
*
* [136] Single Number
*/
// @lc code=start
/**
* @param {number[]} nums
* @return {number}
*/
var singleNumber = function(nums) {
return nums.reduce((i, j) => i ^ j)
};
// @lc code=end
singleNumber([4,1,2,1,2])
|
const express = require("express");
const router = express.Router();
const AuthController = require("../controllers/authController");
const v = require("../validators/user");
router.get("/", function (req, res, next) {
res.render("index", { navLocation: "main" });
});
router.get("/login", function (req, res, next) {
res.render("pages/login", { navLocation: "login" });
});
router.get("/register", function (req, res, next) {
res.render("pages/register", { navLocation: "register" });
});
router.post("/register", v.validate("register"), AuthController.register);
router.post("/login", v.validate("login"), AuthController.login);
router.get("/logout", AuthController.logout);
module.exports = router;
|
var __width = $device.info["screen"]["width"] - 5,
__height = $device.info['screen']["height"] - 78,
_page = 0;
$ui.render({
props: {
title: "少数派",
navBarHidden: true,
statusBarStyle: 0,
},
views: [{
type: "view",
props: {
id: "mainView",
},
layout: $layout.fill,
views: [{
type: "image",
props: {
id: "logo",
radius: 10,
src: "https://cdn.sspai.com/sspai/assets/img/favicon/icon_152.png"
},
layout: function (make, view) {
make.top.equalTo(30)
make.left.equalTo(15)
make.size.equalTo($size(50, 50))
}
},
{
type: "label",
props: {
id: "title",
text: "少数派",
font: $font("bold", 30),
align: $align.center
},
layout: function (make, view) {
make.left.equalTo($("logo").right).offset(5)
make.top.equalTo($("logo")).offset(7)
}
},
{
type: "button",
props: {
id: "searchIcon",
icon: $icon("023", $color("#e1e8f0"), $size(30, 30)),
bgcolor: $color("clear")
},
layout: function (make, view) {
make.top.equalTo($("logo")).offset(10)
make.right.inset(15)
},
events: {
tapped: function (sender) {
$input.text({
type: $kbType.default,
placeholder: "搜索",
handler: function (text) {
$http.get({
url: "https://sspai.com/api/v1/search?limit=10&type=article&offset=10&keyword=" + text,
handler: function (resp) {
let allData = resp.data
let cdnUrl = "https://cdn.sspai.com/"
for (var data in allData["list"]) {
let infors = allData["list"][data]
$("postList").insert({
indexPath: $indexPath(0, 0),
value: {
url: {
text: "https://sspai.com/" + infors["id"]
},
postTitle: {
text: infors["title"]
},
postImage: {
src: cdnUrl + infors["banner"]
}
}
}
)
}
}
})
}
})
}
}
},
{
type: "matrix",
props: {
id: "postList",
columns: 1,
itemHeight: 150,
spacing: 10,
showsVerticalIndicator: false,
template: {
views: [{
type: "view",
props: {
id: "postView",
radius: 15,
bgcolor: $color("#f4f4f4"),
textColor: $color("#abb2bf"),
align: $align.center,
font: $font(32)
},
views: [
{
type: "image",
props: {
id: "postImage",
radius: 15,
},
layout: function (make, view) {
make.centerX.equalTo()
make.size.equalTo($size($("postList").frame.width-20, 100))
}
},
{
type: "label",
props: {
id: "postTitle",
lines: 2,
font: $font(16),
},
layout: function (make, view) {
make.top.equalTo($("postImage").bottom).offset(5)
make.left.right.inset(10)
},
},
],
layout: $layout.fill
}]
}
},
layout: function (make) {
make.top.equalTo($("logo").bottom).offset(5)
make.centerX.equalTo()
make.size.equalTo($size(__width, __height))
},
events: {
didSelect: function (sender, indexPath, data) {
getNews(data["url"]["text"])
},
didReachBottom: function (sender) {
sender.endFetchingMore()
_page += 10
loadSspaiArticle(_page)
$device.taptic(0)
}
}
}
]
}]
})
loadSspaiArticle(_page)
function loadSspaiArticle(_page) {
$http.get({
url: "https://sspai.com/api/v1/articles?offset=" + _page + "&limit=10&type=recommend_to_home&sort=recommend_to_home_at&include_total=true",
header: {
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36"
},
handler: function (resp) {
let allData = resp.data
let cdnUrl = "https://cdn.sspai.com/"
for (var data in allData["list"]) {
let infors = allData["list"][data]
$("postList").insert({
indexPath: $indexPath(0, 0),
value: {
url: {
text: "https://sspai.com/" + infors["id"]
},
postTitle: {
text: infors["title"]
},
postImage: {
src: cdnUrl + infors["banner"]
}
}
}
)
}
}
})
}
function getNews(_url) {
$ui.push({
props: {
// navBarHidden: true,
statusBarStyle: 0,
},
views: [{
type: "web",
props: {
url: _url
},
layout: $layout.fill
}]
})
}
|
import express from "express";
import { Authorize } from "../middleware/authorize.js";
import _boardService from "../services/BoardService";
import _collaboratorService from "../services/CollaboratorService"
import { runInNewContext } from "vm";
//PUBLIC
export default class BoardsController {
constructor() {
this.router = express
.Router()
.use(Authorize.authenticated)
.get("", this.getAll)
.get("/:id", this.getById)
.post("", this.create)
.put("/:id", this.edit)
.delete("/:id", this.delete)
// COLLABORATORS
.get("/:boardId/collaborators", this.getCollaborators)
.post("/:boardId/collaborators/:collaboratorId", this.postCollaborators)
.delete("/:boardId/collaborators/:collaboratorId", this.deleteCollaborators)
.put("/:boardId/collaborators/:collaboratorId", this.putCollaborators)
.use(this.defaultRoute);
}
defaultRoute(req, res, next) {
next({ status: 404, message: "No Such Route" });
}
async getAll(req, res, next) {
try {
//only gets boards by user who is logged in
// let data = await _boardService.find({ user: req.session.uid })
let data = await _boardService.find();
return res.send(data);
} catch (err) {
next(err);
}
}
async getById(req, res, next) {
try {
let data = await _boardService.findOne({
_id: req.params.id
// user: req.session.uid
});
return res.send(data);
} catch (error) {
next(error);
}
}
async create(req, res, next) {
try {
req.body.user = req.session.uid;
let data = await _boardService.create(req.body);
return res.status(201).send(data);
} catch (error) {
next(error);
}
}
async edit(req, res, next) {
try {
let data = await _boardService.findOneAndUpdate(
{ _id: req.params.id },
req.body,
{ new: true }
);
if (data) {
return res.send(data);
}
throw new Error("invalid id");
} catch (error) {
next(error);
}
}
async delete(req, res, next) {
try {
await _boardService.findOneAndRemove({
_id: req.params.id,
user: req.session.uid
});
return res.send("Successfully deleted");
} catch (error) {
next(error);
}
}
// COLLABORATORS
async getCollaborators(req, res, next) {
try {
let boardId = req.params.boardId
let collaborators = await _collaboratorService
.find({ board: boardId }).populate('user')
return res.status(201).send(collaborators)
} catch (error) {
error.message = 'BoardControllers.js getCollaborators()'
next(error)
}
}
async postCollaborators(req, res, next) {
try {
let collaborator = req.body
let createdCollaborator = await _collaboratorService.create(collaborator)
return res.status(201).send(createdCollaborator)
} catch (error) {
error.message = 'BoardControllers.js postCollaborators()'
next(error)
}
}
async deleteCollaborators(req, res, next) {
try {
let collaboratorId = req.params.collaboratorId
let deletedCollaborator = await _collaboratorService.findOneAndDelete({_id: collaboratorId})
return res.status(201).send(deletedCollaborator)
} catch (error) {
error.message = 'BoardControllers.js deleteCollaborators()'
next(error)
}
}
async putCollaborators(req, res, next) {
try {
let collaboratorId = req.params.collaboratorId
let collaborator = req.body
let editedCollaborator = await _collaboratorService.findOneAndUpdate(
{ _id: collaboratorId },
collaborator,
{ new: true }
)
return res.status(201).send(editedCollaborator)
} catch (error) {
error.message = 'BoardControllers.js putCollaborators()'
next(error)
}
}
}
|
import './index.scss';
import HomeController from './controller.js';
export default angular.module('app.home', [])
.controller('HomeController', HomeController)
.name
|
import LogoutButtonContainer from '@/web-client/components/LogoutButton/LogoutButtonContainer';
export default LogoutButtonContainer;
|
'use strict';
exports.BattlePokedex = {
torterra: {
inherit: true,
types: ["Grass", "Rock"],
},
absol: {
inherit: true,
types: ["Dark", "Fairy"],
},
absolmega: {
inherit: true,
types: ["Dark", "Fairy"],
},
blissey: {
inherit: true,
types: ["Normal", "Fairy"],
},
cresselia: {
inherit: true,
types: ["Psychic", "Fairy"],
},
samurott: {
inherit: true,
types: ["Water", "Fighting"],
},
musharna: {
inherit: true,
types: ["Psychic", "Fairy"],
},
spritzee: {
inherit: true,
types: ["Fairy", "Poison"],
},
stakataka: {
inherit: true,
types: ["Ghost", "Steel"],
},
staraptor: {
inherit: true,
types: ["Fighting", "Flying"],
},
misdreavus: {
inherit: true,
types: ["Ghost", "Fairy"],
},
mismagius: {
inherit: true,
types: ["Ghost", "Fairy"],
},
yanmega: {
inherit: true,
types: ["Bug", "Dragon"],
},
goodra: {
inherit: true,
types: ["Dragon", "Poison"],
},
xurkitree: {
inherit: true,
types: ["Electric", "Grass"],
},
servine: {
inherit: true,
types: ["Grass", "Dragon"],
},
serperior: {
inherit: true,
types: ["Grass", "Dragon"],
},
parasect: {
inherit: true,
types: ["Bug", "Ghost"],
abilities: {0: "Effect Spore", 1: "Cursed Body", H: "Prankster"},
},
mawile: {
inherit: true,
types: ["Dark", "Fairy"],
},
mawilemega: {
inherit: true,
types: ["Dark", "Fairy"],
},
vespiquen: {
inherit: true,
types: ["Bug", "Poison"],
abilities: {0: "Poison Point", 1: "Intimidate", H: "Prankster"},
},
lugia: {
inherit: true,
types: ["Water", "Dragon"],
},
rotomfan: {
inherit: true,
types: ["Electric", "Steel"],
},
granbull: {
inherit: true,
types: ["Fairy", "Dark"],
abilities: {0: "Intimidate", 1: "Strong Jaw", H: "Rattled"},
},
celebi: {
inherit: true,
types: ["Grass", "Fairy"],
},
jirachi: {
inherit: true,
types: ["Steel", "Fairy"],
},
manaphy: {
inherit: true,
types: ["Water", "Fairy"],
},
phione: {
inherit: true,
types: ["Water", "Fairy"],
},
victini: {
inherit: true,
types: ["Fire", "Fairy"],
},
lycanroc: {
inherit: true,
types: ["Rock", "Normal"],
abilities: {0: "Rock Head", 1: "Sand Rush", H: "Adaptability"},
},
lycanrocmidnight: {
inherit: true,
types: ["Rock", "Dark"],
abilities: {0: "Keen Eye", 1: "Vital Spirit", H: "Adaptability"},
},
lycanrocdusk: {
inherit: true,
types: ["Rock", "Fire"],
abilities: {0: "Tough Claws", 1: "Technician", H: "Adaptability"},
},
deerling: {
num: 585,
species: "Deerling",
baseForme: "Spring",
types: ["Normal", "Grass"],
baseStats: {hp: 60, atk: 60, def: 50, spa: 40, spd: 50, spe: 75},
abilities: {0: "Chlorophyll", 1: "Sap Sipper", H: "Serene Grace"},
heightm: 0.6,
weightkg: 19.5,
color: "Pink",
evos: ["sawsbuck"],
eggGroups: ["Field"],
},
deerlingspring: {
num: 585,
species: "Deerling-Spring",
baseSpecies: "Deerling",
forme: "Spring",
formeLetter: "S",
types: ["Fairy", "Grass"],
baseStats: {hp: 60, atk: 60, def: 50, spa: 40, spd: 50, spe: 75},
abilities: {0: "Chlorophyll", 1: "Sap Sipper", H: "Misty Surge"},
heightm: 0.6,
weightkg: 19.5,
color: "Pink",
evos: ["sawsbuck"],
eggGroups: ["Field"],
},
};
|
(function(){
angular
.module('everycent.budgets')
.directive('ecIncomeListEditor', ecIncomeListEditor);
function ecIncomeListEditor(){
var directive = {
restrict:'E',
templateUrl: 'app/budgets/ec-income-list-editor-directive.html',
scope: {
budget: '='
},
controller: controller,
controllerAs: 'vm',
bindToController: true
};
return directive;
}
controller.$inject = ['UtilService', 'LookupService', 'StateService', 'BudgetsService', 'ReferenceService'];
function controller(UtilService, LookupService, StateService, BudgetsService, ReferenceService){
var vm = this;
vm.isEditMode = false;
vm.state = StateService;
vm.ref = ReferenceService;
vm.util = UtilService;
vm.addNewIncome = addNewIncome;
vm.markForDeletion = markForDeletion;
vm.switchToEditMode = switchToEditMode;
vm.switchToViewMode = switchToViewMode;
vm.cancelEdit = cancelEdit;
activate();
function activate(){
LookupService.refreshList('bank_accounts').then(function(bankAccounts){
vm.bankAccounts = bankAccounts;
});
}
function addNewIncome(){
BudgetsService.addNewIncome(vm.budget);
}
function markForDeletion(income, isDeleted){
income.deleted = isDeleted;
}
function switchToEditMode(){
vm.originalIncomes = angular.copy(vm.budget.incomes);
vm.isEditMode = true;
}
function switchToViewMode(){
vm.isEditMode = false;
}
function cancelEdit(){
vm.budget.incomes = vm.originalIncomes;
vm.isEditMode = false;
}
}
})();
|
import Vue from "vue";
import VueRouter from "vue-router";
import store from "../store";
import routes from "./routes";
Vue.use(VueRouter);
const router = new VueRouter({
mode: "history",
base: process.env.BASE_URL,
routes
});
const getTitleByRouteName = routeName => {
return {
Authorization: "Авторизация",
User: "Личный кабинет",
NotFound: "Страница не найдена",
ForgotPassword: "Забыл пароль",
Registration: "Регистрация"
}[routeName];
};
router.afterEach(to => {
document.title = getTitleByRouteName(to.name);
if (
to.path === "/" ||
to.path === "/forgotpassword" ||
to.path === "/registration"
) {
store.commit("profile/logOutOfProfile");
}
});
router.beforeEach((to, from, next) => {
if (to.path === "/user" && !store.getters["profile/getSuccess"]) {
next({ name: "Authorization" });
} else {
next();
}
});
export default router;
|
import React, { Component } from 'react';
import Form from './UI/Form';
import Body from '../components/UI/Body/Body';
import About from './UI/About'
import { Route, withRouter } from 'react-router-dom';
class Routing extends Component {
render() {
console.log(this.props);
return (
<div>
<div>
<Route path="/"exact component={Form} />
<Route path="/Form" exact component={Form} />
<Route path="/ProductList" exact component={Body} />
<Route path="/About" exact component={About} />
{/* <Route path="/about" render={() => <h1>This is about with non-exact </h1>} /> */}
</div>
</div>
)
}
}
export default withRouter(Routing);
|
import React, { useState } from "react";
import Clicks from "./Clicker/Clicks";
function App() {
const [clicks, setClicks] = useState(0);
function addClick() {
setClicks(clicks + 1);
}
return (
<div className="wrapper">
<Clicks clicks={clicks} addClick={addClick} />
</div>
);
}
export default App;
|
// remove some internal implementation details, i.e. the "tokens" array on the emoji object
// essentially, convert the emoji from the version stored in IDB to the version used in-memory
export function cleanEmoji (emoji) {
if (!emoji) {
return emoji
}
delete emoji.tokens
if (emoji.skinTones) {
const len = emoji.skinTones.length
emoji.skins = Array(len)
for (let i = 0; i < len; i++) {
emoji.skins[i] = {
tone: emoji.skinTones[i],
unicode: emoji.skinUnicodes[i],
version: emoji.skinVersions[i]
}
}
delete emoji.skinTones
delete emoji.skinUnicodes
delete emoji.skinVersions
}
return emoji
}
|
import React from 'react';
import { Link, withRouter } from 'react-router-dom';
import { useSelector, useDispatch } from 'react-redux';
import { actLogout } from 'containers/shared/Authentication/module/action';
import './Header.scss';
function Header(props) {
const { currentUser } = useSelector(state => state.authReducer); // mapStatetoProps get user login info
const dispatch = useDispatch(); // mapDispatchToProps
const handleLogout = currentUser => {
dispatch(actLogout(currentUser))
props.history.push('/');
};
return (
<div>
<nav className="navbar navbar-expand-sm navbar-light">
<Link className="navbar-brand" to="/">
<img src="../../../logo_Horrizontal_Movie_Project.png" alt="Logo" width="100px" />
</Link>
<button className="navbar-toggler d-lg-none" type="button" data-toggle="collapse" data-target="#collapsibleNavId" aria-controls="collapsibleNavId" aria-expanded="false" aria-label="Toggle navigation">
<span className="navbar-toggler-icon" />
</button>
<div className="collapse navbar-collapse" id="collapsibleNavId">
<ul className="navbar-nav ml-auto mt-2 mt-lg-0">
<li className="nav-item active">
<Link className="nav-link" to="/">Home</Link>
</li>
<li className="nav-item">
<Link className="nav-link" to="/theater">Theater</Link>
</li>
<li className="nav-item">
<Link className="nav-link" to="/review">Review</Link>
</li>
<li className="nav-item">
<Link className="nav-link" to="/about">About</Link>
</li>
{currentUser ? (
<li className="nav-item dropdown">
<a href="/" className="nav-link dropdown-toggle text-truncate" data-toggle="dropdown" role="button">{currentUser.taiKhoan}</a>
<div className="dropdown-menu dropdown-menu-sm-right text-center">
<Link className="dropdown-item" to="/client">Client Info</Link>
{currentUser.maLoaiNguoiDung === 'QuanTri' ? <Link className="dropdown-item" to="/admin">To Admin Page</Link> : null}
<a className="dropdown-item" href="/" onClick={handleLogout}
>Logout</a>
</div>
</li>
) : (
<li className="nav-item" style={{minWidth: 80}}>
<Link className="nav-link" to="/login">Login</Link>
</li>
)}
</ul>
</div>
</nav>
</div>
)
}
export default withRouter(Header);
|
import express from 'express';
import commentController from '../../controllers/commentController';
import auth from '../../middlewares/auth';
import validationComments from '../../helpers/commentValidation';
import logout from '../../middlewares/logout';
import checkUser from '../../middlewares/checkUser';
import isUserAllowed from '../../middlewares/checkUserPermissions';
import LikeDislikeComments from '../../controllers/likeDislikeComment';
const router = express.Router();
const { logoutToken } = logout;
// routes that don't need authentication
router.get('/articles/:slug', commentController.getComments);
router.put('/articles/:id', auth.checkAuthentication, logoutToken, validationComments.commentValidation, checkUser.isCommentOwner, commentController.editComment);
router.get('/articles/edit/:id', commentController.getEditComment);
// check user's permissions route
router.use('/', auth.checkAuthentication, isUserAllowed.checkCommentsPermissions);
router.post('/articles/:slug', logoutToken, validationComments.commentValidation, commentController.createrComment);
router.delete('/articles/:slug/:id', logoutToken, checkUser.isCommentOwner, commentController.deleteComment);
// routes for liking a comment
router.post('/like/comment/:id', auth.checkAuthentication, isUserAllowed.checkLikeDislikePermissions, LikeDislikeComments.likeComment);
router.post('/dislike/comment/:id', auth.checkAuthentication, isUserAllowed.checkLikeDislikePermissions, LikeDislikeComments.dislikeComment);
export default router;
|
import Timeline from '../../../../../models/im/timeline'
import { tableColumnsByDomain } from '../../../../../scripts/utils/table-utils'
import { longText, yesNo } from '../../../../../scripts/utils/table-renders'
import AppRoutes from '../../../../../configs/AppRoutes'
import { toEmotion } from '../../../../../scripts/utils/misc'
const width = App.options.styles.table.width
import { parseUrl } from '../../../../../scripts/utils/url'
const { query } = parseUrl(location.href, true)
const moment = require('moment')
const isProfile = query.type === 'profile'
const options = {
'publisher.nickname': {
width: width.w_12
},
'publisher.customID': {
title: '发布者微信号',
width: width.w_12,
render(h, context) {
return <span>{context.row.publisher.customID || '-'}</span>
}
},
'publisher.platformUid': {
title: '发布者微信ID',
width: width.w_12,
render(h, context) {
if (isProfile) {
return <a onClick={() => { App.push(AppRoutes.Profile.id(context.row.profile.id, context.row.profile.nickname)) }}>{context.row.publisher.platformUid}</a>
} else {
const onClick = async() => {
App.push(AppRoutes.Relation._(context.row.profile.contactID, context.row.publisher.id, context.row.publisher.nickname))
}
return <a onClick={onClick}>{context.row.publisher.platformUid}</a>
}
}
},
'content': {
width: width.w_18,
ellipsis: true,
render(h, context) {
const content = toEmotion(context.row.content)
return longText.call(this, h, context, content, true)
}
},
'detail': {
title: '朋友圈详情',
width: width.w_8,
after: 'content',
render(h, context) {
const row = context.row
const id = row.publisher.id
const date = new Date(row.publishTime).getTime() + 3000
return <a onClick={() => { App.push(AppRoutes.Timeline._(id, date, row.profile.contactID, row.publisher.nickname)) }}>详情</a>
}
},
'likeCount': {
width: width.w_10,
sortable: true,
render(h, context) {
return <span>{context.row.likeCount || 0}</span>
}
},
'commentCount': {
width: width.w_10,
sortable: true,
render(h, context) {
return <span>{context.row.commentCount || 0}</span>
}
},
'replyCount': {
width: width.w_10,
sortable: true,
render(h, context) {
return <span>{context.row.replyCount || 0}</span>
}
},
'isPrivate': false,
'location': {
width: width.w_16,
render(h, context) {
const row = context.row
let location = ''
if (row.location) {
location = row.location.city + row.location.poiName + row.location.poiAddress
}
return `<span>${location}</span>`
}
},
'publishTime': {
width: width.w_12,
sortable: true,
render(h, context) {
return <span>{moment(context.row.publishTime).format('YYYY-MM-DD HH:mm:ss') || ""}</span>
}
},
'ctime': {
width: width.w_12,
sortable: true
,render(h, context) {
return <span>{moment(context.row.ctime).format('YYYY-MM-DD HH:mm:ss') || ""}</span>
}
}
}
if (!isProfile) {
options['profile.customID'] = {
title: '运营微信号',
width: width.w_12,
after: 'detail',
render(h, context) {
return <span>{context.row.profile.customID || '-'}</span>
}
}
options['profile.platformUid'] = {
title: '运营微信ID',
width: width.w_12,
after: 'profile.customID',
render(h, context) {
return <a onClick={() => { App.push(AppRoutes.Profile.id(context.row.profile.id, context.row.profile.nickname)) }}>{context.row.profile.platformUid}</a>
}
}
options['profile.nickname'] = {
title: '运营号昵称',
width: width.w_12,
after: 'profile.platformUid',
render(h, context) {
return <a onClick={() => { App.push(AppRoutes.Profile.id(context.row.profile.id, context.row.profile.nickname)) }}>{context.row.profile.nickname}</a>
}
}
}
export default tableColumnsByDomain(Timeline, options)
|
var crypt__gpgme_8c =
[
[ "CryptCache", "structCryptCache.html", "structCryptCache" ],
[ "CRYPT_KV_VALID", "crypt__gpgme_8c.html#a7f025aa4ac8da85d0115e1274836691a", null ],
[ "CRYPT_KV_ADDR", "crypt__gpgme_8c.html#ac5edad591931f278fb06aa54cdb073cc", null ],
[ "CRYPT_KV_STRING", "crypt__gpgme_8c.html#a1a64fb7012781a2aae80380af9e670f4", null ],
[ "CRYPT_KV_STRONGID", "crypt__gpgme_8c.html#a8dcd36ecf50c01ef2daf5722bd06fd99", null ],
[ "CRYPT_KV_MATCH", "crypt__gpgme_8c.html#aea367f3fa19d93c3c082c35723f13cff", null ],
[ "PKA_NOTATION_NAME", "crypt__gpgme_8c.html#a7808a5649f1126b2c55383593dc453d6", null ],
[ "_LINE_COMPARE", "crypt__gpgme_8c.html#a41f5cf1079121bc1fbc0c6d1a5c152c8", null ],
[ "MESSAGE", "crypt__gpgme_8c.html#affb41485e4cf045fe3f34a388846ec1d", null ],
[ "SIGNED_MESSAGE", "crypt__gpgme_8c.html#a704d35681bc3f3a349721e2c69426405", null ],
[ "PUBLIC_KEY_BLOCK", "crypt__gpgme_8c.html#aa313b6df071b5718005a87f7e33d2da6", null ],
[ "BEGIN_PGP_SIGNATURE", "crypt__gpgme_8c.html#a7038e282b0c74f4a98cdb3bd9ecfd3c0", null ],
[ "is_pka_notation", "crypt__gpgme_8c.html#acdcdf90f5684da72dc5c8d26b8d1b0b9", null ],
[ "redraw_if_needed", "crypt__gpgme_8c.html#acde3260a9e30d9ffd4fa5a62f19620a9", null ],
[ "crypt_keyid", "crypt__gpgme_8c.html#ab94f2568d1c488ad12e2fda7e3e158ff", null ],
[ "crypt_long_keyid", "crypt__gpgme_8c.html#ae91c3b5350f6fff03c9723cfbd98122d", null ],
[ "crypt_short_keyid", "crypt__gpgme_8c.html#a2f4afb10266ff41d2325610047e3ddb1", null ],
[ "crypt_fpr", "crypt__gpgme_8c.html#ab2dbaf863588ff5afe1a42f51436e4d9", null ],
[ "crypt_fpr_or_lkeyid", "crypt__gpgme_8c.html#afa1d67803d96d8fa8b995775d2a88555", null ],
[ "crypt_copy_key", "crypt__gpgme_8c.html#aa2835b1fc6aaafedee22fafa9f2365e5", null ],
[ "crypt_key_free", "crypt__gpgme_8c.html#ae007f214cde6d7245c8a5ca70da0e4de", null ],
[ "crypt_id_is_strong", "crypt__gpgme_8c.html#a62e8dd3b32254251fb76bd1969a3403d", null ],
[ "crypt_id_is_valid", "crypt__gpgme_8c.html#a3e2ecd88211e846a6f486f1a7df1aa32", null ],
[ "crypt_id_matches_addr", "crypt__gpgme_8c.html#a629d74d88f1e5bf918c2b836d4e6ada9", null ],
[ "create_gpgme_context", "crypt__gpgme_8c.html#a54ca8638b13c6da904a48009a8bba358", null ],
[ "create_gpgme_data", "crypt__gpgme_8c.html#a433e35eb7b66902025d1a6eced7c17c8", null ],
[ "body_to_data_object", "crypt__gpgme_8c.html#a5f88576e041b52a5e0196a77d808ad74", null ],
[ "file_to_data_object", "crypt__gpgme_8c.html#a9e4c3751a7e9290b83db346a58f9fc95", null ],
[ "data_object_to_stream", "crypt__gpgme_8c.html#a85ea55200935f18e5e9f04190670038d", null ],
[ "data_object_to_tempfile", "crypt__gpgme_8c.html#ae5c6e51af8b5c1801ba342d6a57a6510", null ],
[ "recipient_set_free", "crypt__gpgme_8c.html#ae29b7beb9bd3db9cd61fae682a2a4bf9", null ],
[ "create_recipient_set", "crypt__gpgme_8c.html#a3c4ecb27b11ac6e5a483518ab703ab6c", null ],
[ "set_signer_from_address", "crypt__gpgme_8c.html#ae3101457957df3ab336ba0f6cba79fd0", null ],
[ "set_signer", "crypt__gpgme_8c.html#aa5a70f753ba6cf97e2c92685aa3b8f27", null ],
[ "set_pka_sig_notation", "crypt__gpgme_8c.html#a0a360c190938728cf8cbc2ee1befa057", null ],
[ "encrypt_gpgme_object", "crypt__gpgme_8c.html#ae42a1cf42ee414b6492aab77874a842c", null ],
[ "get_micalg", "crypt__gpgme_8c.html#a8394b79a9ee75bfdee31a249225de4c9", null ],
[ "print_time", "crypt__gpgme_8c.html#a652fe0cf086f7155b24eb933f6544bb7", null ],
[ "sign_message", "crypt__gpgme_8c.html#a93c5f228bb32a579b45887c66df5b8dd", null ],
[ "pgp_gpgme_sign_message", "crypt__gpgme_8c.html#a463e134af306836ff0e12415a6a740c5", null ],
[ "smime_gpgme_sign_message", "crypt__gpgme_8c.html#a0a75fedd2aff0b209ba1adf06099d8c8", null ],
[ "pgp_gpgme_encrypt_message", "crypt__gpgme_8c.html#afc00d1c96caccee32eb480e8aa31078b", null ],
[ "smime_gpgme_build_smime_entity", "crypt__gpgme_8c.html#a818613e3494585ba4b974d8d7e7befb3", null ],
[ "show_sig_summary", "crypt__gpgme_8c.html#a123a620e8b1711536a4675ff5e5dd622", null ],
[ "show_fingerprint", "crypt__gpgme_8c.html#a537b23583894a4e6569cff4ee1c971ef", null ],
[ "show_one_sig_validity", "crypt__gpgme_8c.html#a8d8ff28a3e56cfb42f037946771ef4e1", null ],
[ "print_smime_keyinfo", "crypt__gpgme_8c.html#a4f6781f9c39997951f4b5a5fcca555fe", null ],
[ "show_one_sig_status", "crypt__gpgme_8c.html#a90bb1055f235c6de5186089f8795d443", null ],
[ "verify_one", "crypt__gpgme_8c.html#a490d3344cd29fb3466bc7868e4b26c87", null ],
[ "pgp_gpgme_verify_one", "crypt__gpgme_8c.html#a5fba8c4b91a4fa20d6ed27e75e5b2573", null ],
[ "smime_gpgme_verify_one", "crypt__gpgme_8c.html#a9760878f52cf39be1f8794d80015fe5c", null ],
[ "decrypt_part", "crypt__gpgme_8c.html#a06057059d161b58e6b17c6b00fe54ab6", null ],
[ "pgp_gpgme_decrypt_mime", "crypt__gpgme_8c.html#a473ba915ca379bb659a754b8792f2cfa", null ],
[ "smime_gpgme_decrypt_mime", "crypt__gpgme_8c.html#a53340a4fb66456050ebb2b14675240af", null ],
[ "pgp_gpgme_extract_keys", "crypt__gpgme_8c.html#acf99c22e68257d9ff91a5cefb5590370", null ],
[ "line_compare", "crypt__gpgme_8c.html#ad209b4fa3d73026e1aeaff676c42fb4e", null ],
[ "pgp_check_traditional_one_body", "crypt__gpgme_8c.html#a88d302145d6de54860223e5e2b726b21", null ],
[ "pgp_gpgme_check_traditional", "crypt__gpgme_8c.html#ae99b605a5ceeebc100ff10226857f84e", null ],
[ "pgp_gpgme_invoke_import", "crypt__gpgme_8c.html#a9b73f1b32f324051fd9c955173f4acec", null ],
[ "copy_clearsigned", "crypt__gpgme_8c.html#ab66d572be0c35eeb6c5247ecd94b2fcc", null ],
[ "pgp_gpgme_application_handler", "crypt__gpgme_8c.html#af9f3a30e035954c5624c3d673819a597", null ],
[ "pgp_gpgme_encrypted_handler", "crypt__gpgme_8c.html#a49d3535b68adb1b38c4599091d04a7b2", null ],
[ "smime_gpgme_application_handler", "crypt__gpgme_8c.html#a6a916c84aff7214350875cce78777fa5", null ],
[ "key_check_cap", "crypt__gpgme_8c.html#abb291e3ef82be0b81dd87945790b1ab8", null ],
[ "list_to_pattern", "crypt__gpgme_8c.html#a6ba2abd89f24052913b556755ca41667", null ],
[ "get_candidates", "crypt__gpgme_8c.html#aef0516e3d7f7c2d43567034cb67c8e71", null ],
[ "crypt_add_string_to_hints", "crypt__gpgme_8c.html#a6413c7e6bbfa71d8114053a970ae2ff2", null ],
[ "crypt_getkeybyaddr", "crypt__gpgme_8c.html#ad1fef6cc1938f167f62e9aee7a969e57", null ],
[ "crypt_getkeybystr", "crypt__gpgme_8c.html#ad973b70036b65c94f40a43a08b9b9c93", null ],
[ "crypt_ask_for_key", "crypt__gpgme_8c.html#ad4d211dd6072df61ecfc4c7311f1aaec", null ],
[ "find_keys", "crypt__gpgme_8c.html#aa15024a537ac84b348d4f4dd7e3fc7bf", null ],
[ "pgp_gpgme_find_keys", "crypt__gpgme_8c.html#aac6076878575fadf2abb93c6a287eb45", null ],
[ "smime_gpgme_find_keys", "crypt__gpgme_8c.html#a5856a7fc81449494aa13e8df6bbdf3c2", null ],
[ "mutt_gpgme_select_secret_key", "crypt__gpgme_8c.html#a2e8df329d00791c453eb6b3f60eabfdf", null ],
[ "pgp_gpgme_make_key_attachment", "crypt__gpgme_8c.html#ab3031c1c6cd431efc8fc3b90607c042d", null ],
[ "init_common", "crypt__gpgme_8c.html#a145bf0426df849dc84a86732a6f679f1", null ],
[ "init_pgp", "crypt__gpgme_8c.html#aead4e2c25ab6b1ea42f818cc243cd2d1", null ],
[ "init_smime", "crypt__gpgme_8c.html#aab62fa83c30ed25209d5fac293cdb59d", null ],
[ "pgp_gpgme_init", "crypt__gpgme_8c.html#a7061521ecb51237cbbc557440353af39", null ],
[ "smime_gpgme_init", "crypt__gpgme_8c.html#a19bf09fde57098f4d77a85b4b73ca90e", null ],
[ "gpgme_send_menu", "crypt__gpgme_8c.html#a196790f245ce25f9335f28895b3911dd", null ],
[ "pgp_gpgme_send_menu", "crypt__gpgme_8c.html#a10c76f6e46d6aa56d8d61f987d3a5d32", null ],
[ "smime_gpgme_send_menu", "crypt__gpgme_8c.html#ab703c2c2bc2c5cf3aa349d48db80232c", null ],
[ "verify_sender", "crypt__gpgme_8c.html#a10e8fb8f5b9b458202bc424762ff96cd", null ],
[ "smime_gpgme_verify_sender", "crypt__gpgme_8c.html#ac500aac211704a07899704a8c04fafb8", null ],
[ "pgp_gpgme_set_sender", "crypt__gpgme_8c.html#a192c41e1923f64fd284a130d27328cb2", null ],
[ "mutt_gpgme_print_version", "crypt__gpgme_8c.html#a6d2692bdc72ffa198bb8ca2a28cfa395", null ],
[ "id_defaults", "crypt__gpgme_8c.html#a485ef2ff923521bdcbe89c000d054349", null ],
[ "signature_key", "crypt__gpgme_8c.html#aa398a87ca5e6f5c08167d0d09fd39c26", null ],
[ "current_sender", "crypt__gpgme_8c.html#a520d4fde81c9ba2e916dc1d86ef1b80e", null ]
];
|
var indexSectionsWithContent =
{
0: "elmntw",
1: "elnt",
2: "mw"
};
var indexSectionNames =
{
0: "all",
1: "classes",
2: "files"
};
var indexSectionLabels =
{
0: "All",
1: "Classes",
2: "Files"
};
|
var globalCounter = 0;
function createBlobGlobbie(n, i, p){
let r = random(255);
let g = random(255);
let b = random(255);
let rad = random(10,40)
let s = generateBlobGlobbies(rad, random(0,360), random(30,50))
let ls = s;
let eyes = []
for(var i = 0; i < n; i++){
eyes.push(int(random(0,s.length)))
}
var glob = {color: color(r,g,b),
lerping: false,
moving: false,
moveTimer: random(0,300),
timeSinceMove: 0,
direction: .02 * getRandomSign(),
numEyes: n,
shape: ls,
lastShape: s,
intellegence: i,
bodyParts: [],
lastPos: p,
pos: p,
radius: rad,
alive: "",
center: [0,0],
eyeNodes: eyes};
blobglobbies.push(glob);
}
//create basic shape for blob globbie
function generateBlobGlobbies(radius, rotateAngle, points){
var pointsArr = [];
for(var i = 0; i < points; i++){
var x = radius * sin(rotateAngle);
var y = radius * cos(rotateAngle);
pointsArr.push([x, y, random(30,40)])
rotateAngle += points;
}
return pointsArr;
}
function drawBlobGlobbies(){
for(var i = 0; i < blobglobbies.length; i++){
if(blobglobbies[i].alive != "ded"){
//set style
fill(blobglobbies[i].color)
strokeWeight(0)
var xoff = blobglobbies[i].pos[0]
var yoff = blobglobbies[i].pos[1]
//add center circle
ellipse(xoff, yoff, rad + random(-1,1))
for(var s = 0; s < blobglobbies[i].shape.length; s++){
var x = blobglobbies[i].lastShape[s][0];
var y = blobglobbies[i].lastShape[s][1];
var rad = blobglobbies[i].lastShape[s][2];
exceedsBoundary(x + xoff, y + yoff, rad, i, s)
ellipse(x + xoff, y + yoff, rad + random(-1,1))
//randomly change stuff up
if(int(random(100)) == 1){
blobglobbies[i].lerping = true;
// console.log(blobglobbies[i].shape[s][0])
blobglobbies[i].shape[s][0] += random(-5,5)
// console.log(blobglobbies[i].shape[s][0] + "," + blobglobbies[i].lastShape[s][0])
blobglobbies[i].shape[s][1] += random(-5,5)
blobglobbies[i].shape[s][2] += random(-5,5)
// console.log("----------------")
}
if(blobglobbies[i].lerping)
lerpGlobbie(i)
if(globalCounter >= 1000){
shrinkDown(i, s)
globalCounter = 0;
}
//check if we should move a globbie
if(!blobglobbies[i].moving && blobglobbies[i].timeSinceMove >= blobglobbies[i].moveTimer){
blobglobbies[i].moving = true;
blobglobbies[i].timeSinceMove = 0;
//randomly change direction
if(int(random(0,20)) % 2 == 0)
blobglobbies[i].direction *= -1;
}
if(blobglobbies[i].moving){
//if too close to edge, change direction
if(blobglobbies[i].pos[0] + 50 >= width || blobglobbies[i].pos[0] - 50 <= 0){
blobglobbies[i].direction *= -1;
}
blobglobbies[i].pos[0] += blobglobbies[i].direction;
//add some Y direction noise in
if(blobglobbies[i].pos[1] >= horizon || blobglobbies[i].pos[1] <= height){
//only do this rarely
if(int(random(0,100)) % 7 ==0){
//stop globbies from going under screen
if(blobglobbies[i].pos[1] + 50 >= height)
blobglobbies[i].pos[1] += -2
else if(blobglobbies[i].pos[1] - 30 <= horizon)
blobglobbies[i].pos[1] += 2
else
blobglobbies[i].pos[1] += int(random(-2,2))
}
}
if(blobglobbies[i].timeSinceMove >= blobglobbies[i].moveTimer){
blobglobbies[i].moving = false
blobglobbies[i].timeSinceMove = 0;
//set a new moveTimer length
blobglobbies[i].moveTimer = random(50,300)
}
}
}
globalCounter++;
//add mouth with a little jitter
image(mouth, xoff + random(-1,1), yoff + random(-1,1))
drawEyesBlobGlobbies(i)
}
blobglobbies[i].timeSinceMove++;
}
}
//smooth out what changes
function lerpGlobbie(i){
for(var s = 0; s < blobglobbies[i].shape.length; s++){
var a = blobglobbies[i].shape[s][0]
var b = blobglobbies[i].lastShape[s][0]
if(a != b){
var x = lerp(blobglobbies[i].lastShape[s][0], blobglobbies[i].shape[s][0], .2)
var y = lerp(blobglobbies[i].lastShape[s][1], blobglobbies[i].shape[s][1], .2)
var r = lerp(blobglobbies[i].lastShape[s][2], blobglobbies[i].shape[s][2], .2)
blobglobbies[i].lastShape[s][0] = x;
blobglobbies[i].lastShape[s][0] = y;
blobglobbies[i].lastShape[s][0] = r;
//if any lerping has fully completed, stop lerping
if(x == blobglobbies[i].shape[s][0] || y == blobglobbies[i].shape[s][1] || r == blobglobbies[i].shape[s][2])
blobglobbies[i].lerping = false;
}
}
}
//draw eyes on globbies
function drawEyesBlobGlobbies(i){
for(var j = 0; j < blobglobbies[i].eyeNodes.length; j++){
var x = blobglobbies[i].pos[0] - blobglobbies[i].shape[blobglobbies[i].eyeNodes[j]][0];
var y = blobglobbies[i].pos[1] - blobglobbies[i].shape[blobglobbies[i].eyeNodes[j]][1];
image(eye, x, y)
}
}
function addCircle(i){
if(blobglobbies[i].shape.length <= 150){
let x = random(-50,50)
let y = random(-50,50)
let r = random(5,30)
blobglobbies[i].shape.push(x,y,r)
blobglobbies[i].lastShape.push(x,y,r)
//add noise
for(var j = 0; j < blobglobbies[i].shape.length; j++){
blobglobbies[i].lastShape[j] = [blobglobbies[i].lastShape[j][0] + random(-5,5), blobglobbies[i].lastShape[j][1] + random(-5,5), blobglobbies[i].lastShape[j][2] + random(-5,5)]
blobglobbies[i].shape[j] = [blobglobbies[i].shape[j][0] + random(-5,5), blobglobbies[i].shape[j][1] + random(-5,5), blobglobbies[i].shape[j][2] + random(-5,5)]
}
} else{
//if theres already at least 150 circles, don't add more, just add noise (stronger)
for(var j = 0; j < blobglobbies[i].shape.length; j++){
blobglobbies[i].lastShape[j] = [blobglobbies[i].lastShape[j][0] + random(-20,20), blobglobbies[i].lastShape[j][1] + random(-20,20), blobglobbies[i].lastShape[j][2] + random(-10,10)]
blobglobbies[i].shape[j] = [blobglobbies[i].shape[j][0] + random(-20,20), blobglobbies[i].shape[j][1] + random(-20,20), blobglobbies[i].shape[j][2] + random(-10,10)]
}
}
}
//squish the circles back in
function exceedsBoundary(x,y,r, i, s){
if (x > width - r || x < r || y > height - r || y < r) {
//check x sign
if(Math.sign(blobglobbies[i].shape[s][0]) == -1){
blobglobbies[i].shape[s][0] += 3;
} else{
blobglobbies[i].shape[s][0] -= 3;
}
//check y sign
if(Math.sign(blobglobbies[i].shape[s][1]) == -1){
blobglobbies[i].shape[s][1] += 3;
} else{
blobglobbies[i].shape[s][1] -= 3;
}
blobglobbies[i].shape[s] = [0,0,r - 2]
}
var x2 = blobglobbies[i].shape[s][0] + blobglobbies[i].pos[0];
var y2 = blobglobbies[i].shape[s][1] + blobglobbies[i].pos[1];
var dist = Math.sqrt( Math.pow((x-x2), 2) + Math.pow((y-y2), 2) )
if(dist > 100){
if(Math.sign(blobglobbies[i].shape[s][0]) == -1){
blobglobbies[i].shape[s][0] += 3;
} else{
blobglobbies[i].shape[s][0] -= 3;
}
if(Math.sign(blobglobbies[i].shape[s][1]) == -1){
blobglobbies[i].shape[s][1] += 3;
} else{
blobglobbies[i].shape[s][1] -= 3;
}
}
}
function shrinkDown(i, s){
if(Math.sign(blobglobbies[i].shape[s][0]) == -1){
blobglobbies[i].shape[s][0] += 3;
} else{
blobglobbies[i].shape[s][0] -= 3;
}
if(Math.sign(blobglobbies[i].shape[s][1]) == -1){
blobglobbies[i].shape[s][1] += 3;
} else{
blobglobbies[i].shape[s][1] -= 3;
}
blobglobbies[i].shape[s][2] -= 1;
}
function splatter(i){
for(var j = 0; j < blobglobbies[i].shape.length; j++){
if(Math.sign(blobglobbies[i].shape[j][0]) == -1)
blobglobbies[i].shape[j][0] += random(-20,0)
else
blobglobbies[i].shape[j][0] += random(0,20)
if(Math.sign(blobglobbies[i].shape[j][1]) == -1)
blobglobbies[i].shape[j][1] += random(-20,0)
else
blobglobbies[i].shape[j][1] += random(0,20)
blobglobbies[i].shape[j][2] -= random(10,20)
}
}
|
var app = angular.module('HorseApp', []);
|
import React, { useState, useEffect } from 'react';
import styles from './Header.scss'
import { connect } from 'dva';
import {withRouter} from "dva/router"
import { Select, Form, Menu, Dropdown, Modal, Button } from 'antd';
import { injectIntl } from 'react-intl';
// import styles from "./excel.scss"
const { Option } = Select;
const Header = (props) => {
console.log(props)
let { userInfo} = props
const { getFieldDecorator } = props.form;
let [loading, setLoading] = useState(false)
let [visible, setVisible] = useState(false)
//判断点击的下拉菜单是哪个
let showModal = (e) => {
let key = e.key * 1
switch (key) {
case 0:
setVisible(true)
break;
case 2:
props.history.push("/excel")
break;
case 3:
props.logOut()
break;
default:
break;
}
};
//点击确定的时候把用户信息改变
let handleOk = () => {
props.changeUserMsg({ user_id: userInfo.user_id, avatar: props.picUrl })
setLoading(false)
setVisible(false)
};
let handleCancel = () => {
setVisible(false)
};
//头像图片formdata上传
let replaceUserPic = (e) => {
let form = new FormData()
form.append(e.target.files[0].name, e.target.files[0])
props.changePic(form)
}
//下拉菜单的选项
const menu = (
<Menu style={{ width: '100%', borderRadius: '2px' }} onClick={showModal}>
<Menu.Item key="0">
<a target="_blank" rel="noopener noreferrer">
个人中心
</a>
</Menu.Item>
<Menu.Item key="1">
<a target="_blank" rel="noopener noreferrer">
我的班级
</a>
</Menu.Item>
<Menu.Divider />
<Menu.Item key="2">
Excel导入导出
</Menu.Item>
<Menu.Item key="3">
退出登录
</Menu.Item>
</Menu>
);
return (
<header className={styles.header}>
<div className={styles.header_logo}></div>
<div>
<div className={styles.header_user}>
<Form>
<div style={{ margin: '17px' }}>
<Form.Item>
{getFieldDecorator('exam_id', {
initialValue: "中文"
})(<Select
style={{ width: 100 }}
>
<Option value='中文' onClick={() => props.changeLocale(props.intl.locale = 'zh')}>{props.intl.locale = '中文'}</Option>
<Option value='英语' onClick={() => props.changeLocale(props.intl.locale = 'en')}>{props.intl.locale = 'English'}</Option>
<Option value='俄罗斯语' onClick={() => props.changeLocale(props.intl.locale = 'ru')}>{props.intl.locale = 'русский язык '}</Option>
<Option value='日语' onClick={() => props.changeLocale(props.intl.locale = 'ja')}>{props.intl.locale = '日本語'}</Option>
</Select>)}
</Form.Item>
</div>
</Form>
{/* 头像滑过下拉菜单 */}
<div className={styles.header_hove}>
<Dropdown overlay={menu} placement='bottomCenter'>
<a className="ant-dropdown-link">
<span className={styles.header_user_img}>
<img src={userInfo.avatar} />
</span>
<span>{userInfo.user_name}</span>
</a>
</Dropdown>
</div>
</div>
</div>
<Modal
visible={visible}
title="个人中心"
onOk={handleOk}
onCancel={handleCancel}
footer={[
<Button key="back" onClick={handleCancel}>
取消
</Button>,
<Button key="submit" type="primary" loading={loading} onClick={handleOk}>
确认
</Button>,
]}
>
<div className="user_pic">
<span>头像:</span>
<span><img src={props.picUrl ? props.picUrl: props.userInfo.avatar ? props.userInfo.avatar: 'https://cdn.nlark.com/yuque/0/2019/png/anonymous/1547609339813-e4e49227-157c-452d-be7e-408ca8654ffe.png?x-oss-process=image/resize,m_fill,w_48,h_48/format,png'} />
<input type="file" onChange={(e) => replaceUserPic(e)} /></span></div>
<div><span>用户名:</span><span>{userInfo.user_name}</span></div>
<div><span>身份名称:</span><span>{userInfo.identity_text}</span></div>
</Modal>
</header>
);
};
Header.propTypes = {
};
const mapStateToProps = state => {
return {
...state.login
}
}
const mapDispatchToProps = dispatch => {
return {
changeLocale: payload => {
dispatch({
type: 'global/updateLocale',
payload
})
},
changePic: payload => {
dispatch({
type: "login/changePic",
payload
})
},
changeUserMsg: payload => {
dispatch({
type: 'login/changeUserMsg',
payload
})
},
logOut:()=>{
dispatch({
type:'login/logout',
})
}
}
}
export default withRouter(injectIntl(connect(mapStateToProps, mapDispatchToProps)(Form.create()(Header))));
|
import Banner from '../Banner/Banner';
import './styles.css';
function Header() {
return (
<header className="header">
<Banner />
</header>
);
}
export default Header;
|
#!/usr/bin/env node
import * as cluster from "cluster";
import { cpus } from "os";
import { runner } from "./app";
const clusteringEnabled = (process.env.CLUSTERING || "false").toLowerCase() === "true";
const execute = () => runner();
const executeClustering = () => cluster.isMaster ? cpus().forEach(cluster.fork) : runner();
if (clusteringEnabled) {
executeClustering();
} else {
execute();
}
|
var express = require("express");
var mongoose = require("mongoose");
mongoose.Promise = global.Promise;
var path = require("path");
var bodyParser = require("body-parser");
var cookieParser = require("cookie-parser");
var session = require("express-session");
var flash = require("connect-flash");
var passport = require("passport");
var route = require("./routes");
var nev = require('email-verification')(mongoose);
// var setUpPassport = require('./config/passport');
require('./config/email-verification')(nev);
require('./config/passport')(passport,nev);
var setupPassport = require('./config/setuppassport');
var app = express();
setupPassport();
mongoose.connect("mongodb://localhost:27017/test", { useNewUrlParser: true });
app.set("port", process.env.PORT || 3000);
app.set("views", path.join(__dirname, "views"));
app.set("view engine", "ejs");
app.use(bodyParser.urlencoded({ extended: true }));
app.use(cookieParser());
app.use(session({
secret: "ASDKPOkdK1OKASDPOK@#!@$",
resave: true,
saveUninitialized: true
}));
/*
secret: 각 세션이 클라이언트에서 암호화되도록 함. 쿠키해킹방지
resave: 미들웨어 옵션, true하면 세션이 수정되지 않은 경우에도 세션 업데이트
saveUninitialized: 미들웨어 옵션, 초기화되지 않은 세션 재설정
*/
app.use(flash());
app.use(passport.initialize());
app.use(passport.session());
app.use('/', route);
app.listen(app.get("port"), function () {
console.log("Server started on port : " + app.get("port"));
});
|
const [timer, ajaxBusy, currentPage, ScrollHandler] = [Symbol(), Symbol(), Symbol(), Symbol()];
class BillboardController {
constructor($scope, $document, $timeout, MoviesApi, ScrollEvent) {
'ngInject';
Object.assign(this, {$scope, $document, $timeout, MoviesApi, ScrollEvent});
this[ScrollHandler] = this.ScrollEvent.$offsetTop.bind(this.ScrollEvent);
this.movies = [];
this[currentPage] = false;
this[ajaxBusy] = false;
this[timer] = false;
this.description = `Get the list of top rated movies. By default,
this list will only include movies that have 50 or more votes. This list refreshes every day.`;
this.activate();
}
activate() {
// 获取电影列表数据
this.$getMovies();
this.scrollEvent();
}
scrollEvent() {
this.$scope.$on('$destroy', () => {
angular.element(this.$document[0]).unbind('scroll');
this[ajaxBusy] = false;
});
angular.element(this.$document[0]).bind('scroll', () => {
if (this[timer]) this.$timeout.cancel(this[timer]);
this[timer] = this.$timeout(() => {
const loadingCondition = this[ScrollHandler]();
if (loadingCondition < 100 && !this[ajaxBusy]) {
this.$getMovies();
}
}, 1000);
});
}
$getMovies() {
if (this[ajaxBusy]) return;
this[ajaxBusy] = true;
const topRatedMoviesPromise = this.MoviesApi.$list({movie_type: 'top_rated', page: this[currentPage] || 1});
topRatedMoviesPromise.then((resp) => {
this.totalResults = resp.total_results;
this.movies = this.movies.concat(resp.results);
// 更新分页
this.totalItems = resp.total_results;
this[currentPage] = resp.page;
this[currentPage]++;
this[ajaxBusy] = false;
}, () => {
this[ajaxBusy] = false;
});
}
}
export default BillboardController;
|
(function (cjs, an) {
var p; // shortcut to reference prototypes
var lib={};var ss={};var img={};
lib.ssMetadata = [];
// symbols:
// helper functions:
function mc_symbol_clone() {
var clone = this._cloneProps(new this.constructor(this.mode, this.startPosition, this.loop));
clone.gotoAndStop(this.currentFrame);
clone.paused = this.paused;
clone.framerate = this.framerate;
return clone;
}
function getMCSymbolPrototype(symbol, nominalBounds, frameBounds) {
var prototype = cjs.extend(symbol, cjs.MovieClip);
prototype.clone = mc_symbol_clone;
prototype.nominalBounds = nominalBounds;
prototype.frameBounds = frameBounds;
return prototype;
}
(lib.Symbol5 = function(mode,startPosition,loop) {
this.initialize(mode,startPosition,loop,{});
// Layer_1
this.shape = new cjs.Shape();
this.shape.graphics.f("#FFFF66").s().p("AimCmQhEhFAAhhQAAhhBEhFQBFhEBhAAQBhAABFBEQBFBFAABhQAABhhFBFQhFBFhhAAQhhAAhFhFg");
this.shape.setTransform(23.5,23.5);
this.timeline.addTween(cjs.Tween.get(this.shape).wait(1));
}).prototype = getMCSymbolPrototype(lib.Symbol5, new cjs.Rectangle(0,0,47,47), null);
(lib.Symbol4 = function(mode,startPosition,loop) {
this.initialize(mode,startPosition,loop,{});
// Layer_1
this.shape = new cjs.Shape();
this.shape.graphics.f("#336600").s().p("AgOCIIgGgCQgCgCAAgFQAAgLACgFIAAgDIABgBIgBgOIAAg/QgPAAgOgEQgUgFgHgMQgEgHAAgQIAAgrQAAgQAFgGQAIgKAMAEQAMAEADASQACAJgCATQAAAJADAFQAEAHANAEIAAhdQAAgNADgIQAFgMAKgBQAMgBAGAOQAEAHAAARIAABZQADgDAGgBIAFgBQAEgBABgCQABgCAAgFIAAgSQAAgSAFgGQAFgGAIgBQAJgBAFAFQAHAHABAMIAAAVQAAAWgBAEQgGATgcAKQgRAEgIgFIgBBFIgBAQQAEAAACAFIABAAIAAAIIAAAEIAAADQgBAEgCABIgGACIgEADIgHABg");
this.shape.setTransform(283.2,69.6);
this.shape_1 = new cjs.Shape();
this.shape_1.graphics.f("#CC9966").s().p("AsvGZQgIgDABgGQgEABgDgFIgBgHQAAgIACgDQACgEAIgFQARgLAMgPQAFgEADAAIABAAIADgFQAFgHAAgEIAAgDIABAAQgBAFAAALQAAAFACACIAFACIAUADIAHgBIAFgDIAFgCQADgBABgEIAAgDIACAEQADAFgBAGQgBANgNAGQgEACgFACIgBAAIgIAHIgkAWQgKAGgFACIgIABIgEgBgEghEADZQhzgDhIgSQgXgFg8gTQg0gRgfgGQgigGiLgFQgWAAgUgCQhNgHgvgXQgKgFgGgHQgHgIAEgIIAEgEQAGgFALAAIAMABIAwgIIACgBIAOgJQAJgFATgIIAHgCQH0i/HzjlIAUgJQAEgOAJgCQAHgCAGAGIACAEQAFAIACAMQABANABBBQAAAwAJAdQAPAuApAlQAkAgA0AWQAhANBBASQBDATAfAMQAsARB5BDQBmA5BEAPQApAJAEAUQADASgVAKQgQAJgYAAIs/ATQh3ADhYAAQg+AAgwgBgAdQCyQgRgCgEgIQgFgJAJgKQAGgIAMgFQA9gaBqgIIDSgKQB9gFBSgRQBCgOBwglIBAgUQAjgLARgEQAegGAXAEIALADQAHADAEAFIABACQAEAGgDALIgGASIgDAWQgCAOgDAIQgGANgQAJQgKAGgUAGQgrAPgbAFQgRACgcABIguADQgNABgWAEIgjAFQggADhIgDQhOgCibACQhKABglACQg9AEgwALQghAJgSAEQgUAEgSAAIgNgBgAKlAmQgMgCgIgFQgKgHACgJQABgMAWgEIEkhGICagiQBjgVAugRQBOgdArgxIAMgNIADgDIACgCIAQAEQAGABADACIAIAGQAEACAKAAIAKgBIAVAGQAgAKA6AeIAiARQgBADACADQACADAEACQAIAEASAGIAUAFIABAAIgCAEQgEAHgHACQgEACgYADQgQABgWAJQgXAMgNAEQgeAMg1AFQhBAHgVAFQgaAGgsASQgyAUgVAGQgiAKgsADQgbADg2ACQiLAFhPAMIgMABIhTAOQgbADgXAAQgSAAgPgCg");
this.shape_1.setTransform(358.3,48.7);
this.shape_2 = new cjs.Shape();
this.shape_2.graphics.f("#CCCC99").s().p("AF1MJQgPgDgDgLQgCgKAKgJQiNAIibAEQjYAGldACQu5AGvMgNIjlgDQgngBgUgEQgYgFgRgKQhGAFhTAAQhIgBiIgHIhRgGQgugFgjgIQhvgbhvhZQh9hkAFhoQABgXAKgLQAGgHALgEIAUgGQAYgIAbgQQARgLAegXQAcgVAMgMQAWgTANgUQAbgrADhJQABgbgBg4QgBg1ACgdQAFheAnhEQAKgUAOgGQAIgDANABIAWAEIAvAEQAbADARAIQAIAEAPAMQAPALAJAEQASAIAkAAQBmAABmgOIgEAFQgEAHAHAJQAGAHAKAFQAvAWBNAHQAUACAWABQCLAEAiAHQAfAGA0AQQA8ATAXAGQBIASBzACQBzAEDKgFIM/gTQAYgBAQgIQAVgLgDgSQgEgUgpgJQhEgPhmg5Qh5hEgsgQQgfgMhDgTQhBgSghgOQg0gWgkggQgpglgPguQgJgdAAgvQgBhCgBgNQgCgMgFgIIgCgDQBHggApgPQBZgfBMgEQBqgECKAyQBPAeCdBFQDoBcEvAfQDYAWFRgFQDMgDGQgOIAggBIHKgQQA/gCAhACIALABIgMAMQgrAyhOAdQguARhjAUIiaAiIkkBGQgWAGgBAMQgCAJAKAHQAIAFAMACQAjAEAwgGIBTgNIAMgCQBPgLCLgGQA2gCAbgCQAsgFAigJQAVgGAygUQAsgTAagGQAVgFBBgGQA1gGAegLQANgFAXgLQAWgJAQgCQAYgCAEgCQAHgDAEgHIACgDQAKACAGAAQAeAIAlAEQAhADAzAAQBIAACpgGQCcgGBVACQEXAEC5BOQAeANAMAOIADAFIgLgDQgXgEgeAGQgRADgjALIhAAVQhwAmhCANQhSARh9AGIjSAJQhqAJg9AZQgMAGgGAIQgJAJAFAJQAEAJARACQAWACAdgGQASgDAhgJQAwgLA9gEQAlgDBKgBQCbgCBOADQBIADAggEIAjgFQAWgEANgBIAugCQAcgBARgDQAbgEArgPQAUgHAKgGQAQgJAGgNQADgHACgOIADgWIAGgTQADgLgEgHIgBgBIAFgBQB/gWDah1QB0g+A0gYQBfgrBQgSQBDgPAfAaQAWAUAIAyQAOBhgTB7QgKBDgkCZQghCNgKBOQgOB5AVBhQAJAuABAOQADAigNAWIgCACQACAaAAAVQAAAogOATQgQAWgnAHIgfAGQgSADgMAFIgSAJQgKAFgIACQgKADgPgBIofgCQgSgBgGgHIgPADQgMADgbABQmDATmCAGQjQAQh/AJQmGAZlxANIjFAFQhZADglADQhGAFg1AOQgLADgJAAIgHAAgARPKxIhVAGIEAgLQhfAChMADgAtSB3QADABAJgCQAFgCAKgGIAkgWIAIgGIABgBQAFgBAEgDQANgGABgMQABgHgDgFIgCgDIAAgEIgBgIIAAgBQgCgFgEABIABgQIAAhEQAJAFARgFQAcgJAFgUQABgEAAgXIABgVQgBgMgHgGQgGgFgIABQgIAAgFAGQgFAHAAARIAAASQAAAFgCACQgBACgDABIgGACQgFABgEADIAAhaQAAgQgDgIQgHgOgMABQgLACgEAMQgDAIAAANIAABcQgOgEgEgHQgCgFAAgIQABgTgBgKQgDgSgNgEQgLgEgIAKQgFAHAAAPIAAArQAAARAEAHQAHANATAEQAPAEAPABIAAA+IABAOIgBABIgBACIgBAAIAAAEQAAADgFAHIgDAFIgBAAQgDAAgFAFQgMAOgRALQgIAFgCAFQgCADAAAHIABAIQADAFAEgCQgBAHAIADg");
this.shape_2.setTransform(361.8,77.7);
this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.shape_2},{t:this.shape_1},{t:this.shape}]}).wait(1));
}).prototype = getMCSymbolPrototype(lib.Symbol4, new cjs.Rectangle(0,0,723.6,155.5), null);
(lib.Symbol3 = function(mode,startPosition,loop) {
this.initialize(mode,startPosition,loop,{});
// Layer_1
this.shape = new cjs.Shape();
this.shape.graphics.f("#998853").s().p("AyDM5QAEhkAnijIBLklQAYheAiiqQAjitAThLQA7jrBmiaIAEgCQAIgEAFgIQAEgHgDgFIAUgaQB1iVCHhdQC0h8DVgYQAzgGA0AAQG3AAE3GMQBOBkA5CMQAdBJAXBVIAMArQAUBPAiCpQAiCtAXBbQBYFdgPC1QgVEEjbgCQlCgBjmgxIifggQhXgPhfAAQiRAAk9A4QlNA7ivAFIgLABQjQAAAMkAg");
this.shape.setTransform(115.7,108.1);
this.timeline.addTween(cjs.Tween.get(this.shape).wait(1));
}).prototype = getMCSymbolPrototype(lib.Symbol3, new cjs.Rectangle(0,0,231.4,216.1), null);
(lib.Symbol2 = function(mode,startPosition,loop) {
this.initialize(mode,startPosition,loop,{});
// Layer_1
this.shape = new cjs.Shape();
this.shape.graphics.f("#444557").s().p("AAJBLIgJgFIAAgBQgEgCgCgEQgCgDAAgIIABghQAAgKgGgBIgGAIIgLARQgHAOgEAcIgPgDQgJgDgDgGIgDgLIgEgLIgCgMQgCgWADgPQACgQAFgIQAGgMATgLIAUgIIBIgMIAHgBQAKgBAEAAQABAIAIANQADAKgFAWIgJADQgHABgDACIgFAHIgLAWIgEAJIgBAMIABAuIgHAAQgMAAgJgDg");
this.shape.setTransform(8.9,38);
this.shape_1 = new cjs.Shape();
this.shape_1.graphics.f("#3C3D4D").s().p("AAJBVIgJgDIgHgFQgHgFgCgFQgDgFABgLQAAgMgBgEQgJARgCATQgCALgEACQgFADgHgDIgUgGQgGgBgCgDQgBgCgBgEIgFgRIgEgTIgBgTQAAgZAEgMIAHgQIAGgJQAEgEAGgEQAQgKAIgEQAIgDATgDIA6gJIAPgBIAAAAQAHgBAEADQAEACADAHIAAAAQAFARADAUIAAADQgCAQgJAGIgHADIgHAEQgEACgCAGIgLAWIgBANIAAApQAAAIgDACIgGACQgQgBgMgDgAgIATIAAAhQAAAIACADQABADAFADIAAAAIAJAGQALADAQgBIAAguIABgLIADgJIAMgXIAFgGQADgDAGgBIAJgCQAGgWgEgKQgHgOgCgHQgEAAgJABIgHABIhJAMIgTAIQgTALgHALQgFAIgCARQgCAPABAWIACALIAEAMIADALQADAFAKAEIAPADQAEgcAHgPIAKgRIAHgHQAFABAAAKg");
this.shape_1.setTransform(8.9,38);
this.shape_2 = new cjs.Shape();
this.shape_2.graphics.f("#000000").s().p("AgBCoQgCAAgGgFIgWgTQgMgMgCgMQgCgIACgQQAFgogBgvQAMADAQAAIAGgBQADgDAAgHIAAgoIABgNIAKgXQACgGAEgDIAHgDIAHgDQAJgGACgQIAAgDIABAJQADAVACAoQAGBmgFAzQgBAQgEAIQgEAJgIAJIgRAOQgHAFgEAAIgBgBgAAeiYQgDgHgEgCQgEgDgHAAIAFgDQAFgCADADIAFAOg");
this.shape_2.setTransform(14,45.6);
this.shape_3 = new cjs.Shape();
this.shape_3.graphics.f("#807145").s().p("Ai/E9QgHgBgKgJQgjgdgDgZQgBgHACgPQAEgrAAgpIAAgEIAKAEQABAvgFAoQgCAPACAIQACAMAMAMIAWAUQAGAFACAAQAFABAIgGIARgOQAIgIAEgJQAEgJABgPQAFgzgGhnQgCgogDgWIgBgJQgDgUgFgPIgFgPQgDgCgFACIgFADIAAAAIgPACQAFgIAFgEIAGgCIgCgBIABAAIAEgCIADgCIAAgBIACgCIAEgBQAUgDAggUIAwgdQAcgSAngkQATgQALgMIAYgeIBLhjQAGgHAEAAQADgBADACQADADgBADIgDADQgLAKgMAOQAVgFANAAQAWgBAOAJQANAJALARQAZApAEA8QACAogIBDQgGAzgGAfQgKAtgPAiQgNAegoA8IglA3QgRAagNAJQgVARgwAEIhFACIiJABIAAgCgABpkDIgmA0QgsA6g8ArQgbAUg6AiQgOAIgKAEQgGACgHABQAHAFAEAPQAKAqAEBYQAEBHgCArQgCAogPAVQgFAHgOAMIgBABICfgCQAeAAARgDQAZgEARgNQANgKARgaIAthEQAagoAIgPQAUgoALg2QAIgjAGg+QAGg6gDgkQgDg0gWgkQgLgTgNgHQgNgHgTACIgjAHIgGAAIgJALg");
this.shape_3.setTransform(33,31.9);
this.shape_4 = new cjs.Shape();
this.shape_4.graphics.f("#998853").s().p("AjKEkQAOgMAGgHQAOgVACgoQADgrgEhHQgEhYgLgqQgDgPgHgFQAGgBAHgCQAJgEAPgIQA6giAbgUQA8grArg6IAng0IAIgLIAGAAIAjgHQAUgCANAHQANAHALATQAVAkAEA0QACAkgGA6QgGA+gHAjQgLA2gVAoQgIAPgZAoIgtBEQgSAagNAKQgQANgaAEQgQADgeAAIifACIAAgBg");
this.shape_4.setTransform(36.4,33.4);
this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.shape_4},{t:this.shape_3},{t:this.shape_2},{t:this.shape_1},{t:this.shape}]}).wait(1));
}).prototype = getMCSymbolPrototype(lib.Symbol2, new cjs.Rectangle(0,0,57.8,63.8), null);
(lib.Symbol1 = function(mode,startPosition,loop) {
this.initialize(mode,startPosition,loop,{});
// Layer_1
this.shape = new cjs.Shape();
this.shape.graphics.f("#000000").s().p("AARC6QgkAAgMgQQAAgFgEgEQgEgEgEgBIgahkQgPhBgPgmIgHgTQACgOAHgQIAQgeQAGgKAGgBIAEgBIAAABQAEAXANAVQANASAMAEQAGACAMAAIAjgCQALgDAAgIQABgEgJgJQgLgKgPgaQgEgHgBgFQAGgDAXgGQAUgFAKgGQAPgJAHgNQASA7AEAiQADAUAAAoIAACaQAAAWgEALQgFASgNAIQgJAFgWAAg");
this.shape.setTransform(18.7,85.8);
this.shape_1 = new cjs.Shape();
this.shape_1.graphics.f("#444557").s().p("AhgBkQgRgCgHgIQgGgJACgTQABgTACgOQAEgUAQgaQAEgJAGgGIAAgBQAHgIAKgGQAIgHAMgEQAGgDABgDIADgDQADgDAHgCQAHgCAPgJQAMgIAIgCIAMgDQAcgFAOAAQAIAAAEABQAFACAHAFQAWARAPAoQABADACACIgDAEQgGAQgUAHIgRAEIgRAEQgQAEgDAJQgCAHAEAHIAHANIAHALQAFAIAJAJIAGAHQgEAEgKAAIgUAAQgJABgGgCQgKgDgGgJIgKgSQgIgSgBgKIgBgDIAAgCQAAAAAAgBQAAAAAAAAQgBgBAAAAQAAAAgBgBQAAAAAAAAQgBgBAAAAQAAAAgBAAQAAAAAAAAIgBAAIgBAAQgJgCgHAEQgHADgHAOQgPAbgGAUQgDAJgBAHIgBAFIgJAAQgKAAgKgCg");
this.shape_1.setTransform(13.6,69.4);
this.shape_2 = new cjs.Shape();
this.shape_2.graphics.f("#3C3D4D").s().p("AhlBuQgQgDgJgJQgFgEgDgGQgBgDAAgKIABgRIADgcQAEgUAMgWQAJgVAJgJQAEgEAHgFIAOgKIAKgGIAGgCIAEgFQAIgGAUgIIAQgKQAKgGAYgEQAWgEALAAQANAAAGADQAKADAMAMIALALIAGALIARAhQADAHgCADQAAACgCAFQgGANgPAJQgKAFgUAFQgXAGgGAEQABAEAEAHQAPAaALALQAJAJgBAEQAAAIgMADIgjABQgMAAgGgCQgNgDgMgTQgMgVgEgWIAAgBIgFAAQgFACgGAKIgQAeQgIAQgCAOIAAACQgBAIgDADIgBABQgEACgHAAQgWgBgHgCgAAUhgIgMADQgIACgMAIQgPAJgHACQgHACgDADIgDADQgBADgGADQgMAEgIAHQgKAGgHAIIAAABQgGAGgEAJQgQAagEAUQgCAOgBATQgCATAGAJQAHAIARACQAOADAPgBIABgFQABgHADgJQAGgUAPgbQAHgOAHgDQAHgEAJACIABAAIABAAQAAAAAAAAQABAAAAAAQAAAAABABQAAAAAAAAQABAAAAABQAAAAABABQAAAAAAAAQAAABAAAAIAAACIABADQABAKAIASIAKASQAGAJAKADQAGACAJgBIAUAAQAKAAAEgEIgGgHQgJgJgFgIIgHgLIgHgNQgEgHACgHQADgJAQgEIARgEIARgEQAUgHAGgQIADgEQgCgCgBgDQgPgogWgRQgHgFgFgCQgEgBgIAAQgOAAgcAFg");
this.shape_2.setTransform(13.6,69.4);
this.shape_3 = new cjs.Shape();
this.shape_3.graphics.f("#807145").s().p("AjnIOQgdAAgRgDQgagGgOgQQgLgMgJggIgRhNQgCgRgHgYQgGgTgOgjIgEgKIABgBQADgDABgIIAAgCIAIASQAOAnAQBCIAZBjQAFABAEAEQAEAEAAAFQAMAQAlAAIAlABQAXAAAJgGQANgIAFgSQADgKAAgWIAAicQAAgogCgUQgEgigTg7QACgFAAgCQACgDgDgHIgRghIgGgLIgLgLQgMgMgKgDQgGgDgNAAQgLAAgWAEQgYAEgLAGIgQAKQgUAIgIAGIgEAFIgGACIgKAGIgOAKQAFgKAQgNQAZgUAOgHQAdgPAogBIBDgVQAdgJAQgIQANgHARgMIAugjQAagUAJgLIAQgWIAthKQAUgfgEgUQgDgKAFgBQACgBADACIADAFQAEAQgIAUQgEAMgNAVIgrBCQgQAZgIAIQgHAHgQAMIgsAhQgbATgMAHQgOAHglAMIgjALQAWACAMALQANAKALAgQAbBNAHApQAFAgAABMIgBB5QAAAxgUAQIgHAEIBngCQBRgFA3gWQAUgIAqgYQBrg8A3g2QAZgXAcgkIAxg+QAPgVADgJQAGgOgBgfIgHjDQgDhIgEgkQgHg8gRgtQgNgigZgpQgNgWgigwQgXgfgKgJQgbgag/gZQgdgMgRgFQgZgHgWACQgEABgEgCQgFgCABgDQACgEAGAAQAfgCAlAMQAXAHAqAUQAlARAQANQANALAXAgQAmA1AQAbQAcAuAOAoQAPArAHA5QADAhADBEIAGDFQABAjgGARQgEAJgOATQgjAvgVAZQggAngeAbQgtAphUAyQhKAsgwAOQgmALhAAEQgrADgjAAQgpAAgfgEg");
this.shape_3.setTransform(46.2,53);
this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.shape_3},{t:this.shape_2},{t:this.shape_1},{t:this.shape}]}).wait(1));
}).prototype = getMCSymbolPrototype(lib.Symbol1, new cjs.Rectangle(0,0,87.5,106.1), null);
(lib.head = function(mode,startPosition,loop) {
this.initialize(mode,startPosition,loop,{});
// hat
this.shape = new cjs.Shape();
this.shape.graphics.f("#330000").s().p("AiFA5Qg0gHhdgbIgDgCQAAgBAAAAQAAgBAAAAQAAAAABgBQAAAAAAAAIAAgCIAAgBIAAgPIAAgRQABgKAIgRIADgEIABgBIABgBIABAAIABgCQADgDACABQADAAAHAFQAIAEAOAEQBTAVAyAHQBZALBagMQBbgMBTgjQAFgCADABIACACIABAAQADABAAADIAFAOIADAOQABANgBAZIAAAFIAAACIAAACQAAAAAAAAQAAABAAAAQgBABAAAAQAAAAgBABQgCACgFABQgJACgNAGIgWAKQgXAJgxADIhQAFQhEAEgkAAQg7AAgugHg");
this.shape.setTransform(61,26.7);
this.shape_1 = new cjs.Shape();
this.shape_1.graphics.f("#660000").s().p("AmNE1QhWgFhCgSQgugNgfgWQglgcgIglIgBgDIgBgCQgCgCAAgHIABguQAMgbARgdIAKgEIAKgKQAGgGAQgGQAwgSAtgNIAFgBIAEgCIAhgJQAbgGARAAIATgBIAGgBQAUAAALgFQAJgEAFgIIABgDIAHAAIAAACQAAAAAAAAQAAABgBAAQAAAAAAABQABAAAAABIADACQBdAaAzAHQAvAHA6AAQAmAABCgEIBQgFQAxgDAXgIIAWgKQAOgGAJgCQAEgBACgCIABACQBhgEAyAAQBVgBBFAFQBDAFAjAQQAYANAQAUQASAXABAZQACA3hHAyQhmBIicAbQg9AKhNAEQguADhdABIk6AGIg/AAQg5AAgjgCgADWgRIAQgBIgQgBIAAACgAigg5QgygHhSgVQgPgEgHgEQgHgFgDAAQgDgBgCADIgCACIgBAAIAIgbQAIgdAHgMIAlg6QARgZAQAAIADgEQAVgUAbgBQAMgBAIAFQAIAEAMARQATAdAGARIAFARIAGASIAEAGIAQACIAHAAQAAgQAHgQQAGgPAQgXIAcgpQALgRAJgGQAKgJAcgFQAegFAPgBQAKAAAJABQAGAAAHADQAtARAXBHQAFAQANA2IAIAqQgCgBgFACQhUAjhaAMQguAGguAAQgsAAgsgFg");
this.shape_1.setTransform(67.6,31.1);
this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.shape_1},{t:this.shape}]}).wait(10));
// right_eye
this.shape_2 = new cjs.Shape();
this.shape_2.graphics.f().s("#000000").ss(3,1,1).p("AApAAQAAASgMANQgMANgRAAQgQAAgMgNQgMgNAAgSQAAgRAMgNQAMgNAQAAQARAAAMANQAMANAAARg");
this.shape_2.setTransform(47.4,70);
this.shape_3 = new cjs.Shape();
this.shape_3.graphics.f("#FFFF33").s().p("AgcAfQgMgNAAgSQAAgRAMgNQAMgNAQAAQARAAAMANQANANAAARQAAASgNANQgMANgRAAQgQAAgMgNg");
this.shape_3.setTransform(47.4,70);
this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.shape_3},{t:this.shape_2}]}).wait(10));
// left_eye
this.shape_4 = new cjs.Shape();
this.shape_4.graphics.f().s("#000000").ss(3,1,1).p("AAuAAQAAAUgNAOQgOAOgTAAQgTAAgNgOQgOgOAAgUQAAgSAOgOQANgPATAAQATAAAOAPQANAOAAASg");
this.shape_4.setTransform(65.7,71.9);
this.shape_5 = new cjs.Shape();
this.shape_5.graphics.f("#FFFF33").s().p("AggAiQgNgOAAgUQAAgSANgPQAOgNASAAQAUAAANANQANAPAAASQAAAUgNAOQgNAOgUgBQgSABgOgOg");
this.shape_5.setTransform(65.7,71.9);
this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.shape_5},{t:this.shape_4}]}).wait(10));
// face
this.shape_6 = new cjs.Shape();
this.shape_6.graphics.f("#000000").s().p("AjPDVIgDgBIgOgBIgPgCIgLgBIgSgJIgOgHQgfgSgJgSIgDgGIgCgFIgCgBIgBgPIABhgIgCgIIAAgUIgBgDIAAgJIABgKIAAgLIAAgCIABgHQAAgNABgOIAAg0QAAgEABgBQADgDADADQACACABAEIAAADIABAAQBTghA6gSIAAAAQBOgaBEgMQCsgfCBAsQAkAMALAPIAAAAQAUAYgGAzQgDA5gHBIQgCAogHAZQgKAlgYAVQgSAQgdAJIgBAAQgRAFggAEIgBAAQhdAKhJADIgBAAQg2ACghgDIgUgCIggADIgTABIAAAAIg3ABIgHgCg");
this.shape_6.setTransform(62.5,72.3);
this.timeline.addTween(cjs.Tween.get(this.shape_6).wait(10));
}).prototype = p = new cjs.MovieClip();
p.nominalBounds = new cjs.Rectangle(0,0,135.2,93.8);
(lib.character = function(mode,startPosition,loop) {
this.initialize(mode,startPosition,loop,{});
// head
this.instance = new lib.head();
this.instance.parent = this;
this.instance.setTransform(76.4,46,1,1,0,0,0,67.5,31.1);
this.timeline.addTween(cjs.Tween.get(this.instance).wait(1).to({regX:67.6,regY:46.9,x:74.7,y:62.9},0).wait(1).to({x:72.9,y:64},0).wait(1).to({x:71.1,y:65.1},0).wait(1).to({x:69.4,y:66.2},0).wait(1).to({x:67.6,y:67.3},0).wait(1).to({x:69.8,y:65.9},0).wait(1).to({x:72,y:64.5},0).wait(1).to({x:74.2,y:63.1},0).wait(1).to({x:76.5,y:61.8},0).wait(1));
// arm1
this.instance_1 = new lib.Symbol1();
this.instance_1.parent = this;
this.instance_1.setTransform(159.3,62.4,1,1,0,0,0,48.8,3.5);
this.timeline.addTween(cjs.Tween.get(this.instance_1).wait(1).to({regX:43.8,regY:53,rotation:2.2,x:152.4,y:111.6},0).wait(1).to({rotation:4.5,x:150.4,y:111.3},0).wait(1).to({rotation:6.7,x:148.5,y:110.9},0).wait(1).to({rotation:9,x:146.6,y:110.5},0).wait(1).to({rotation:11.2,x:144.8,y:110},0).wait(1).to({rotation:8.4,x:147.1,y:110.6},0).wait(1).to({rotation:5.6,x:149.5,y:111.1},0).wait(1).to({rotation:2.8,x:151.9,y:111.6},0).wait(1).to({rotation:0,x:154.3,y:111.9},0).wait(1));
// body
this.instance_2 = new lib.Symbol3();
this.instance_2.parent = this;
this.instance_2.setTransform(115.7,108,1,1,0,0,0,115.7,108);
this.timeline.addTween(cjs.Tween.get(this.instance_2).wait(1).to({regY:108.1,y:108.7},0).wait(1).to({y:109.3},0).wait(1).to({y:109.9},0).wait(1).to({y:110.5},0).wait(1).to({y:111.1},0).wait(1).to({y:110.4},0).wait(1).to({y:109.6},0).wait(1).to({y:108.9},0).wait(1).to({y:108.1},0).wait(1));
// arm2
this.instance_3 = new lib.Symbol2();
this.instance_3.parent = this;
this.instance_3.setTransform(32.2,84.4,1,1,0,0,0,56.4,-8.7);
this.timeline.addTween(cjs.Tween.get(this.instance_3).wait(1).to({regX:28.9,regY:31.9,rotation:-1.2,x:5.6,y:125.6},0).wait(1).to({rotation:-2.4,x:6.5,y:126.1},0).wait(1).to({rotation:-3.7,x:7.4,y:126.7},0).wait(1).to({rotation:-4.9,x:8.3,y:127.2},0).wait(1).to({rotation:-6.1,x:9.2,y:127.7},0).wait(1).to({rotation:-7.3,x:10.1,y:128.2},0).wait(1).to({rotation:-8.5,x:11.1,y:128.6},0).wait(1).to({rotation:-9.8,x:12,y:129.1},0).wait(1).to({rotation:-11,x:13,y:129.5},0).wait(1));
}).prototype = p = new cjs.MovieClip();
p.nominalBounds = new cjs.Rectangle(-24.2,0,255.6,216.1);
// stage content:
(lib.desertman = function(mode,startPosition,loop) {
this.initialize(mode,startPosition,loop,{});
// tint
this.shape = new cjs.Shape();
this.shape.graphics.f().s("#000000").ss(3,1,1).p("Eg7IgpKMB2RAAAMAAABSVMh2RAAAg");
this.shape.setTransform(294.5,205.5);
this.shape_1 = new cjs.Shape();
this.shape_1.graphics.f("rgba(153,102,0,0.2)").s().p("Eg7IApLMAAAhSVMB2RAAAMAAABSVg");
this.shape_1.setTransform(294.5,205.5);
this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.shape_1},{t:this.shape}]}).wait(24));
// body
this.instance = new lib.character();
this.instance.parent = this;
this.instance.setTransform(413.8,307,1,1,0,0,0,115.7,108);
this.timeline.addTween(cjs.Tween.get(this.instance).wait(1).to({regX:103.6,regY:109.6,x:392.7,y:308.7},0).wait(1).to({x:383.7},0).wait(1).to({x:374.7,y:308.8},0).wait(1).to({x:365.7},0).wait(1).to({x:356.7,y:308.9},0).wait(1).to({x:347.7,y:309},0).wait(1).to({x:338.7},0).wait(1).to({x:329.7,y:309.1},0).wait(1).to({x:320.7},0).wait(1).to({x:311.7,y:309.2},0).wait(1).to({x:302.7,y:309.3},0).wait(1).to({x:293.7},0).wait(1).to({x:284.7,y:309.4},0).wait(1).to({x:275.7,y:309.5},0).wait(1).to({x:266.7},0).wait(1).to({x:257.7,y:309.6},0).wait(1).to({x:248.7},0).wait(1).to({x:239.7,y:309.7},0).wait(1).to({x:230.7,y:309.8},0).wait(1).to({x:221.7},0).wait(1).to({x:212.7,y:309.9},0).wait(1).to({x:203.7},0).wait(1).to({x:194.7,y:310},0).wait(1));
// dunes
this.instance_1 = new lib.Symbol4();
this.instance_1.parent = this;
this.instance_1.setTransform(273.4,338.8,1,1,0,0,0,361.8,77.7);
this.timeline.addTween(cjs.Tween.get(this.instance_1).wait(1).to({x:273.8},0).wait(1).to({x:274.3},0).wait(1).to({x:274.7},0).wait(1).to({x:275.1},0).wait(1).to({x:275.6},0).wait(1).to({x:276},0).wait(1).to({x:276.4},0).wait(1).to({x:276.9},0).wait(1).to({x:277.3},0).wait(1).to({x:277.7},0).wait(1).to({x:278.2},0).wait(1).to({x:278.6},0).wait(1).to({x:279.1},0).wait(1).to({x:279.5},0).wait(1).to({x:279.9},0).wait(1).to({x:280.4},0).wait(1).to({x:280.8},0).wait(1).to({x:281.2},0).wait(1).to({x:281.7},0).wait(1).to({x:282.1},0).wait(1).to({x:282.5},0).wait(1).to({x:283},0).wait(1).to({x:283.4},0).wait(1));
// sun
this.instance_2 = new lib.Symbol5();
this.instance_2.parent = this;
this.instance_2.setTransform(275,96.6,1,1,0,0,0,23.5,23.5);
this.timeline.addTween(cjs.Tween.get(this.instance_2).wait(1).to({y:96.5},0).wait(1).to({y:96.4},0).wait(2).to({y:96.3},0).wait(1).to({y:96.2},0).wait(2).to({y:96.1},0).wait(1).to({y:96},0).wait(2).to({y:95.9},0).wait(1).to({y:95.8},0).wait(2).to({y:95.7},0).wait(1).to({y:95.6},0).wait(2).to({y:95.5},0).wait(1).to({y:95.4},0).wait(2).to({y:95.3},0).wait(1).to({y:95.2},0).wait(2).to({y:95.1},0).wait(2));
// sky
this.shape_2 = new cjs.Shape();
this.shape_2.graphics.f("#33CCFF").s().p("EgrGAfkMAAAg/HMBWNAAAMAAAA/HgAYTOUQgGAIAEAGQACADAEACQAHAEATAGIAUAFQAOAEAHgDQAFgBADgGQADgEgDgGQgBgDgJgEIgrgNIgMgCQgJAAgFAEgAVAMzQgIADABANQAAAEACADQACADAIACIARAEQAGABADACIAHAGQAFADAKgBQAJAAAEgCQAFgEAAgFQAAgGgDgDQgCgCgKgEIgPgGIgOgGIgQgFIgGgBIgFABg");
this.shape_2.setTransform(275,201.1);
this.timeline.addTween(cjs.Tween.get(this.shape_2).wait(24));
}).prototype = p = new cjs.MovieClip();
p.nominalBounds = new cjs.Rectangle(186.6,140.6,763,530);
// library properties:
lib.properties = {
id: 'D2DF9283198ADE449B2C92671CD79AB7',
width: 550,
height: 400,
fps: 24,
color: "#33CCFF",
opacity: 1.00,
manifest: [],
preloads: []
};
// bootstrap callback support:
(lib.Stage = function(canvas) {
createjs.Stage.call(this, canvas);
}).prototype = p = new createjs.Stage();
p.setAutoPlay = function(autoPlay) {
this.tickEnabled = autoPlay;
}
p.play = function() { this.tickEnabled = true; this.getChildAt(0).gotoAndPlay(this.getTimelinePosition()) }
p.stop = function(ms) { if(ms) this.seek(ms); this.tickEnabled = false; }
p.seek = function(ms) { this.tickEnabled = true; this.getChildAt(0).gotoAndStop(lib.properties.fps * ms / 1000); }
p.getDuration = function() { return this.getChildAt(0).totalFrames / lib.properties.fps * 1000; }
p.getTimelinePosition = function() { return this.getChildAt(0).currentFrame / lib.properties.fps * 1000; }
an.bootcompsLoaded = an.bootcompsLoaded || [];
if(!an.bootstrapListeners) {
an.bootstrapListeners=[];
}
an.bootstrapCallback=function(fnCallback) {
an.bootstrapListeners.push(fnCallback);
if(an.bootcompsLoaded.length > 0) {
for(var i=0; i<an.bootcompsLoaded.length; ++i) {
fnCallback(an.bootcompsLoaded[i]);
}
}
};
an.compositions = an.compositions || {};
an.compositions['D2DF9283198ADE449B2C92671CD79AB7'] = {
getStage: function() { return exportRoot.getStage(); },
getLibrary: function() { return lib; },
getSpriteSheet: function() { return ss; },
getImages: function() { return img; }
};
an.compositionLoaded = function(id) {
an.bootcompsLoaded.push(id);
for(var j=0; j<an.bootstrapListeners.length; j++) {
an.bootstrapListeners[j](id);
}
}
an.getComposition = function(id) {
return an.compositions[id];
}
})(createjs = createjs||{}, AdobeAn = AdobeAn||{});
var createjs, AdobeAn;
|
getshowdata();
var datecur = '2020-12-16';
var year = 2020;
var mont = 12;
$('#ybox').val(year);
$('#monbox').val(mont);
var arroom = [];
let dayNamesMin = ["จันทร์", "อังคาร", "พุทธ์", "พฤหัส", "ศุกร์", "เสาร์", "อาทิต"];
let monthNames = ['มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม'];
$("#show_inv").empty();
var y = 0;
var t = '';
for (y = year; y <= (year + 5); y++) {
t += "<option>" + y + "</option>";
}
$('#ybox:last').append(t);
function setselectmont() {
var txtm = "";
var m = 0;
var str = "";
var mss = $('#monbox').val();
for (m = 0; m <= 11; m++) {
str = "" + (m + 1);
var ccs = "boxdata";
if (str == mss) {
ccs = "boxdatat";
}
txtm += "<div class='col-md-2'><div class='" + ccs + "' onclick='changm(" + str + ")'>" + str.padStart(2, '0') + " : " + monthNames[m] + "</div></div>";
}
$('#mbox').html("<div class='row'>" + txtm + "</div>");
}
function tocal(pr_room) {
$('#showpd').html('');
var n2 = $('#monbox').val();
var n3 = $('#ybox').val();
var maxpr = pr_room.length;
var run = 0;
$('#showtitle').html('ตารางจัดการราคาห้อง <b>' + monthNames[(n2 - 1)] + ' ปี ' + y + '</b>');
var n1 = getDaysInMonth(n2, n3);
var b = n1 * 1;
var ystr = n3 * 1;
var dayn = 0;
var txtday = "";
var txtdayw = "";
var txtrow = "";
for (dayn = 1; dayn <= b; dayn++) {
var txtd = "" + dayn;
var txtc = "" + ystr + "-" + n2 + "-" + dayn;
var txtnm = cofwd(txtc);
if (txtnm == 'อาทิต') {
txtdayw += "<td style='background-color:red!important;color:#fff!important;font-size:11px!important'>" + txtnm + "</td>";
} else if (datecur == txtc) {
txtdayw += "<td style='background-color:blue!important;color:#fff!important;font-size:11px!important'>" + txtnm + "</td>";
} else {
txtdayw += "<td style='font-size:11px!important'><b>" + txtnm + "</b></td>";
}
txtday += "<td style='font-size:11px!important'><b>" + txtd.padStart(2, '0') + "</b></td>";
}
for (var rdm = 1; rdm <= arroom.length; rdm++) {
var idrm = arroom[rdm - 1]['idroom'];
txtrow += "<tr class='hoverrow'><td style=' width: 200px!important;text-align:left!important;font-size:12px!important;'> " + arroom[rdm - 1]['roomnm'] + "</td>";
for (dayn = 1; dayn <= b; dayn++) {
run++;
var txtd = "" + dayn;
var prm = "";
var txtcd = n3 + "-" + n2.padStart(2, '0') + "-" + txtd.padStart(2, '0');
for (let ii = 0; ii < maxpr; ii++) {
if (pr_room[ii]['date_start'] == txtcd && pr_room[ii]['ID_room'] == idrm) {
prm = pr_room[ii]['price_room'];
}
}
txtrow += "<td><input type='text' style='width:100%;font-size:12px!important;text-align:right!important' onchange=\"saveauto(" + run + ",'" + txtcd + "'," + idrm + ")\" value='" + prm + "' id='prset" + run + "'></td>";
}
txtrow += "</tr>";
}
$('#showpd').html("<table style='width:100%;color:#888!important' class='tbborder'><tr style='background-image: linear-gradient(#ccc, #fff)'><td></td>" + txtdayw + "</tr><tr style='color:#fff;background-color:#1f2e5c!important'><td><b>ห้องพัก</b></td>" + txtday + "</tr>" + txtrow + "</table>");
}
function getpricall() {
var year = $('#ybox').val();
var mont = $('#monbox').val();
$.ajax({
type: 'POST',
url: 'https://www.khemtis.com/booking/roompr.php',
data: {
year: year,
mont: mont
},
dataType: 'json',
success: function (data) {
pr_room = [];
$.each(data, function (index, element) {
let text = {
'idroom': element.ID_room,
'date_start': element.date_start,
'price_room': element.price_room,
}
pr_room.push(text);
});
//console.log(pr_room[1]['date_start']);
tocal(pr_room);
}
});
}
function getshowdata() {
var slsroom = $('#slsroom').val();
$.ajax({
type: 'POST',
url: 'https://www.khemtis.com/booking/roomti.php',
data: {
get_param: slsroom
},
dataType: 'json',
success: function (data) {
arroom = [];
$.each(data, function (index, element) {
let text = {
'idroom': element.id,
'roomnm': element.name_roomtype,
}
arroom.push(text);
});
}
});
}
function saveauto(run, dy, idr) {
var vl = $('#prset' + run).val();
//alert(vl);
//alert(dy);
//alert(idr);
$.ajax({
type: 'POST',
url: 'saveroom.php',
data: {
price: vl,
dy: dy,
idrm: idr
},
dataType: 'html',
success: function (data) {
//alert(data);
getpricall();
}
});
}
function changy() {
reloadpagenew();
}
function changm(m) {
$('#monbox').val(m);
getshowdata();
}
function reloadpagenew() {
getpricall();
}
/*
function reloadpage(m,y){
$('#monbox').val(m);
$('#showtitle').html('ตารางจัดการราคาห้อง <b>'+monthNames[(m-1)]+' ปี '+y+'</b>');
var b = getDaysInMonth(m,y);
tocal(b,m,y);
}
*/
function cofwd(day) {
var d = new Date(day);
var weekday = new Array(7);
weekday[0] = "อาทิต";
weekday[1] = "จันทร์";
weekday[2] = "อังคาร";
weekday[3] = "พุทธ์";
weekday[4] = "พฤหัส";
weekday[5] = "ศุกร์";
weekday[6] = "เสาร์";
return weekday[d.getDay()];
}
function curdate() {
var today = new Date();
var dd = String(today.getDate()).padStart(2, '0');
var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
var yyyy = today.getFullYear();
today = mm + '/' + dd + '/' + yyyy;
return today;
}
function getDaysInMonth(month, year) {
return new Date(year, month, 0).getDate();
}
|
import React from "react";
import { useField, ErrorMessage } from "formik";
const InputField = ({ label, ...props }) => {
const [field, meta] = useField(props);
return (
<>
<label>{label}</label>
<input
{...field}
{...props}
className={`mb-3 form-control ${
meta.touched && meta.error ? "is-invalid" : ""
}`}
/>
<ErrorMessage
name={props.name}
className="invalid-feedback"
component="div"
/>
</>
);
};
export default InputField;
|
const withoutEnd = string => string.substring(1, string.length - 1)
console.log(withoutEnd("Hello")) // "ell"
console.log(withoutEnd("java")) // "av"
console.log(withoutEnd("coding")) // "odin
|
var canvas, stage, exportRoot, lib = {};
const init = () =>{
canvas = document.getElementById("MyCanvas");
exportRoot = new lib.root();
stage = new createjs.Stage("MyCanvas");
stage.addChild(exportRoot);
createjs.Ticker.framerate = 30;
createjs.Ticker.addEventListener("tick", stage);
document.addEventListener("keydown", KeydownHandler);
}
(lib.root = function(mode,startPosition,loop) {
this.initialize(mode,startPosition,loop,{});
this.addChild(this.LittleBlue = new lib.LittleBlue());
this.LittleBlue.parent = this;
this.LittleBlue.setTransform(250,100);
}).prototype = new createjs.MovieClip();
(lib.LittleBlue = function(mode,startPosition,loop) {
this.initialize(mode,startPosition,loop,{});
this.addChild( this.shape = new createjs.Shape() );
this.shape.graphics.f().s("#0000FF").ss(10,1,1).p("AgChKQhmgBhIhJQhJhJAAhnQAAhoBJhJQBJhJBnAAQBoAABJBJQBJBJAABoQAABnhJBJQhIBJhmABQBmABBIBIQBJBJAABnAAEFFQBlABBIBIQBJBKAABnAAAhKIAAGPAADhKIgDAAIgCAAAj5I/QAAhnBJhKQBIhIBmgBAj5CvQAAhnBJhJQBIhIBmgB");
this.shape.setTransform(0,0);
}).prototype = new createjs.MovieClip();
const KeydownHandler = e =>{
switch( e.keyCode ){
case 37:
exportRoot.LittleBlue.x -= 10;
break;
case 38:
exportRoot.LittleBlue.y -= 10;
break;
case 39:
exportRoot.LittleBlue.x += 10;
break;
case 40:
exportRoot.LittleBlue.y += 10;
break;
default:
break;
}
}
|
// var fs = require('fs');
// var log = console.log;
// var unzip = require('unzip');
var outputPath = 'zip';
var outputFile = '../js/bootstrap-3.1.1-dist.zip';
// var extract = unzip.Extract({ path: outputPath });
// extract.on('error', function (err) {
// log.warn(err);
// }).on('finish', function () {
// log('zip ' + outputFile + ' ----> ' + outputPath);
// });
// fs.createReadStream(outputFile).pipe(extract);
var AdmZip = require('adm-zip');
var zip = new AdmZip(outputFile);
zip.extractAllTo(outputPath, true);
log('zip ' + outputFile + ' ----> ' + outputPath);
|
i = 1;
teamArray = [];
function recursive(numOfBrackets) {
if (numOfBrackets <= 1) {
console.log("Team " + i + " vs Team " + (i+1));
teamArray.push(i, i+1);
i += 2;
} else {
(recursive(numOfBrackets - 1) + recursive(numOfBrackets - 1));
}
}
recursive(4);
|
import React, { Component } from 'react';
import styled, { ThemeProvider } from 'styled-components'
import './App.css';
import { Main, Upload, CatalogPage } from './pages'
import { Switch, Route } from 'react-router-dom'
import NavigationBar from './components/navigationbar'
import { defaultTheme } from './themes'
class App extends Component {
constructor(props){
super(props)
this.navBarButtons = {
Ding: {
link: '/',
icon: 'ding',
color: 'gold'
},
Upload: {
link: '/upload',
icon: 'youtube',
color: 'red',
},
Catalog: {
link: '/catalogPage',
icon: 'catalog'
}
};
}
render() {
return (
<ThemeProvider theme={defaultTheme}>
<MainWindow>
<NavigationBar buttons={this.navBarButtons}/>
<PageWrapper>
<Switch>
<Route exact path='/' component={Main}/>
<Route exact path='/upload' component={Upload}/>
<Route exact path='/catalogPage' component={CatalogPage}/>
</Switch>
</PageWrapper>
</MainWindow>
</ThemeProvider>
);
}
}
const MainWindow = styled.div`
position:absolute;
width:100%;
height:100%;
z-index: 1000;
top:0px;
left:0px;
display: flex;
flex-direction: row;
`;
const PageWrapper = styled.div`
text-align: center;
flex: 10;
background-color: ${props => props.theme.backgroundMain}
`;
export default App;
|
// Define a collection to hold our notifications
Notifications = new Mongo.Collection("notifications");
if (Meteor.isClient) { // This code is executed on the client only
} else { //serverside
Meteor.publish('users', function () {
return Meteor.users.find({});
});
ServiceConfiguration.configurations.remove({
service: 'twitter'
});
ServiceConfiguration.configurations.insert({
service : 'twitter',
consumerKey: 'SBdsNROyRbpQP2Bw6beUzw',
secret : 'V0CnmFNQSVE1AeFaWUAuVOjclGmkiGyJII3PIYtDDo'
});
Meteor.publish('notifications', function () {
return Notifications.find({});
});
}
|
var Storage = require('node-persist');
Storage.initSync();
var DataModel = function(name, method, endpoint, requestBody, responseBody, id){
if( !(this instanceof DataModel) ){
return new DataModel(name, method, endpoint, requestBody, responseBody, id);
}
if(id){
var model = Storage.getItem(id);
if( !model ){
throw new Error('DataModel with id' + id + 'does not exist!');
}
this.id = model.id;
this.name = model.name;
this.method = model.method;
this.requestBody = model.requestBody;
this.responseBody = model.responseBody;
this.endpoint = model.endpoint;
} else if (!requestBody || !responseBody || !endpoint ) {
throw new Error('requestBody, responseBody or endpoint was undefined.');
} else {
this.id = (Storage.length() + 1).toString();
this.name = name || 'Untitled' + this.id;
this.method = method || 'POST';
this.requestBody = requestBody;
this.responseBody = responseBody;
this.endpoint = endpoint;
}
};
DataModel.prototype.save = function(callback){
Storage.setItem(this.id, this, callback);
};
module.exports = DataModel;
|
const app = require('express')()
const bodyParser = require('body-parser')
const NodejsInventory = require('nodejs-inventory')
const Monitor = require('nodejs-inventory-monitor')
const inventory = new NodejsInventory()
const monitor = new Monitor(inventory)
const databaseConnection = process.env.DATABASE || 'mongodb://localhost:27017/nodejs-inventory'
inventory.connect(databaseConnection)
monitor.connect(databaseConnection)
inventory.startMonitor(monitor)
app.use(bodyParser.json())
app.use((req, res, next) => {
req.user = {
_id: req.headers.user
}
req.query.user = req.user
next()
})
app.use('/', inventory.allRoutes)
app.post('/monitorConfig',(req,res)=>{
monitor.saveItemMonitorConfig(req.body)
.then(data=>res.send(data))
})
app.listen(process.env.PORT || 8000)
console.log('running');
|
import { useRouter } from 'next/router';
import EditProduct from '../containers/Products/EditProduct';
const Update = () => {
const router = useRouter();
return (
<div>
<EditProduct productId={router.query.id} />
</div>
);
};
export default Update;
|
import React, {useState} from 'react';
import {TouchableOpacity, Text} from 'react-native';
import styles from '../screens/About/styles';
import Paragraph from './Paragraph';
import Animated from 'react-native-reanimated';
import CollapsableText from './CollapsableText';
const Conduct = ({title, description, ...props}) => {
const [open, setOpen] = useState(false);
return (
<>
<TouchableOpacity onPress={() => setOpen(!open)}>
<Text style={styles.conductTitle} {...props}>
{open ? '-' : '+'} {title}
</Text>
</TouchableOpacity>
<CollapsableText>
{open ? <Paragraph>{description}</Paragraph> : null}
</CollapsableText>
</>
);
};
export default Conduct;
|
var getAcheckerResults = require('../lib/getAcheckerResults');
exports.getAcheckerResults = {
setUp: function testSetup(done) {
done();
},
'Missing argument: options': function (test) {
getAcheckerResults(false, function(err) {
test.throws(err);
test.done();
});
},
'Missing argument: options.uri': function (test) {
getAcheckerResults({'uri': false}, function(err) {
test.throws(err);
test.done();
});
},
'Missing argument: options.ws': function (test) {
getAcheckerResults({'uri': true, 'qs': false}, function(err) {
test.throws(err);
test.done();
});
},
'Abort if provided URI is unreachable': function (test) {
opts = {
uri: 'http://achecker.ca/checkacc.php',
qs: {
uri: 'thisisnotarealwebsite.foobar',
output: 'rest',
guide: 'WCAG2-AA'
}
};
getAcheckerResults(opts, function(err, results) {
test.ok(err, 'The URI was successfully reached.');
test.done();
});
},
'Allow HTTPS URIs': function (test) {
opts = {
uri: 'http://achecker.ca/checkacc.php',
qs: {
uri: 'https://wikipedia.org',
output: 'rest',
guide: 'WCAG2-AA'
}
};
getAcheckerResults(opts, function(err, results) {
test.ok(err === null);
test.done();
});
}
};
|
const Service = require('./servicePost.model');
exports.saveService = (req, res) => {
const {
title,
pago,
descripcion,
ubicacion,
categoria,
img,
} = req.body;
const { _id } = req.user;
const service = new Service({
title,
pago,
descripcion,
ubicacion,
categoria,
client: _id,
img,
});
service.save((err, productDB) => {
if (err) {
return res.status(500).json({
ok: false,
err,
});
}
if (!productDB) {
return res.status(400).json({
ok: false,
err,
});
}
return res.status(201).json({
ok: true,
product: productDB,
});
});
};
exports.getAllForCategory = (req, res) => {
const { sky } = req.query || 0;
const { lim } = req.query || 5;
const { id } = req.params;
Service.find({ categoria: id })
.sort('title')
.populate('client', 'nombre email')
.populate('worker', 'nombre email')
.populate('categoria', 'description')
.skip(Number(sky))
.limit(Number(lim))
.exec((err, serviceDB) => {
if (err) {
return res.status(400).json({
ok: false,
err,
});
}
return res.json({
ok: true,
serviceDB,
});
});
};
exports.getAll = (req, res) => {
const { sky } = req.query || 0;
const { lim } = req.query || 5;
Service.find({})
.sort('title')
.populate('client', 'nombre email')
.populate('worker', 'nombre email')
.populate('categoria', 'description')
.skip(Number(sky))
.limit(Number(lim))
.exec((err, serviceDB) => {
if (err) {
return res.status(400).json({
ok: false,
err,
});
}
return res.json({
ok: true,
serviceDB,
});
});
};
exports.getAllClient = (req, res) => {
const { _id } = req.user;
const { sky } = req.query || 0;
const { lim } = req.query || 5;
Service.find({ client: _id })
.sort('title')
.populate('client', 'nombre email')
.populate('worker', 'nombre email')
.populate('categoria', 'description title')
.skip(Number(sky))
.limit(Number(lim))
.exec((err, serviceDB) => {
if (err) {
return res.status(400).json({
ok: false,
id: _id,
err,
});
}
const response = serviceDB.filter(remove => remove.Estado !== 'ELIMINADO');
return res.json({
ok: true,
serviceDB: response,
});
});
};
exports.getServicePostSearch = (req, res) => {
const { term } = req.params;
// const { _id } = req.user;
const regex = new RegExp(term, 'i');
Service.find({ title: regex })
.populate('client', 'nombre email')
.populate('worker', 'nombre email')
.populate('categoria', 'description')
.exec((err, serviceDB) => {
if (err) {
return res.status(500).json({
ok: false,
err,
});
}
if (!serviceDB) {
return res.status(400).json({
ok: false,
err: {
message: 'El termino no existe',
},
});
}
return res.json({
ok: true,
serviceDB,
});
});
};
exports.getServicePostSearchCategory = (req, res) => {
const { term, id } = req.params;
// const { _id } = req.user;
const regex = new RegExp(term, 'i');
Service.find({ title: regex, categoria: id })
.populate('client', 'nombre email')
.populate('worker', 'nombre email')
.populate('categoria', 'description')
.exec((err, serviceDB) => {
if (err) {
return res.status(500).json({
ok: false,
err,
});
}
if (!serviceDB) {
return res.status(400).json({
ok: false,
err: {
message: 'El termino no existe',
},
});
}
return res.json({
ok: true,
serviceDB,
});
});
};
exports.updatedService = (req, res) => {
const { id } = req.params;
const { body } = req;
Service.findByIdAndUpdate(id, body,
{ new: true }, (err, serviceDB) => {
if (err) {
return res.status(500).json({
ok: false,
err,
});
}
if (!serviceDB) {
return res.status(400).json({
ok: false,
err: {
message: 'El ID no existe',
},
});
}
return res.json({
ok: true,
serviceDB,
});
});
};
exports.updateStateMetode = (id, Estado) => {
Service.findByIdAndUpdate(id, Estado,
{ new: true }, (err, serviceDB) => {
if (err) {
return ({
ok: false,
err,
});
}
if (!serviceDB) {
return ({
ok: false,
err: {
message: 'El ID no existe',
},
});
}
return ({
ok: true,
serviceDB,
});
});
};
exports.getId = (req, res) => {
const { id } = req.params;
Service.findById(id)
.populate('client', 'nombre email')
.populate('worker', 'nombre email')
.populate('categoria', 'description')
.exec((err, serviceDB) => {
if (err) {
return res.status(500).json({
ok: false,
err,
});
}
if (!serviceDB) {
return res.status(400).json({
ok: false,
err: {
message: 'El ID no existe',
},
});
}
return res.json({
ok: true,
serviceDB,
});
});
};
exports.removeService = (req, res) => {
const { id } = req.params;
Service.findByIdAndUpdate(id, { Estado: 'ELIMINADO' },
{ new: true }, (err, serviceDB) => {
if (err) {
return res.status(500).json({
ok: false,
err,
});
}
if (!serviceDB) {
return res.status(400).json({
ok: false,
err: {
message: 'El ID no existe',
},
});
}
return res.json({
ok: true,
serviceDB,
});
});
};
|
// Sierpinski Triangle Recursion Demo
let triangleVertices = [];
let numberOfTriangles = 0;
function setup() {
createCanvas(windowWidth, windowHeight);
triangleVertices.push({x:width/2, y:!height}, {x:0, y:height}, {x:width, y:height})
console.log(getMidpoint(triangleVertices[0], triangleVertices[1]));
}
function draw() {
background(220);
sierpinski(triangleVertices, numberOfTriangles);
}
function mousePressed() {
numberOfTriangles++;
}
function sierpinski(points, depth) {
let theColors = ["blue", "teal", "turqoise", "green", "white", "black"]
fill(theColors[depth % theColors.length]);
triangle(points[0].x, points[0].y, points[1].x, points[1].y, points[2].x, points[2].y);
if (depth > 0) {
sierpinski([points[1], getMidpoint(points[0],points[1]), getMidpoint(points[1], points[2])], depth -1)
sierpinski([points[0], getMidpoint(points[0],points[1]), getMidpoint(points[0], points[2])], depth -1)
sierpinski([points[2], getMidpoint(points[1],points[2]), getMidpoint(points[0], points[2])], depth -1)
}
}
function getMidpoint(point1, point2) {
let midX = (point1.x + point2.x)/2
let midY = (point1.y + point2.y)/2
return {x: midX, y: midY};
}
|
define(function(require) {
var Mask, style, doc, isIE6;
doc = $(document);
isIE6 = navigator.userAgent.indexOf("MSIE 6.0") !== -1;
style = {
'position' : isIE6 ? 'absolute' : 'fixed',
'top' : 0,
'left' : 0,
'width' : '100%',
'height' : isIE6 ? doc.outerHeight(true) : '100%',
'display' : 'none',
'z-index' : 998,
'opacity' : 0.2,
'background-color' : 'black'
};
Mask = Backbone.View.extend({
initialize : function() {
this.element = $('<iframe/>').attr({
'frameborder' : 0,
'scrolling' : 'no'
}).css(style).appendTo(document.body);
},
show : function() {
this.element.fadeIn();
},
hide : function() {
this.element.fadeOut();
}
});
return new Mask();
});
|
let express = require("express");
//connect to the port 8080
let PORT = process.env.PORT || 8080;
let app = express();
//static content for the app from the public directory
app.use(express.static("public"));
//parse body
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
//set handle bars
let exphbs = require("express-handlebars");
app.engine("handlebars", exphbs({ defaultLayout: "main" }));
app.set("view engine", "handlebars");
//import routes to give server access
let routes = require("./controllers/burgers_controller.js");
app.use(routes);
//start server so it can listen
app.listen(PORT, function(){
console.log("Server listening on: http://localhost:", PORT);
});
|
'use strict';
module.exports.hello = (event, context, callback) => {
const response = {
statusCode: 200,
body: JSON.stringify({
message: 'Oh hi there. How are you?',
input: event,
}),
};
callback(null, response);
// Use this code if you don't use the http event with the LAMBDA-PROXY integration
// callback(null, { message: 'Go Serverless v1.0! Your function executed successfully!', event });
};
module.exports.goodbye = (event, context, callback) => {
const response = {
statusCode: 200,
body: JSON.stringify({
messages: "I sorry to hear this",
input: context,
})
};
callback(null, response);
};
|
import logo from './logo.svg';
import './App.css';
import { useEffect, useState } from 'react';
import List from './List';
import axios from 'axios'
function App() {
const[gifs,setGifs]=useState([])
useEffect(()=>{
const giphyKey='FFC6KjDhiM88JkkhsrFX1hoiSAAMVPO0'
axios.get(`https://api.giphy.com/v1/gifs/trending?api_key=${giphyKey}&limit=${5}`)
.then(res=>{
console.log(res.data.data)
setGifs(res.data.data)}).catch(e=>console.log(e))
},[])
const mapped= gifs.map(gif=>{
return <List gif={gif} />
})
return (
<div className="App">
{mapped}
</div>
);
}
export default App;
|
import a1 from './stills/audify/audify1.PNG';
import a2 from './stills/audify/audify2.PNG';
import a3 from './stills/audify/audify3.PNG';
import a4 from './stills/audify/audify4.PNG';
import k1 from './stills/kumite/kumite1.PNG';
import k2 from './stills/kumite/kumite2.PNG';
import k3 from './stills/kumite/kumite3.PNG';
import k4 from './stills/kumite/kumite4.PNG';
export const imageArray1 = [
{
title: 'Landing Page',
description:"The landing page of Audify, a Spotify clone. Developed by Alejandro Ventura, Christopher Kirkum, Cristhian Morales and, Damian Montoya",
image:a3
},
{
title: 'Playlist Page',
description:"A saved collection of songs that a user can listen to. Authorized users can create, read, updated, and delete playlists. Authorized users can also add songs to the playlists they create. ",
image:a1
},
{
title: 'User Profile',
description:"The My Library page is also the user's page. On this page, a user can update their personal information. Here a user can see all of the playlists they created",
image:a2
},
{
title: 'The Search',
description:"The search works.",
image:a4
},
]
export const imageArray2 = [
{
title: 'Landing Page',
description:"The landing page of Kumite, a UFC clone. Developed by Christopher Kirkum.",
image:k1
},
{
title: 'User Profile',
description:"The page dedicated to the user. Here a users can see comments made by other users. Users can also see who is following them, and who they are following.",
image:k3
},
{
title: 'Fighter Cards Front',
description:"A page that displays all the users registered as a fighter. Each Card is a link to a fighter's user page.",
image:k2
},
{
title: 'Fighter Cards Back',
description:"The back side of the fighter's card shows on hover. The backside of the card shows the fighter's moniker and stats",
image:k4
},
]
|
/**
* This file is part of "MPS Setagaya Pacman."
*
* MPS Setagaya Pacman is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MPS Setagaya Pacman is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
*
* (c) Junya Kaneko <jyuneko@hotmail.com>
*/
/**
* Created by Junya Kaneko on 10/23/15.
* Authors: Junya Kaneko
*/
// パックマンのコンストラクタを定義。
// パックマンは、半径、速度、移動方向、口の開き具合、口パクの速度、初期タイルの位置を属性として持つ。
/**
* パックマンのコンストラクタ
* @param radius 半径
* @param speed 移動スピード(pixcel/s)
* @param theta 口の開き具合 (度)
* @param map マップ
* @param row マップ上の初期位置 (行)
* @param col マップ上の初期位置 (列)
* @constructor
*/
var Pacman = function (radius, speed, theta, map, row, col) {
Character.call(this, speed, map, row, col);
this.radius = radius;
this.theta = theta;
this.dTheta = 3;
};
// Character の prototype を Pacman に設定。
inheritFromCharacter(Pacman);
// パックマンのメソッドを定義。
// 今のところ、メソッドはコンストラクタの持つ prototype オブジェクトのメソッドとして
// 定義すると覚える。
Pacman.prototype.getRadius = function () {
return this.radius;
};
Pacman.prototype.getLeft = function () {
return this.getCx() - this.getRadius();
};
Pacman.prototype.getTop = function () {
return this.getCy() - this.getRadius();
};
Pacman.prototype.getRight = function() {
return this.getCx() + this.getRadius();
};
Pacman.prototype.getBottom = function() {
return this.getCy() + this.getRadius();
};
Pacman.prototype.getTheta = function() {
return this.theta;
};
Pacman.prototype.chew = function () {
if (this.theta >= 30 || this.theta <= 0) {
this.dTheta *= -1;
}
this.theta += this.dTheta;
return this.theta;
};
Pacman.prototype.move = function (duration) {
this.chew();
Character.prototype.move.call(this, duration);
};
Pacman.prototype.draw = function (ctx) {
ctx.strokeStyle = "#FF0000";
ctx.fillStyle = "#FF0000";
ctx.beginPath();
ctx.arc(this.getCx(), this.getCy(), this.radius, this.getTheta() * Math.PI / 180, (360 - this.getTheta()) * Math.PI / 180);
ctx.lineTo(this.getCx(), this.getCy());
ctx.lineTo(this.getCx() + this.radius * Math.cos(this.getTheta() * Math.PI / 180), this.position[1] + this.radius * Math.sin(this.getTheta() * Math.PI / 180));
ctx.fill();
};
|
document.addEventListener('keydown', (e) => {
if(e.key == ' '){
josh = document.createElement('img')
josh.src = 'walkright.gif'
josh.style.position = 'absolute'
josh.style.left = '0px'
josh.style.bottom = '100px'
josh.style.width = "50px"
document.body.append(josh)
setInterval( () => {
let currentPosition = parseInt(josh.style.left)
josh.style.left = currentPosition + 6 + 'px'
}, 20)
setTimeout( () => {
josh.remove()
}, 5000)
}
})
|
var map;
var infoBox;
var mgr;
$(document).ready(function () {
map = new BMap.Map('map_canvas');
var poi = new BMap.Point(121.48,31.23);
map.centerAndZoom(poi, 12);
map.enableScrollWheelZoom(true);
var html = ["<div class='infoBoxContent'><div class='title'><strong>TEST项目</strong><span class='price'>负责人:test</span></div>",
"<div class='list'><ul><li><div class='left'><img src='../map/img/tree.jpg'/></div><div class='left'><a target='_blank' href='http://map.baidu.com'>点击可以连接</a><p>描述描述描述描述描述</p></div><div class='rmb'>已处理</div></li>"
,"<li><div class='left'><img src='../map/img/tree2.jpg'/></div><div class='left'><a target='_blank' href='http://map.baidu.com'>testtesttesttesttesttesttest</a><p>testtesttesttesttest</p></div><div class='rmb'>未处理</div></li>"
,"<li><div class='left'><img src='../map/img/tree3.jpg'/></div><div class='left'><a target='_blank' href='http://map.baidu.com'>11111111</a><p></p></div><div class='rmb'>已处理</div></li>"
,"<li><div class='left'><img src='../map/img/tree4.jpg'/></div><div class='left'><a target='_blank' href='http://map.baidu.com'>22222222</a><p></p></div><div class='rmb'>已处理</div></li>"
,"<li class='last'><div class='left'><img src='../map/img/tree5.jpg'/></div><div class='left'><a target='_blank' href='http://map.baidu.com'>333333333</a><p></p></div><div class='rmb'>已处理</div></li>"
,"</ul></div>"
,"</div>"];
infoBox = new BMapLib.InfoBox(map,html.join(""),{
boxStyle:{
background:"url('tipbox.gif') no-repeat center top"
,width: "270px"
,height: "300px"
}
,closeIconMargin: "1px 1px 0 0"
,enableAutoPan: true
,align: INFOBOX_AT_TOP
});
// var marker = new BMap.Marker(poi);
// map.addOverlay(marker);
// marker.setAnimation(BMAP_ANIMATION_BOUNCE);
// marker.disableDragging();
// marker.addEventListener("click", function(){
// infoBox.open(marker);
// });
$("close").onclick = function(){
infoBox.close();
}
$("open").onclick = function(){
infoBox.open(marker);
}
$("show").onclick = function(){
infoBox.show();
}
$("hide").onclick = function(){
infoBox.hide();
}
$("enableAutoPan").onclick = function(){
infoBox.enableAutoPan();
}
$("disableAutoPan").onclick = function(){
infoBox.disableAutoPan();
}
function $(id){
return document.getElementById(id);
}
addMarker(121.47, 31.22 );
// addMarker(121.43, 31.18 );
// addMarker(121.42, 31.22);
// addMarker(121.45, 31.23);
// addMarker(121.4, 31.25 );
// addMarker(121.45, 31.25 );
// addMarker(121.5, 31.27);
// addMarker(121.52, 31.27);
// addMarker(121.38, 31.12);
// addMarker(121.48, 31.4);
// addMarker(121.27, 31.38);
//mgrmarker******************
var padding = 200;
mgr = new BMapLib.MarkerManager(map,{
borderPadding: padding
,maxZoom: 18
,trackMarkers: true
});
var markersConfig = [{minZoom: 1, maxZoom: 10, markerCount:10 }
,{minZoom: 11, maxZoom: 12, markerCount:10 }
,{minZoom: 13, maxZoom: 15, markerCount:15 }
,{minZoom: 16, maxZoom: 17, markerCount:10 }
,{minZoom: 18, maxZoom: 19, markerCount:10 }
];
for(var i in markersConfig){
var t = markersConfig[i];
var mks = getRandomMarker(map,t.markerCount,padding);
mgr.addMarkers(mks,t.minZoom,t.maxZoom)
}
// mgr.showMarkers()
//******************
});
// 编写自定义函数,创建标注
function addMarker(longitude,latitude){
var point = new BMap.Point(longitude,latitude);
var marker = new BMap.Marker(point);
// var marker = richMarker(point);
map.addOverlay(marker);
marker.addEventListener("click", function(){
infoBox.open(marker);
});
}
function richMarker(point) {
var htm = "<div id='overLay' class='level1_label'>1256张图片" + "</div>";
var richMarker = new BMapLib.RichMarker(htm, point, {"anchor": new BMap.Size(-72, -84), "enableDragging": true});
return richMarker;
}
/**
* 随机生成marker
*
* @param {Map}
* map 地图map对象
* @param {Number}
* num 要产生的marker的数量
* @param {Boolean}
* isInViewport 是否需要只在视口中的marker
* @return {Array} marker的数组集合
*/
function getRandomMarker(map,num,borderPadding){
var container = map.getContainer()
, markers = []
, height = parseInt(container.offsetHeight,10) / 2 + borderPadding
, width = parseInt(container.offsetWidth,10) / 2 + borderPadding;
var center = map.getCenter(), pixel = map.pointToPixel(center);
var realBounds = mgr._getRealBounds();
//随机一个新的坐标,不超过地图+borderPadding范围
for(var i = num; i--;){
var w = width * Math.random(), h = height * Math.random();
var newPixel = { x : pixel.x + (Math.random() > 0.5 ? w : -w),
y : pixel.y + (Math.random() > 0.5 ? h : -h)}
, newPoint = map.pixelToPoint(newPixel);
var marker = new BMap.Marker(newPoint);
if(realBounds.containsPoint(newPoint)){
markers.push(marker);
(function(mk){
mk.addEventListener('click', function(){
infoBox.open(mk);
});
})(marker);
}
}
return markers;
}
|
define([
'sgc-mongoose-model',
'chai',
'sinonIE'], function(RemoteModel, chai) {
'use strict';
return function() {
var Collection = RemoteModel.Collection;
var Model = RemoteModel.Model;
chai.should();
describe('Test navigate representation users/35151/comments', function() {
it('Test navigate representation comments', function(){
var collection = new (Collection.extend({},
{
modelName:'Comment'
}))();
collection.navigateRepresentation().should.equal('comments');
});
it('Test navigate representation', function(){
var parentModel = new (Model.extend({},
{
modelName:'User'
}))('35151');
var SubCollection = Collection.extend({},
{
modelName:'Comment'
});
parentModel.generateSchemaAttribute('comments', {type:'COLLECTION', generator:SubCollection});
parentModel.comments.navigateRepresentation().should.equal('users/35151/comments');
});
it('Test navigate representation users/35151/comments/321', function(){
var parentModel = new (Model.extend({},
{
modelName:'User'
}))('35151');
var SubCollection = Collection.extend({},
{
modelName:'Comment'
});
parentModel.generateSchemaAttribute('comments', {type:'COLLECTION', generator:SubCollection});
parentModel.comments.add('321');
parentModel.comments.at(0).navigateRepresentation().should.equal('users/35151/comments/321');
});
it('Test navigate representation users/35151', function(){
var parentModel = new (Model.extend({},
{
modelName:'User'
}))('35151');
parentModel.navigateRepresentation().should.equal('users/35151');
});
it('Test model from collection comments/123', function(){
var collection = new (Collection.extend({},
{
modelName:'Comment'
}))();
collection.add('123');
collection.at(0).navigateRepresentation().should.equal('comments/123');
});
it('Test submodel from model users/35151/author/6512', function(){
var parentModel = new (Model.extend({},
{
modelName:'User'
}))('35151');
parentModel.generateSchemaAttribute('author', {type:'MODEL', generator:Model});
parentModel.author.set('_id', '6512');
parentModel.author.navigateRepresentation().should.equal('users/35151/author/6512');
});
it('Test navigate with navigate root for comment to true representation /comments/321', function(){
var parentModel = new (Model.extend({},
{
modelName:'User'
}))('35151');
var SubCollection = Collection.extend({},
{
modelName:'Comment',
navigateRoot:true
});
parentModel.generateSchemaAttribute('comments', {type:'COLLECTION', generator:SubCollection});
parentModel.comments.add('321');
parentModel.comments.at(0).navigateRepresentation().should.equal('comments/321');
});
it('Test navigate with navigate root for comment to true representation /comments', function(){
var parentModel = new (Model.extend({},
{
modelName:'User'
}))('35151');
var SubCollection = Collection.extend({},
{
modelName:'Comment',
navigateRoot:true
});
parentModel.generateSchemaAttribute('comments', {type:'COLLECTION', generator:SubCollection});
parentModel.comments.navigateRepresentation().should.equal('comments');
});
});
};
});
|
import React, { Component } from 'react';
class BirthdayButton extends React.Component {
constructor(props) {
super(props);
this.state = {
position: this.props.age
};
}
render() {
return (
<fieldset>
<button onClick={ this.switch }>Birthday Button for { this.props.firstName } { this.props.lastName } </button>
</fieldset>
);
}
switch = () => {
var age = this.state.position
age++;
this.state = {
position: age
};
}
}
export default BirthdayButton
|
module.exports = {
ENV: process.env.NODE_ENV || 'development',
PORT: process.env.PORT || 5000,
URL: process.env.BASE_URL || 'https://localhost:5000',
MONGODB_URI: process.env.MONGODB_URI || '',
accessKeyId: '',
jwt_secret: '', //
jwt_expiration_in_seconds: 36000, // Token lasts 1 hour
secretAccessKey: '',
permissionLevels: {
USER: 1,
REGISTERED_USER: 4,
ADMIN: 2048,
},
};
|
import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import { graphql, withApollo } from 'react-apollo';
import { channelQuery } from '../../models/gql/remote';
class SelectedChannel extends React.Component {
get channelName() {
const { data } = this.props;
const { channel, error, loading } = data;
console.log('data', data);
// channelId改变时loading会变为true
if (loading || error) return null;
return channel && channel.name;
}
render() {
return <span>{this.channelName}</span>;
}
}
SelectedChannel.propTypes = {
data: PropTypes.object.isRequired
};
const SelectedChannelWithData = graphql(channelQuery, {
options: props => ({
// fetchPolicy: 'network-only',
variables: { channelId: props.channelId },
}),
})(SelectedChannel);
export default SelectedChannelWithData;
|
import React, { Component } from 'react';
import { BrowserRouter as Router, Route, Link, Switch } from 'react-router-dom';
import ApolloClient from 'apollo-boost';
import { ApolloProvider, } from 'react-apollo';
import './App.css';
import Post from './Posts/Post';
import Posts from './Posts/Posts';
import NewPost from './Posts/NewPost';
// local states
const defaultState = {
isEditMode: false
}
const client = new ApolloClient({
uri: 'https://api-apeast.graphcms.com/v1/cjlz4d1sv09e301eo8ag0e33k/master',
clientState: {
defaults: defaultState,
resolvers: {} // to make isEditMode work
}
})
// client.query({
// query:POST_QUERY
// }).then(res => console.log(res));
class App extends Component {
render() {
return (
<ApolloProvider client={client}>
<Router>
<div className="App">
<header className="App-header">
<Link to={'/'}>
<h1 className="App-title">GraphQL is Great</h1>
</Link>
</header>
<main>
<Switch>
<Route exact path="/" component={Posts} />
<Route exact path="/post/new" component={NewPost} />
<Route path="/post/:id" component={Post} />
</Switch>
</main>
</div>
</Router>
</ApolloProvider>
);
}
}
export default App;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.