text stringlengths 7 3.69M |
|---|
import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
const useStyles = makeStyles(theme => ({
cointainer: {
display: 'flex',
height: '4vw',
alignItems: 'center',
},
cryptoName: {
width: '14.2vw',
height: '100%',
padding: '0 1.1vw',
fontSize: '21px',
fontWeight: '700',
display: 'flex',
alignItems: 'center',
},
cryptoPrice: {
width: '9vw',
display: 'flex',
alignItems: 'center',
fontSize: '19px',
height: '100%',
justifyContent: 'center',
},
cryptoVolume: {
width: '12vw',
display: 'flex',
alignItems: 'center',
fontSize: '19px',
height: '100%',
justifyContent: 'center',
},
cryptoChangePositive: {
width: '11vw',
display: 'flex',
alignItems: 'center',
fontSize: '19px',
height: '100%',
justifyContent: 'center',
color: 'green',
},
cryptoChangeNegative: {
width: '11vw',
display: 'flex',
alignItems: 'center',
fontSize: '19px',
height: '100%',
justifyContent: 'center',
color: 'red',
},
cryptoSymbol: {
width: '8vw',
display: 'flex',
alignItems: 'center',
fontSize: '19px',
height: '100%',
justifyContent: 'center',
},
cryptoDif: {
width: '10vw',
display: 'flex',
alignItems: 'center',
fontSize: '19px',
height: '100%',
justifyContent: 'center',
},
algorithm: {
width: '10vw',
display: 'flex',
alignItems: 'center',
fontSize: '19px',
height: '100%',
justifyContent: 'center',
},
logo: {
paddingRight: '1vw',
width: '30px',
height: '30px',
},
}));
const CryptoItem = ({ coinInfo, coinDetails }) => {
const classes = useStyles();
const { FullName } = coinInfo;
const {
PRICE,
VOLUME24HOURTO,
CHANGEPCT24HOUR,
IMAGEURL,
FROMSYMBOL,
HIGH24HOUR,
LOW24HOUR,
} = coinDetails;
if (!coinInfo) return null;
return (
<div className={classes.cointainer}>
<div className={classes.cryptoName}>
<img
src={`https://www.cryptocompare.com/${IMAGEURL}`}
alt='logo'
className={classes.logo}
/>
{FullName}
</div>
<div className={classes.cryptoPrice}>{PRICE}</div>
<div className={classes.cryptoVolume}>{VOLUME24HOURTO}</div>
<div
className={
CHANGEPCT24HOUR > 0
? classes.cryptoChangePositive
: classes.cryptoChangeNegative
}>
{CHANGEPCT24HOUR} %
</div>
<div className={classes.cryptoSymbol}>{FROMSYMBOL}</div>
<div className={classes.cryptoDif}>{HIGH24HOUR}</div>
<div className={classes.cryptoDif}>{LOW24HOUR}</div>
<div className={classes.algorithm}>Algorithm</div>
</div>
);
};
export default CryptoItem;
|
var app = angular.module('app', [
'rzModule',
'ngRoute',
'fotomapController'
]);
app.config(['$routeProvider', '$httpProvider', '$locationProvider', function($routeProvider, $httpProvider, $locationProvider) {
$httpProvider.defaults.useXDomain = true;
$routeProvider
.when('/', {
templateUrl: "partials/fotomap.html",
controller: "FotomapController"
})
.when('/about', {
templateUrl: "partials/about.html"
})
.when('/privacy', {
templateUrl: "partials/privacy.html"
})
.otherwise({
redirectTo: '/'
})
// $locationProvider.html5Mode(true);
}]); |
const { describe, it } = require('mocha');
const { request } = require('../context');
describe('Product API responses', () => {
it('<200> GET /products', (done) => {
request.get('/products')
.expect(200)
.end(done);
});
it('<200> GET /products/1001', (done) => {
request.get('/products/1001')
.expect(200)
.end(done);
});
});
|
var rowHighlighterClass = 'list_selected_row';
var gloArrButtonsRow1 = new Array();
$(document).ready(function() {
$(checkBoxSelector).change(function() {
setTimeout(function(){
highlightRow();
}, 5);
});
$('.dataTables_scrollBody').on('scroll', function() {
if($('.context-menu')){
$('.context-menu').hide();
$('.context-menu-shadow').hide();
}
});
$(dataTableSelector + " tr ").contextmenu(function(e) {
e.preventDefault();
//e.stopPropagation();
var rcCheckBoxCheckedId = $(this).find("input:checkbox").attr("id");
if(!$('#'+rcCheckBoxCheckedId).attr('checked'))
{
var checkBoxId = $(this).find("input:checkbox").attr("id");
var isCtrlPressed = e.ctrlKey;
var isShiftPressed = e.shiftKey;
if(!isCtrlPressed && !isShiftPressed){
$(checkBoxSelector ).each(function() {
if(checkBoxId != $(this).attr("id")){
$(this).attr("checked",false);
}
});
}
if(e.shiftKey || (e.shiftKey && e.ctrlKey)){
$(this).find("input:checkbox").simulate('click', {shiftKey: true});
}
else if(e.ctrlKey){
$(this).find("input:checkbox").simulate('click', {ctrlKey: true});
}
else{
$(this).find("input:checkbox").simulate('click');
}
}
});
$(dataTableSelector + " tr ").mouseup(function(e) {
switch (e.which) {
case 1:
if(e.target.nodeName != 'INPUT' && e.target.nodeName != 'A' ){ //alert("LC");
var checkBoxId = $(this).find("input:checkbox").attr("id");
var isCtrlPressed = e.ctrlKey;
var isShiftPressed = e.shiftKey;
if(!isCtrlPressed && !isShiftPressed){
$(checkBoxSelector ).each(function() {
if(checkBoxId != $(this).attr("id")){
$(this).attr("checked",false);
}
});
}
if(e.shiftKey || (e.shiftKey && e.ctrlKey)){
$(this).find("input:checkbox").simulate('click', {shiftKey: true});
}
else if(e.ctrlKey){
$(this).find("input:checkbox").simulate('click', {ctrlKey: true});
}
else{
$(this).find("input:checkbox").simulate('click');
}
}
break;
}
return false;
});
highlightRow();
});
$(function() { $(dataTableSelector + " tr ").contextMenu(function() {
var items = [];
$(pageButtonSetSelector + " > ul > li:visible > a:visible ").each(function(){
items.push(createItem($(this).text(), $(this).attr("id")));
});
return items; });
});
function createItem(text, id){
var o = {};
var cap=text;
var clickE = id;
o[cap]=function() {
//alert(clickE);
$('#'+clickE).click();
} ;
return o;
}
function highlightRow(){
$(checkBoxSelector ).each(function(){
if($(this).is(':checked')){
$(this).closest('tr').children('td').addClass(rowHighlighterClass);
}else{
$(this).closest('tr').children('td').removeClass(rowHighlighterClass);
}
});
}
|
import React from "react"
import Card from "./card"
import { Tabs } from 'antd'
import { Link } from "gatsby"
import Button from "./button"
import { scale, options } from "../utils/typography"
const TabPane = Tabs.TabPane;
const FAQ = () => (
<>
<Tabs defaultActiveKey="1">
<TabPane tab="FAQ" key="1">
<Tab1 />
</TabPane>
<TabPane tab="快速上手" key="2">
<Tab2 />
</TabPane>
<TabPane tab="资料下载" key="3">
<Tab3 />
</TabPane>
<TabPane tab="询价" key="4">
<Tab4 />
</TabPane>
</Tabs>
</>
)
const Tab1 = () => (
<>
<h4 css={styles.cardHeadLine}>
常见问题解答与网管软件、IT运维相关知识
</h4>
<div css={styles.futuraParagraph}>
<Card>
<li><a href="http://www.siteview.com/sites/siteview/home/document/siteview-itoss/itoss-faq/faq-azjc/faq-az01.html">ITOSS产品安装环境要求</a></li>
<li><a href="http://www.siteview.com/sites/siteview/home/document/siteview-itoss/itoss-faq/faq-azjc/faq-az12.html">ITOSS端口修改配置</a></li>
<li><a href="http://www.siteview.com/sites/siteview/home/document/siteview-itoss/itoss-faq/faq-azjc/faq-zyjc02.html">linux下如何添加SNMP服务</a></li>
<li><a href="http://www.siteview.com/sites/siteview/home/document/siteview-itoss/itoss-faq/faq-azjc/faq-zyjc04.html">邮件报警配置方法</a></li>
</Card>
<Card>
<li><a href="http://www.siteview.com/sites/siteview/home/document/siteview-itoss/itoss-faq/faq-azjc/faq-az04.html">添加JAVA环境变量</a></li>
<li><a href="http://www.siteview.com/sites/siteview/home/document/siteview-itoss/itoss-faq/faq-azjc/faq-zyjc01.html">Windows如何配置SNMP服务</a></li>
<li><a href="http://www.siteview.com/sites/siteview/home/document/siteview-itoss/itoss-faq/faq-azjc/faq-zyjc03.html">网络设备如何开启SNMP</a></li>
<li><a href="http://www.siteview.com/sites/siteview/home/document/siteview-itoss/itoss-faq/faq-azjc/faq-zyjc05.html">微信报警配置</a></li>
</Card>
<Card>
<li><a href="http://www.siteview.com/sites/siteview/home/document/siteview-itoss/itoss-faq/faq-azjc/faq-az01.html">查看更多FAQ</a></li>
</Card>
</div>
</>
)
const Tab2 = () => (
<>
<h4 css={styles.cardHeadLine}>
关于安装、监测、运维详细操作步骤
</h4>
<h2 css={{color: `#1890FF`}}>
“非常快速地按步骤就能把ITOSS部署下去,实现落地应用,介绍通俗易懂,也很专业。”
</h2>
<Button secondary to="http://www.siteview.com/sites/siteview/home/quict-start.html" tag="href" overrideCSS={{marginTop: `3rem`, marginLeft: `0rem`}} style={{textDecoration: 'none', fontFamily: options.headerFontFamily.join(`,`),}}>
快速上手
</Button>
</>
)
const Tab3 = () => (
<>
<h4 css={styles.cardHeadLine}>
关于产品资料、用户手册的下载与升级更新说明
</h4>
<div css={styles.futuraParagraph}>
<Card>
<li><a href="http://www.siteview.com/sites/siteview/home/document/siteview-itoss/itossinformation-download.html">SITEVIEW ITOSS PPT演示</a></li>
<li><a href="http://www.siteview.com/sites/siteview/home/document/siteview-itoss/itossinformation-download.html">SITEVIEW ITOSS PDF彩页产品介绍</a></li>
<li><a href="http://www.siteview.com/sites/siteview/home/document/siteview-itoss/itossinformation-download.html">SITEVIEW ITOSS 用户手册</a></li>
<li><a href="http://www.siteview.com/sites/siteview/home/document/siteview-itoss/itossupdate-instruction.html">升级更新说明</a></li>
</Card>
<Card>
<li><Link to="/404/">前往文档中心</Link></li>
</Card>
</div>
</>
)
const Tab4 = () => (
<>
<h4 css={styles.cardHeadLine}>
产品报价、定制、OEM、需求咨询
</h4>
<div css={styles.futuraParagraph}>
<Card>
<li><a href="http://www.siteview.com/sites/siteview/home/price.html">产品报价</a></li>
<li><a href="http://www.siteview.com/sites/siteview/home/oem.html">OEM合作</a></li>
<li><p>客服热线:400-705-0567</p></li>
<li><p>销售电话:13520830552(彭先生)</p></li>
</Card>
<Card>
<li><Link to="/about/contactus/">联系我们</Link></li>
</Card>
</div>
</>
)
const styles = {
cardHeadLine: {
...scale(1 / 5),
marginTop: 0,
color: `#1890FF`,
},
demand: {
marginLeft: `18px`,
padding: `30px`,
},
futuraParagraph: {
fontFamily: options.headerFontFamily.join(`,`),
marginBottom: 0,
display: `flex`,
width: `100%`,
},
}
export default FAQ |
import Vue from 'vue';
import table from '../../components/table/table.vue';
new Vue({
el:"#app",
data:{
lists:null
},
components:{
componentTable:table
}
}) |
function FindProxyForURL(url, host)
{
return "SOCKS5 home.z0.hk:28080;DIRECT;";
}
|
import firebase, { firestore, storage } from "../../firebase/firebase";
import * as actionTypes from "../../redux/actions/actionTypes";
import { successNotification } from "../../utils/notifications";
export const getAllPostersId = () => {
let posters = [];
return firestore
.collection("posters")
.get()
.then((querySnapshot) => {
querySnapshot.forEach((doc) => {
posters.push(doc.id);
});
})
.then(() => JSON.stringify(posters))
.catch((error) => {
console.log("Error getting documents: ", error);
});
};
export const fetchPostersbyCategory = (category) => {
let posters = [];
let promises = [];
let lastVisible;
return firestore
.collection("posters")
.where("category", "==", category)
.where("visibility", "==", true)
.orderBy("ratingsCount", "desc")
.limit(5)
.get()
.then((querySnapshot) => {
lastVisible = querySnapshot.docs[querySnapshot.docs.length - 1];
querySnapshot.forEach((doc) => {
let posterData = doc.data();
posterData.id = doc.id;
if (posterData.authorRef) {
promises.push(
posterData.authorRef.get().then((res) => {
posterData.authorData = res.data();
})
);
}
posters.push(posterData);
});
return Promise.all(promises);
})
.then(() => {
// return JSON.stringify(posters);
return { posters, lastVisible };
})
.catch((err) => new Error(err.message));
};
export const fetchNextPostersbyCategory = (category, last) => {
let posters = [];
let promises = [];
let lastVisible;
return firestore
.collection("posters")
.where("category", "==", category)
.where("visibility", "==", true)
.orderBy("ratingsCount", "desc")
.startAfter(last)
.limit(5)
.get()
.then((querySnapshot) => {
if (last) lastVisible = querySnapshot.docs[querySnapshot.docs.length - 1];
else lastVisible = null;
querySnapshot.forEach((doc) => {
let posterData = doc.data();
posterData.id = doc.id;
if (posterData.authorRef) {
promises.push(
posterData.authorRef.get().then((res) => {
posterData.authorData = res.data();
})
);
}
posters.push(posterData);
});
return Promise.all(promises);
})
.then(() => {
// return JSON.stringify(posters);
return { posters, lastVisible };
})
.catch((err) => new Error(err.message));
};
export const fetchPostersbyId = (documentId) => {
let promises = [];
let poster;
return firestore
.collection("posters")
.doc(documentId)
.get()
.then((doc) => {
if (doc.exists) {
poster = doc.data();
poster.id = doc.id;
promises.push(
poster.authorRef.get().then((res) => {
poster.authorData = res.data();
})
);
return Promise.all(promises);
} else return {};
})
.then(() => {
return JSON.stringify(poster);
});
};
export const fetchPosters = () => {
let posters = [];
let promises = [];
let lastVisible;
return firestore
.collection("posters")
.where("visibility", "==", true)
.orderBy("ratingsCount", "desc")
.limit(5)
.get()
.then((querySnapshot) => {
lastVisible = querySnapshot.docs[querySnapshot.docs.length - 1];
querySnapshot.forEach((doc) => {
let posterData = doc.data();
posterData.id = doc.id;
if (posterData.authorRef) {
promises.push(
posterData.authorRef.get().then((res) => {
posterData.authorData = res.data();
})
);
}
posters.push(posterData);
});
return Promise.all(promises);
})
.then(() => {
// return JSON.stringify(posters);
return { posters, lastVisible };
})
.catch((err) => new Error(err.message));
};
export const fetchNextPosters = (last) => {
let posters = [];
let promises = [];
let lastVisible;
return firestore
.collection("posters")
.where("visibility", "==", true)
.orderBy("ratingsCount", "desc")
.startAfter(last)
.limit(5)
.get()
.then((querySnapshot) => {
if (last) lastVisible = querySnapshot.docs[querySnapshot.docs.length - 1];
else lastVisible = null;
querySnapshot.forEach((doc) => {
let posterData = doc.data();
posterData.id = doc.id;
if (posterData.authorRef) {
promises.push(
posterData.authorRef.get().then((res) => {
posterData.authorData = res.data();
})
);
}
posters.push(posterData);
});
return Promise.all(promises);
})
.then(() => {
// return JSON.stringify(posters);
return { posters, lastVisible };
})
.catch((err) => new Error(err.message));
};
export const fetchPostersByUserId = (userId) => {
const posters = [];
return firestore
.collection("posters")
.where("userId", "==", userId)
.orderBy("date", "desc")
.get()
.then((querySnapshot) => {
querySnapshot.forEach((doc) => {
posters.push({ ...doc.data(), id: doc.id });
});
})
.then(() => {
return JSON.stringify(posters);
});
};
export const fetchPostersByUserId2 = (userId) => {
return (dispatch) => {
const unsubscribe = firestore
.collection("posters")
.where("userId", "==", userId)
.orderBy("date", "desc")
.onSnapshot((querySnapshot) => {
let posters = [];
querySnapshot.forEach((doc) => {
posters.push({ id: doc.id, ...doc.data() });
});
dispatch({
type: actionTypes.FETCH_MY_POSTERS,
posters: posters,
});
});
return unsubscribe;
};
};
export const fetchPostersByUserId3 = (userId) => {
return (dispatch) => {
const unsubscribe = firestore
.collection("posters")
.where("userId", "==", userId)
.where("visibility", "==", true)
.orderBy("date", "desc")
.onSnapshot((querySnapshot) => {
let posters = [];
querySnapshot.forEach((doc) => {
posters.push({ id: doc.id, ...doc.data() });
});
dispatch({
type: actionTypes.FETCH_MY_POSTERS,
posters: posters,
});
});
return unsubscribe;
};
};
export const uploadPoster = (poster) => {
firestore
.collection("posters")
.add({
title: poster.title,
description: poster.description,
category: poster.category,
keywords: poster.keywords,
works: [],
ratings: [],
userId: poster.userId,
visibility: true,
ratingsCount: 0,
authorRef: firestore.doc(`/users/${poster.userId}`),
price: parseInt(poster.price),
location: poster.location,
phoneNumber: poster.phoneNumber,
date: firebase.firestore.FieldValue.serverTimestamp(),
})
.then((docRef) => {
const promises = [];
const urls = [];
poster.photos.forEach((file) => {
const name = Date.now().toString() + Math.random(3).toFixed(3);
const uploadTask = storage
.ref()
.child(`${poster.userId}/posters/${docRef.id}/${name}`)
.put(file);
promises.push(uploadTask);
uploadTask.on(
firebase.storage.TaskEvent.STATE_CHANGED,
(snapshot) => {
const progress =
(snapshot.bytesTransferred / snapshot.totalBytes) * 100;
if (snapshot.state === firebase.storage.TaskState.RUNNING) {
console.log(`Progress: ${progress}%`);
}
},
(error) => console.log(error.code),
async () => {
const downloadURL = await uploadTask.snapshot.ref.getDownloadURL();
// do something with the url
firestore
.collection("posters")
.doc(docRef.id)
.update({
works: firebase.firestore.FieldValue.arrayUnion(downloadURL),
});
}
);
});
return Promise.all(promises)
.then(() => {
successNotification("Success", "Poster Uploaded");
console.log(urls);
return urls;
})
.catch((err) => console.log(err.code));
});
};
export const updatePoster = (poster) => {
return firestore
.collection("posters")
.doc(poster.id)
.update({
title: poster.title,
description: poster.description,
category: poster.category,
price: parseInt(poster.price),
location: poster.location,
phoneNumber: poster.phoneNumber,
keywords: poster.keywords
})
.then(() => {
successNotification("Success", "Successfully Updated Poster");
})
.catch((e) => {
return new Error(e.message);
});
};
export const updatePosterVisibility = (id, visibility) => {
return firestore
.collection("posters")
.doc(id)
.update({
visibility,
})
.then(() => {
successNotification("Success", "Successfully Updated Poster");
})
.catch((e) => {
return new Error(e.message);
});
};
export const deletePoster = (id) => {
firestore
.collection("posters")
.doc(id)
.delete()
.then(() => {
successNotification("Success", "Poster Deleted");
})
.catch((e) => {
throw new Error(e.message);
});
};
export const resetPosters = () => {
return (dispatch) => {
dispatch({ type: actionTypes.RESET_POSTERS });
};
};
|
function cashGo()
{
var form = document.getElementsByName('result');
var hiddenF = document.createElement('input');
hiddenF.setAttribute('type', 'hidden');
hiddenF.setAttribute('name', 'how');
var how = document.getElementsByName('how');
hiddenF.setAttribute('value', how[0].value);
form[0].appendChild(hiddenF);
form[0].submit();
}
function book(max)
{
var obj = document.getElementsByName('seat');
var checked_cnt = 0;
var checked_value = '';
var arr = new Array();
for( i=0; i<obj.length; i++ ) {
if(obj[i].checked) {
checked_cnt = checked_cnt+1;
checked_value = obj[i].value;
arr[checked_cnt-1] = checked_value.split('/')[0];
}
}
if( checked_cnt > max )
{
alert('인원이 초과했습니다.');
}
else if( checked_cnt < max )
{
alert('선택하지 않은 좌석이 있습니다.');
}
else if( checked_cnt == max )
{
var form = document.getElementsByName('seatform');
form[0].setAttribute('action', 'book_action.php');
var hiddenF = document.createElement('input');
hiddenF.setAttribute('type', 'hidden');
hiddenF.setAttribute('name', 'seats');
hiddenF.setAttribute('value', arr);
form[0].appendChild(hiddenF);
form[0].submit();
}
}
function bt(id)
{
var prev_bt = document.getElementsByClassName('button_select');
var selected_id = document.getElementById(id);
prev_bt[0].className='button effect';
selected_id.className='button_select';
menu = document.getElementById("s_bt1_m").setAttribute("style", "visibility: hidden;");
menu = document.getElementById("s_bt2_m").setAttribute("style", "visibility: hidden;");
menu = document.getElementById("s_"+id+"_m");
menu.setAttribute("style", "visibility: visible;");
if( id == 'bt1' ) cur = 'A';
else if( id == 'bt2' ) cur = 'B';
else cur = 'C';
}
function next()
{
var ck = valid();
if( ck == 5 )
{
setPost();
}
else if( ck == 0 ) alert('출발지 확인');
else if( ck == 1 ) alert('도착지 확인');
else if( ck == 2 ) alert('날짜 확인');
else if( ck == 3 ) alert('시간 확인');
else if( ck == 4 ) alert('매표수 확인');
}
var start;
var end;
var date;
var time;
var senior;
var student;
var junior;
var role;
function valid()
{
start = document.getElementsByName('start');
end = document.getElementsByName('end');
date = document.getElementsByName('date');
time = document.getElementsByName('time');
senior = document.getElementsByName('senior');
student = document.getElementsByName('student');
junior = document.getElementsByName('junior');
role = document.getElementsByName('role');
var result = 0;
if( start[0].value == 0 ) result = 0;
else if( end[0].value == 0 ) result = 1;
else if( date[0].value == 0 ) result = 2;
else if( time[0].value == 0 ) result = 3;
else if( senior[0].value == 0 && student[0].value == 0 && junior[0].value == 0 ) result = 4;
else result = 5;
return result;
}
function setPost()
{
var form = document.createElement('form');
form.setAttribute('method', 'post');
form.setAttribute('action', './book.php');
var hiddenF = document.createElement('input');
hiddenF.setAttribute('type', 'hidden');
hiddenF.setAttribute('name', 'start');
hiddenF.setAttribute('value', start[0].value);
form.appendChild(hiddenF);
hiddenF = document.createElement('input');
hiddenF.setAttribute('type', 'hidden');
hiddenF.setAttribute('name', 'end');
hiddenF.setAttribute('value', end[0].value);
form.appendChild(hiddenF);
hiddenF = document.createElement('input');
hiddenF.setAttribute('type', 'hidden');
hiddenF.setAttribute('name', 'date');
hiddenF.setAttribute('value', date[0].value);
form.appendChild(hiddenF);
hiddenF = document.createElement('input');
hiddenF.setAttribute('type', 'hidden');
hiddenF.setAttribute('name', 'time');
hiddenF.setAttribute('value', time[0].value);
form.appendChild(hiddenF);
hiddenF = document.createElement('input');
hiddenF.setAttribute('type', 'hidden');
hiddenF.setAttribute('name', 'role');
hiddenF.setAttribute('value', role[0].value);
form.appendChild(hiddenF);
hiddenF = document.createElement('input');
hiddenF.setAttribute('type', 'hidden');
hiddenF.setAttribute('name', 'senior');
hiddenF.setAttribute('value', senior[0].value);
form.appendChild(hiddenF);
hiddenF = document.createElement('input');
hiddenF.setAttribute('type', 'hidden');
hiddenF.setAttribute('name', 'student');
hiddenF.setAttribute('value', student[0].value);
form.appendChild(hiddenF);
hiddenF = document.createElement('input');
hiddenF.setAttribute('type', 'hidden');
hiddenF.setAttribute('name', 'junior');
hiddenF.setAttribute('value', junior[0].value);
form.appendChild(hiddenF);
form.submit();
}
|
import React from "react";
import GroupCallRoomListItem from "./GroupCallRoomListItem";
import { useSelector } from "react-redux";
const GroupCallRoomList = () => {
const { rooms } = useSelector((state) => state.call);
return (
<div className="w-full bg-customBlack flex overflow-y-auto ">
{rooms &&
rooms.map((room) => {
return (
<React.Fragment key={room.roomId}>
<GroupCallRoomListItem room={room} />
</React.Fragment>
);
})}
</div>
);
};
export default GroupCallRoomList;
|
import Card from '../components/Cards.js';
import FormValidation from '../components/FormValidator.js';
import {
editPopup,
addPopup,
imgPopup,
deletePopup,
editBtn,
addBtn,
validationConfig,
profileForm,
nameInput,
aboutInput,
profileName,
profileAbout,
profileAvatar,
container,
cardPopupForm,
templateElement,
avatarForm,
avatarBtn,
avatarUpdatePopup,
} from '../constants/variables.js';
import Section from '../components/Section.js';
import UserInfo from '../components/UserInfo.js';
import PopupWithImage from '../components/PopupWithImage.js';
import PopupWithForm from '../components/PopupWithForm.js';
import PopupWithDeleteForm from '../components/PopupWithDeleteForm.js';
import Api from '../components/Api.js';
import './index.css';
const api = new Api({
address: "https://mesto.nomoreparties.co/v1/cohort-27",
token: "f8a0f685-371b-49c7-8421-4195e39df623",
});
const createCard = (data) => {
const card = new Card({
data: data,
cardTemplate: templateElement,
handleCardClick: () => {
popupWithImage.open(data);
},
handleCardDelete: () => {
deleteCardPopup.open(()=> {
deleteCardPopup.setLoading(true);
api.deleteCard(data._id)
.then(() => {
card.deleteButtonClick();
deleteCardPopup.close();
})
.catch((err) => console.log(`Ошибка при удалении карточки: ${err}`))
.finally(() => {
deleteCardPopup.setLoading(false);
});
})
},
userId: userInfo.getUserId(),
api: api,
});
const cardElement = card.generateCard();
return cardElement;
};
const cardsList = new Section(
{
renderer: (data) => {
cardsList.addItem(createCard(data));
},
},
container
);
const userInfo = new UserInfo({
name: profileName,
about: profileAbout,
avatar: profileAvatar,
});
Promise.all([api.getUserData(), api.getInitialCards()]).then(
([userData, initialCards]) => {
userInfo.setUserInfo({
name: userData.name,
about: userData.about,
avatar: userData.avatar,
id: userData._id,
});
cardsList.renderItems(initialCards);
})
.catch((err) => console.log(`Ошибка: ${err}`));
const popupWithImage = new PopupWithImage(imgPopup);
const addCardPopup = new PopupWithForm(addPopup, addCardSubmitHandler);
const editProfilePopup = new PopupWithForm(editPopup, editFormSubmitHandler);
const deleteCardPopup = new PopupWithDeleteForm(deletePopup);
const formAddCardValidator = new FormValidation(validationConfig, cardPopupForm);
const formEditCardValidator = new FormValidation(validationConfig, profileForm);
const formUpdateAvatarValidator = new FormValidation(validationConfig, avatarForm);
// Обновление аватара
const updateAvatarPopup = new PopupWithForm(avatarUpdatePopup, avatarPopupSubmitHandler);
function avatarPopupSubmitHandler(data) {
updateAvatarPopup.setLoading(true);
api
.updateAvatar(data.avatar)
.then((res) => {
userInfo.setUserAvatar(res.avatar);
updateAvatarPopup.close();
})
.catch((err) => console.log(`Ошибка при загрузке фотографии: ${err}`))
.finally(() => {
updateAvatarPopup.setLoading(false);
});
}
// Редактирование профиля
function editFormSubmitHandler(data) {
editProfilePopup.setLoading(true);
api
.setUserData(data)
.then(({ name, about, avatar }) => {
userInfo.setUserInfo({ name, about, avatar });
editProfilePopup.close();
})
.catch((err) => console.log(`Ошибка при обновлении профиля: ${err}`))
.finally(() => {
editProfilePopup.setLoading(false);
});
}
// Добавление карточки
function addCardSubmitHandler(data) {
addCardPopup.setLoading(true);
api
.createCard(data)
.then((res) => {
cardsList.addItem(createCard(res));
addCardPopup.close();
})
.catch((err) => console.log(`Ошибка при загрузке карточки: ${err}`))
.finally(() => {
addCardPopup.setLoading(false);
});
}
editBtn.addEventListener('click', () => {
nameInput.value = userInfo.getUserInfo().name;
aboutInput.value = userInfo.getUserInfo().about;
editProfilePopup.open();
formEditCardValidator.reset();
});
addBtn.addEventListener('click', () => {
addCardPopup.open();
formAddCardValidator.reset();
});
avatarBtn.addEventListener("click", () => {
updateAvatarPopup.open();
formUpdateAvatarValidator.reset();
});
updateAvatarPopup.setEventListeners();
addCardPopup.setEventListeners();
editProfilePopup.setEventListeners();
popupWithImage.setEventListeners();
deleteCardPopup.setEventListeners();
formAddCardValidator.enableValidation();
formEditCardValidator.enableValidation();
formUpdateAvatarValidator.enableValidation(); |
import Vue from 'vue';
import KForm from 'vue2-form-validate';
Vue.use(KForm);
|
var fs = require("fs");
fs.readFileSync("input.txt").toString().split("\n").forEach(function (line) {
if (line !== "") {
KnightMoves(line.trim());
}
});
function KnightMoves(position) {
var column = letterToIndex(position[0]),
row = parseInt(position[1]),
positions = possiblePositions(row, column);
positions = positions.map(function (p) {
return indexToLetter(p[0]) + p[1];
});
console.log(positions.sort().join((" ")));
}
function letterToIndex(letter) {
return "abcdefgh".indexOf(letter) + 1;
}
function indexToLetter(index) {
return "abcdefgh"[index - 1];
}
function possiblePositions(row, column) {
var positions = [
[column - 2, row + 1],
[column - 2, row - 1],
[column - 1, row + 2],
[column - 1, row - 2],
[column + 2, row + 1],
[column + 2, row - 1],
[column + 1, row + 2],
[column + 1, row - 2]
];
positions = positions.filter(function (c) {
return c[0] > 0 && c[0] < 9 && c[1] > 0 && c[1] < 9;
});
return positions;
}
|
// IMPORTS
import React from 'react';
import '../styles/components/header/header.css';
import Spinner from './main/spinner';
// COMPONENT
class Header extends React.Component {
constructor(props) {
super(props);
this.state = { isButtonSetAtPhotos: true, isLoaded: false };
this.handleModeChange = this.handleModeChange.bind(this);
this.handleModeChangeToPhotos = this.handleModeChangeToPhotos.bind(this);
this.handleModeChangeToGraphics = this.handleModeChangeToGraphics.bind(this);
this.setStateAs = this.setStateAs.bind(this);
this.handleScrollToTop = this.handleScrollToTop.bind(this);
}
setStateAs(newState) {
this.setState({ isButtonSetAtPhotos: newState });
this.props.changeMode(newState);
}
handleModeChange() {
const black = document.querySelector(".header__black");
const body = document.querySelector("body");
body.style.pointerEvents = "none";
black.style.display = "block";
black.classList.remove("header__black--animate");
black.classList.add("header__black--animate");
this.setStateAs(!this.state.isButtonSetAtPhotos);
document.querySelector("#top").scrollIntoView();
setTimeout(() => {
body.style.pointerEvents = "auto";
black.style.display = "none";
}, 1000);
}
handleModeChangeToPhotos() {
this.setStateAs(true);
}
handleModeChangeToGraphics() {
this.setStateAs(false);
}
handleScrollToTop() {
setTimeout(() => {
document.querySelector("#top").scrollIntoView({ behavior: "smooth" });
}, 10);
}
render() {
return (
<header className="header">
<div className="header__black"></div>
<section className="header__logo" onClick={ this.handleScrollToTop }>
<div className="header__logo__title">
<div className="header__logo__title__name">
<span className="header__logo__title__name__letter">O</span>
<span className="header__logo__title__name__letter">L</span>
<span className="header__logo__title__name__letter">I</span>
<span className="header__logo__title__name__letter">W</span>
<span className="header__logo__title__name__letter">I</span>
<span className="header__logo__title__name__letter">E</span>
<span className="header__logo__title__name__letter" style={{ marginRight: "5px" }}>R</span>
</div>
<div className="header__logo__title__name">
<span className="header__logo__title__name__letter" style={{ marginLeft: "15px" }}>P</span>
<span className="header__logo__title__name__letter">A</span>
<span className="header__logo__title__name__letter">K</span>
<span className="header__logo__title__name__letter">U</span>
<span className="header__logo__title__name__letter">Ł</span>
<span className="header__logo__title__name__letter">A</span>
</div>
</div>
<div className="header__logo__title">
{ this.state.isButtonSetAtPhotos &&
<div className="header__logo__title__brand">
<span className="header__logo__title__brand__letter">P</span>
<span className="header__logo__title__brand__letter">H</span>
<span className="header__logo__title__brand__letter">O</span>
<span className="header__logo__title__brand__letter">T</span>
<span className="header__logo__title__brand__letter">O</span>
<span className="header__logo__title__brand__letter">G</span>
<span className="header__logo__title__brand__letter">R</span>
<span className="header__logo__title__brand__letter">A</span>
<span className="header__logo__title__brand__letter">P</span>
<span className="header__logo__title__brand__letter">H</span>
<span className="header__logo__title__brand__letter">Y</span>
</div>
}
{ !this.state.isButtonSetAtPhotos &&
<div className="header__logo__title__brand">
<span className="header__logo__title__brand__letter">A</span>
<span className="header__logo__title__brand__letter">R</span>
<span className="header__logo__title__brand__letter">T</span>
<span className="header__logo__title__brand__letter" style={{ margin: "0 15px" }}>&</span>
<span className="header__logo__title__brand__letter">D</span>
<span className="header__logo__title__brand__letter">E</span>
<span className="header__logo__title__brand__letter">S</span>
<span className="header__logo__title__brand__letter">I</span>
<span className="header__logo__title__brand__letter">G</span>
<span className="header__logo__title__brand__letter">N</span>
</div>
}
</div>
</section>
<div className="header__mode-changer">
<button
className="header__mode-changer__container"
onClick={ this.handleModeChange }>
<span
className="header__mode-changer__container__button"
style={ this.state.isButtonSetAtPhotos ? {left: "calc(0% - 3px)"} : {left: "calc(100% - 13px)"}} >
</span>
</button>
</div>
</header>
);
}
}
// EXPORTING COMPONENT
export default Header; |
const Joi = require('joi')
const Product = require('../models/product')
const ProductSchema = Joi.object({
ID:
Joi.string()
.pattern(new RegExp(/^[DR]{2}\d/))
.min(3)
.required(),
name:
Joi.string()
.pattern(new RegExp(/^[ a-zA-Z0-9]+$/))
.min(3)
.max(32)
.required(),
price:
Joi.number()
.min(1)
.required()
})
function invalidProductError(message)
{
if(message.includes('"ID"'))
{
return 'The products ID must start with "DR" followed'
+ ' by at least one number.'
}
else if(message.includes('"name"'))
{
return 'You must enter a name with a length between '
+ '3-32 characters and only contain letters, numbers and spaces.'
}
else if(message.includes('"price"'))
{
return 'The price must be a positive number.'
}
else
{
return 'The fields you are trying to add are not allowed.'
}
}
// Middlewares
const tryValidProduct = async (req, res, next) =>
{
const newProduct = req.body
const ID = req.params.id
const product =
{
ID,
name: newProduct.name,
price: newProduct.price
}
try
{
await ProductSchema.validateAsync(product)
next()
}
catch(error)
{
const message = invalidProductError(error.message)
res.status(400).send(message)
}
}
const tryRegisteredProduct = async (req, res, next) =>
{
const ID = req.params.id
try
{
const exist = await Product.findOne({ID})
if(exist)
{
res.status(400).send('A product with the same ID already exists.')
}
else
{
next()
}
}
catch(error)
{
res.status(400).send('Unexpected error in registered product.')
}
}
const tryProductExist = async (req, res, next) =>
{
const ID = req.params.id
try
{
const exist = await Product.findOne({ID})
if(!exist)
{
res.status(400).send('The product you are trying to access' +
' does not exist.')
}
else
{
req.product = exist
next()
}
}
catch(error)
{
res.status(400).send('Unexpected error in registered product.')
}
}
module.exports = {tryRegisteredProduct, tryValidProduct, tryProductExist} |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
const { MessageFactory, InputHints } = require('botbuilder');
const { DialogSet, DialogTurnStatus, TextPrompt, WaterfallDialog } = require('botbuilder-dialogs');
const { InterruptableDialog} = require('./interruptableDialog');
const MAIN_WATERFALL_DIALOG = 'mainWaterfallDialog';
const HANDOFF_DIALOG = "handoffDialog"
class MainDialog extends InterruptableDialog {
constructor(handoffDialog, userState) {
super('MainDialog');
if (!handoffDialog) throw new Error('[MainDialog]: Missing parameter \'handoffDialog\' is required');
// Define the main dialog and its related components.
this.addDialog(new TextPrompt('TextPrompt'))
.addDialog(handoffDialog)
.addDialog(new WaterfallDialog(MAIN_WATERFALL_DIALOG, [
this.introStep.bind(this),
this.finalStep.bind(this)
]));
this.initialDialogId = MAIN_WATERFALL_DIALOG;
}
/**
* The run method handles the incoming activity (in the form of a TurnContext) and passes it through the dialog system.
* If no dialog is active, it will start the default dialog.
* @param {*} turnContext
* @param {*} accessor
*/
async run(turnContext, accessor) {
const dialogSet = new DialogSet(accessor);
dialogSet.add(this);
const dialogContext = await dialogSet.createContext(turnContext);
const results = await dialogContext.continueDialog();
if (results.status === DialogTurnStatus.empty) {
await dialogContext.beginDialog(this.id);
}
}
/**
* First step in the waterfall dialog. Prompts the user for a command.
*/
async introStep(stepContext) {
if(stepContext.context.activity.from.id.indexOf('Agent') > -1)
{
//Agent
return await stepContext.replaceDialog(HANDOFF_DIALOG);
}
const messageText = stepContext.options.restartMsg ? stepContext.options.restartMsg : 'How can I help?';
const promptMessage = MessageFactory.text(messageText, messageText, InputHints.ExpectingInput);
return await stepContext.prompt('TextPrompt', { prompt: promptMessage });
}
/**
* This is the final step in the main waterfall dialog.
*/
async finalStep(stepContext) {
// Restart the main dialog
return await stepContext.replaceDialog(this.initialDialogId);
}
}
module.exports.MainDialog = MainDialog; |
// 引入spa类库
require('./lib/spa.min.js');
require('./lib/swiper-3.3.1.min.js');
// 引入views
require('./views/eat.js');
require('./views/index.js');
require('./views/home.js');
require('./views/login.js');
require('./views/detail.js');
require('./views/outdoors.js');
|
import React, { Component } from 'react';
class Task extends Component {
constructor(props) {
super(props);
this.state = {
taskHovered: false,
isCrossedOff: props.task.crossed_off
};
this.renderStatus = this.renderStatus.bind(this);
this.handleMouseEnter = this.handleMouseEnter.bind(this);
this.handleMouseLeave = this.handleMouseLeave.bind(this);
this.handleTaskClick = this.handleTaskClick.bind(this);
}
renderStatus(isCrossedOff) {
if (isCrossedOff) {
return 'CROSSED OUT';
} else {
return 'ON TIME';
}
}
handleMouseEnter() {
this.setState({ taskHovered: true });
}
handleMouseLeave() {
this.setState({ taskHovered: false });
}
async handleTaskClick(taskId) {
const opts = {
method: 'PUT',
body: JSON.stringify({
crossed_off: !this.props.task.crossed_off,
user_id: localStorage.getItem('id'),
title: this.props.task.title,
task: this.props.task.task
}),
headers: {
'Content-Type': 'application/json'
}
}
try {
const task = await fetch(`/api/tasks/${taskId}`, opts);
const resp = await fetch(`/api/tasks/show/${taskId}`);
const editedTask = await resp.json();
this.setState({ isCrossedOff: editedTask.crossed_off });
} catch (error) {
throw Error(error);
}
this.props.getTasks();
}
render() {
let { task, index, hideCrossedOut } = this.props;
let className = this.props.task.crossed_off ? 'task-text' : null;
let containerClass = hideCrossedOut && this.state.isCrossedOff
? 'crossed-out-hide'
: 'task-container';
let deleteClass = this.state.taskHovered ? ['delete'] : 'delete hide-delete';
return (
<div
className={containerClass}
onClick={() => this.handleTaskClick(task.id)}
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave}>
{/* <div className="buttons">
<button className="edit" onClick={() => this.props.handleEdit(task)}>Edit Task</button>
</div> */}
<div className="task-cell task-status">
<button className={deleteClass}
onClick={() => this.props.handleDelete(task.id)}>X</button>
<span className={className}>{this.renderStatus(this.state.isCrossedOff)}</span>
</div>
<div className="task-cell task-title">
<span className={className}>{task.title}</span>
</div>
<div className="task-cell task-description">
<span className={className}>{task.task}</span>
</div>
</div>
);
}
}
export default Task;
|
import React from 'react';
import '../../style/common.less';
import Util from './../../util/utils';
import BaseForm from '../../components/BaseForm';
import axios from '../../axios'
import { Card, Button, Table, Modal } from 'antd';
export default class Order extends React.Component{
state = {}
params = {
page: 1
}
formList = [
{
type: 'SELECT',
label: '城市',
field: 'city',
placeholder: '全部',
initialValue: 0,
width: 100,
list: [{ id:0, name: '全部'},{ id:1, name: '北京'},{ id:2, name: '天津'},{ id:3, name: '上海'}]
},
{
type: 'TIME'
},
{
type: 'SELECT',
label: '订单状态',
field: 'order_status',
placeholder: '全部',
initialValue: 0,
width: 100,
list: [{ id:0, name: '全部'},{ id:1, name: '进行中'},{ id:2, name: '结束行程'}]
}
]
componentDidMount(){
this.requestList()
}
handleFilter = (params)=>{
this.params = params;
this.requestList()
}
requestList = ()=> {
axios.ajax({
url: '/order/list',
data:{
params: this.params
}
}).then((res)=>{
if(res.code === 0 ){
res.result.item_list.map((item,index)=>{
item.key = index;
return item;
})
this.setState({
dataSource: res.result.item_list,
pagination: Util.pagination(res,(current)=>{
this.params.page = current;
this.requestList()
})
})
}
})
}
onRowClick = (record,index)=>{
let selectKey = [index];
this.setState({
selectedRowKeys: selectKey,
selectedItem: record
})
}
openOrderDetail = () => {
let item = this.state.selectedItem;
if (!item) {
Modal.info({
title: '信息',
content: '请先选择一条订单'
});
return;
}
// 通过window.open 进行路由的跳转
window.open('/#/common/order/detail/' + item.id, '_blank');
};
render(){
const selectedRowKeys = this.state.selectedRowKeys;
const rowSelection = {
type: 'radio',
selectedRowKeys
}
const columns = [
{
title: '订单编号',
dataIndex: 'order_sn'
},
{
title: '车辆编号',
dataIndex: 'bike_sn'
},
{
title: '用户名',
dataIndex: 'user_name'
},
{
title: '手机号',
dataIndex: 'mobile'
},
{
title: '里程',
dataIndex: 'distance',
render(distance){
return distance/1000 + 'Km';
}
},
{
title: '行驶时长',
dataIndex: 'total_time',
},
{
title: '状态',
dataIndex: 'status'
},
{
title: '开始时间',
dataIndex: 'start_time',
},
{
title: '结束时间',
dataIndex: 'end_time'
},
{
title: '订单金额',
dataIndex: 'total_fee'
},
{
title: '实付金额',
dataIndex: 'user_pay'
}
]
return (
<div>
<Card>
<BaseForm formList={this.formList} filterSubmit={this.handleFilter}/>
</Card>
{/* <Card>
<FilterForm/>
</Card> */}
<Card style={{marginTop: 16}}>
<Button type="primary" onClick={this.openOrderDetail}>订单详情</Button>
<Button type="primary" style={{marginLeft:16}}>结束订单</Button>
</Card>
<div className="content-wrap">
<Table
bordered
columns = {columns}
rowSelection={rowSelection}
selectedRowKeys={this.state.selectedRowKeys}
selectedItem={this.state.selectedItem}
dataSource = {this.state.dataSource}
pagination={this.state.pagination}
onRow={(record,index)=>{
return {
onClick:()=>{
this.onRowClick(record,index);
}
}
}}
/>
</div>
</div>
)
}
}
// class FilterForm extends React.Component{
// render(){
// const { getFieldDecorator } = this.props.form;
// return (
// <Form layout="inline">
// <FormItem label="城市">
// {
// getFieldDecorator('city_id',{
// initialValue: ""
// })(
// <Select style={{width:120}}>
// <Option value="">全部</Option>
// <Option value="1">北京市</Option>
// <Option value="2">天津市</Option>
// <Option value="3">上海市</Option>
// </Select>
// )
// }
// </FormItem>
// <FormItem label="订单时间">
// {
// getFieldDecorator('start_time')(
// <DatePicker showTime format="YYYY-MM-DD HH:mm:ss" />
// )
// }
// </FormItem>
// <FormItem >
// {
// getFieldDecorator('end_time')(
// <DatePicker style={{marginLeft: 16}} showTime format="YYYY-MM-DD HH:mm:ss" />
// )
// }
// </FormItem>
// <FormItem label="订单状态">
// {
// getFieldDecorator('order_status',{
// initialValue: ""
// })(
// <Select style={{width:120}}>
// <Option value="">全部</Option>
// <Option value="1">进行中</Option>
// <Option value="2">结束行程</Option>
// </Select>
// )
// }
// </FormItem>
// <FormItem>
// <Button type="primary" style={{marginRight:10}}>查询</Button>
// <Button>重置</Button>
// </FormItem>
// </Form>
// )
// }
// }
// FilterForm = Form.create({})(FilterForm); |
const Hapi = require('hapi');
const SETTINGS = require('../settings');
// Create a server with a host and port
const server = new Hapi.Server();
server.connection({
host: 'localhost',
port: process.env.PORT || SETTINGS.defaultPort
});
// Including routes
require('./api.router')(server);
// Start the server
server.start((err) => {
if (err) {
throw err;
}
console.log('Server running at:', server.info.uri);
}); |
import React, { Component } from 'react';
import { Route, Link } from 'react-router-dom';
import { Navbar } from 'react-bootstrap'
import logo from './logo.svg';
import './App.css';
import users from './api/users.json';
import posts from './api/posts.json';
import Home from './components/Home'
import UserList from './components/users/UsersList'
import SignUp from './components/users/SignUp'
import PostList from "./components/posts/PostsList";
import {setCurrentUser} from "./helpers/storageHelper";
class App extends Component {
constructor(props){
super(props);
this.loadDataToLocalStorage();
}
loadDataToLocalStorage(){
setCurrentUser(users[1]);
localStorage.setItem('devaTwitt.users', JSON.stringify(users));
localStorage.setItem('devaTwitt.posts', JSON.stringify(posts));
}
render() {
return (
<div className="App">
<header className="App-header">
<Navbar inverse collapseOnSelect>
<Navbar.Header>
<Navbar.Brand>
<Link to="/">
<img src={logo} className="App-logo" alt="logo" />
<div>DevaTwitt by React</div>
</Link>
</Navbar.Brand>
<Navbar.Toggle />
</Navbar.Header>
<Navbar.Collapse>
<ul className="nav navbar-nav navbar-right">
<li key={1} ><Link to="/">Home</Link></li>
<li key={2} ><Link to="/users">User List</Link></li>
<li key={3} ><Link to="/posts">Post List</Link></li>
<li key={4} ><Link to="/sign-up">Sign Up</Link></li>
</ul>
</Navbar.Collapse>
</Navbar>
</header>
<main>
<div className="container">
<Route exact path="/" component={Home} />
<Route path="/users" component={UserList} />
<Route path="/sign-up" component={SignUp} />
<Route path="/posts" component={PostList} />
</div>
</main>
</div>
);
}
}
export default App;
|
tippy('#articles-communication', {
theme: 'light-border',
arrow: false,
allowHTML: true,
placement: 'right',
touch: false,
maxWidth: 550,
interactive: true,
interactiveBorder: 1,
content: '<div class="article-component"><h1>Communication</h1><ul><li>Alexander, <a href="https://slatestarcodex.com/2016/02/20/writing-advice/">Nonfiction Writing Advice</a> (2016)</li><li>Lewis, <a href="https://aaronzlewis.com/blog/2014/06/01/solved-conversations/">Solved Conversations</a> (2014)</li><li>Somers, <a href="https://jsomers.net/blog/dictionary">You’re probably using the wrong dictionary</a> (2014)</li></ul></div>'
}); |
import React from "react"
import { ThemeProvider } from "./src/Theme"
export const wrapRootElement = ({ element }) => {
return <ThemeProvider>{element}</ThemeProvider>
}
|
require("../../common/vendor.js"), (global.webpackJsonp = global.webpackJsonp || []).push([ [ "pages/packageB/plates/_components/recommendation" ], {
"55c7": function(e, n, o) {
o.r(n);
var t = o("6166"), a = o("d1de");
for (var c in a) [ "default" ].indexOf(c) < 0 && function(e) {
o.d(n, e, function() {
return a[e];
});
}(c);
o("6a79");
var i = o("f0c5"), r = Object(i.a)(a.default, t.b, t.c, !1, null, "d7060f1a", null, !1, t.a, void 0);
n.default = r.exports;
},
"5bb2": function(e, n, o) {
Object.defineProperty(n, "__esModule", {
value: !0
}), n.default = void 0;
var t = function(e) {
return e && e.__esModule ? e : {
default: e
};
}(o("80d6")), a = {
components: {
TopFilter: function() {
o.e("components/buildings_top_filter/index").then(function() {
return resolve(o("71eb"));
}.bind(null, o)).catch(o.oe);
},
HouseItem: function() {
Promise.all([ o.e("common/vendor"), o.e("components/business/house_item") ]).then(function() {
return resolve(o("ae38"));
}.bind(null, o)).catch(o.oe);
}
},
props: {
name: {
type: String
},
items: {
type: Array
},
loading: {
type: Boolean
},
no_more: {
type: Boolean
}
},
data: function() {
return {
filter_tabs: [ "价格", "面积", "装修" ]
};
},
methods: {
toggleFilter: function() {
this.backTop();
},
backTop: function() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {
focus: !1
};
t.default.getElementPosition("#recommedation", this.$mp.component).then(function(n) {
if (n) {
var o = n.top, t = n.scrollTop;
if (e.focus || !(o < 0)) {
var a = o + t;
a && wx.pageScrollTo({
scrollTop: a
});
}
}
});
},
changeFilter: function(e) {
this.$emit("changeFilter", e), this.backTop({
focus: !0
});
}
}
};
n.default = a;
},
6166: function(e, n, o) {
o.d(n, "b", function() {
return t;
}), o.d(n, "c", function() {
return a;
}), o.d(n, "a", function() {});
var t = function() {
var e = this;
e.$createElement;
e._self._c;
}, a = [];
},
"6a79": function(e, n, o) {
var t = o("8670");
o.n(t).a;
},
8670: function(e, n, o) {},
d1de: function(e, n, o) {
o.r(n);
var t = o("5bb2"), a = o.n(t);
for (var c in t) [ "default" ].indexOf(c) < 0 && function(e) {
o.d(n, e, function() {
return t[e];
});
}(c);
n.default = a.a;
}
} ]), (global.webpackJsonp = global.webpackJsonp || []).push([ "pages/packageB/plates/_components/recommendation-create-component", {
"pages/packageB/plates/_components/recommendation-create-component": function(e, n, o) {
o("543d").createComponent(o("55c7"));
}
}, [ [ "pages/packageB/plates/_components/recommendation-create-component" ] ] ]); |
import React from 'react';
import { SimpleForm } from '../pages/SimpleForm';
export default {
title: 'Example/SimpleForm',
component: SimpleForm,
};
const Template = (args) => <SimpleForm {...args} />;
export const Name = Template.bind({});
Name.args = {
label: 'Name',
actionText: 'Save Name'
};
export const NickName = Template.bind({});
NickName.args = {
label: 'Nick Name',
actionText: 'Save Nick Name'
}; |
#!/usr/bin/env node
"use strict";
var grammar = require("./plee-grammar.js"),
fs = require("fs"),
util = require("util"),
chalk = require('chalk'),
argv = require('yargs')
.usage('Usage: $0 file|glob [--print-ast]')
.demand(1)
.argv;
console.log();
var contents = fs.readFileSync(argv._[0], 'utf-8');
console.log("************");
console.log(contents);
console.log("************");
try {
var result = require("util").inspect(
grammar.parse(contents), {colors: true, depth: null}
);
if (argv.print_ast) {
console.log(result);
}
} catch(e) {
console.log(e);
var lines = contents.split("\n"),
err_line = lines[e.line -1],
chars = err_line.split(""),
x = "",
max = e.column + 8,
i,
pad = " ",
pad_i;
chars[e.column - 1] = chalk.bgRed(chars[e.column - 1]);
console.log("file:", process.argv[2]);
console.log("error context:");
for(i = 0; i < max; ++i) {
x+= " ";
}
max = Math.max(0, e.line - 5);
for(i = max; i < e.line; ++i) {
pad_i = pad.substring(0, pad.length - ("" + i).length) + i;
if (e.line - 1 === i) {
console.log(pad_i + " | " + chars.join(""));
} else {
console.log(pad_i + " | " + lines[i]);
}
}
if (max + e.message.length < 80) {
console.log(x + "^", chalk.bgRed(e.message));
} else {
console.log(x + "^\n", chalk.bgRed(e.message));
}
console.log("");
max = Math.min(lines.length, e.line + 5);
for(i = e.line; i < max; ++i) {
pad_i = pad.substring(0, pad.length - ("" + i).length) + i;
console.log(pad_i + " | " + lines[i]);
}
}
|
// app/routes.ts
///<reference path='../typings/tsd.d.ts' />
var express = require('express');
var router = express.Router();
router.get('/hello', function (req, res) {
res.send("Cool");
});
router.get('*', function (req, res) {
res.status(404).send('Nope! Chuck Testah!');
});
module.exports = router;
|
var Entry = require("../models/diaryDay.js");
var CatalogueFood = require("../models/catalogueFood.js");
var mongoInitialiser = require("../initialisers/mongo");
var q = require('q');
function clearCatalogue() {
var deferred = q.defer();
CatalogueFood.remove({}, function(err) {
if(err) {
console.log(err);
deferred.reject(new Error(err));
} else {
deferred.resolve();
}
});
return deferred.promise;
}
function saveFood(food) {
var deferred = q.defer();
var catalogueFood = new CatalogueFood(food);
var upsertData = catalogueFood.toObject();
delete upsertData._id; // no-underscore-dangle
CatalogueFood
.update({ description: upsertData.description },
upsertData,
{ upsert: true })
.exec(function(err, cf) {
if(err) {
console.log("Error - ");
console.log(err);
deferred.reject(new Error(err));
} else {
deferred.resolve();
}
});
return deferred.promise;
}
function populateCatalogue() {
var deferred = q.defer();
Entry
.find({
foods: {
$elemMatch: { unitEnergy: { $ne: null }, nutrition: { $ne: null } }
}
})
.exec(function(err, entries) {
if(err) {
console.log(err);
deferred.reject(new Error(err));
}
var items = [];
entries.forEach(function(e) {
e.foods.forEach(function(f) {
items.push(saveFood(f));
});
});
q.allSettled(items)
.then(function() {
deferred.resolve();
});
});
return deferred.promise;
}
module.exports = function(done) {
clearCatalogue()
.then(populateCatalogue)
.then(function() {
done();
});
}
|
import React from "react";
export default function CalendarBox() {
return (
<div className="calendarBox">
{/* <h3>This is Calendar box</h3> */}
<list>
<ol>aaaaaaaaaaaaaaaaaaa</ol>
<ol>aaaaaaaaaaaaaaaaaaa</ol>
<ol>aaaaaaaaaaaaaaaaaaa</ol>
<ol>aaaaaaaaaaaaaaaaaaa</ol>
<ol>aaaaaaaaaaaaaaaaaaa</ol>
</list>
</div>
);
}
|
function initCookie() {
}
//Emulates the command to the Chromecast
function runCommand(srcCommand, parameter)
{
chrome.storage.sync.get({
commands: "{\"commands\": [{\"name\": \"Start\", \"command\":{ },\"description\": \"\",\"hasParameter\": true}]}",
namespace: "urn:x-cast:com.reactnative.googlecast.example"
}, function(items) {
document.getElementById('defaultNamespace').value = items.namespace;
});
var commandJson = JSON.stringify(srcCommand.command);
if(srcCommand.hasParameter)
{
commandJson = commandJson.replace("[PAREMETER]", parameter);
}
var scriptToRun = '';
if(!srcCommand.isEvent)
{
var namespaceValue = srcCommand.namespace && srcCommand.namespace.length ? srcCommand.namespace : window.defaultNamespace;
var customEventCode = "quizcast.CastEmulator.triggerCustomEvent('"+ namespaceValue +"', {data:"+commandJson+"})";
scriptToRun = customEventCode;
}else
{
var eventCode = "quizcast.CastEmulator.triggerEvent('"+srcCommand.eventName+"', {data:"+commandJson+"})";;
scriptToRun = eventCode;
}
chrome.tabs.getSelected(null, function(tab){
//chrome.tabs.executeScript(tab.id, {code: scriptToRun}, function(response) {
//console.log('Script executed - '+response);
//});
chrome.tabs.sendMessage(tab.id, {action:'runScript', scriptToRun: scriptToRun}, function(){});
//chrome.runtime.sendMessage({action: "runScript", scriptToRun: scriptToRun}, function(response) {});
});
}
function initCommandsUi(commands) {
var commandsContainer = document.getElementById("commandsContainer");
console.log('Creating commands UI');
commands.forEach(element => {
console.log("Creating elements for " + element.name);
var commandDiv = document.createElement("div");
var commandTitle = document.createElement("span");
commandTitle.innerText = element.name;
commandTitle.className = element.hasParameter ? "commandTitleWithParameter" : "commandTitle";
commandDiv.appendChild(commandTitle);
if(element.hasParameter)
{
var commandParameter = document.createElement("input");
commandParameter.innerText = element.name;
commandParameter.className = "commandParameter";
commandDiv.appendChild(commandParameter);
}
var commandRun = document.createElement("button");
commandRun.innerText = "Run";
commandRun.className = "commandRun";
commandRun.command = element;
commandRun.parameterElement = commandParameter;
commandRun.onclick = function(ev){
var srcCommand = ev.srcElement.command;
var parameter = '';
if(srcCommand.hasParameter)
{
parameter = ev.srcElement.parameterElement.value;
}
runCommand(srcCommand, parameter);
}
commandDiv.appendChild(commandRun);
commandsContainer.appendChild(commandDiv);
});
}
document.addEventListener("DOMContentLoaded", function () {
// Use default value color = 'red' and likesColor = true.
chrome.storage.sync.get({
commands: "[{\"name\": \"Start\",\"description\": \"\",\"hasParameter\": true}]",
namespace: "urn:x-cast:com.reactnative.googlecast.example"
}, function(items) {
var parsedSettings = JSON.parse(items.commands);
console.log("Settings loaded...");
if(parsedSettings)
{
commandList = parsedSettings;
window.defaultNamespace = items.namespace;
initCommandsUi(commandList);
}
});
}); |
import React, { Component } from "react";
import DropDown from "../../Assets/DropDown";
import { cleanArray } from '../../../Helpers/inputs';
import { coords } from "../../../firebase";
export default class InputWithSelect extends Component {
constructor(props) {
super(props);
this.state = {
town: "",
selectValue: "",
selectedBusStop: {},
stops: []
};
this.onBlur = this.onBlur.bind(this);
this.onSelect = this.onSelect.bind(this);
}
searchCoords() {
if(this.state.town === '') return;
coords.child(this.state.town).once('value')
.then(snapShot => {
const value = cleanArray(snapShot.val());
if ( value === null || value === 0 ) return;
this.setState({ stops: value });
})
.catch(() => undefined);
}
onBlur(e) {
const target = e.target;
const value = target.value;
// Check if value is the same as before and ignore it if true
if(value === this.state.town) return;
this.setState({ town: value }, this.searchCoords);
this.props.setValue(this.props.name, value);
// Search if bus stops exist for the given town
}
onSelect(e) {
const target = e.target;
//const value = Number(target.value);
const value = target.value;
// const selected = this.state.stops[value];
const selected = this.state.stops.filter(x => x.place === value)[0];
this.setState({
selectValue: value,
selectedBusStop: selected
}, () => {
// Set value to parent element
this.props.setValue(this.props.bsName, selected);
});
}
render() {
const { name, label } = this.props;
const { stops } = this.state;
const stopPlaces = stops.map(coord => coord.place);
return (
<div style={{ display: "block", marginTop: 5, marginBottom: 5 }}>
<label htmlFor={name}>{label}</label>
<input required type="text" name={name} onBlur={this.onBlur} />
<DropDown
name={name}
value={this.state.selectValue}
onChange={this.onSelect}
ignoreEmpty
dynamic
towns={stopPlaces}
/>
</div>
);
}
}
|
// Written by Xiaolin Zhou
// inverted list
$(document).ready(function() {
"use strict";
var av_name = "InvListCON";
var av = new JSAV(av_name);
//position variables
var yPos = 5;
var xPos = 180;
//label on top for primary & seconday
av.label("Secondary ", {left: xPos + 10, top: yPos});
av.label("Primary ", {left: xPos + 320, top: yPos});
//height and width variables for left table first column
var leftBoxWidth = 100;
var leftBoxHeight = 30;
//left box first column
av.label("Key", {left: xPos + 29, top: yPos + 15});
av.g.rect(xPos, yPos + 50, leftBoxWidth, leftBoxHeight);//.css({fill: "white"});
av.g.rect(xPos, yPos + 50 + leftBoxHeight, leftBoxWidth, leftBoxHeight);//.css({fill: "white"});
av.g.rect(xPos, yPos + 50 + leftBoxHeight * 2, leftBoxWidth, leftBoxHeight);//.css({fill: "white"});
//height and width variable for left table second and fourth column
var boxHeightAndWidth = 30;
//left box second column
av.label("Index", {left: xPos + leftBoxWidth - 5, top: yPos + 15});
av.g.rect(xPos + leftBoxWidth, yPos + 50, boxHeightAndWidth, boxHeightAndWidth);//.css({fill: "white"});
av.g.rect(xPos + leftBoxWidth, yPos + 50 + leftBoxHeight, boxHeightAndWidth, boxHeightAndWidth);//.css({fill: "white"});
av.g.rect(xPos + leftBoxWidth, yPos + 50 + leftBoxHeight * 2, boxHeightAndWidth, boxHeightAndWidth);//.css({fill: "white"});
//right table left column variables
var rightBoxWidth = 90;
var rightBoxHeight = 30;
//right box first column
av.label("Key", {left: xPos + 330, top: yPos + 15});
av.g.rect(xPos + 300, yPos + 50, rightBoxWidth, rightBoxHeight);//.css({fill: "white"});
av.g.rect(xPos + 300, yPos + 50 + rightBoxHeight, rightBoxWidth, rightBoxHeight);//.css({fill: "white"});
av.g.rect(xPos + 300, yPos + 50 + rightBoxHeight * 2, rightBoxWidth, rightBoxHeight);//.css({fill: "white"});
av.g.rect(xPos + 300, yPos + 50 + rightBoxHeight * 3, rightBoxWidth, rightBoxHeight);//.css({fill: "white"});
av.g.rect(xPos + 300, yPos + 50 + rightBoxHeight * 4, rightBoxWidth, rightBoxHeight);//.css({fill: "white"});
av.g.rect(xPos + 300, yPos + 50 + rightBoxHeight * 5, rightBoxWidth, rightBoxHeight);//.css({fill: "white"});
av.g.rect(xPos + 300, yPos + 50 + rightBoxHeight * 6, rightBoxWidth, rightBoxHeight);//.css({fill: "white"});
av.g.rect(xPos + 300, yPos + 50 + rightBoxHeight * 7, rightBoxWidth, rightBoxHeight);//.css({fill: "white"});
//right box second column
av.label("Next", {left: xPos + 295 + rightBoxWidth, top: yPos + 15});
av.g.rect(xPos + 300 + rightBoxWidth, yPos + 50, boxHeightAndWidth, boxHeightAndWidth);//.css({fill: "white"});
av.g.rect(xPos + 300 + rightBoxWidth, yPos + 50 + rightBoxHeight, boxHeightAndWidth, boxHeightAndWidth);//.css({fill: "white"});
av.g.rect(xPos + 300 + rightBoxWidth, yPos + 50 + rightBoxHeight * 2, boxHeightAndWidth, boxHeightAndWidth);//.css({fill: "white"});
av.g.rect(xPos + 300 + rightBoxWidth, yPos + 50 + rightBoxHeight * 3, boxHeightAndWidth, boxHeightAndWidth);//.css({fill: "white"});
av.g.rect(xPos + 300 + rightBoxWidth, yPos + 50 + rightBoxHeight * 4, boxHeightAndWidth, boxHeightAndWidth);//.css({fill: "white"});
av.g.rect(xPos + 300 + rightBoxWidth, yPos + 50 + rightBoxHeight * 5, boxHeightAndWidth, boxHeightAndWidth);//.css({fill: "white"});
av.g.rect(xPos + 300 + rightBoxWidth, yPos + 50 + rightBoxHeight * 6, boxHeightAndWidth, boxHeightAndWidth);//.css({fill: "white"});
av.g.rect(xPos + 300 + rightBoxWidth, yPos + 50 + rightBoxHeight * 7, boxHeightAndWidth, boxHeightAndWidth);//.css({fill: "white"});
//arrows
//first arrow
av.g.line(305, 70, 450, 70,
{"arrow-end": "classic-wide-long", "stroke-width": 1});
//second arrow
av.g.line(305, 100, 450, 100,
{"arrow-end": "classic-wide-long", "stroke-width": 1});
//third arrow
av.g.line(305, 130, 350, 130,
{"stroke-width": 1});
av.g.line(350, 130, 350, 160,
{"stroke-width": 1});
av.g.line(350, 160, 450, 160,
{"arrow-end": "classic-wide-long", "stroke-width": 1});
//arrows at right box
//connect 0 and 4
av.g.line(xPos + 325 + rightBoxWidth, 70, xPos + 345 + rightBoxWidth, 70, {"stroke-width": 1});
av.g.line(xPos + 345 + rightBoxWidth, 70, xPos + 345 + rightBoxWidth, 185, {"stroke-width": 1});
av.g.line(xPos + 345 + rightBoxWidth, 185, xPos + 330 + rightBoxWidth, 185,
{"arrow-end": "classic-wide-long", "stroke-width": 1});
//connect 1 and 6
av.g.line(xPos + 325 + rightBoxWidth, 100, xPos + 355 + rightBoxWidth, 100,
{"stroke-width": 1, "stroke-dasharray": "- "});
av.g.line(xPos + 355 + rightBoxWidth, 100, xPos + 355 + rightBoxWidth, 245,
{"stroke-width": 1, "stroke-dasharray": "- "});
av.g.line(xPos + 355 + rightBoxWidth, 245, xPos + 330 + rightBoxWidth, 245,
{"arrow-end": "classic-wide-long", "stroke-width": 1, "stroke-dasharray": "- "});
//connect 4 and 5
av.g.line(xPos + 325 + rightBoxWidth, 195, xPos + 345 + rightBoxWidth, 195, {"stroke-width": 1});
av.g.line(xPos + 345 + rightBoxWidth, 195, xPos + 345 + rightBoxWidth, 215, {"stroke-width": 1});
av.g.line(xPos + 345 + rightBoxWidth, 215, xPos + 330 + rightBoxWidth, 215,
{"arrow-end": "classic-wide-long", "stroke-width": 1});
//connect 5 and 7
av.g.line(xPos + 325 + rightBoxWidth, 225, xPos + 345 + rightBoxWidth, 225, {"stroke-width": 1});
av.g.line(xPos + 345 + rightBoxWidth, 225, xPos + 345 + rightBoxWidth, 285, {"stroke-width": 1});
av.g.line(xPos + 345 + rightBoxWidth, 285, xPos + 330 + rightBoxWidth, 285,
{"arrow-end": "classic-wide-long", "stroke-width": 1});
//connect 6 and 2
av.g.line(xPos + 325 + rightBoxWidth, 255, xPos + 365 + rightBoxWidth, 255,
{"stroke-width": 1, "stroke-dasharray": "- "});
av.g.line(xPos + 365 + rightBoxWidth, 255, xPos + 365 + rightBoxWidth, 130,
{"stroke-width": 1, "stroke-dasharray": "- "});
av.g.line(xPos + 365 + rightBoxWidth, 130, xPos + 330 + rightBoxWidth, 130,
{"arrow-end": "classic-wide-long", "stroke-width": 1, "stroke-dasharray": "- "});
//text in left boxes
av.label("Jones", {left: xPos + 10, top: yPos + 40});
av.label("Smith", {left: xPos + 10, top: yPos + 40 + leftBoxHeight});
av.label("Zukowski", {left: xPos + 10, top: yPos + 40 + leftBoxHeight * 2});
//text in left boxes right column
av.label("0", {left: xPos + leftBoxWidth + 10, top: yPos + 40});
av.label("1", {left: xPos + leftBoxWidth + 10, top: yPos + 40 + leftBoxHeight});
av.label("3", {left: xPos + leftBoxWidth + 10, top: yPos + 40 + leftBoxHeight * 2});
//test next to the right boxes
av.label("0", {left: xPos + 280, top: yPos + 40});
av.label("1", {left: xPos + 280, top: yPos + 40 + rightBoxHeight});
av.label("2", {left: xPos + 280, top: yPos + 40 + rightBoxHeight * 2});
av.label("3", {left: xPos + 280, top: yPos + 40 + rightBoxHeight * 3});
av.label("4", {left: xPos + 280, top: yPos + 40 + rightBoxHeight * 4});
av.label("5", {left: xPos + 280, top: yPos + 40 + rightBoxHeight * 5});
av.label("6", {left: xPos + 280, top: yPos + 40 + rightBoxHeight * 6});
av.label("7", {left: xPos + 280, top: yPos + 40 + rightBoxHeight * 7});
//text\slash in right boxes
av.label("AA10", {left: xPos + 325, top: yPos + 40});
av.label("AX33", {left: xPos + 325, top: yPos + 40 + rightBoxHeight});
av.label("ZX45", {left: xPos + 325, top: yPos + 40 + rightBoxHeight * 2});
av.label("ZQ99", {left: xPos + 325, top: yPos + 40 + rightBoxHeight * 3});
av.label("AB12", {left: xPos + 325, top: yPos + 40 + rightBoxHeight * 4});
av.label("AB39", {left: xPos + 325, top: yPos + 40 + rightBoxHeight * 5});
av.label("AX35", {left: xPos + 325, top: yPos + 40 + rightBoxHeight * 6});
av.label("FF37", {left: xPos + 325, top: yPos + 40 + rightBoxHeight * 7});
//text in right boxes right column
av.label("4", {left: xPos + 300 + leftBoxWidth, top: yPos + 40});
av.label("6", {left: xPos + 300 + leftBoxWidth, top: yPos + 40 + leftBoxHeight});
av.g.line(xPos + 300 + rightBoxWidth, yPos + 140, xPos + 330 + rightBoxWidth, yPos + 110,
{"stroke-width": 1});
av.g.line(xPos + 300 + rightBoxWidth, yPos + 170, xPos + 330 + rightBoxWidth, yPos + 140,
{"stroke-width": 1});
av.label("5", {left: xPos + 300 + leftBoxWidth, top: yPos + 40 + leftBoxHeight * 4});
av.label("7", {left: xPos + 300 + leftBoxWidth, top: yPos + 40 + leftBoxHeight * 5});
av.label("2", {left: xPos + 300 + leftBoxWidth, top: yPos + 40 + leftBoxHeight * 6});
av.g.line(xPos + 300 + rightBoxWidth, yPos + 290, xPos + 330 + rightBoxWidth, yPos + 260,
{"stroke-width": 1});
av.displayInit();
av.recorded();
});
|
import React from 'react';
import {connect} from 'react-redux';
import Input from '@material-ui/core/Input';
import Button from '@material-ui/core/Button';
import Fab from '@material-ui/core/Fab';
import AddIcon from '@material-ui/icons/Add';
import { Link } from 'react-router-dom';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import ListItemIcon from '@material-ui/core/ListItemIcon';
import ListItemText from '@material-ui/core/ListItemText';
import DeleteForeverIcon from '@material-ui/icons/DeleteForever';
import ListSubheader from '@material-ui/core/ListSubheader';
import { addTask, deleteTask } from './actions';
const container = {
display: 'flex',
flexWrap: 'wrap',
maxWidth:400,
margin: '0 auto',
marginTop: 20,
}
const navList = {
maxWidth:400,
}
class Task extends React.Component {
constructor(props) {
super(props);
this.state = {
text: '',
}
}
addTask() {
this.props.addTask(this.state.text);
}
deleteTask(id) {
this.props.deleteTask(id);
}
renderTasks() {
const { tasks } = this.props;
return (
<List
component="nav"
style={navList}
subheader={<ListSubheader component="div">Tasks list</ListSubheader>} >
{
tasks.map(task => {
return (
<ListItem key={task.id} button>
<ListItemIcon>
<DeleteForeverIcon onClick={() => this.deleteTask(task.id)} />
</ListItemIcon>
<ListItemText inset primary={task.text}/>
</ListItem>
)
})
}
</List>
)
}
render () {
return (
<div style={container}>
<div style={container}>
<Input
placeholder="Add your task here"
className="input"
inputProps={{
'aria-label': 'Description',
}}
onChange={event => this.setState({ text: event.target.value })}
/>
<Fab
color="primary" aria-label="Add" className="fab"
onClick={() => this.addTask()}>
<AddIcon />
</Fab>
<Button
size="small"
component={Link}
to="/"
>Return to welcome screen</Button>
</div>
{ this.renderTasks() }
</div>
);
}
}
function mapStateToProps(state) {
return {
tasks: state
}
}
export default connect(mapStateToProps, { addTask, deleteTask })(Task); |
import React, {useState, useEffect} from 'react';
import axios from 'axios';
import { Link, useHistory } from "react-router-dom";
import { useParams } from 'react-router';
const EditAuthor = () => {
const {id} = useParams();
const [authorInfo, setAuthorInfo] = useState([]);
const history = useHistory();
const [validationErrors, setValidationErrors] = useState({});
useEffect(() => {
axios.get(`http://localhost:8000/api/authors/${id}`)
.then(res => {
console.log("Response for getting one author -->", res)
if(res.data.err) {
history.push("/author_not_found")
} else {
setAuthorInfo(res.data.results)
}
})
.catch(err => {console.log(err)})
}, [])
const changeHandler = (e) => {
setAuthorInfo({
...authorInfo,
[e.target.name]: e.target.value
})
}
const submitHandler = (e) => {
e.preventDefault();
axios.put(`http://localhost:8000/api/authors/${id}`, authorInfo)
.then(res => {
console.log("Response after making put request --> ", res)
if(res.data.err) {
setValidationErrors(res.data.err.errors)
} else {
history.push("/")
}
})
.catch(err => console.log(err))
}
return (
<div>
<Link to="/">Home</Link>
<h5 className="mt-3">Edit this author:</h5>
<form onSubmit={(e)=>submitHandler(e)}>
<div className="form-group mb-3">
<label htmlFor="name">Name:</label>
<input onChange={(e)=>changeHandler(e)} type="text" name="name" value={authorInfo?.name} className="form-control"/>
<p className="text-danger">{validationErrors.name?.message}</p>
</div>
<input type="submit" value="Update" className="btn btn-primary"/>
</form>
<Link to="/" className="btn btn-secondary mt-3">Cancel</Link>
</div>
);
};
export default EditAuthor; |
import React from 'react';
import { Redirect, useLocation } from "react-router-dom";
import { connect } from 'react-redux';
import { userAuthentication, authenticationUrl } from '../store/actions';
function useQuery() {
return new URLSearchParams(useLocation().search);
}
const Authorization = ({unsplash, userAuthentication}) => {
let query = useQuery();
const code = query.get("code")
if (unsplash.isAuthenticated) {
return (
<Redirect to="/" />
)
}
else if (code) {
userAuthentication(code);
return (
<Redirect to="/" />
)
}
else {
return (
<div>
{ document.location.assign(authenticationUrl) }
</div>
)
}
}
const mapStateToProps = state => ({
unsplash: state.unsplash
});
const mapDispatchToProps = {
userAuthentication
};
export default connect(
mapStateToProps,
mapDispatchToProps
)(Authorization); |
const express = require('express')
const cors = require('cors')
const massive = require('massive')
const { json } = require('body-parser')
const session = require('express-session')
require('dotenv').config()
const socketIo = require('socket.io')
const http = require('http')
const app = express()
const controller = require(`${__dirname}/controller/controller`)
const index = require("../server/index.js");
const server = http.createServer(app);
const io = socketIo(server)
app.use(index(io))
app.use(cors())
app.use(express.json())
app.use(
session({
secret: 'here is secret',
resave: true,
saveUninitialized: true
})
)
let messages = []
io.on('connection', socket => {
console.log('New Client Connected')
socket.emit('msgs', messages)
socket.on('send_message', incomingMessage => {
messages.push(incomingMessage)
socket.emit('msgs', messages)
})
socket.on('disconnect', () => {
console.log('Client Disconnected')
})
})
app.get('/api/login', controller.loginUser)
app.put('/api/logout', controller.logoutUser)
const port = 3993
// const getUser = (req, res) => {
// const dbInstance = req.app.get('db')
// dbInstance.getUser().then(resp => res.status(200).send(resp))
// }
app.get(`/api/authUser`, (req, res) => {
const dbInstance = req.app.get('db')
const { username, password } = req.body
console.log('Verified', username, password)
dbInstance
.getUser(req.query.username, req.query.password)
.then(resp => {
console.log(resp)
res.status(200).send(resp)
})
.catch(err => {
console.log(err)
})
// if (
// username == req.params.username &&
// password == req.params.password
// ) {
// dbInstance.getUser(req.query.username, req.query.password).then(() => {
// app.get('/api/login', controller.loginUser)
// getUser(req, res.status(200).send(true))
// }).catch((err) => {
// console.log(err)
// })
// } else {
// res.status(200).send(false)
// }
})
// app.post(`/api/authUser`, (req, res) => {
// console.log('User Request Received')
// const { username, password } = req.body
// console.log(process.env.password, process.env.username)
// console.log(username, password)
// if (username == process.env.username && password == process.env.password) {
// res.status(200).send(true)
// } else {
// res.status(200).send(false)
// }
// })
app.post(`/api/addUser`, (req, res) => {
const {
firstName,
lastName,
email,
createUsername,
createPassword,
image
} = req.body
console.log(
'Request received',
firstName,
lastName,
email,
createUsername,
createPassword,
image
)
console.log(req.body)
const dbInstance = req.app.get('db')
dbInstance
.addUser(firstName, lastName, email, createUsername, lastName, image)
.then(() => {
getUser(req, res)
})
})
massive(process.env.connectionString).then(db => {
app.set('db', db)
app.listen(3993, () => {
console.log(`Listening on port ${port}`)
})
console.log('Connected to database')
})
|
const fs = require('fs');
const config = require('./../config');
let cellPhones = require('./cellphones') || [];
module.exports = {
getPhones: () => cellPhones,
getPhoneById: id => cellPhones.find(phone => phone.id === Number(id)),
addPhone(fields) {
const {fullName, phone} = fields;
if (!fullName || !phone) {
throw new Error('Empty fullName or phone fields');
}
const newPhone = {
id: cellPhones.length,
fullName,
phone
};
cellPhones.push(newPhone);
save();
return newPhone;
},
updatePhone(fields) {
const {id, fullName, phone} = fields;
if (!id || !fullName || !phone) {
throw new Error('Empty id, fullName or phone fields');
}
let targetPhone = cellPhones.find(phone => phone.id === Number(id));
if (!targetPhone) {
throw new Error('Invalid record id');
}
targetPhone.fullName = fullName;
targetPhone.phone = phone;
save();
return targetPhone;
},
deletePhone(id) {
let targetPhone = cellPhones.find(phone => phone.id !== Number(id));
if (!targetPhone) {
throw new Error('Invalid record id');
}
cellPhones = cellPhones.filter(phone => phone.id !== Number(id));
save();
return targetPhone;
}
};
function save() {
fs.writeFile(__dirname + config.db.cellPhonesDataPath, JSON.stringify(cellPhones, null, ' '), err => {
if (err) {
throw err;
}
});
}
|
/**
* System configuration for Angular samples
* Adjust as necessary for your application needs.
*/
(function (global) {
System.config({
// //use typescript for compilation
// transpiler: 'typescript',
// //typescript compiler options
// typescriptOptions: {
// // Copy of compiler options in standard tsconfig.json
// "target": "es5",
// "module": "es2015",
// "moduleResolution": "node",
// "sourceMap": true,
// "emitDecoratorMetadata": true,
// "experimentalDecorators": true,
// "noImplicitAny": true,
// "suppressImplicitAnyIndexErrors": true
// },
// meta: {
// 'typescript': {
// "exports": "ts"
// }
// },
paths: {
// paths serve as alias
'npm:': 'node_modules/'
},
// map tells the System loader where to look for things
map: {
// our app is within the app folder
app: 'app',
// angular bundles
'@angular/core': 'npm:@angular/core/bundles/core.umd.min.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.min.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/animations': "npm:@angular/animations/bundles/animations.umd.min.js",
'@angular/animations/browser': 'npm:@angular/animations/bundles/animations-browser.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.min.js',
'@angular/platform-browser/animations': 'npm:@angular/platform-browser/bundles/platform-browser-animations.umd.min.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.min.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.min.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.min.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.min.js',
'@angular/upgrade': 'npm:@angular/upgrade/bundles/upgrade.umd.min.js',
'@angular/flex-layout' : 'npm:@angular/flex-layout/bundles/flex-layout.umd.js',
'@ng-bootstrap/ng-bootstrap': 'npm:@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js',
'@angular/material': 'npm:@angular/material/bundles/material.umd.min.js',
'@angular/cdk': 'npm:@angular/cdk/bundles/cdk.umd.min.js',
'socket.io-client': 'npm:socket.io-client/socket.io.min.js',
// other libraries
'rxjs': 'npm:rxjs',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api',
'angular2-fontawesome': 'npm:angular2-fontawesome',
'hammerjs': 'npm:hammerjs/hammer.min.js',
'leaflet' : 'npm:leaflet/dist/leaflet.js',
/* // angular bundles
'@angular/core': 'npm:core.umd.min.js',
'@angular/common': 'npm:common.umd.min.js',
'@angular/compiler': 'npm:compiler.umd.min.js',
'@angular/animations': "npm:animations.umd.min.js",
'@angular/animations/browser': 'npm:animations-browser.umd.min.js',
'@angular/platform-browser': 'npm:platform-browser.umd.min.js',
'@angular/platform-browser/animations': 'npm:platform-browser-animations.umd.min.js',
'@angular/platform-browser-dynamic': 'npm:platform-browser-dynamic.umd.min.js',
'@angular/http': 'npm:http.umd.min.js',
'@angular/router': 'npm:router.umd.min.js',
'@angular/forms': 'npm:forms.umd.min.js',
'@angular/upgrade': 'npm:upgrade.umd.min.js',
'@angular/material': 'npm:material.umd.min.js',
'@angular/cdk': 'npm:cdk.umd.min.js',
'@angular/flex-layout' : 'npm:flex-layout.umd.min.js',
'@ng-bootstrap/ng-bootstrap': 'npm:ng-bootstrap.js',
// other libraries
'rxjs': 'npm:Rx.min.js',
'angular-in-memory-web-api': 'npm:in-memory-web-api.umd.min.js',
'angular2-fontawesome': 'npm:angular2-fontawesome.umd.min.js',
'hammerjs': 'npm:hammer.min.js',
'leaflet' : 'npm:leaflet.js', */
// further angular bundles
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
app: {
main: './main.js',
defaultExtension: 'js'
},
rxjs: {
defaultExtension: 'js'
},
'angular-in-memory-web-api': {
main: './index.js',
defaultExtension: 'js'
},
'angular2-fontawesome': {
defaultExtension: 'js'
}
}
});
})(this); |
import Ember from 'ember';
import Sortable from 'ui/mixins/sortable';
export default Ember.Controller.extend(Sortable, {
sortableContent : Ember.computed.alias('model.all'),
sortBy: 'name',
sorts: {
state : ['stateSort','name','id'],
name : ['name','id'],
server : ['nfsConfig.server','name','id'],
label : ['nfsConfig.label','name','id'],
mountOptions : ['nfsConfig.mountOptions','name','id'],
},
});
|
import React from "react";
import SHOP_DATA from "./../../data/ShopData";
import CollectionPreview from "../../components/collection-preview/collection-preview.component";
import "./shop-page.styles.scss";
class ShopPage extends React.Component {
constructor(props) {
super(props);
this.state = {
collection: []
};
}
componentDidMount() {
this.setState({ collection: SHOP_DATA });
}
render() {
const { collection } = this.state;
return (
<div>
<h1 className="shop-page-header">SHOP PAGE</h1>
<CollectionPreview collection={collection} />
</div>
);
}
}
export default ShopPage;
|
import './estilos.css'
const Footer = () => {
return (
<footer className="footer-luna" >
<p>@Copyright 2021 - Lu Boher</p>
</footer >
);
}
export default Footer |
import Phaser from "phaser";
import hexRgb from "hex-rgb";
import Mousetrap from "mousetrap";
import _ from "lodash";
import SceneHelpers from "../helpers/SceneHelpers";
@SceneHelpers
class state0 extends Phaser.Scene {
constructor() {
super("state0");
}
preload() {
}
create() {
const color = hexRgb("#5e78a0", { format: "array" });
this.scene.manager.game.config.backgroundColor.setTo(...color);
_.range(0, 10).forEach(v => {
Mousetrap.bind(v.toString(), e => {
this.changeState(e, v);
});
});
}
changeState(event, stateNum) {
this.getGame().scene.start("state" + stateNum);
}
update() {}
}
export default state0;
|
const config = {
siteTitle: 'Plato',
siteTitleShort: 'Plato Plato',
siteDescription: 'Super Duper Static Site generator',
siteUrl: 'https://github.com/TimRoussilhe/Plato/',
metaSiteName: 'Plato',
metaTwitterName: '@timroussilhe',
metaImage: 'https://media1.giphy.com/media/eLudircQfgGEU/giphy.gif?cid=3640f6095c0e8e92753069696f5d90c5',
metaImageTwitter: 'https://media1.giphy.com/media/eLudircQfgGEU/giphy.gif?cid=3640f6095c0e8e92753069696f5d90c5',
themeColor: '#000',
backgroundColor: '#fff',
pathPrefix: null,
social: {
twitter: 'Plato',
fbAppId: '550534890534809345890',
},
preload: [
{
type: 'font',
href: '/assets/fonts/UntitledSans-Regular.woff2',
format: 'woff2',
},
],
staticRoutes: [
{
id: 'index',
url: '/',
template: 'homepage',
json: 'index.json',
},
{
id: 'about',
url: '/about-no-data',
template: 'about',
},
{
id: 'about',
url: '/about',
template: 'about',
json: 'about.json',
},
{
id: 'pokemon',
url: '/pokemon',
template: 'about',
dataSource: 'https://pokeapi.co/api/v2/pokemon/?limit=6',
json: 'pokemon.json',
},
{
id: '404',
fileName: '404.html',
url: '/error',
template: 'notfound',
json: '404.json',
},
],
};
export default config;
|
import React, { Component } from 'react';
import {
requireNativeComponent,
ViewPropTypes,
ImagePropsAndroid,
UIManager,
findNodeHandle,
NativeModules,
Text,
} from 'react-native';
import PropTypes from 'prop-types';
const resolveAssetSource = require('react-native/Libraries/Image/resolveAssetSource');
const iface = {
name: 'RNImageViewManager',
propTypes: {
width: PropTypes.number,
height: PropTypes.number,
src: PropTypes.any,
...ViewPropTypes,
},
};
const RCTRNImageView = requireNativeComponent('RNImageViewManager', iface);
class RNImageViewView extends Component {
render() {
const { source: originalSource } = this.props;
const source = resolveAssetSource(originalSource);
const { ...props } = this.props;
const nativeProps = {
src: source,
...props,
};
return (
<RCTRNImageView
ref={(myView) => {
this.myView = myView;
}}
{...nativeProps}
/>
);
}
}
export default RNImageViewView;
|
import React from "react";
const TodoFooter = () => {
return <div className="todo-footer">Created by Anooj</div>;
};
export default TodoFooter;
|
import React, { Component } from 'react';
import { Button, WhiteSpace } from 'antd-mobile';
import Item from './item/index';
import styles from './App.less';
const data =[
{title:'亚马逊' , src: require('./static/images/img_19.jpg') , href:'../../../amazon-logistics/index.html' },
{title:'众人添财' , src: require('./static/images/img_21.jpg') , href:'../../../tc/index.html' },
{title:'叮当加速度,元宵送祝福!' , src: require('./static/images/img_17.jpg') , href:'http://mobile.lenovo-idea.com/2015/offline/lanternfestival/' },
{title:'让爱传递,她的达芬奇密码' , src: require('./static/images/img_18.jpg') , href:'../../../women/index.html' },
{title:'厨房巅峰挑战赛' , src: require('./static/images/img_20.jpg') , href:'http://mobile.lenovo-idea.com/2015/offline/cooking/' },
{title:'联想小新笔记本' , src: require('./static/images/img_22.jpg') , href:'../../../telday/index.html' },
{title:'360全景图' , src: require('./static/images/img_test1.jpg') , href:'http://mobile.lenovo-idea.com/2015/test/360outer/' },
{title:'联想大客户 电信日' , src: require('./static/images/img_23.jpg') , href:'http://mobile.lenovo-idea.com/2015/telecomday/' },
{title:'联想高考祈福H5' , src: require('./static/images/img_24.jpg') , href:'http://mobile.lenovo-idea.com/2015/bless/' },
{title:'乐檬K3乐懵了 微信' , src: require('./static/images/img_26.jpg') , href:'http://mobile.lenovo-idea.com/2015/weixin/' },
{title:'乐檬k3 线下助销' , src: require('./static/images/img_27.jpg') , href:'http://mobile.lenovo-idea.com/2015/sale/' },
{title:'联想k80 线下助销' , src: require('./static/images/img_28.jpg') , href:'http://mobile.lenovo-idea.com/2015/k80/' },
{title:'惠普七夕奇葩求爱' , src: require('./static/images/img_29.jpg') , href:'http://mobile.lenovo-idea.com/2015/festival/' },
{title:'联想秋季新品发布' , src: require('./static/images/img_30.jpg') , href:'http://mobile.lenovo-idea.com/2015/holiday/' },
{title:'新一代moto 360' , src: require('./static/images/img_31.jpg') , href:'http://mobile.lenovo-idea.com/2015/moto360/' },
{title:'联想员工享福啦!' , src: require('./static/images/img_32.jpg') , href:'http://mobile.lenovo-idea.com/2015/p1/' },
{title:'HP华丽蜕变计时赛' , src: require('./static/images/img_34.jpg') , href:'http://mobile.lenovo-idea.com/2015/hp/' },
{title:'Moto X Style选择无可复制 (第三方公司制作)' , src: require('./static/images/img_33.jpg') , href:'http://mobile.lenovo-idea.com/2015/motoxstyle/' },
{title:'乐檬K3圣诞节(下线)' , src: require('./static/images/img_1.jpg') , href:'' },
{title:'策反王撕葱(下线)' , src: require('./static/images/img_2.jpg') , href:'' },
{title:'广交会(下线)' , src: require('./static/images/img_4.jpg') , href:'' },
{title:'乐檬K3绕口令(下线)' , src: require('./static/images/img_5.jpg') , href:'' },
{title:'武媚娘 乐檬K3病毒(下线)' , src: require('./static/images/img_6.jpg') , href:'' },
{title:'乐檬k3产品(下线)' , src: require('./static/images/img_7.jpg') , href:'' },
{title:'厕所挖宝总动员(下线)' , src: require('./static/images/img_8.jpg') , href:'' },
{title:'黄金斗士Note8 众筹(下线)' , src: require('./static/images/img_9.jpg') , href:'' },
{title:'联想手机2015爱你有我 (下线)' , src: require('./static/images/img_10.jpg') , href:'' },
{title:'联想手机品牌 (下线)' , src: require('./static/images/img_11.jpg') , href:'' },
{title:'大寒(下线)' , src: require('./static/images/img_3.jpg') , href:'' },
{title:'挖笋尖(下线)' , src: require('./static/images/img_12.jpg') , href:'' },
{title:'联想手机vibe X2(下线)' , src: require('./static/images/img_13.jpg') , href:'' },
{title:'雾里看笋(下线)' , src: require('./static/images/img_14.jpg') , href:'' },
{title:'一块皮子华丽蜕变之旅(下线)' , src: require('./static/images/img_15.jpg') , href:'' },
{title:'联想智能电视携手哆啦A梦发红包赠玩偶送电视啦!(下线)' , src: require('./static/images/img_16.jpg') , href:'' },
{title:'联想大客户 端午节送红包(下线)' , src: require('./static/images/img_25.jpg') , href:'' }
]
let pageId = 1
let pageSize = 4
if(window.innerWidth>768){
pageSize = 12
}
const fecthData = ()=>{
const _pageId = pageId
pageId++
return data.filter((value,index)=>{
if(index>=(_pageId-1) * pageSize && index<=(_pageId) * pageSize ) return value
})
}
class App extends Component {
constructor(props){
super(props);
this.state=({
data:fecthData(),
isLoadingMore: false
})
}
componentDidMount() {
const wrapper = this.refs.wrapper;
const loadMoreDataFn = this.loadMoreDataFn;
const that = this; // 为解决不同context的问题
let timeCount;
function callback() {
const top = wrapper.getBoundingClientRect().top;
const windowHeight = window.screen.height;
if (top && top < windowHeight) {
// 当 wrapper 已经被滚动到页面可视范围之内触发
loadMoreDataFn(that);
}
}
window.addEventListener('scroll', function () {
if (this.state.isLoadingMore) {
return ;
}
if (timeCount) {
clearTimeout(timeCount);
}
timeCount = setTimeout(callback, 500);
}.bind(this), false);
}
loadMoreDataFn(that) {
that.setState({
data: that.state.data.concat(fecthData())
})
}
render() {
return (
<div>
<div className={styles.link}>
<a href="./lenovo.html">联想</a>
<a href="http://mobile.lenovo-idea.com/2015/list/index.html">JOYSALOON</a>
</div>
<div className={styles.list}>
{this.state.data.map((item,key) => (
<Item key={key} title={item.title} src={item.src} href={item.href} />
))
}
</div>
<div className={styles.loadMore} ref = "wrapper" onClick={this.loadMoreDataFn.bind(this, this)}>正在加载...</div>
<WhiteSpace size="lg" />
</div>
);
}
}
export default App;
|
let vi = {
'hello %s': 'xin chao %s %s'
}
module.exports = vi |
$("#botao-placar").click(mostraPlacar);
function inserePlacar() {
var corpoTabela = $(".placar").find("tbody");
var usuario = "Ygor Kayan"
var numPalavras = $("#contador-palavras").text();
var linha = novaLinha(usuario, numPalavras);
linha.find(".botao-remover").click(removeLinha);
corpoTabela.append(linha);
$(".placar").slideDown(500);
scrollPlacar();
}
function scrollPlacar() {
var posicaoPlacar = $(".placar").offset().top;
$("body").animate(
{
scrollTop: posicaoPlacar + "px"
}, 1000);
}
function novaLinha(usuario, palavras) {
var linha = $("<tr>");
var colunaUsuario = $("<td>").text(usuario).addClass("usuario");
var colunaPalavras = $("<td>").text(palavras).addClass("pontuacao");
var colunaRemover = $("<td>");
var link = $("<a>").addClass("botao-remover").attr("href", "#");
var icone = $("<i>").addClass("small").addClass("material-icons").text("delete");
link.append(icone);
colunaRemover.append(link);
linha.append(colunaUsuario);
linha.append(colunaPalavras);
linha.append(colunaRemover);
return linha;
}
function removeLinha() {
event.preventDefault();
var linha = $(this).parent().parent();
linha.fadeOut(1000);
setTimeout(function () {
linha.remove();
}, 1000);
}
function mostraPlacar() {
$(".placar").stop().slideToggle(600);
}
$("#botao-sicronismo").click(function () {
salvarPlacar();
})
function salvarPlacar() {
var listaPlacar = [];
var linhas = $("tbody>tr");
linhas.each(function () {
var nome = $(this).find("td:nth-child(1)").text();
var palavras = $(this).find("td:nth-child(2)").text();
listaPlacar.push(nome + "-" + palavras)
});
var dados = {
placar: listaPlacar
}
$.post("http://localhost:8080/placar", dados, function () {
console.log("salvo");
})
}
function atualizarPlacar() {
$.get("http://localhost:8080/placar", function(data) {
data.forEach(function(linha) {
var linha = novaLinha(linha.nome, linha.pontuaçao);
linha.find(".botao-remover").click(removeLinha);
$("tbody").append(linha);
})
})
}
|
$(function(){
var mySwiper = new Swiper ('.swiper-container', {
//freeMode : true,
autoplay : 3000,
//direction: 'vertical',//上下页
loop: true,//无缝
// 如果需要分页器
pagination: '.swiper-pagination',
//用户操作后重启
autoplayDisableOnInteraction : false,
});
//公告栏
var fontMove = $('.font-move span');
var width = fontMove.width() /10;
fontMove[0].style.animation='animations '+width/2+'s linear 0s infinite forwards;-webkit-animation:animations '+width/2+'s linear 0s infinite forwards;-moz-animation:animations '+width/2+'s linear 0s infinite forwards;';
document.getElementById("frames").innerHTML = '@-webkit-keyframes animations3{0%{-webkit-transform:translate(24rem);}100%{-webkit-transform:translate(-'+width+'rem);}}@-moz-keyframes animations3{0%{-moz-transform:translate(24rem);}100%{-moz-transform:translate(-'+width+'rem);}}@keyframes animations{0%{transform:translate(24rem);}100%{transform:translate(-'+width+'rem);}}';
});
|
const config = {
repositories: [
{
name: 'PrestaShop',
nbRequiredApprovals: 2,
topwatchersThreshold: 5,
excludedUsersFromTopwatchers: [
'prestashop-issue-bot',
'prestashop-issue-bot[bot]',
'sentimentbot',
'sentimentbot[bot]',
'top-issues',
'top-issues[bot]',
'travis-ci',
'travis-ci[bot]',
'ps-jarvis',
'ps-jarvis[bot]',
'prestonBot',
'prestonBot[bot]',
'dependabot',
'dependabot[bot]',
'atomiix',
'eternoendless',
'jolelievre',
'kpodemski',
'matks',
'matthieu-rolland',
'NeOMakinG',
'PierreRambaud',
'Progi1984',
'PululuK',
'sowbiba',
'khouloudbelguith',
'Robin-Fischer-PS',
'MatShir',
'hibatallahAouadni',
'florine2623',
'Julievrz',
'boubkerbribri',
'ldeprestashop',
'marionf',
'nesrineabdmouleh',
'prestascott',
'RomainBocheux',
'sarahdib',
'SD1982',
'TristanLDD',
],
projects: [
{
name: 'PrestaShop 1.7.7.6',
kanbanColumns: {
// notReadyColumnId: xxxxxxx,
backlogColumnId: 14540711,
toBeSpecifiedColumnId: 14540716,
toDoColumnId: 14540712,
inProgressColumnId: 14540718,
toBeReviewedColumnId: 14540720,
toBeTestedColumnId: 14540726,
toBerMergedColumnId: 14540727,
doneColumnId: 14540728,
},
},
{
name: 'PrestaShop 1.7.8.0',
kanbanColumns: {
notReadyColumnId: 7977635,
backlogColumnId: 6728638,
toBeSpecifiedColumnId: 7977630,
toDoColumnId: 6728615,
inProgressColumnId: 6728616,
toBeReviewedColumnId: 7309753,
toBeTestedColumnId: 7309755,
toBerMergedColumnId: 7309760,
doneColumnId: 6728617,
},
},
],
labels: {
todo: {name: 'To Do', automatic: true},
inProgress: {name: 'WIP', automatic: false},
toBeReproduced: {name: 'TBR', automatic: true},
toBeSpecified: {name: 'TBS', automatic: true},
needsMoreInfo: {name: 'NMI', automatic: false},
toBeTested: {name: 'waiting for QA', automatic: false},
toBeMerged: {name: 'QA ✔️', automatic: false},
waitingAuthor: {name: 'waiting for author️', automatic: false},
fixed: {name: 'Fixed', automatic: true},
topwatchers: {name: 'Topwatchers', automatic: false},
},
milestones: [
{
name: '1.7.7.6',
project: 'PrestaShop 1.7.7.6',
},
{
name: '1.7.8.0',
project: 'PrestaShop 1.7.8.0',
},
],
},
],
};
module.exports = config;
|
../../../../../shared/src/App/Site/sagas.js |
import React from 'react';
import { Container,Row,Card, CardTitle, CardText, Col } from 'reactstrap';
const Cards= (props) => {
return (
<Container style={{backgroundColor:'grey'}}>
<Row>
<Col>
<Card body inverse color="info" style={CardStyle}>
<CardTitle>Active Cases- Till Now({Date().slice(0,11)})</CardTitle>
<CardText style={{fontSize:'30px'}}>{props.graphData.datasets[0].data[0]}</CardText>
</Card>
</Col>
<Col>
<Card body inverse color="danger" style={CardStyle}>
<CardTitle>Deaths Cases- Till Now({Date().slice(0,11)})</CardTitle>
<CardText style={{fontSize:'30px'}}>{props.graphData.datasets[0].data[1]}</CardText>
</Card>
</Col>
<Col>
<Card body inverse color="success" style={CardStyle}>
<CardTitle>Recovered Cases- Till Now({Date().slice(0,11)})</CardTitle>
<CardText style={{fontSize:'30px'}}>{props.graphData.datasets[0].data[2]}</CardText>
</Card>
</Col>
</Row>
</Container>
);
};
const CardStyle={
marginLeft:'5px',
marginTop:'20px',
marginBottom:'10px',
border:'solid',
borderColor:'rgb(100,100,100)',
borderWidth:'2px',
}
export default Cards; |
Parse.initialize("TK6eb71TLg0APbyMsHiSaGEbW3jfG7ItMr6GFaLE", "sK68SERNVQoB9mIekFHdFs9KbF6EiAiH8VctUyBs"); |
var skillsNode;var skillsNodeDesc;
$(document).ready(function(){
// Graph Section
var aboutMeGraphShown=0;
var skillsGraphShown=0;
drawGraphAboutMe();
drawHistory();
d3.json("files/skills.json", function(json) {
skillsNode=json.nodes;
skillsNodeDesc=json.nodesDescription;
drawGraphSkills(skillsNode,1);
});
$(window).resize(function(){
drawGraphAboutMe();
drawHistory();
d3.json("files/skills.json", function(json) {
skillsNode=json.nodes;
drawGraphSkills(skillsNode);
});
});
$(window).on('scroll', function() {
if($(window).scrollTop()+$(window).height()>$("#graphAboutMe").offset().top && aboutMeGraphShown==0){
aboutMeGraphShown=1;
drawGraphAboutMe();
}
if($(window).scrollTop()+$(window).height()>$("#graph-skills").offset().top && skillsGraphShown==0){
skillsGraphShown=1;
d3.json("files/skills.json", function(json) {
skillsNode=json.nodes;
drawGraphSkills(skillsNode);
});
}
$(".email").attr('title','hello'+' @ '+'joelcthomas.com');
emailToolTip();
});
});
function emailToolTip(){
$(".email").tooltip({
position: {
my: "center bottom-20",
at: "center top",
using: function( position, feedback ) {
$(this).css(position);
$("<div>")
.addClass( "email-info" )
.addClass( feedback.vertical )
.addClass( feedback.horizontal )
.appendTo( this );
}
}
});
}
function drawHistory(){
var width = $("#graphHistory").width(),
height = 600,
scaleYear = 20,
historyData;
var hoverarea=[];
$("#graphHistoryD3").remove();
var svg = d3.select("#graphHistory").append("svg")
.attr("class", "image featured")
.attr("id","graphHistoryD3")
.attr("width", width)
.attr("height", height)
.on("mousemove", function(){
var hoverCoord = [0, 0];
hoverCoord = d3.mouse(this);
controlHover(hoverCoord[0],hoverCoord[1]);
});
d3.json("files/historyData.json", function(error, json) {
historyData = json;
update();
});
var lineFunction = d3.svg.line()
.x(function(d) { return d.x; })
.y(function(d) { return d.y; })
.interpolate("basis");
function update(){
var x,x1,x2,y,y1,y2;
$.each(historyData, function(i,d) {
// Main lines
if(d.group!="anchor"&&d.group!="anchor2"&&d.group!="scale"){
x1=(($("#graphHistory").width()/2)+(d.x1*$("#graphHistory").width()/scaleYear));
y1=(($("#graphHistory").height()*(1/2))+d.y1);
x2=(($("#graphHistory").width()/2)+(d.x2*$("#graphHistory").width()/scaleYear));
y2=(($("#graphHistory").height()*(1/2))+d.y2);
appendLine(x1,y1,x2,y2,d.id,d.width,d.strokestyle,d.color);
if(d.group=="emphasis"||d.group=="learn"){
hoverarea[d.id.split("_")[1]+'_x1']=x1;
hoverarea[d.id.split("_")[1]+'_x2']=x2;
}
}
//Scale
if(d.group=="scale"){
x1=(($("#graphHistory").width()/2)+(d.x1*$("#graphHistory").width()/scaleYear));
y1=(($("#graphHistory").height()*(1/10))+d.y1);
x2=(($("#graphHistory").width()/2)+(d.x2*$("#graphHistory").width()/scaleYear));
y2=(($("#graphHistory").height()*(1/10))+d.y2);
appendLine(x1,y1,x2,y2,"",d.width,d.strokestyle,d.color);
var text=svg.append("text")
.attr("dy", ".35em")
.attr("x",x2+5)
.attr("y",y2)
.attr("class","anchortext")
.attr("font-size",function(){
if($( window ).width()>800){return "12px";}
else{return "0.6em";}
})
.text(function() { return d.name; });
}
// Separating lines
if(d.group=="mainaxis"){
x1=(($("#graphHistory").width()/2)+(d.x1*$("#graphHistory").width()/scaleYear));
y1=(($("#graphHistory").height()*(1/2))+d.y1-7);
x2=(($("#graphHistory").width()/2)+(d.x1*$("#graphHistory").width()/scaleYear));
y2=(($("#graphHistory").height()*(1/2))+d.y1+7);
appendLine(x1,y1,x2,y2,"",2,"",d.color);
x1=(($("#graphHistory").width()/2)+(d.x1*$("#graphHistory").width()/scaleYear));
y1=(($("#graphHistory").height()*(1/2))+d.y1-7+180);
x2=(($("#graphHistory").width()/2)+(d.x1*$("#graphHistory").width()/scaleYear));
y2=(($("#graphHistory").height()*(1/2))+d.y1+7+180);
appendLine(x1,y1,x2,y2,"",2,"",d.color);
}
//Add Main Axis Image
if(d.group=="image"){
x1=(($("#graphHistory").width()/2)+(d.x1*$("#graphHistory").width()/scaleYear));
x2=(($("#graphHistory").width()/2)+(d.x2*$("#graphHistory").width()/scaleYear));
x=x1+(x2-x1)/2;
y=(($("#graphHistory").height()*(1/2))+d.y1+180);
var textWidth=(x2-x1)*0.7;
var image = svg.append("svg:image")
.attr("xlink:href", "/images/history/"+d.name+".png")
.attr("x", x)
.attr("y", y)
.attr("width", widthCalc(d.width)+"px")
.attr("height", widthCalc(d.height)+"px")
.attr("transform", "translate(" + (-widthCalc(d.width)/2) + "," + (-widthCalc(d.height)/2) + ")");
}
// Add pointing anchor lines
if(d.group=="anchor"){
//Vertical line
x1=(($("#graphHistory").width()/2)+(d.x1*$("#graphHistory").width()/scaleYear));
y1=(($("#graphHistory").height()*(1/2))+d.y1);
x2=(($("#graphHistory").width()/2)+(d.x2*$("#graphHistory").width()/scaleYear));
y2=(($("#graphHistory").height()*(1/2))+d.y2);
appendLine(x1,y1,x2,y2,d.id,d.width,d.strokestyle,d.color);
//horizontal line
x1=x2;
y1=y2;
x2=x1+10;
y2=y2;
appendLine(x1,y1,x2,y2,d.id,d.width,d.strokestyle,d.color);
//Arrow head
x1=x2-4;
y1=y2-4;
appendLine(x1,y1,x2,y2,d.id,d.width,d.strokestyle,d.color);
x1=x2-4;
y1=y2+4;
appendLine(x1,y1,x2,y2,d.id,d.width,d.strokestyle,d.color);
//Anchor text
x=x2+3;
y=y2;
var text=svg.append("text")
.attr("dy", ".35em")
.attr("x",x)
.attr("y",y)
.attr("class","anchortext")
.attr("id",d.id)
.attr("font-size",function(){
if($( window ).width()>800){return "12px";}
else{return "0.6em";}
})
.text(function() { return d.name; });
var textWidth=($("#graphHistory").width()-x)*0.9;
wrap(text,textWidth);
}
if(d.group=="anchor2"){
//Vertical line
x1=(($("#graphHistory").width()/2)+(d.x1*$("#graphHistory").width()/scaleYear));
y1=(($("#graphHistory").height()*(1/2))+d.y1);
x2=(($("#graphHistory").width()/2)+(d.x2*$("#graphHistory").width()/scaleYear));
y2=(($("#graphHistory").height()*(1/2))+d.y2);
//Arrow head
var anchorclass="anchortext2";
if(y2<y1){
appendLine(x1,y1,x2,y2,d.id,d.width,d.strokestyle,d.color);
x1=x2-4;
y1=y2+4;
appendLine(x1,y1,x2,y2,d.id,d.width,d.strokestyle,d.color);
x1=x2+4;
y1=y2+4;
appendLine(x1,y1,x2,y2,d.id,d.width,d.strokestyle,d.color);
anchorclass="anchortext2";
}
//Anchor text
if(anchorclass=="anchortext2"){
x=x1+((x2-x1)/2);
y=y2-9;
}
var text=svg.append("text")
.attr("dy", ".35em")
.attr("x",x)
.attr("y",y)
.attr("class",anchorclass)
.attr("id",d.id)
.attr("font-size",function(){
if($( window ).width()>800){return "12px";}
else{return "0.6em";}
})
.text(function() { return d.name; });
if(y2>=y1){
var textWidth=(x2-x1)*0.9;
wrap(text,textWidth);
}
}
});
controlHover(0,0);
}
function controlHover(posx,posy){
var selectedArea='empty';
if(posy<($("#graphHistory").height()/2)){
if(posx>hoverarea['Infosys_x1']&&posx<=hoverarea['Infosys_x2']){
selectedArea='Infosys';
}else if(posx>hoverarea['StatisticalAnalyst_x1']&&posx<=hoverarea['StatisticalAnalyst_x2']){
selectedArea='StatisticalAnalyst';
}else if(posx>hoverarea['ResearchAssistant_x1']&&posx<=hoverarea['ResearchAssistant_x2']){
selectedArea='ResearchAssistant';
}else if(posx>hoverarea['MicronIntern_x1']&&posx<=hoverarea['MicronIntern_x2']){
selectedArea='MicronIntern';
}else if(posx>hoverarea['ProcessEngg_x1']&&posx<=hoverarea['ProcessEngg_x2']){
selectedArea='ProcessEngg';
}else if(posx>hoverarea['SystemsEngineer_x1']&&posx<=hoverarea['SystemsEngineer_x2']){
selectedArea='SystemsEngineer';
}else if(posx>hoverarea['SeniorDataScientist_x1']&&posx<=hoverarea['SeniorDataScientist_x2']){
selectedArea='SeniorDataScientist';
}else if(posx>hoverarea['PrincipalDataScientist_x1']&&posx<=hoverarea['PrincipalDataScientist_x2']){
selectedArea='PrincipalDataScientist';
}
var allTextElements=svg.selectAll("text[id=Infosys],text[id=StatisticalAnalyst],text[id=ResearchAssistant],text[id=MicronIntern],text[id=ProcessEngg],text[id=SystemsEngineer],text[id=SeniorDataScientist],text[id=PrincipalDataScientist]");
allTextElements.attr("class","anchortext");
allTextElements=svg.selectAll("text[id=Sathyabama],text[id=UniversityOfHouston],text[id=ContinousLearn]");
allTextElements.attr("class","anchortext2");
var hoverTextElement=svg.selectAll("text[id="+selectedArea+"]");
hoverTextElement.attr("class","anchortexthover")
}else{
if(posx>hoverarea['Sathyabama_x1']&&posx<=hoverarea['Sathyabama_x2']){
selectedArea='Sathyabama';
}else if(posx>hoverarea['UniversityOfHouston_x1']&&posx<=hoverarea['UniversityOfHouston_x2']){
selectedArea='UniversityOfHouston';
}else if(posx>hoverarea['ContinousLearn_x1']&&posx<=hoverarea['ContinousLearn_x2']){
selectedArea='ContinousLearn';
}
var allTextElements=svg.selectAll("text[id=Infosys],text[id=StatisticalAnalyst],text[id=ResearchAssistant],text[id=MicronIntern],text[id=ProcessEngg],text[id=SystemsEngineer],text[id=SeniorDataScientist],text[id=PrincipalDataScientist]");
allTextElements.attr("class","anchortext");
allTextElements=svg.selectAll("text[id=Sathyabama],text[id=UniversityOfHouston],text[id=ContinousLearn]");
allTextElements.attr("class","anchortext2");
var anchortexthover='anchortext2hover';
var hoverTextElement=svg.selectAll("text[id="+selectedArea+"]");
hoverTextElement.attr("class",anchortexthover);
}
var allLineElements=svg.selectAll("line[id=Infosys],line[id=StatisticalAnalyst],line[id=ResearchAssistant],line[id=MicronIntern],line[id=ProcessEngg],line[id=SystemsEngineer],line[id=SeniorDataScientist],line[id=PrincipalDataScientist],line[id=Sathyabama],line[id=UniversityOfHouston],line[id=ContinousLearn]");
allLineElements.attr("class","anchorline");
var hoverLineElement=svg.selectAll("line[id="+selectedArea+"]");
hoverLineElement.attr("class","anchorlinehover");
allLineElements=svg.selectAll("line[id=ML_Infosys],line[id=ML_StatisticalAnalyst],line[id=ML_ResearchAssistant],line[id=ML_MicronIntern],line[id=ML_ProcessEngg],line[id=ML_SystemsEngineer],line[id=ML_SeniorDataScientist],line[id=ML_PrincipalDataScientist]");
allLineElements.attr("class","workline");
allLineElements=svg.selectAll("line[id=ML_Sathyabama],line[id=ML_UniversityOfHouston],line[id=ML_ContinousLearn]");
allLineElements.attr("class","learnline");
hoverLineElement=svg.selectAll("line[id=ML_"+selectedArea+"]");
hoverLineElement.attr("class","anchorlinehover");
svg.selectAll("path.bottomline").remove();
var lineData1= [ { "x": 0, "y": $("#graphHistory").height()*(1/2)+110}, { "x": posx-10, "y": $("#graphHistory").height()*(1/2)+110},
{ "x": posx, "y": $("#graphHistory").height()*(1/2)+110-20}, { "x": posx+10, "y": $("#graphHistory").height()*(1/2)+110},
{ "x": $("#graphHistory").width(), "y": $("#graphHistory").height()*(1/2)+110}];
var lineData2 = [ { "x": $("#graphHistory").width(), "y": $("#graphHistory").height()*(1/2)+110},
{ "x": posx+10, "y": $("#graphHistory").height()*(1/2)+110},
{ "x": posx, "y": $("#graphHistory").height()*(1/2)+110+20},
{ "x": posx-10, "y": $("#graphHistory").height()*(1/2)+110},
{ "x": 0, "y": $("#graphHistory").height()*(1/2)+110}];
var lineGraph = svg.append("path")
.attr("d", lineFunction(lineData1))
.attr("class","bottomline");
lineGraph = svg.append("path")
.attr("d", lineFunction(lineData2))
.attr("class","bottomline");
}
function appendLine(x1,y1,x2,y2,id,width,strokestyle,color){
svg.append("svg:line")
.attr("x1",x1)
.attr("y1",y1)
.attr("x2",x2)
.attr("y2",y2)
.attr("id", id)
.attr("stroke-width", width)
.attr("stroke-dasharray",strokestyle)
.attr("stroke", color)
.attr("fill", color);
}
function wrap(text, width) {
text.each(function() {
var text = d3.select(this),
words = text.text().split(/\s+/).reverse(),
word,
line = [],
lineNumber = 0,
lineHeight = 1, // ems
x = text.attr("x"),
y = text.attr("y"),
dy = parseFloat(text.attr("dy")),
tspan = text.text(null).append("tspan").attr("x", x).attr("y", y).attr("dy", dy + "em");
while (word = words.pop()) {
line.push(word);
tspan.text(line.join(" "));
if (tspan.node().getComputedTextLength() > width || word=='linebreak') {
line.pop();
tspan.text(line.join(" "));
if(word!='linebreak'){
line = [word];
}else{
line = [];
}
tspan = text.append("tspan").attr("x", x).attr("y", y).attr("dy", ++lineNumber * lineHeight + dy + "em").text(word);
}
}
});
}
function widthCalc(val){
if($( window ).width()>1024){return val;}
else{return (val- (1024-$( window ).width())/10 );}
}
}
function drawGraphAboutMe(){
var smallCircleSize=0;
var w = $('#graphAboutMe').width(), h = (function(){
if($( window ).width()>700){return 700;}
else{return 600+((700-$(window ).width())/2);}
})();
var jsonData;
var force = d3.layout.force()
.charge(
function(d){
if($( window ).width()>1024){return -4000;}
else{return -$(window ).width();}
})
.distance(
function(d){
if($( window ).width()>700){return 150;}
else{return $(window ).width()/10;}
})
.linkDistance(
function(d){
if($( window ).width()>700){return d.distance;}
else{return d.distance*($(window ).width()/700);}
})
.gravity(0.00005)
.size([w, h/2]);
$("#graphAboutMeD3").remove();
var svg = d3.select('#graphAboutMe')
.append('svg')
.attr("class", "image featured")
.attr("id","graphAboutMeD3")
.attr('width', w)
.attr('height', h);
svg.append("defs").selectAll("marker")
.data(["base","art","software","statistics"])
.enter().append("marker")
.attr("id", function(d) { return d; })
.attr("viewBox", "0 -5 10 10")
.attr("refX", 0)
.attr("refY", -0.5)
.attr("markerWidth", 7)
.attr("markerHeight", 7)
.attr("orient", "auto")
.append("path")
.attr("d", "M0,-5L10,0L0,5");
var link = svg.selectAll(".link"),
node = svg.selectAll(".node");
d3.json("files/aboutMe.json", function(json){
for(var i=json.nodes.length-1;i>=0;i--){
if(json.nodes[i].name=="math"){
json.nodes[i].x=$("#graphAboutMeD3").width()/2;
}else if(json.nodes[i].name=="science"){
json.nodes[i].x=($("#graphAboutMeD3").width()/2)-($("#graphAboutMeD3").width()/4);
}else if(json.nodes[i].name=="art"){
json.nodes[i].x=($("#graphAboutMeD3").width()/2)+($("#graphAboutMeD3").width()/4);
}else if(json.nodes[i].name=="data science"){
json.nodes[i].x=($("#graphAboutMeD3").width()/2)+($("#graphAboutMeD3").width()/8);
json.nodes[i].y=($("#graphAboutMeD3").height()-75);
}else if(json.nodes[i].name=="artificial intelligence"){
json.nodes[i].x=($("#graphAboutMeD3").width()/2)-($("#graphAboutMeD3").width()/8);
json.nodes[i].y=($("#graphAboutMeD3").height()-75);
}else if(json.nodes[i].name=="product development"){
json.nodes[i].x=($("#graphAboutMeD3").width()/2);
json.nodes[i].y=($("#graphAboutMeD3").height())*0.40;
}
};
jsonData=json;
update();
});
function update() {
force
.nodes(jsonData.nodes)
.links(jsonData.links)
.start();
var path = svg.append("g").selectAll("path")
.data(force.links())
.enter().append("path")
.attr("class", function(d) { return "link " + d.type; })
.attr("marker-mid", function(d) { return "url(#" + d.type + ")"; });
node = node
.data(jsonData.nodes, function(d) { return d.id; });
node.exit().remove();
var nodeEnter = node.enter().append("g")
.attr("class", "node")
.on("click", click)
.on("mouseover", function(d){
d3.select(this).select("circle").transition()
.duration(200)
.attr("r", circleSizeMouseOver);
path.style('stroke-width', function(l){
if (d === l.source || d === l.target)
return 2;
else
return 1;
});
})
.on("mouseout", function(d){
d3.select(this).select("circle").transition()
.duration(800)
.attr("r", circleSize);
path.style('stroke-width', 1);
})
.call(force.drag);
nodeEnter.append("svg:circle")
.attr("r", circleSize)
.style("fill", function(d) { return d.color; });
var text = svg.append("svg:g")
.selectAll("g")
.data(force.nodes())
.enter().append("svg:g")
.attr("class", "nodeText");
text.append("svg:text")
.attr("x", 0)
.attr("dy", ".35em")
.attr("font-size",function(){
if($( window ).width()>800){return "14px";}
else{return "0.85em";}
})
.text(function(d) { return d.name; });
text.select("text").call(wrap, smallCircleSize );
force.on("tick", function() {
path.attr("d", linkArc);
r=75;
node
.each(collide(.5))
.attr("cx", function(d) { return d.x = Math.max(r, Math.min(w - r, d.x)); })
.attr("cy", function(d) { return d.y = Math.max(r, Math.min(h - r, d.y)); });
node.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });
text.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });
});
};
function linkArc(d) {
var dx = d.target.x - d.source.x,
dy = d.target.y - d.source.y,
dr = Math.sqrt(dx * dx + dy * dy)/0.4;
if(d.target.x<w/2||d.source.x<w/2){
return [
"M",d.source.x,d.source.y,
"A",dr,dr,0,0,0,d.target.x,d.target.y
].join(" ");
}else{
return [
"M",d.source.x,d.source.y,
"A",dr,dr,0,0,1,d.target.x,d.target.y
].join(" ");
}
}
function circleSize(d){
var circleSize=0;
if($( window ).width()<700){circleSize=Math.sqrt(d.size) / (9+((700-$( window ).width())/60));}
else{circleSize=Math.sqrt(d.size) / 9;}
circleSize=circleSize || 4.5
smallCircleSize=1.3*((smallCircleSize==0||smallCircleSize>circleSize)?circleSize:smallCircleSize);
return circleSize;
}
function circleSizeMouseOver(d){
var circleSize=0;
if($( window ).width()<700){circleSize=Math.sqrt(d.size) / (9+((700-$( window ).width())/60));}
else{circleSize=Math.sqrt(d.size) / 10;}
circleSize=circleSize || 4.5
smallCircleSize=1.3*((smallCircleSize==0||smallCircleSize>circleSize)?circleSize:smallCircleSize);
return circleSize+10;
}
function tick() {
r=75;
node.attr("cx", function(d) { return d.x = Math.max(r, Math.min(w - r, d.x)); })
.attr("cy", function(d) { return d.y = Math.max(r, Math.min(h - r, d.y)); });
link.attr("x1", function(d) { return d.source.x; })
.attr("y1", function(d) { return d.source.y; })
.attr("x2", function(d) { return d.target.x; })
.attr("y2", function(d) { return d.target.y; });
node.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });
}
function click(d) {
if (d3.event.defaultPrevented) return; // ignore drag
force.start();
}
function collide(alpha) {
var width = 960,
height = 500,
padding = 1.5, // separation between same-color circles
clusterPadding = 6, // separation between different-color circles
maxRadius = 12;
var quadtree = d3.geom.quadtree(node);
return function(d) {
var r = d.radius + maxRadius + Math.max(padding, clusterPadding),
nx1 = d.x - r,
nx2 = d.x + r,
ny1 = d.y - r,
ny2 = d.y + r;
quadtree.visit(function(quad, x1, y1, x2, y2) {
if (quad.point && (quad.point !== d)) {
var x = d.x - quad.point.x,
y = d.y - quad.point.y,
l = Math.sqrt(x * x + y * y),
r = d.radius + quad.point.radius + (d.cluster === quad.point.cluster ? padding : clusterPadding);
if (l < r) {
l = (l - r) / l * alpha;
d.x -= x *= l;
d.y -= y *= l;
quad.point.x += x;
quad.point.y += y;
}
}
return x1 > nx2 || x2 < nx1 || y1 > ny2 || y2 < ny1;
});
};
}
function wrap(text, width) {
text.each(function() {
var text = d3.select(this),
words = text.text().split(/\s+/).reverse(),
word,
line = [],
lineNumber = 0,
lineHeight = 1, // ems
y = text.attr("y"),
dy = parseFloat(text.attr("dy")),
tspan = text.text(null).append("tspan").attr("x", 0).attr("y", y).attr("dy", dy + "em");
if(words.length>1){
dy=dy-((lineHeight*(words.length-1))/2);
tspan = text.text(null).append("tspan").attr("x", 0).attr("y", y).attr("dy", dy + "em");
}
while (word = words.pop()) {
line.push(word);
tspan.text(line.join(" "));
if (tspan.node().getComputedTextLength() > width) {
line.pop();
tspan.text(line.join(" "));
line = [word];
tspan = text.append("tspan").attr("x", 0).attr("y", y).attr("dy", ++lineNumber * lineHeight + dy + "em").text(word);
}
}
});
}
}
function drawGraphSkills(nodes){
var width = $('#graph-skills').width(), height = (function(){
if($( window ).width()>700){return 600;}
else{return 600+((700-$(window ).width()));}
})();
var fill = d3.scale.category10();
var groups = d3.nest().key(function(d) { return d.group; }).entries(nodes);
var groupPath = function(d) {
if(d3.geom.hull(d.values.map(function(i) { return [i.x, i.y]; })).join("L") !=""){
return "M" +
d3.geom.hull(d.values.map(function(i) { return [i.x, i.y]; }))
.join("L")
+ "Z";
}
};
var groupFill = function(d, i) { return fill(i); };
var padding = 3,
radius = d3.scale.sqrt().range([0, 12]);
var forceSkills = d3.layout.force()
.nodes(nodes)
.size([width, height])
.charge(-800)
.gravity(.2)
.on("tick", tickSkills)
.start();
var timeoutID;
$("#graph-skills-d3").remove();
var svg = d3.select('#graph-skills').append("svg")
.attr("class", "image featured")
.attr("id","graph-skills-d3")
.attr("width", width)
.attr("height", height)
.append("g")
.attr("transform", "translate(0,0)");
var circle = svg.selectAll("circle")
.data(nodes)
.enter().append("circle")
.attr("class", "skills-circle")
.attr("r", function(d) {
return circleRadCalc(d.radius);
})
.on("mouseover", function(d){
cancelRestoreImgOpacity();
for(var i=1;i<=groups.length;i++){
if(i==d.group){
$(".skills-image-group"+d.group).css('opacity','1');
$("#graph-skills-desc").html(skillsNodeDesc[d.group]+"<br>");
}else{
$(".skills-image-group"+i).css('opacity','0.1');
}
};
})
.on("mouseout", function(d){
timeoutID = window.setTimeout(restoreImgOpacity,500);
})
.style("stroke", function(d) { return d.color; })
.style("fill", function(d) { return d.color; })
.style("fill-opacity","0.0")
.style("stroke-opacity","0.0")
.call(forceSkills.drag);
var image = svg.append("svg:g")
.selectAll("g")
.data(forceSkills.nodes())
.enter().append("svg:image")
.attr("class", "skills-image")
.attr("class", function(d) { return "skills-image skills-image-group"+d.group; })
.attr("xlink:href", function(d) { return "/images/skills/"+d.name+".png"; })
.attr("width", function(d) { return widthCalc(d.width)+"px";})
.attr("height", function(d) { return widthCalc(d.height)+"px";});
function tickSkills(e) {
var r=75;
circle
.each(cluster(50 * e.alpha * e.alpha))
.each(collide(0.75))
.attr("cx", function(d) { return d.x = Math.max(r, Math.min(width - r, d.x)); })
.attr("cy", function(d) { return d.y = Math.max(r, Math.min(height - r, d.y)); });
image.attr("transform", function(d) { return "translate(" + (d.x-widthCalc(d.width)/2) + "," + (d.y-widthCalc(d.height)/2) + ")"; });
svg.selectAll("path")
.data(groups)
.attr("d", groupPath)
.enter().insert("path", "circle")
.style("fill", groupFill)
.style("stroke", groupFill)
.style("stroke-width", 40)
.style("stroke-linejoin", "round")
.style("opacity", 0.20)
.attr("d", groupPath);
}
function restoreImgOpacity(){
$("#graph-skills-desc").html("<br>");
for(var i=1;i<=groups.length;i++){
$(".skills-image-group"+i).css('opacity','1');
};
}
function cancelRestoreImgOpacity(){
window.clearTimeout(timeoutID);
}
// Move d to be adjacent to the cluster node.
function cluster(alpha) {
var max = {};
// Find the largest node for each cluster.
nodes.forEach(function(d) {
if (!(d.color in max) || (d.radius > max[d.color].radius)) {
max[d.color] = d;
}
});
return function(d) {
var node = max[d.color],
l,
r,
x,
y,
i = -1;
if (node == d) return;
x = d.x - node.x;
y = d.y - node.y;
l = Math.sqrt(x * x + y * y);
r = d.radius + node.radius;
if (l != r) {
l = (l - r) / l * alpha;
d.x -= x *= l;
d.y -= y *= l;
node.x += x;
node.y += y;
}
};
}
// Resolves collisions between d and all other circles.
function collide(alpha) {
var quadtree = d3.geom.quadtree(nodes);
return function(d) {
var r = circleRadCalc(d.radius) + circleRadCalc(radius.domain()[1]) + Math.max(padding, 105),
nx1 = d.x - r,
nx2 = d.x + r,
ny1 = d.y - r,
ny2 = d.y + r;
quadtree.visit(function(quad, x1, y1, x2, y2) {
if (quad.point && (quad.point !== d)) {
var x = d.x - quad.point.x,
y = d.y - quad.point.y,
l = Math.sqrt(x * x + y * y),
r = circleRadCalc(d.radius) + circleRadCalc(quad.point.radius) + (d.cluster === quad.point.cluster ? padding : 105);
if (l < r) {
l = (l - r) / l * alpha;
d.x -= x *= l;
d.y -= y *= l;
quad.point.x += x;
quad.point.y += y;
}
}
return x1 > nx2
|| x2 < nx1
|| y1 > ny2
|| y2 < ny1;
});
};
}
function widthCalc(val){
if($( window ).width()>1024){return val;}
else{return (val- (1024-$( window ).width())/19 );}
}
function circleRadCalc(dRadius){
if($( window ).width()>1024){return dRadius;}
else{
return (dRadius- ((1024-$( window ).width())/19) );
}
}
}
|
$(document).ready(function(){
$('#mobile-tog, #mobile-nav').click(function(e){
$('#underhead').toggleClass('collapse');
e.preventDefault();
});
}); |
var simulator = require('./simulator/simulator');
simulator.init({
webPort: 9091,
isProxy: false,
webroot: './hh70_rc'
})
|
const express = require('express');
const session = require('express-session');
const bodyParser = require('body-parser');
const cors = require('cors');
let IN_PROD = true;
const SESSION_LIFETIME = 1000 * 60 * 60;
if(process.env.NODE_ENV !== 'production') {
require('dotenv').config();
IN_PROD = false;
}
const connectDB = require('./src/middlewares/db.middleware');
// middlewares
const auth = require('./src/middlewares/auth.middleware');
const serialization = require('./src/middlewares/serialization.middleware');
// controller
const signup = require('./src/controller/users/signup.controller');
const login = require('./src/controller/users/login.controller');
const logout = require('./src/controller/users/logout.controller');
const usernameValid = require('./src/controller/users/usernameValid.controller');
const getUser = require('./src/controller/users/getUser.controller');
const newDeal = require('./src/controller/deal/newDeal.controller');
const getDeal = require('./src/controller/deal/getDeal.controller');
const getAllDeals = require('./src/controller/deal/getAllDeals.controller');
const getVotes = require('./src/controller/votes/getVotes.controller')
const newVote = require('./src/controller/votes/newVote.controller');
const newComment = require('./src/controller/comment/newComment.controller');
const getDealComments = require('./src/controller/comment/getDealComments.controller');
const getUserComments = require('./src/controller/comment/getUserComments.controller');
const newGroup = require('./src/controller/group/newGroup.controller');
const getGroups = require('./src/controller/group/getGroups.controller');
const getGroup = require('./src/controller/group/getGroup.controller');
// ADMIN
const authAdmin = require('./src/middlewares/authAdmin.middleware');
const getAllUsers = require('./src/controller/admin/users/getAllUsers.controller');
const app = express();
connectDB();
app.use(bodyParser.json());
app.use(cors({origin: [
"http://localhost:3000"
], credentials: true}));
app.use(session({
name: process.env.SESSION_NAME,
secret: 'this is secret',
resave: false,
saveUninitialized: false,
cookie: {
httpOnly: true,
maxAge: SESSION_LIFETIME,
// sameSite: true,
secure: IN_PROD
}
}));
app.get('/connected', (req, res, next) => {
const { user } = req.session;
if (!user) {
return res.json({name: false, img: "https://img.icons8.com/cotton/2x/gender-neutral-user--v2.png"});
}
return res.json({name: user.name, img: "https://img-premium.flaticon.com/png/512/3770/3770458.png?token=exp=1621602178~hmac=3eb56a9942468b34f47023241373e966"});
});
// USERS
app.post('/register', signup, serialization);
app.post('/login', login, serialization);
app.get('/logout', auth, logout, serialization);
app.post('/users/username/valid', usernameValid, serialization);
app.get('/user/:userId', getUser, serialization);
// DEALS
app.post('/deal/new', auth, newDeal, serialization);
app.get('/deal/:id', getDeal, serialization);
app.get('/deals', getAllDeals, serialization);
// VOTES
app.get('/deal/:id/votes', getVotes, serialization);
app.post('/deal/:id/vote', auth, newVote, serialization);
//COMMENTS
app.post('/deal/:id/comment/new', auth, newComment, serialization);
app.get('/deal/:id/comments', getDealComments, serialization);
app.get('/user/:id/comments', getUserComments, serialization);
// GROUPS
app.get('/groups', getGroups, serialization);
app.get('/group/:groupId', getGroup, serialization);
app.post('/group/new', newGroup, serialization);
// ADMIN
app.get('/admin/users', auth, authAdmin, getAllUsers, serialization);
app.listen(process.env.PORT, () => console.log("server started") );
|
import styled from 'styled-components'
export default styled.button`
font-family: ${({ theme }) => theme.bodyFontFamily};
background-color: ${({ theme }) => theme.accentColor};
border: 3px solid ${({ theme }) => theme.accentColor};
font-size: 1.0rem;
padding: .5rem 2rem;
border-radius: 10px;
color: white;
&: hover {
color: ${({ theme }) => theme.accentColor};
background-color: transparent;
}
`
|
import _ from 'lodash'
import * as actionTypes from '../../constants/action-types'
const initialState = {
registries: {
'octoblu-official': {},
'octoblu-community': {},
},
items: [],
}
function flatten(registries) {
let allItems = []
_.each(_.values(registries), (registry) => {
let items = _.get(registry, 'items', [])
if (_.isPlainObject(items)) {
items = _.values(items)
}
allItems = _.union(allItems, items)
})
return allItems
}
export default function types(state = initialState, action) {
switch (action.type) {
case actionTypes.FETCH_AVAILABLE_CONNECTORS_SUCCESS:
return { ...state, registries: action.registries, items: flatten(action.registries) }
default:
return state
}
}
|
$(document).ready(function() {
// When login button is pressed
$("#loginbtn").click(function(){
var myEmailAdmin = $('#myemail').val();
var myPasswordAdmin = $('#mypassword').val();
var adminExists = false;
var crntAdmin = {};
//Get all admins
$.ajax({
url: "http://192.168.40.50:8080/Testicon-Backend/api/admins/"
}).then(function(data, status, jqxhr) {
// Loop through all users and check with entered email and password
$.each( data, function( intValue, currentAdmin ) {
if(myEmailAdmin == currentAdmin.email && myPasswordAdmin == currentAdmin.password){
adminExists = true;
crntAdmin = currentAdmin;
return false;
}
});
if(adminExists){
var adminName = crntAdmin.firstName + " " + crntAdmin.lastName;
//save admin name to cookie
$.cookie('cookieadmin', adminName, { path: '/' } );
//Go to index
window.location.href = 'index.html';
}else{
alert("Wrong password or email!");
}
}); // End ajax
}); // End click event
// Log out
$("#logout").click(function(){
$.removeCookie('cookieAdmin', { path: '/' });
});
});
|
import React from "react";
import "./style.css";
import { Helmet, HelmetProvider } from "react-helmet-async";
import Typewriter from "typewriter-effect";
import { introdata, meta, projects } from "../../content_option";
import { Link } from "react-router-dom";
import { FaGolang, FaNodeJs, FaGitAlt , FaReact } from "react-icons/fa6";
import { DiPostgresql, DiRubyRough } from "react-icons/di";
import { BiLogoTypescript, BiLink } from "react-icons/bi";
import { SiGraphql } from "react-icons/si";
export const Home = () => {
return (
<HelmetProvider>
<section id="home" className="home">
<Helmet>
<meta charSet="utf-8" />
<title>{meta.title}</title>
<meta name="description" content={meta.description} />
</Helmet>
<div className="intro-sec background-wrap">
<div className="text h-100 d-lg-flex">
<div className="align-self-center">
<div className="mx-auto">
<h1 className="mb-1x">{introdata.title}</h1>
<div className="mb-2">
<FaGolang className="icon-tech" />
<FaNodeJs className="icon-tech" />
<DiPostgresql className="icon-tech" />
<FaGitAlt className="icon-tech" />
<DiRubyRough className="icon-tech" />
<FaReact className="icon-tech" />
<BiLogoTypescript className="icon-tech" />
<SiGraphql className="icon-tech" />
</div>
<h1 className="fluidz-48 mb-1x">
<Typewriter
options={{
strings: [
introdata.animated.first,
introdata.animated.second,
introdata.animated.third,
],
autoStart: true,
loop: true,
deleteSpeed: 10,
}}
/>
</h1>
<h5 className="intro-description">{introdata.description}</h5>
<div className="intro_btn-action pb-5">
<Link to="/resume" className="text_2">
<div id="button_p" className="ac_btn btn ">
Check more
<div className="ring one"></div>
<div className="ring two"></div>
<div className="ring three"></div>
</div>
</Link>
<a href="mailto:tiff.wijaya@gmail.com">
<div id="button_h" className="ac_btn btn">
Contact Me
<div className="ring one"></div>
<div className="ring two"></div>
<div className="ring three"></div>
</div>
</a>
</div>
</div>
</div>
<div className="align-self-center mx-auto">
<div className="image-wrapper">
<img src="/profile-circle.png" alt="@zeirash" />
</div>
</div>
</div>
</div>
<hr style={{color: "#888888", marginTop: "0"}}/>
<div className="intro-sec">
{projects.map((data, i) => {
return (
<div key={i} className="section-content">
<h4 className="section-title">
{data.header}
</h4>
{data.details.map((detail, j) => {
var link = ""
if (detail.url !== "") {
link = <div className="link-project">
<a href={detail.url}>
<BiLink /> {detail.url_name}
</a>
</div>
};
return (
<div>
<div key={j} className="section-place">
<h3 className="project-title">
{detail.name}
</h3>
<div className="place-content">
<div className="place-note">
{detail.note}
</div>
{link}
</div>
</div>
</div>
);
})}
</div>
);
})}
</div>
</section>
</HelmetProvider>
);
};
|
#target Illustrator
// TODO:
// List all hidden & locked layers
// Show & Unlock those layers
// (Do the dirty work)
// Re-Hide / Lock said layers
// Rig this script to work on a folder like Shivendra Agarwal's
// but only when there's no documents open (If documents open: resize only current, if none, ask for folder and go to town on those)
requiredABsize = prompt('Scale artboards to what square size?\nREMEMBER THIS NUMBER TO CREATE ENOUGH SPACE BETWEEN YOUR SCALED ARTBOARDS IN THE NEXT STEP.\n\nThis script uses \"Scale Strokes and Effects\" for you.\n\n', '500', 'Select artboard area');
// Make sure the user generates enough space between the artboards
app.executeMenuCommand("ReArrange Artboards");
var activeDoc = app.activeDocument;
var TotalArtboards = activeDoc.artboards.length;
var originalOrigin = activeDoc.rulerOrigin;
for (var i = 0; i < TotalArtboards; i++) {
var _artboards = activeDoc.artboards;
var abActive = _artboards[i];
var abProps = getArtboardBounds(abActive);
var scale = findRequiredScale(abProps);
// abActive = activeDoc.artboards[ activeDoc.artboards.getActiveArtboardIndex() ];
activeDoc.artboards.setActiveArtboardIndex(i);
// alert(i);
app.selection = [];
// app.executeMenuCommand ('deselectall');
app.executeMenuCommand('selectallinartboard');
var selection = activeDoc.selection;
var artboardRight = abActive.artboardRect[2];
// Get the Height of the Artboard
var artboardBottom = abActive.artboardRect[3];
var artboardX = abActive.artboardRect[0];
var artboardY = abActive.artboardRect[1];
var horziontalCenterPosition = (artboardRight + (-1 * artboardX)) / 2;
var verticalCenterPosition = (artboardY - (artboardBottom)) / 2;
//alert(app.activeDocument.rulerOrigin+"\n left "+artboardX+"\ntop "+artboardY+"\nright "+artboardRight+"\nbottom "+artboardBottom+"\nTheleft: "+horziontalCenterPosition+"\nThevert: "+verticalCenterPosition);
activeDoc.rulerOrigin = [horziontalCenterPosition, verticalCenterPosition];
app.selection = [];
activeDoc.selectObjectsOnActiveArtboard();
// app.executeMenuCommand ('selectallinartboard');
// Check if anything is selected:
if (selection.length > 0) {
for (j = 0; j < selection.length; j++) {
selection[j].resize(scale * 100, scale * 100, true, true, true, true, scale * 100, Transformation.DOCUMENTORIGIN);
}
}
var scaledArtboardRect = newRect(-abProps.width / 2 * scale, -abProps.height / 2 * scale, abProps.width * scale, abProps.height * scale);
activeDoc.artboards[i].artboardRect = scaledArtboardRect;
}
activeDoc.rulerOrigin = originalOrigin;
// Artboard bounds helper (used above):
function getArtboardBounds(artboard) {
var bounds = artboard.artboardRect,
left = bounds[0],
top = bounds[1],
right = bounds[2],
bottom = bounds[3],
width = right - left,
height = top - bottom,
props = {
left: left,
top: top,
width: width,
height: height
};
return props;
}
function findRequiredScale(props) {
var scale = Math.min(requiredABsize / props.height, requiredABsize / props.width);
if (scale > 1)
return scale;
else
return 1;
}
function newRect(x, y, width, height) {
var l = 0;
var t = 1;
var r = 2;
var b = 3;
var rect = [];
rect[l] = x;
rect[t] = -y;
rect[r] = width + x;
rect[b] = -(height - rect[t]);
return rect;
};
|
// Copyright (c) 2019 Shellyl_N and Authors
// license: ISC
// https://github.com/shellyln
// const isWebpack = typeof __webpack_require__ === 'function';
//
// if (!isWebpack) {
// const fs = require('fs');
//
// require.extensions['.css'] = function (module, filename) {
// module.exports = fs.readFileSync(filename, 'utf8');
// };
// }
|
import styled from 'styled-components';
export const PageContainer = styled.div`
display: flex;
flex-direction: column;
h1 {
font-size: 38px;
margin: 0 0 30px 0;
}
@media screen and (max-width: 800px) {
h1 {
font-size: 28px;
text-align: center;
}
}
`;
export const ItemsContainer = styled.div`
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
grid-gap: 10px;
@media screen and (max-width: 800px) {
grid-template-columns: 1fr 1fr;
grid-gap: 0px;
}
`;
|
var express = require('express');
var cookieParser = require('cookie-parser');
var app = express();
var port = process.env.PORT || 8080;
var http = require('http');
var md5 = require('md5');
var request = require('request');
var morgan = require('morgan');
var bodyParser = require('body-parser');
var methodOverride = require('method-override');
app.use(express.static(__dirname + '/public'));
app.use(morgan('dev'));
app.use(bodyParser.json()); // parse application/json
app.use(methodOverride('X-HTTP-Method-Override'));
app.use(cookieParser());
app.get('/api/person', function(req, res) {
var options = {
host: 'persons-directory',
port: 5000,
path: '/api/person',
method: 'GET'
};
http.get(options, function(result) {
result.setEncoding('utf8');
var body = '';
result.on('data', function(d) {
body += d;
});
result.on('end', function() {
try {
var parsed = JSON.parse(body);
} catch (err) {
console.error('Unable to parse response as JSON', err);
}
res.json(parsed);
});
}).on('error', function(err) {
console.error('Error with the request:', err.message);
});
});
function createPerson(person, callback) {
var query = { json: { lastname: person.lastname, firstname: person.firstname, birthdate: person.birthdate },
url : 'http://persons-directory:5000/api/person',
method : 'POST' };
request(query, callback);
};
app.post('/api/person', function(req, res) {
createPerson(req.body, function(error, response) {
if (error) return res.send(500, error);
res.send(201, response.body);
});
});
app.delete('/api/person', function(req, res) {
res.send(501, "Not implemented yet");
});
app.get('/logout', function(req, res) {
res.clearCookie('connected');
res.send('<p>disconnected</p>');
});
app.get('/login', function(req, res) {
if (req.cookies.connected) {
res.redirect('/');
} else {
var mdp = req.param('password');
var hash = md5(mdp); // Add salt
if (hash == '721a9b52bfceacc503c056e3b9b93cfa') { // Hash for coucou
res.cookie('connected', 1);
res.redirect('/');
} else {
res.send('<form><input type="text" name="login"/><input type="password" name="password"/><input type="submit" value="Connect"/></form>');
}
}
});
app.get('*', function(req, res) {
if (req.cookies.connected) {
res.sendfile('./public/directory.html');
} else {
res.redirect('/login');
}
});
app.listen(port);
console.log("App listening on port " + port);
|
const mongoose = require('mongoose');
require('dotenv').config();
const db_uri = process.env.DEV_BBDD_URI;
const db_success_msg = process.env.MONGO_CONNECTION_OK_MSG;
mongoose.connect(db_uri,
{
useNewUrlParser: true,
useUnifiedTopology: true,
useCreateIndex: true,
useFindAndModify: true
}
)
.then(() => console.log(db_success_msg))
.catch(console.error);
|
// Ex 01
class Objet {
constructor(nom, prix){
this.nom = nom,
this. prix = prix
}
}
let lampe = new Objet ("lampe", 10);
let torche = new Objet ("torche", 5);
let tableau = ["lampe", "torche"];
class Personnage {
constructor (nom, sac, argent){
this.nom = nom,
this.sac = sac,
this.argent = argent,
this.prendre = (tableau) => {
this.sac.push(tableau.shift());
}
this.acheter = (nom, objet)=> {
this.argent -= objet.prix;
nom.argent += objet.prix;
this.sac.push(objet);
nom.sac.splice(nom.sac.indexOf(objet), 1);
}
}
}
let cam = new Personnage ("Cam", [], 13);
let laurie = new Personnage ("laurie", [], 50);
laurie.prendre(tableau);
cam.prendre(tableau);
console.log(tableau);
console.log(laurie);
cam.acheter(laurie, "lampe");
console.log(cam);
console.log(laurie);
|
$(document).ready(function () {
$('.btn-view').click(function() {
$('#detail').css("display","block");
});
});
|
export { default } from './VotingAll.layout'
|
function getChromosome(chromosomes, id) {
for (var i = 0; i < chromosomes.length; i++) {
if(chromosomes[i].chromosomeID === id) {
return chromosomes[i];
}
}
return undefined;
}
function getTraitExpressionValue(traits, id) {
var trait = getTrait(traits,id);
if(trait) {
return getExpressionValue(trait.geneA, trait.geneB);
}
return undefined;
}
function getExpressionValue(geneA, geneB) {
var geneA_expr = geneA.expressionValue,
geneA_CV = geneA.combinationValue,
geneB_expr = geneB.expressionValue,
geneB_CV = geneB.combinationValue;
if(geneA_expr == geneB_expr) {//If the Expression is the same, don't mess with it
return geneA_expr;
}
if(geneA_CV === 1 && geneB_CV === 0) {//Dominant GeneA
return geneA_expr;
} else if(geneB_CV === 1 && geneA_CV === 0) {//Dominant GeneB
return geneB_expr;
} else if(geneA_CV == geneB_CV) {
return (geneA_expr + geneB_expr) / 2;//Average of Genes
} else {
return getWeightedGeneAverage(geneA, geneB);//Weighted Average of Genes
}
}
function getWeightedGeneAverage(geneA, geneB) {
var geneA_expr = geneA.expressionValue,
geneA_CV = 10 * geneA.combinationValue,
geneB_expr = geneB.expressionValue,
geneB_CV = 10 * geneB.combinationValue;
var weightedA = geneA_expr * geneA_CV,
weightedB = geneB_expr * geneB_CV,
combined = weightedA + weightedB,
combinedAverage = combined / (geneA_CV + geneB_CV);
console.log('A: ' + weightedA + ' B: ' + weightedB + ' = ' + combined + ' avg: ' + combinedAverage);
return combinedAverage;
}
function getTrait(traits, id) {
for (var i = 0; i < traits.length; i++) {
if(traits[i].traitId === id) {
return traits[i];
}
}
return undefined;
} |
var searchData=
[
['savetofile2d',['saveToFile2D',['../classOutput.html#aa9ea0df4774ce32a319bdb1b3a6712a8',1,'Output']]],
['savetofile3d',['saveToFile3D',['../classOutput.html#aa16a2893d743f7c218c026efa3e65718',1,'Output']]],
['setline',['setline',['../classInteractive__editor.html#acf3e55ad6b947af72b83d996f409c176',1,'Interactive_editor']]],
['setplane',['setPlane',['../classInteractive__editor.html#a1332966f87d6df07b217ed663105379b',1,'Interactive_editor']]],
['setpoint',['setPoint',['../classInteractive__editor.html#a21c3f807f2e892c9b40cae987593e2cb',1,'Interactive_editor']]]
];
|
import $ from 'jquery';
import React from 'react';
class AwesomeComponent extends React.Component {
constructor(props) {
super(props);
this.state = {likesCount : 0};
this.onLike = this.onLike.bind(this);
}
onLike () {
let that = this;
$.get("/api/names").then(function (data){
that.setState({
names: data
});
});
}
render() {
return (
<div>
Likes : <span>{this.state.names}</span>
<div><button onClick={this.onLike}>Like Me</button></div>
</div>
);
}
}
export default AwesomeComponent; |
import { classNameBindings, layout as templateLayout } from '@ember-decorators/component';
import Component from '@ember/component';
import layout from 'ember-bootstrap/templates/components/bs-accordion/title';
import defaultValue from 'ember-bootstrap/utils/default-decorator';
/**
Component for an accordion item title.
See [Components.Accordion](Components.Accordion.html) for examples.
@class AccordionItemTitle
@namespace Components
@extends Ember.Component
@public
*/
@templateLayout(layout)
@classNameBindings('collapsed:collapsed:expanded')
export default class AccordionItemTitle extends Component {
@defaultValue
ariaRole = 'tab';
/**
* @property collapsed
* @type boolean
* @public
*/
/**
* @property disabled
* @type boolean
* @private
*/
/**
* @event onClick
* @public
*/
onClick() {
}
click(e) {
e.preventDefault();
if (!this.get('disabled')) {
this.get('onClick')();
}
}
}
|
import React from "react";
import MaterialTable, { MTableToolbar } from "material-table";
import moment from "moment";
import SimpleAccordion from "./accordion";
import "../App.css";
import SearchIcon from "@material-ui/icons/Search";
import { MyContext } from "../App";
const lightBlue = "#1C85E7";
const darkBlue = "#1C466C";
const grey = "#e2e2e2";
function AiropsTable() {
const [opsData, setOpsData] = React.useState([]);
const { panMap } = React.useContext(MyContext);
//! refactor this to be done on app load
React.useEffect(() => {
fetch("/api/passwords")
.then((response) => response.json())
.then((json) => setOpsData(json));
}, []);
const data = React.useMemo(() => opsData, [opsData]);
const columns = [
//{ title: "DSGN Code", field: "dsgn_code", render: null },
{
title: "Company Name",
field: "company_name",
defaultSort: "asc",
},
{
title: "Address",
field: "address",
filtering: false,
sorting: false,
},
{
title: "City",
field: "city",
},
{
title: "State",
field: "state",
//filterPlaceholder: "Filter State",
},
{
title: "Zip",
field: "zip",
},
{
title: "Number of Aircraft",
field: "number_of_aircraft",
type: "numeric",
filtering: false,
searchable: false,
customSort: (a, b) => a.number_of_planes - b.number_of_planes,
},
{
title: "Years in Business",
field: "yib",
type: "numeric",
filtering: false,
customSort: (a, b) => {
var dateA = new Date(a.yib),
dateB = new Date(b.yib);
return dateA - dateB;
},
render: (rowData) => moment(rowData.yib).toNow(true).toString(),
},
{
title: "FAR Part",
field: "far_part",
type: "numeric",
lookup: {
91: "Part 91", // Govt Ops - State & Federal",
121: "Part 121", // Scheduled/Supplemental (Age 65 Limit)",
125: "Part 125", // Travel Club, Etc.",
133: "Part 133", // External Load Rotary",
135: "Part 135", // Charter/Commuter",
137: "Part 137", // Aerial Application",
},
customSort: (a, b) => {
return a.far_part - b.far_part;
},
},
{
title: "Link to Apply",
field: "link_to_apply",
filtering: false,
render: (rowData) => (
<a
href={rowData.link_to_apply}
target="_blank"
rel="noopener noreferrer"
>
Apply
</a>
),
sorting: false,
searchable: false,
},
];
return (
<div className="table">
<MaterialTable
//style={{ backgroundColor: "#e2e2e2" }}
title="Air Operators"
columns={columns}
data={data}
icons={{ Filter: () => <SearchIcon style={{ fontSize: "medium" }} /> }}
actions={[
{
icon: "map",
tooltip: "Show on map",
onClick: (event, rowData) => panMap(rowData),
},
]}
options={{
actionsColumnIndex: -1,
filtering: true,
search: false,
headerStyle: {
backgroundColor: darkBlue,
color: "#FFF",
},
}}
components={{
Toolbar: (props) => (
<div>
<MTableToolbar {...props} />
<div
id="mapDiv"
style={{
padding: "10px 10px",
textAlign: "center",
display: "flex",
}}
>
<SimpleAccordion data={data} />
</div>
</div>
),
}}
/>
</div>
);
}
export default AiropsTable;
|
document.addEventListener("DOMContentLoaded", function() {
const container= document.querySelectorAll('.Img-container');
for (let i = 0; i < container.length; i++) {
const content = container[i];
console.log(content);
content.addEventListener('mousemove',startRotate);
content.addEventListener('mouseout',stopRotate);
}
function startRotate(event){
const contentItem = this.querySelector('.Img-content');
const halfHeight = contentItem.offsetHeight/2;
const halfWidth = contentItem.offsetWidth/2;
contentItem.style.transform = 'rotateX(' + -(event.offsetY - halfHeight) / 50 + 'deg) rotateY(' + (event.offsetX - halfWidth) / 60 + 'deg)';
}
function stopRotate(event){
const contentItem = this.querySelector('.Img-content');
contentItem.style.transform = 'rotate(0)';
}
}); |
var ventana_alto = window.innerHeight ? window.innerHeight : $(window).height();
var ventana_ancho = $(window).width();
var disable=true;
var active_ace=false;
var input_text=false;
var input_text2=false;
var input_goles=false;
var input_radio=false;
var tenis_name="";
var respuestas_array = new Array();
var final_time = 0;
var aciertos = 0;
$("#indepth_boton_empezar").on("click",function(){
$("#indepth_boton_empezar").click(false);
ventana_alto = window.innerHeight ? window.innerHeight : $(window).height();
$("#indepth_resultados").show();
var data = {
"preguntas": [
{
"pregunta": "<img src='../images/preguntas/1.png'>",
"respuestas": [
{
"respuesta": "Paco Gento",
"tipo": "true"
},
{
"respuesta": "Paolo Maldini",
"tipo": "false"
},
{
"respuesta": "Cristiano Ronaldo",
"tipo": "false"
},
{
"respuesta": "Clarence Seedorf",
"tipo": "false"
}
]
},
{
"pregunta": "<img src='../images/preguntas/2.png'>",
"respuestas": [
{
"respuesta": "Atletico de Madrid",
"tipo": "false"
},
{
"respuesta": "Bayern de Múnich",
"tipo": "false"
},
{
"respuesta": "Manchester United",
"tipo": "false"
},
{
"respuesta": "Juventus",
"tipo": "true"
}
]
},
{
"pregunta": "<img src='../images/preguntas/3.png'>",
"respuestas": [
{
"respuesta": "Hugo Sánchez",
"tipo": "false"
},
{
"respuesta": "Hector Herrera",
"tipo": "false"
},
{
"respuesta": "Javier Hernández",
"tipo": "true"
},
{
"respuesta": "Rafa Márquez",
"tipo": "false"
}
]
},
{
"pregunta": "<img src='../images/preguntas/4.png'>",
"respuestas": [
{
"respuesta": "Cristiano Ronaldo",
"tipo": "true"
},
{
"respuesta": "Gareth Bale",
"tipo": "false"
},
{
"respuesta": "Liones Messi",
"tipo": "false"
},
{
"respuesta": "Samuel Eto'o",
"tipo": "false"
}
]
},
{
"pregunta": "<img src='../images/preguntas/5.png'>",
"respuestas": [
{
"respuesta": "A. Del Piero",
"tipo": "false"
},
{
"respuesta": "Paolo Maldini",
"tipo": "false"
},
{
"respuesta": "Patrice Evra",
"tipo": "true"
},
{
"respuesta": "Gianluigi Buffon",
"tipo": "false"
}
]
},
{
"pregunta": "<img src='../images/preguntas/6.png'>",
"respuestas": [
{
"respuesta": "Raúl González",
"tipo": "false"
},
{
"respuesta": "Sergio Ramos",
"tipo": "false"
},
{
"respuesta": "Cristiano Ronaldo",
"tipo": "false"
},
{
"respuesta": "Iker Casillas",
"tipo": "true"
}
]
},
{
"pregunta": "<img src='../images/preguntas/7.png'>",
"respuestas": [
{
"respuesta": "España",
"tipo": "false"
},
{
"respuesta": "Inglaterra",
"tipo": "true"
},
{
"respuesta": "Italia",
"tipo": "false"
},
{
"respuesta": "Alemania",
"tipo": "false"
}
]
},
{
"pregunta": "<img src='../images/preguntas/8.png'>",
"respuestas": [
{
"respuesta": "España",
"tipo": "true"
},
{
"respuesta": "Inglaterra",
"tipo": "false"
},
{
"respuesta": "Italia",
"tipo": "false"
},
{
"respuesta": "Alemania",
"tipo": "false"
}
]
},
{
"pregunta": "<img src='../images/preguntas/9.png'>",
"respuestas": [
{
"respuesta": "Patrick Kluivert",
"tipo": "true"
},
{
"respuesta": "Lionel Messi",
"tipo": "false"
},
{
"respuesta": "Neymar",
"tipo": "false"
},
{
"respuesta": "Johan Cruyff",
"tipo": "false"
}
]
},
{
"pregunta": "<img src='../images/preguntas/10.png'>",
"respuestas": [
{
"respuesta": "Barcelona",
"tipo": "false"
},
{
"respuesta": "Milán",
"tipo": "false"
},
{
"respuesta": "Real Madrid",
"tipo": "true"
},
{
"respuesta": "Bayern de Múnich",
"tipo": "false"
}
]
},
{
"pregunta": "<img src='../images/preguntas/11.png'>",
"respuestas": [
{
"respuesta": "Paolo Maldini",
"tipo": "true"
},
{
"respuesta": "Cristiano Ronaldo",
"tipo": "false"
},
{
"respuesta": "Patrice Evra",
"tipo": "false"
},
{
"respuesta": "Clarence Seedorf",
"tipo": "false"
}
]
},
{
"pregunta": "<img src='../images/preguntas/12.png'>",
"respuestas": [
{
"respuesta": "Josep Guardiola",
"tipo": "false"
},
{
"respuesta": "Jose Mourinho",
"tipo": "false"
},
{
"respuesta": "Alex Ferguson",
"tipo": "false"
},
{
"respuesta": "Zinédine Zidane",
"tipo": "true"
}
]
}
]
};
preguntas=data.preguntas;
$("#indepth_pregunta_cont").html("");
$.each(preguntas, function( i, item ) {
var div=' <div class="indepth_pregunta_item"><div class="indepth_pregunta">'+(i+1)+'- '+item.pregunta+'</div><div class="indepth_pregunta_main"><div class="indepth_pregunta_img"><img src="'+urlIndepth+'images/preguntas/'+(i+1)+'.png" /></div><div class="indepth_respuestas_cont" num="'+i+'">';
var div_items="";
$.each(item.respuestas, function( j, items ) {
div_items+='<div class="indepth_respuesta_item active" num="'+j+'">'+items.respuesta+'</div>';
});
var div_fin='</div></div></div>';
$("#indepth_pregunta_cont").append(div+div_items+div_fin);
});
$("#indepth_page1").css({
"top":ventana_alto-100,
"visibility":"visible",
"height": "auto"
});
$("#nav-bar-stats,#top-bar-wrapper,#body-wrapper").hide();
$("#indepth_page1").show();
$("#indepth_page1").animate({
top: 0
},2000 );
$(document).on("click",".indepth_respuesta_item",function(){
var respuesta_cont = $(this).parent();
var pregunta_num = respuesta_cont.attr("num");
var respuesta_num = $(this).attr("num");
var pregunta_obj = preguntas[pregunta_num];
var respuesta_obj = pregunta_obj.respuestas[respuesta_num];
tipo= (respuesta_obj.tipo === "true");
if(tipo){
$(this).addClass("bien");
respuestas_array[pregunta_num]=true;
}else{
$(this).addClass("mal");
respuestas_array[pregunta_num]=false;
}
respuesta_cont.find('.indepth_respuesta_item').removeClass("active").addClass("disable");
respuesta_cont.find('.indepth_respuesta_item').click(false);
if(preguntas.length == respuestas_array.length){
respuestas_num=0;
$.each(respuestas_array, function( i, item ) {
if(item!=undefined)
respuestas_num++;
});
if(respuestas_num == preguntas.length){
finish_test();
}
}
});
});
function finish_test(){
ventana_alto = window.innerHeight ? window.innerHeight : $(window).height();;
var ventana_ancho = $(window).width();
$("#indepth_resultados").css({
"visibility": "visible",
"position":"fixed",
"top": 0,
"left": -ventana_ancho
});
$("#indepth_resultados").animate({
"left": 0
},2000, function(){
$("html, body, #indepth_page1").css("overflow","hidden");
});
$.each(respuestas_array, function( i, item ) {
if(item){
aciertos++;
}
});
aficionado="";
msg="";
if (aciertos <= 3) {
$("#indepth_resultados").css({
"visibility": "visible",
"position":"fixed",
"top": 0,
"left": -ventana_ancho
});
$(".inner").append("<img src='"+urlIndepth+"images/respuestas/3.png'>");
totalfb = "villamelon"
} else if (aciertos > 3 && aciertos <= 6) {
$("#indepth_resultados").css({
"visibility": "visible",
"position":"fixed",
"top": 0,
"left": -ventana_ancho
});
$(".inner").append("<img src='"+urlIndepth+"images/respuestas/2.png'>");
totalfb = "sinpalabras";
} else if (aciertos > 6 && aciertos <= 9) {
$("#indepth_resultados").css({
"visibility": "visible",
"position":"fixed",
"top": 0,
"left": -ventana_ancho
});
$(".inner").append("<img src='"+urlIndepth+"images/respuestas/1.png'>");
totalfb = "maso";
} else if (aciertos > 9) {
$("#indepth_resultados").css({
"visibility": "visible",
"position":"fixed",
"top": 0,
"left": -ventana_ancho
});
$(".inner").append("<img src='"+urlIndepth+"images/respuestas/0.png'>");
totalfb = "champion";
}
$("#txt-result").text("Tuviste " + aciertos + " aciertos de 12 posibles");
$("#indepth_resultados").animate({
"left": 0
},2000, function(){
$("html, body, #indepth_page1").css("overflow","hidden");
});
$("#indepth_twittear").click(function(){
var text = "";
if (totalfb == "villamelon") {
text = encodeURIComponent("Villamelón le dicen");
} else if (totalfb == "sinpalabras") {
text = encodeURIComponent("Sin palabras");
} else if (totalfb == "maso") {
text = encodeURIComponent("Ahí la llevas");
} else if (totalfb == "champion") {
text = encodeURIComponent("La Champions eres tú");
}
var url = encodeURIComponent("http://juanfutbol.com/indepth/para-verdaderos-conocedores-de-la-champions");
window.open("https://twitter.com/share?text="+text+"&hashtags=JFQuizz&url="+url+"?m="+totalfb,"","width=500, height=300");
});
$("#indepth_facebook").click(function(){
var url = encodeURIComponent("http://juanfutbol.com/indepth/para-verdaderos-conocedores-de-la-champions?m="+totalfb);
window.open("https://www.facebook.com/sharer/sharer.php?u="+url,"","width=500, height=300");
});
$("#indepth_whatsapp").click(function(){
var text = "";
if (totalfb == "villamelon") {
text = encodeURIComponent("Villamelón le dicen");
} else if (totalfb == "sinpalabras") {
text = encodeURIComponent("Sin palabras");
} else if (totalfb == "maso") {
text = encodeURIComponent("Ahí la llevas");
} else if (totalfb == "champion") {
text = encodeURIComponent("La Champions eres tú");
}
var url = encodeURIComponent("http://juanfutbol.com/indepth/para-verdaderos-conocedores-de-la-champions?m="+totalfb);
window.open("whatsapp://send?text="+url+" "+text);
});
}
var indepth_sizeAdjust = function(firstTime){
$(".indepth_page").each(function(){
if($(this).attr("resize") == "true"){
var h = parseInt($(this).width(),10) / $(this).attr("width") * $(this).attr("height");
$(this).css("height", h + "px");
}else if(firstTime && $(this).attr("resize") == "false"){
$(".indepth_background", $(this)).css("min-width", $(this).attr("width") + "px");
$(this).css("height", $(this).attr("height") + "px");
}
})
}
var indepth_preloadImgs = function(){
$("img[over]").each(function(){
$(this).attr("out", $(this).attr("src"));
$(this).on("mouseenter", function(){
$(this).attr("src", $(this).attr("over"));
}).on("mouseleave", function(){
$(this).attr("src", $(this).attr("out"));
}).css("cursor", "pointer");
var tmp = $("<img/>");
tmp.attr("src", $(this).attr("over"));
tmp.css({"position":"absolute", "top":"-9999px", "left":"-9999px"})
tmp.appendTo("body");
});
}
$(document).ready(function(){
indepth_sizeAdjust(true);
indepth_preloadImgs();
ventana_alto = window.innerHeight ? window.innerHeight : $(window).height();
ventana_ancho = $(window).width();
$("#indepth_cover").css({
"width": (ventana_ancho)+"px",
"height": (ventana_alto-100)+"px"
})
$("#indepth_resultados").css({
"width":ventana_ancho+"px",
"height":ventana_alto+"px"
});
});
$(window).on("resize", function(){
ventana_alto = window.innerHeight ? window.innerHeight : $(window).height();
ventana_ancho = $(window).width();
$("#indepth_cover").css({
"width": (ventana_ancho)+"px",
"height": (ventana_alto-100)+"px"
})
$("#indepth_resultados").css({
"width":ventana_ancho+"px",
"height":ventana_alto+"px"
});
});
|
import { GET_PRODUCTS, GET_CATEGORIES } from './actionType'
import callApi from '../utils/callApi'
export function getProductsRequest() {
return (dispatch) => {
callApi('product', 'GET', null).then(res => {
dispatch(getProducts(res.data))
})
}
}
export function getProducts(products) {
return { type: GET_PRODUCTS, products }
}
export function getCategoriesRequest() {
return (dispatch) => {
callApi('category', 'GET', null).then(res => {
dispatch(getCategories(res.data))
})
}
}
export function getCategories(categories) {
return { type: GET_CATEGORIES, categories }
}
|
import React from 'react'
import SocialConatact from '../../common/social_contact/index'
import './about.css'
function About() {
return (
<div className="about">
<div className="about-top">
<div className="about-info">
Hi there <img src={require("../../../images/icons/hand.png").default} className="hand-icon"/>, I am
<br /><span className="info-name">Aparsh Gupta.</span><br />
B.Tech undergraduate @ <strong>IIT Patna</strong>. I am a competitive programmer, web-developer and an active learner.
</div>
<div className="about-image">
<img
src={require("../../../images/crazy_screen.png").default}
className="picture" />
</div>
</div>
<div className="about-social-section">
<SocialConatact/>
</div>
</div>
)
}
export default About
|
// pages/catgroy/catgroy.js
import {
getKindsFoods,
getCatgroys
} from '../../api/api'
import {
picUrl
} from '../../utils/config';
Page({
/**
* 页面的初始数据
*/
data: {
foods: [],
tabs: [],
picUrl,
active_tabs_id: ''
},
_tabHandler(e) {
const classifyId = e.target.dataset.id
this.setData({
active_tabs_id: classifyId
})
this._getClassify(classifyId)
},
_getClassify(classifyId) {
wx.showLoading();
getKindsFoods(classifyId).then(
res => {
console.log(res, 'ressss');
const foods = res.body.classifyGoodsList
this.setData({
foods
})
wx.hideLoading()
}
)
},
_getCatgroys() {
getCatgroys.then(
res => {
console.log(res, 'res');
const tabs = res.body.classifyList
this.setData({
tabs
})
}
)
},
_toDetail(e) {
const {id} = e.currentTarget.dataset
console.log(id,'id');
if (id) {
wx.navigateTo({
url: `/pages/detail/detail?goodsId=${id}`,
success: (result) => {
},
fail: () => {},
complete: () => {}
});
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
const classifyId = options.classifyid
this._getClassify(classifyId)
this._getCatgroys()
this.setData({active_tabs_id:classifyId})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
}) |
import styled from 'styled-components';
export const ListsGridContainerStyle = styled.div`
grid-area: lists-grid;
background: var(--light-color);
color: black;
`;
export const ListsGridStyle = styled.div`
background: var(--secondary-color);
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-rows: auto 1fr;
margin: 0 5rem 2rem 5rem;
padding: 2rem;
width: ${(props) => (props.fullWidth ? '100%' : 'auto')};
min-height: ${(props) => (props.fullWidth ? '80vh' : 'auto')};
a {
grid-column: 1/-1;
justify-self: center;
margin-top: 2rem;
}
@media (max-width: 700px) {
grid-template-columns: 1fr;
margin: 0;
}
`;
export const EmptyListsGridStyle = styled.div`
display: flex;
flex-direction: column;
align-items: center;
margin-top: 3rem;
padding: 0 1rem 1rem 1rem;
text-align: center;
border: 1px solid white;
h1 {
font-size: 2rem;
}
`;
export const ListsGridHeaderStyle = styled.div`
grid-column: 1/-1;
color: var(--primary-color);
h1 {
font-size: 2.5rem;
line-height: 1.2;
margin-top: 1rem;
color: var(--primary-color);
text-align: center;
}
@media (max-width: 700px) {
margin: 0;
}
`;
export const CardsGridStyle = styled.div`
display: grid;
grid-column: 1/-1;
grid-template-columns: 1fr 1fr;
grid-template-rows: auto;
align-items: start;
justify-items: start;
grid-gap: 20px;
margin: 0 0 auto 0;
@media (max-width: 700px) {
grid-template-columns: 1fr;
grid-template-rows: auto;
}
`;
export const ListCardStyles = styled.div`
display: grid;
background: var(--light-color);
border: none;
justify-content: center;
align-items: center;
font-size: 20px;
padding: 1rem;
height: 150px;
width: 100%;
background: #fff;
padding: 2rem;
text-align: center;
opacity: ${(props) => props.notHovered && 0.4};
p {
color: #aaa;
font-size: 0.8rem;
margin-bottom: 0.5rem;
}
`;
|
import React, { Component } from 'react';
import parser from 'html-react-parser';
import SpeakerSection from '../SpeakerSection';
import './index.css';
import back from './back.svg';
import header from './header.svg';
import headerMobile from './header-mobile.svg';
import footer from './footer.svg';
const renderLinkIcon = icon => {
if (!icon) return;
return <img alt="" src={icon} className="SpeakerSections-linkIcon" />;
};
const renderLink = (href, label, icon) => {
if (!href || !label) return;
return (
<a className="SpeakerSections-link" href={href}>
{renderLinkIcon(icon)}
{label}
</a>
);
};
const renderSection = ({ node: { frontmatter, html } }, index) => {
const body = parser(html);
return <SpeakerSection key={index} {...frontmatter} body={body} />;
};
export default class SpeakerSections extends Component {
render() {
return (
<div className="SpeakerSections">
<div className="SpeakerSections-contentWrapper">
<img className="SpeakerSections-header" alt="" src={header} />
<img
alt=""
src={headerMobile}
className="SpeakerSections-header is-mobile"
/>
<nav className="SpeakerSections-navigation">
{renderLink('/#speakers', 'Go back', back)}
</nav>
<div className="SpeakerSections-content">
{this.props.sections.map(renderSection)}
</div>
<nav className="SpeakerSections-footerNavigation ">
{renderLink('/#speakers', 'Go back', back)}
</nav>
</div>
<img className="SpeakerSections-footer" alt="" src={footer} />
</div>
);
}
}
|
'use strict';
import React from 'react';
import {Link} from 'react-router-dom';
import {connect} from 'react-redux';
import * as util from '../../lib/util.js';
import {logout} from '../../action/auth-actions.js';
class Navbar extends React.Component{
constructor(props){
super(props);
this.handleLogout = this.handleLogout.bind(this);
}
handleLogout(){
this.props.logout();
}
render(){
return(
<nav>
{util.renderIf(!this.props.loggedIn,
<ul>
<li>
<Link to='/welcome/signup'>Sign Up</Link>
</li>
<li>
<Link to='/welcome/login'>Login</Link>
</li>
</ul>
)}
{util.renderIf(this.props.loggedIn,
<ul>
<li>
<Link to='/settings'>Settings</Link>
</li>
</ul>
)}
{util.renderIf(this.props.loggedIn,
<button onClick={this.handleLogout}>Logout</button>)}
</nav>
)
}
}
let mapStateToProps = state => ({
loggedIn: !!state.auth,
});
let mapDispatchToProps = dispatch => ({
logout: () => dispatch(logout()),
});
export default connect(mapStateToProps, mapDispatchToProps)(Navbar); |
import React from 'react'
import { useFormik } from 'formik'
import * as Yup from 'yup';
import { useDispatch } from 'react-redux';
import { themNguoiDungAction } from '../../../action/UserAction';
import { history } from '../../../App';
export default function ThemNgDung(props) {
const dispatch = useDispatch();
// su dung thu vien Formik de lay du lieu
const formik = useFormik({
initialValues: { // khai bao cac thuoc tinh input
taiKhoan: '',
matKhau: '',
email: '',
soDt: '',
maNhom: '',
maLoaiNguoiDung: '',
hoTen: ''
},
// su dung thu vien yup de xet validation
validationSchema: Yup.object().shape({
taiKhoan: Yup.string().required('tài khoản không được bỏ trống'),
matKhau: Yup.string().required('mật khẩu không được bỏ trống').min(6, 'mật khẩu tối thiểu 6 kí tự').max(10, 'mật khẩu tối đa 10 kí tự'),
email: Yup.string().email('email không hợp lệ').required('email không được bỏ trống'),
soDt: Yup.string().matches(/^[0-9]+$/, 'số điện thoại phải là số'),
hoTen: Yup.string().required('họ tên không được bỏ trống')
}),
onSubmit: (values) => {
console.log(values)
// dua du lieu len API
dispatch(themNguoiDungAction(values));
}
})
return (
<form className="container" onSubmit={formik.handleSubmit}>
<h3>Thêm Người Dùng</h3>
<div className="row">
<div className="col-6">
<div className="form-group">
<p>Tài khoản</p>
<input name="taiKhoan" className="form-control" onChange={formik.handleChange} onBlur={formik.handleBlur} />
{formik.errors.taiKhoan && formik.touched.taiKhoan && <p className="text text-danger">{formik.errors.taiKhoan}</p>}
</div>
<div className="form-group">
<p>Họ tên</p>
<input name="hoTen" className="form-control" onChange={formik.handleChange} onBlur={formik.handleBlur} />
{formik.errors.hoTen && formik.touched.hoTen && <p className="text text-danger">{formik.errors.hoTen}</p>}
</div>
<div className="form-group">
<p>Mật khẩu</p>
<input name="matKhau" className="form-control" onChange={formik.handleChange} onBlur={formik.handleBlur} />
{formik.errors.matKhau && formik.touched.matKhau && <p className="text text-danger">{formik.errors.matKhau}</p>}
</div>
<div className="form-group">
<p>Email</p>
<input name="email" className="form-control" onChange={formik.handleChange} onBlur={formik.handleBlur} />
{formik.errors.email && formik.touched.email && <p className="text text-danger">{formik.errors.email}</p>}
</div>
</div>
<div className="col-6">
<div className="form-group">
<p>Số điện thoại</p>
<input name="soDt" className="form-control" onChange={formik.handleChange} onBlur={formik.handleBlur} />
{formik.errors.soDt && formik.touched.soDt && <p className="text text-danger">{formik.errors.soDt}</p>}
</div>
<div className="form-group">
<p>Mã nhóm</p>
<select name="maNhom" className="form-control" onChange={formik.handleChange}>
<option >Chọn mã nhóm</option>
<option value="GP02">Group 1</option>
<option value="GP03">Group 2</option>
<option value="GP04">Group 3</option>
</select>
</div>
<div className="form-group">
<p>Mã loại người dùng</p>
<select name="maLoaiNguoiDung" className="form-control" onChange={formik.handleChange}>
<option >Chọn loại người dùng</option>
<option value="QuanTri">Quản Trị</option>
<option value="KhachHang">Khách Hàng</option>
</select>
</div>
</div>
</div>
<div className="form-group d-flex justify-content-center mt-5">
<button type="button" className="btn btn-update btn-primary mr-5" onClick={()=>{
history.goBack();
}}>Trở về</button>
<button type="submit" className="btn btn-update btn-success ml-5">Hoàn tất</button>
</div>
</form>
)
}
|
export default {
type: 'FeatureCollection',
name: 'week_6',
crs: { type: 'name', properties: { name: 'urn:ogc:def:crs:OGC:1.3:CRS84' } },
features: [
{
type: 'Feature',
properties: {
field_1: 0,
trek: 1,
wachtsman: null,
tijd: '07:55',
datum: '4-2-2018',
lat: "51°20'",
long: "02°54'",
snelheid: 4.5,
richting: 'no',
'kracht (Bft)': 3,
'tijd halen': '09:20',
schatting: null,
totaal_kg: 45,
tong: 25,
schol: 15.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.333333333333336,
new_long: 2.9
},
geometry: { type: 'Point', coordinates: [2.9, 51.333333] }
},
{
type: 'Feature',
properties: {
field_1: 1,
trek: 2,
wachtsman: null,
tijd: '09:30',
datum: '4-2-2018',
lat: "51°20'",
long: "02°54'",
snelheid: 4.5,
richting: 'no',
'kracht (Bft)': 4,
'tijd halen': '11:10',
schatting: null,
totaal_kg: 45,
tong: 25,
schol: 15.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.333333333333336,
new_long: 2.9
},
geometry: { type: 'Point', coordinates: [2.9, 51.333333] }
},
{
type: 'Feature',
properties: {
field_1: 2,
trek: 3,
wachtsman: null,
tijd: '11:20',
datum: '4-2-2018',
lat: "51°16'",
long: "02°54'",
snelheid: 4.5,
richting: 'no',
'kracht (Bft)': 4,
'tijd halen': '12:40',
schatting: null,
totaal_kg: 45,
tong: 25,
schol: 15.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.266666666666666,
new_long: 2.9
},
geometry: { type: 'Point', coordinates: [2.9, 51.266667] }
},
{
type: 'Feature',
properties: {
field_1: 3,
trek: 4,
wachtsman: null,
tijd: '12:50',
datum: '4-2-2018',
lat: "51°20'",
long: "02°45'",
snelheid: 4.5,
richting: 'no',
'kracht (Bft)': 4,
'tijd halen': '14:20',
schatting: null,
totaal_kg: 30,
tong: 20,
schol: 5.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.333333333333336,
new_long: 2.75
},
geometry: { type: 'Point', coordinates: [2.75, 51.333333] }
},
{
type: 'Feature',
properties: {
field_1: 4,
trek: 5,
wachtsman: null,
tijd: '14:30',
datum: '4-2-2018',
lat: "51°14'",
long: "02°47'",
snelheid: 4.5,
richting: 'no',
'kracht (Bft)': 5,
'tijd halen': '16:00',
schatting: null,
totaal_kg: 35,
tong: 20,
schol: 10.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.233333333333334,
new_long: 2.7833333333333332
},
geometry: { type: 'Point', coordinates: [2.783333, 51.233333] }
},
{
type: 'Feature',
properties: {
field_1: 5,
trek: 6,
wachtsman: null,
tijd: '16:10',
datum: '4-2-2018',
lat: "51°15'",
long: "02°47'",
snelheid: 4.5,
richting: 'no',
'kracht (Bft)': 5,
'tijd halen': '17:40',
schatting: null,
totaal_kg: 30,
tong: 20,
schol: 5.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.25,
new_long: 2.7833333333333332
},
geometry: { type: 'Point', coordinates: [2.783333, 51.25] }
},
{
type: 'Feature',
properties: {
field_1: 6,
trek: 7,
wachtsman: null,
tijd: '17:45',
datum: '4-2-2018',
lat: "51°16'",
long: "02°55'",
snelheid: 4.5,
richting: 'no',
'kracht (Bft)': 5,
'tijd halen': '19:15',
schatting: null,
totaal_kg: 40,
tong: 25,
schol: 10.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.266666666666666,
new_long: 2.9166666666666665
},
geometry: { type: 'Point', coordinates: [2.916667, 51.266667] }
},
{
type: 'Feature',
properties: {
field_1: 7,
trek: 8,
wachtsman: null,
tijd: '19:25',
datum: '4-2-2018',
lat: "51°21'",
long: "02°54'",
snelheid: 4.5,
richting: 'no',
'kracht (Bft)': 5,
'tijd halen': '20:55',
schatting: null,
totaal_kg: 35,
tong: 20,
schol: 10.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.35,
new_long: 2.9
},
geometry: { type: 'Point', coordinates: [2.9, 51.35] }
},
{
type: 'Feature',
properties: {
field_1: 8,
trek: 9,
wachtsman: null,
tijd: '21:05',
datum: '4-2-2018',
lat: "51°23'",
long: "02°58'",
snelheid: 4.5,
richting: 'no',
'kracht (Bft)': 6,
'tijd halen': '22:35',
schatting: null,
totaal_kg: 30,
tong: 20,
schol: 5.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.383333333333333,
new_long: 2.9666666666666668
},
geometry: { type: 'Point', coordinates: [2.966667, 51.383333] }
},
{
type: 'Feature',
properties: {
field_1: 9,
trek: 10,
wachtsman: null,
tijd: '22:45',
datum: '4-2-2018',
lat: "51°19'",
long: "02°53'",
snelheid: 4.5,
richting: 'no',
'kracht (Bft)': 6,
'tijd halen': '00:15',
schatting: null,
totaal_kg: 25,
tong: 20,
schol: null,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.31666666666667,
new_long: 2.8833333333333333
},
geometry: { type: 'Point', coordinates: [2.883333, 51.316667] }
},
{
type: 'Feature',
properties: {
field_1: 10,
trek: 11,
wachtsman: null,
tijd: '00:25',
datum: '5-2-2018',
lat: "51°21'",
long: "02°54'",
snelheid: 4.5,
richting: 'no',
'kracht (Bft)': 6,
'tijd halen': '01:55',
schatting: null,
totaal_kg: 30,
tong: 20,
schol: 5.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.35,
new_long: 2.9
},
geometry: { type: 'Point', coordinates: [2.9, 51.35] }
},
{
type: 'Feature',
properties: {
field_1: 11,
trek: 12,
wachtsman: null,
tijd: '02:10',
datum: '5-2-2018',
lat: "51°20'",
long: "02°54'",
snelheid: 4.5,
richting: 'no',
'kracht (Bft)': 7,
'tijd halen': '03:40',
schatting: null,
totaal_kg: 20,
tong: 5,
schol: 5.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.333333333333336,
new_long: 2.9
},
geometry: { type: 'Point', coordinates: [2.9, 51.333333] }
},
{
type: 'Feature',
properties: {
field_1: 12,
trek: 13,
wachtsman: null,
tijd: '03:50',
datum: '5-2-2018',
lat: "51°25'",
long: "02°58'",
snelheid: 4.5,
richting: 'no',
'kracht (Bft)': 7,
'tijd halen': '04:10',
schatting: null,
totaal_kg: 25,
tong: 15,
schol: null,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.416666666666664,
new_long: 2.9666666666666668
},
geometry: { type: 'Point', coordinates: [2.966667, 51.416667] }
},
{
type: 'Feature',
properties: {
field_1: 13,
trek: 14,
wachtsman: null,
tijd: '04:50',
datum: '5-2-2018',
lat: "51°27'",
long: "03°01'",
snelheid: 4.5,
richting: 'no',
'kracht (Bft)': 7,
'tijd halen': '06:10',
schatting: null,
totaal_kg: 20,
tong: 10,
schol: 5.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.45,
new_long: 3.0166666666666666
},
geometry: { type: 'Point', coordinates: [3.016667, 51.45] }
},
{
type: 'Feature',
properties: {
field_1: 14,
trek: 15,
wachtsman: null,
tijd: '06:20',
datum: '5-2-2018',
lat: "51°30'",
long: "03°09'",
snelheid: 4.5,
richting: 'no',
'kracht (Bft)': 6,
'tijd halen': '07:00',
schatting: null,
totaal_kg: 25,
tong: 20,
schol: null,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.5,
new_long: 3.15
},
geometry: { type: 'Point', coordinates: [3.15, 51.5] }
},
{
type: 'Feature',
properties: {
field_1: 15,
trek: 16,
wachtsman: null,
tijd: '07:10',
datum: '5-2-2018',
lat: "51°32'",
long: "03°13'",
snelheid: 4.5,
richting: 'no',
'kracht (Bft)': 6,
'tijd halen': '08:30',
schatting: null,
totaal_kg: 35,
tong: 25,
schol: 5.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.533333333333331,
new_long: 3.2166666666666668
},
geometry: { type: 'Point', coordinates: [3.216667, 51.533333] }
},
{
type: 'Feature',
properties: {
field_1: 16,
trek: 17,
wachtsman: null,
tijd: '09:20',
datum: '5-2-2018',
lat: "51°35'",
long: "03°17'",
snelheid: 4.5,
richting: 'no',
'kracht (Bft)': 6,
'tijd halen': '10:50',
schatting: null,
totaal_kg: 40,
tong: 25,
schol: null,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.583333333333336,
new_long: 3.2833333333333332
},
geometry: { type: 'Point', coordinates: [3.283333, 51.583333] }
},
{
type: 'Feature',
properties: {
field_1: 17,
trek: 18,
wachtsman: null,
tijd: '11:00',
datum: '5-2-2018',
lat: "51°30'",
long: "03°08'",
snelheid: 4.5,
richting: 'no',
'kracht (Bft)': 6,
'tijd halen': '12:30',
schatting: null,
totaal_kg: 30,
tong: 25,
schol: null,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.5,
new_long: 3.1333333333333333
},
geometry: { type: 'Point', coordinates: [3.133333, 51.5] }
},
{
type: 'Feature',
properties: {
field_1: 18,
trek: 19,
wachtsman: null,
tijd: '13:00',
datum: '5-2-2018',
lat: "51°25'",
long: "02°58'",
snelheid: 4.5,
richting: 'o',
'kracht (Bft)': 5,
'tijd halen': '14:30',
schatting: null,
totaal_kg: 40,
tong: 25,
schol: 10.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.416666666666664,
new_long: 2.9666666666666668
},
geometry: { type: 'Point', coordinates: [2.966667, 51.416667] }
},
{
type: 'Feature',
properties: {
field_1: 19,
trek: 20,
wachtsman: null,
tijd: '14:35',
datum: '5-2-2018',
lat: "51°19'",
long: "02°47'",
snelheid: 4.5,
richting: 'o',
'kracht (Bft)': 5,
'tijd halen': '16:05',
schatting: null,
totaal_kg: 25,
tong: 20,
schol: null,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.31666666666667,
new_long: 2.7833333333333332
},
geometry: { type: 'Point', coordinates: [2.783333, 51.316667] }
},
{
type: 'Feature',
properties: {
field_1: 20,
trek: 21,
wachtsman: null,
tijd: '16:15',
datum: '5-2-2018',
lat: "51°18'",
long: "02°47'",
snelheid: 4.5,
richting: 'o',
'kracht (Bft)': 5,
'tijd halen': '17:45',
schatting: null,
totaal_kg: 30,
tong: 15,
schol: 10.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.3,
new_long: 2.7833333333333332
},
geometry: { type: 'Point', coordinates: [2.783333, 51.3] }
},
{
type: 'Feature',
properties: {
field_1: 21,
trek: 22,
wachtsman: null,
tijd: '18:00',
datum: '5-2-2018',
lat: "51°19'",
long: "02°47'",
snelheid: 4.5,
richting: 'o',
'kracht (Bft)': 6,
'tijd halen': '19:30',
schatting: null,
totaal_kg: 40,
tong: 25,
schol: 10.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.31666666666667,
new_long: 2.7833333333333332
},
geometry: { type: 'Point', coordinates: [2.783333, 51.316667] }
},
{
type: 'Feature',
properties: {
field_1: 22,
trek: 23,
wachtsman: null,
tijd: '19:40',
datum: '5-2-2018',
lat: "51°19'",
long: "02°47'",
snelheid: 4.5,
richting: 'o',
'kracht (Bft)': 6,
'tijd halen': '21:00',
schatting: null,
totaal_kg: 40,
tong: 25,
schol: 10.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.31666666666667,
new_long: 2.7833333333333332
},
geometry: { type: 'Point', coordinates: [2.783333, 51.316667] }
},
{
type: 'Feature',
properties: {
field_1: 23,
trek: 24,
wachtsman: null,
tijd: '21:10',
datum: '5-2-2018',
lat: "51°21'",
long: "02°55'",
snelheid: 4.5,
richting: 'no',
'kracht (Bft)': 7,
'tijd halen': '22:35',
schatting: null,
totaal_kg: 25,
tong: 15,
schol: null,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.35,
new_long: 2.9166666666666665
},
geometry: { type: 'Point', coordinates: [2.916667, 51.35] }
},
{
type: 'Feature',
properties: {
field_1: 24,
trek: 25,
wachtsman: null,
tijd: '22:45',
datum: '5-2-2018',
lat: "51°21'",
long: "02°47'",
snelheid: 4.5,
richting: 'no',
'kracht (Bft)': 7,
'tijd halen': '00:15',
schatting: null,
totaal_kg: 25,
tong: 20,
schol: null,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.35,
new_long: 2.7833333333333332
},
geometry: { type: 'Point', coordinates: [2.783333, 51.35] }
},
{
type: 'Feature',
properties: {
field_1: 25,
trek: 26,
wachtsman: null,
tijd: '00:25',
datum: '6-2-2018',
lat: "51°19'",
long: "02°50'",
snelheid: 4.5,
richting: 'no',
'kracht (Bft)': 7,
'tijd halen': '02:00',
schatting: null,
totaal_kg: 30,
tong: 20,
schol: 5.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.31666666666667,
new_long: 2.8333333333333335
},
geometry: { type: 'Point', coordinates: [2.833333, 51.316667] }
},
{
type: 'Feature',
properties: {
field_1: 26,
trek: 27,
wachtsman: null,
tijd: '02:05',
datum: '6-2-2018',
lat: "51°20'",
long: "02°52'",
snelheid: 4.5,
richting: 'no',
'kracht (Bft)': 5,
'tijd halen': '03:30',
schatting: null,
totaal_kg: 40,
tong: 25,
schol: null,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.333333333333336,
new_long: 2.8666666666666667
},
geometry: { type: 'Point', coordinates: [2.866667, 51.333333] }
},
{
type: 'Feature',
properties: {
field_1: 27,
trek: 28,
wachtsman: null,
tijd: '03:35',
datum: '6-2-2018',
lat: "51°16'",
long: "02°43'",
snelheid: 4.5,
richting: 'no',
'kracht (Bft)': 5,
'tijd halen': '05:05',
schatting: null,
totaal_kg: 25,
tong: 10,
schol: 5.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.266666666666666,
new_long: 2.7166666666666668
},
geometry: { type: 'Point', coordinates: [2.716667, 51.266667] }
},
{
type: 'Feature',
properties: {
field_1: 28,
trek: 29,
wachtsman: null,
tijd: '05:15',
datum: '6-2-2018',
lat: "51°19'",
long: "02°50'",
snelheid: 4.5,
richting: 'no',
'kracht (Bft)': 5,
'tijd halen': '06:40',
schatting: null,
totaal_kg: 35,
tong: 20,
schol: 10.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: 60.0,
schar: 60.0,
new_lat: 51.31666666666667,
new_long: 2.8333333333333335
},
geometry: { type: 'Point', coordinates: [2.833333, 51.316667] }
},
{
type: 'Feature',
properties: {
field_1: 29,
trek: 30,
wachtsman: null,
tijd: '06:50',
datum: '6-2-2018',
lat: "51°15'",
long: "02°43'",
snelheid: 4.5,
richting: 'no',
'kracht (Bft)': 5,
'tijd halen': '08:10',
schatting: null,
totaal_kg: 35,
tong: 30,
schol: null,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.25,
new_long: 2.7166666666666668
},
geometry: { type: 'Point', coordinates: [2.716667, 51.25] }
},
{
type: 'Feature',
properties: {
field_1: 30,
trek: 31,
wachtsman: null,
tijd: '08:20',
datum: '6-2-2018',
lat: "51°19'",
long: "02°50'",
snelheid: 4.5,
richting: 'ono',
'kracht (Bft)': 5,
'tijd halen': '09:50',
schatting: null,
totaal_kg: 40,
tong: 25,
schol: 5.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.31666666666667,
new_long: 2.8333333333333335
},
geometry: { type: 'Point', coordinates: [2.833333, 51.316667] }
},
{
type: 'Feature',
properties: {
field_1: 31,
trek: 32,
wachtsman: null,
tijd: '10:00',
datum: '6-2-2018',
lat: "51°17'",
long: "02°44'",
snelheid: 4.5,
richting: 'ono',
'kracht (Bft)': 4,
'tijd halen': '11:35',
schatting: null,
totaal_kg: 35,
tong: 20,
schol: 10.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.283333333333331,
new_long: 2.7333333333333334
},
geometry: { type: 'Point', coordinates: [2.733333, 51.283333] }
},
{
type: 'Feature',
properties: {
field_1: 32,
trek: 33,
wachtsman: null,
tijd: '11:45',
datum: '6-2-2018',
lat: "51°18'",
long: "02°43'",
snelheid: 4.5,
richting: 'ono',
'kracht (Bft)': 4,
'tijd halen': '13:15',
schatting: null,
totaal_kg: 35,
tong: 20,
schol: 10.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.3,
new_long: 2.7166666666666668
},
geometry: { type: 'Point', coordinates: [2.716667, 51.3] }
},
{
type: 'Feature',
properties: {
field_1: 33,
trek: 34,
wachtsman: null,
tijd: '13:30',
datum: '6-2-2018',
lat: "51°19'",
long: "02°50'",
snelheid: 4.5,
richting: 'ono',
'kracht (Bft)': 4,
'tijd halen': '14:35',
schatting: null,
totaal_kg: 25,
tong: 20,
schol: null,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.31666666666667,
new_long: 2.8333333333333335
},
geometry: { type: 'Point', coordinates: [2.833333, 51.316667] }
},
{
type: 'Feature',
properties: {
field_1: 34,
trek: 35,
wachtsman: null,
tijd: '14:45',
datum: '6-2-2018',
lat: "51°16'",
long: "02°44'",
snelheid: 4.5,
richting: 'ono',
'kracht (Bft)': 4,
'tijd halen': '16:30',
schatting: null,
totaal_kg: 30,
tong: 15,
schol: 10.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.266666666666666,
new_long: 2.7333333333333334
},
geometry: { type: 'Point', coordinates: [2.733333, 51.266667] }
},
{
type: 'Feature',
properties: {
field_1: 35,
trek: 36,
wachtsman: null,
tijd: '16:40',
datum: '6-2-2018',
lat: "51°18'",
long: "02°47'",
snelheid: 4.5,
richting: 'ono',
'kracht (Bft)': 4,
'tijd halen': '17:40',
schatting: null,
totaal_kg: 35,
tong: 25,
schol: null,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.3,
new_long: 2.7833333333333332
},
geometry: { type: 'Point', coordinates: [2.783333, 51.3] }
},
{
type: 'Feature',
properties: {
field_1: 36,
trek: 37,
wachtsman: null,
tijd: '17:50',
datum: '6-2-2018',
lat: "51°18'",
long: "02°45'",
snelheid: 4.5,
richting: 'ono',
'kracht (Bft)': 4,
'tijd halen': '19:20',
schatting: null,
totaal_kg: 30,
tong: 15,
schol: 10.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.3,
new_long: 2.75
},
geometry: { type: 'Point', coordinates: [2.75, 51.3] }
},
{
type: 'Feature',
properties: {
field_1: 37,
trek: 38,
wachtsman: null,
tijd: '19:30',
datum: '6-2-2018',
lat: "51°23'",
long: "02°54'",
snelheid: 4.5,
richting: 'ono',
'kracht (Bft)': 4,
'tijd halen': '20:45',
schatting: null,
totaal_kg: 30,
tong: 20,
schol: null,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.383333333333333,
new_long: 2.9
},
geometry: { type: 'Point', coordinates: [2.9, 51.383333] }
},
{
type: 'Feature',
properties: {
field_1: 38,
trek: 39,
wachtsman: null,
tijd: '20:55',
datum: '6-2-2018',
lat: "51°27'",
long: "03°01'",
snelheid: 4.5,
richting: 'ono',
'kracht (Bft)': 4,
'tijd halen': '22:15',
schatting: null,
totaal_kg: 35,
tong: 20,
schol: 10.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.45,
new_long: 3.0166666666666666
},
geometry: { type: 'Point', coordinates: [3.016667, 51.45] }
},
{
type: 'Feature',
properties: {
field_1: 39,
trek: 40,
wachtsman: null,
tijd: '22:25',
datum: '6-2-2018',
lat: "51°28'",
long: "03°00'",
snelheid: 4.5,
richting: 'ono',
'kracht (Bft)': 4,
'tijd halen': '00:05',
schatting: null,
totaal_kg: 25,
tong: 15,
schol: null,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.466666666666669,
new_long: 3.0
},
geometry: { type: 'Point', coordinates: [3.0, 51.466667] }
},
{
type: 'Feature',
properties: {
field_1: 40,
trek: 41,
wachtsman: null,
tijd: '00:10',
datum: '7-2-2018',
lat: "51°23'",
long: "03°00'",
snelheid: 4.5,
richting: 'ono',
'kracht (Bft)': 4,
'tijd halen': '01:40',
schatting: null,
totaal_kg: 30,
tong: 15,
schol: 10.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.383333333333333,
new_long: 3.0
},
geometry: { type: 'Point', coordinates: [3.0, 51.383333] }
},
{
type: 'Feature',
properties: {
field_1: 41,
trek: 42,
wachtsman: null,
tijd: '01:50',
datum: '7-2-2018',
lat: "51°20'",
long: "02°50'",
snelheid: 4.5,
richting: 'ono',
'kracht (Bft)': 4,
'tijd halen': '03:20',
schatting: null,
totaal_kg: 25,
tong: 15,
schol: null,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.333333333333336,
new_long: 2.8333333333333335
},
geometry: { type: 'Point', coordinates: [2.833333, 51.333333] }
},
{
type: 'Feature',
properties: {
field_1: 42,
trek: 43,
wachtsman: null,
tijd: '03:30',
datum: '7-2-2018',
lat: "51°18'",
long: "02°45'",
snelheid: 4.5,
richting: 'ono',
'kracht (Bft)': 4,
'tijd halen': '04:55',
schatting: null,
totaal_kg: 35,
tong: 15,
schol: 10.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.3,
new_long: 2.75
},
geometry: { type: 'Point', coordinates: [2.75, 51.3] }
},
{
type: 'Feature',
properties: {
field_1: 43,
trek: 44,
wachtsman: null,
tijd: '05:05',
datum: '7-2-2018',
lat: "51°20'",
long: "02°47'",
snelheid: 4.5,
richting: 'ono',
'kracht (Bft)': 4,
'tijd halen': '06:15',
schatting: null,
totaal_kg: 35,
tong: 25,
schol: null,
kabeljauw: null,
tarbot: 20.0,
griet: null,
rog: 20.0,
opmerkingen: null,
bot: 60.0,
schar: 60.0,
new_lat: 51.333333333333336,
new_long: 2.7833333333333332
},
geometry: { type: 'Point', coordinates: [2.783333, 51.333333] }
},
{
type: 'Feature',
properties: {
field_1: 44,
trek: 45,
wachtsman: null,
tijd: '06:25',
datum: '7-2-2018',
lat: "51°20'",
long: "02°48'",
snelheid: 4.5,
richting: 'ono',
'kracht (Bft)': 4,
'tijd halen': '07:30',
schatting: null,
totaal_kg: 35,
tong: 20,
schol: 10.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.333333333333336,
new_long: 2.8
},
geometry: { type: 'Point', coordinates: [2.8, 51.333333] }
},
{
type: 'Feature',
properties: {
field_1: 45,
trek: 46,
wachtsman: null,
tijd: '07:45',
datum: '7-2-2018',
lat: "51°21'",
long: "02°49'",
snelheid: 4.5,
richting: 'ono',
'kracht (Bft)': 4,
'tijd halen': '08:45',
schatting: null,
totaal_kg: 35,
tong: 20,
schol: null,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.35,
new_long: 2.8166666666666664
},
geometry: { type: 'Point', coordinates: [2.816667, 51.35] }
},
{
type: 'Feature',
properties: {
field_1: 46,
trek: 47,
wachtsman: null,
tijd: '08:55',
datum: '7-2-2018',
lat: "51°21'",
long: "02°51'",
snelheid: 4.5,
richting: 'ono',
'kracht (Bft)': 4,
'tijd halen': '10:05',
schatting: null,
totaal_kg: 35,
tong: 20,
schol: 10.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.35,
new_long: 2.85
},
geometry: { type: 'Point', coordinates: [2.85, 51.35] }
},
{
type: 'Feature',
properties: {
field_1: 47,
trek: 48,
wachtsman: null,
tijd: '10:15',
datum: '7-2-2018',
lat: "51°21'",
long: "02°51'",
snelheid: 4.5,
richting: 'ono',
'kracht (Bft)': 4,
'tijd halen': '11:30',
schatting: null,
totaal_kg: 35,
tong: 25,
schol: null,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.35,
new_long: 2.85
},
geometry: { type: 'Point', coordinates: [2.85, 51.35] }
},
{
type: 'Feature',
properties: {
field_1: 48,
trek: 49,
wachtsman: null,
tijd: '11:45',
datum: '7-2-2018',
lat: "51°21'",
long: "02°51'",
snelheid: 4.5,
richting: 'ono',
'kracht (Bft)': 4,
'tijd halen': '12:45',
schatting: null,
totaal_kg: 40,
tong: 20,
schol: 10.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.35,
new_long: 2.85
},
geometry: { type: 'Point', coordinates: [2.85, 51.35] }
},
{
type: 'Feature',
properties: {
field_1: 49,
trek: 50,
wachtsman: null,
tijd: '14:50',
datum: '7-2-2018',
lat: "51°22'",
long: "02°51'",
snelheid: 4.5,
richting: 'ono',
'kracht (Bft)': 4,
'tijd halen': '16:15',
schatting: null,
totaal_kg: 25,
tong: 20,
schol: null,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.366666666666667,
new_long: 2.85
},
geometry: { type: 'Point', coordinates: [2.85, 51.366667] }
},
{
type: 'Feature',
properties: {
field_1: 50,
trek: 51,
wachtsman: null,
tijd: '16:25',
datum: '7-2-2018',
lat: "51°21'",
long: "02°50'",
snelheid: 4.5,
richting: 'ono',
'kracht (Bft)': 4,
'tijd halen': '18:00',
schatting: null,
totaal_kg: 15,
tong: 2,
schol: 10.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.35,
new_long: 2.8333333333333335
},
geometry: { type: 'Point', coordinates: [2.833333, 51.35] }
},
{
type: 'Feature',
properties: {
field_1: 51,
trek: 52,
wachtsman: null,
tijd: '19:30',
datum: '7-2-2018',
lat: "51°22'",
long: "02°50'",
snelheid: 4.5,
richting: 'ono',
'kracht (Bft)': 4,
'tijd halen': '20:35',
schatting: null,
totaal_kg: 30,
tong: 25,
schol: null,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.366666666666667,
new_long: 2.8333333333333335
},
geometry: { type: 'Point', coordinates: [2.833333, 51.366667] }
},
{
type: 'Feature',
properties: {
field_1: 52,
trek: 53,
wachtsman: null,
tijd: '20:45',
datum: '7-2-2018',
lat: "51°22'",
long: "02°50'",
snelheid: 4.5,
richting: 'zw',
'kracht (Bft)': 4,
'tijd halen': '22:00',
schatting: null,
totaal_kg: 55,
tong: 20,
schol: 30.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.366666666666667,
new_long: 2.8333333333333335
},
geometry: { type: 'Point', coordinates: [2.833333, 51.366667] }
},
{
type: 'Feature',
properties: {
field_1: 53,
trek: 54,
wachtsman: null,
tijd: '22:10',
datum: '7-2-2018',
lat: "51°22'",
long: "02°50'",
snelheid: 4.5,
richting: 'zw',
'kracht (Bft)': 4,
'tijd halen': '23:10',
schatting: null,
totaal_kg: 20,
tong: 15,
schol: null,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.366666666666667,
new_long: 2.8333333333333335
},
geometry: { type: 'Point', coordinates: [2.833333, 51.366667] }
},
{
type: 'Feature',
properties: {
field_1: 54,
trek: 55,
wachtsman: null,
tijd: '23:20',
datum: '7-2-2018',
lat: "51°22'",
long: "02°53'",
snelheid: 4.5,
richting: 'zw',
'kracht (Bft)': 3,
'tijd halen': '00:30',
schatting: null,
totaal_kg: 40,
tong: 10,
schol: 20.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.366666666666667,
new_long: 2.8833333333333333
},
geometry: { type: 'Point', coordinates: [2.883333, 51.366667] }
},
{
type: 'Feature',
properties: {
field_1: 55,
trek: 56,
wachtsman: null,
tijd: '00:35',
datum: '8-2-2018',
lat: "51°18'",
long: "02°51'",
snelheid: 4.5,
richting: 'zw',
'kracht (Bft)': 3,
'tijd halen': '02:05',
schatting: null,
totaal_kg: 25,
tong: 15,
schol: null,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.3,
new_long: 2.85
},
geometry: { type: 'Point', coordinates: [2.85, 51.3] }
},
{
type: 'Feature',
properties: {
field_1: 56,
trek: 57,
wachtsman: null,
tijd: '02:15',
datum: '8-2-2018',
lat: "51°19'",
long: "02°46'",
snelheid: 4.5,
richting: 'zw',
'kracht (Bft)': 3,
'tijd halen': '02:30',
schatting: null,
totaal_kg: 25,
tong: 10,
schol: 10.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.31666666666667,
new_long: 2.7666666666666666
},
geometry: { type: 'Point', coordinates: [2.766667, 51.316667] }
},
{
type: 'Feature',
properties: {
field_1: 57,
trek: 58,
wachtsman: null,
tijd: '04:00',
datum: '8-2-2018',
lat: "51°20'",
long: "02°47'",
snelheid: 4.5,
richting: 'zw',
'kracht (Bft)': 3,
'tijd halen': '05:15',
schatting: null,
totaal_kg: 15,
tong: 10,
schol: null,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.333333333333336,
new_long: 2.7833333333333332
},
geometry: { type: 'Point', coordinates: [2.783333, 51.333333] }
},
{
type: 'Feature',
properties: {
field_1: 58,
trek: 59,
wachtsman: null,
tijd: '05:20',
datum: '8-2-2018',
lat: "51°20'",
long: "02°48'",
snelheid: 4.5,
richting: 'zw',
'kracht (Bft)': 3,
'tijd halen': '06:35',
schatting: null,
totaal_kg: 15,
tong: 10,
schol: null,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.333333333333336,
new_long: 2.8
},
geometry: { type: 'Point', coordinates: [2.8, 51.333333] }
},
{
type: 'Feature',
properties: {
field_1: 59,
trek: 60,
wachtsman: null,
tijd: '06:45',
datum: '8-2-2018',
lat: "51°22'",
long: "02°47'",
snelheid: 4.5,
richting: 'zw',
'kracht (Bft)': 3,
'tijd halen': '08:00',
schatting: null,
totaal_kg: 25,
tong: 15,
schol: 5.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.366666666666667,
new_long: 2.7833333333333332
},
geometry: { type: 'Point', coordinates: [2.783333, 51.366667] }
},
{
type: 'Feature',
properties: {
field_1: 60,
trek: 61,
wachtsman: null,
tijd: '08:10',
datum: '8-2-2018',
lat: "51°27'",
long: "02°54'",
snelheid: 4.5,
richting: 'zw',
'kracht (Bft)': 3,
'tijd halen': '09:00',
schatting: null,
totaal_kg: 15,
tong: 10,
schol: null,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.45,
new_long: 2.9
},
geometry: { type: 'Point', coordinates: [2.9, 51.45] }
},
{
type: 'Feature',
properties: {
field_1: 61,
trek: 62,
wachtsman: null,
tijd: '09:15',
datum: '8-2-2018',
lat: "51°29'",
long: "02°59'",
snelheid: 4.5,
richting: 'zw',
'kracht (Bft)': 3,
'tijd halen': '10:25',
schatting: null,
totaal_kg: 20,
tong: 10,
schol: 5.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.483333333333334,
new_long: 2.9833333333333334
},
geometry: { type: 'Point', coordinates: [2.983333, 51.483333] }
},
{
type: 'Feature',
properties: {
field_1: 62,
trek: 63,
wachtsman: null,
tijd: '10:30',
datum: '8-2-2018',
lat: "51°28'",
long: "03°08'",
snelheid: 4.5,
richting: 'zw',
'kracht (Bft)': 3,
'tijd halen': '11:45',
schatting: null,
totaal_kg: 35,
tong: 15,
schol: null,
kabeljauw: null,
tarbot: null,
griet: 20.0,
rog: null,
opmerkingen: null,
bot: 50.0,
schar: 80.0,
new_lat: 51.466666666666669,
new_long: 3.1333333333333333
},
geometry: { type: 'Point', coordinates: [3.133333, 51.466667] }
},
{
type: 'Feature',
properties: {
field_1: 63,
trek: 64,
wachtsman: null,
tijd: '11:55',
datum: '8-2-2018',
lat: "51°33'",
long: "03°05'",
snelheid: 4.5,
richting: 'zw',
'kracht (Bft)': 3,
'tijd halen': '13:10',
schatting: null,
totaal_kg: 30,
tong: 15,
schol: null,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.55,
new_long: 3.0833333333333335
},
geometry: { type: 'Point', coordinates: [3.083333, 51.55] }
},
{
type: 'Feature',
properties: {
field_1: 64,
trek: 65,
wachtsman: null,
tijd: '13:20',
datum: '8-2-2018',
lat: "51°34'",
long: "03°15'",
snelheid: 4.5,
richting: 'zw',
'kracht (Bft)': 3,
'tijd halen': '14:40',
schatting: null,
totaal_kg: 25,
tong: 15,
schol: null,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.56666666666667,
new_long: 3.25
},
geometry: { type: 'Point', coordinates: [3.25, 51.566667] }
},
{
type: 'Feature',
properties: {
field_1: 65,
trek: 66,
wachtsman: null,
tijd: '14:50',
datum: '8-2-2018',
lat: "51°35'",
long: "03°17'",
snelheid: 4.5,
richting: 'zw',
'kracht (Bft)': 3,
'tijd halen': '16:05',
schatting: null,
totaal_kg: 30,
tong: 20,
schol: 5.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.583333333333336,
new_long: 3.2833333333333332
},
geometry: { type: 'Point', coordinates: [3.283333, 51.583333] }
},
{
type: 'Feature',
properties: {
field_1: 66,
trek: 67,
wachtsman: null,
tijd: '16:15',
datum: '8-2-2018',
lat: "51°34'",
long: "03°18'",
snelheid: 4.5,
richting: 'zw',
'kracht (Bft)': 3,
'tijd halen': '17:00',
schatting: null,
totaal_kg: 30,
tong: 20,
schol: 5.0,
kabeljauw: null,
tarbot: null,
griet: null,
rog: null,
opmerkingen: null,
bot: null,
schar: null,
new_lat: 51.56666666666667,
new_long: 3.3
},
geometry: { type: 'Point', coordinates: [3.3, 51.566667] }
}
]
}
|
const buttonsContainer = document.querySelector('.buttons-container');
const symbolsContainer = document.querySelector('.symbols-container');
let outputDisplay = document.getElementById('output-display');
let history = '';
let resetOutput = false;
buttonsContainer.addEventListener('click', function(event) {
if (resetOutput === true) {
outputDisplay.value = '';
resetOutput = false;
}
outputDisplay.value += event.target.innerHTML;
});
symbolsContainer.addEventListener('click', function(event) {
let symbol = event.target.innerHTML;
if (symbol !== '=') {
addToHistory(outputDisplay.value, symbol);
resetOutput = true;
} else if (symbol === '=') {
symbol = '';
addToHistory(outputDisplay.value, symbol);
outputDisplay.value = evaluate();
history = '';
}
});
function addToHistory(output, symbol) {
history += output + symbol;
}
function evaluate() {
let test = eval(history).toString();
return test;
}
// let i = 1;
// let j = 2;
// let k = 3;
// let plus = '+';
// let history = '0';
// function addToHistory(output, symbol) {
// history += plus + output;
// }
// function evaluate() {
// console.log(eval(history));
// }
// addToHistory(i, plus);
// addToHistory(j, plus);
// addToHistory(k, plus);
// evaluate();
|
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
//TODO: Belki de her istekte hem dev hem de production ortamını yüklemek en iyi
//yol değildir?
var config = [];
config['development'] = {
MONGO_URL : 'mongodb://localhost/twitter',
SECRET_KEY : 'über-secret-key',
DEBUG : true
}
config['production'] = {
DEBUG : false
}
module.exports = config[process.env.NODE_ENV];
|
class AnalogClock {
constructor(date) {
this.setAnalogTime(date);
}
refresh() {
this.setAnalogTime(new Date);
}
setAnalogTime(date) {
this.hour = date.getHours() % 12;
this.minute = date.getMinutes();
this.second = date.getSeconds();
}
degHour(){
return parseFloat((this.hour / 12) * 360);
}
degMinute(){
return parseFloat((this.minute / 60) * 360);
}
degSecond(){
return parseFloat((this.second / 60) * 360);
}
}
class Adjustor {
static OFFSET_DEG() {return 90.0;}
static adjust(clock, hourHand, minHand, secondHand) {
hourHand.style.transform = `rotate(${clock.degHour() + this.OFFSET_DEG()}deg)`;
minHand.style.transform = `rotate(${clock.degMinute() + this.OFFSET_DEG()}deg)`;
secondHand.style.transform = `rotate(${clock.degSecond() + this.OFFSET_DEG()}deg)`;
}
}
window.onload = () => {
const hourHand = document.querySelector('.hour-hand');
const minHand = document.querySelector('.min-hand');
const secondHand = document.querySelector('.second-hand');
const clock = new AnalogClock(new Date);
Adjustor.adjust(clock, hourHand, minHand, secondHand);
setInterval(() => {
clock.refresh();
Adjustor.adjust(clock, hourHand, minHand, secondHand);
}, 1000);
}; |
'use strict'
// let age = parseInt(prompt("Enter your age:"));
// alert(`You are ${age} year old.`);
// console.log(typeof(age));
// if (age >= 10){
// alert("You are able");
// }else{
// alert("You are not able for this.");
// }
// let WinningNumber = 8;
// let Numbers = parseInt(prompt("Enter you Luck number"));
// if(Numbers > WinningNumber)
// {
// alert("Too Big number enter");
// }
// else if(Numbers < WinningNumber)
// {
// alert("Too samll number enter ");
// }
// else
// {
// alert("WoW! You Enter right number");
// }
|
/*jslint browser: true, undef: true, white: false, laxbreak: true *//*global Ext, MyRetirement, MyRetirementRemote*/
Ext.define('MyRetirement.model.income.RetirementAverage', {
extend: 'Ext.data.Model'
,requires: [
'MyRetirement.proxy.Direct'
]
,proxy: {
type: 'apidirect'
,api: {
read: 'MyRetirementRemote.incomeService.calcMonthlyIncomeDuringRetirement'
}
}
,fields: [
// client
{name: 'otherIncomeAvgMonthlyAmount' ,type: 'integer'}
,{name: 'pensionAvgMonthlyAmount' ,type: 'integer'}
,{name: 'socialSecurityAvgMonthlyAmount' ,type: 'integer'}
,{name: 'totalIncomeSourcesAvgMonthlyAmount' ,type: 'integer'}
,{name: 'monthlyIncomeDuringRetirement'}
]
});
|
const userController = require("./userController");
const productController = require("./productController");
const adminController = require("./__admin/adminController");
const transactionController = require("./transactionController");
const adminProductController = require("./__admin/adminProductController");
const superAdminController = require("./__admin/superAdminController");
const adminWarehouseController = require("./__admin/adminWarehouseController")
module.exports = {
userController,
productController,
adminController,
adminProductController,
transactionController,
superAdminController,
adminWarehouseController
};
|
var VRenderer = 'hoedown';
// Use Marked to highlight code blocks in edit mode.
marked.setOptions({
highlight: function(code, lang) {
if (lang) {
if (lang === 'wavedrom') {
lang = 'json';
}
if (hljs.getLanguage(lang)) {
return hljs.highlight(lang, code, true).value;
} else {
return hljs.highlightAuto(code).value;
}
} else {
return code;
}
}
});
var updateHtml = function(html) {
startFreshRender();
// There is at least one async job for MathJax.
asyncJobsCount = 1;
contentDiv.innerHTML = html;
insertImageCaption();
setupImageView();
var codes = document.getElementsByTagName('code');
mermaidIdx = 0;
flowchartIdx = 0;
wavedromIdx = 0;
plantUMLIdx = 0;
graphvizIdx = 0;
for (var i = 0; i < codes.length; ++i) {
var code = codes[i];
if (code.parentElement.tagName.toLowerCase() == 'pre') {
if (VEnableMermaid && code.classList.contains('language-mermaid')) {
// Mermaid code block.
if (renderMermaidOne(code)) {
// replaceChild() will decrease codes.length.
--i;
continue;
}
} else if (VEnableFlowchart
&& (code.classList.contains('language-flowchart')
|| code.classList.contains('language-flow'))) {
// Flowchart code block.
if (renderFlowchartOne(code)) {
// replaceChild() will decrease codes.length.
--i;
continue;
}
} else if (VEnableWavedrom && code.classList.contains('language-wavedrom')) {
// Wavedrom code block.
if (renderWavedromOne(code)) {
// replaceChild() will decrease codes.length.
--i;
continue;
}
} else if (VEnableMathjax && code.classList.contains('language-mathjax')) {
// Mathjax code block.
continue;
} else if (VPlantUMLMode != 0
&& code.classList.contains('language-puml')) {
// PlantUML code block.
if (VPlantUMLMode == 1) {
if (renderPlantUMLOneOnline(code)) {
// replaceChild() will decrease codes.length.
--i;
}
} else {
renderPlantUMLOneLocal(code);
}
continue;
} else if (VEnableGraphviz
&& code.classList.contains('language-dot')) {
// Graphviz code block.
renderGraphvizOneLocal(code);
continue;
}
if (listContainsRegex(code.classList, /language-.*/)) {
hljs.highlightBlock(code);
}
}
}
addClassToCodeBlock();
addCopyButtonToCodeBlock();
renderCodeBlockLineNumber();
// If you add new logics after handling MathJax, please pay attention to
// finishLoading logic.
// MathJax may be not loaded for now.
if (VEnableMathjax && (typeof MathJax != "undefined")) {
try {
MathJax.Hub.Queue(["resetEquationNumbers",MathJax.InputJax.TeX],
["Typeset", MathJax.Hub, contentDiv, postProcessMathJax]);
} catch (err) {
content.setLog("err: " + err);
finishOneAsyncJob();
}
} else {
finishOneAsyncJob();
}
};
var highlightText = function(text, id, timeStamp) {
var html = marked(text);
content.highlightTextCB(html, id, timeStamp);
}
var textToHtml = function(identifier, id, timeStamp, text, inlineStyle) {
var html = marked(text);
if (inlineStyle) {
var container = textHtmlDiv;
container.innerHTML = html;
html = getHtmlWithInlineStyles(container);
container.innerHTML = "";
}
content.textToHtmlCB(identifier, id, timeStamp, html);
}
|
import React, { useContext, useEffect, useState } from "react";
import "./Post.css";
import { Modal } from "@material-ui/core";
import Avatar from "@material-ui/core/Avatar";
import MoreHorizIcon from "@material-ui/icons/MoreHoriz";
import { Button, Icon, IconButton } from "@material-ui/core";
import TurnedInNotOutlinedIcon from "@material-ui/icons/TurnedInNotOutlined";
import FavoriteBorderIcon from "@material-ui/icons/FavoriteBorder";
import ChatBubbleOutlineSharpIcon from "@material-ui/icons/ChatBubbleOutlineSharp";
import { setstate } from "./context";
import { db } from "./firebase";
import firebase from "firebase";
import { getModalStyle, useStyles } from "./Common";
function Post({ imageurl, username, caption, userimage, postid }) {
const {
user,
} = useContext(setstate);
const [comments, setcomments] = useState([]);
const [comment, setcomment] = useState("");
const classes = useStyles();
const [modalStyle] = React.useState(getModalStyle);
const [showcomment, setshowcomment] = useState(false);
const [user1, setuser1] = useState([]);
useEffect(() => {
let unsubscribe;
if (postid) {
unsubscribe = db
.collection("posts")
.doc(postid)
.collection("comments")
.orderBy("timestamp", "desc")
.onSnapshot((snapshot) => {
setcomments(snapshot.docs.map((doc) =>
doc.data()
));
});
}
return () => {
unsubscribe();
};
}, [postid]);
const postcomment = (e) => {
e.preventDefault();
db.collection("posts").doc(postid).collection("comments").add({
text: comment,
username: user?.displayName,
timestamp: firebase.firestore.FieldValue.serverTimestamp(),
});
setshowcomment(false);
setcomment("");
};
const body1 = (
<div style={modalStyle} className={classes.paper}>
<form>
{user ? (
<center className="uploadimage">
<form className="Post_test">
<input
type="text"
className="post__input"
placeholder="Add a comment..."
value={comment}
onChange={(e) => setcomment(e.target.value)}
/>
<Button
variant="contained"
color="secondary"
className="post__button"
disabled={!comment}
type="submit"
onClick={postcomment}
>
Post
</Button>
</form>
</center>
) : (
<h4>You need to create an account for commenting</h4>
)}
</form>
</div>
);
return (
<div className="Post">
<div className="Post__header">
<div className="Post_header__icon">
<Avatar className="Post_avatar" alt={username} src={userimage} />
<h4>{username}</h4>
</div>
<IconButton>
<MoreHorizIcon />
</IconButton>
</div>
<img className="Post__img" src={imageurl} alt="" />
<div className="Bottom_io">
<div>
<IconButton>
<FavoriteBorderIcon />
</IconButton>
<IconButton>
<ChatBubbleOutlineSharpIcon onClick={() => setshowcomment(true)} />
</IconButton>
<IconButton>
<img
src="https://cdn0.iconfinder.com/data/icons/instagram-32/512/Chat_Message_DM-512.png"
alt=""
className="message_icon"
/>
</IconButton>
</div>
<IconButton>
<TurnedInNotOutlinedIcon />
</IconButton>
</div>
<div>
<Modal open={showcomment} onClose={() => setshowcomment(false)}>
{body1}
</Modal>
</div>
<h4 className="Post_test">
{" "}
<strong>{username}</strong>
{caption}
</h4>
<div className="postcomments">
{
(
comments.map(({ username, text }) => (
<p>
<strong>{username}</strong>
{text}
</p>
)))
}
</div>
</div>
);
}
export default Post;
|
export var getConfig = function() {
let config = {
appPort: 3000
}
return config;
} |
var searchData=
[
['skill',['Skill',['../namespaceSkill.html',1,'']]]
];
|
Players = new Meteor.Collection("players");
Currencies = new Meteor.Collection("currencies");
if (Meteor.isClient) {
Template.leaderboard.players = function () {
return Players.find({}, {sort: {points: -1, name: 1}});
};
Template.leaderboard.selected_name = function () {
var player = Players.findOne(Session.get("selected_player"));
return player && player.name;
};
Template.player.selected = function () {
return Session.equals("selected_player", this._id) ? "selected" : '';
};
Template.player.points = function () {
return Players.findOne({name: this.name}).points;
};
Template.player.AdaPower = function () {
var ownedCoins = this["Ada"];
var outstandingCurrency = Currencies.findOne({name: "Ada"}).outstanding;
return (ownedCoins / outstandingCurrency).toFixed(2)*100;
};
Template.player.NikolaPower = function () {
var ownedCoins = this["Nikola"];
var outstandingCurrency = Currencies.findOne({name: "Nikola"}).outstanding;
return (ownedCoins / outstandingCurrency).toFixed(2)*100 || 0;
};
Template.currencies.currencies = function () {
return Currencies.find({}, {sort: {outstanding: -1, name: 1}});
};
Template.leaderboard.events({
'click input.ada-inc': function () {
var selectedPlayer = Session.get("selected_player");
if ( Players.findOne({_id: selectedPlayer}, {points: {name: "Ada"}}) ) {
Players.update(selectedPlayer, {$inc: {"points.Ada": 5}});
Currencies.update(Currencies.findOne({name:"Ada"})['_id'], {$inc: {outstanding: 5}});
} else {
Players.update(selectedPlayer, {$set: {"points.Ada": 5}});
Currencies.update(Currencies.findOne({name:"Ada"})['_id'], {$inc: {outstanding: 5}});
}
},
'click input.nikola-inc': function () {
var selectedPlayer = Session.get("selected_player");
if ( Players.findOne({_id: selectedPlayer}, {points: {name: "Nikola"}}) ) {
Players.update(selectedPlayer, {$inc: {"points.Nikola": 5}});
Currencies.update(Currencies.findOne({name:"Nikola"})['_id'], {$inc: {outstanding: 5}});
} else {
Players.update(selectedPlayer, {$set: {"points.Nikola": 5}});
Currencies.update(Currencies.findOne({name:"Nikola"})['_id'], {$inc: {outstanding: 5}});
}
}
});
Template.player.events({
'click': function () {
Session.set("selected_player", this._id);
}
});
}
// On server startup, create some players if the database is empty.
if (Meteor.isServer) {
Meteor.startup(function () {
if (Players.find().count() === 0) {
var names = ["Ada",
"Grace",
"Marie",
"Carl",
"Nikola",
"Claude"];
for (var i = 0; i < names.length; i++) {
Players.insert({name: names[i], points: {"Ada": ~~(Math.random()*100)}});
Currencies.insert({name: names[i], outstanding: 0});
}
}
});
}
|
/* global $, Sortable, Editor, RepeatableFields, autosize */
/* exported Admin */
/** Admin
* This file orchestrates all the code for the administrative part of the website (ie. admin.wemeditate.com)
*/
const Admin = {
load: function() {
console.log('loading Admin.js') // eslint-disable-line no-console
// Initialize javascript-reliant elements for the entire body
Admin.initialize($(document.body))
// Activate the loader icon on form submit
$('form').on('submit', function() {
$(this).addClass('loading')
$('#loader').addClass('active')
})
// Activate the loader icon when pagination buttons are clicked
$('#pagination').on('click', 'a', function() {
$('#loader').addClass('active')
})
// Initialize the Sortable library for sortable lists
$('.sort-list').each(function() {
Sortable.create(this, {
handle: '.handle',
draggable: '.sortable',
})
var list = $(this)
list.closest('form').on('submit', function() {
// Before any form is submitted, we need to update the order value for each item in this list.
list.children('.sortable').each(function(index) {
$(this).children('.sorting-order').val(index + 1)
})
})
})
},
initialize: function(scope) {
// Initialize basic javascript elements.
scope.find('.ui.checkbox').checkbox()
scope.find('.tabs.menu > .item').tab()
scope.find('.ui.accordion').accordion()
scope.find('.ui.date.picker').calendar({ type: 'date' })
autosize(scope.find('textarea'))
RepeatableFields.initialize(scope)
// Initialize dropdown elements.
scope.find('.ui.dropdown:not(.simple)').each(function() {
var $element = $(this)
var options = {
fullTextSearch: true,
}
if ($element.hasClass('clearable')) {
options.clearable = true
}
$element.dropdown(options)
// This is a workaround to fix default values for a multiple select
// TODO: Is this workaround still necessary?
// As of Oct 27, 2019 this has been commented out. If this doesn't cause any issues in the next week or so, we can delete it.
/*if ($element.hasClass('multiple')) {
var selected = []
selected.push($element.find('option:selected').val())
$element.dropdown('set selected', selected)
$element.children('input[type="hidden"]').val(null)
}*/
})
// Add callbacks for a few input types
scope.find('input[type=file]').on('change', event => this.onChangeFileInput(event.target))
scope.find('.js-vimeo-field input').on('change', event => this.onRefreshVimeoInput(event.target.parentNode.parentNode))
scope.find('.js-vimeo-field + .preview-item .reload').on('click', event => this.onRefreshVimeoInput(event.target.parentNode.previousSibling))
},
// When a file input has it's file changes, we need to update the preview.
onChangeFileInput(input) {
const $img = $(input).next('.image').children('img')
if ($img.length > 0 && input.files && input.files[0]) {
const reader = new FileReader()
reader.onload = function(event) {
$img.attr('src', event.target.result)
}
reader.readAsDataURL(input.files[0])
}
},
// When vimeo metadata is refreshed, we need to make the appropriate server requests
onRefreshVimeoInput(field) {
const vimeo_id = field.querySelector('input').value
const input = field.querySelector('.input')
const meta = field.nextSibling
if (!vimeo_id || isNaN(vimeo_id)) {
// If the vimeo id isn't valid, then hide this whole section
meta.querySelector('.content').style.display = 'none'
} else {
meta.querySelector('.content').style.display = null
input.classList.add('loading')
Editor.retrieveVimeoVideo(vimeo_id, response => {
// Render a preview of the returned meta data, and store it to an input to be saved.
meta.querySelector('.raw').innerText = JSON.stringify(response, null, 2)
meta.querySelector('img').src = response.thumbnail
meta.querySelector('.hint').innerText = response.title
meta.querySelector('a').href = `https://vimeo.com/${response.vimeo_id}`
meta.querySelector('input').value = JSON.stringify(response)
input.classList.remove('loading')
})
}
},
}
$(document).on('turbolinks:load', Admin.load)
|
/**
* Copyright 2017 PhenixP2P Inc. All Rights Reserved.
*
* 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.
*/
import {SEEK_TO, SEEK_TO_REALTIME_STREAM, UPDATE_SEEKBAR_RANGE} from '../../../src/actions/actionTypes';
import {seekToAction, seekToRealtimeStreamAction, updateSeekbarRangeAction} from '../../../src/actions/videoStreamActions.js';
describe('actions', () => {
test('should create an action to seek to certain stream time', () => {
const streamTime = 45.2;
const actualOutput = seekToAction(streamTime);
const expectedOutput = {
type: SEEK_TO,
streamTime
};
expect(actualOutput).toEqual(expectedOutput);
});
test('should create an action to seek to real stream time', () => {
const actualOutput = seekToRealtimeStreamAction();
const expectedOutput = {type: SEEK_TO_REALTIME_STREAM};
expect(actualOutput).toEqual(expectedOutput);
});
test('should create an action to update the seekbar range', () => {
const seekbarValues = {
streamTime: 38.0,
maxSeekbarRange: 40
};
const actualOutput = updateSeekbarRangeAction(seekbarValues);
const expectedOutput = {
type: UPDATE_SEEKBAR_RANGE,
seekbarValues
};
expect(actualOutput).toEqual(expectedOutput);
});
}); |
import React, { PureComponent } from 'react'
import { connect } from 'react-redux'
import * as _ from 'lodash'
import Box from 'grommet/components/Box'
import Title from 'grommet/components/Title'
import Header from 'grommet/components/Header'
import Headline from 'grommet/components/Headline'
import PathwayGraph from '../PathwayGraph'
import PathwayDiffer from './PathwayDiffer'
import GradeSidebar from './Sidebar/GradeSidebar'
import DefaultSidebar from './Sidebar/Default'
import RequiredGradeSidebar from './Sidebar/RequiredGradeSidebar'
import JobSidebar from './Sidebar/JobSidebar'
import PostSecondarySidebar from './Sidebar/PostSecondarySidebar'
class PathwayComparison extends PureComponent {
state = {
sidebarType: 'none',
sidebarInfo: {}
}
createNodesAndEdges = () => {
const pathway = this.props.userPathway
const nodes = []
const grades = ['9', '10', '11', '12']
grades.forEach(v => {
if (v in pathway) {
nodes.push({ id: v, label: `Grade ${v}` })
}
})
const edges = []
for (let x = 1; x < nodes.length; x++) {
edges.push({ from: nodes[x - 1].id, to: nodes[x].id })
}
return { edges, nodes }
}
onPersonalGradeClicked = (id) => {
const info = this.props.userPathway[id]
this.setState({ sidebarType: 'HIGHSCHOOL', sidebarInfo: { grade: id, courses: info } })
}
onSelectedPathwayClick = (idx, id) => {
const info = _.get(this.props.jobPathways[idx], id)
if (id.startsWith('SE')) {
return this.setState({ sidebarType: 'POST_SECONDARY', sidebarInfo: info })
}
if (id.startsWith('J')) {
return this.setState({ sidebarType: 'JOB', sidebarInfo: info })
}
return this.setState({ sidebarType: 'REQUIRED_HIGHSCHOOL', sidebarInfo: { grade: id, required: info ? info.required : [] } })
}
renderComparisonPathways = () => {
const jobPathways = this.props.jobPathways
return jobPathways.map((jp, idx) => (
<PathwayDiffer
studentPathway={this.props.userPathway}
selectedPathway={jp}
onSelectNode={(id) => this.onSelectedPathwayClick(idx, id)}
/>
))
}
renderSideBar = () => {
const info = this.state.sidebarInfo
switch (this.state.sidebarType) {
case 'HIGHSCHOOL': return <GradeSidebar grade={info.grade} courses={info.courses} />
case 'REQUIRED_HIGHSCHOOL': return <RequiredGradeSidebar grade={info.grade} required={info.required} courses={this.props.userPathway[info.grade]} />
case 'JOB': return <JobSidebar info={info} />
case 'POST_SECONDARY': return <PostSecondarySidebar info={info} />
default: return <DefaultSidebar />
}
}
render () {
if (!this.props.jobPathways) {
if (this.props.loading === 'BEFORE_LOAD') {
this.props.history.push('/search')
}
return <h3> Loading </h3>
}
const { edges, nodes } = this.createNodesAndEdges()
const jobName = this.props.jobPathways[0].name
return (
<Box full='vertical'>
<Header pad='medium' justify='between'>
<Headline size='small'><b>Comparing your pathway</b></Headline>
</Header>
<Box flex direction='row' alignContent='stretch'>
<Box direction='column' separator='all' basis='1/4'>
<Header pad='medium'>
<Title>Your Current Pathway</Title>
</Header>
<Box flex direction='row'>
<PathwayGraph edges={edges} nodes={nodes} onSelectNode={this.onPersonalGradeClicked} />
</Box>
</Box>
<Box direction='column' seperator='all' flex>
<Header pad='medium' flex justify='center'>
<Title> Pathways for
<span style={{textDecoration: 'underline'}}>{jobName}</span> </Title>
</Header>
<Box direction='row' flex>
{
this.renderComparisonPathways()
}
</Box>
</Box>
<Box style={{backgroundColor: 'lightgray', overflowY: 'scroll'}} pad='medium' basis='1/3'>
{
this.renderSideBar()
}
</Box>
</Box>
</Box>
)
}
}
const stateToProps = (state) => ({
userPathway: state.pathway.pathway,
jobPathways: state.jobPathway.pathway,
loading: state.jobPathway.loading
})
const dispatchToProps = (dispatch) => ({})
export default connect(stateToProps, dispatchToProps)(PathwayComparison)
|
import React, { useState, useEffect } from 'react';
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
import { Helmet } from 'react-helmet';
import Home from './Home.js';
import Contact from './contact';
import Footer from './Footer';
import Header from './header';
import Products from './products';
import Recipes from './recipes';
import Scrollmenu from './Scrollmenu';
import Teachings from './teachings';
import Tests from './Tests';
import PageNotFound from './PageNotFound';
const arrayOfComponents = [
{ component: Home, string: 'home', path: '/home', title: '' },
{
component: Products,
string: 'products',
path: '/proizvodi',
title: 'Somina | proizvodi',
},
{
component: Recipes,
string: 'recipes',
path: '/recepti',
title: 'Somina | recepti',
},
{
component: Teachings,
string: 'teachings',
path: '/pouke',
title: 'Somina | pouke',
},
{
component: Contact,
string: 'contact',
path: '/kontakt',
title: 'Somina | kontakt',
},
{
component: Tests,
string: 'tests',
path: '/tests',
title: 'Somina | tests',
},
];
const App = (props) => {
const [pos, setPos] = useState(false);
useEffect(() => {
document.onscroll = (e) => {
let scrolled = document.scrollingElement.scrollTop;
scrolled >= 96 ? setPos(true) : setPos(false);
};
}, []);
return (
<div className="">
<Router>
<Header />
{pos && <Scrollmenu />}
<Switch>
<Route exact path="/">
<div className="min-h-screen">
<Home />
</div>
</Route>
{arrayOfComponents.map((component) => (
<Route key={component.string} path={component.path}>
<div className="min-h-screen">
<Helmet>
<title>{component.title}</title>
</Helmet>{' '}
{<component.component />}
</div>
</Route>
))}
<Route path="*">
<PageNotFound />
</Route>
</Switch>
</Router>
<Footer />
</div>
);
};
export default App;
|
exports.base = async function (req, res) {
res.redirect('/link/list');
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.