text
stringlengths
7
3.69M
var UserAndPostConstants = require('../constants/user_and_post_constants'); var AppDispatcher = require('../dispatcher/dispatcher'); var PostActions = { receiveAllPostsFromUser: function(userPosts) { AppDispatcher.dispatch({ actionType: UserAndPostConstants.ADD_ALL_USER_POSTS, userPosts: userPosts }); }, receiveNewPostFromUser: function(userPost) { AppDispatcher.dispatch({ actionType: UserAndPostConstants.ADD_NEW_USER_POST, userPost: userPost }); }, updatePostFromUser: function(userPost) { AppDispatcher.dispatch({ actionType: UserAndPostConstants.UPDATE_USER_POST, userPost: userPost }); }, deletePostFromUser: function(userPost) { AppDispatcher.dispatcher({ actionType: UserAndPostConstants.DELETE_USER_POST, userPost: userPost }); } }; module.exports = PostActions;
$(document).ready(function() { $("button#say-a").click(function() { $("ul").prepend("<li>Response A</li>"); $("li").click(function() { $(this).remove(); }); }); $("button#say-b").click(function() { $("ul").prepend("<li>Response B</li>"); $("li").click(function() { $(this).remove(); }); }); $("button#say-c").click(function() { $("ul").prepend("<li>Response C</li>"); $("li").click(function() { $(this).remove(); }); }); $("button#bark").click(function() { $("ul#meow-text").prepend("<li>meow!</li>"); $("li").first().click(function() { $(this).after('<img src="img/pic.jpg"></img>'); $("img").click(function() { $(this).remove(); }); }); }); $("button#meow").click(function() { $("ul#bark-text").prepend("<li>bark!</li>"); $("li").click(function() { $(this).remove(); }); }); });
/* * Load the single-quoted JSON from Python's repr() function, prettify * and save as conventional double-quoted JSON. */ var fs = require('fs'); var content = fs.readFileSync('../stub/micropython-rp2-1_13-290/modules.json', 'utf8'); var obj = (0, eval)('(' + content + ')'); fs.writeFileSync('../stub/micropython-rp2-1_13-290/modules.json', JSON.stringify(obj, null, 4));
import React from 'react'; const payment = () => { return <div className="form-container"> <div className = "form-header"> <h2>State Machine Payment Form</h2> </div> <div className="form-body"> <form> <div className="form-group"> <label htmlFor = "NameOnCard">Name on card</label> <input type = "text" id = "NameOnCard" className = "form-control" placeholder = "Name"/> </div> <div className="form-group"> <label htmlFor = "CreditCardNumber">Card Number</label> <input type = "text" id = "CreditCardNumber" className = "form-control" placeholder = "Card Number"/> </div> <button className = "button" id="payNow"> Pay Now</button> </form> </div> </div> } export default payment;
import React, { Component } from 'react'; import { View, Text, StyleSheet, Image, TouchableOpacity, Alert } from 'react-native'; import NumericInput from 'react-native-numeric-input'; import { Button } from 'react-native-elements'; import { COLOR_FIREBRICK, } from '../../asset/MyColor'; import { IP_SERVER, LAY_THUC_DON, COLOR_WHITE, THEM_MON_AN, URLThucDon, } from '../../asset/MyConst'; import moment from 'moment'; import { connect } from 'react-redux'; import * as actions from '../../redux/actions'; class ChiTietMonAnActivity extends Component { static navigationOptions = ({ navigation }) => ({ title: `${navigation.state.params.monAn.TenMonAn}`, headerStyle: { backgroundColor: '#f4511e', }, headerTintColor: '#fff', headerTitleStyle: { fontWeight: 'bold', }, }); constructor(props) { super(props); this.state = { soLuong: 1, monAn: this.props.navigation.getParam('monAn'), isActive: true }; } async _onPress() { const { soLuong } = this.state; if (soLuong < 1) { Alert.alert( 'Chú ý!', 'Số lượng phải lớn hơn 0', [ { text: 'Xác nhận', onPress: () => { } } ], { cancelable: false }, ); } else { this.setState({ isActive: false }); let monAn = JSON.stringify({ loai: THEM_MON_AN, ChuTaiKhoanId: this.props.email, BuaAnId: this.props.buaAn.loaiBua, MonAnId: this.state.monAn.Id, NgayAn: this.props.ngayChon, SoLuong: this.state.soLuong, }); await this.props.themMonAnAsync(monAn, this.props.email, this.props.ngayChon).then(() => { this.props.myNavigation.navigate('ManHinhChinhActivity'); }).then(() => { this.setState({ isActive: false }); }); } }; render() { const { Calo, Xo, Dam, Beo } = this.state.monAn; const { soLuong } = this.state; return ( <View style={styles.container}> <View style={styles.top}> <Image style={styles.avatarLogin} source={{ uri: this.state.monAn.AnhMonAn, }} /> </View> <View style={styles.mid}> <View style={styles.calo}> <Text style={styles.tieuDe}>Năng lượng (Kcal) </Text> <Text style={styles.tieuDe}>{Number(Calo) * soLuong}</Text> </View> <View style={styles.xo}> <Text style={styles.tieuDe}>Xơ (g) </Text> <Text style={styles.tieuDe}>{Number(Xo) * soLuong}</Text> </View> <View style={styles.beo}> <Text style={styles.tieuDe}>Béo (g) </Text> <Text style={styles.tieuDe}>{Number(Beo) * soLuong}</Text> </View> <View style={styles.dam}> <Text style={styles.tieuDe}>Đạm (g) </Text> <Text style={styles.tieuDe}>{Number(Dam) * soLuong}</Text> </View> </View> <View style={styles.bottom}> <View style={styles.soLuong}> <NumericInput style={styles.numberUpDown} type="up-down" value={this.state.soLuong} onChange={soLuong => this.setState({ soLuong })} totalWidth={100} totalHeight={40} initValue={this.state.soLuong} /> <Text style={{ marginLeft: 20, marginTop: 10, fontSize: 16 }}> {this.state.monAn.DonViTinh.split(' ')[1].trim()} </Text> </View> <TouchableOpacity onPress={() => this._onPress()} disabled={!this.state.isActive} style={this.state.isActive ? styles.buttonluu : styles.button_disabled}> <Text style={{ fontSize: 20 }}>Lưu</Text> </TouchableOpacity> </View> </View> ); } } function mapStateToProps(state) { return { myNavigation: state.myNavigation, buaAn: state.thucDon.buaAn, ngayChon: state.thucDon.ngayChon, email: state.taiKhoan.email } } export default connect( mapStateToProps, actions )(ChiTietMonAnActivity) const styles = StyleSheet.create({ container: { flex: 1, flexDirection: 'column', justifyContent: 'flex-start', }, top: { flex: 4, borderBottomWidth: 2, }, mid: { flex: 1, flexDirection: 'row', borderBottomWidth: 2, padding: 5, }, bottom: { flex: 5, borderBottomWidth: 2, justifyContent: 'center', alignItems: 'center', }, avatarLogin: { width: '100%', height: '100%', resizeMode: 'stretch', }, calo: { flex: 2, }, xo: { flex: 1, }, beo: { flex: 1, }, dam: { flex: 1, }, tieuDe: { fontSize: 16, marginTop: 5, }, soLuong: { flexDirection: 'row', justifyContent: 'center', }, numberUpDown: { textAlign: 'center', fontSize: 14, margin: 150, }, buttonluu: { width: 200, height: 45, borderRadius: 5, justifyContent: 'center', alignItems: 'center', backgroundColor: COLOR_FIREBRICK, marginTop: 10, }, luu: { color: COLOR_WHITE, }, button_disabled: { backgroundColor: '#cccccc', color: '#666666', borderWidth: 1, borderColor: '#999999', width: 200, height: 45, borderRadius: 5, justifyContent: 'center', alignItems: 'center', marginTop: 10, } });
/* A slide show designed for rodeoshow.com.au Features bare bone slide show functionality coupled with the ability to add animated elements for each slide that are executed and reset each time the slide comes into view CSS properties are set as objects (for example): $('#test').modularFeature().defineModule({ start: {'opacity' : '0','left' : '0px', 'top' : '0px'}, end: {'opacity' : '1','left' : '70px', 'top' : '120px'}, time: 0.5 }); */ ;modularFeature = (function ($) { var params = {}; var ItemModule = function () { this.el = ''; this.start = ''; this.end = ''; this.time = ''; } var Item = function (element) { this.el = element; this.current = false; this.showItem = function () { this.current = true; _mf.animating = true; this.resetModules().activateModules(); this.el.fadeIn(_mf.fadeSpeed, function () { _mf.animating = false; }); } this.hideItem = function () { this.current = false; _mf.animating = true; this.el.fadeOut(_mf.fadeSpeed, function () { _mf.animating = false; }); return this; } this.modules = []; this.resetModules = function () { if (this.modules.length > 0) { for (var m = 0; m < this.modules.length; m++) { this.modules[m].el.css(this.modules[m].start); } } return this; } this.activateModules = function () { var self = this; if (this.modules.length > 0) { for (var m = 0; m < this.modules.length; m++) { this.modules[m].el.stop().animate(this.modules[m].end, _mf.hold * this.modules[m].time); } } return this; } this.stopAllModules = function () { if (this.modules.length > 0) { for (var m = 0; m < this.modules.length; m++) { this.modules[m].el.stop(); } } return this; } } var _mf = { hold: 4000, fadeSpeed: 500, el: '', animating: false, currentItem: 0, Nav: { el: '', init: function () { var self = this; this.el = params.nav; $.each(_mf.Items.item, function () { self.el.append('<li></li>'); }); this.el.find('li').on('click', this, this.onClick); // INIT NAV this.switchNav(); }, switchNav: function () { this.el.find('li').eq(_mf.currentItem).addClass('current').siblings().removeClass('current'); }, onClick: function (e) { if (!_mf.animating) { var self = e.data; _mf.currentItem = $(this).index(); _mf.Items.switchItems(); _mf.slideShow.countDown = 0; self.switchNav(); } } }, Items: { item: [], init: function () { var self = this; $.each(_mf.el.find(params.items), function () { self.item.push( new Item($(this)) ); }); // INIT ITEMS for (var items = 0; items < this.item.length; items++) { if ( items != _mf.currentItem) this.item[items].el.hide(); } this.item[_mf.currentItem].current = true; this.item[_mf.currentItem].el.show(); params.itemModules(); this.item[_mf.currentItem].resetModules().activateModules(); console.log(this); }, switchItems: function () { for (var items = 0; items < this.item.length; items++) { if ( this.item[items].current ) this.item[items].hideItem().stopAllModules(); } this.item[_mf.currentItem].showItem(); } }, slideShow: { timer: '', countDown: 0, start: function () { var self = this; this.timer = setInterval(function () { if (self.countDown++ == _mf.hold / 100) { self.countDown = 0; if (_mf.currentItem == _mf.Items.item.length - 1) { _mf.currentItem = 0; } else { _mf.currentItem++ } _mf.Items.switchItems(); _mf.Nav.switchNav(); } },_mf.hold / 50) }, pause: function () { } }, init: function (container) { this.el = container; this.Items.init(); this.Nav.init(); this.slideShow.start(); }, Public: { defineModule: function (moduleSettings) { //console.log(this); var itemIndex = $(this).closest(params.items).index(); var module = new ItemModule; module.el = $(this); module.start = moduleSettings.start; module.end = moduleSettings.end; module.time = moduleSettings.time; _mf.Items.item[itemIndex].modules.push(module); } } // __public } var modularFeature = function (settings) { if (settings) { params = settings; _mf.init($(this)); } else { this.defineModule = _mf.Public.defineModule; return this; } } $.fn.extend({ modularFeature: modularFeature }) }(jQuery)); $(document).ready(function () { $('#modular-gallery').modularFeature({ items: '.item', nav: $('#modular-nav'), itemModules: function () { $('#test').modularFeature().defineModule({ start: {'opacity' : '0','left' : '0px', 'top' : '0px'}, end: {'opacity' : '1','left' : '70px', 'top' : '120px'}, time: 0.5 }); $('#testA').modularFeature().defineModule({ start: {'opacity' : '0','right' : '0px', 'bottom' : '0px'}, end: {'opacity' : '1','right' : '80px', 'bottom' : '10px'}, time: 0.2 }); $('#text1').modularFeature().defineModule({ start: {'opacity' : '0','top' : '50px', 'left' : '0px'}, end: {'opacity' : '1','top' : '-120px', 'left' : '0px'}, time: 0.2 }); $('#test2').modularFeature().defineModule({ start: {'opacity' : '0','top' : '0px', 'right' : '0px'}, end: {'opacity' : '1','top' : '40px', 'right' : '60px'}, time: 0.4 }); $('#text2').modularFeature().defineModule({ start: {'opacity' : '0','top' : '0px', 'right' : '-40px'}, end: {'opacity' : '1','top' : '0px', 'right' : '0px'}, time: 0.2 }); $('#test3').modularFeature().defineModule({ start: {'opacity' : '0','bottom' : '0px', 'left' : '0px'}, end: {'opacity' : '1','bottom' : '50px', 'left' : '70px'}, time: 0.4 }); $('#text3').modularFeature().defineModule({ start: {'opacity' : '0','top' : '0px', 'right' : '-40px'}, end: {'opacity' : '1','top' : '0px', 'right' : '0px'}, time: 0.2 }); } }); });
import React from 'react' import RunesData from 'components/runes/RunesData' import Rune from 'components-lib/rune/Rune' import RuneStar from 'components-lib/runeStar/RuneStar' import { Utils, FormSelect, BusyBars } from 'ap-react-bootstrap' import SWPanel from 'components-lib/ui/SWPanel' import PosType from 'utils/constants/PosType' import SetType from 'utils/constants/SetType' import StatType from 'utils/constants/StatType' import './Runes.scss' class Runes extends React.Component { constructor(props) { super(props); } componentWillMount() { RunesData.register(this) } componentWillUnmount() { RunesData.unregister() } _buildRune(rune) { return (<Rune key={rune.id} rune={rune}/>) } _buildType(setType) { return ( <div key={setType.key} onClick={this.onClickSetFilter.bind(this, setType.key)} className={(this.state.setFilter[setType.key]) ? "sm-rune-type sm-rune-type-active" : "sm-rune-type"} title={setType.key}> <img src={"assets/images/runes/Rune-" + setType.key + ".png"}/> </div> ) } _buildSubStat(substat) { return ( <li key={substat.key} className={(this.state.subStatFilter[substat.key]) ? "sm-runes-sub-active" : ""}> <span className="sm-label" onClick={this.onClickSubStatFilter.bind(this, substat.key)}>{substat.key}</span> </li> ) } _buildSorts(sort, key) { return ( <li key={key}> <label className="sm-label" htmlFor={key}>{key}</label> <input id={key} className="sm-checkbox" type="checkbox" onClick={this.onClickSort.bind(this, key)}/> </li> ) } render() { if (this.refs.list && this.state.threshold === 50) { this.refs.list.scrollTop = 0; } return ( <div className='sm-runes'> <div className="row sm-max-height"> <div className="col-xs-12 col-sm-4 sm-max-height sm-max-height-fix"> <SWPanel className="sm-runes-positions"> <RuneStar onChange={this.onClickRuneStar}/> <ul> {Utils.map(RunesData.SORT_ATTRIBUTE, this._buildSorts.bind(this))} </ul> </SWPanel> <SWPanel> <div className="sm-runes-types"> {SetType.VALUES.map(this._buildType.bind(this))} </div> </SWPanel> </div> <div className="col-xs-12 col-sm-8 sm-max-height sm-max-height-fix"> <div className="row sm-runes-stats"> <div className="col-xs-12 col-sm-4 sm-max-height"> <SWPanel className="sm-runes-main-filters"> <h4>Main Stat</h4> <FormSelect values={this.state.statTypeValues} className={'sm-input sm-runes-main-select'} onChange={this.onChangeMainStatFilter.bind(this)}/> </SWPanel> </div> <div className="col-xs-12 col-sm-8 sm-max-height"> <SWPanel className="sm-runes-sub-filters"> <ul> {StatType.VALUES.map(this._buildSubStat.bind(this))} </ul> </SWPanel> </div> </div> <div className="clearfix"></div> <div className='sm-runes-list' onScroll={this.onScroll} ref='list'> {this.state.runes.slice(0, this.state.threshold).map(this._buildRune)} {this.state.runes.length > this.state.threshold ? <div className='sm-runes-busy'> <BusyBars className='sm-busy-indicator'/> </div> : '' } </div> </div> </div> </div> ); } } export default Runes;
var AlfredError = require('./AlfredError'); var argv = require('minimist')(process.argv.slice(2)); var alfredo = require('alfredo'); if (!argv['_'].length) { return new alfredo.Item({ title: 'No query passed' }).feedback(); } var configObj = require('./config').read(); if (configObj instanceof AlfredError) { return configObj.toItem().feedback(); } else { require('./getTicketInfo')(argv['_'][0], configObj); }
Component({ properties: { type: { type: String, value: "" }, // 学校计划 share: { type: Boolean, value: false }, // 学校计划 collegePlan: { type: Boolean, value: true }, // 数据源 listData: { type: Array, value: [] }, // 列数 columns: { type: Number, value: 1, observer: "dataChange" }, // 顶部高度 topSize: { type: Number, value: 0, observer: "dataChange" }, // 底部高度 bottomSize: { type: Number, value: 0, observer: "dataChange" }, cityId: { type: Number, value: 0 }, isPreview: { type: Boolean, value: false } }, data: { /* 渲染数据 */ windowHeight: 0, // 视窗高度 platform: "", // 平台信息 realTopSize: 0, // 计算后顶部高度实际值 realBottomSize: 0, // 计算后底部高度实际值 itemDom: { // 每一项 item 的 dom 信息, 由于大小一样所以只存储一个 width: 0, height: 0, left: 0, top: 0 }, itemWrapDom: { // 整个拖拽区域的 dom 信息 width: 0, height: 0, left: 0, top: 0 }, startTouch: { // 初始触摸点信息 pageX: 0, pageY: 0, identifier: 0 }, startTranX: 0, // 当前激活元素的初始 X轴 偏移量 startTranY: 0, // 当前激活元素的初始 Y轴 偏移量 preOriginKey: -1, // 前一次排序时候的起始 key 值 /* 未渲染数据 */ list: [], cur: -1, // 当前激活的元素 curZ: -1, // 当前激活的元素, 用于控制激活元素z轴显示 tranX: 0, // 当前激活元素的 X轴 偏移量 tranY: 0, // 当前激活元素的 Y轴 偏移量 itemWrapHeight: 0, // 动态计算父级元素高度 dragging: false, // 是否在拖拽中 overOnePage: false, // 整个区域是否超过一个屏幕 itemTransition: false, // item 变换是否需要过渡动画, 首次渲染不需要 flag: true }, methods: { /*点击每一项后触发事件*/ itemClick: function itemClick(e) { var _e$currentTarget$data = e.currentTarget.dataset, index = _e$currentTarget$data.index, code = _e$currentTarget$data.code; var item = this.data.list[index]; this.triggerEvent("click", { oldKey: index, newKey: item.key, data: item.data, code: code }); }, collegedetail: function collegedetail(e) { var _e$currentTarget$data2 = e.currentTarget.dataset, collegeid = _e$currentTarget$data2.collegeid, collegecode = _e$currentTarget$data2.collegecode, isben = _e$currentTarget$data2.isben, index = _e$currentTarget$data2.index; this.triggerEvent("collegedetail", { collegeid: collegeid, collegecode: collegecode, isben: isben, index: index }); }, showplan: function showplan(e) { var index = e.currentTarget.dataset.index; this.triggerEvent("showplan", { index: index }); }, showmajor: function showmajor(e) { var majorcode = e.currentTarget.dataset.majorcode; this.triggerEvent("showmajor", { majorcode: majorcode }); }, /*长按触发移动排序*/ longPress: function longPress(e) { if (this.data.share) { return; } // 获取触摸点信息 var startTouch = e.changedTouches[0]; if (!startTouch) return; // 如果是固定项则返回 var index = e.currentTarget.dataset.index; if (this.isFixed(index)) return; // 防止多指触发 drag 动作, 如果已经在 drag 中则返回, touchstart 事件中有效果 if (this.data.dragging) return; this.setData({ dragging: true }); var startPageX = startTouch.pageX, startPageY = startTouch.pageY, _data = this.data, itemDom = _data.itemDom, itemWrapDom = _data.itemWrapDom, startTranX = 0, startTranY = 0; if (this.data.columns > 1) { // 多列的时候计算X轴初始位移, 使 item 水平中心移动到点击处 startTranX = startPageX - itemDom.width / 2 - itemWrapDom.left; } // 计算Y轴初始位移, 使 item 垂直中心移动到点击处 startTranY = startPageY - itemDom.height / 2 - itemWrapDom.top; this.setData({ startTouch: startTouch, startTranX: startTranX, startTranY: startTranY, cur: index, curZ: index, tranX: startTranX, tranY: startTranY }); wx.vibrateShort(); }, touchMove: function touchMove(e) { // 获取触摸点信息 var currentTouch = e.changedTouches[0]; if (!currentTouch) return; if (!this.data.dragging) return; var _data2 = this.data, windowHeight = _data2.windowHeight, realTopSize = _data2.realTopSize, realBottomSize = _data2.realBottomSize, itemDom = _data2.itemDom, startTouch = _data2.startTouch, startTranX = _data2.startTranX, startTranY = _data2.startTranY, preOriginKey = _data2.preOriginKey, startPageX = startTouch.pageX, startPageY = startTouch.pageY, startId = startTouch.identifier, currentPageX = currentTouch.pageX, currentPageY = currentTouch.pageY, currentId = currentTouch.identifier, currentClientY = currentTouch.clientY; // 如果不是同一个触发点则返回 if (startId !== currentId) return; // 通过 当前坐标点, 初始坐标点, 初始偏移量 来计算当前偏移量 var tranX = currentPageX - startPageX + startTranX, tranY = currentPageY - startPageY + startTranY; // 单列时候X轴初始不做位移 if (this.data.columns === 1) tranX = 0; // 判断是否超过一屏幕, 超过则需要判断当前位置动态滚动page的位置 if (this.data.overOnePage && this.data.cityId !== 834) { if (currentClientY > windowHeight - itemDom.height - realBottomSize) { // 当前触摸点pageY + item高度 - (屏幕高度 - 底部固定区域高度) wx.pageScrollTo({ scrollTop: currentPageY + itemDom.height - (windowHeight - realBottomSize), duration: 300 }); } else if (currentClientY < itemDom.height + realTopSize) { // 当前触摸点pageY - item高度 - 顶部固定区域高度 wx.pageScrollTo({ scrollTop: currentPageY - itemDom.height - realTopSize, duration: 300 }); } } // 设置当前激活元素偏移量 this.setData({ tranX: tranX, tranY: tranY }); // 获取 originKey 和 endKey var originKey = parseInt(e.currentTarget.dataset.key), endKey = this.calculateMoving(tranX, tranY); // 如果是固定 item 则 return if (this.isFixed(endKey)) return; // 防止拖拽过程中发生乱序问题 if (originKey === endKey || preOriginKey === originKey) return; this.setData({ preOriginKey: originKey }); // 触发排序 this.insert(originKey, endKey); }, touchEnd: function touchEnd() { if (!this.data.dragging) return; this.clearData(); this.dataChange(); }, /** * 根据当前的手指偏移量计算目标key */ calculateMoving: function calculateMoving(tranX, tranY) { var itemDom = this.data.itemDom; var rows = Math.ceil(this.data.list.length / this.data.columns) - 1, i = Math.round(tranX / itemDom.width), j = Math.round(tranY / itemDom.height); i = i > this.data.columns - 1 ? this.data.columns - 1 : i; i = i < 0 ? 0 : i; j = j < 0 ? 0 : j; j = j > rows ? rows : j; var endKey = i + this.data.columns * j; endKey = endKey >= this.data.list.length ? this.data.list.length - 1 : endKey; return endKey; }, /** * 根据起始key和目标key去重新计算每一项的新的key */ insert: function insert(origin, end) { var _this = this; this.setData({ itemTransition: true }); var list = void 0; if (origin < end) { // 正序拖动 list = this.data.list.map(function(item) { if (item.fixed) return item; if (item.key > origin && item.key <= end) { item.key = _this.l2r(item.key - 1, origin); } else if (item.key === origin) { item.key = end; } return item; }); this.getPosition(list); } else if (origin > end) { // 倒序拖动 list = this.data.list.map(function(item) { if (item.fixed) return item; if (item.key >= end && item.key < origin) { item.key = _this.r2l(item.key + 1, origin); } else if (item.key === origin) { item.key = end; } return item; }); this.getPosition(list); } }, /*正序拖动 key 值和固定项判断逻辑*/ l2r: function l2r(key, origin) { if (key === origin) return origin; if (this.data.list[key].fixed) { return this.l2r(key - 1, origin); } else { return key; } }, /*倒序拖动 key 值和固定项判断逻辑*/ r2l: function r2l(key, origin) { if (key === origin) return origin; if (this.data.list[key].fixed) { return this.r2l(key + 1, origin); } else { return key; } }, /* 根据排序后 list 数据进行位移计算*/ getPosition: function getPosition(data) { var _this2 = this; var vibrate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; var platform = this.data.platform; var list = data.map(function(item, index) { item.x = item.key % _this2.data.columns; item.y = Math.floor(item.key / _this2.data.columns); return item; }); this.setData({ list: list }); if (!vibrate) return; if (platform !== "devtools") wx.vibrateShort(); var listData = []; list.forEach(function(item) { listData[item.key] = item.data; }); this.triggerEvent("change", { listData: listData }); }, /*判断是否是固定的 item*/ isFixed: function isFixed(key) { var list = this.data.list; if (list && list[key] && list[key].fixed) return 1; return 0; }, /*清除参数*/ clearData: function clearData() { var _this3 = this; this.setData({ preOriginKey: -1, dragging: false, cur: -1, tranX: 0, tranY: 0 }); // 延迟清空 setTimeout(function() { _this3.setData({ curZ: -1 }); }, 300); }, /*监听列数变化, 如果改变重新初始化参数*/ dataChange: function dataChange(newVal, oldVal) { this.init(); }, /*初始化获取 dom 信息*/ initDom: function initDom() { var _this4 = this; wx.pageScrollTo({ scrollTop: 0, duration: 0 }); var _wx$getSystemInfoSync = wx.getSystemInfoSync(), windowWidth = _wx$getSystemInfoSync.windowWidth, windowHeight = _wx$getSystemInfoSync.windowHeight, platform = _wx$getSystemInfoSync.platform; var remScale = (windowWidth || 375) / 375, realTopSize = this.data.topSize * remScale / 2, realBottomSize = this.data.bottomSize * remScale / 2; this.setData({ windowHeight: windowHeight, platform: platform, realTopSize: realTopSize, realBottomSize: realBottomSize }); this.createSelectorQuery().select(".item").boundingClientRect(function(res) { console.log(res); console.log("======================"); var rows = Math.ceil(_this4.data.list.length / _this4.data.columns); _this4.setData({ itemDom: res, itemWrapHeight: rows * res.height }); _this4.createSelectorQuery().select(".item-wrap").boundingClientRect(function(res) { // (列表的底部到页面顶部距离 > 屏幕高度 - 底部固定区域高度) 用该公式来计算是否超过一页 var overOnePage = res.bottom > windowHeight - realBottomSize; _this4.setData({ itemWrapDom: res, overOnePage: overOnePage }); }).exec(); }).exec(); }, /*初始化*/ init: function init() { var _this5 = this; this.clearData(); this.setData({ itemTransition: false }); // 避免获取不到节点信息报错问题 if (this.data.listData.length === 0) { this.setData({ list: [], itemWrapHeight: 0 }); return; } // 遍历数据源增加扩展项, 以用作排序使用 var list = this.data.listData.map(function(item, index) { return { key: index, x: 0, y: 0, data: item }; }); this.getPosition(list, false); // 异步加载数据时候, 延迟执行 initDom 方法, 防止基础库 2.7.1 版本及以下无法正确获取 dom 信息 setTimeout(function() { return _this5.initDom(); }, 10); console.log("*****************"); console.log(this.data); }, screen: function screen(e, flag) { this.setData({ listData: e, flag: flag }), this.init(); }, clickPopup: function clickPopup(e) { var index = e.currentTarget.dataset.index; var arr = this.data.list; arr[index].st = !arr[index].st; arr.map(function(i, idx) { if (idx != index) { i.st = false; } }); this.setData({ list: arr }); }, moveUp: function moveUp(e) { var index = e.currentTarget.dataset.index; var list = this.data.listData; list[index] = list.splice(index - 1, 1, list[index])[0]; this.setData({ listData: list }); this.triggerEvent("change", { listData: list }); this.init(); }, moveDown: function moveDown(e) { var index = e.currentTarget.dataset.index; var list = this.data.listData; list[index] = list.splice(index + 1, 1, list[index])[0]; this.setData({ listData: list }); this.triggerEvent("change", { listData: list }); this.init(); }, delVolunteer: function delVolunteer(e) { var that = this; var index = e.currentTarget.dataset.index; var list = this.data.listData; wx.showModal({ content: "是否删除该志愿?", success: function success(res) { if (res.confirm) { list.splice(index, 1); that.setData({ listData: list }); that.triggerEvent("change", { listData: list }); that.init(); } else if (res.cancel) {} } }); } }, ready: function ready() { console.log(this.data.listData); this.init(); } });
// Dependencies var express = require('express'); var bodyParser = require('body-parser'); var path = require ('path'); // Config var app = express(); var PORT = process.env.PORT || 8080; // Middleware app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.text()); // Routes to html pages require(path.join(__dirname, './app/routing/apiRoutes'))(app); require(path.join(__dirname, './app/routing/htmlRoutes'))(app); // Listen app.listen(PORT, function() { console.log(require); console.log('FriendFinder is listening on PORT: ' + PORT); });
var oauthTabs = {}; /** * @param url * @param redirectUri * @param openerTabId - Not supported in edge and firefox for android * @returns {Promise<any>} */ function startOAuth(url, redirectUri, openerTabId){ return new Promise((resolve, reject)=>{ chrome.tabs.create({url, openerTabId}, (tab)=>{ oauthTabs[tab.id] = { redirectUri, resolve, reject }; }); }); } /** * SUPPORTED ON ALL BROWSERS * https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/onRemoved */ chrome.tabs.onRemoved.addListener((tabId)=>{ if(oauthTabs[tabId]){ if(oauthTabs[tabId].reject){ oauthTabs[tabId].reject('tab closed before oauth completed'); } oauthTabs[tabId] = undefined; } }); /** * SUPPORTED ON ALL BROWSER * https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/onUpdated */ chrome.tabs.onUpdated.addListener((tabId, changeInfo)=>{ if(oauthTabs[tabId]) { const {redirectUri, resolve, reject} = oauthTabs[tabId]; console.log("matching", redirectUri, changeInfo.url); if (resolve && changeInfo && changeInfo.url) { const url = changeInfo.url.replace("http://",'').replace("https://",''); const redir = redirectUri.replace("http://",'').replace("https://",''); console.log("matching", url, redir); if(url.startsWith(redir)) { resolve(changeInfo.url); console.log('closing tab and resolving with', changeInfo.url); oauthTabs[tabId] = undefined; chrome.tabs.remove(tabId); } } } }); module.exports = { startOAuth }
(function () { angular.module('filmstrip').controller('filmstripController', ['filmstripFactory', filmstripController]); function filmstripController(imageFactory) { this.images = imageFactory.getFilmstripImages(); this.updateSelected = function(url) { console.log('url:', url) } } })();
import React from "react"; import AdmSideBar from "../../components/sidebar_adm/admsidebar"; import LineGraph from "../../components/graficos/line/line_graph"; import BarGraph from "../../components/graficos/bar/bar_graph"; import LineBarArea from "../../components/graficos/area/line_bar_area"; import RadarArea from "../../components/graficos/radar_area/radar_area"; import "./index_admin.css"; export default function UserSelect() { return ( <> <div className="container-fluid"> <div className="row"> <AdmSideBar /> </div> <div className="graph-container"> <LineGraph /> <BarGraph /> </div> <div className="graph-container"> <LineBarArea /> <RadarArea /> </div> </div> </> ); }
function columnsInfo(){ return [ { title: '<i class="fi-flag"></i> Name', data: null, defaultContent: '', class:'text-center', responsivePriority: 1, render: (data, type, row) => renderAsLink(vulnName(data), row) }, { title: '<i class="fi-info"></i> Description', data: 'short_desc', defaultContent: '', class:'text-left', responsivePriority: 3, render: (data, type, row) => renderAsLink(data, row) }, { title: '<i class="fi-megaphone"></i> Date', data: 'announced', defaultContent: '', class:'text-center', responsivePriority: 5, render: function(data, type, row) { return renderAsLink(moment(data).format('MMMM DD, YYYY'), row); } }, { title: '<i class="fi-like"></i>', data: 'upvotes', defaultContent: '0', class:'text-center', responsivePriority: 2, render: (data, type, row) => renderAsLink(data, row) }, { title: '<i class="fi-pricetag-multiple"></i> Tags', data: 'tag_names', defaultContent: '', class:'text-left', responsivePriority: 4, render: (data, type, row) => renderAsLink(data, row) } ]; } function languageInfo() { return { search: "", // nothing in the placeholder; searchPlaceholder: 'Search', lengthMenu: "Show _MENU_", info: "Showing _START_ to _END_ of _TOTAL_ vulnerabilities", infoEmpty: "Showing 0 to 0 of 0 entries", infoFiltered: "(filtered from _MAX_ total vulnerabilities)", }; } function buildTopNav() { $('#datatable_wrapper').prepend('<div id="table-nav-top"></div>'); var nav = $('#table-nav-top'); nav.addClass('table-nav grid-x'); var nav_length = $('#datatable_length'); nav_length.addClass('table-nav-show-entries cell small-2') nav.append(nav_length); nav.append( '<div class="table-nav-filter cell small-3">' + ' <select id="tag_filters" name="tag_filters" class="tag-filter">' + ' <option selected></option>'+ ' <option disabled value> --- Filter by Tags --- </option>'+ ' </select>' + '</div>' ); nav.append( ' <div class="table-nav-more-about text-center cell small-4">' + // ajax call to /api/tags will populate here ' </div>' ); var nav_search = $('#datatable_filter label'); nav_search.addClass('table-nav-search cell small-3') nav.append(nav_search); } function renderAsLink(data, row) { return '<a class="dt_row" href="/vulnerabilities/' + row.id + '">' + data + '</a>'; } function vulnTable(apiUrl, tableName = '#datatable'){ $.ajax({ url: apiUrl, dataType: 'json', success: function(jsonData) { $(tableName).DataTable({ responsive: true, destroy: true, data: jsonData, order: [[3, "desc"]], /* Default sort */ columnDefs: [ { "width": "12%", "targets": 0 } ], columns: columnsInfo(), language: languageInfo(), initComplete: function () { $('#loading').remove(); buildTopNav(); this.api().columns(4).every( function () { var column = this; $('#tag_filters').on( 'change', function () { column.search($(this).val()).draw(); $('.table-nav-more-about-link').hide(); var tag_id = $(this).find(':selected').data('tag-id'); $('#table-nav-tag-' + tag_id).show(); } ); $.ajax({ url: "/api/tags", dataType: "json", success: function (data) { data.sort(function(a, b) { return a.name.localeCompare(b.name); }); $.each(data, function ( index, d ) { $('#tag_filters').append( '<option value="' + d.name + '"' + ' data-tag-id="'+ d.id +'">' + d.name + '</option>' ); $('.table-nav-more-about').append( '<a href="/tags/' + d.id + '" ' + ' class="table-nav-more-about-link"' + ' id="table-nav-tag-' + d.id + '">'+ '<i class="fi-pricetag-multiple"/></i> Learn about ' + d.name + '</a>'); } ); $('.table-nav-more-about-link').hide(); } }); } ); } }); } }); $(tableName).on('mouseover', 'tbody tr', function() { $(this).css({ 'cursor': 'pointer', 'color': 'blue' }); }) $(tableName).on('mouseout', 'tbody tr', function() { $(this).css({ 'cursor': 'default', 'color': 'inherit' }); }) }
/** * Copyright 2016 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ goog.provide('audioCat.utility.dialog.DialogManager'); goog.require('audioCat.ui.dialog.DialogPool'); goog.require('audioCat.ui.dialog.EventType'); goog.require('goog.dom.classes'); goog.require('goog.events'); /** * Manages the display of dialogs. * @param {!audioCat.utility.DomHelper} domHelper Facilitates DOM interactions. * @param {!audioCat.ui.window.ScrollResizeManager} scrollResizeManager Keeps * tracks of window dimensions and scroll. * @param {!audioCat.ui.widget.ButtonPool} buttonPool Pools buttons so that we * don't create too many and can reuse buttons. * @constructor */ audioCat.utility.dialog.DialogManager = function(domHelper, scrollResizeManager, buttonPool) { /** * Facilitates DOM interactions. * @private {!audioCat.utility.DomHelper} */ this.domHelper_ = domHelper; /** * Keeps track of window dimensions and scroll. * @private {!audioCat.ui.window.ScrollResizeManager} */ this.scrollResizeManager_ = scrollResizeManager; /** * Pools buttons so we don't create too many. * @private {!audioCat.ui.widget.ButtonPool} */ this.buttonPool_ = buttonPool; /** * Ensures we don't create too many dialog objects. * @private {!audioCat.ui.dialog.DialogPool} */ this.dialogPool_ = new audioCat.ui.dialog.DialogPool(domHelper, buttonPool); /** * The element shielding the user from interacting with background elements if * the shield is on. Otherwise, null. * @private {Element} */ this.backgroundShield_ = null; /** * The current count of background-shielded dialogs. We can hide the * background shield when this value drops to 0. * @private {number} */ this.backgroundShieldedDialogCount_ = 0; // If we have a background shield, resize it along with the window. scrollResizeManager.callAfterScroll(goog.bind(this.handleResize_, this)); }; /** * Handles what happens when the user resizes the window. Notably, resizes the * shield preventing the user from interacting with the background. * @param {number} xScroll The left/right scroll. * @param {number} yScroll The top/bottom scroll. * @param {number} windowWidth The window width. * @param {number} windowHeight The window height. * @private */ audioCat.utility.dialog.DialogManager.prototype.handleResize_ = function(xScroll, yScroll, windowWidth, windowHeight) { var backgroundShield = this.backgroundShield_; if (!backgroundShield) { return; } backgroundShield.style.width = String(windowWidth) + 'px'; backgroundShield.style.height = String(windowHeight) + 'px'; }; /** * Retrieves a button that was reset from the pool. * @param {!audioCat.ui.dialog.Contentable} content The content for the button. * @return {!audioCat.ui.widget.ButtonWidget} A button widget that was reset. */ audioCat.utility.dialog.DialogManager.prototype.obtainButton = function(content) { return this.buttonPool_.retrieveButton(content); }; /** * Puts a button back into the pool. * @param {!audioCat.ui.widget.ButtonWidget} button The button to put back. */ audioCat.utility.dialog.DialogManager.prototype.putBackButton = function(button) { this.buttonPool_.putBackButton(button); }; /** * Retrieves a customized dialog. * @param {!audioCat.ui.dialog.Contentable} content The dialog content. * @param {?audioCat.ui.dialog.DialogText=} opt_closeText If provided and * true-y, the dialog includes a button for closing the dialog. The text of * this button will be this argument. * @return {!audioCat.ui.dialog.DialogWidget} A dialog box. */ audioCat.utility.dialog.DialogManager.prototype.obtainDialog = function(content, opt_closeText) { var dialogWidget = this.dialogPool_.retrieveDialog(content, opt_closeText); // Hide the dialog if the dialog requests hiding. goog.events.listenOnce(dialogWidget, audioCat.ui.dialog.EventType.HIDE_DIALOG_REQUESTED, this.handleHideDialogRequested_, false, this); return dialogWidget; }; /** * Handles what happens when a dialog requests to be hidden. * @param {!goog.events.Event} event The associated event dispatched by the * dialog widget. * @private */ audioCat.utility.dialog.DialogManager.prototype.handleHideDialogRequested_ = function(event) { this.hideDialog( /** @type {!audioCat.ui.dialog.DialogWidget} */ (event.target)); }; /** * Shows a given dialog. * @param {!audioCat.ui.dialog.DialogWidget} dialogWidget The dialog to show. * @param {boolean=} opt_allowBackgroundInteractions Whether to allow the user * to interact with the background when the dialog shows. Defaults to false. */ audioCat.utility.dialog.DialogManager.prototype.showDialog = function( dialogWidget, opt_allowBackgroundInteractions) { // Hide the dialog. var domHelper = this.domHelper_; // Create a background shield to prevent users from interacting with other // elements. var documentBody = domHelper.getDocument().body; if (!opt_allowBackgroundInteractions) { if (!this.backgroundShield_) { // If nothing shielding the background, make and display one. var shield = domHelper.createDiv(goog.getCssName('backgroundShield')); // Make the shield block the whole screen. // TODO(chizeng): Alter dimensions of the shield when window resizes. var scrollResizeManager = this.scrollResizeManager_; shield.style.width = String(scrollResizeManager.getWindowWidth()) + 'px'; shield.style.height = String(scrollResizeManager.getWindowHeight()) + 'px'; this.backgroundShield_ = shield; domHelper.appendChild(documentBody, shield); } dialogWidget.setShownWithBackgroundShield(true); this.backgroundShieldedDialogCount_++; } var dialogDom = dialogWidget.getDom(); domHelper.appendChild(documentBody, dialogWidget.getDom()); }; /** * Hides a dialog, and puts the dialog back for later use. * @param {!audioCat.ui.dialog.DialogWidget} dialog The dialog to hide. */ audioCat.utility.dialog.DialogManager.prototype.hideDialog = function(dialog) { // Hide the dialog. var domHelper = this.domHelper_; var shownWithBackgroundShield = dialog.getShownWithBackgroundShield(); // The shown with background shield property is reset by this call, so we have // to store its current value before reseting. dialog.noteBeingHidden(); this.dialogPool_.putBackDialog(dialog); if (shownWithBackgroundShield) { this.backgroundShieldedDialogCount_--; if (this.backgroundShieldedDialogCount_ == 0) { // Hide the shield that prevents interactions with the background. domHelper.removeNode(this.backgroundShield_); this.backgroundShield_ = null; } } };
import React from 'react'; import { BrowserRouter as Router, Switch, Route } from 'react-router-dom'; import './App.css'; import 'bootstrap/dist/css/bootstrap.min.css'; import FilmQuiz from './components/FilmQuiz/FilmQuizComponent'; import StartPage from './components/StartPage/StartPageComponent'; function App() { return ( <Router> <div className="App"> <Switch> <Route path="/" exact component={StartPage}/> <Route path="/quiz" component={FilmQuiz}/> </Switch> </div> </Router> ); } export default App;
async ({reflowCtx}) => { const {NumberInput, getInputValues} = reflowCtx.utils const nodeSpec = { key: 'grid', label: 'grid', portSpecs: { 'inputs': { kick: {}, x0: { initialValues: [0], ctx: { getGuiComponent: () => NumberInput } }, x1: { initialValues: [100], ctx: { getGuiComponent: () => NumberInput } }, dx: { initialValues: [10], ctx: { getGuiComponent: () => NumberInput } }, y0: { initialValues: [0], ctx: { getGuiComponent: () => NumberInput } }, y1: { initialValues: [100], ctx: { getGuiComponent: () => NumberInput } }, dy: { initialValues: [10], ctx: { getGuiComponent: () => NumberInput } }, }, 'outputs': { cells: {}, }, }, tickFn ({node}) { if (! node.hasHotInputs()) { return } const inputValues = getInputValues({ node, inputKeys: Object.keys(node.getInputPorts()).filter(key => key !== 'kick') }) const { x0, x1, dx, y0, y1, dy } = inputValues const cells = [] let idx = 0 for (let x = x0; x < x1; x += dx) { for (let y = y0; y < y1; y += dy) { const cell = { idx, shape: { bRect: { x, y, top: y + dy, right: x + dx, bottom: y, left: x, width: dx, height: dy, } } } cell.toString = () => JSON.stringify(cell) cells.push(cell) idx += 1 } } node.getPort('outputs:cells').pushValue(cells) }, } return nodeSpec }
import React from 'react'; const Basket = props => { return ( <div id="basket" onClick={props.basketClick}> <img src="http://zelechow.com.pl/wp-content/uploads/2016/06/shop.png" alt="basket"></img> </div>); } export default Basket;
/** * Implementation for Risk Management service defined in ./risk-service.cds */ module.exports = async (srv) => { srv.after('READ', 'Risks', (risks) => { risks.forEach((risk) => { if (risk.impact >= 100000) { risk.criticality = 1; } else { risk.criticality = 2; } }); }); srv.on('READ', 'Risks', (req, next) => { req.query.SELECT.columns = req.query.SELECT.columns.filter(({ expand, ref }) => !(expand && ref[0] === 'bp')); return next(); }); const BupaService = await cds.connect.to('API_BUSINESS_PARTNER'); srv.on('READ', srv.entities.BusinessPartners, async (req) => { const res = await BupaService.tx(req).run(req.query.redirectTo(BupaService.entities.A_BusinessPartner)) // const res = await BupaService.tx(req).run( // req.query.redirectTo( // srv.model.definitions["sap.ui.riskmanagement.BusinessPartners"] // ) // ); return res; }); }
import React from 'react'; import { Image, StyleSheet } from 'react-native'; const Logo = () => ( <Image source={require('../../assets/logo.jpg')} style={styles.image} /> ); const styles = StyleSheet.create({ image: { width: 330, height: 155, marginBottom: 30, marginLeft: 45 }, }); export default Logo;
import {useEffect, useState} from "react"; import {useRecoilState} from "recoil"; import DailogContent from "~/components/atoms/dialog/DialogContent"; import {StyledDynamicTextBuilder} from "./DynamicTextBuilder.style"; import {addSegmentState, configuratorState, segmentState, tagsState, deleteSegmentState} from "./atoms"; import {findComponentInTree} from "./util/findSegmentInTree"; import DialogActions from "~/components/atoms/dialog/DialogAction"; import Button from "~/components/atoms/button/Button"; import MessageboxStoreManager from "~/components/molecules/Messagebox/MessageboxFactory"; import {messageboxState} from "~/components/molecules/Messagebox/MessageboxAtom"; import RenderComponentGroup from "./render/RenderComponentGroup"; const DynamicTextBuilder = function (props) { const [tags, setTags] = useRecoilState(tagsState); const messageboxStateAtom = useRecoilState(messageboxState); const [openConfigurator, setOpenConfigurator] = useRecoilState(configuratorState); const [updateSegment, setUpdateSegment] = useRecoilState(segmentState); const [addSegment, setAddSegment] = useRecoilState(addSegmentState); const [deleteSegment, setDeleteSegment] = useRecoilState(deleteSegmentState); const [data, setData] = useState([]); const [changeDetected, setChangeDetected] = useState(false); useEffect(() => { setData(props.componentData); }, []); useEffect(() => { setTags(props.tags); }, [props.tags]); useEffect(() => { props.onChange({ target: { name: props.name, value: data, }, }); }, [data]); //Update segment useEffect(() => { if (updateSegment != null) { let newData = JSON.parse(JSON.stringify(data)); const parent = updateSegment.parentId == null ? newData : findComponentInTree(newData, updateSegment.parentId).segment.data; if (parent != null) { let {segment, index} = findComponentInTree(parent, updateSegment.id); segment.data = updateSegment.data; setData(newData); } setChangeDetected(true); setUpdateSegment(null); } }, [updateSegment]); //Add segment useEffect(() => { if (addSegment != null) { let newData = JSON.parse(JSON.stringify(data)); const parent = addSegment.parentId == null ? newData : findComponentInTree(newData, addSegment.parentId).segment.data; if (parent != null) { if (addSegment.segmentId == null) parent.push(addSegment.segment); if (addSegment.segmentId != null) { let {segment, index} = findComponentInTree(parent, addSegment.segmentId); if (addSegment.location == "after") index++; let parentArr = Array.isArray(parent) ? parent : parent.data; parentArr.splice(index, 0, addSegment.segment); } setData(newData); setAddSegment(null); } } }, [addSegment]); //Confirm delete segment useEffect(() => { if (deleteSegment != null) { if (deleteSegment.skipConfirm) { handleDeleteSegment(); return; } MessageboxStoreManager.AddConfirm(messageboxStateAtom, { title: "Segment verwijderen?", content: "Weet je zeker dat je dit segment wilt verwijderen?", confirm: { onClick: handleDeleteSegment, label: "Verwijderen", color: "warning", }, }); } }, [deleteSegment]); //Delete segment const handleDeleteSegment = () => { let newData = JSON.parse(JSON.stringify(data)); const parent = deleteSegment.parentId == null ? newData : findComponentInTree(newData, deleteSegment.parentId).segment; if (parent != null) { const {index} = findComponentInTree(parent, deleteSegment.segmentId); let parentArr = Array.isArray(parent) ? parent : parent.data; parentArr.splice(index, 1); setData(newData); setDeleteSegment(null); } }; //Handle close const handleClose = () => { if (changeDetected) { MessageboxStoreManager.AddConfirm(messageboxStateAtom, { title: "Wijzigingen verwijderen?", content: "Er zijn niet opgeslagen wijzigingen. Als je dit venster sluit worden alle wijzigen verwijderd. Weet je zeker dat je door wilt gaan?", confirm: { onClick: props.onClose, }, }); } else { props.onClose(); } }; return ( <StyledDynamicTextBuilder> <div className="header-title">Dynamische tekst</div> <RenderComponentGroup components={data} /> </StyledDynamicTextBuilder> ); }; export default DynamicTextBuilder;
/* begin copyright text * * Copyright © 2017 PTC Inc., Its Subsidiary Companies, and /or its Partners. All Rights Reserved. * * end copyright text */ /* jshint node: true */ /* jshint strict: global */ /* jshint camelcase: false */ 'use strict'; var debug = require('debug')("vxs:limitshelper"); var Q = require("q"); var systemSettings = require('../../config/system.json'); var settingTableName = systemSettings.db.tables.SETTING; var repsTableName = systemSettings.reps.tableName; var eventCountTableName = systemSettings.db.tables.EVENTCOUNT; function LimitsHelper(){} LimitsHelper.checkModelLimit = function checkModelLimit(dbHandler, namespaceId){ debug("Checking model limit for namespaceId=", namespaceId); var where = "namespaceid = ? and category = 'license' and name = 'modellimit'"; var deferred = Q.defer(); return dbHandler.selectWithParams(['value'], settingTableName, where, [namespaceId]) .then(function(rows){ if (rows && rows.length >0 ){ if (rows[0].value !== null){ var limit = Number(rows[0].value); debug("Models limit=", limit); return dbHandler.selectWithParams(['count(*) AS count'], repsTableName, "namespace = ?", [namespaceId]) .then(function(rows) { var count = Number(rows[0]['count']); debug("Models count=" + count); if (count >= limit) { var err = new Error("The maximum number of models has been reached."); err.http_code = 403; deferred.reject(err); } else { deferred.resolve(); } return deferred.promise; }); } else { debug("Model limit is set to 'unlimited'"); deferred.resolve(); } } else { debug("Model limit property is not set"); deferred.resolve(); } return deferred.promise; }); }; LimitsHelper.checkViewLimit = function checkViewLimit(dbHandler, namespaceId){ debug("Checking rep views limit for namespaceId=", namespaceId); var where = "namespaceid = ? and category = 'license' and name = 'viewlimit'"; var deferred = Q.defer(); return dbHandler.selectWithParams(['value'], settingTableName, where, [namespaceId]) .then(function(rows){ if (rows && rows.length >0 ){ if (rows[0].value !== null){ var limit = Number(rows[0].value); debug("View limit=", limit); //TODO: RepViewEvent.eventtype return dbHandler.selectWithParams(['count'], eventCountTableName, "namespaceid = ? and eventtype = 'repview'", [namespaceId]) .then(function(rows) { if (rows && rows.length >0 ){ var count = rows[0]['count']; debug("View count=" + count); if (count >= limit) { var err = new Error("The maximum number of views has been reached"); err.status = 403; err.errorCode = "MAX_VIEW_LIMIT_REACHED"; deferred.reject(err); } else { deferred.resolve(); } } else { debug("Cannot find event count for rep view event"); deferred.resolve(); } return deferred.promise; }); } else { debug("Rep view limit is set to 'unlimited'"); deferred.resolve(); } } else { debug("Rep view limit property is not set"); deferred.resolve(); } return deferred.promise; }); }; module.exports = LimitsHelper;
import React from "react"; import PropTypes from "prop-types"; class EditTweetModal extends React.Component { constructor(props) { super(props); const { tweet } = this.props; this.state = { tweetText: tweet.content, selectedImage: "", image: "" }; this.onTweetImageChange = e => { this.setState({ selectedImage: window.URL.createObjectURL(e.target.files[0]), image: e.target.files[0] }); }; this.onTweetTextChange = e => { this.setState({ tweetText: e.target.value }); }; this.onConfirmButtonClicked = () => { const { onCanceled, onConfirmed, tweet } = this.props; const { tweetText, image } = this.state; onConfirmed({ tweetId: tweet.tweetId, content: tweetText, image }); onCanceled(false); }; } componentDidMount() { const { tweet } = this.props; this.setState({ selectedImage: tweet.imageUrl }); } render() { const { onCanceled, tweetImage } = this.props; const { tweetText, selectedImage } = this.state; return ( <div className="container"> <div> <textarea value={tweetText} onChange={this.onTweetTextChange} rows="6" cols="40" /> <div> <img width="200" src={selectedImage ? selectedImage : tweetImage} /> <input onChange={this.onTweetImageChange} type="file" /> </div> </div> <div> <button className="close" onClick={() => onCanceled(false)}> Cancel </button> <button className="close" onClick={this.onConfirmButtonClicked}> Confirm </button> </div> <style jsx>{` .container { position: absolute; top: 10rem; left: 15rem; width: 10rem; height: 10rem; background: lightGray; padding: 30px; width: 450px; height: 300px; } button.close { marginbottom: 1rem; } `}</style> </div> ); } } EditTweetModal.propTypes = { toggleModal: PropTypes.func.isRequired, onLogoutButtonClicked: PropTypes.func.isRequired, onCanceled: PropTypes.func.isRequired, onConfirmed: PropTypes.func.isRequired, tweet: PropTypes.shape().isRequired, tweetImage: PropTypes.string.isRequired }; export default EditTweetModal;
const { gql } = require('apollo-server-express') const { makeExecutableSchema } = require('@graphql-tools/schema') const { constraintDirective, constraintDirectiveTypeDefs } = require('graphql-constraint-directive') const deepmerge = require('deepmerge') const directives = require('../../directives') const globalTypeDefs = gql` type Query type Mutation type Subscription ` const makeExecutableSchemaFromModules = ({ modules }) => { let typeDefs = [ constraintDirectiveTypeDefs, globalTypeDefs, ...directives.typeDefs, ] let resolvers ={ } modules.forEach(module => { typeDefs = [ ...typeDefs, ...module.typeDefs ] resolvers = deepmerge(resolvers,module.resolvers) }) return makeExecutableSchema({ typeDefs, schemaDirectives: { ...directives.schemaDirectives, }, schemaTransforms: [constraintDirective()], resolvers, }) } module.exports = { makeExecutableSchemaFromModules }
import React, { Component } from "react"; import _ from "lodash"; import Input from "../commons/Input"; import DateSelector from "../commons/DateSelector"; import PropTypes from "prop-types"; import PriorityCircle from "../commons/PriorityCircle"; import { nextPriorityOf } from "../commons/priority"; import InputGroup from "../commons/InputGroup"; import { connect } from "react-redux"; import { requestPostTodo } from "../../actions/ajaxActions"; const emptyTodo = { title: "", content: "", due: null, done: false, priority: 1 }; class NewTodoForm extends Component { state = { newTodo: emptyTodo, formOpened: false }; handleDueToggle = () => { const newTodo = { ...this.state.newTodo }; newTodo.due = newTodo.due ? null : new Date(); this.setState({ newTodo }); }; handleFormOpenedToggle = () => { const formOpened = !this.state.formOpened; this.setState({ formOpened, newTodo: emptyTodo }); }; handlePriorityChange = () => { const newTodo = { ...this.state.newTodo }; newTodo.priority = nextPriorityOf(newTodo.priority); this.setState({ newTodo }); }; handleChange = ({ currentTarget }) => { const newTodo = { ...this.state.newTodo }; newTodo[currentTarget.name] = currentTarget.value; this.setState({ newTodo }); }; handleSelectDate = ({ currentTarget }) => { if (!this.state.newTodo.due) return; const { name, value } = currentTarget; const newTodo = { ...this.state.newTodo }; const due = new Date(newTodo.due); switch (name) { case "year": due.setFullYear(value); break; case "month": due.setMonth(value - 1); break; case "date": due.setDate(value); break; default: console.error("due date를 설정하는 도중에 문제가 발생했습니다."); return; } newTodo.due = due; this.setState({ newTodo }); }; renderPriorityInput = () => { const { newTodo } = this.state; return ( <InputGroup label="중요도"> <PriorityCircle item={newTodo} className="priority-input-circle" onPriorityChange={this.handlePriorityChange} showLabel={true} /> </InputGroup> ); }; renderControllButton = () => { const { newTodo } = this.state; const { onAddTodo } = this.props; return this.state.formOpened ? ( <> <input className={`new-todo-control-btn ${!newTodo.title ? "disabled" : ""}`} type="submit" form="new-todo-form" onClick={e => { e.preventDefault(); if (!newTodo.title) return; onAddTodo(newTodo); this.handleFormOpenedToggle(); }} value="확인" /> <button onClick={this.handleFormOpenedToggle} className="new-todo-control-btn" > 취소 </button> </> ) : ( <button className="new-todo-control-btn" onClick={this.handleFormOpenedToggle} > 추가 </button> ); }; renderHeader = () => { return ( <div className="new-todo-header"> <h1 className="new-todo-label">새로운 할 일</h1> {this.renderControllButton()} </div> ); }; renderForm = () => { const { newTodo } = this.state; return ( <form onSubmit={() => onAdd(newTodo)} id="new-todo-form"> <Input name="title" value={newTodo.title} placeholder="새 TODO의 제목을 입력하세요." onChange={this.handleChange} maxLength={50} label="제목" focus="true" /> <Input name="content" value={newTodo.content} placeholder="상세 내용을 입력하세요." onChange={this.handleChange} maxLength={500} label="내용" type="textarea" /> {this.renderPriorityInput()} <button className="new-todo-control-btn toggle-due-btn" onClick={e => { e.preventDefault(); this.handleDueToggle(); }} > {newTodo.due ? "기한 필요 없어요" : "기한을 둘 거에요 ⏰"} </button> {newTodo.due ? ( <DateSelector date={newTodo.due} onChange={this.handleSelectDate} label="기한" /> ) : ( "" )} </form> ); }; render() { const { formOpened } = this.state; return ( <div className="new-todo"> {this.renderHeader()} {formOpened ? this.renderForm() : ""} </div> ); } } const mapDispatchToProps = dispatch => { return { onAddTodo: todo => dispatch(requestPostTodo(todo)) }; }; export default connect( () => ({}), mapDispatchToProps )(NewTodoForm);
import Router from "next/router"; export const redirect = (url) => { Router.push(url); };
import React from "react"; import { Box, Chip, makeStyles, } from "@material-ui/core"; const useStyles = makeStyles((theme) => ({ selectedNumber: { color: '#fff', backgroundColor: 'red', width: 40, height: 40, margin: 8, fontSize: 14, fontWeight: 'bold', }, nonSelectedNumber: { color: '#fff', backgroundColor: 'green', width: 40, height: 40, margin: 8, fontSize: 14, fontWeight: 'bold', }, currentNumber: { color: '#fff', backgroundColor: 'blue', width: 40, height: 40, margin: 8, fontSize: 14, fontWeight: 'bold', } })); const NumberCard = (props) => { const classes = useStyles(); const {calledOutNumber, currentNumber} = props // const allNumbers = Array.from({length: 90}, (_, i) => i + 1); const allNumbers = [ [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25, 26, 27, 28, 29, 30], [31, 32, 33, 34, 35, 36, 37, 38, 39, 40], [41, 42, 43, 44, 45, 46, 47, 48, 49, 50], [51, 52, 53, 54, 55, 56, 57, 58, 59, 60], [61, 62, 63, 64, 65, 66, 67, 68, 69, 70], [71, 72, 73, 74, 75, 76, 77, 78, 79, 80], [81, 82, 83, 84, 85, 86, 87, 88, 89, 90] ] return ( <Box display="flex" flexWrap='wrap'> {allNumbers.map((numberRow, index1) => ( <Box key={index1}> {numberRow.map((number, index2) => ( <Box key={number} border="2px solid black"> <Chip size={"medium"} label={number} className={ calledOutNumber.includes(number) ? ( number === currentNumber ? classes.currentNumber : classes.selectedNumber) : classes.nonSelectedNumber}/> </Box> ))} </Box> ))} </Box> ); }; export default NumberCard;
import React from 'react' import {Link} from 'react-router-dom'; function Assessments() { return ( <React.Fragment> <h2><Link style={LinkStyle} to="/assessment/create">Book an assessment</Link>{' '}</h2> {/* <h2><Link style={LinkStyle} to="/assessment/delete">Delete my Account</Link>{' '}</h2> <h2><Link style={LinkStyle} to="/partner/update">Update My Profile</Link>{' '}</h2> */} <h2><Link style={LinkStyle} to="/assessment/view">View all assessments</Link>{' '}</h2> </React.Fragment> ) } export default Assessments; const LinkStyle={ color:'#000' }
/* * jquery.zoomooz-core.js, part of: * http://janne.aukia.com/zoomooz * * Version history: * 1.04 fixed examples, iphone tuneups, transform offset fix * 1.03 added closeclick, code structuring * 1.02 bug fix on endcallback resetting for native animation * 1.01 declarative syntax and fixes * 0.92 working scrolling * 0.91 simplifying code base and scrolling for non-body zoom roots * 0.90 fixing margin on first body child * 0.89 support for jquery 1.7 * 0.88 fixed a bug with 90 deg rotations * 0.87 fixed a bug with settings and a couple of demos * 0.86 fixed a bug with non-body zoom root * 0.85 basic IE9 support * 0.81 basic support for scrolling * 0.80 refactored position code to a separate file * 0.72 fixed a bug with skew in Webkit * 0.71 fixed bugs with FF4 * 0.70 support for non-body zoom root * 0.69 better settings management * 0.68 root element tuning * 0.67 adjustable zoom origin (not fully working yet) * 0.65 zoom origin to center * 0.63 basic Opera support * 0.61 refactored to use CSSMatrix classes * 0.51 initial public version * * LICENCE INFORMATION: * * Copyright (c) 2010 Janne Aukia (janne.aukia.com) * Dual licensed under the MIT (MIT-LICENSE.txt) * and GPL Version 2 (GPL-LICENSE.txt) licenses. * * LICENCE INFORMATION FOR DERIVED FUNCTIONS: * * Function computeTotalTransformation based * on jquery.fn.offset, copyright John Resig, 2010 * (MIT and GPL Version 2). * */ /*jslint sub: true */ (function($) { "use strict"; //**********************************// //*** Variables ***// //**********************************// var helpers = $.zoomooz.helpers; var animationSettings = ["duration", "easing", "nativeanimation"]; //**********************************// //*** Static setup ***// //**********************************// setupCssStyles(); //**********************************// //*** jQuery functions ***// //**********************************// if(!$.zoomooz) { $.zoomooz = {}; } /* this can be used for setting the default settings for zoomooz explicitly. */ $.zoomooz.setup = function(settings) { $.zoomooz.defaultSettings = jQuery.extend(constructDefaultSettings(), settings); }; /* returns the zooming settings of a particular element. used by zoomTarget. */ $.fn.zoomSettings = function(settings) { var retValue; this.each(function() { var $elem = $(this); retValue = setupElementSettings($elem, settings); }); return retValue; } /* the main zooming method. */ $.fn.zoomTo = function(settings, skipElementSettings) { this.each(function() { var $this = $(this); if(!skipElementSettings) { settings = $this.zoomSettings(settings); } zoomTo($this, settings); if(settings.debug) { if($("#debug").length===0) { $(settings.root).append('<div id="debug"><div>'); } else { $("#debug").html(""); } showDebug($this,settings); } else { if($("#debug").length!==0) { $("#debug").html(""); } } }); return this; }; //**********************************// //*** Setup functions ***// //**********************************// function setupElementSettings($elem, baseSettings) { var settings = jQuery.extend({}, baseSettings); if(!$.zoomooz.defaultSettings) { $.zoomooz.setup(); } var defaultSettings = $.zoomooz.defaultSettings; var elementSettings = jQuery.extend({},settings); for(var key in defaultSettings) { if (defaultSettings.hasOwnProperty(key) && !elementSettings[key]) { elementSettings[key] = $elem.data(key); } } // FIXME: it would be better, that the animationSettings // would come from the jquery.zoomooz-anim file somehow for(var i=0;i<animationSettings.length;i++) { var key = animationSettings[i]; if(!elementSettings[key]) { elementSettings[key] = $elem.data(key); } } return jQuery.extend({}, defaultSettings, elementSettings); } /* setup css styles in javascript to not need an extra zoomooz.css file for the user to load. having the styles here helps also at keeping the css requirements minimal. */ function setupCssStyles() { var style = document.createElement('style'); style.type = 'text/css'; var transformOrigin = ""; helpers.forEachPrefix(function(prefix) { transformOrigin += prefix+"transform-origin: 0 0;"; },true); // FIXME: how to remove the html height requirement? // FIXME: how to remove the transform origin? style.innerHTML = "html {height:100%;}" + /*".noScroll{overflow:hidden !important;}" +*/ ".noScroll{}" + "body.noScroll,html.noScroll body{margin-right:15px;}" + "* {"+transformOrigin+"}"; document.getElementsByTagName('head')[0].appendChild(style); } function constructDefaultSettings() { return { targetsize: 0.9, scalemode: "both", root: $(document.body), debug: false, animationendcallback: null, closeclick: false }; } //**********************************// //*** Main zoom function ***// //**********************************// function zoomTo(elem, settings) { var scrollData = handleScrolling(elem, settings); var rootTransformation; var animationendcallback = null; setTransformOrigin(settings.root); // computeTotalTransformation does not work correctly if the // element and the root are the same if(elem[0] !== settings.root[0]) { var inv = computeTotalTransformation(elem, settings.root).inverse(); rootTransformation = computeViewportTransformation(elem, inv, settings); if(settings.animationendcallback) { animationendcallback = function() { settings.animationendcallback.call(elem[0]); }; } } else { rootTransformation = (new PureCSSMatrix()).translate(-scrollData.x,-scrollData.y); animationendcallback = function() { var $root = $(settings.root); var $scroll = scrollData.elem; $scroll.removeClass("noScroll"); $root.setTransformation(new PureCSSMatrix()); $root.data("original-scroll",null); $(document).off("touchmove"); // this needs to be after the setTransformation and // done with window.scrollTo to not have iPhone repaints if($scroll[0]==document.body || $scroll[0]==window) { window.scrollTo(scrollData.x,scrollData.y); } else { $scroll.scrollLeft(scrollData.x); $scroll.scrollTop(scrollData.y); } if(settings.animationendcallback) { settings.animationendcallback.call(elem[0]); } }; } var animationstartedcallback = null; if(scrollData && scrollData.animationstartedcallback) { animationstartedcallback = scrollData.animationstartedcallback; } $(settings.root).animateTransformation(rootTransformation, settings, animationendcallback, animationstartedcallback); } //**********************************// //*** Handle scrolling ***// //**********************************// function handleScrolling(elem, settings) { var $root = settings.root; var $scroll = $root.parent(); if(elem[0] === $root[0]) { var scrollData = $root.data("original-scroll"); if(scrollData) { return scrollData; } else { return {"elem": $scroll, "x":0,"y:":0}; } } else if(!$root.data("original-scroll")) { // safari var scrollY = $root.scrollTop(); var scrollX = $root.scrollLeft(); var elem = $root; // moz if(!scrollY) { scrollY = $scroll.scrollTop(); scrollX = $scroll.scrollLeft(); elem = $scroll; } var scrollData = {"elem":elem,"x":scrollX,"y":scrollY}; $root.data("original-scroll",scrollData); $(document).on("touchmove", function(e) { e.preventDefault(); }); var transformStr = "translate(-"+scrollX+"px,-"+scrollY+"px)"; helpers.forEachPrefix(function(prefix) { $root.css(prefix+"transform", transformStr); }); elem.addClass("noScroll"); scrollData.animationstartedcallback = function() { // this needs to be after the setTransformation and // done with window.scrollTo to not have iPhone repaints if(elem[0]==document.body || elem[0]==document) { window.scrollTo(0,0); } else { elem.scrollLeft(0); elem.scrollTop(0); } }; return scrollData; } } //**********************************// //*** Element positioning ***// //**********************************// function setTransformOrigin(zoomParent) { var zoomViewport = $(zoomParent).parent(); var dw = zoomViewport.width(); var dh = zoomViewport.height(); var xrotorigin = dw/2.0; var yrotorigin = dh/2.0; var offsetStr = printFixedNumber(xrotorigin)+"px "+printFixedNumber(yrotorigin)+"px"; helpers.forEachPrefix(function(prefix) { zoomParent.css(prefix+"transform-origin", offsetStr); }); } function computeViewportTransformation(elem, endtrans, settings) { var zoomAmount = settings.targetsize; var zoomMode = settings.scalemode; var zoomParent = settings.root; var zoomViewport = $(zoomParent).parent(); var dw = zoomViewport.width(); var dh = zoomViewport.height(); var relw = dw/elem.outerWidth(); var relh = dh/elem.outerHeight(); var scale; if(zoomMode=="width") { scale = zoomAmount*relw; } else if(zoomMode=="height") { scale = zoomAmount*relh; } else if(zoomMode=="both") { scale = zoomAmount*Math.min(relw,relh); } else if(zoomMode=="scale") { scale = zoomAmount; } else { console.log("wrong zoommode"); return; } var xoffset = (dw-elem.outerWidth()*scale)/2.0; var yoffset = (dh-elem.outerHeight()*scale)/2.0; var xrotorigin = dw/2.0; var yrotorigin = dh/2.0; /* fix for body margins, hope that this does not break anything .. */ /* see also the part of the fix that is in computeTotalTransformation! */ var xmarginfix = -parseFloat(zoomParent.css("margin-left")) || 0; var ymarginfix = -parseFloat(zoomParent.css("margin-top")) || 0; var viewportTransformation = (new PureCSSMatrix()) .translate(xmarginfix,ymarginfix) .translate(-xrotorigin,-yrotorigin) .translate(xoffset,yoffset) .scale(scale,scale) .multiply(endtrans) .translate(xrotorigin,yrotorigin); return viewportTransformation; } //**********************************// //*** Debugging positioning ***// //**********************************// function calcPoint(e,x,y) { return [e.a*x+e.c*y+e.e,e.b*x+e.d*y+e.f]; } function showDebug(elem, settings) { var e = computeTotalTransformation(elem, settings.root).elements(); displayLabel(calcPoint(e,0,0)); displayLabel(calcPoint(e,0,elem.outerHeight())); displayLabel(calcPoint(e,elem.outerWidth(),elem.outerHeight())); displayLabel(calcPoint(e,elem.outerWidth(),0)); } function displayLabel(pos) { var labelStyle = "width:4px;height:4px;background-color:red;position:absolute;margin-left:-2px;margin-top:-2px;"; labelStyle += 'left:'+pos[0]+'px;top:'+pos[1]+'px;'; var label = '<div class="debuglabel" style="'+labelStyle+'"></div>'; $("#debug").append(label); } //**********************************// //*** Calculating element ***// //*** total transformation ***// //**********************************// /* Based on: * jQuery.fn.offset */ function computeTotalTransformation(input, transformationRootElement) { var elem = input[0]; if( !elem || !elem.ownerDocument ) { return null; } var totalTransformation = new PureCSSMatrix(); var trans; if ( elem === elem.ownerDocument.body ) { var bOffset = jQuery.offset.bodyOffset( elem ); trans = new PureCSSMatrix(); trans = trans.translate(bOffset.left, bOffset.top); totalTransformation = totalTransformation.multiply(trans); return totalTransformation; } var support; if(jQuery.offset.initialize) { jQuery.offset.initialize(); support = { fixedPosition:jQuery.offset.supportsFixedPosition, doesNotAddBorder:jQuery.offset.doesNotAddBorder, doesAddBorderForTableAndCells:jQuery.support.doesAddBorderForTableAndCells, subtractsBorderForOverflowNotVisible:jQuery.offset.subtractsBorderForOverflowNotVisible } } else { support = jQuery.support; } var offsetParent = elem.offsetParent; var doc = elem.ownerDocument; var computedStyle; var docElem = doc.documentElement; var body = doc.body; var root = transformationRootElement[0]; var defaultView = doc.defaultView; var prevComputedStyle; if(defaultView) { prevComputedStyle = defaultView.getComputedStyle( elem, null ); } else { prevComputedStyle = elem.currentStyle; } /* function offsetParentInsideRoot($elem, $root) { // FIXME: // wondering, should this be $root.closest() // or $root.parent().closest... var $viewport = $root.parent(); var $offsetParent = $elem.offsetParent(); return ($viewport[0]==$offsetParent[0]) || $viewport.closest($offsetParent).length==0; } console.log("inside root",offsetParentInsideRoot(input, transformationRootElement)); */ var top = elem.offsetTop; var left = elem.offsetLeft; var transformation = constructTransformation().translate(left,top); transformation = transformation.multiply(constructTransformation(elem)); totalTransformation = transformation.multiply((totalTransformation)); // loop from node down to root while ( (elem = elem.parentNode) && elem !== root) { top = 0; left = 0; if ( support.fixedPosition && prevComputedStyle.position === "fixed" ) { break; } computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle; top -= elem.scrollTop; left -= elem.scrollLeft; if ( elem === offsetParent ) { top += elem.offsetTop; left += elem.offsetLeft; if ( support.doesNotAddBorder && !(support.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.nodeName)) ) { top += parseFloat( computedStyle.borderTopWidth ) || 0; left += parseFloat( computedStyle.borderLeftWidth ) || 0; } offsetParent = elem.offsetParent; } if ( support.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) { top += parseFloat( computedStyle.borderTopWidth ) || 0; left += parseFloat( computedStyle.borderLeftWidth ) || 0; } prevComputedStyle = computedStyle; if(elem.offsetParent==root) { top -= parseFloat($(elem.offsetParent).css("margin-top")) || 0; left -= parseFloat($(elem.offsetParent).css("margin-left")) || 0; } transformation = constructTransformation().translate(left,top); transformation = transformation.multiply(constructTransformation(elem)); totalTransformation = transformation.multiply(totalTransformation); } top = 0; left = 0; // fixme: should disable these for non-body roots? if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) { top += body.offsetTop; left += body.offsetLeft; } if ( support.fixedPosition && prevComputedStyle.position === "fixed" ) { top += Math.max( docElem.scrollTop, body.scrollTop ); left += Math.max( docElem.scrollLeft, body.scrollLeft ); } var itertrans = (new PureCSSMatrix()).translate(left,top); totalTransformation = totalTransformation.multiply(itertrans); return totalTransformation; } //**********************************// //*** Helpers ***// //**********************************// function printFixedNumber(x) { return Number(x).toFixed(6); } function constructTransformation(elem) { var rawTrans = helpers.getElementTransform(elem); if(!rawTrans) { return new PureCSSMatrix(); } else { return new PureCSSMatrix(rawTrans); } } })(jQuery);
function UrlLoader(){ } UrlLoader.prototype = { isValidUrl: function(url){ if(!url) { alert('Invalid input entered.'); return false; } else{ return true; } }, loadUrl: function(url){ url = prompt('please enter a url'); if(this.isValidUrl(url)){ //trim url and open in new frame. if(url.indexOf('http://') == -1){ url = 'http://' + url; } window.open(encodeURI(url), 'newframe', 'height=450,width=400,menubar=no,toolbar=no,scrollbars=no,location=no,status=no,resizable=no'); } } } document.addEventListener('DOMContentLoaded', function(){ var urlLoader = new UrlLoader(); urlLoader.loadUrl(); });
import React, { Component, PropTypes } from 'react' import { Map, OrderedMap } from 'immutable' import logger from '../debug' import EventList from './EventList.jsx' import SessionRecord from '../model/SessionRecord' import EventRecord from '../model/EventRecord' import { Row, Col, Button, ButtonGroup } from '../components/layout' const log = logger('EventClock') export default class EventClock extends Component { static propTypes = { session: PropTypes.instanceOf(SessionRecord).isRequired, events: PropTypes.instanceOf(OrderedMap).isRequired, templates: PropTypes.instanceOf(Map).isRequired, currentEvent: PropTypes.instanceOf(EventRecord).isRequired, createEvent: PropTypes.func.isRequired, deleteEvent: PropTypes.func.isRequired, endEvents: PropTypes.func.isRequired } hasTerminated() { return this.props.currentEvent.isEnd } createEventButton(template) { const create = template.eventCreator(this.props.session._id) const disabled = this.props.currentEvent.name === template.name || this.hasTerminated() return <Button key={template._id} onClick={this.props.createEvent.bind(this, create)} disabled={disabled}>{template.name}</Button> } endEventsButton() { return <Button bsStyle="warning" outline={true} onClick={this.props.endEvents.bind(this, this.props.session._id)} disabled={this.hasTerminated()}>stop</Button> } render() { return ( <div> <Row> <Col xs={12} sm={12}> <ButtonGroup marginBottom={1}> {this.props.templates.toIndexedSeq().map(template => this.createEventButton(template) )} {this.endEventsButton()} </ButtonGroup> </Col> </Row> <EventList events={this.props.events} deleteEvent={this.props.deleteEvent} hasTerminated={this.hasTerminated()}/> </div> ) } }
//檢查屬性與擷取屬性值 let firstItem = document.getElementById('one');//取得第一個清單項目 if(firstItem.hasAttribute('class')){//若存在名稱為class的屬性 let attr = firstItem.getAttribute('class'); //取得屬性 let el = document.getElementById('scriptResults'); el.innerHTML = '<p>The first item has a class name: ' + attr +'</p>'; }
import styled from 'styled-components'; export const ResponsiveWrapper = styled('div')` @media (max-width: 768px) { h4 { font-size: 10px; } } `;
function addandremove(arr){ let res = []; for(let i = 0; i < arr.length; i++){ switch(arr[i]){ case 'add': res.push(i+1); break; case 'remove': res.pop(); } } if(res.length!=0) res.forEach(element => { console.log(element); }); else{ console.log('Empty'); } }
arr = [10, 200, 30, 500]; function printMaxArray(arr) { let max = -Infinity; for(let i = 0; i < arr.length; i++) { if(arr[i] > max) { max = arr[i] } } console.log(max) } printMaxArray(arr);
import React from "react"; import { BrowserRouter, Switch, Route, Redirect } from "react-router-dom"; import Home from "./components/Home"; import Judet from "./components/Judet/Judet"; import MobileInstallInfo from "./components/MobileInstallInfo"; import PlanMondial from "./components/PlanMondial"; const Router = (props) => ( <React.Fragment> <BrowserRouter> <Switch> <Route exact path="/" component={Home} /> <Route path="/judet/:id/:countyName/:countyCode" component={Judet} /> <Route path="/mobile-install-info" component={MobileInstallInfo} /> <Route path="/plan-mondial" component={PlanMondial} /> {/* <Route path="/info-judete" component={NivelJudete} /> */} <Redirect to="/" /> </Switch> </BrowserRouter> </React.Fragment> ); export default Router;
const { User } = require('../../models'); const { createToken } = require('../../utilities/tokenService'); const cookieOptions = { httpOnly: true, // secure: true, on deployment signed: true, maxAge: (1000 * 60) ^ 60, expiresIn: new Date(Date.now() + 90000) }; const signup = async function(req, res) { try { let user = await User.create(req.body); let token = await createToken(user); res.cookie('token', token, cookieOptions); res.redirect('/api/users/authorized'); } catch (err) { if (err) throw err; } }; module.exports = signup;
define(function (require) { 'use strict'; var Controller = require('controller'), Grid = require('grid'), Rdr = require('rdr'), Terrain = require('terrain'), Viewport = require('view/viewport'), CreateBuildingView = require('view/create/building'); var Settings = { rdr: {}, viewport: {}, }; // Setup renderer var rdr = new Rdr(Settings.rdr); function GameController () { Controller.apply(this, arguments); } _.extend(GameController.prototype, Controller.prototype, { units: [], init: function () { var self = this; console.log('gamecontroller:init'); this.menu = this.options.menu; this._setupMenuListeners(); // Create and render viewport this.viewport = this.addView(new Viewport(Settings.viewport), 'viewport'); this.parentView.el.appendChild(this.viewport.render()); setTimeout(this.install.bind(this)); }, install: function () { }, _setupMenuListeners: function () { this.menu.getView().on('create:grid', this.createGrid.bind(this)); this.menu.getView().on('create:unit', this.createUnit.bind(this)); this.menu.getView().on('create:building', this.createBuilding.bind(this)); }, createGrid: function () { var self = this; this.viewport.showNotice('creating grid'); this.viewport.removeGrid(); setTimeout(function () { self._createGrid(); self.viewport.hideNotice(); }, 200); }, _createGrid: function () { console.time('create:grid'); this.grid = new Grid(100,100,2); console.timeEnd('create:grid'); console.time('create:terrain'); this.terrain = Terrain.generate(this.grid); console.timeEnd('create:terrain'); console.time('create:render'); this.viewport.insertGrid(rdr.grid(this.grid).render( this.viewport.el.offsetWidth, this.viewport.el.offsetHeight )); console.timeEnd('create:render'); this.viewport.hideNotice(); }, createBuilding: function () { alert('create:building'); }, createUnit: function () { alert('create:unit'); }, run: function () { console.log('gamecontroller:run'); } }); return GameController; });
import { GROUP_ID } from "settings/apiConfig"; import callApi from "utils/callApi"; const userApi = { loginApi(user) { return callApi('QuanLyNguoiDung/DangNhap', 'POST', user); }, signupApi(user) { return callApi('QuanLyNguoiDung/DangKy', 'POST', user); }, fetchUserInfoApi(user) { return callApi('QuanLyNguoiDung/ThongTinTaiKhoan', 'POST', user); }, addUserApi(user, token) { return callApi('QuanLyNguoiDung/ThemNguoiDung', 'POST', user, token); }, editUserApi(user, token) { return callApi('QuanLyNguoiDung/CapNhatThongTinNguoiDung', 'PUT', user, token); }, deleteUserApi(taiKhoan, token) { return callApi(`QuanLyNguoiDung/XoaNguoiDung?TaiKhoan=${taiKhoan}`, 'DELETE', taiKhoan, token); }, findUserApi(groupID, keyword) { return callApi(`QuanLyNguoiDung/TimKiemNguoiDung?MaNhom=${groupID}&tuKhoa=${keyword}`, 'GET', groupID, keyword); }, fetchAllUserApi() { return callApi(`QuanLyNguoiDung/LayDanhSachNguoiDung?MaNhom=${GROUP_ID}`, 'GET') }, }; export default userApi;
(function(ko, $) { ko.testBase = function(model, element, test) { element.appendTo("body"); ko.applyBindings(model, element[0]); var args = { clean: function() { element.remove(); } }; if (test) { test(element, args); } if (!args.async) { args.clean(); } }; ko.test = function(tag, convention, model, test, prepElement) { var element = $("<" + tag + "/>"); element.attr("data-name", convention); if (prepElement !== undefined) prepElement(element); ko.testBase(model, element, test); }; ko.virtualElementTest = function(convention, innerContent, model, test) { var virtualElement = $("<div><!-- ko name: " + convention + "-->" + innerContent + "<!-- /ko--></div>"); ko.testBase(model, virtualElement, test); }; })(window.ko, window.jQuery);
import { tokens } from '@sparkpost/design-tokens'; const lineHeight = '25px'; const fontSize = tokens.fontSize_200; export const pre = props => ` position: relative; display: grid; grid-template-columns: ${tokens.spacing_700} auto; font-family: ${tokens.fontFamily_monospace}; border-radius: ${tokens.borderRadius_100}; background-color: ${props.dark ? tokens.color_gray_900 : tokens.color_gray_100}; border: 1px solid ${tokens.color_gray_400}; overflow: scroll; padding: ${tokens.spacing_600} ${tokens.spacing_400} ${tokens.spacing_600} 0; `; export const code = props => ` position: absolute; padding: ${tokens.spacing_600} ${tokens.spacing_600} ${tokens.spacing_600} ${tokens.spacing_800}; color: ${props.dark ? tokens.color_white : tokens.color_gray_800}; font-size: ${fontSize}; line-height: ${lineHeight}; `; export const line = props => ` display: block; text-align: right; line-height: ${lineHeight}; font-size: ${fontSize}; color: ${props.dark ? tokens.color_white : tokens.color_gray_700}; user-select: none; `; export const prefix = () => ` padding-right: ${tokens.spacing_200}; `; export const chevron = () => ` width: ${tokens.fontSize_400}; height: ${tokens.fontSize_400}; fill: ${tokens.color_gray_500}; `;
// Import react import React from 'react' import PropTypes from 'prop-types' // Redux connector import { connect } from 'react-redux' import * as contacts from '../redux/actions-contacts' import * as meetings from '../redux/actions-meetings' // Dumb components import { List, Person } from './contact-list-dumb' class ContactList extends React.Component { constructor( props ) { super( props ) this.state = { showingperson: false, showall: false, editingperson: false } this.currentperson = this.currentperson.bind( this ) this.showPerson = this.showPerson.bind( this ) this.resetPerson = this.resetPerson.bind( this ) this.showAllToggle = this.showAllToggle.bind( this ) this.savePerson = this.savePerson.bind( this ) this.toggleEditPerson = this.toggleEditPerson.bind( this ) this.deleteMeeting = this.deleteMeeting.bind( this ) } // Setting the id of the person we're interacting with in the state showPerson( e ) { e.preventDefault( ) this.setState( { ...this.state, showingperson: e.target.id } ) } // Clear person id in the state resetPerson( e ) { e.preventDefault( ) this.setState( { ...this.state, showingperson: false } ) } // Toggle whether or not we are currently editing the person we are viewing toggleEditPerson( e ) { this.state.editingperson ? this.setState( { ...this.state, editingperson: false } ) : this.setState( { ...this.state, editingperson: true } ) } // Save the new person details we put in the editable fields savePerson( e ) { e.preventDefault( ) const { id, name, bio, frequency } = e.target const newdata = {} if ( name.value.length > 0 ) newdata.name = name.value if ( bio.value.length > 0 ) newdata.bio = bio.value if ( frequency.value.length > 0 ) newdata.frequency = frequency.value this.props.dispatch( contacts.savechanges( id.value, newdata ) ) this.toggleEditPerson( ) } currentperson( ) { if ( this.state.showingperson) return this.props.contacts.object[this.state.showingperson] return false } // Whether only to show overdue of all contacts on the main page showAllToggle( ) { this.state.showall ? this.setState( { ...this.state, showall: false } ) : this.setState( { ...this.state, showall: true } ) } // Delete meeting deleteMeeting( e, meetid, personid ) { e.preventDefault( ) console.log( meetid, personid ) this.props.dispatch( meetings.destroy( personid, meetid ) ).then( console.log.bind( console ) ) } render( ) { const { user, contacts } = this.props // The sort is reversed because we want high priority to come first const list = <main><div className="container"><section><div> <List showall = { this.state.showall } user = { user } show = { this.showPerson } contacts = { contacts.array.sort( ( one, two ) => two.priority > one.priority ? 1 : -1 ) } /> <p className="mouse link center" onClick = { this.showAllToggle }>Show { this.state.showall ? 'overdue only' : 'all contacts' }</p> <Person toggle = { this.toggleEditPerson } editing = { this.state.editingperson } save = { this.savePerson } reset = { this.resetPerson } person = { this.props.contacts.object[this.state.showingperson] } deletemeet = { this.deleteMeeting } /> </div></section></div></main> return user ? list : false } } // Connect the relevant redux data to this component. Contacts can be quite big since it includes meeting data export default connect( store => ( { user: store.user ? true : false, contacts: store.contacts } ) )( ContactList )
import React from 'react'; import './SidebarComponent.css'; import {BrowserRouter as Link} from 'react-router-dom'; function SidebarComponent({active ,Icon, name}) { return ( <div className="SidebarComponent"> <Icon/> <h2>{name}</h2> </div> ) } export default SidebarComponent
const express = require('express'); const app = express(); const PORT = process.env.PORT || 8000; const {spawn} = require('child_process'); //Use Folder app.use(express.static('./dominic')); app.use(express.static('./main')); app.get('/diabetes',(req,res)=>{ res.sendFile(__dirname+"/main/index.html"); }); app.get('/result',(req,res)=>{ var glucose = req.query.glucose; var bmi = req.query.bmi; var age = req.query.age; var bp = req.query.bp; var insulin = req.query.insulin; var dpdf = req.query.dpdf; const pythons = spawn('python',['diabetes.py', glucose,bmi,age,bp,dpdf,insulin]); pythons.stdout.on('data',(data)=>{ res.json(data.toString()); }); }); app.listen(PORT,(err)=>{ if(err){ console.log(err); }else{ console.log("http://localhost:"+PORT); } })
module.exports = (phrases) => { let word = phrases[0].split(' ')[0]; return word; }
import { ThemeProvider, createGlobalStyle } from "styled-components"; import { Helmet } from "react-helmet"; import styledNormalize from "styled-normalize"; import App from "next/app"; import Layout from "../src/components/Navigation/Layout"; import theme from "../src/utils/theme"; const GlobalStyle = createGlobalStyle` ${styledNormalize} * { font-family: 'Inter',-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif } `; class MyApp extends App { render() { const { Component, pageProps, router, store } = this.props; const title = "Blockchain.com"; return ( <> <Helmet> <title>{title}</title> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta property="og:title" content={title} /> </Helmet> <ThemeProvider theme={theme}> <GlobalStyle /> <Layout> <Component router={router} {...pageProps} /> </Layout> </ThemeProvider> </> ); } } export default MyApp;
//= require jquery //= require best_in_place //= require jquery_ujs //= require jquery.simplemodal //= require jquery.ui //= require best_in_place.jquery-ui
self.assetsManifest = { "assets": [ { "hash": "sha256-8aM9R9K90X6h+KPDW4OzrEh071mAs7dvAQxjBxAZQAc=", "url": "css\/app.css" }, { "hash": "sha256-rldnE7wZYJj3Q43t5v8fg1ojKRwyt0Wtfm+224CacZs=", "url": "css\/bootstrap\/bootstrap.min.css" }, { "hash": "sha256-xMZ0SaSBYZSHVjFdZTAT\/IjRExRIxSriWcJLcA9nkj0=", "url": "css\/bootstrap\/bootstrap.min.css.map" }, { "hash": "sha256-jA4J4h\/k76zVxbFKEaWwFKJccmO0voOQ1DbUW+5YNlI=", "url": "css\/open-iconic\/FONT-LICENSE" }, { "hash": "sha256-BJ\/G+e+y7bQdrYkS2RBTyNfBHpA9IuGaPmf9htub5MQ=", "url": "css\/open-iconic\/font\/css\/open-iconic-bootstrap.min.css" }, { "hash": "sha256-OK3poGPgzKI2NzNgP07XMbJa3Dz6USoUh\/chSkSvQpc=", "url": "css\/open-iconic\/font\/fonts\/open-iconic.eot" }, { "hash": "sha256-sDUtuZAEzWZyv\/U1xl\/9D3ehyU69JE+FvAcu5HQ+\/a0=", "url": "css\/open-iconic\/font\/fonts\/open-iconic.otf" }, { "hash": "sha256-+P1oQ5jPzOVJGC52E1oxGXIXxxCyMlqy6A9cNxGYzVk=", "url": "css\/open-iconic\/font\/fonts\/open-iconic.svg" }, { "hash": "sha256-p+RP8CV3vRK1YbIkNzq3rPo1jyETPnR07ULb+HVYL8w=", "url": "css\/open-iconic\/font\/fonts\/open-iconic.ttf" }, { "hash": "sha256-cZPqVlRJfSNW0KaQ4+UPOXZ\/v\/QzXlejRDwUNdZIofI=", "url": "css\/open-iconic\/font\/fonts\/open-iconic.woff" }, { "hash": "sha256-aF5g\/izareSj02F3MPSoTGNbcMBl9nmZKDe04zjU\/ss=", "url": "css\/open-iconic\/ICON-LICENSE" }, { "hash": "sha256-p\/oxU91iBE+uaDr3kYOyZPuulf4YcPAMNIz6PRA\/tb0=", "url": "css\/open-iconic\/README.md" }, { "hash": "sha256-5FnAMkx9v\/YbfNUP2iuWIzlH3lHKEy8sDCcOEokoPJY=", "url": "diplom\/game1.css" }, { "hash": "sha256-D+TgDzixwxl6+gTubz4HCn4mHFtrpWX652qpW2KqiO8=", "url": "diplom\/game1.html" }, { "hash": "sha256-ubjX\/9pqEQZ34GWt72V4yhAywbdPVjbZNrg2Gap9HZE=", "url": "diplom\/game1.js" }, { "hash": "sha256-E5Xt9sYrgfpK0hQQjpYe0Z0nCTnT6hC0p3g+a1jc4Vw=", "url": "diplom\/game2.css" }, { "hash": "sha256-aYO\/bVnsHh5iDrGlkdspBkLsO8EuizomC4\/hdwg7guk=", "url": "diplom\/game2.html" }, { "hash": "sha256-VwTSOhPs0BtDOVrRo86CkaFbK6LYPiex9iB3ko\/BZTg=", "url": "diplom\/game2.js" }, { "hash": "sha256-4bA80kccUnns8njsGb85zfwBCPFG8x7trJS936F+IWk=", "url": "diplom\/game3.css" }, { "hash": "sha256-h6vy8akwXFxeMh5tiSUUZ9O9Rq5xf2ONRbmUq+AZPZc=", "url": "diplom\/game3.html" }, { "hash": "sha256-NXw0pxtiCONprovyCOy0hZv\/xv2j1MvSmBpryWWxcJs=", "url": "diplom\/game3.js" }, { "hash": "sha256-HSZ61DoGr2IGYGi23fRvF+PhuBWYvfE9kpRdcxq7FIM=", "url": "diplom\/menu.html" }, { "hash": "sha256-Jtxf9L+5ITKRc1gIRl4VbUpGkRNfOBXjYTdhJD4facM=", "url": "favicon.ico" }, { "hash": "sha256-IpHFcQvs03lh6W54zoeJRG1jW+VnGmwymzxLoXtKX7Y=", "url": "icon-512.png" }, { "hash": "sha256-bRMhmJqbCr+bCzXaOLgtoze6LEPc002zM+y0tqAPaZ4=", "url": "index.html" }, { "hash": "sha256-CTHhnvC3pKXtBgFIVVM0LjhhkUTSjUsqtBQoFeveHkA=", "url": "manifest.json" }, { "hash": "sha256-yzFf+O\/mlH+Q9klUSqXP2kxGKOUFLPxaww8da8fKhGU=", "url": "sample-data\/weather.json" }, { "hash": "sha256-ibxaSjW7s3aLVssChknhzCpgMTHGu4D48Q9OLP3dfe8=", "url": "_framework\/dotnet.timezones.blat" }, { "hash": "sha256-+NqBIg7FTMeA2q0mxzbehfuE2WPrnq53yqLsu47afbY=", "url": "_framework\/dotnet.wasm" }, { "hash": "sha256-m7NyeXyxM+CL04jr9ui1Z6pVfMWwhHusuz5qNZWpAwA=", "url": "_framework\/icudt.dat" }, { "hash": "sha256-91bygK5voY9lG5wxP0\/uj7uH5xljF9u7iWnSldT1Z\/g=", "url": "_framework\/icudt_CJK.dat" }, { "hash": "sha256-DPfeOLph83b2rdx40cKxIBcfVZ8abTWAFq+RBQMxGw0=", "url": "_framework\/icudt_EFIGS.dat" }, { "hash": "sha256-oM7Z6aN9jHmCYqDMCBwFgFAYAGgsH1jLC\/Z6DYeVmmk=", "url": "_framework\/icudt_no_CJK.dat" }, { "hash": "sha256-VR9AaflChiwC+KUJnKHaZAMWHeF8tQ1Giwr7XsIRIfw=", "url": "_framework\/dotnet.5.0.4.js" }, { "hash": "sha256-0j9bI0glUjw6NYlfq76J0s9cpTM7TZehLK8gtohNkQc=", "url": "DiplomJSBlazor.styles.css" }, { "hash": "sha256-ORH2etjdj75AYwWZekUUj4G1qqODX+6Dq195wFyAAus=", "url": "_framework\/Microsoft.AspNetCore.Components.dll" }, { "hash": "sha256-V6CRnO3vGdK0b6eqIh09pU7iA0rZkaBhJ0ac1DtWrD0=", "url": "_framework\/Microsoft.AspNetCore.Components.Web.dll" }, { "hash": "sha256-lGcPdftz9NKbcd+6W1VVW5WoQA\/zC9jUGWsv\/w94fG4=", "url": "_framework\/Microsoft.AspNetCore.Components.WebAssembly.dll" }, { "hash": "sha256-bZZ69\/58+BnN9G33FpTd2iXAdfgLbBnDUiiKxfaZ7IU=", "url": "_framework\/Microsoft.Extensions.Configuration.dll" }, { "hash": "sha256-7mxFRRlriJzO95ZBz4cmDSFADogdaoDy8MxzQoNtwaU=", "url": "_framework\/Microsoft.Extensions.Configuration.Abstractions.dll" }, { "hash": "sha256-cwzKuqTaJjYc5QXknt6NaBt\/MWSt9DYHfmu0I\/CV2mc=", "url": "_framework\/Microsoft.Extensions.Configuration.Json.dll" }, { "hash": "sha256-Fj3WO6cw4Pbh90sLIj2PrTMuVvIx62jfLSxrP7tylyI=", "url": "_framework\/Microsoft.Extensions.DependencyInjection.dll" }, { "hash": "sha256-8L6pzpycBrKxgs\/3WsBVoR\/7NenUcL+e0i19DvlMog8=", "url": "_framework\/Microsoft.Extensions.DependencyInjection.Abstractions.dll" }, { "hash": "sha256-TpIA498zSsaZAjS+42XzHSmeWdSuY4\/\/ydfZQGlz1O8=", "url": "_framework\/Microsoft.Extensions.Logging.dll" }, { "hash": "sha256-TSzg6qsgsxZ162vc0deudnTvJ85ORFBpjYjqJ7LqFSA=", "url": "_framework\/Microsoft.Extensions.Logging.Abstractions.dll" }, { "hash": "sha256-g1C9Fnh++M4k1mLduCz2yUnf\/70tTCbdZ\/s6bDjsmZM=", "url": "_framework\/Microsoft.Extensions.Options.dll" }, { "hash": "sha256-32yXMbcCMbfUq7vtlIPput8uO7SZK8E9m3V8EXMScBc=", "url": "_framework\/Microsoft.Extensions.Primitives.dll" }, { "hash": "sha256-bakD6JBVxfwh3Wri1MJq53pQXbLnKW4w8NcvgIOr7r8=", "url": "_framework\/Microsoft.JSInterop.dll" }, { "hash": "sha256-UwgpwjCHmUhISv5eMMiYhjnJhBAudE0gLHyB4B\/kLpQ=", "url": "_framework\/Microsoft.JSInterop.WebAssembly.dll" }, { "hash": "sha256-qZYTUS+ga7CydtH54fYPbehFCvx3B49I74G8dxreTog=", "url": "_framework\/System.IO.Pipelines.dll" }, { "hash": "sha256-+hZbfp5Jn0bow9AU9VTgUpncrqPh66fqywhrs2xtRak=", "url": "_framework\/DiplomJSBlazor.dll" }, { "hash": "sha256-Oyt4LolNKr48lekz2RGZEEFAiepxkrixmR4JDffMxFk=", "url": "_framework\/System.Collections.Concurrent.dll" }, { "hash": "sha256-6k2NDnWP6bx8Ci1nEH2iyUjI9LJIq3\/0HpW5EVILgJw=", "url": "_framework\/System.Collections.Immutable.dll" }, { "hash": "sha256-WTOCNoOEAZMjfHIi583ZspuT65Mz9BL3xxbf5hoFMeE=", "url": "_framework\/System.Collections.dll" }, { "hash": "sha256-pY3sJoWWONDSSb4Itaccg9nszIJ9qgKqcMgvbKhZDVI=", "url": "_framework\/System.ComponentModel.dll" }, { "hash": "sha256-gjo3eXWss8iztxzGuOXjj\/0IJlGL+2R0gzbevJIFclk=", "url": "_framework\/System.Console.dll" }, { "hash": "sha256-RGcG+wluehFl59BsAZGHh\/GQydds0HhYDYJ6yhb1S0A=", "url": "_framework\/System.Linq.dll" }, { "hash": "sha256-ce5Pe9ot9aa\/8NlVntDrM+vR2eHfyYRrFLF0dWRxx1I=", "url": "_framework\/System.Memory.dll" }, { "hash": "sha256-j+VFKXGUabJOD43Smy2yO0q3X2tEHfrIGzL+ivYK268=", "url": "_framework\/System.Net.Http.dll" }, { "hash": "sha256-L42QzNMEfh\/kzEzVIqOdxy\/T4G5XVWj4CQxyipLaxTY=", "url": "_framework\/System.Net.Primitives.dll" }, { "hash": "sha256-0WFyZEE\/KU9GcESC3Tzaf+c9NwXHHjAGKByqNz+vDZQ=", "url": "_framework\/System.ObjectModel.dll" }, { "hash": "sha256-\/TJCWO\/kumFHGQdIUkPj6Cf1XFcm4QyIqJZ\/Pdo8rsg=", "url": "_framework\/System.Private.Runtime.InteropServices.JavaScript.dll" }, { "hash": "sha256-jK85apzJqtVp+l55zt2OY2VIrUIZni8b1F0cuO0KZZI=", "url": "_framework\/System.Private.Uri.dll" }, { "hash": "sha256-56TigODI2fA6rN+XjE\/oXLzEbzjGAf+gnbZ3uSZm\/k0=", "url": "_framework\/System.Runtime.CompilerServices.Unsafe.dll" }, { "hash": "sha256-eeoFplmtvAIhZXC1T7Xk20xSp4ex5gSh0mvCn4JdKgU=", "url": "_framework\/System.Runtime.InteropServices.RuntimeInformation.dll" }, { "hash": "sha256-yIMrT8Ppi8eSGnwO3Zz5D+x96yg\/7Drdnh499NtWIgU=", "url": "_framework\/System.Text.Encodings.Web.dll" }, { "hash": "sha256-Prhg3pkgjqAhGEu2Rexcvs775A4dKE8+HRbAMF4kRWs=", "url": "_framework\/System.Text.Json.dll" }, { "hash": "sha256-9zvtD3B0TRhlbXsotHLRbAK8HPflzNYPs4mKqfsJM3I=", "url": "_framework\/System.Private.CoreLib.dll" }, { "hash": "sha256-4XPGUPuDjkdAq2Nrg+d5s\/elO+9mvuFfzNe2lh6cy\/U=", "url": "_framework\/blazor.boot.json" }, { "hash": "sha256-sYA0L2visb01XnqGT7epPVSXTZJFhpQ4PMDzhF\/rngo=", "url": "_framework\/blazor.webassembly.js" } ], "version": "XsEOY3rh" };
/** * Created by aresn on 16/6/20. */ import Vue from 'vue'; import VueRouter from 'vue-router'; import App from './app'; import iComponents from '../src/index'; Vue.use(VueRouter); Vue.use(iComponents); // 开启debug模式 Vue.config.debug = true; // 路由配置 const router = new VueRouter({ routes:[ { path:'/button', component: function (resolve) { require(['./routers/button.vue'], resolve); } } ] }); let app = new Vue({ router, render: h => h(App), }).$mount('#body'); let indexScrollTop = 0; router.beforeEach((route, redirect, next) => { if (route.path !== '/') { indexScrollTop = document.body.scrollTop; } document.title = route.meta.title || document.title; next(); }); router.afterEach(route => { if (route.path !== '/') { document.body.scrollTop = 0; } else { Vue.nextTick(() => { document.body.scrollTop = indexScrollTop; }); } });
document.addEventListener("DOMContentLoaded", getJson); let page; //henter json fil fra WP url async function getJson() { let jsonObject = await fetch("https://jakobfalkenberg.dk/kea/2sem/tema7/huset/wordpress/wp-json/wp/v2/bastard_cafe"); page = await jsonObject.json(); post172Output(); sreenSize(); } function post172Output() { //post med id 209 let post172 = page.find(x => x.id == '172'); //indsæt header info document.querySelector(".site_header").textContent = post172.acf.header; //indsæt tag-line info document.querySelector(".tag_line").textContent = post172.acf.tagline; //indsætter content i valgt html class document.querySelector(".bastard_content").innerHTML = post172.content.rendered; //Billede url document.querySelector(".content_image").style.backgroundImage = "url('" + post172.acf.billede.url + "')"; //alt tekst url document.querySelector(".content_image").alt = post172.acf.billede.alt; //title document.querySelector(".content_image").title = post172.acf.billede.title; //Video document.querySelector(".video_container").innerHTML = post172.acf.video; } // SCREEN LISTENER ÅBNER OG LUKKER ET ELEMENT function sreenSize() { console.log("screeeen siiize"); if (window.matchMedia("(min-width: 1000px)").matches) { /* the viewport is at least 400 pixels wide */ } else { document.querySelector(".section_1").addEventListener("click", section_1_mobil); document.querySelector(".section_2").addEventListener("click", section_2_mobil); document.querySelector(".section_3").addEventListener("click", section_3_mobil); document.querySelector(".section_4").addEventListener("click", section_4_mobil); /* the viewport is less than 400 pixels wide */ } } function section_1_mobil() { console.log(event.target.classList); let a = document.querySelector(".show_1"); if (a.style.display === "none") { a.style.display = "block"; } else { a.style.display = "none"; } }; function section_2_mobil() { console.log("første"); let a = document.querySelector(".show_2"); if (a.style.display === "none") { a.style.display = "block"; console.log("HEJ"); } else { a.style.display = "none"; } }; function section_3_mobil() { console.log("HEJ"); let a = document.querySelector(".show_3"); if (a.style.display === "none") { a.style.display = "block"; } else { a.style.display = "none"; } }; function section_4_mobil() { console.log("HEJ"); let a = document.querySelector(".show_4"); if (a.style.display === "none") { a.style.display = "block"; } else { a.style.display = "none"; } };
const passport = require('passport'); const GoogleStrategy = require('passport-google-oauth20').Strategy; const FacebookStrategy = require('passport-facebook').Strategy; const { GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, FACEBOOK_CLIENT_ID, FACEBOOK_CLIENT_SECRET } = require('../../var_config'); const User = require('../../models/user'); passport.serializeUser((user, done) => { done(null, user.id); }); passport.deserializeUser((id, done) => { User.findById(id).then(user => { done(null, user); }); }); passport.use( new GoogleStrategy( { clientID: GOOGLE_CLIENT_ID, clientSecret: GOOGLE_CLIENT_SECRET, callbackURL: '/auth/google/callback', proxy: true }, async (accessToken, refreshToken, profile, done) => { const existingUser = await User.findOne({ "google.id": profile.id }); if (existingUser) { return done(null, existingUser); } const user = await new User({ method:'google', google: { id: profile.id, email: profile.emails[0].value }, username:profile.displayName }).save(); done(null, user); } ) ); passport.use( new FacebookStrategy( { clientID: FACEBOOK_CLIENT_ID, clientSecret: FACEBOOK_CLIENT_SECRET, callbackURL: '/auth/facebook/callback', proxy: true, profileFields: ['id', 'emails', "name"] }, async (accessToken, refreshToken, profile, done) => { const existingUser = await User.findOne({ "facebook.id": profile.id }); if (existingUser) { return done(null, existingUser); } const user = await new User({ method:'facebook', facebook: { id: profile.id, email: profile.emails[0].value }, username: profile.name.givenName }).save(); done(null, user); } ) );
import util from 'util'; import ava from 'ava'; import parser from '../../index'; export const parse = (input, transform) => { return parser(transform).processSync(input); }; export function test (spec, input, callback, only = false) { let tester = only ? ava.only : ava; if (only) { let e = new Error(); console.error(e); } if (callback) { tester(`${spec} (tree)`, t => { let tree = parser().astSync(input); let debug = util.inspect(tree, false, null); callback.call(this, t, tree, debug); }); } tester(`${spec} (toString)`, t => { let result = parser().processSync(input); t.deepEqual(result, input); }); } test.only = (spec, input, callback) => test(spec, input, callback, true); export const throws = (spec, input) => { ava(`${spec} (throws)`, t => { t.throws(() => parser().processSync(input)); }); };
import {getQuotedOrders} from './ajax.js'; var infoDiv = document.getElementById('info-div'); var data = null; if(_localStorage.merchId == null){ window.location.href = "index.php"; }else{ getQuotedOrders(_localStorage.merchId) .then((res)=>{ if(res.Message){ throw 'Wrong Id'; }else{ data = res; } }) .then(updatePage) .catch((err)=>{ alert('Your merchant Id is wrong! \n Please fix it.'); _localStorage.removeMerchant(); window.location.href = "index.php"; }) } window.getOrderDetails = function (orderId, invoiceMstId){ console.log(orderId, invoiceMstId); var orderInfo = document.getElementById('modal-body'); var appendBlock = "<div class='appendBlock'>"; appendBlock += `<input type="hidden" name="orderId" value="${orderId}">`; appendBlock += `<input type="hidden" name="invoiceMstId" value="${invoiceMstId}">`; appendBlock += '<p>Do you want to update this order?</p>'; appendBlock += "</div>"; orderInfo.innerHTML = appendBlock; $('#modal').modal('toggle'); console.log(orderId, invoiceMstId); } function updatePage(){ var count = Object.keys(data).length; if (count > 0) { var mainDiv = '<table class="table table-dark" border = "1">'; mainDiv += '<thead>'; mainDiv += '<tr><td>Order Id</td><td>Distance</td><td>Order Date</td><td>Total</td></tr>'; mainDiv += '</thead><tbody>'; for (let i = 0; i < count; i++) { let obj = data[i]; mainDiv += '<tr class="orders-row" onclick="getOrderDetails(' + obj.Order_Id + ','+ obj.InvoiceMst_Id + ')">'; let appendBlock = ''; appendBlock += `<td>${obj.Order_Id}</td>`; appendBlock += `<td>${obj.Dist}</td>`; appendBlock += `<td>${obj.OrderDate.toDateString()}</td>`; appendBlock += `<td>${obj.Total}</td>`; mainDiv += appendBlock + '</tr>'; } infoDiv.innerHTML = mainDiv; } else { infoDiv.innerHTML = '<div class="mainDiv">No Submitted Orders</div>'; } }
/* graphics.js Authors: Joseph Carlos (jcarlos) Kunal Desai (kunald) James Grugett (jgrugett) */ var globalGraphics = new Graphics(); function Graphics() { this.addImage = function(source) { this.images[source] = new Image(); this.images[source].src = source; } // Images this.images = {}; this.addImage("terrain.png"); this.addImage("Doom-LostSoul.png"); this.addImage("trainersprites.png"); this.addImage("sand2.png"); var terrain = this.images["terrain.png"]; var lostSoul = this.images["Doom-LostSoul.png"]; var trainer = this.images["trainersprites.png"]; var sand = this.images["sand2.png"]; // Textures this.barrierTexture = new Texture(terrain, 96, 64, 16, 16, 2, false); this.cactusTexture = new Texture(terrain, 96, 64, 16, 16, 4, false); this.playerTexture = new Texture(terrain, 128, 112, 16, 16, 1, true); this.backgroundTexture = new Texture(terrain, 32, 16, 16, 16, 4, false); this.pelletTexture = new Texture(terrain, 192, 128, 16, 16, 1, true); this.sandTexture = new Texture(sand, 0, 0, 96, 96, 4, false); // Animations this.lostSoulStanding = new Animation(lostSoul, [66, 66], [15, 68], [32, 32], [47, 53], 5); this.trainerRunning = new Animation(trainer, [337, 353, 370], [6, 6, 6], [15, 16, 15], [18, 18, 17], 5); this.trainerWalking = new Animation(trainer, [148, 164, 180], [6, 7, 7], [14, 14, 14], [19, 18, 18], 5); this.trainerBiking = new Animation(trainer, [102, 123], [116, 116], [20, 20], [22, 22], 5); this.playerExploding = new Animation(lostSoul, [197, 274, 373], [292, 293, 280], [68, 88, 103], [60, 72, 90], 3); } function newImage(source) { var img = new Image(); img.src = source; return img; } function Texture(file, x, y, width, height, scale, stretch) { this.file = file; this.x = x; this.y = y; this.width = width; this.height = height; this.scale = scale; this.stretch = stretch; } function fillTex(ctx, texture, x, y, width, height) { if (texture.stretch) { ctx.drawImage(texture.file, texture.x, texture.y, texture.width, texture.height, x, y, width, height); return; } var drawWidth = texture.width * texture.scale; var drawHeight = texture.height * texture.scale; var xRatio = width / drawWidth; var yRatio = height / drawHeight; var upperCols = Math.ceil(xRatio); var upperRows = Math.ceil(yRatio); var lowerCols = Math.floor(xRatio); var lowerRows = Math.floor(yRatio); var rows = lowerRows; var cols = lowerCols; if ((upperCols - xRatio) < (xRatio - lowerCols)) { cols = upperCols; } if ((upperRows - yRatio) < (yRatio - lowerRows)) { rows = upperRows; } if (cols === 0) { cols = 1; } if (rows === 0) { rows = 1; } drawWidth = width / cols drawHeight = height / rows for (var row = 0; row < rows; row++) { for (var col = 0; col < cols; col++) { ctx.drawImage(texture.file, texture.x, texture.y, texture.width, texture.height, x + col * drawWidth, y + row * drawHeight, drawWidth, drawHeight); } } } function Animation(file, xs, ys, widths, heights, fps) { this.fps = fps; this.file = file; this.xs = xs; this.ys = ys; this.widths = widths; this.heights = heights; this.duration = function() { return this.fps * this.xs.length; } } function tileTex(ctx, texture, x, y, width, height) { var finalWidth, finalHeight, endWidth, endHeight, endTexWidth, endTexHeight; var finalTexWidth, finalTexHeight; var drawWidth, drawHeight; if (texture.stretch) { drawWidth = width; drawHeight = height; } else { drawWidth = texture.width * texture.scale; drawHeight = texture.height * texture.scale; } var xTimes = Math.floor(width / drawWidth); var yTimes = Math.floor(height / drawHeight); endTexWidth = texture.width * (width / drawWidth - xTimes); endTexHeight = texture.height * (height / drawHeight - yTimes); endWidth = drawWidth * (width / drawWidth - xTimes); endHeight = drawHeight * (height / drawHeight - yTimes); for (var i = 0; i <= xTimes; i++) { for (var j = 0; j <= yTimes; j++) { finalWidth = drawWidth; finalHeight = drawHeight; finalTexWidth = texture.width; finalTexHeight = texture.height; if (i === xTimes) { finalWidth = endWidth; finalTexWidth = endTexWidth; } if (j === yTimes) { finalHeight = endHeight; finalTexHeight = endTexHeight; } ctx.drawImage(texture.file, texture.x, texture.y, finalTexWidth, finalTexHeight, x + i * drawWidth, y + j * drawHeight, finalWidth, finalHeight); } } }
import React from "react" import Layout from "../components/layout" import SEO from "../components/seo" const NotFoundPage = () => ( <Layout> <SEO title="Страница не найдена" /> <h1>Страница не найдена</h1> </Layout> ) export default NotFoundPage
function Dev(piece, boardSize) { this.piece = piece; this.boardSize = boardSize; } // TODO: implementar a jogada Dev.prototype.move = function(board) { for (let i = 0 ; i < this.boardSize ; i++) { let tr = board.rows[i]; for (let j = 0 ; j < this.boardSize ; j++) { let td = tr.cells[j]; if (!td.innerHTML) { console.log('if', td.innerHTML, i, j) td.innerHTML = this.piece; td.classList.add('fade-in'); return {line: i, column: j } } else if (td.innerHTML !== this.piece) { let col = j + 1; console.log('else', td.innerHTML, i, col) if (col < this.boardSize && !tr.cells[col].innerHTML) { tr.cells[col].innerHTML = this.piece; return {line: i, column: col } } } } } };
// Array.prototype.indexOf polyfill: if ( typeof(Array.prototype.indexOf) === 'undefined' ) { Array.prototype.indexOf = function(item, start) { var length = this.length start = typeof(start) !== 'undefined' ? start : 0 for (var i = start; i < length; i++) { if (this[i] === item) return i } return -1 } } function ReadFile(Filename) { var wsh = WScript.CreateObject('WScript.Shell'); var fso = WScript.CreateObject('Scripting.FileSystemObject'); var absFilepath = fso.BuildPath(wsh.CurrentDirectory, Filename); if (! fso.FileExists(absFilepath)) { WScript.Echo('File not found: ' + absFilepath); return false; } var fileObj = fso.GetFile(absFilepath); // https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/windows-scripting/hwfw5c59(v=vs.84) var ForReading = 1; var Formatting = -2; var ts = fileObj.OpenAsTextStream(ForReading, Formatting); var fileContents = ts.ReadAll(); ts.Close(); return fileContents; } function CustomCustoms() { var inputContents = ReadFile('./day06/day6.txt'); var groups = inputContents.split('\n\n'); var totalTally = []; for (var i = 0; i < groups.length; i++) { var answers = groups[i].split('\n'); var tally = []; for (var j = 0; j < answers.length; j++) { var answer = answers[j].split(''); for (var k = 0; k < answer.length; k++) { if (tally.indexOf(answer[k]) === -1) { tally.push(answer[k]); } } } totalTally.push(tally.length); } var totalSum = 0; for (var i = 0; i < totalTally.length; i++) { totalSum += totalTally[i]; } return totalSum; } WScript.Echo(CustomCustoms());
var locations = [ { name: "ISS", radius: 15, fillKey: "ISS", date: "", latitude: 0, longitude: 0, }, ]; var pathnodes = []; function getissloc() { map.bubbles([]); fetch("http://api.open-notify.org/iss-now.json") .then((response) => response.json()) .then((data1) => { // console.log(data1); locations[0] = { name: "ISS", radius: 15, fillKey: "ISS", date: "", latitude: 0, longitude: 0, }; locations[0].latitude = data1.iss_position.latitude; locations[0].longitude = data1.iss_position.longitude; locations[0].date = data1.timestamp; pathnodes.push(locations[0]); // pathnodes[pathnodes.length - 1].fillKey = "path"; // pathnodes[pathnodes.length - 1].radius = 10; // pathnodes[pathnodes.length - 1].name = "path"; map.bubbles(pathnodes, { popupTemplate: function (geo, data) { return [ '<div class="hoverinfo">' + data.name, "<br/>Date: " + data.date + "", "<br/>latitude: " + data.latitude + "", "<br/>longitude: " + data.longitude + "", "</div>", ].join(""); }, }); // map.bubbles(locations, { // popupTemplate: function (geo, data) { // return [ // '<div class="hoverinfo">' + data.name, // "<br/>Date: " + data.date + "", // "<br/>latitude: " + data.latitude + "", // "<br/>longitude: " + data.longitude + "", // "</div>", // ].join(""); // }, // }); }); } var map = new Datamap({ element: document.getElementById("mapbox"), responsive: true, fills: { defaultFill: "#2B454E", //the keys in this object map to the "fillKey" of [data] or [bubbles] ISS: "#000000", path: "#ffffff", }, geographyConfig: { hideAntarctica: true, borderWidth: 1, borderOpacity: 1, popupOnHover: true, //disable the popup while hovering highlightOnHover: true, highlightFillColor: "#576b72", }, }); getissloc(); window.setInterval(function () { getissloc(); }, 10000); window.addEventListener("resize", function () { map.resize(); }); // map.bubbles([]);
/** * Copyright (C) 2009 eXo Platform SAS. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ /** * @author Nguyen Ba Uoc */ if(!eXo.core.html) { eXo.core.html = {} ; } eXo.core.html.HTMLEntities = [] ; eXo.core.html.HTMLEntities['nbsp'] = 32 ; eXo.core.html.HTMLEntities['iexcl'] = 161 ; eXo.core.html.HTMLEntities['cent'] = 162 ; eXo.core.html.HTMLEntities['pound'] = 163 ; eXo.core.html.HTMLEntities['curren'] = 164 ; eXo.core.html.HTMLEntities['yen'] = 165 ; eXo.core.html.HTMLEntities['brvbar'] = 166 ; eXo.core.html.HTMLEntities['sect'] = 167 ; eXo.core.html.HTMLEntities['uml'] = 168 ; eXo.core.html.HTMLEntities['copy'] = 169 ; eXo.core.html.HTMLEntities['ordf'] = 170 ; eXo.core.html.HTMLEntities['laquo'] = 171 ; eXo.core.html.HTMLEntities['not'] = 172 ; eXo.core.html.HTMLEntities['shy'] = 173 ; eXo.core.html.HTMLEntities['reg'] = 174 ; eXo.core.html.HTMLEntities['macr'] = 175 ; eXo.core.html.HTMLEntities['deg'] = 176 ; eXo.core.html.HTMLEntities['plusmn'] = 177 ; eXo.core.html.HTMLEntities['sup2'] = 178 ; eXo.core.html.HTMLEntities['sup3'] = 179 ; eXo.core.html.HTMLEntities['acute'] = 180 ; eXo.core.html.HTMLEntities['micro'] = 181 ; eXo.core.html.HTMLEntities['para'] = 182 ; eXo.core.html.HTMLEntities['middot'] = 183 ; eXo.core.html.HTMLEntities['cedil'] = 184 ; eXo.core.html.HTMLEntities['sup1'] = 185 ; eXo.core.html.HTMLEntities['ordm'] = 186 ; eXo.core.html.HTMLEntities['raquo'] = 187 ; eXo.core.html.HTMLEntities['frac14'] = 188 ; eXo.core.html.HTMLEntities['frac12'] = 189 ; eXo.core.html.HTMLEntities['frac34'] = 190 ; eXo.core.html.HTMLEntities['iquest'] = 191 ; eXo.core.html.HTMLEntities['Agrave'] = 192 ; eXo.core.html.HTMLEntities['Aacute'] = 193 ; eXo.core.html.HTMLEntities['Acirc'] = 194 ; eXo.core.html.HTMLEntities['Atilde'] = 195 ; eXo.core.html.HTMLEntities['Auml'] = 196 ; eXo.core.html.HTMLEntities['Aring'] = 197 ; eXo.core.html.HTMLEntities['AElig'] = 198 ; eXo.core.html.HTMLEntities['Ccedil'] = 199 ; eXo.core.html.HTMLEntities['Egrave'] = 200 ; eXo.core.html.HTMLEntities['Eacute'] = 201 ; eXo.core.html.HTMLEntities['Ecirc'] = 202 ; eXo.core.html.HTMLEntities['Euml'] = 203 ; eXo.core.html.HTMLEntities['Igrave'] = 204 ; eXo.core.html.HTMLEntities['Iacute'] = 205 ; eXo.core.html.HTMLEntities['Icirc'] = 206 ; eXo.core.html.HTMLEntities['Iuml'] = 207 ; eXo.core.html.HTMLEntities['ETH'] = 208 ; eXo.core.html.HTMLEntities['Ntilde'] = 209 ; eXo.core.html.HTMLEntities['Ograve'] = 210 ; eXo.core.html.HTMLEntities['Oacute'] = 211 ; eXo.core.html.HTMLEntities['Ocirc'] = 212 ; eXo.core.html.HTMLEntities['Otilde'] = 213 ; eXo.core.html.HTMLEntities['Ouml'] = 214 ; eXo.core.html.HTMLEntities['times'] = 215 ; eXo.core.html.HTMLEntities['Oslash'] = 216 ; eXo.core.html.HTMLEntities['Ugrave'] = 217 ; eXo.core.html.HTMLEntities['Uacute'] = 218 ; eXo.core.html.HTMLEntities['Ucirc'] = 219 ; eXo.core.html.HTMLEntities['Uuml'] = 220 ; eXo.core.html.HTMLEntities['Yacute'] = 221 ; eXo.core.html.HTMLEntities['THORN'] = 222 ; eXo.core.html.HTMLEntities['szlig'] = 223 ; eXo.core.html.HTMLEntities['agrave'] = 224 ; eXo.core.html.HTMLEntities['aacute'] = 225 ; eXo.core.html.HTMLEntities['acirc'] = 226 ; eXo.core.html.HTMLEntities['atilde'] = 227 ; eXo.core.html.HTMLEntities['auml'] = 228 ; eXo.core.html.HTMLEntities['aring'] = 229 ; eXo.core.html.HTMLEntities['aelig'] = 230 ; eXo.core.html.HTMLEntities['ccedil'] = 231 ; eXo.core.html.HTMLEntities['egrave'] = 232 ; eXo.core.html.HTMLEntities['eacute'] = 233 ; eXo.core.html.HTMLEntities['ecirc'] = 234 ; eXo.core.html.HTMLEntities['euml'] = 235 ; eXo.core.html.HTMLEntities['igrave'] = 236 ; eXo.core.html.HTMLEntities['iacute'] = 237 ; eXo.core.html.HTMLEntities['icirc'] = 238 ; eXo.core.html.HTMLEntities['iuml'] = 239 ; eXo.core.html.HTMLEntities['eth'] = 240 ; eXo.core.html.HTMLEntities['ntilde'] = 241 ; eXo.core.html.HTMLEntities['ograve'] = 242 ; eXo.core.html.HTMLEntities['oacute'] = 243 ; eXo.core.html.HTMLEntities['ocirc'] = 244 ; eXo.core.html.HTMLEntities['otilde'] = 245 ; eXo.core.html.HTMLEntities['ouml'] = 246 ; eXo.core.html.HTMLEntities['divide'] = 247 ; eXo.core.html.HTMLEntities['oslash'] = 248 ; eXo.core.html.HTMLEntities['ugrave'] = 249 ; eXo.core.html.HTMLEntities['uacute'] = 250 ; eXo.core.html.HTMLEntities['ucirc'] = 251 ; eXo.core.html.HTMLEntities['uuml'] = 252 ; eXo.core.html.HTMLEntities['yacute'] = 253 ; eXo.core.html.HTMLEntities['thorn'] = 254 ; eXo.core.html.HTMLEntities['yuml'] = 255 ; eXo.core.html.HTMLEntities['fnof'] = 402 ; eXo.core.html.HTMLEntities['Alpha'] = 913 ; eXo.core.html.HTMLEntities['Beta'] = 914 ; eXo.core.html.HTMLEntities['Gamma'] = 915 ; eXo.core.html.HTMLEntities['Delta'] = 916 ; eXo.core.html.HTMLEntities['Epsilon'] = 917 ; eXo.core.html.HTMLEntities['Zeta'] = 918 ; eXo.core.html.HTMLEntities['Eta'] = 919 ; eXo.core.html.HTMLEntities['Theta'] = 920 ; eXo.core.html.HTMLEntities['Iota'] = 921 ; eXo.core.html.HTMLEntities['Kappa'] = 922 ; eXo.core.html.HTMLEntities['Lambda'] = 923 ; eXo.core.html.HTMLEntities['Mu'] = 924 ; eXo.core.html.HTMLEntities['Nu'] = 925 ; eXo.core.html.HTMLEntities['Xi'] = 926 ; eXo.core.html.HTMLEntities['Omicron'] = 927 ; eXo.core.html.HTMLEntities['Pi'] = 928 ; eXo.core.html.HTMLEntities['Rho'] = 929 ; eXo.core.html.HTMLEntities['Sigma'] = 931 ; eXo.core.html.HTMLEntities['Tau'] = 932 ; eXo.core.html.HTMLEntities['Upsilon'] = 933 ; eXo.core.html.HTMLEntities['Phi'] = 934 ; eXo.core.html.HTMLEntities['Chi'] = 935 ; eXo.core.html.HTMLEntities['Psi'] = 936 ; eXo.core.html.HTMLEntities['Omega'] = 937 ; eXo.core.html.HTMLEntities['alpha'] = 945 ; eXo.core.html.HTMLEntities['beta'] = 946 ; eXo.core.html.HTMLEntities['gamma'] = 947 ; eXo.core.html.HTMLEntities['delta'] = 948 ; eXo.core.html.HTMLEntities['epsilon'] = 949 ; eXo.core.html.HTMLEntities['zeta'] = 950 ; eXo.core.html.HTMLEntities['eta'] = 951 ; eXo.core.html.HTMLEntities['theta'] = 952 ; eXo.core.html.HTMLEntities['iota'] = 953 ; eXo.core.html.HTMLEntities['kappa'] = 954 ; eXo.core.html.HTMLEntities['lambda'] = 955 ; eXo.core.html.HTMLEntities['mu'] = 956 ; eXo.core.html.HTMLEntities['nu'] = 957 ; eXo.core.html.HTMLEntities['xi'] = 958 ; eXo.core.html.HTMLEntities['omicron'] = 959 ; eXo.core.html.HTMLEntities['pi'] = 960 ; eXo.core.html.HTMLEntities['rho'] = 961 ; eXo.core.html.HTMLEntities['sigmaf'] = 962 ; eXo.core.html.HTMLEntities['sigma'] = 963 ; eXo.core.html.HTMLEntities['tau'] = 964 ; eXo.core.html.HTMLEntities['upsilon'] = 965 ; eXo.core.html.HTMLEntities['phi'] = 966 ; eXo.core.html.HTMLEntities['chi'] = 967 ; eXo.core.html.HTMLEntities['psi'] = 968 ; eXo.core.html.HTMLEntities['omega'] = 969 ; eXo.core.html.HTMLEntities['thetasym'] = 977 ; eXo.core.html.HTMLEntities['upsih'] = 978 ; eXo.core.html.HTMLEntities['piv'] = 982 ; eXo.core.html.HTMLEntities['bull'] = 8226 ; eXo.core.html.HTMLEntities['hellip'] = 8230 ; eXo.core.html.HTMLEntities['prime'] = 8242 ; eXo.core.html.HTMLEntities['Prime'] = 8243 ; eXo.core.html.HTMLEntities['oline'] = 8254 ; eXo.core.html.HTMLEntities['frasl'] = 8260 ; eXo.core.html.HTMLEntities['weierp'] = 8472 ; eXo.core.html.HTMLEntities['image'] = 8465 ; eXo.core.html.HTMLEntities['real'] = 8476 ; eXo.core.html.HTMLEntities['trade'] = 8482 ; eXo.core.html.HTMLEntities['alefsym'] = 8501 ; eXo.core.html.HTMLEntities['larr'] = 8592 ; eXo.core.html.HTMLEntities['rarr'] = 8594 ; eXo.core.html.HTMLEntities['darr'] = 8595 ; eXo.core.html.HTMLEntities['harr'] = 8596 ; eXo.core.html.HTMLEntities['crarr'] = 8629 ; eXo.core.html.HTMLEntities['lArr'] = 8656 ; eXo.core.html.HTMLEntities['uarr'] = 8593 ; eXo.core.html.HTMLEntities['uArr'] = 8657 ; eXo.core.html.HTMLEntities['rArr'] = 8658 ; eXo.core.html.HTMLEntities['dArr'] = 8659 ; eXo.core.html.HTMLEntities['hArr'] = 8660 ; eXo.core.html.HTMLEntities['forall'] = 8704 ; eXo.core.html.HTMLEntities['part'] = 8706 ; eXo.core.html.HTMLEntities['exist'] = 8707 ; eXo.core.html.HTMLEntities['empty'] = 8709 ; eXo.core.html.HTMLEntities['nabla'] = 8711 ; eXo.core.html.HTMLEntities['isin'] = 8712 ; eXo.core.html.HTMLEntities['notin'] = 8713 ; eXo.core.html.HTMLEntities['ni'] = 8715 ; eXo.core.html.HTMLEntities['prod'] = 8719 ; eXo.core.html.HTMLEntities['sum'] = 8721 ; eXo.core.html.HTMLEntities['minus'] = 8722 ; eXo.core.html.HTMLEntities['lowast'] = 8727 ; eXo.core.html.HTMLEntities['radic'] = 8730 ; eXo.core.html.HTMLEntities['prop'] = 8733 ; eXo.core.html.HTMLEntities['infin'] = 8734 ; eXo.core.html.HTMLEntities['ang'] = 8736 ; eXo.core.html.HTMLEntities['and'] = 8743 ; eXo.core.html.HTMLEntities['or'] = 8744 ; eXo.core.html.HTMLEntities['cap'] = 8745 ; eXo.core.html.HTMLEntities['cup'] = 8746 ; eXo.core.html.HTMLEntities['int'] = 8747 ; eXo.core.html.HTMLEntities['there4'] = 8756 ; eXo.core.html.HTMLEntities['sim'] = 8764 ; eXo.core.html.HTMLEntities['cong'] = 8773 ; eXo.core.html.HTMLEntities['asymp'] = 8776 ; eXo.core.html.HTMLEntities['ne'] = 8800 ; eXo.core.html.HTMLEntities['equiv'] = 8801 ; eXo.core.html.HTMLEntities['le'] = 8804 ; eXo.core.html.HTMLEntities['ge'] = 8805 ; eXo.core.html.HTMLEntities['sub'] = 8834 ; eXo.core.html.HTMLEntities['sup'] = 8835 ; eXo.core.html.HTMLEntities['nsub'] = 8836 ; eXo.core.html.HTMLEntities['sube'] = 8838 ; eXo.core.html.HTMLEntities['supe'] = 8839 ; eXo.core.html.HTMLEntities['oplus'] = 8853 ; eXo.core.html.HTMLEntities['otimes'] = 8855 ; eXo.core.html.HTMLEntities['perp'] = 8869 ; eXo.core.html.HTMLEntities['sdot'] = 8901 ; eXo.core.html.HTMLEntities['lceil'] = 8968 ; eXo.core.html.HTMLEntities['rceil'] = 8969 ; eXo.core.html.HTMLEntities['lfloor'] = 8970 ; eXo.core.html.HTMLEntities['rfloor'] = 8971 ; eXo.core.html.HTMLEntities['lang'] = 9001 ; eXo.core.html.HTMLEntities['rang'] = 9002 ; eXo.core.html.HTMLEntities['loz'] = 9674 ; eXo.core.html.HTMLEntities['spades'] = 9824 ; eXo.core.html.HTMLEntities['clubs'] = 9827 ; eXo.core.html.HTMLEntities['hearts'] = 9829 ; eXo.core.html.HTMLEntities['diams'] = 9830 ; eXo.core.html.HTMLEntities['quot'] = 34 ; eXo.core.html.HTMLEntities['amp'] = 38 ; eXo.core.html.HTMLEntities['lt'] = 60 ; eXo.core.html.HTMLEntities['gt'] = 62 ; eXo.core.html.HTMLEntities['OElig'] = 338 ; eXo.core.html.HTMLEntities['oelig'] = 339 ; eXo.core.html.HTMLEntities['Scaron'] = 352 ; eXo.core.html.HTMLEntities['scaron'] = 353 ; eXo.core.html.HTMLEntities['Yuml'] = 376 ; eXo.core.html.HTMLEntities['circ'] = 710 ; eXo.core.html.HTMLEntities['tilde'] = 732 ; eXo.core.html.HTMLEntities['ensp'] = 8194 ; eXo.core.html.HTMLEntities['emsp'] = 8195 ; eXo.core.html.HTMLEntities['thinsp'] = 8201 ; eXo.core.html.HTMLEntities['zwnj'] = 8204 ; eXo.core.html.HTMLEntities['zwj'] = 8205 ; eXo.core.html.HTMLEntities['lrm'] = 8206 ; eXo.core.html.HTMLEntities['rlm'] = 8207 ; eXo.core.html.HTMLEntities['ndash'] = 8211 ; eXo.core.html.HTMLEntities['mdash'] = 8212 ; eXo.core.html.HTMLEntities['lsquo'] = 8216 ; eXo.core.html.HTMLEntities['rsquo'] = 8217 ; eXo.core.html.HTMLEntities['sbquo'] = 8218 ; eXo.core.html.HTMLEntities['ldquo'] = 8220 ; eXo.core.html.HTMLEntities['rdquo'] = 8221 ; eXo.core.html.HTMLEntities['bdquo'] = 8222 ; eXo.core.html.HTMLEntities['dagger'] = 8224 ; eXo.core.html.HTMLEntities['Dagger'] = 8225 ; eXo.core.html.HTMLEntities['permil'] = 8240 ; eXo.core.html.HTMLEntities['lsaquo'] = 8249 ; eXo.core.html.HTMLEntities['rsaquo'] = 8250 ; eXo.core.html.HTMLEntities['euro'] = 8364 ;
import React from 'react'; import LoginForm from './LoginForm'; import { connect } from 'react-redux'; import { loginUser } from '../actions/loginActions'; const Home = ({ history, loginUser, auth }) => { return ( <div> <br /> <br /> <br /> <LoginForm history={history} loginUser={loginUser} user={auth} /> </div> ); }; const mapStateToProps = state => ({ auth: state.auth, }); export default connect( mapStateToProps, { loginUser }, )(Home);
slide[MODULEID].buildThumbList = function() { for (var i=0;i<this.umg_images.length ;i++ ) { var item = ""; if (this.umg_mouseoverbehavior == "moveto") { item = "<a href='javascript:void(0);' onmouseover='slide[MODULEID].navigateTo("+i+")' class='umg_page' id='page[MODULEID]_"+i+"'><img border='0' src='"+jQuery(this.umg_images[i]).attr("alt")+"' height='30' alt='' /></" + "a>"; } else if (this.umg_mouseoverbehavior == "scroll") { item = "<a href='javascript:slide[MODULEID].navigateTo("+i+")' onmouseover='slide[MODULEID].hoverTo("+i+")' class='umg_page' id='page[MODULEID]_"+i+"'><img border='0' src='"+jQuery(this.umg_images[i]).attr("alt")+"' height='30' alt='' /></" + "a>"; } else //default, do nothing { item = "<a href='javascript:slide[MODULEID].navigateTo("+i+")' class='umg_page' id='page[MODULEID]_"+i+"'><img border='0' src='"+jQuery(this.umg_images[i]).attr("alt")+"' height='30' alt='' /></" + "a>"; } this.umg_thumbs.append(item); } } slide[MODULEID].previousHover = -1; slide[MODULEID].hoverTo = function(index) { this.ensureVisibility(index, this.previousHover, 2000); slide[MODULEID].previousHover = index; } slide[MODULEID].onMoveTo = function(index) { if (this.umg_index >= 0) { jQuery(this.umg_thumbs.find("#page[MODULEID]_" + this.umg_index)).removeClass("active"); } var currentThumb = jQuery(this.umg_thumbs.find("#page[MODULEID]_" + index)); currentThumb.addClass("active"); this.ensureVisibility(index, this.umg_index, "fast"); } slide[MODULEID].ensureVisibility = function(index, compareToIndex, speed) { if(this.umg_thumbs.height() <= this.umg_thumbslist.height()) return; var currentThumb = jQuery(this.umg_thumbs.find("#page[MODULEID]_" + index)); if (index > compareToIndex) { //scroll down var yOffset = currentThumb.position().top+currentThumb.height()+this.umg_thumbs.position().top; if (yOffset > this.umg_thumbslist.height() * .67) { var scrollTo = currentThumb.position().top*-1 + 42; if (scrollTo + this.umg_thumbs.height() < this.umg_thumbslist.height()) { scrollTo = this.umg_thumbslist.height() - this.umg_thumbs.height(); } this.umg_thumbs.animate({"top":scrollTo},"fast"); } } else { //up var yOffset = currentThumb.position().top+this.umg_thumbs.position().top; if (yOffset < this.umg_thumbslist.height() * .33) { var scrollTo = currentThumb.position().top*-1 + 42; if (scrollTo > 0) { scrollTo = 0; } this.umg_thumbs.animate({"top":scrollTo},"fast"); } } }
const mongoose = require('mongoose'); mongoose.connect('mongodb://localhost:27017/crud') .then(console.log('Database Connected') )
"use strict"; (function () { let person = { firstName: "Matheus", lastName: "Romano", age: 18, isAdult: function () { return person.age >= 18; }, }; let healthStats = { height: 78, weught: 200, }; function mergeStats(p, hp) { return Object.assign({}, p, hp); } let mergedPerson = mergeStats(person, healthStats); display(mergedPerson); display(person); let person2 = {}; Object.assign(person2, person); display(person2); display(person === person2); display("Print the keys od the object Person: " + Object.keys(person)); for (let propety in person) { display(`Print the keys of the object Person: ${propety}`); } })(); (function () { function registrationUser(fName, lName) { let person = { fName, lName, }; display(person); } registrationUser("MatALlaheus", "Romano"); })(); // (function () { // function Person(firstName, lastName, age) { // this.firstName = firstName; // this.lastName = lastName; // this.age = age; // this.isAdult = () => this.age > 21; // } // let matheus = new Person("Matheus", "Romano", 45); // let carla = new Person ("Carla", "Lazara", 14); // display(matheus.isAdult()) // display(carla.isAdult()) // })(); (function () { let person = { name: { firstName: "Matheus", lastName: "Romano", }, age: 15, }; for (let propertyName in person) { display(propertyName + ": " + person[propertyName]); } Object.defineProperty(person, "name", { writable: false }); // Object.freeze(person.name) person.name.lastName = "Braga"; display(person.name); display(Object.getOwnPropertyDescriptor(person, "firstName")); })(); (function () { display("=========================================================="); let person = { firstName: "Matheus", lastName: "Romano", age: 15, }; Object.defineProperty(person, "firstName", { enumerable: false }); for (let propertyName in person) { display(propertyName + ": " + person[propertyName]); } display(Object.keys(person)); display(JSON.stringify(person)); display(person.firstName); })(); (function () { display("=========================================================="); let person = { firstName: "Matheus", lastName: "Romano", age: 15, }; // Object.defineProperty(person,'firstName', {configurable: false}) // Object.defineProperty(person,'firstName', {enumerable: false}) // Object.defineProperty(person,'firstName', {writable: true}) delete person.firstName; for (let propertyName in person) { display(propertyName + ": " + person[propertyName]); } display(Object.keys(person)); display(JSON.stringify(person)); display(person.firstName); })(); (function () { display("=========================================================="); let person = { name: { first: "Matheus", last: "Romano" }, age: 15, }; Object.defineProperty(person, 'fullName', { get: function() { return this.name.first + " " + this.name.last}, set: function(value) { var nameParts = value.split('.'); this.name.first = nameParts[0]; this.name.last = nameParts[1]; }, }); person.fullName = 'LAla.LOLP' display(person.fullName) display(person.name.first); display(person.name.last) })();
require('dotenv').config(); module.exports = { apps: [ { name: 'heroku-line-bot-local', script: 'src/index.js', // From .env // Can't use process.env directly, or it will mess up with pm2 internals env: Object.assign({}, process.env), autorestart: true, watch: true, interpreter: './node_modules/.bin/babel-node', }, ], };
module.exports = { url : "mongodb://Evgen097:630ev630@ds137760.mlab.com:37760/myimagesearch" };
import React, { Component } from 'react'; import { Link } from 'react-router-dom'; import cx from 'classnames'; import { ReactComponent as Logo } from './logo.svg'; import styles from './Header.module.css'; import SocialLinks from '../../../components/SocialLinks'; import './logo.css'; export default class Header extends Component { state = { showNavModal: false, }; componentDidMount() { window.addEventListener('resize', this.onCloseNav); } componentWillUnmount() { window.removeEventListener('resize', this.onCloseNav); } onCloseNav = () => { this.setState({ showNavModal: false }, () => { document.body.classList.remove(styles.noScroll); }); }; onOpenNav = () => { this.setState({ showNavModal: true }, () => { document.body.classList.add(styles.noScroll); }); }; render() { const { showNavModal } = this.state; return ( <header className={styles.header}> <Link to="/" onClick={this.onCloseNav}><Logo /></Link> <div className={styles.titleContainer}> <Link to="/" onClick={this.onCloseNav} className={styles.title}><span className={styles.v}>vincent</span><span className={styles.sy}>sy</span><span className={styles.lo}>lo</span></Link> </div> <nav className={cx(styles.links, { [styles.modalOpen]: showNavModal, [styles.modalClosed]: !showNavModal, })}> <div className={styles.smallMenuHeader}> <Link to="/" onClick={this.onCloseNav}><Logo /></Link> <div className={styles.titleContainer}> <Link to="/" onClick={this.onCloseNav} className={styles.title}><span className={styles.v}>vincent</span><span className={styles.sy}>sy</span><span className={styles.lo}>lo</span></Link> </div> <button onClick={this.onCloseNav} className={styles.closeButton}><i className="fal fa-3x fa-times" /></button> </div> <SocialLinks /> <Link to="/contact" className={cx(styles.link, styles.contact)} onClick={this.onCloseNav}>get in touch</Link> { showNavModal ? <div className={styles.flex} /> : null } </nav> <button className={cx(styles.link, styles.smallOnly)} onClick={this.onOpenNav}><i className="fal fa-3x fa-bars" /></button> </header> ); } }
'use strict'; // Create a Circle constructor that creates a circle object: // it should take the circle's radius as a parameter // it should have a "getCircumference" method that returns it's circumference // it should have a "getArea" method that returns it's area // it should have a "toString" method that returns it's stats as a string like: // 'Radius: 4, Circumference: 25.132741228718345, Area: 50.26548245743669' var Circle = function(radius) { this.radius = radius; this.getCircumference = function() { var circumference = this.radius * Math.PI * 2 console.log(circumference) return circumference; } this.getArea = function() { var area = this.radius * this.radius * Math.PI; console.log(area); return area; } this.toString = function() { var s = 'Radius: ' + this.radius + ', Circumference: ' + this.getCircumference() + ', Area: ' + this.getArea(); return s; } }; module.exports = Circle; //var c = new Circle(4); //console.log(c.toString());
var bookshelf = require('../custom_modules/bookshelf').plugin('registry'); var course = require('./course'); var examination = require('./examination'); var schedule = require('./schedule'); var disciplinemedia = require('./disciplinemedia'); var media = require('./media'); module.exports = bookshelf.model('discipline', { tableName: 'discipline', course: function () { return this.belongsTo('course'); }, media: function () { return this.hasMany('media').through('disciplinemedia', 'id', 'discipline_id'); }, examinations: function(){ return this.hasMany('examination'); }, reinforcements: function(){ return this.hasMany('reinforcement'); }, classoptionals: function(){ return this.hasMany('classoptional'); }, warnings : function(){ return this.hasMany('warning'); }, schedules : function(){ return this.hasMany('schedule'); } });
function createSeaLevel(YEARS, YEARMARKINGS, WIDTH, HEIGHT) { const SEACANVAS = document.getElementById('sea-canvas'); SEACANVAS.style.height = HEIGHT + "px"; SEACANVAS.style.width = WIDTH + "px"; const SVGL = "http://www.w3.org/2000/svg"; // finds the minimum and maximum sea level number in the list of data function findMinMax() { var min = Number.POSITIVE_INFINITY; var max = Number.NEGATIVE_INFINITY; for (var i = 0; i < YEARS.length; i++) { var level = YEARS[i].seaLevel; if (level < min) { min = level; } if (level > max) { max = level; } } return [min, max]; } // creates an array storing the minimum and maximum values var minMax = findMinMax(); // stores the list containing the scaled sea levels correlating the height // of the viewport var scaledLevels = []; // creates a list containing the scaled sea levels to correlate to the height of the viewport for (var i = 0; i < YEARS.length; i++) { var year = YEARS[i]; var scaledLevel = scaleNumber(year.seaLevel); scaledLevels.push(Math.round(scaledLevel)); } // the function that scales the input sea-level to match the range dictated by the height of the viewport function scaleNumber(level) { var heightMin = HEIGHT * 0.75; var heightMax = HEIGHT * 0.25; var levelMinMaxPercent = minMax[1] - minMax[0]; var heightPercent = heightMax - heightMin; var levelPercent = ((level - minMax[0]) / levelMinMaxPercent); var scaled = (levelPercent * heightPercent) + heightMin; return scaled; } // creates and appends a line element to the sea-canvas svg for each of the sea level data points for (var i = 0; i < (YEARS.length - 1); i++) { var line = document.createElementNS(SVGL, 'line'); line.setAttributeNS(null, "x1", Math.floor(YEARMARKINGS[i])); line.setAttributeNS(null, "y1", scaledLevels[i]); line.setAttributeNS(null, "x2", Math.ceil(YEARMARKINGS[i + 1])); line.setAttributeNS(null, "y2", scaledLevels[i + 1]); line.setAttributeNS(null, "style", "stroke:rgb(255,255,255);stroke-width:5;z-index: 10;"); SEACANVAS.appendChild(line); } };
import React from 'react'; export const MotionCircle = ({ className = '', selectStyle, ...props }) => style => { const motionsProps = selectStyle(style); return ( <circle {...props} {...motionsProps} className={className} /> ); }; export default MotionCircle;
import BodyPart from './body_part'; class Feet extends BodyPart { constructor(owner, name) { super(owner, name, 'feet', 2); } } export default Feet;
import React from 'react'; import { makeStyles } from '@material-ui/core/styles'; import { Container, IconButton } from '@material-ui/core'; import SearchIcon from '@material-ui/icons/Search'; import OutlinedInput from '@material-ui/core/OutlinedInput'; import InputLabel from '@material-ui/core/InputLabel'; import InputAdornment from '@material-ui/core/InputAdornment'; import FormControl from '@material-ui/core/FormControl'; const useStyles = makeStyles((theme) => ({ root:{ display: 'flex', backgroundColor: theme.palette.primary.background, }, inputBar: { display: 'flex', alignItems: 'center', width: '100%', marginTop: '2%', }, input: { marginLeft: theme.spacing(1), flex: 1, padding: '8px 10px', }, searchIcon: { color: theme.palette.primary.main } })); export default function SearchBar() { const classes = useStyles(); return ( <div className={classes.root}> <Container maxWidth="sm" className={classes.inputBar}> <FormControl variant="outlined" fullWidth> <InputLabel >Enter track/artist</InputLabel> <OutlinedInput type='text' endAdornment={ <InputAdornment position="end"> <IconButton aria-label="search tracks/artists" edge="end" > <SearchIcon className={classes.searchIcon}/> </IconButton> </InputAdornment> } labelWidth={125} /> </FormControl> </Container> </div> ); };
import React, { Component } from 'react'; import "./style.css" class Input extends Component { constructor(props) { super(props); this.state = {} } render() { const { typeInput, nameInput, valueInput, onChangeInput, onClickInput } = this.props return ( <input className = "input" type={typeInput} name={nameInput} value={valueInput} onClick={onClickInput} onChange={onChangeInput} /> ); } } export default Input;
config({ 'editor/plugin/separator': {requires: ['editor']} });
// notes from tutor session with Michael // var gifApi = // "https://api.giphy.com/v1/gifs/search?api_key=LIpfrXPaXMHI0SPAQt9zVa9vl9FO69QT&q=shiba inu&limit=10&offset=0&rating=G&lang=en"; // $.ajax({ // url: gifApi, // method: "get" // }).then(function(response) { // var gifUrl = response.data[0].images["480w_still"].url; // renderGif(gifUrl); // }); // function renderGif(url) { // var img = $("<img>"); // img.attr("src", url); // $("#dogImages").append(img); // } ///I need to make an array of predetermined buttons // connect those buttons with Gif values //when clicking button make the 10 gifs repoulate and not endlessly stack gif groups on top of each other // add on click events for still and animate // add search button that will add new button with new gif values for that button $(document).ready(function() { // this is an array for the animals pre options on screen shiba inu and cat at the top because i love them!!!! have one shiba and two cats var animals = ["shiba", "cat", "panda", "kangaroo", "koala"]; // for(var i = 0; i < animals.length; i++) { var button = $("<button>").text(animals[i]); button.attr("data-animal", animals[i]); button.addClass("animal-button"); $("#button-array").append(button); } $(document).on("click", ".animal-button", function() { var animal = $(this).attr("data-animal"); var gifApi = //"https://api.giphy.com/v1/gifs/search?api_key=LIpfrXPaXMHI0SPAQt9zVa9vl9FO69QT&q=shiba inu&limit=10&offset=0&rating=G&lang=en"; // why doesn't my api url do any thing? i looked at others projects and it is formated differently than mine $.ajax({ url: gifApi, method: "get" }).then(function(response) { var gifUrl = response.data[0].images["480w_still"].url; renderGif(gifUrl); }); function renderGif(url) { var img = $("<img>"); img.attr("src", url); $("#dogImages").append(img); } // this part is what Tom had on the screen in office hours so i copied it to work on it with my tutor later // $(document).on("click", ".result", function() { // var state = $(this).attr("data-state"); // if(state === "still") { // $(this).attr("src", $(this).attr("data-animate")); // $(this).attr("data-state", "animate"); // } else { // $(this).attr("src", $(this).attr("data-still")); // $(this).attr("data-state", "still"); // } // });
import styled from 'styled-components'; const StyledCheckbox = styled.label` width: 20px; height: 20px; border: 1px solid #393A4B; display: flex; border-radius: 50%; align-items: center; justify-content: center; cursor: pointer; `; const StyledCheckboxInput = styled.input` &:checked + ${StyledCheckbox} { background-image: linear-gradient(-45deg, #C058F3, #55DDFF); &::before { content: url(${process.env.PUBLIC_URL}/assets/images/icon-check.svg); } } `; export default StyledCheckbox; export { StyledCheckboxInput }
var mod; mod = angular.module('infinite-scroll', []); mod.directive('infiniteScroll', [ '$rootScope', '$window', '$timeout', function($rootScope, $window, $timeout) { return { link: function(scope, elem, attrs) { var checkWhenEnabled, container, handler, scrollDistance, scrollEnabled; $window = angular.element($window); // infinite-scroll-distance specifies how close to the bottom of the page // the window is allowed to be before we trigger a new scroll. The value // provided is multiplied by the window height; for example, to load // more when the bottom of the page is less than 3 window heights away, // specify a value of 3. Defaults to 0. */ scrollDistance = 0; if (attrs.infiniteScrollDistance != null) { scope.$watch(attrs.infiniteScrollDistance, function(value) { return scrollDistance = parseInt(value, 10); }); } // infinite-scroll-disabled specifies a boolean that will keep the // infnite scroll function from being called; this is useful for // debouncing or throttling the function call. If an infinite // scroll is triggered but this value evaluates to true, then // once it switches back to false the infinite scroll function // will be triggered again. scrollEnabled = true; checkWhenEnabled = false; if (attrs.infiniteScrollDisabled != null) { scope.$watch(attrs.infiniteScrollDisabled, function(value) { scrollEnabled = !value; if (scrollEnabled && checkWhenEnabled) { checkWhenEnabled = false; return handler(); } }); } container = $window; // infinite-scroll-container sets the container which we want to be // infinte scrolled, instead of the whole window window. Must be an // Angular or jQuery element. if (attrs.infiniteScrollContainer != null) { scope.$watch(attrs.infiniteScrollContainer, function(value) { value = angular.element(value); if (value != null) { return container = value; } else { throw new Exception("invalid infinite-scroll-container attribute."); } }); } // infinite-scroll-parent establishes this element's parent as the // container infinitely scrolled instead of the whole window. if (attrs.infiniteScrollParent != null) { container = elem.parent(); scope.$watch(attrs.infiniteScrollParent, function() { return container = elem.parent(); }); } // infinite-scroll specifies a function to call when the window, // or some other container specified by infinite-scroll-container, // is scrolled within a certain range from the bottom of the // document. It is recommended to use infinite-scroll-disabled // with a boolean that is set to true when the function is // called in order to throttle the function call. handler = function() { var containerBottom, elementBottom, remaining, shouldScroll; if (container === $window) { containerBottom = container.height() + container.scrollTop(); elementBottom = elem.offset().top + elem.height(); } else { containerBottom = container.height(); elementBottom = elem.offset().top - container.offset().top + elem.height(); } remaining = elementBottom - containerBottom; shouldScroll = remaining <= container.height() * scrollDistance; if (shouldScroll && scrollEnabled) { if ($rootScope.$$phase) { return scope.$eval(attrs.infiniteScroll); } else { return scope.$apply(attrs.infiniteScroll); } } else if (shouldScroll) { return checkWhenEnabled = true; } }; container.on('scroll', handler); scope.$on('$destroy', function() { return container.off('scroll', handler); }); return $timeout((function() { if (attrs.infiniteScrollImmediateCheck) { if (scope.$eval(attrs.infiniteScrollImmediateCheck)) { return handler(); } } else { return handler(); } }), 0); } }; } ]);
import React, {Fragment, useState} from 'react'; import '@styles/block-carousel.css'; import itemsMap from '@/maps/itemPage/itemsMap'; let shuffle = function (arr) { for (let i = arr.length - 1; i > 0; i--) { let j = Math.floor(Math.random() * (i + 1)); [arr[i], arr[j]] = [arr[j], arr[i]]; }; }; let makeState4Carousel = function (arr) { let resArr = arr.map(item => ({...item})); shuffle(resArr); resArr.length = 10; resArr.map(item => { if (Array.isArray(item.img)) {item.img = item.img[0];}; if (item.img.path == "") {item.img.path = "noimage.jpg"}; item.name4Carousel = item.type; if (item.name4Carousel.length > 30) { item.name4Carousel = item.name4Carousel.substr(0, 27) + '...'; }; }); return resArr }; const CarouselItem = ({items}) => { function clickHandler (i) { let itemURL = new URL (window.location.href); itemURL.pathname = '/item'; itemURL.searchParams.set('type', items[i].type); window.location.href = itemURL; }; return( <Fragment> {items.map((item, i) => ( <div className="content__goodsCarousel_gallery_cardContainer box-sizing border_1px border-radius_4px" key={i} onClick={() => clickHandler(i)}> <figure className="carouselCard flex flex-direction_column align-items_center"> <div className="carouselCard_imgContainer flex"> <img src={item.img.path} className="carouselCard_img" /> </div> <figcaption className="carouselCard_name cardName font-size_12px"> {item.name4Carousel} </figcaption> </figure> </div> ))} </Fragment> ) }; export const Carousel = () => { const [carouselState, setCarouselState] = useState({ step: 170, // ширина элемента, шаг сдвига карусели count: 3, // видимое количество изображений position: 0, // положение ленты прокрутки // itemsArr: carouselItemsTest, // массив айтемов itemsArr: makeState4Carousel(itemsMap), // массив айтемов intervalOn: false }); function clickPrevCarousel () { // сдвиг влево let newPosition = carouselState.position + carouselState.step; newPosition = Math.min(newPosition, 0); setCarouselState(prevState => ({ ...prevState, position: newPosition })); }; function clickNextCarousel () { // сдвиг вправо let newPosition = carouselState.position - carouselState.step; newPosition = Math.max(newPosition, -carouselState.step * (carouselState.itemsArr.length - carouselState.count)); setCarouselState(prevState => ({ ...prevState, position: newPosition })); }; if (!carouselState.intervalOn) { // автоматическая прокрутка setCarouselState(prevState => ({ ...prevState, intervalOn: true })); let rebuildState = function (prevState) { let newState = {...prevState}; if (newState.position == -newState.step * (newState.itemsArr.length - newState.count)) { newState.position = 0; } else { let newPosition = newState.position - newState.step; newPosition = Math.max(newPosition, -newState.step * (newState.itemsArr.length - newState.count)); newState.position = newPosition; }; return newState }; setInterval(function() { setCarouselState(prevState => rebuildState(prevState)) },3000); }; return( <div className="content__containerGoods flex justify-content_center" > <div className="content__goodsCarousel flex align-items_center justify-content_center"> <div className="content__goodsCarousel_arrow prevCarousel border_1px border-radius_4px flex align-items_center" onClick={clickPrevCarousel}>◄</div> <div className="content__goodsCarousel_galleryWindow"> <div className="content__goodsCarousel_gallery flex" style={{marginLeft: carouselState.position + 'px'}}> <CarouselItem items = {carouselState.itemsArr}/> </div> </div> <div className="content__goodsCarousel_arrow nextCarousel border_1px border-radius_4px flex align-items_center" onClick={clickNextCarousel}>►</div> </div> </div> ) }
/** * 1.理解图 7-1 * 2.参考 p181 利用闭包和循环生成一个数组,数组的每一项都是一个函数,该函数执行结果返回数组下标对应的字符串 * arr[0]() 返回 '0',arr[1]() 返回 '1' * 3.结合前面章节 4.3 垃圾回收理解内存泄漏 * 4.结合闭包创建一个构造函数 Glj,拥有一个 私有变量 secret,拥有一个函数 seeSecret,函数返回 secret 的值 * 实例化一个 Glj,尝试调用 secret 属性,再调用 seeSecret,理解其中作用 * 5.理解单例模式,并结合闭包创建一个函数 getGlj,有一个私有变量 glj,当 glj 未定义时实例化一个 Glj 并赋值给 glj, * 当 glj 已经定义时返回 glj */ function createArray(num) { const result = new Array(); for (var i = 0; i <= num; i++) { result[i] = function (num1) { return function () { return num1; } }(i); } return result; } const arr = createArray(10); console.log(arr[0](), arr[1]()); function Glj() { const secret = 'glj is lolikon'; this.seeSecret = function () { return secret; } } const glj = new Glj(); console.log(glj.seeSecret()); const getGlj = (function () { let glj; return function () { if (!glj) { glj = new Glj(); } return glj; } })();
const http = require('http'); const countStudents = require('./3-read_file_async'); const hostname = 'localhost'; const port = 1245; const file = process.argv[2]; const app = http.createServer(async (req, res) => { res.statusCode = 200; res.setHeader('Content-Type', 'text/plain'); if (req.url === '/') { res.end('Hello Holberton School!'); } else if (req.url === '/students') { res.write('This is the list of our students\n'); try { const students = await countStudents(file); res.end(`${students.join('\n')}`); } catch (e) { res.end(e.message); } res.statusCode = 404; res.end(); } }); app.listen(port, hostname, () => { console.log(`Server running at http://${hostname}:${port}/`); }); module.exports = app;
import Vue from 'vue' import VueRouter from 'vue-router' Vue.use(VueRouter) import user from '@components/user.vue'; import warship from '@components/warship.vue'; import activity from '@components/activity.vue'; export default new VueRouter({ linkActiveClass:'list-active', routes:[ { path:'/', redirect:'/user', component:user }, { path:'/user', component:user }, { path:'/warship', component:warship }, { path:'/activity', component:activity } ] })
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.PartnerController = void 0; var CrudController_1 = require("../CrudController"); var geo_1 = require("../../common/geo"); var constants = require("../../config/constants"); var PartnerController = /** @class */ (function (_super) { __extends(PartnerController, _super); function PartnerController() { return _super !== null && _super.apply(this, arguments) || this; } PartnerController.prototype.create = function (req, res) { throw new Error("Method not implemented."); }; PartnerController.prototype.read = function (req, res) { var fs = require('fs'); var _ = require('underscore'); var partners = JSON.parse(fs.readFileSync(constants.DB)).partners; var org = req.query.org; var kilometers = req.query.kms; var lat = req.query.lat; var lng = req.query.lng; if (org != undefined && org != "") { partners = _.filter(partners, function (p) { if (p.organization.toLowerCase().includes(org)) return p; }); } if (lat != undefined && lat != "" && lng != undefined && lng != "" && kilometers != undefined && kilometers != 0) { partners.forEach(function (partner) { var displayPartner = false; if (partner.offices !== undefined) { var offices = partner.offices; offices.forEach(function (office) { if (office.coordinates) { var coordinates = (office.coordinates).split(","); var km_far = geo_1.geoDistance(lat, lng, coordinates[0], coordinates[1], 'K'); office.km_far = km_far; // multiply by 1000 to change to meters. var withinRadius = false; if (km_far <= kilometers) { displayPartner = true; withinRadius = true; } office.withinRadius = withinRadius; } }); } partner.displayPartner = displayPartner; }); partners = _.where(partners, { "displayPartner": true }); } partners = _.sortBy(partners, 'organization'); res.json({ partners: partners }); }; PartnerController.prototype.update = function (req, res) { throw new Error("Method not implemented."); }; PartnerController.prototype.delete = function (req, res) { throw new Error("Method not implemented."); }; return PartnerController; }(CrudController_1.CrudController)); exports.PartnerController = PartnerController;
describe('content resolver', () => { it('has this pointless test', () => { expect(true).toBe(true) }) })
var array = []; while (true) { var input = prompt("Введите число", 0); if (input === "" || input === null || isNaN(input)) break; array.push(+input); } var sum = 0; for (var i = 0; i < array.length; i++) { sum += array[i]; } alert(sum);
import React,{useContext,useEffect} from 'react' import AuthContext from '../auth/AuthContext'; // const About = (props) => { // const authcontext=useContext(AuthContext); // const {isAuthentocated,loadUser}=authcontext; // useEffect(() => { // if(isAuthentocated){ // loadUser(); // }else{ // props.history.push("/login"); // } // }, [isAuthentocated,props.history]); // return ( // <div> // <h3 className="alert alert-success">About App page</h3> // </div> // ) // } export const About = () => { return ( <div> <h3 className="alert alert-success">About App page</h3> </div> ) } export default About
import axios from 'axios' import { API } from 'Constants/CommonConstants' export const postRegister = async (data) => { const response = await axios.post(API.USER, data) return response } export const updateUser = async (data, id) => { const response = await axios.patch(`${API.USER}/${id}`, data) return response } export const getLogin = async (data) => { const response = await axios.get(API.USER, { params: data, }) return response } export const deleteCart = async (id) => { const response = await axios.delete(`${API.USER}/${id}`) return response }
import React from 'react'; import PropTypes from 'prop-types'; const ErrorDialog = ({ error }) => { if (!error) return null; let { message, handlers } = error; let buttons = Object.keys(handlers).map((label) => <button key={label} onClick={ handlers[label] }>{ label }</button>); return (<div className="error-dialog dialog"> <div className="box"> <h1>Error</h1> <p>{ message }</p> { buttons } </div> </div>); }; ErrorDialog.propTypes = { error: PropTypes.shape({ message: PropTypes.string.isRequired, handlers: PropTypes.object.isRequired }) }; export default ErrorDialog;
import React, {Fragment} from 'react'; import {Layout} from "../Layout"; import {OutingList} from "../Outing"; import {isLogged} from "../../functions/logged"; import {Carousel} from "../Carousel"; import {TextContainer} from "../Layout/TextContainer"; import {Button} from 'reactstrap'; import {redirectTo} from "../../functions/redirect"; const welcomeItems = [ { icon: 'question-circle', title: `Qu'est ce que eScort ?`, description: `eScort est un service qui facilite la mise en relation de plusieurs personnes ou groupes de personnes. Grâce à cette application vous pourrez découvrir les sorties organisées autour de chez vous, et découvrir de nouvelles personnes. Vous êtes nouvel arrivant dans une ville et vous ne souhaitez pas passer votre temps libre seul, vous êtes sociable et adorez passer des moments en groupe avec de nouvelles personnes, alors cette application est faite pour vous`, }, { icon: 'user-shield', title: `Votre anonymat avant tout`, description: `Nous ne stockons aucune donnée, si ce n'est juste votre email, votre nom d'utilisateur et votre mot de passe afin de pouvoir vous authentifier. Aucune donnée n'est revendue ni exploitée par notre service ou par un tiers, nous mettons votre anonymat sur un piédestal afin de réduire au maximum les apprioris sur les gens.`, }, { icon: 'users', title: `Envie de rencontrer du monde ?`, description: `Rien de plus simple, il suffit de s'inscrire pour accéder aux sorties disponibles près de chez vous. Il ne vous reste plus qu'à nous rejoindre et poster ou rejoindre une sortie pour commencer l'aventure.`, }, { icon: 'money-bill-alt', title: `Investissez et obtenez des royalties`, description: `L'application étant 100% gratuite, vous pouvez participer à son développement en effectuant des dons pour soutenir le projet, en échange vous obtenez un pourcentage de parts dans l'entreprise en fonction du total donné par tous les contributeurs. Plus vous donnez, plus vous obtenez de pourcentage de parts.`, learnMore: '/cashback' }, ]; export const Welcome = ({fetch_outings_error, is_fetching_outings, outing_created_elements, outings_list,...rest}) => ( <Layout defaultContainer={isLogged()} {...rest}> { isLogged() ? <div className={'pt-4 pb-4'}> <OutingList {...rest}/> </div>: <WelcomeDefault {...rest}/> } </Layout> ); const WelcomeDefault = ({history}) => ( <Fragment> <Carousel/> { welcomeItems.map((welcomeItem, index) => ( <TextContainer key={index} reverse={index%2 === 1} content={welcomeItem} history={history}/> )) } <div className={`reverse bg-register-welcome text-center`}> <div className={'pt-5 pb-5 bg-opacity'}> <h1 className={'text-center pb-2'}>Commence l'aventure dès maintenant</h1> <Button className={'primary fsr-3 pl-4 pr-4'} onClick={() => redirectTo(history, '/register')}>Inscris-toi !</Button> </div> </div> </Fragment> );
import React, { Component } from 'react'; import lessThan from '../images/less-than.png'; import greatrThan from '../images/greater-than.png'; const testimonialArray = [ { id: 0, author: "Barry Z", text: <div className="Testimonial-slide-in"> <em> "Incredible thanks to Trevor, who in 1 week, produced what the [OMITTED] vendor could not do in 8 weeks (and 13 teleconferences)" </em></div> }, { id: 1, author: "JoAnna N", text: <div className="Testimonial-slide-in-c"><em> <p> "I used to struggle with my website (formatting, updating, getting it to look and work the way I want it to). </p> <p> Having Trevor take the reins on it has <strong> made my life easier and my online business more streamlined and able to flourish</strong>. </p> <p> He is patient, knowledgeable, diligent, and a pleasure to work with. <br /> I highly recommend him to anyone looking for website help that wants to work with someone trustworthy, caring, and conscientious!" </p></em> </div> }, { id: 2, author: "Bob H", text: <div className="Testimonial-slide-in"><em> "Trevor did an excellent job, and was able to execute any request I had." </em></div> } ]; const oneDot = <div className="dots-container"> <div className="solid-dot"></div> <div className="empty-dot"></div> <div className="empty-dot"></div> </div> const twoDots = <div className="dots-container"> <div className="empty-dot"></div> <div className="solid-dot"></div> <div className="empty-dot"></div> </div> const threeDots = <div className="dots-container"> <div className="empty-dot"></div> <div className="empty-dot"></div> <div className="solid-dot"></div> </div> class TestimonialSlider extends Component { constructor(props){ super(props); this.state = { testimonial: testimonialArray[0].text, testimonialSource: testimonialArray[0].author, testimonialAnimation: false, testimonialId: testimonialArray[0].id, testimonialDots: oneDot } this.testimonialHandlerLeft = this.testimonialHandlerLeft.bind(this); this.testimonialHandlerRight = this.testimonialHandlerRight.bind(this); } testimonialHandlerRight(){ if(this.state.testimonial === testimonialArray[0].text){ this.setState({ testimonialId: testimonialArray[1].id, testimonial: testimonialArray[1].text, testimonialSource: testimonialArray[1].author, testimonialDots: twoDots }) } else if (this.state.testimonial === testimonialArray[1].text){ this.setState({ testimonialId: testimonialArray[2].id, testimonial: testimonialArray[2].text, testimonialSource: testimonialArray[2].author, testimonialDots: threeDots }) } else { this.setState({ testimonialId: testimonialArray[0].id, testimonial: testimonialArray[0].text, testimonialSource: testimonialArray[0].author, testimonialDots: oneDot }) } } testimonialHandlerLeft(){ if(this.state.testimonial === testimonialArray[1].text){ this.setState({ testimonialId: testimonialArray[0].id, testimonial: testimonialArray[0].text, testimonialSource: testimonialArray[0].author, testimonialDots: oneDot }) } else if (this.state.testimonial === testimonialArray[2].text){ this.setState({ testimonialId: testimonialArray[1].id, testimonial: testimonialArray[1].text, testimonialSource: testimonialArray[1].author, testimonialDots: twoDots }) } else { this.setState({ testimonialId: testimonialArray[2].id, testimonial: testimonialArray[2].text, testimonialSource: testimonialArray[2].author, testimonialDots: threeDots }) } } render(){ return( <div className="TestimonialSlider-container"> <h2 className="Align-center White">Don't just take my word for it, see what my clients are saying:</h2> <div className="TestimonialSlider White"> <div> <img src={lessThan} alt="Testimonial Left" className="left-testimonial-btn See-more-btn" onClick={this.testimonialHandlerLeft} /> {/* <button className="See-more-btn left-testimonial-btn" onClick={this.testimonialHandlerLeft} >{"<"}</button> */} {/* <button onClick={this.testimonialHandlerRight} className="See-more-btn">{">"}</button> */} <img src={greatrThan} alt="Testimonial Right" className="right-testimonial-btn See-more-btn" onClick={this.testimonialHandlerRight} /> <div onTouchStart={this.testimonialHandlerRight}> {this.state.testimonial} </div> <div className="Font-weight-700"> {this.state.testimonialSource} </div> <div className="dots-container"> {this.state.testimonialDots} </div> </div> </div> </div> ); } } export default TestimonialSlider;
module.exports = `//#version 300 es attribute vec4 aVertexPosition; attribute float aVertexIndex; uniform mat4 uModelViewMatrix; uniform mat4 uProjectionMatrix; uniform bool magicZoom; uniform float nodeSize; uniform float zoom; varying vec4 vVertexColor; const float MAX_NODE_SIZE = 38.0; // unsigned rIntValue = (u_color / 256 / 256) % 256; // unsigned gIntValue = (u_color / 256 ) % 256; // unsigned bIntValue = (u_color ) % 256; // https://stackoverflow.com/questions/6893302/decode-rgb-value-to-single-float-without-bit-shift-in-glsl // had to flip r and b to match concrete notation vec3 unpackColor(float f) { vec3 color; color.r = floor(f / 256.0 / 256.0); color.g = floor((f - color.r * 256.0 * 256.0) / 256.0); color.b = floor(f - color.r * 256.0 * 256.0 - color.g * 256.0); // now we have a vec3 with the 3 components in range [0..255]. Let's normalize it! return color / 255.0; } void main() { gl_Position = uProjectionMatrix * uModelViewMatrix * aVertexPosition; if (magicZoom) { gl_PointSize = MAX_NODE_SIZE; } else { float size = nodeSize * MAX_NODE_SIZE * zoom; gl_PointSize = max(size, 5.0); } vVertexColor = vec4(unpackColor(aVertexIndex), 1.0); }`
import { html, LitElement } from 'lit-element'; import '@polymer/iron-icons/iron-icons.js'; import '@polymer/iron-icons/social-icons.js'; import sharedStyles from '../../style/app.scss'; import landingStyles from '../../style/landing-page.scss'; import homeSearchStyles from '../../style/homepage-searchV2.scss'; class homeSearchV2 extends LitElement { static get styles() { return [sharedStyles, landingStyles, homeSearchStyles]; } render() { return html` <div class="field home-search"> <div class="control has-icons-left home-searchIcon"> <input class="input is-rounded" type="search" placeholder="Search for keywords like 'open apereo' " /> <span class="icon is-left "> <iron-icon icon="search"></iron-icon> </span> </div> </div> `; } } window.customElements.define('home-search-v2', homeSearchV2);
import axios from 'axios'; import types from './types'; import { addFlashMessage } from './flashMessage' const { SET_PAGE, PAGE_FETCHED, SET_PAGER } = types; const limit = (count, p) => `limit=${count}&offset=${p?p*count: 0}`; const encode = encodeURIComponent; export const setPage = ({ page, items }) => ({ type: SET_PAGE, page, ...items }); export const pageFetched = (page) => ({ type: PAGE_FETCHED, page }) export const setPager = (pager) => ({ type: SET_PAGER, pager }); export const getBooks = (page) => ( dispatch => axios.get(`users/books?${limit(10, page)}`) .then(response => { const { books } = response.data dispatch(setPage({ page, books })) }) .catch(errors => { dispatch(addFlashMessage({ type: 'error', text: errors.response.data.message })); }) ) export const getAuthors = (page) => ( dispatch => axios.get(`authors/books?${limit(10,page)}`) .then(response => { const { authors } = response.data dispatch(setPage({ page, authors })); }) .catch(errors => { dispatch(addFlashMessage({ type: 'error', text: errors.response.data.message })); }) ) export const fetchPage = (page, items, onPageChange) => ( (dispatch, getState) => { let { pager } = getState().pagination; if (page < 1 || page > pager.totalPages) { return; } // get new pager object for specified object pager = getPager(items.length, page, 4) const { startIndex, endIndex } = pager; // get new page of items from items array let pageOfItems = items.slice(startIndex, endIndex + 1); //call change page function in parent component onPageChange(pageOfItems); dispatch(setPager(pager)); } ) export const getPager = (totalItems, currentPage = 1, pageSize = 5) => { //calculate total pages let totalPages = Math.ceil(totalItems / pageSize); let startPage, endPage; if (totalPages <= 5) { //less than 5 total pages show all startPage = 1; endPage = totalPages; } else { //more than 5 total pages, calculate start and end pages if (currentPage <= 3) { startPage = 1; endPage = 5; } else if (currentPage + 2 >= totalPages) { startPage = totalPages - 4; endPage = currentPage + 2; } else { startPage = currentPage - 2; endPage = currentPage + 2 } } // calculate start and end item indexes let startIndex = (currentPage - 1) * pageSize; let endIndex = Math.min(startIndex + pageSize - 1, totalItems - 1); // create an array of pages to ng-repeat in the pager control let pages = _.range(startPage, endPage + 1); // return object with all pager properties required by the view return { totalItems: totalItems, currentPage: currentPage, pageSize: pageSize, totalPages: totalPages, startPage: startPage, endPage: endPage, startIndex: startIndex, endIndex: endIndex, pages: pages }; }
import React from "react"; import { getTopTracks } from "../../helper"; import styled from "styled-components"; import TrackCard from "../../components/TrackCard"; const Text = styled.h1` color: white; `; const Subtitle = styled.div` font-weight: 700; color: white; `; const TrackList = ({ tracks }) => { return tracks.map((track, index) => ( <TrackCard name={track.name} trackId={track.trackId} thumbnailSrc={track.thumbnailSrc} artistName={track.artistName} songSrc={track.songSrc} key={index} /> )); }; const Loader = () => { return <Subtitle>Loading.. Please wait..</Subtitle>; }; const PlaylistPage = () => { const [tracks, setTracks] = React.useState([]); const [isLoading, setIsLoading] = React.useState(false); React.useEffect(() => { setIsLoading(true); async function fetchTopTracks() { const result = await getTopTracks(); setTracks(result); } fetchTopTracks(); setIsLoading(false); }, []); return ( <div> <Text>Playlist Page</Text> {isLoading ? <Loader /> : <TrackList tracks={tracks} />} </div> ); }; export default PlaylistPage;
import initDebug from 'debug'; import newShopbacker from './new'; import { ACTIONS_ID } from '../config'; const debug = initDebug('happy:slack:skills:shopbacker:submission'); export default (controller) => { debug('Skill learned!'); controller.on('dialog_submission', (bot, message) => { switch (message.callback_id) { case ACTIONS_ID.new: newShopbacker(bot, message); break; case ACTIONS_ID.edit: newShopbacker(bot, message); break; case ACTIONS_ID.joinProject: newShopbacker(bot, message); break; case ACTIONS_ID.leaveProject: newShopbacker(bot, message); break; default: bot.reply(message, 'Could not this submission!'); } }); };
import React, { Component } from 'react' import { Card, Button, Form, Col, InputGroup } from 'react-bootstrap'; import {UtilityFunctions as UF} from '../../Common/Util'; import SSM from '../../Common/SimpleStateManager'; import Wrap from '../../Common/Wrap'; import '../../Components/SellerPage/SellerPage.css'; import SimpleMessageModal from '../SimpleMessageModal/SimpleMessageModal'; import BE from '../../Common/comm'; export default class CheckOutForm extends Component { constructor(props){ super(props); this.backToManagerCB = props.backToManagerCB; this.submitCB = props.submitCB; this.state = { form:{ isValid:false, }, mName:props.data ? props.data.Name : "" , mPhoneNumber: props.data ? props.data.mPhoneNumber : "", mAddress: props.data ? props.data.mAddress : "", mBuyerEmail: props.data? props.data.mBuyerEmail : "" } } renderItemCreationForm(){ let validated = this.state.form.isValid; let ele = <div className="bodyDiv"> <div className="bodyContent"> <Form className="createShopForm" noValidate validated={validated} onSubmit={this.handleSubmit}> <Form.Row> <Form.Group controlId="validationCustom01"> <Form.Label>Your name</Form.Label> <Form.Control required type="text" placeholder="full name" name="mName" value = {this.state.mName} onChange = {this.handleInputChange.bind(this)} /> <Form.Control.Feedback>Looks good!</Form.Control.Feedback> </Form.Group> </Form.Row> <Form.Row> <Form.Group controlId="validationCustom02"> <Form.Label>Phone Number</Form.Label> <Form.Control required type="text" placeholder="phone" name="mPhoneNumber" value = {this.state.mPhoneNumber} onChange = {this.handleInputChange.bind(this)} /> <Form.Control.Feedback>Looks good!</Form.Control.Feedback> </Form.Group> </Form.Row> <Form.Row> <Form.Group controlId="validationCustomUsername"> <Form.Label>Email</Form.Label> <InputGroup> <InputGroup.Prepend> <InputGroup.Text id="inputGroupPrepend">@</InputGroup.Text> </InputGroup.Prepend> <Form.Control type="text" placeholder="Image URL" aria-describedby="inputGroupPrepend" required name="mBuyerEmail" value = {this.state.mBuyerEmail} onChange = {this.handleInputChange.bind(this)} /> <Form.Control.Feedback type="invalid"> This link is already taken. </Form.Control.Feedback> </InputGroup> </Form.Group> </Form.Row> <Form.Row> <Form.Group controlId="ItemDescription"> <Form.Label>Address</Form.Label> <Form.Control as="textarea" rows="3" name="mAddress" value = {this.state.mAddress} onChange = {this.handleInputChange.bind(this)} /> </Form.Group> </Form.Row> <Form.Row> <Form.Group> <Button type="submit">Confirm</Button> <Button type="button" variant="secondary" onClick={()=>this.backToManagerCB()}>Back</Button> </Form.Group> </Form.Row> </Form> </div> </div> return ele; } handleSubmit = (event) => { const form = event.currentTarget; event.preventDefault(); event.stopPropagation(); if (form.checkValidity() === false) { console.log("Invalid form , handle "+ form.checkValidity()) }else{ this.setValidated(true); let items = { Name: this.state.mName, mPhoneNumber : this.state.mPhoneNumber, mBuyerEmail: this.state.mBuyerEmail, mAddress: this.state.mAddress } this.submitCB(items); this.backToManagerCB(); } }; setValidated(isValidated){ this.setState({ form:{ isValid:isValidated } }) } handleInputChange(event) { const target = event.target; const value = target.type === 'checkbox' ? target.checked : target.value; const name = target.name; this.setState({ [name]: value }); } render() { return ( <Wrap> {this.renderItemCreationForm()} </Wrap> ) } }
var assert = require('chai').assert; var helpers = require('../src/helpers.js'); describe('inArray', () => { it('should throw an error if no arguments passed to inArray()', () => { assert.throw( () => {helpers.inArray()}, Error, "Second parameter to inArray() must be an array" ); }); it('should throw an error if only 1 argument passed to inArray()', () => { assert.throw( () => {helpers.inArray(1)}, Error, "Second parameter to inArray() must be an array" ); }); it('should throw an error if the 2nd argument passed to inArray() is not an array', () => { assert.throw( () => {helpers.inArray(1, {})}, Error, "Second parameter to inArray() must be an array" ); }); it('should return true for "a" in the array ["1", "a", "$"]', () => { assert.isTrue(helpers.inArray("a", ["1", "a", "$"])); }); it('should return false for "a" in the array ["1", "b", "$"]', () => { assert.isFalse(helpers.inArray("a", ["1", "b", "$"])); }); }); describe('isArray', () => { it('should return false for an empty object', () => { assert.isFalse(helpers.isArray({})); }); it('should return false for an object', () => { assert.isFalse(helpers.isArray({foo: 'bar'})); }); it('should return true for an empty array', () => { assert.isTrue(helpers.isArray([])); }); it('should return true for an array', () => { assert.isTrue(helpers.isArray([1, 2, 'abc', {}])); }); it('should return false if no argument passed', () => { assert.isFalse(helpers.isArray()); }); it('should return false if a number is passed', () => { assert.isFalse(helpers.isArray(1)); }); it('should return false if a number object is passed', () => { assert.isFalse(helpers.isArray(new Number(1))); }); it('should return false if a string is passed', () => { assert.isFalse(helpers.isArray('abc123')); }); it('should return false if a string object is passed', () => { assert.isFalse(helpers.isArray(new String("abc123"))); }); it('should return false if a function is passed', () => { assert.isFalse(helpers.isArray(function(){})); }); it('should return false if true is passed', () => { assert.isFalse(helpers.isArray(true)); }); it('should return false if false is passed', () => { assert.isFalse(helpers.isArray(false)); }); }); describe('isBoolean', () => { it('should return false for an empty object', () => { assert.isFalse(helpers.isBoolean({})); }); it('should return false for an object', () => { assert.isFalse(helpers.isBoolean({foo: 'bar'})); }); it('should return false for an empty array', () => { assert.isFalse(helpers.isBoolean([])); }); it('should return false if no argument passed', () => { assert.isFalse(helpers.isBoolean()); }); it('should return false if a number is passed', () => { assert.isFalse(helpers.isBoolean(1)); }); it('should return false if a number object is passed', () => { assert.isFalse(helpers.isBoolean(new Number(1))); }); it('should return false if a string is passed', () => { assert.isFalse(helpers.isBoolean('abc123')); }); it('should return false if a string object is passed', () => { assert.isFalse(helpers.isBoolean(new String("abc123"))); }); it('should return false if a function is passed', () => { assert.isFalse(helpers.isBoolean(function(){})); }); it('should return true if true is passed', () => { assert.isTrue(helpers.isBoolean(true)); }); it('should return true if false is passed', () => { assert.isTrue(helpers.isBoolean(false)); }); }); describe('isDate', () => { it('should return false for an empty string', () => { assert.isFalse(helpers.isDate('')); }); it('should return false for a number', () => { assert.isFalse(helpers.isDate(1)); }); it('should return false when no arguments are passed', () => { assert.isFalse(helpers.isDate()); }); it('should return false for null', () => { assert.isFalse(helpers.isDate(null)); }); it('should return false for undefined', () => { assert.isFalse(helpers.isDate(undefined)); }); it('should return false for an empty object', () => { assert.isFalse(helpers.isDate({})); }); it('should return false for a date string', () => { assert.isFalse(helpers.isDate('October 13, 2014 11:13:00')); }); it('should return true for a date object created with a date string', () => { assert.isTrue(helpers.isDate(new Date('October 13, 2014 11:13:00'))); }); it('should return true for a date object created with a year-month-day date string', () => { assert.isTrue(helpers.isDate(new Date('1999-12-31'))); }); it('should return true for a date object created with 1 Unix time parameter', () => { assert.isTrue(helpers.isDate(new Date(86400000))); }); it('should return true for a date object created with multiple parameters', () => { assert.isTrue(helpers.isDate(new Date(1995, 11, 17, 3, 24, 0))); }); it('should return false for an array', () => { assert.isFalse(helpers.isDate([1, 2, 4, 0])); }); }); describe('isNumber', () => { it('should return false for an empty object', () => { assert.isFalse(helpers.isNumber({})); }); it('should return false for an object', () => { assert.isFalse(helpers.isNumber({foo: 'bar'})); }); it('should return false for an empty array', () => { assert.isFalse(helpers.isNumber([])); }); it('should return false if no argument passed', () => { assert.isFalse(helpers.isNumber()); }); it('should return true if a number is passed', () => { assert.isTrue(helpers.isNumber(1)); }); it('should return true if a number object is passed', () => { assert.isTrue(helpers.isNumber(new Number(1))); }); it('should return false if a string is passed', () => { assert.isFalse(helpers.isNumber('abc123')); }); it('should return false if a string object is passed', () => { assert.isFalse(helpers.isNumber(new String("abc123"))); }); it('should return false if a function is passed', () => { assert.isFalse(helpers.isNumber(function(){})); }); }); describe('isObject', () => { it('should return true for an empty object', () => { assert.isTrue(helpers.isObject({})); }); it('should return true for an object', () => { assert.isTrue(helpers.isObject({foo: 'bar'})); }); it('should return false for an empty array', () => { assert.isFalse(helpers.isObject([])); }); it('should return false if no argument passed', () => { assert.isFalse(helpers.isObject()); }); it('should return false if a number is passed', () => { assert.isFalse(helpers.isObject(1)); }); it('should return false if a number object is passed', () => { assert.isFalse(helpers.isObject(new Number(1))); }); it('should return false if a string is passed', () => { assert.isFalse(helpers.isObject('abc123')); }); it('should return false if a string object is passed', () => { assert.isFalse(helpers.isObject(new String("abc123"))); }); it('should return false if a function is passed', () => { assert.isFalse(helpers.isObject(function(){})); }); it('should return true for a date object created with a date string', () => { assert.isTrue(helpers.isObject(new Date('October 13, 2014 11:13:00'))); }); it('should return true for a object in a prototype chain', () => { function Graph() { this.vertices = []; this.edges = []; } Graph.prototype = { addVertex: function(v) { this.vertices.push(v); } }; var graph = new Graph(); assert.isTrue(helpers.isObject(graph)); }); it('should return true for a object in an Object.create() prototype chain', () => { var a = {a: 1}; var b = Object.create(a); var c = Object.create(b); assert.isTrue(helpers.isObject(c)); }); }); describe('isString', () => { it('should return false for an empty object', () => { assert.isFalse(helpers.isString({})); }); it('should return false for an object', () => { assert.isFalse(helpers.isString({foo: 'bar'})); }); it('should return false for an empty array', () => { assert.isFalse(helpers.isString([])); }); it('should return false if no argument passed', () => { assert.isFalse(helpers.isString()); }); it('should return false if a number is passed', () => { assert.isFalse(helpers.isString(1)); }); it('should return false if a number object is passed', () => { assert.isFalse(helpers.isString(new Number(1))); }); it('should return false if a function is passed', () => { assert.isFalse(helpers.isString(function(){})); }); it('should return true if a string is passed', () => { assert.isTrue(helpers.isString('abc123')); }); it('should return true if a string object is passed', () => { assert.isTrue(helpers.isString(new String("abc123"))); }); }); describe('makeDateObj', () => { it('should return the correct year for "2010-02-14"', () => { const date_obj = helpers.makeDateObj('2010-02-14'); assert.isTrue(date_obj.year === '2010'); }); it('should return the correct month for "2010-02-14"', () => { const date_obj = helpers.makeDateObj('2010-02-14'); assert.isTrue(date_obj.month === '02'); }); it('should return the correct day for "2010-02-14"', () => { const date_obj = helpers.makeDateObj('2010-02-14'); assert.isTrue(date_obj.day === '14'); }); it('should return the correct hour for "2010-02-14"', () => { const date_obj = helpers.makeDateObj('2010-02-14'); assert.isTrue(date_obj.hour === '00'); }); it('should return the correct minute for "2010-02-14"', () => { const date_obj = helpers.makeDateObj('2010-02-14'); assert.isTrue(date_obj.min === '00'); }); it('should return the correct second for "2010-02-14"', () => { const date_obj = helpers.makeDateObj('2010-02-14'); assert.isTrue(date_obj.sec === '00'); }); it('should return the correct year for "1987-10-01 14:30:56"', () => { const date_obj = helpers.makeDateObj('1987-10-01 14:30:56'); assert.isTrue(date_obj.year === '1987'); }); it('should return the correct month for "1987-10-01 14:30:56"', () => { const date_obj = helpers.makeDateObj('1987-10-01 14:30:56'); assert.isTrue(date_obj.month === '10'); }); it('should return the correct day for "1987-10-01 14:30:56"', () => { const date_obj = helpers.makeDateObj('1987-10-01 14:30:56'); assert.isTrue(date_obj.day === '01'); }); it('should return the correct hour for "1987-10-01 14:30:56"', () => { const date_obj = helpers.makeDateObj('1987-10-01 14:30:56'); assert.isTrue(date_obj.hour === '14'); }); it('should return the correct minute for "1987-10-01 14:30:56"', () => { const date_obj = helpers.makeDateObj('1987-10-01 14:30:56'); assert.isTrue(date_obj.min === '30'); }); it('should return the correct second for "1987-10-01 14:30:56"', () => { const date_obj = helpers.makeDateObj('1987-10-01 14:30:56'); assert.isTrue(date_obj.sec === '56'); }); it('should return the correct year for "December 17, 1995"', () => { const date_obj = helpers.makeDateObj('December 17, 1995'); assert.isTrue(date_obj.year === '1995'); }); it('should return the correct month for "December 17, 1995"', () => { const date_obj = helpers.makeDateObj('December 17, 1995'); assert.isTrue(date_obj.month === '12'); }); it('should return the correct day for "December 17, 1995"', () => { const date_obj = helpers.makeDateObj('December 17, 1995'); assert.isTrue(date_obj.day === '17'); }); it('should return the correct hour for "December 17, 1995"', () => { const date_obj = helpers.makeDateObj('December 17, 1995'); assert.isTrue(date_obj.hour === '00'); }); it('should return the correct minute for "December 17, 1995"', () => { const date_obj = helpers.makeDateObj('December 17, 1995'); assert.isTrue(date_obj.min === '00'); }); it('should return the correct second for "December 17, 1995"', () => { const date_obj = helpers.makeDateObj('December 17, 1995'); assert.isTrue(date_obj.sec === '00'); }); it('should return the correct year for "December 17, 1995 00:30:10"', () => { const date_obj = helpers.makeDateObj('December 17, 1995 00:30:10'); assert.isTrue(date_obj.year === '1995'); }); it('should return the correct month for "December 17, 1995 00:30:10"', () => { const date_obj = helpers.makeDateObj('December 17, 1995 00:30:10'); assert.isTrue(date_obj.month === '12'); }); it('should return the correct day for "December 17, 1995 00:30:10"', () => { const date_obj = helpers.makeDateObj('December 17, 1995 00:30:10'); assert.isTrue(date_obj.day === '17'); }); it('should return the correct hour for "December 17, 1995 00:30:10"', () => { const date_obj = helpers.makeDateObj('December 17, 1995 00:30:10'); assert.isTrue(date_obj.hour === '00'); }); it('should return the correct minute for "December 17, 1995 00:30:10"', () => { const date_obj = helpers.makeDateObj('December 17, 1995 00:30:10'); assert.isTrue(date_obj.min === '30'); }); it('should return the correct second for "December 17, 1995 00:30:10"', () => { const date_obj = helpers.makeDateObj('December 17, 1995 00:30:10'); assert.isTrue(date_obj.sec === '10'); }); it('should return the correct year for "12/17/1995"', () => { const date_obj = helpers.makeDateObj('12/17/1995'); assert.isTrue(date_obj.year === '1995'); }); it('should return the correct month for "12/17/1995"', () => { const date_obj = helpers.makeDateObj('12/17/1995'); assert.isTrue(date_obj.month === '12'); }); it('should return the correct day for "12/17/1995"', () => { const date_obj = helpers.makeDateObj('12/17/1995'); assert.isTrue(date_obj.day === '17'); }); it('should return the correct hour for "12/17/1995"', () => { const date_obj = helpers.makeDateObj('December 17, 1995'); assert.isTrue(date_obj.hour === '00'); }); it('should return the correct minute for "12/17/1995"', () => { const date_obj = helpers.makeDateObj('12/17/1995'); assert.isTrue(date_obj.min === '00'); }); it('should return the correct second for "12/17/1995"', () => { const date_obj = helpers.makeDateObj('12/17/1995'); assert.isTrue(date_obj.sec === '00'); }); it('should return the correct year for "12/17/1995 01:20:05"', () => { const date_obj = helpers.makeDateObj('12/17/1995 01:20:05'); assert.isTrue(date_obj.year === '1995'); }); it('should return the correct month for "12/17/1995 01:20:05"', () => { const date_obj = helpers.makeDateObj('12/17/1995 01:20:05'); assert.isTrue(date_obj.month === '12'); }); it('should return the correct day for "12/17/1995 01:20:05"', () => { const date_obj = helpers.makeDateObj('12/17/1995 01:20:05'); assert.isTrue(date_obj.day === '17'); }); it('should return the correct hour for "12/17/1995 01:20:05"', () => { const date_obj = helpers.makeDateObj('December 17, 1995 01:20:05'); assert.isTrue(date_obj.hour === '01'); }); it('should return the correct minute for "12/17/1995 01:20:05"', () => { const date_obj = helpers.makeDateObj('12/17/1995 01:20:05'); assert.isTrue(date_obj.min === '20'); }); it('should return the correct second for "12/17/1995 01:20:05"', () => { const date_obj = helpers.makeDateObj('12/17/1995 01:20:05'); assert.isTrue(date_obj.sec === '05'); }); }); describe('objIsEmpty', () => { it('should return true for an empty object', () => { assert.isTrue(helpers.objIsEmpty({})); }); it('should return false for an object', () => { assert.isFalse(helpers.objIsEmpty({foo: 'bar'})); }); it('should throw an error for an empty array', () => { assert.throw( () => {helpers.objIsEmpty([])}, Error, "Not an object" ); }); it('should throw an error if no argument passed', () => { assert.throw( () => {helpers.objIsEmpty()}, Error, "Not an object" ); }); it('should throw an error if a number is passed', () => { assert.throw( () => {helpers.objIsEmpty(1)}, Error, "Not an object" ); }); it('should throw an error if a number object is passed', () => { assert.throw( () => {helpers.objIsEmpty(new Number(1))}, Error, "Not an object" ); }); it('should throw an error if a string is passed', () => { assert.throw( () => {helpers.objIsEmpty('abc123')}, Error, "Not an object" ); }); it('should throw an error if a string object is passed', () => { assert.throw( () => {helpers.objIsEmpty(new String("abc123"))}, Error, "Not an object" ); }); it('should throw an error if a function is passed', () => { assert.throw( () => {helpers.objIsEmpty(function(){})}, Error, "Not an object" ); }); });
'use strict'; const _ = require('lodash'); const fs = require('fs-extra'); const SourceGenerator = require('./SourceGenerator'); class RawFileSourceGenerator extends SourceGenerator{ constructor(config,logger){ super(config,logger); this.setSourcePath(_.get(config,'sourcePath',null)); //If this class is not being extended if (Object.getPrototypeOf(this) === RawFileSourceGenerator.prototype) { Object.seal(this); } } _readFileContents(){ return new Promise((resolve,reject)=>{ fs.readFile(this.sourcePath,'utf8',(err,data)=>{ if(err){ reject(err); } else{ resolve(data); } }); }); } /***********************************************/ /*** START OVERIDDEN METHODS ***/ /***********************************************/ /** * This will generate and set the source code string. * @returns {Promise} This method is asynchronous. */ generate(){ return new Promise((resolve,reject)=>{ this._readFileContents() .then((data)=>{ this.setSourceCode(data); resolve(data); }) .catch(reject); }); } /***********************************************/ /*** END OVERIDDEN METHODS ***/ /*** START PUBLIC METHODS ***/ /***********************************************/ get sourcePath(){ return this._sourcePath; } setSourcePath(val){ this._sourcePath = val; return this; } /***********************************************/ /*** END PUBLIC METHODS ***/ /***********************************************/ } module.exports = RawFileSourceGenerator;
import { Link } from 'react-router-dom'; import { useAuth } from '../../context/useAuth'; import { FiInstagram, FiHome, FiLogOut } from 'react-icons/fi'; import * as S from './styles'; const Header = () => { const { user, logout } = useAuth(); return ( <S.Header> <S.Wrapper> <Link to="/feed"> <FiInstagram size={26} /> </Link> <S.Widgets> <button> <Link to="/feed"> <FiHome size={22} /> </Link> </button> <button onClick={() => logout()}> <FiLogOut size={22} /> </button> <button> <S.Avatar> <Link to={`/${user.username}`}> <img src={ user.image ? user.image : `https://eu.ui-avatars.com/api/?name=${user.username}` } alt={user.username} /> </Link> </S.Avatar> </button> </S.Widgets> </S.Wrapper> </S.Header> ); }; export default Header;
(function(){ 'use strict'; angular .module('everycent.common') .directive('ecAmountLabel', ecAmountLabel); ecAmountLabel.$inject = []; function ecAmountLabel(){ var directive = { restrict:'E', templateUrl: 'app/common/ec-amount-label-directive.html', scope: { type: '@', label: '@', amount: '=' }, controller: controller, controllerAs: 'vm', bindToController: true }; return directive; function controller(){ /* jshint validthis: true */ var vm = this; vm.labelClasses = labelClasses; function labelClasses(){ var result = {}; result['label-' + vm.type] = vm.amount >= 0; result['label-danger'] = vm.amount < 0; return result; } } } })();
import React from "react"; import Header from "../../components/Header"; import Footer from "../../components/Footer"; import LoginForm from "./LoginForm"; import style from "./LoginPage.css" const LoginPage = () =>{ return ( <div> <Header title={"芜湖"} subTitle={"我的微服务前后端实现"}/> <div className={style.back} > <div className={style.loginForm}> <span className={style.loginText}>用户登录</span> <LoginForm /> </div> </div> <Footer/> </div> ) } export default LoginPage;