text
stringlengths
7
3.69M
const mongoose = require("mongoose"); const { Post } = require("./Post"); const commSchema = new mongoose.Schema({ bodyComment: { type: String, required: true }, commentedOn: { type: Date, default: Date.now }, linked: { type: mongoose.Schema.Types.ObjectId, ref: "Post" }, person: { type: mongoose.Schema.Types.ObjectId, ref: "User" } }); const Comm = mongoose.model("Comm", commSchema); exports.Comm = Comm;
var express = require('express'); var router = express.Router(); var neo_server = require('../lib/neo_server.js'); router.get('/serverinfo/:HospNum', function(req, res){ }); module.exports = router;
define(['require'], function (require) { angular.module('service.mission', ['ui.tms', 'service.matter']). provider('srvMission', function () { var _siteId, _missionId, _oMission, _getMissionDeferred; this.config = function (siteId, missionId) { _siteId = siteId; _missionId = missionId; }; this.$get = ['$q', '$uibModal', 'http2', 'noticebox', 'tmsSchema', function ($q, $uibModal, http2, noticebox, tmsSchema) { var _self = { get: function () { var url; if (_getMissionDeferred) { return _getMissionDeferred.promise; } _getMissionDeferred = $q.defer(); url = '/rest/pl/fe/matter/mission/get?id=' + _missionId; http2.get(url).then(function (rsp) { var userApp; _oMission = rsp.data; _oMission.extattrs = (_oMission.extattrs && _oMission.extattrs.length) ? JSON.parse(_oMission.extattrs) : {}; if (userApp = _oMission.userApp) { if (userApp.data_schemas && angular.isString(userApp.data_schemas)) { userApp.data_schemas = JSON.parse(userApp.data_schemas); } } _getMissionDeferred.resolve(_oMission); }); return _getMissionDeferred.promise; }, chooseContents: function (oMission, oReport) { return $uibModal.open({ templateUrl: '/views/default/pl/fe/matter/mission/component/chooseContents.html?_=1', controller: ['$scope', '$uibModalInstance', function ($scope2, $mi) { var oCriteria, oIncludeApps = {}, oIncludeMarks = {}; $scope2.mission = oMission; $scope2.criteria = oCriteria = {}; if (oReport.apps) { oReport.apps.forEach(function (oApp) { oIncludeApps[oApp.type + oApp.id] = true; }); } if (oReport.show_schema) { oReport.show_schema.forEach(function (oSchema) { oIncludeMarks[oSchema.title + oSchema.id] = true; }); } // 选中的记录 $scope2.markRows = { selected: {}, reset: function () { this.selected = {}; } }; $scope2.appRows = { allSelected: 'N', selected: {}, reset: function () { this.allSelected = 'N'; this.selected = {}; } }; $scope2.$watch('appRows.allSelected', function (checked) { var index = 0; if (checked === 'Y') { while (index < $scope2.matters.length) { $scope2.appRows.selected[index++] = true; } } else if (checked === 'N') { $scope2.appRows.selected = {}; } }); $scope2.doSearch = function () { $scope2.appRows.reset(); $scope2.markRows.reset(); $scope2.appMarkSchemas = angular.copy(oMission.userApp.dataSchemas); if ($scope2.appMarkSchemas && $scope2.appMarkSchemas.length) { $scope2.appMarkSchemas.forEach(function (schema, index) { if (oIncludeMarks[schema.title + schema.id]) { $scope2.markRows.selected[schema.id] = true; } }); } _self.matterList(oCriteria).then(function (matters) { $scope2.matters = matters; if (matters && matters.length) { for (var i = 0; i < matters.length; i++) { if (matters[i].type == 'memberschema') { matters.splice(matters[i], 1); break; } }; matters.forEach(function (oMatter, index) { if (oIncludeApps[oMatter.type + oMatter.id]) { $scope2.appRows.selected[index] = true; } }); } }); }; $scope2.cancel = function () { $mi.dismiss(); }; $scope2.ok = function () { var apps = []; for (var i in $scope2.appRows.selected) { if ($scope2.appRows.selected[i]) { apps.push($scope2.matters[i]); } } var marks = []; if (Object.keys($scope2.markRows.selected).length) { $scope2.appMarkSchemas.forEach(function (oSchema) { if ($scope2.markRows.selected[oSchema.id]) { marks.push(oSchema); } }); } $mi.close({ app: apps, mark: marks }); }; $scope2.doSearch(); }], backdrop: 'static' }).result; }, matterList: function (oCriteria) { var deferred, url; deferred = $q.defer(); !oCriteria && (oCriteria = {}); url = '/rest/pl/fe/matter/mission/matter/list?id=' + _missionId; http2.post(url, oCriteria).then(function (rsp) { deferred.resolve(rsp.data); }); return deferred.promise; }, matterCount: function () { var deferred = $q.defer(); http2.get('/rest/pl/fe/matter/mission/matter/count?id=' + _missionId).then(function (rsp) { deferred.resolve(parseInt(rsp.data)); }); return deferred.promise; }, userList: function (oResultSet) { var deferred = $q.defer(), url; if (Object.keys(oResultSet).length === 0) { angular.extend(oResultSet, { page: { at: 1, size: 30, j: function () { return 'page=' + this.at + '&size=' + this.size; }, offset: function () { return (this.at - 1) * this.size; } }, criteria: {}, users: [] }); } _self.get().then(function (mission) { //tmsSchema.config(mission.userApp.data_schemas); }); url = '/rest/pl/fe/matter/mission/user/list?mission=' + _missionId; url += '&' + oResultSet.page.j(); http2.post(url, oResultSet.criteria).then(function (rsp) { var records = rsp.data.records; oResultSet.users.splice(0, oResultSet.users.length); if (records && records.length) { records.forEach(function (record) { tmsSchema.forTable(record); oResultSet.users.push(record); }); } oResultSet.page.total = rsp.data.total; deferred.resolve(rsp.data); }); return deferred.promise; }, recordByUser: function (user) { var deferred = $q.defer(); if (user.userid) { http2.get('/rest/pl/fe/matter/mission/report/recordByUser?mission=' + _missionId + '&user=' + user.userid).then(function (rsp) { deferred.resolve(rsp.data); }); } else { alert('无法获得有效用户信息'); } return deferred.promise; }, submit: function (modifiedData) { var defer = $q.defer(); http2.post('/rest/pl/fe/matter/mission/update?id=' + _missionId, modifiedData).then(function (rsp) { defer.resolve(rsp.data); }); return defer.promise; } } return _self; }]; }).provider('srvMissionRound', function () { var _siteId, _missionId, _rounds, _oPage, _RestURL = '/rest/pl/fe/matter/mission/round/'; this.config = function (siteId, missionId) { _siteId = siteId; _missionId = missionId; }; this.$get = ['$q', '$uibModal', 'http2', 'srvMission', function ($q, $uibModal, http2, srvMission) { return { init: function (rounds, page) { _rounds = rounds; _oPage = page; if (page.j === undefined) { page.at = 1; page.size = 10; page.j = function () { return 'page=' + this.at + '&size=' + this.size; } } }, list: function (checkRid) { var defer = $q.defer(), url; if (_rounds === undefined) { _rounds = []; } if (_oPage === undefined) { _oPage = { at: 1, size: 10, j: function () { return 'page=' + this.at + '&size=' + this.size; } }; } url = _RestURL + 'list?site=' + _siteId + '&mission=' + _missionId + '&' + _oPage.j(); if (checkRid) { url += '&checked=' + checkRid; } http2.get(url).then(function (rsp) { var _checked; _rounds.splice(0, _rounds.length); rsp.data.rounds.forEach(function (rnd) { rsp.data.active && (rnd._isActive = rnd.rid === rsp.data.active.rid); _rounds.push(rnd); }); _oPage.total = parseInt(rsp.data.total); _checked = (rsp.data.checked ? rsp.data.checked : ''); defer.resolve({ rounds: _rounds, page: _oPage, active: rsp.data.active, checked: _checked }); }); return defer.promise; }, add: function () { http2.post('/rest/script/time', { html: { 'editor': '/views/default/pl/fe/matter/enroll/component/roundEditor' } }).then(function (rsp) { $uibModal.open({ templateUrl: '/views/default/pl/fe/matter/enroll/component/roundEditor.html?_=' + rsp.data.html.editor.time, backdrop: 'static', controller: ['$scope', '$uibModalInstance', function ($scope, $mi) { var oNewRound, defaultStartAt; defaultStartAt = new Date(); defaultStartAt.setMinutes(0); defaultStartAt.setSeconds(0); $scope.round = oNewRound = { start_at: parseInt(defaultStartAt / 1000) }; $scope.$on('xxt.tms-datepicker.change', function (event, data) { data.obj[data.state] = data.value; }); $scope.close = function () { $mi.dismiss(); }; $scope.ok = function () { http2.post(_RestURL + 'add?site=' + _siteId + '&mission=' + _missionId, oNewRound).then(function (rsp) { if (_rounds.length > 0 && rsp.data.state == 1) { _rounds[0].state = 2; } _rounds.splice(0, 0, rsp.data); _oPage.total++; $mi.close(); }); }; }] }).result.then(function () {}); }); }, edit: function (oRound) { http2.post('/rest/script/time', { html: { 'editor': '/views/default/pl/fe/matter/enroll/component/roundEditor' } }).then(function (rsp) { $uibModal.open({ templateUrl: '/views/default/pl/fe/matter/enroll/component/roundEditor.html?_=' + rsp.data.html.editor.time, backdrop: 'static', controller: ['$scope', '$uibModalInstance', function ($scope, $mi) { $scope.round = { rid: oRound.rid, title: oRound.title, start_at: oRound.start_at, end_at: oRound.end_at, state: oRound.state }; $scope.$on('xxt.tms-datepicker.change', function (event, data) { if (data.state === 'start_at') { if (data.obj[data.state] == 0 && data.value > 0) { $scope.round.state = '1'; } else if (data.obj[data.state] > 0 && data.value == 0) { $scope.round.state = '0'; } } data.obj[data.state] = data.value; }); $scope.close = function () { $mi.dismiss(); }; $scope.ok = function () { $mi.close({ action: 'update', data: $scope.round }); }; $scope.remove = function () { $mi.close({ action: 'remove' }); }; }] }).result.then(function (rst) { var url = _RestURL; if (rst.action === 'update') { url += 'update?site=' + _siteId + '&mission=' + _missionId + '&rid=' + oRound.rid; http2.post(url, rst.data).then(function (rsp) { if (_rounds.length > 1 && rst.data.state === '1') { _rounds[1].state = '2'; } angular.extend(oRound, rsp.data); }); } else if (rst.action === 'remove') { url += 'remove?site=' + _siteId + '&mission=' + _missionId + '&rid=' + oRound.rid; http2.get(url).then(function (rsp) { _rounds.splice(_rounds.indexOf(round), 1); _oPage.total--; }); } }); }); } }; }]; }).provider('srvOpMission', function () { var _siteId, _missionId, _accessId, _oMission, _getMissionDeferred; this.config = function (siteId, missionId, accessId) { _siteId = siteId; _missionId = missionId; _accessId = accessId; }; this.$get = ['$q', '$uibModal', 'http2', 'noticebox', function ($q, $uibModal, http2, noticebox) { var _self = { get: function () { var url; if (_getMissionDeferred) { return _getMissionDeferred.promise; } _getMissionDeferred = $q.defer(); url = '/rest/site/op/matter/mission/get?site=' + _siteId + '&mission=' + _missionId + '&accessToken=' + _accessId; http2.get(url).then(function (rsp) { var userApp; _oMission = rsp.data.mission; _oMission.extattrs = (_oMission.extattrs && _oMission.extattrs.length) ? JSON.parse(_oMission.extattrs) : {}; if (userApp = _oMission.userApp) { if (userApp.data_schemas && angular.isString(userApp.data_schemas)) { userApp.data_schemas = JSON.parse(userApp.data_schemas); } } _getMissionDeferred.resolve(rsp.data); }); return _getMissionDeferred.promise; }, chooseApps: function (oMission, includeApps) { return $uibModal.open({ templateUrl: '/views/default/pl/fe/matter/mission/component/chooseApps.html?_=1', controller: ['$scope', '$uibModalInstance', function ($scope2, $mi) { var oCriteria, oIncludeApps = {}; $scope2.criteria = oCriteria = {}; if (includeApps) { includeApps.forEach(function (oApp) { oIncludeApps[oApp.type + oApp.id] = true; }); } // 选中的记录 $scope2.rows = { allSelected: 'N', selected: {}, reset: function () { this.allSelected = 'N'; this.selected = {}; } }; $scope2.$watch('rows.allSelected', function (checked) { var index = 0; if (checked === 'Y') { while (index < $scope2.matters.length) { $scope2.rows.selected[index++] = true; } } else if (checked === 'N') { $scope2.rows.selected = {}; } }); $scope2.doSearch = function () { $scope2.rows.reset(); _self.matterList(oCriteria).then(function (matters) { $scope2.matters = matters; if (matters && matters.length) { matters.forEach(function (oMatter, index) { if (oIncludeApps[oMatter.type + oMatter.id]) { $scope2.rows.selected[index] = true; } }); } }); }; $scope2.cancel = function () { $mi.dismiss(); }; $scope2.ok = function () { var selected = []; for (var i in $scope2.rows.selected) { if ($scope2.rows.selected[i]) { selected.push($scope2.matters[i]); } } $mi.close(selected); }; $scope2.doSearch(); }], backdrop: 'static' }).result; }, matterList: function () { var deferred = $q.defer(), url; url = '/rest/site/op/matter/mission/matterList?site=' + _siteId + '&mission=' + _missionId + '&accessToken=' + _accessId; http2.get(url).then(function (rsp) { deferred.resolve(rsp.data); }); return deferred.promise; }, recordByUser: function (oUser, oApp) { var url, deferred = $q.defer(); if (!oUser.userid) { alert('无法获得有效用户信息'); } url = '/rest/site/op/matter/mission/report/recordByUser'; url += '?site=' + _siteId + '&mission=' + _missionId + '&accessToken=' + _accessId; url += '&user=' + oUser.userid; oApp && (url += '&app=' + oApp.type + ',' + oApp.id); http2.get(url).then(function (rsp) { deferred.resolve(rsp.data); }); return deferred.promise; }, } return _self; }]; }); });
var http = require('http'); var fs = require('fs'); var robot = require("robotjs"); var qrcode = require('qrcode-terminal'); var network = require('network'); var html = fs.readFileSync('index.html', 'utf8'); var WebSocketServer = require('websocket').server; console.log('after calling readFile'); //create a server object: var server = http.createServer(function (req, res) { res.writeHead(200, { 'Content-Type': 'text/html' }); res.write(html); //write a response to the client res.end(); //end the response }) server.listen(8080, function () { console.log((new Date()) + ' Server is listening on port 8080'); network.get_private_ip(function (err, ip) { add = 'http://' + ip + ':8080'; qrcode.generate(add); }) }); wsServer = new WebSocketServer({ httpServer: server, // You should not use autoAcceptConnections for production // applications, as it defeats all standard cross-origin protection // facilities built into the protocol and the browser. You should // *always* verify the connection's origin and decide whether or not // to accept it. autoAcceptConnections: false }); wsServer.on('request', function (request) { var connection = request.accept(null, request.origin); connection.on('message', function (message) { console.log(message) robot.keyTap(message.utf8Data) }); }); var getLocalIPs = function () { var script = "ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'" exec(script, function (error, stdout, sterr) { console.log('stdout: ' + stdout); }); };
red_13_interval_name = ["花園","關廟","深坑","布袋","龜洞","南雄橋","阿蓮"]; red_13_interval_stop = [ ["關廟轉運站","北勢里活動中心"], // 花園 ["山西宮","香洋里","五甲"], // 關廟 ["遠成冷凍","深坑國小","深坑","深坑馬槽"], // 深坑 ["打鹿洲","布袋","頂草埤","草埤","精法精密公司"], // 布袋 ["南雄派出所","崇和國小","龜洞"], // 龜洞 ["蓮昭巷","南雄橋"], // 南雄橋 ["後寮","民眾服務社","忠孝路口","阿蓮"] // 阿蓮 ]; red_13_fare = [ [26], [26,26], [26,26,26], [26,26,26,26], [33,26,26,26,26], [38,31,26,26,26,26], [44,37,28,26,26,26,26] ]; // format = [time at the start stop] or // [time, other] or // [time, start_stop, end_stop, other] red_13_main_stop_name = ["關廟<br />轉運站","山西宮","深坑","布袋","南雄橋","阿蓮"]; red_13_main_stop_time_consume = [0, 5, 10, 13, 19, 25]; red_13_important_stop = [0, 1, 5]; // 關廟轉運站, 山西宮, 阿蓮 red_13_time_go = [["05:30"],["05:50"],["06:10"],["07:20"],["08:35"],["10:10"],["12:10"],["14:10"],["16:35"],["17:30"],["18:35"],["19:40"],["20:50",['黃']]]; red_13_time_return = [["05:55"],["06:15"],["06:35"],["07:45"],["09:00"],["10:35"],["12:35"],["14:35"],["17:00"],["18:10"],["19:10"],["20:10"],["21:20",['黃']]];
$(function () { let modalBlock = $('#translate-modal'); let obj, array, id, value, url; function getForm (url, $this) { obj = { id: $this.data('key'), action : $this.data('action'), }; $.post(url, obj, function (data) { modalBlock.find('.modal-body').html(data.form); modalBlock.modal({show: true}); }); } $('.translate-td').click(function () { url = modalBlock.data('url'); getForm (url, $(this)); }); $('#insert-term').click(function (e) { e.preventDefault(); getForm (this.href, $(this)); }); $(document).on('submit', '#form-translate', function () { $.post(this.action, $(this).serialize(), function (data) { if (data.success) { array = data.success; for (let i = 0; i < array.length; i++) { id = array[i].id; value = array[i].value; $(id).html(value); } modalBlock.modal('hide'); } if (data.error) { alert(data.error); } if (data.reload) { location.reload(); } }); return false; }); });
App.HomeBooktabSingleitemView = Ember.View.extend({ animationSpeed: 300, willAnimateIn : function () { var width = this.$().width(); var height = this.$().height(); this.$().css("position", "absolute"); this.$().css("width", width); this.$().css("height", height); $("#outlet-container").css("height", height); this.$().css('top', 0); this.$().css('left', width); }, animateIn : function (done) { var that = this; this.$().animate({ "left": 0, }, this.animationSpeed, function() { done(); }); }, didAnimateIn: function() { this.resetStuff(); setTimeout(function(){ $.scrollTo("#app", 200, { 'axis':'y' }); }, 200); }, willAnimateOut: function() { var width = this.$().width(); var height = this.$().height(); this.$().css("position", "absolute"); this.$().css("width", width); this.$().css("height", height); $("#outlet-container").css("height", height); }, animateOut : function (done) { var width = this.$().width(); var that = this; this.$().animate({ "left": width, }, this.animationSpeed, function() { done(); }); }, didAnimateOut: function() { }, resetStuff: function() { this.$().css("position", "relative"); this.$().css("width", 'auto'); this.$().css("height", 'auto'); $("#outlet-container").css("height", 'auto'); } }); App.BookingItemView = Ember.View.extend({ isExpanded: false, templateName: 'home/booktab/bookingitem', willAnimateIn: function() { }, click: function() { return; }, actions: { toggleIsExpanded: function(status) { if (status !== 1) { return; } if (this.get("isExpanded")) { this.set("isExpanded", false); } else { this.set("isExpanded", true); } } }, }); App.BookingtItemActionPlateView = Ember.View.extend({ templateName: 'home/booktab/bookingitemactionplate', click: function(evt) { return false; }, willAnimateIn: function() { this.$().slideUp(0); }, animateIn: function(done) { this.$().slideDown(200,function() { done(); }); }, animateOut: function(done) { } });
const { Controller } = require('egg'); const { ERROR_CODE } = require('../constant'); module.exports = class UserController extends Controller { async register() { try { const { username, password } = this.ctx.request.body; const userInfo = await this.service.user.createUser({ username, password }); await this.service.user.setLoginCookieAndSession(userInfo); this.ctx.body = ''; } catch (error) { this.logger.error(error); this.ctx.body = { code: ERROR_CODE, message: error.name, data: '', }; } } async modifyUserInfo() { try { const { username, password } = this.ctx.request.body; const id = this.ctx.cookies.get('id'); const userInfo = { id, username, password }; await this.service.user.updateUser(id, { username, password }); await this.service.user.setLoginCookieAndSession(userInfo); this.ctx.body = ''; } catch (error) { this.logger.error(error); this.ctx.body = { code: ERROR_CODE, message: error.name, data: '', }; } } async login() { try { const { username, password } = this.ctx.request.body; const userInfo = await this.service.user.checkUserInfo({ username, password }); await this.service.user.setLoginCookieAndSession(userInfo); this.ctx.body = ''; } catch (error) { this.logger.error(error); this.ctx.body = { code: ERROR_CODE, message: error.name, data: '', }; } } async logout() { try { const id = this.ctx.cookies.get('id'); await this.service.user.clearLoginCookieAndSession(id); this.ctx.body = ''; } catch (error) { this.logger.error(error); this.ctx.body = { code: ERROR_CODE, message: error.name, data: '', }; } } };
/** * Created by imafan_work on 2015/11/6 0006. */ $(function(){ $('#content').on('focus', '.form-control', function () { $(this).closest('.input-group, .form-group').addClass('focus'); }).on('blur', '.form-control', function () { $(this).closest('.input-group, .form-group').removeClass('focus'); }); $("#searchBar").focus(function(){ $(this).animate({width:'300px'}, 500); }); $("#searchBar").blur(function(){ $(this).animate({width: '200px'}, 500); }); $("#sidebar ul li a").click(function(){ $(this).parent().siblings().find("span.selected").remove(); $(this).append("<span class='selected'></span>"); }) $(document).ajaxSuccess(function(event, xhr, settings) { var content = xhr.responseText; if(content){ try{ var resObj = $.parseJSON(content); if(!resObj.success && resObj.codeMsg === "nologin"){ window.location.href = base + '/admin/logout'; } }catch(e){ } } }); }) function loadContent(url, fn){ $("#content").load(url,function(res){ if(fn && typeof fn == "function"){ fn.call(this,arguments); } }); }
import React from 'react' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faChrome, faFacebook, faGithub, faInstagram, faLinkedin, faYoutube } from '@fortawesome/free-brands-svg-icons'; import { faEnvelopeOpen, faHandsHelping, faMapMarker, faMapPin, faPhone } from '@fortawesome/free-solid-svg-icons'; function Footer() { return ( <div className="footer-section bg-dark"> <footer className="container text-center text-lg-start text-white"> {/* <!-- Section: Social media --> */} <section className="d-flex justify-content-center justify-content-lg-between p-4 border-bottom" > {/* <!-- Left --> */} <div className="me-5 d-none d-lg-block footer-para"> <span>Get connected with me on social networks:</span> </div> {/* <!-- Left --> */} {/* <!-- Right --> */} <div className="footer-social"> <a href="https://www.facebook.com/chiranjeebnayak.371" className="social-icons" id="social-fb" style={{fontSize: "1.5rem"}}> <FontAwesomeIcon icon={faFacebook} /> </a> <a href="https://www.instagram.com/chiranjeebnayak.371/" className="social-icons" id="social-in"style={{fontSize: "1.5rem"}}> <FontAwesomeIcon icon={faInstagram} /> </a> <a href="https://github.com/ChiranjeebNayak" className="social-icons" id="social-git" style={{fontSize: "1.5rem"}}> <FontAwesomeIcon icon={faGithub} /> </a> <a href="https://www.linkedin.com/in/chiranjeeb-nayak-b6218b182/" className="social-icons" id="social-ln"style={{fontSize: "1.5rem"}}> <FontAwesomeIcon icon={faLinkedin} /> </a> <a href="https://www.youtube.com/channel/UCXUkUF9D1c2lugsF_iQ9N_g" className="social-icons" id="social-ut" style={{fontSize: "1.5rem"}}> <FontAwesomeIcon icon={faYoutube} /> </a> </div> {/* <!-- Right --> */} </section> {/* <!-- Section: Social media --> */} {/* <!-- Section: Links --> */} <section className=""> <div className="container text-center text-md-start mt-5"> {/* <!-- Grid row --> */} <div className="row mt-3"> {/* <!-- Grid column --> */} <div className="col-md-3 col-lg-4 col-xl-3 mx-auto mb-4"> {/* <!-- Content --> */} <h6 className="text-uppercase fw-bold mb-4" style={{color:"orange"}}> <FontAwesomeIcon icon={faHandsHelping} className="footer-logo" />Chiranjeeb Nayak </h6> <p> Currently looking for a job in Software Engineer ,Frontend Developer ,Backend Developer ,FullStack Developer , Mern Stack Developer ,Progamming Analysist </p> </div> {/* <!-- Grid column --> */} {/* <!-- Grid column --> */} <div className="col-md-2 col-lg-2 col-xl-2 mx-auto mb-4 footer-link"> {/* <!-- Links --> */} <h6 className="text-uppercase fw-bold mb-4" style={{color:"orange"}}> Links </h6> <p> <a href="#" className="text-reset">Home</a> </p> <p> <a href="#About" className="text-reset">About</a> </p> <p> <a href="#Education" className="text-reset">Education</a> </p> <p> <a href="#Projects" className="text-reset">Projects</a> </p> <p> <a href="#Contact" className="text-reset">Contact</a> </p> </div> {/* <!-- Grid column --> */} <div className="col-md-4 col-lg-3 col-xl-3 mx-auto mb-md-0 mb-4"> {/* <!-- Links --> */} <h6 className="text-uppercase fw-bold mb-4" style={{color:"orange"}}> Contact </h6> <p><FontAwesomeIcon icon={faMapMarker} /> Naripur,Bhadrak,Odisha,India</p> <p><FontAwesomeIcon icon={faMapPin} /> 756100</p> <p><FontAwesomeIcon icon={faEnvelopeOpen} /> ChiranjeebNayak.37@gmail.com</p> <p><FontAwesomeIcon icon={faPhone} /> +91 6372117831</p> </div> {/* <!-- Grid column --> */} </div> {/* <!-- Grid row --> */} </div> </section> {/* <!-- Section: Links --> */} </footer> {/* <!-- Footer --> */} {/* <!-- Copyright --> */} <div className=" text-white text-center p-4" style={{backgroundColor: "black"}}> © 2021 Copyright: <a className=" fw-bold" href="#"> Chirannjeeb Nayak</a> </div> {/* <!-- Copyright --> */} </div > ) } export default Footer
import React, { Component } from 'react' export class Message extends Component { constructor(){ super(); this.state = { message:"hi there" } } handler() { this.setState( { message:"how you doin?" } ) } render() { return ( <div> <div> <h1>{this.state.message}</h1> </div> <button onClick = {() => this.handler()}>Click me</button> </div> ) } } export default Message
import React, { Component } from "react"; import Img from "gatsby-image"; import Layout from "../components/layout/layout"; import SEO from "../components/seo"; import Content from "../components/utility/Content/Content"; import Banner from "../components/banner/banner"; import "../components/styles/faq.sass"; import SlideUpDown from "../components/slide_up_down/slide_up_down"; import Signup from "../components/page_bottom_signup/page_signup"; import Spacer from "../components/spacer/spacer"; class Faq extends Component { constructor(props) { super(props); this.state = {}; } render() { const data = this.props.data.allWordpressPage.edges[0].node; const staf = this.props.data.staf.edges; const location = this.props.data.location.edges; const academy = this.props.data.academy.edges; const general = this.props.data.general.edges; return ( <Layout> <SEO page="FAQ" description="View answers to our frequently asked questions." /> <Banner btnText="Contact Us" linkPage="contact" title={data.acf.banner.hero_text} cta={data.acf.banner.cta} sides={true} img={data.acf.banner.image.localFile.childImageSharp.fluid} heroimgalt={data.acf.banner.image.alt_text} /> <Content> <div className="wrapper"> <Spacer /> <div className="faq"> <div className="faq__section"> <div className="faq__section__left"> <h3>General</h3> </div> <div className="faq__section__right"> {general.map(el => ( <SlideUpDown key={el.node.id} name={el.node.acf.question} desc={el.node.acf.answer} /> ))} </div> </div> <div className="faq__section"> <div className="faq__section__left"> <h3>Academy</h3> </div> <div className="faq__section__right"> {academy.map(el => ( <SlideUpDown key={el.node.id} name={el.node.acf.question} desc={el.node.acf.answer} /> ))} </div> </div> <div className="faq__section"> <div className="faq__section__left"> <h3>Staff</h3> </div> <div className="faq__section__right"> {staf.map(el => ( <SlideUpDown key={el.node.id} name={el.node.acf.question} desc={el.node.acf.answer} /> ))} </div> </div> <div className="faq__section"> <div className="faq__section__left"> <h3>Location</h3> </div> <div className="faq__section__right"> {location.map(el => ( <SlideUpDown key={el.node.id} name={el.node.acf.question} desc={el.node.acf.answer} /> ))} </div> </div> </div> <Spacer /> <Signup /> </div> </Content> </Layout> ); } } export const query = graphql` query { staf: allWordpressWpFaq( filter: { acf: { catagory: { regex: "/Staf/" } } } ) { edges { node { id title acf { question answer } } } } location: allWordpressWpFaq( filter: { acf: { catagory: { regex: "/Location/" } } } ) { edges { node { id title acf { question answer } } } } academy: allWordpressWpFaq( filter: { acf: { catagory: { regex: "/Academy/" } } } ) { edges { node { id title acf { question answer } } } } general: allWordpressWpFaq( filter: { acf: { catagory: { regex: "/General/" } } } ) { edges { node { id title acf { question answer } } } } allWordpressPage(filter: { title: { regex: "/Faq/" } }) { edges { node { title acf { banner { hero_text cta image { alt_text localFile { childImageSharp { fluid(maxWidth: 600) { ...GatsbyImageSharpFluid_noBase64 } } } } } } } } } } `; export default Faq;
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); var express_1 = require("express"); var UserController_1 = __importDefault(require("../controllers/UserController")); var userRoutes = express_1.Router(); var userController = new UserController_1.default(); userRoutes.post("/", userController.create); userRoutes.patch("/:id", userController.enable); userRoutes.get("/:id", userController.indexById); userRoutes.put("/:id", userController.update); exports.default = userRoutes;
export const loader = (function loader () { return function () { return { setLoading() { zoobooks().elements().loader.removeAttribute("hidden"); }, setLoaded() { zoobooks().elements().loader.setAttribute("hidden", "hidden"); } } } })();
import './GrandPrixArchiveTable.scss' import { React, useMemo, } from 'react'; import { useTable } from 'react-table' import { COLUMNS } from './GrandPrixArchiveColumns' export const GrandPrixArchiveTable = ({ grandsPrix }) => { const columns = useMemo(() => COLUMNS, []); const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow } = useTable({ columns: columns, data: grandsPrix, }); return ( <div className='GrandPrixArchiveTable'> <table className="table"{...getTableProps()}> <thead>{ headerGroups.map(headerGroup => ( <tr {...headerGroup.getHeaderGroupProps( )}> {headerGroup.headers.map(column => ( <th {...column.getHeaderProps({ style: { width: column.width } })} > {column.render('Header')}</th> ))} </tr> )) } <tr> </tr> </thead> <tbody className="table-body"{...getTableBodyProps()} > {rows.map((row,) => { prepareRow(row) return ( <tr {...row.getRowProps()} className="table-row" > {row.cells.map(cell => { return <td {...cell.getCellProps()}>{cell.render('Cell')}</td> })} </tr> ) })} </tbody> </table> </div> ); }
const path = require('path'); const fastKoa = require('fast-koa'); const config = require('./config'); fastKoa.initApp({ routesPath: path.join(__dirname, 'routes'), enableResponseTime: true, enableLogger: true }); fastKoa .listen(config.port) .then(server => { const addr = server.address(); console.log(`Server started...`, addr); }) .catch(console.error);
const DBUtils = module.exports; const { db } = require('../../app/utils/Database'); DBUtils.clear = async () => { await db.table('user').del(); await db.table('role').del(); };
var mongoose = require('mongoose'); var Schema = mongoose.Schema; var ProductInstanceSchema = new Schema( { title: {type: String, required: true, max: 100}, product: {type: Schema.ObjectId, ref: 'Product', required: true}, color: {type: String}, image: {type: String, default: 'https://s3-ap-southeast-1.amazonaws.com/deccan-images/armless.png'}, availability: {type: String, required: true, enum: ['Available', 'Not Available', 'Discontinued'], default: 'Available'} } ); // Virtual for product's URL ProductInstanceSchema .virtual('url') .get(function () { return 'productinstance/' + this._id; }); //Export model module.exports = mongoose.model('ProductInstance', ProductInstanceSchema);
var express = require('express'); var router = express.Router(); var session=require('../session'); /* GET home page. */ router.get('/', function(req, res, next) { if(!("sid" in req.cookies)){ res.render('index',{button: '로그인', user:'', isLogin: false}); } else{ if(session.getSession(req.cookies["sid"])) res.render('index',{button:'로그아웃',user: req.cookies["name"]+'님 안녕하세요!', isLogin: true}); else res.render('index',{button: '로그인', user:'', isLogin: false}); } }); module.exports = router;
import { user, api } from "./constants/api_constants.js"; export default { getChannels, channelDetail, channelMessages, verifyToken, refreshToken, getToken, postMessage }; function genericRequest(target, options = {}, token = false) { let defaultOpts = { headers: { Accept: "application/json", "Content-Type": "application/json" } }; if (token) { console.log( "token: ", localStorage.getItem("token"), "defaultHeaders: ", defaultOpts ); //defaultOpts.headers["Authorization"] = "JWT " + token; defaultOpts.headers["Authorization"] = "JWT " + localStorage.getItem("token"); } options.headers = { ...defaultOpts.headers, ...options.headers }; return fetch(target, options); } function getChannels() { return genericRequest(api.CHANNELS_URL); } function channelDetail(pk) { return genericRequest(api.channelDetail(pk)); } function channelMessages(pk, token) { return genericRequest(api.messagesURL(pk), {}, token); } function postMessage(pk, message, token) { message.method = "POST"; return genericRequest(api.messagesURL(pk), message, token); } async function verifyToken(_token) { if (!_token) { return false; } let req = { method: "POST", body: JSON.stringify({ token: _token }) }; console.log("verifyToken: req: ", req); let response = await genericRequest(api.VERIFY_URL, req); console.log("verifyToken: response: ", response); return checkStatus(response); } function refreshToken(token) { let options = { method: "POST", body: JSON.stringify({ token: token }) }; return genericRequest(api.REFRESH_URL, options); } function getToken() { console.log("getToken: executed"); let token_req = { method: "POST", body: JSON.stringify({ username: user.USERNAME, password: user.PASSWORD }) }; console.log("ReqInit obj: ", token_req); genericRequest(api.AUTH_URL, token_req) .then(checkStatus) .then(response => response.json()) .then(json => { console.log("Token from src/Api: ", json.token); localStorage.setItem("token", json.token); //FIXME how does return work in promise chains? return json.token; }) .catch(error => { console.log("Error from src/Api: ", error); return false; }); } function checkStatus(response) { if (response.status >= 200 && response.status < 300) { return response; } else { console.log("checkStatus fail: ", response); return false; } } export { checkStatus };
'use strict'; (function (){ angular .module("BookApp") .controller("PeopleController",PeopleController); function PeopleController($scope, UserService) { $scope.user = UserService.getUser(); } })();
var mongoose = require('mongoose'), Product = mongoose.model('Product'); exports.clear = function () { Product.remove({}, function (err) { if (err) { console.log(err); } else { console.log('Product collection dropped'); } return; }) } exports.all = function (callback) { Product.find(function (err, products) { if (err) { console.log(err); return; } else { console.log('Products found: ' + products); callback(products); } }); }; exports.find = function (queryData, callback) { var query = queryBuilder(queryData); Product.find(query, function (err, products) { if (err) { console.log(err); callback(null); } else if (products.length <= 0) { console.log('No products found'); callback(null); } else { console.log('Products found: ' + products); callback(products); } }); }; function queryBuilder(queryData) { var query = {}; query.gender = queryData.gender; if (queryData.category) { query.category = queryData.category; } if (queryData.colour) { if (queryData.colour != "any") { query.colour = queryData.colour; } else { queryData.colour = "Multi-Color"; } } if (queryData.price) { if (queryData.price != "any") { var price = queryData.price * 100 if (queryData.quantifier) { if (queryData.quantifier == 'under') { query.price = { '$lt': price } } else { query.price = { '$gt': price } } } else { var less_than = price + 1000; var greater_than = price - 1000; query.price = { '$gt': greater_than, '$lt': less_than } } } } return query; } exports.findByProductIdArray = function (productIdArray, callback) { Product.find({ '_id': { $in: productIdArray } }, function (err, products) { if (err) { console.log(err); callback(null); } else if (products.length <= 0) { console.log('No products found'); callback(null); } else { console.log('Products found: ' + products); callback(products); } }); }; exports.insert = function (item, callback) { Product.create({ gender: item.gender, category: item.category, colour: item.colour, title: item.title, subcategory: item.subcategory, pictureURL: item.url, price: item.price }, function (err, product) { if (err) { console.log(err); } else { //console.log("Product created: " + product); callback(); } }) }
export default /* glsl */` #ifndef ENV_ATLAS #define ENV_ATLAS uniform sampler2D texture_envAtlas; #endif uniform samplerCube texture_cubeMap; uniform float material_reflectivity; vec3 calcReflection(vec3 reflDir, float gloss) { vec3 dir = cubeMapProject(reflDir) * vec3(-1.0, 1.0, 1.0); vec2 uv = toSphericalUv(dir); // calculate roughness level float level = saturate(1.0 - gloss) * 5.0; float ilevel = floor(level); float flevel = level - ilevel; vec3 sharp = $DECODE_CUBEMAP(textureCube(texture_cubeMap, fixSeams(dir))); vec3 roughA = $DECODE(texture2D(texture_envAtlas, mapRoughnessUv(uv, ilevel))); vec3 roughB = $DECODE(texture2D(texture_envAtlas, mapRoughnessUv(uv, ilevel + 1.0))); return processEnvironment(mix(sharp, mix(roughA, roughB, flevel), min(level, 1.0))); } void addReflection(vec3 reflDir, float gloss) { dReflection += vec4(calcReflection(reflDir, gloss), material_reflectivity); } `;
const express = require('express'); const app = express(); const port = 3390; app.use(express.json()); const jogos = [ "The Sims", "Super Mário", "GTA - San Andreas", ]; app.get('/', (req, res) => { res.send('Games Monster') }); app.get('/jogos', (req, res) => { res.send(jogos); }); app.get('/jogos/:id', (req, res) => { const id = req.params.id -1; const jogo = jogos[id]; res.send(jogo) }) app.post('/jogos', (req, res) => { const jogo = req.body.jogo; const id = jogos.length; jogos.push(jogo); res.send(`jogo: ${jogo} adicionado com sucesso!`) }); app.put('/jogos/:id', (req,res) => { const id = req.params.id -1; const jogo = req.body.jogo; jogos[id] = jogo; res.send(`O jogo: ${jogo}, foi atualizado com sucesso`); }); app.delete('/jogos/:id', (req,res)=>{ const id = req.params.id -1; const jogo = jogos[id]; if (!jogo) { res.send('jogo não localizado') } jogos.splice(jogo, 1) res.send(`Jogo deletado com sucesso`) }) app.listen(port, () => { console.info(`App está rodando em: http://localhost:${port}/`) });
// Copyright 2021 Google LLC // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. import * as i18n from 'lighthouse/core/lib/i18n/i18n.js'; import LongTasks from '../computed/long-tasks.js'; import {NetworkRecords} from 'lighthouse/core/computed/network-records.js'; import {auditNotApplicable} from '../messages/common-strings.js'; import {Audit} from 'lighthouse'; import {getAttributableUrl} from '../utils/tasks.js'; import {isAdRelated, getNameOrTld} from '../utils/resource-classification.js'; const UIStrings = { /* Title of the audit */ title: 'Total ad JS blocking time', failureTitle: 'Reduce ad JS blocking time', description: 'Ad-related scripts are blocking the main thread. ' + '[Learn more](' + 'https://developers.google.com/publisher-ads-audits/reference/audits/total-ad-blocking-time' + ').', failureDisplayValue: '{timeInMs, number, seconds} s blocked', columnName: 'Name', columnBlockingTime: 'Blocking Time', }; const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings); /** * @typedef {Object} TableRow * @property {number} blockingTime * @property {string} name */ /** * Table headings for audits details sections. * @type {LH.Audit.Details.Table['headings']} */ const HEADINGS = [ { key: 'name', itemType: 'text', text: str_(UIStrings.columnName), }, { key: 'blockingTime', itemType: 'ms', text: str_(UIStrings.columnBlockingTime), granularity: 1, }, ]; /** @inheritDoc */ class TotalAdBlockingTime extends Audit { /** * @return {LH.Audit.Meta} */ static get meta() { return { id: 'total-ad-blocking-time', title: str_(UIStrings.title), failureTitle: str_(UIStrings.failureTitle), description: str_(UIStrings.description), requiredArtifacts: ['traces', 'devtoolsLogs'], }; } /** * @return {{ * simulate: LH.Audit.ScoreOptions, provided: LH.Audit.ScoreOptions, * }} */ static get defaultOptions() { return { simulate: { p10: 290, median: 600, }, provided: { p10: 150, median: 350, }, }; } /** * @param {LH.Artifacts} artifacts * @param {LH.Audit.Context} context * @return {Promise<LH.Audit.Product>} * @override */ static async audit(artifacts, context) { const LONG_TASK_DUR_MS = 50; const trace = artifacts.traces[Audit.DEFAULT_PASS]; const devtoolsLog = artifacts.devtoolsLogs[Audit.DEFAULT_PASS]; const networkRecords = await NetworkRecords.request(devtoolsLog, context); if (!networkRecords.find((r) => isAdRelated(r.url))) { return auditNotApplicable.NoAdRelatedReq; } const metricData = {trace, devtoolsLog, settings: context.settings}; let longTasks = []; try { longTasks = await LongTasks.request(metricData, context); } catch (e) { return auditNotApplicable.InvalidTiming; } let totalAdJsBlockingTime = 0; /** @type {Map<string, number>} */ const adBlockingTimeByParty = new Map(); for (const longTask of longTasks) { const scriptUrl = getAttributableUrl(longTask); if (!scriptUrl || !isAdRelated(scriptUrl)) { // Don't count non-ads scripts here. continue; } if (longTask.parent) { // Only show top-level tasks (i.e. ones with no parents). continue; } // Count excess long task time as "blocking time" const blockingTime = longTask.duration - LONG_TASK_DUR_MS; totalAdJsBlockingTime += blockingTime; const party = getNameOrTld(scriptUrl); const prevBlockingTime = adBlockingTimeByParty.get(party) || 0; adBlockingTimeByParty.set(party, prevBlockingTime + blockingTime); } /** @type {TableRow[]} */ const tableDetails = []; for (const [name, blockingTime] of adBlockingTimeByParty.entries()) { tableDetails.push({name, blockingTime}); } // Sort in descending order tableDetails.sort((a, b) => b.blockingTime - a.blockingTime); const scoreOptions = context.options[context.settings.throttlingMethod] || context.options['provided']; return { score: Audit.computeLogNormalScore(scoreOptions, totalAdJsBlockingTime), numericValue: totalAdJsBlockingTime, numericUnit: 'millisecond', displayValue: str_(UIStrings.failureDisplayValue, {timeInMs: totalAdJsBlockingTime}), details: TotalAdBlockingTime.makeTableDetails(HEADINGS, tableDetails), }; } } export default TotalAdBlockingTime; export {UIStrings};
import React, { Component } from 'react'; import { connect } from 'react-redux' import {Table} from 'antd' import format from 'date-fns/format' import setDay from 'date-fns/set_day' import setHours from 'date-fns/set_hours' import {getUnsortedRecordByDayArray, getUnsortedRecordByHourArray} from '../redux/selectors' const columns = [{ title: 'Day', dataIndex: 'day', render: (val) => (format(setDay(new Date(), val), 'dddd')) }, { title: 'Winrate', dataIndex: 'winrate', render: (val) => (val ? (val *100).toFixed(2) + '%' : 'No Data') }]; const hourColumns = [{ title: 'Hour', dataIndex: 'hour', render: (val) => (format(setHours(new Date(), val), 'HH')) }, { title: 'Winrate', dataIndex: 'winrate', render: (val) => (val ? (val *100).toFixed(2) + '%' : 'No Data') }]; const DashboardContainer = ({sortedRecordByDay, sortedRecordByHour}) => { return ( <div> <Table dataSource={sortedRecordByDay} columns={columns} size='small' pagination={false}/> <Table dataSource={sortedRecordByHour} columns={hourColumns} size='small' pagination={false}/> </div> ) } const mapStateToProps = (state) => { return { sortedRecordByDay: getUnsortedRecordByDayArray(state), sortedRecordByHour: getUnsortedRecordByHourArray(state), }; } export default connect(mapStateToProps)(DashboardContainer)
var searchData= [ ['outofrange',['OutOfRange',['../group___fleece.html#gga6a3de980e42db083a0ec3081c4ae8ecea7338c2318fc6c03ca5cf1b718d7efd02',1,'Fleece.h']]] ];
var config = require(__dirname + '/../config'); module.exports = function(req, res, next) { req.browsePrefix = config.sbPrefix; return next(); }
import React from 'react' import { number, boolean } from '@storybook/addon-knobs' import mdx from './bar-chart.mdx' import BarChart from './bar-chart' export default { title: 'Chart/Bar', parameters: { component: BarChart, componentSubtitle: 'Subtitle', docs: { page: mdx, }, }, } export const Basic = () => ( <BarChart id="bar" subtitle={boolean('Subtitle', false, 'General option')} size={{ height: 200 }} data={[ { name: 'Column1', main: { value: number('Column1', 5406, {}, 'Value') }, }, { name: 'Column2', main: { value: number('Column2', 3999, {}, 'Value') }, }, { name: 'Column3', main: { value: number('Column3', 6155, {}, 'Value') }, }, { name: 'Column4', main: { value: number('Column4', 862, {}, 'Value') }, }, { name: 'Column5', main: { value: number('Column5', 3866, {}, 'Value') }, }, ]} /> ) export const SortByValues = () => ( <BarChart id="barSortByValue" subtitle={boolean('Subtitle', false, 'General option')} customs={{ sortByValues: true }} size={{ height: 200 }} data={[ { name: 'Column1', main: { value: number('Column1', 5406, {}, 'Value') }, }, { name: 'Column2', main: { value: number('Column2', 3999, {}, 'Value') }, }, { name: 'Column3', main: { value: number('Column3', 6155, {}, 'Value') }, }, { name: 'Column4', main: { value: number('Column4', 862, {}, 'Value') }, }, { name: 'Column5', main: { value: number('Column5', 3866, {}, 'Value') }, }, ]} /> ) export const Horizontal = () => ( <BarChart id="hbar" axisRotate subtitle={boolean('Subtitle', true, 'General option')} customs={{ sortByValues: false }} size={{ height: 200 }} data={[ { name: 'Column1', main: { value: number('Column1', 5406, {}, 'Value') }, }, { name: 'Column2', main: { value: number('Column2', 3999, {}, 'Value') }, }, { name: 'Column3', main: { value: number('Column3', 6155, {}, 'Value') }, }, { name: 'Column4', main: { value: number('Column4', 862, {}, 'Value') }, }, { name: 'Column5', main: { value: number('Column5', 3866, {}, 'Value') }, }, ]} /> ) export const HorizontalWithSortByValues = () => ( <BarChart id="hbarSortByValue" axisRotate subtitle={boolean('Subtitle', true, 'General option')} customs={{ sortByValues: true }} size={{ height: 200 }} data={[ { name: 'Column1', main: { value: number('Column1', 5406, {}, 'Value') }, }, { name: 'Column2', main: { value: number('Column2', 3999, {}, 'Value') }, }, { name: 'Column3', main: { value: number('Column3', 6155, {}, 'Value') }, }, { name: 'Column4', main: { value: number('Column4', 862, {}, 'Value') }, }, { name: 'Column5', main: { value: number('Column5', 3866, {}, 'Value') }, }, ]} /> ) export const Stacked = () => ( <BarChart id="barStacked" subtitle={boolean('Subtitle', true, 'General option')} customs={{ stack: true, stackSubtitleValue: true, groups: ['group1', 'group2'], }} size={{ height: 200 }} data={[ { name: 'Column1', main: { group1: number('Column1', 132198, {}, 'Group1 Value'), group2: number('Column1', 122560, {}, 'Group2 Value'), }, }, { name: 'Column2', main: { group1: number('Column2', 191420, {}, 'Group1 Value'), group2: number('Column2', 237877, {}, 'Group2 Value'), }, }, { name: 'Column3', main: { group1: number('Column3', 143751, {}, 'Group1 Value'), group2: number('Column3', 169354, {}, 'Group2 Value'), }, }, { name: 'Column4', main: { group1: number('Column4', 170597, {}, 'Group1 Value'), group2: number('Column4', 188582, {}, 'Group2 Value'), }, }, { name: 'Column5', main: { group1: number('Column5', 91170, {}, 'Group1 Value'), group2: number('Column5', 81477, {}, 'Group2 Value'), }, }, ]} /> ) export const Compare = () => ( <BarChart id="barCompare" compare size={{ height: 180 }} data={[ { name: 'Column1', main: { value: number('Column1', 617, {}, 'Main Value') }, compare: { value: number('Column1', 557, {}, 'Compare Value') }, }, { name: 'Column2', main: { value: number('Column2', 2424, {}, 'Main Value') }, compare: { value: number('Column2', 2387, {}, 'Compare Value') }, }, { name: 'Column3', main: { value: number('Column3', 3024, {}, 'Main Value') }, compare: { value: number('Column3', 2798, {}, 'Compare Value') }, }, { name: 'Column4', main: { value: number('Column4', 2433, {}, 'Main Value') }, compare: { value: number('Column4', 2557, {}, 'Compare Value') }, }, { name: 'Column5', main: { value: number('Column5', 1662, {}, 'Main Value') }, compare: { value: number('Column5', 1401, {}, 'Compare Value') }, }, ]} /> ) export const HorizontalCompare = () => ( <BarChart id="hbarCompare" axisRotate compare size={{ height: 160 }} data={[ { name: 'Column1', main: { value: number('Column1', 617, {}, 'Main Value') }, compare: { value: number('Column1', 557, {}, 'Compare Value') }, }, { name: 'Column2', main: { value: number('Column2', 2424, {}, 'Main Value') }, compare: { value: number('Column2', 2387, {}, 'Compare Value') }, }, { name: 'Column3', main: { value: number('Column3', 3024, {}, 'Main Value') }, compare: { value: number('Column3', 2798, {}, 'Compare Value') }, }, { name: 'Column4', main: { value: number('Column4', 2433, {}, 'Main Value') }, compare: { value: number('Column4', 2557, {}, 'Compare Value') }, }, { name: 'Column5', main: { value: number('Column5', 1662, {}, 'Main Value') }, compare: { value: number('Column5', 1401, {}, 'Compare Value') }, }, ]} /> )
import { useEffect, useState } from "react"; import { getBlogs } from "../../services/blog-posts.js" import { Blog } from "../Blog/Blog.jsx" import "./BlogList.css"; const BlogList = () => { const [blogs, setBlogs] = useState([]); useEffect(() => { getBlogs() .then(blogs => setBlogs(blogs)) }, []) return ( <div className="blog-container"> { blogs.map((blog,index) => <Blog post={blog} isAutorized={true} key={index}/>) } </div> ) } export default BlogList;
// module Data.BigInt.Bits "use strict"; exports.and = function(a) { return function(b) { return a.and(b); }; }; exports.or = function(a) { return function(b) { return a.or(b); }; }; exports.xor = function(a) { return function(b) { return a.xor(b); }; }; exports.not = function(a) { return a.not(); }; exports.shiftLeft = function(a) { return function(n) { return a.shiftLeft(n); }; }; exports.shiftRight = function(a) { return function(n) { return a.shiftRight(n); }; };
"use strict"; const utils = require("../utils"); const url = require("url"); const fs = require("../filesystem"); const rfs = require("fs"); const mime = require("mime"); const stream = require("stream"); const zlib = require("zlib"); const logger = utils.createLogger({sourceFilePath: __filename}); let compression = false; /** * * @param {RequestContext} rc */ const serveExistingFile = function (rc) { const parsedUrl = url.parse(rc.request.url, true); const requestedFilePath = rc.runtime.findFileForUrlPathname(decodeURIComponent(parsedUrl.pathname)); const handleFileNotFound = function handleFileNotFound(err) { logger.error("Existing file to serve does not exist: " + requestedFilePath, err.stack); utils.writeResponse(rc.response, 404, { "Content-Type": "text/plain; charset=utf-8" }, "File could not be found"); }; const handleExistsCompressing = function handleExists(stat) { const begin = new Date().getTime(); const fileMime = mime.lookup(requestedFilePath); const fileSize = stat.size; const textual = fileMime && (fileMime.indexOf("text/") === 0 || fileMime.indexOf('application/json') === 0 || fileMime.indexOf('application/javascript') === 0); if (textual) { const acceptEncoding = rc.request.headers['accept-encoding']; if(acceptEncoding){ if (acceptEncoding.indexOf("deflate") >=0) { rc.response.writeHead(200, { 'content-type': fileMime, 'content-encoding': 'deflate', "Last-Modified": stat.ctime.toString() }); rfs.createReadStream(requestedFilePath).pipe(zlib.createDeflate()).pipe(rc.response); } else if (acceptEncoding.indexOf("gzip") >=0) { rc.response.writeHead(200, { 'content-type':fileMime, 'content-encoding': 'gzip', "Last-Modified": stat.ctime.toString() }); rfs.createReadStream(requestedFilePath).pipe(zlib.createGzip()).pipe(rc.response); } else { rc.response.writeHead(200, { "Content-Type": fileMime, "Content-Length": fileSize, "Last-Modified": stat.ctime.toString() }); const rstream = rfs.createReadStream(requestedFilePath); rstream.on('end', () => { let end = new Date().getTime(); logger.debug("Served in " + (end-begin) + "ms: " + requestedFilePath); }); rstream.pipe(rc.response); } let end = new Date().getTime(); console.log("Served in " + (end-begin) + "ms: " + requestedFilePath); }else{ rc.response.writeHead(200, { "Content-Type": fileMime, "Content-Length": fileSize, "Last-Modified": stat.ctime.toString() }); const rstream = rfs.createReadStream(requestedFilePath); rstream.on('end', () => { let end = new Date().getTime(); logger.debug("Served in " + (end-begin) + "ms: " + requestedFilePath); }); rstream.pipe(rc.response); } logger.debug("200 OK: GET " + parsedUrl.pathname + " " + fileMime); } else { rc.response.writeHead(200, { "Content-Type": fileMime, "Content-Length": fileSize, "Last-Modified": stat.ctime.toString() }); const rstream = rfs.createReadStream(requestedFilePath); rstream.on('end', () => { let end = new Date().getTime(); logger.debug("Served in " + (end-begin) + "ms: " + requestedFilePath); }); rstream.pipe(rc.response); } }; const handleExists = function handleExists(stat) { const begin = new Date().getTime(); const fileMime = mime.lookup(requestedFilePath); const fileSize = stat.size; rc.response.writeHead(200, { "Content-Type": fileMime, "Content-Length": fileSize, "Last-Modified": stat.ctime.toString() }); const rstream = rfs.createReadStream(requestedFilePath); rstream.on('end', () => { let end = new Date().getTime(); logger.debug("Served in " + (end - begin) + "ms: " + requestedFilePath); }); rstream.pipe(rc.response); }; fs.stat(requestedFilePath).then((compression ? handleExistsCompressing : handleExists), handleFileNotFound); }; module.exports = serveExistingFile;
const others ={ "results": [ { "id":7, "user_id":"", "date":"2019-03-24", "heading":"Farmers' suicides in India", "detail":"Farmer suicides in India refers to the national catastrophe of farmers being forced to commit suicide since the 1990s, often by drinking pesticides, due to their inability to repay loans mostly taken from banks and NBFCs to purchase expensive seeds and fertilizers, often marketed by foreign MNCs.", "address":"Tamil Nadu", "posterpath":"https://i.ibb.co/dLJJ54c/7.jpg", "category":"Others", "location":"Theni", "status":"Open", "comment":"" }, { "id":8, "user_id":"", "date":"2019-03-25", "heading":"For Swachh Mission, unhygienic public washrooms get no takers", "detail":"There is no lack of unsavoury words to describe the state of public toilets in Delhi: Unhygienic, unsanitary or plain dirty. A common sight at most of these public washrooms is women entering with their noses and mouths covered. Even as the Swachh Bharat Mission was initiated in 2014 in a bid to free India from open defecation, there seems to have been no headway in the quality of options for citizens to use instead.", "address":"The AIIMS and Vijay Chowk washrooms", "posterpath":"https://i.ibb.co/XYjRnhC/8.jpg", "category":"Others", "location":"Delhi", "status":"Open", "comment":"" } ] } export default others;
export const name="why"; export const height="1.8";
import React from 'react' export const UserTypeScreen = () => { return ( <> </> ) }
export const LOADING_MATCHES = '[MATCHES] LOADING_MATCHES'; export const LOADED_MATCHES = '[MATCHES] LOADED_MATCHES'; export const ERROR_LOADING_MATCHES = '[MATCHES] ERROR_LOADING_MATCHES'; export const RESET_STATE = '[MATCHES] RESET_STATE'; export const ADDING_MATCH = '[MATCHES] ADDING_MATCH'; export const ADDED_MATCH = '[MATCHES] ADDED_MATCH'; export const ERROR_ADDING_MATCH = '[MATCHES] ERROR_ADDING_MATCH'; export const CLEAR_ERROR_ADD_MATCH = '[MATCHES] CLEAR_ERROR_ADD_MATCH'; export const RESET_ADD_MATCH_STATE = '[MATCHES] RESET_ADD_MATCH_STATE'; export const DELETING_MATCH = '[MATCHES] DELETING_MATCH'; export const DELETED_MATCH = '[MATCHES] DELETED_MATCH'; export const ERROR_DELETING_MATCH = '[MATCHES] ERROR_DELETING_MATCH'; export const CLEAR_ERROR_DELETE_MATCH = '[MATCHES] CLEAR_ERROR_DELETE_MATCH'; export const RESET_DELETE_MATCH_STATE = '[MATCHES] RESET_DELETE_MATCH_STATE'; export const LOADING_MATCH = '[MATCHES] LOADING_MATCH'; export const LOADED_MATCH = '[MATCHES] LOADED_MATCH'; export const ERROR_LOADING_MATCH = '[MATCHES] ERROR_LOADING_MATCH'; export const CLEAR_ERROR_LOAD_MATCH = '[MATCHES] CLEAR_ERROR_LOAD_MATCH'; export const RESET_LOAD_MATCH_STATE = '[MATCHES] RESET_LOAD_MATCH_STATE'; export const SUBSCRIBING = '[MATCHES] SUBSCRIBING'; export const SUBSCRIBED = '[MATCHES] SUBSCRIBED'; export const ERROR_SUBSCRIBING = '[MATCHES] ERROR_SUBSCRIBING'; export const CLEAR_SUBSCRIBE_ERROR = '[MATCHES] CLEAR_SUBSCRIBE_ERROR'; export const RESET_SUBSCRIBE_STATE = '[MATCHES] RESET_SUBSCRIBE_STATE'; export const UNSUBSCRIBING = '[MATCHES] UNSUBSCRIBING'; export const UNSUBSCRIBED = '[MATCHES] UNSUBSCRIBED'; export const ERROR_UNSUBSCRIBING = '[MATCHES] ERROR_UNSUBSCRIBING'; export const CLEAR_UNSUBSCRIBE_ERROR = '[MATCHES] CLEAR_UNSUBSCRIBE_ERROR'; export const RESET_UNSUBSCRIBE_STATE = '[MATCHES] RESET_UNSUBSCRIBE_STATE'; export const EDITING_MATCH = '[MATCHES] EDITING_MATCH'; export const EDITED_MATCH = '[MATCHES] EDITED_MATCH'; export const ERROR_EDITING_MATCH = '[MATCHES] ERROR_EDITING_MATCH'; export const CLEAR_ERROR_EDIT_MATCH = '[MATCHES] CLEAR_ERROR_EDIT_MATCH'; export const RESET_EDIT_MATCH_STATE = '[MATCHES] RESET_EDIT_MATCH_STATE'; export const EDITING_SCORE_MATCH = '[MATCHES] EDITING_SCORE_MATCH'; export const EDITED_SCORE_MATCH = '[MATCHES] EDITED_SCORE_MATCH'; export const ERROR_EDITING_SCORE_MATCH = '[MATCHES] ERROR_EDITING_SCORE_MATCH'; export const CLEAR_ERROR_EDIT_SCORE_MATCH = '[MATCHES] CLEAR_ERROR_EDIT_SCORE_MATCH'; export const RESET_EDIT_SCORE_MATCH_STATE = '[MATCHES] RESET_EDIT_SCORE_MATCH_STATE'; export const EDITING_TEAMS_MATCH = '[MATCHES] EDITING_TEAMS_MATCH'; export const EDITED_TEAMS_MATCH = '[MATCHES] EDITED_TEAMS_MATCH'; export const ERROR_EDITING_TEAMS_MATCH = '[MATCHES] ERROR_EDITING_TEAMS_MATCH'; export const CLEAR_ERROR_EDIT_TEAMS_MATCH = '[MATCHES] CLEAR_ERROR_EDIT_TEAMS_MATCH'; export const RESET_EDIT_TEAMS_MATCH_STATE = '[MATCHES] RESET_EDIT_TEAMS_MATCH_STATE';
module.exports = { // publicPath: process.env.NODE_ENV === 'production' // ? '' // : '/', devServer: { proxy: { '/api': { target: 'http://192.168.1.102:8080', pathRewrite: { '^/api': '' }, changeOrigin: true }, '/search_api': { target: 'http://192.168.1.102:8080', pathRewrite: { '^/search_api': '' }, changeOrigin: true }, '/shopcar_api': { target: 'http://192.168.1.102:8080', pathRewrite: { '^/shopcar_api': '' }, changeOrigin: true }, "/payment_api": { target: 'http://192.168.1.102:8080', pathRewrite: { '^/payment_api': '' }, changeOrigin: true }, "/sxt": { target: 'http://192.168.1.116:3001', pathRewrite: { '^/sxt': '' }, changeOrigin: true }, "/register_api": { target: 'http://192.168.1.102:8080', pathRewrite: { '^/register_api': '' }, changeOrigin: true } } } }
const router = require('express').Router() const controller = require("../../controllers/api/report") const isLogin = require("../../middleware/is-login") const multer = require("multer") router.post('/report',isLogin,multer().none(), controller.index) module.exports = router;
import React from 'react'; import Card from './components/Card'; import axios from 'axios' import Button from '@material-ui/core/Button'; import { withStyles } from '@material-ui/core/styles'; import { Link } from 'react-router-dom'; const styles = { button: { color: 'blue', fontWeight: 'bold', fontSize: 20, borderColor: 'black', borderWidth: 1 }, input: { display: 'none', }, del: { color: '#FF0000', font: 22, }, }; class FormEduOrg extends React.Component { constructor(props) { super(props) this.state = { response: <h1>page loading ...</h1>, deleting: '', } } ggg=() => { const { id } = this.props.match.params console.log(id+"dadadadaxadaxdxd") var lastPart = window.location.href.split("/").pop(); console.log(lastPart) console.log(window.location.href) const s = lastPart //5cb9d1188e100a2cdc8d4d0a return s; } componentDidMount() { const s = this.ggg(); axios.get(`http://localhost:5000/api/educationalOrganizations/courses/`+s) .then(res => { var c = res.data.data; var ans = <div> {c.map(course => ( <Card cid={course._id} course={course} deleteCourse={this.deleteCourse} /> ))} </div> this.setState({ response: ans }) }) } render() { return ( <div> <h1>Courses</h1> {/* <Button size="small" variant="contained" style={styles.button} >Create a new course?</Button> */} <Link to={`/createCourse`} style={styles.button}>Create a new course?</Link> <br /><br /> {this.state.deleting} {this.state.response} </div> ) } deleteCourse = (cid) => { console.log('dakhal' + cid) this.setState({ deleting: <div><p style={styles.del}>deleting ...</p></div> }) axios.delete(`http://localhost:5000/api/courses/${cid}`) .then((res) => { window.location.reload(); console.log('ay7aga') }) } } export default withStyles(styles)(FormEduOrg);
function getInformationAboutOneProduct(product_id) { $('.carousel_same_products').css('display', 'block'); $('#one_product').css('display', 'block') $('.product_id').css('display', 'none'); $('.number_page').css('display', 'none'); $('.line').remove(); $.getJSON("product-information.php?product_id="+product_id, function(data){ $.each(data, function(key, value){ $('.name_one_product').text(value.title); $('.mini_discr').text(value.mini_discription); $('.artical_product').text('Артикул:' + ' ' + value.artical); $('.price_product').text(value.price + ' ' + 'руб.'); $('.image_one_products').attr('src', value.image); }) }) } function carouselCategory(category) { $('.none_class1').removeClass().addClass('carousel-button-left'); $('.none_class2').removeClass().addClass('carousel-button-right'); $.getJSON("carousel-categories.php?category="+category, function(data){ $.each(data, function(key, value){ var newImage = data.map(function (data) { return data.image; }); var newId = data.map(function (data) { return data.product_id; }); var same_products = data.length; $('#same_products').text(same_products + ' '+'аналогичных товаров данной категрии:') if(key===0){ for(var i=0; i<data.length; i++){ console.log(newImage[i]) $(".block_with_carousel").clone().removeClass("block_with_carousel").addClass("carousel-block") .appendTo(".carousel-items"); } $(".block_with_carousel").remove() } if(key===0){ for(var i=0; i<data.length; i++){ var element = document.getElementsByClassName('image-in-carousel')[i]; element.setAttribute('src', newImage[i]); element.id = newId[i]*1000; }} }); }) } function ttt(id) { console.log(id) $('id').clone('.cart') }
/** * @author Ignacio González Bullón - <nacho.gonzalez.bullon@gmail.com> * @since 12/12/15. */ (function () { 'use strict'; angular.module('corestudioApp') .controller('ChangepassController', ChangepassController); ChangepassController.$inject = ['$uibModalInstance', '$scope']; function ChangepassController($uibModalInstance, $scope) { var vm = this; vm.title = 'Cambiar contraseña'; vm.dismiss = dismiss; vm.savePassword = savePassword; ///////////////////// function dismiss() { $uibModalInstance.dismiss('CANCEL'); } function savePassword() { $scope.$broadcast('show-errors-check-validity'); if ($scope.changePasswordForm.$valid) { $uibModalInstance.close({action: 'SAVE', passwords: {oldPassword: vm.oldPassword, newPassword: vm.newPassword}}); } } } })();
'use strict'; const Constants = { TITLE: 'ID Me!', ENDPOINT: 'http://localhost:8000', TOPBAR_HEIGHT: 60, BOTTOMBAR_HEIGHT: 80, }; module.exports = Constants;
import React from 'react'; import { View, Image, } from 'react-native'; import { Container, Content, Button, Text, Icon, H3, CardItem, Card, Body } from 'native-base'; import { LogoTitle } from '../../../components/header'; import Strings from '../../../language/fr'; import { reverseFormat, FilePicturePath, toDate } from '../../../utilities/index'; export class ArchiveDetailsScreen extends React.Component { static navigationOptions = ({ navigation }) => { return { headerTitle: <LogoTitle HeaderText={Strings.RECEPTION_CHECK} />, }; }; constructor(props) { super(props); this.state = { item: this.props.navigation.state.params.controle, equipments: [], }; this._bootstrapAsync(); } _bootstrapAsync = async () => { }; _parseEquipments() { } componentDidMount() { this._parseEquipments(); }; render() { return ( <Container> <Content padder> <Card> <CardItem header bordered> {this.state.item.type == 0 && <Text>{Strings.PRODUCT}: {this.state.item.produit}</Text>} {this.state.item.type == 1 && <Text>{Strings.CONTROLE_FROID}</Text>} {this.state.item.type == 2 && <Text>{Strings.PRODUCT}: {this.state.item.produit}</Text>} {this.state.item.type == 3 && <Text>{Strings.CLEANING_SCHEDULE}: {this.state.item.equipment ? this.state.item.equipment.name : 'equipment'}</Text>} </CardItem> {(this.state.item.type == 0 || this.state.item.type == 1 || this.state.item.type == 3) && <CardItem header bordered> <View> {this.state.item.confirmed == 1 && <View style={{ flexDirection: 'row', marginBottom: 20, }}> <Button iconLeft success> <Icon name='checkmark' /> <Text>{Strings.CONFIRMED}</Text> </Button> </View>} {this.state.item.confirmed == 0 && <View style={{ marginBottom: 20, }}><Button iconLeft danger> <Icon name='close' /> <Text>{Strings.NOT_CONFIRMED}</Text> </Button></View>} </View> </CardItem>} <CardItem bordered> <Body> <View style={{ padding: 10, flexDirection: 'row' }}> {this.state.item.source != '' && <Button style={{ width: 70, height: 70, borderRadius: 100, }} onPress={() => this.props.navigation.navigate('ArchiveGallery', { index: 0, pictures: [{ source: this.state.item.source }], })}><View style={{ backgroundColor: 'white', borderRadius: 100, borderWidth: 1, }}> <Image resizeMode={'cover'} style={{ width: 70, height: 70, borderRadius: 100, }} source={{ uri: FilePicturePath() + this.state.item.source }} /></View></Button>} {this.state.item.signature != '' && <Button style={{ width: 70, height: 70, borderRadius: 100, }} onPress={() => this.props.navigation.navigate('ArchiveGallery', { index: 1, pictures: [{ source: this.state.item.signature }], })}><View style={{ backgroundColor: 'white', borderRadius: 100, borderWidth: 1, }}> <Image resizeMode={'cover'} style={{ width: 70, height: 70, borderRadius: 100, }} source={{ uri: FilePicturePath() + this.state.item.signature }} /></View></Button>} </View> </Body> </CardItem> {this.state.item.type == 0 && <CardItem bordered> <Body> <Text>{Strings.DUBL}: {this.state.item.dubl}</Text> </Body> </CardItem>} {this.state.item.type == 0 && <CardItem bordered> <Body> <Text>{Strings.ASPECT}: {this.state.item.aspect == 0 ? Strings.BON : Strings.MAUVAIS}</Text> </Body> </CardItem>} {this.state.item.type == 0 && <CardItem bordered> <Body> <Text>{Strings.DUPRODUIT}: {this.state.item.du_produit}</Text> </Body> </CardItem>} {this.state.item.type == 0 && <CardItem bordered> <Body> <Text>{Strings.EMBALAGE_INTATC}: {this.state.item.intact == 0 ? Strings.NO : Strings.YES}</Text> </Body> </CardItem>} {this.state.item.type == 0 && <CardItem bordered> <Body> <Text>{Strings.ETIQUTAGE_CONF}: {this.state.item.conforme == 0 ? Strings.NO : Strings.YES}</Text> </Body> </CardItem>} {(this.state.item.type == 0 || this.state.item.type == 3) && <CardItem bordered> <Body> <Text>{Strings.AUTRES}: {this.state.item.autres}</Text> </Body> </CardItem>} {this.state.item.type == 0 && <CardItem bordered> <Body> <Text>{Strings.ACTION_CORECTIVES}: {this.state.item.actions}</Text> </Body> </CardItem>} {this.state.item.type == 0 && <CardItem bordered> <Body> <Text>{Strings.FOURNISSEUR}: {this.state.item.fourniseur.name}</Text> </Body> </CardItem>} {this.state.item.type == 1 && <CardItem bordered> <Body> {this.state.item.products.map(product => { return <View style={{ marginBottom: 10, }}> <Text>{Strings.PRODUCT}: {product.name}</Text> <Text>{Strings.TEMPERATURE}: {product.temperature}°</Text> </View> })} </Body> </CardItem>} {this.state.item.type == 1 && <CardItem bordered> <Body> <View style={{ marginTop: 20, marginBottom: 20, }}> {this.state.item.temperatures.map((row) => { return <View style={{ marginBottom: 20, }}> <View style={{ flexDirection: 'row' }}> <View style={{ marginRight: 10, }}> <Button transparent style={{ height: 50, }} onPress={() => this.props.navigation.navigate('ArchiveGallery', { index: 0, pictures: [{ source: row.equipment.source }], })}> <Image resizeMode={'cover'} style={{ width: 50, height: 50, borderRadius: 100, }} source={{ uri: FilePicturePath() + row.equipment.source }} /> </Button> </View> <View> <H3 style={{ marginBottom: 10, }}>{row.equipment.name}</H3> {row.values.map(val => { return <Text>{Strings.TEMPERATURE}: {val}°</Text> })} </View> </View> </View>; })} </View> </Body> </CardItem>} {this.state.item.type == 1 && <CardItem bordered> <Body> <Text>{Strings.AUTRES}: {this.state.item.autres}°</Text> </Body> </CardItem>} {this.state.item.type == 1 && <CardItem bordered> <Body> <Text>{Strings.AUTRES_CORECTIVES}: {this.state.item.actions}</Text> </Body> </CardItem>} {this.state.item.type == 2 && <CardItem bordered> <Body> <Text>{Strings.QUANTITY}: {this.state.item.quantity}</Text> </Body> </CardItem>} {this.state.item.type == 2 && <CardItem bordered> <Body> <Text>{Strings.VALORISATION}: {this.state.item.valorisation} ‎€</Text> </Body> </CardItem>} {this.state.item.type == 2 && <CardItem bordered> <Body> <Text>{Strings.CAUSES}: {this.state.item.causes}‎</Text> </Body> </CardItem>} {this.state.item.type == 2 && <CardItem bordered> <Body> <Text>{Strings.DEVENIR}: {this.state.item.devenir}‎</Text> </Body> </CardItem>} {this.state.item.type == 2 && <CardItem bordered> <Body> <Text>{Strings.TRAITMENT_DATE}: {reverseFormat(this.state.item.traitment_date.toISOString().substring(0, 10))}</Text> </Body> </CardItem>} {true && <CardItem bordered> <Body> <Text>{Strings.DATETIME}: {reverseFormat(toDate(this.state.item.created_at))} {this.state.item.created_at.toLocaleTimeString()}</Text> </Body> </CardItem>} </Card> </Content> </Container > ); } }
var mongoose = require('mongoose'), Schema = mongoose.Schema, passportLocalMongoose = require('passport-local-mongoose'); var User = new Schema({ email : String, password : String }); User.plugin(passportLocalMongoose); User.static('userExists', function(userEmail, callback) { var users = this.findOne({email : userEmail}); console.log(users[0]); //return (typeof(user) != 'undefined' && user != null); /* var user = this.findOne({email : userEmail}, function(err,obj) { if(err){ console.log("Err:" + err); return null; } console.log("o:"+obj); return obj; }); console.log("u:"+user[0]);*/ return (user[0].email != null && user[0].email != 'undefined'); }); module.exports = mongoose.model('User', User);
const express = require('express') const router = express.Router() const controllerUser = require('../controllers/userController.js') const isLogin = require('../middlewares/isLogin') router.use(isLogin) router.get('/', controllerUser.getDataUser) router.put('/', controllerUser.addWatchedTags) module.exports = router
window.onload = function () { //Better to construct options first and then pass it as a parameter var options = { data: [ { // Change type to "doughnut", "line", "splineArea", etc. type: "column", dataPoints: [ { label: "apple", y: 10 }, { label: "orange", y: 15 }, { label: "banana", y: 25 }, { label: "mango", y: 30 }, { label: "grape", y: 28 } ] } ] }; $("#chartContainer").CanvasJSChart(options); } // line charAt window.onload = function () { var options = { animationEnabled: true, theme: "light2", axisX: { valueFormatString: "DD MMM" }, axisY: { title: "Number of Sales", suffix: "K", minimum: 30 }, toolTip: { shared: true }, legend: { cursor: "pointer", verticalAlign: "bottom", horizontalAlign: "left", dockInsidePlotArea: true, itemclick: toogleDataSeries }, data: [{ type: "column", showInLegend: true, name: "Projected Sales", markerType: "square", xValueFormatString: "DD MMM, YYYY", color: "#F08080", yValueFormatString: "#,##0K", dataPoints: [ { x: new Date(2017, 10, 1), y: 63 }, { x: new Date(2017, 10, 2), y: 69 }, { x: new Date(2017, 10, 3), y: 65 }, { x: new Date(2017, 10, 4), y: 70 }, { x: new Date(2017, 10, 5), y: 71 }, { x: new Date(2017, 10, 6), y: 65 }, { x: new Date(2017, 10, 7), y: 73 }, { x: new Date(2017, 10, 8), y: 96 }, { x: new Date(2017, 10, 9), y: 84 }, { x: new Date(2017, 10, 10), y: 85 }, { x: new Date(2017, 10, 11), y: 86 }, { x: new Date(2017, 10, 12), y: 94 }, { x: new Date(2017, 10, 13), y: 97 }, { x: new Date(2017, 10, 14), y: 86 }, { x: new Date(2017, 10, 15), y: 89 } ] }, { type: "column", showInLegend: true, name: "Actual Sales", lineDashType: "dash", yValueFormatString: "#,##0K", dataPoints: [ { x: new Date(2017, 10, 1), y: 60 }, { x: new Date(2017, 10, 2), y: 57 }, { x: new Date(2017, 10, 3), y: 51 }, { x: new Date(2017, 10, 4), y: 56 }, { x: new Date(2017, 10, 5), y: 54 }, { x: new Date(2017, 10, 6), y: 55 }, { x: new Date(2017, 10, 7), y: 54 }, { x: new Date(2017, 10, 8), y: 69 }, { x: new Date(2017, 10, 9), y: 65 }, { x: new Date(2017, 10, 10), y: 66 }, { x: new Date(2017, 10, 11), y: 63 }, { x: new Date(2017, 10, 12), y: 67 }, { x: new Date(2017, 10, 13), y: 66 }, { x: new Date(2017, 10, 14), y: 56 }, { x: new Date(2017, 10, 15), y: 64 } ] }] }; $("#chartContainer").CanvasJSChart(options); var options2 = { animationEnabled: true, theme: "light2", axisX: { valueFormatString: "DD MMM" }, axisY: { title: "Number of Sales", suffix: "K", minimum: 30 }, toolTip: { shared: true }, legend: { cursor: "pointer", verticalAlign: "bottom", horizontalAlign: "left", dockInsidePlotArea: true, itemclick: toogleDataSeries }, data: [{ type: "spline", showInLegend: true, name: "Projected Sales", markerType: "square", xValueFormatString: "DD MMM, YYYY", color: "#F08080", yValueFormatString: "#,##0K", dataPoints: [ { x: new Date(2017, 10, 1), y: 63 }, { x: new Date(2017, 10, 2), y: 69 }, { x: new Date(2017, 10, 3), y: 65 }, { x: new Date(2017, 10, 4), y: 70 }, { x: new Date(2017, 10, 5), y: 71 }, { x: new Date(2017, 10, 6), y: 65 }, { x: new Date(2017, 10, 7), y: 73 }, { x: new Date(2017, 10, 8), y: 96 }, { x: new Date(2017, 10, 9), y: 84 }, { x: new Date(2017, 10, 10), y: 85 }, { x: new Date(2017, 10, 11), y: 86 }, { x: new Date(2017, 10, 12), y: 94 }, { x: new Date(2017, 10, 13), y: 97 }, { x: new Date(2017, 10, 14), y: 86 }, { x: new Date(2017, 10, 15), y: 89 } ] }, { type: "spline", showInLegend: true, name: "Actual Sales", lineDashType: "dash", yValueFormatString: "#,##0K", dataPoints: [ { x: new Date(2017, 10, 1), y: 60 }, { x: new Date(2017, 10, 2), y: 57 }, { x: new Date(2017, 10, 3), y: 51 }, { x: new Date(2017, 10, 4), y: 56 }, { x: new Date(2017, 10, 5), y: 54 }, { x: new Date(2017, 10, 6), y: 55 }, { x: new Date(2017, 10, 7), y: 54 }, { x: new Date(2017, 10, 8), y: 69 }, { x: new Date(2017, 10, 9), y: 65 }, { x: new Date(2017, 10, 10), y: 66 }, { x: new Date(2017, 10, 11), y: 63 }, { x: new Date(2017, 10, 12), y: 67 }, { x: new Date(2017, 10, 13), y: 66 }, { x: new Date(2017, 10, 14), y: 56 }, { x: new Date(2017, 10, 15), y: 64 } ] }] }; $("#chartContainer1").CanvasJSChart(options2); function toogleDataSeries(e) { if (typeof (e.dataSeries.visible) === "undefined" || e.dataSeries.visible) { e.dataSeries.visible = false; } else { e.dataSeries.visible = true; } e.chart.render(); } }
var request = require('request'); function getAsUriParameters(data) { var url = ''; for (var prop in data) { url += encodeURIComponent(prop) + '=' + encodeURIComponent(data[prop]) + '&'; } return url.substring(0, url.length - 1) }; /** * Really? You're looking in here? * * It's a whole route that isn't used by the app. * If you give it an address in the United States, * it will get the latitude and longitude of the * address. **/ exports.fetch = function (req, res, next) { console.log('geo.fetch') console.log(JSON.stringify(req.body, null, 2)); var url = "https://geocoding.geo.census.gov/geocoder/locations/address?benchmark=Public_AR_Current&format=json&"; var addressParams = getAsUriParameters(req.body); url += addressParams; console.log('url = ' + url); request(url, function (err, resGeo, body) { if (err) return next(); if (body) { var result = JSON.parse(body); result = result.result; if (resGeo.statusCode === 200) { switch(result.addressMatches.length) { case 0: res.status(403).json({ "message":"did not match address" }); break; case 1: res.status(resGeo.statusCode).json( result.addressMatches[0].coordinates ); break; case 2: default: res.status(403).json({ "message":"matched more than one address" }); } } else { res.status(resGeo.statusCode).json(body); } } else { res.status(resGeo.statusCode).json({}); } }); };
var game = new Phaser.Game(640, 640, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); var player ; var map; var layer; var cursors; var jumpButton; function preload() { game.load.tilemap('map', null, map, Phaser.Tilemap.TILED_JSON); game.load.image('tilea2', 'assets/tilemap/tilea2.png'); game.load.spritesheet('player', 'assets/GFX/SPRITES/PNG/WALK/1.png',0,0); } function create() { game.physics.startSystem(Phaser.Physics.ARCADE); game.time.desiredFps = 30; game.physics.arcade.gravity.y = 250; map = game.add.tilemap('map'); map.addTilesetImage('tilea2'); map.setCollisionBetween(1, 170); layer = map.createLayer('Tile Layer 1'); layer.resizeWorld(); //najpierw sprite potem działanie na nim jako obj player =game.add.sprite(0,0,'player'); game.physics.enable(player, Phaser.Physics.ARCADE); player.body.collideWorldBounds = true; player.body.setSize(32 , 32, 32, 32); game.camera.follow(player); cursors = game.input.keyboard.createCursorKeys(); } function update() { game.physics.arcade.collide(player, layer); if(cursors.left.isDown){ player.x -= 3 }if(cursors.right.isDown){ player.x += 3; }if(cursors.up.isDown){ player.y -= 3; }if(cursors.down.isDown){ player.y += 3; } } function render () { game.debug.text(game.time.suggestedFps, 32, 32); // game.debug.text(game.time.physicsElapsed, 32, 32); // game.debug.body(player); // game.debug.bodyInfo(player, 16, 24); }
import RestfulDomainModel from '../base/RestfulDomainModel' import Contact from './contact' import Profile from './profile' class Model extends RestfulDomainModel { async list(Model) { return await this.post(`${this.baseUrl}/list`, Model) } } export default new Model([ { id: { name: 'ID', dataOnly: true }}, { profileId: { name: '好友', dataOnly: true, include: Profile, as: 'profile' }}, { contactId: { name: '发布者', dataOnly: true, include: Contact, as: 'publisher' }}, { content: { name: '内容' }}, { likeCount: { name: '点赞数' }}, { commentCount: { name: '评论数' }}, { replyCount: { name: '回复数' }}, { location: { name: '地理位置' }}, { isPrivate: { name: '是否私有' }}, { type: { name: '类型', dataOnly: true }}, { publishTime: { name: '发布时间' }}, { ctime: { name: '创建时间' }} ], '/im/timeline')
const express = require('express') const app = express() const bodyParser = require('body-parser') const user = require('./routes/user') const package = require('./routes/package') const order = require("./routes/order") const cors = require('cors') // const publicPath = path.join(__dirname,"realClient/client/build") const port = process.env.PORT || 4000 // seeing if it is working app.use(bodyParser.json()) // app.use(express.static(path.join(__dirname,"realClient/client/build"))) // app.use(express.static(publicPath)) app.use(package) app.use(user) app.use(order) app.use(cors({ origin: 'https://michaels-final-app.herokuapp.com' })) app.get('/', (req, res) => { res.send('Welcome to our express app hahahahaha') }) app.get('*',(req,res)=>{ res.sendFile(path.join(publicPath,"index.html")) }) app.listen(port, () => { console.log(`App running on port: ${port}`) })
import React from "react"; import { FreeBird, Col, Row, CardBody, Fa } from "mdbreact"; class Baner extends React.Component { render() { return ( <div> <img src="http://hbanoticias.com/wp-content/uploads/2018/03/TECSUP.jpg" width="100%" className="mx-auto" alt="Responsive" /> <FreeBird> <Row> <Col md="10" className="mx-auto float-none white z-depth-1 py-2 px-2" > <CardBody> <h2 className="h2-responsive mb-4 text-center text-uppercase indigo-text"> <strong>Gestor de contenidos</strong> </h2> <p className="text-center">Bienvenidos a nueva experiencia</p> <Row className="d-flex flex-row justify-content-center row"> <a className="border nav-link border-light rounded mr-1" href="/login" rel="noopener noreferrer" > <Fa icon="graduation-cap" className="mr-2" size="2x" /> <span className="text-uppercase text-secondary " > Inicia Sesion</span> </a> </Row> </CardBody> </Col> </Row> </FreeBird> </div> ); } } export default Baner;
// 展示于 header 横幅的默认标题 const bannerDefaultTitle = 'you know znm' // 站点名, 用于页面 title const siteName = 'youknowznm' // github 用户名, 用于获取仓库列表 const githubUsername = 'youknowznm' // 社交相关, 在 footer 展示, 按需增减 const email = 'znm92@icloud.com' const zhihu = 'https://www.zhihu.com/people/youkonwznm' // 是否在 header 导航展示简历链接 // 如不展示, 则需手动前往 `/about` 查看 const showResumeOnHeaderNav = false // 笔记 markdown 代码的语言列表, 用以优化 hljs 的体积 const markdownCodeLanguages = ['javascript', 'scss', 'css', 'bash'] module.exports = { bannerDefaultTitle, siteName, githubUsername, email, zhihu, github: `https://github.com/${githubUsername}`, showResumeOnHeaderNav, markdownCodeLanguages, }
/** * @class Buffer * Buffer */ export class Buffer { /** * @constructor * @param {WebGLRenderingContext} gl A WebGL rendering context. * @param {Float32Array} data Data. * @param {Object} options Options. * @param {String} [options.name] The name of the attribute. * @param {Number} [options.type] The WebGL type of the attribute. * @param {Number} [options.size] The size of the attributes in bytes. * @param {Number} [options.location] The index location in the shader. * @param {WebGLProgram} [options.program] The WebGL program. * @return {Attribute} The attribute variable. * @api public */ constructor (gl, data, options) { options = options || {}; var type = options.type || gl.ARRAY_BUFFER; if(type !== gl.ARRAY_BUFFER && type !== gl.ELEMENT_ARRAY_BUFFER) { throw new Error("gl-buffer: Invalid type for webgl buffer, must be either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER") } var usage = options.usage || gl.DYNAMIC_DRAW; if(usage !== gl.DYNAMIC_DRAW && usage !== gl.STATIC_DRAW && usage !== gl.STREAM_DRAW) { throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW") } var buffer = gl.createBuffer(); this.gl = gl; this.type = type; this.usage = usage; this.buffer = buffer; this.length = 0; if (data) { this.update(data); } } /** * Buffer#bind * Bind this buffer. * @return {Buffer} this for chaining. */ bind () { this.gl.bindBuffer(this.type, this.buffer); return this; } /** * Buffer#unbind * Unbind this buffer. * @return {Buffer} this for chaining. */ unbind () { this.gl.bindBuffer(this.type, null); return this; } /** * Buffer#dispose * Dispose this buffer. * @return {Buffer} this for chaining. */ dispose () { this.gl.deleteBuffer(this.buffer); return this; } /** * Buffer#update * Update this buffer. * @return {Buffer} this for chaining. */ update (data, offset) { var gl = this.gl; if (typeof offset !== "number") { offset = -1 } this.bind(); var count = data.length; var length = count * data.BYTES_PER_ELEMENT; if (offset < 0) { gl.bufferData(this.type, data, this.usage) this.count = count; this.length = length; return; } if (length + offset > this.length) { throw new Error("gl-buffer: If resizing buffer, must not specify offset") } gl.bufferSubData(this.type, offset, data); return this; } }
import React from "react"; import { Carousel } from "../../components/carousel/Carousel"; import { Home } from "../../components/home/Home"; export const HomePage = () => ( <div> <Carousel title="Welcome to Nicks Financial Services" text="We are passionate about providing an exceptional service and expert advice to assist you in achieving your financial goals!" url={`https://images.unsplash.com/photo-1495433324511-bf8e92934d90?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2700&q=80`} /> <Home /> </div> );
const Borrowed = require('../models').Borrowed; const User = require('../models').User; const Book = require('../models').Book; const Genre = require('../models').Genre; const mailAdmin = require('../email/notifyAdmin').mailAdmin; const EventEmitter = require('events'); let userData; class MailEvent extends EventEmitter {} const mailEvent = new MailEvent(); mailEvent.on('email', () => { mailAdmin(userData); }); module.exports = { //allow users to borrow book create(req, res) { return Borrowed .create({ userId: req.params.userId, bookId: req.params.bookId, returned: false }) //get details of book borrowed and notify admin .then(borrowedBook => { let userId = borrowedBook.userId; let bookId = borrowedBook.bookId; let date = borrowedBook.createdAt; //get complete user details from users table in the database return User.findById(userId).then(user => { let userEmail = user.email; let username = user.username; //get details of book borrowed from books table in the database return Book.findById(bookId, { include: { model: Genre, as: 'genre' } }).then(function(book) { let bookTitle = book.title; let genre = book.genre; userData = { username: username, email: userEmail, bookTitle: bookTitle, genre: genre, date: date }; res.status(201).send({ message: 'You have successfully borrowed this book', borrowedBook }); mailEvent.emit('email'); }); }); }) .catch(() => res.status(500).send({ message: 'Internal Server Error' })); }, update(req, res) { return Borrowed .find({ where: { bookId: req.params.bookId, userId: req.params.userId } }) .then(books => { if (!books) { return res.status(404).send({ message: 'Book Not Found' }); } return books .update({ returned: req.body.returned || books.returned }) .then(returnedBook => res.status(200).send({ message: 'You have succesfully returned this book', returnedBook })) .catch(() => res.status(500).send({ message: 'Internal Server Error' })); }) .catch(() => res.status(500).send({ message: 'Internal Server Error' })); } };
import Colors from "./Colors"; import Font from "./Font"; import Dimensions from "./Dimensions"; import Shadow from "./shadowGenerator"; import Helper from "./Helper"; export { Colors, Font, Dimensions, Shadow, Helper };
import React from 'react'; import ResourceSub from '../comps/ResourceSub'; export default { title:'ResourceSubheading', component: ResourceSub }; export const DefaultResub = () => <ResourceSub />
class ViewerService { constructor(config) { /** * The type of service (e.g. wms, wmts, kml, etc.) * * @type {string} */ this.type = ''; /** * The URL of the service endpoint or the data file * * @type {string} */ this.url = ''; /** * The layers this service provides * * @type {Array} */ this.layers = []; if (config.type) this.type = config.type; if (config.url) this.url = config.url; if (config.layers) { this.setLayers(config.layers); } } /** * Taking a ViewerService object get all layer properties from the service endpoint/datafile * * @param crs * @returns {Promise<ViewerService>} */ async getInstance(crs) { var me = this; console.log('get service instance wtih crs: ' + crs); await this.getCapabilities().then(function (clayers) { if (clayers!=='skip') { if (me.layers.length > 0) { me.layers = me.mergeLayers(me.layers, clayers); } else { me.layers = clayers; } } var i = 0; for (const layer of me.layers) { console.log('set ol with ' + me.url + ' and ' + crs); layer.setOL(me.url, crs); if (layer.ol !== false) { me.layers[i].ol = layer.ol; } else { // unset me.layers[i].splice(i, 1); } i++; } return me; }); console.log(me); return me; } /** * Retrieve all layers from the Service Url/data file * * @returns {Promise<Array>} */ async getCapabilities() { // gets overwritten in all the subclasses; return []; } /** * Set layer properties from config * * @param layers */ setLayers() { // gets overwritten in all the subclasses; } /** * Merge the layers array retrieved by getCapabilities with the layers array of the config. * Overrides the default layer properties with the ones provided in the config. * * @param layers * @param clayers * @returns {Array} */ mergeLayers(layers,clayers) { const complayers=[]; const compare = this.compareByTitle(layers, clayers); for (const title in compare.t2) { const cindex=compare.t2[title]; const index=compare.t1[title]; if (index > -1) { const lyr=clayers[cindex]; lyr.id = layers[index].id; lyr.label = layers[index].label; lyr.visible = layers[index].visible; lyr.opacity = layers[index].opacity; lyr.zindex = layers[index].zindex; complayers.push(lyr); } } return complayers; } /** * Given 2 arrays of Objects with a property 'title' this returns 2 arrays: * t1: all titles of arr1 as t1[<title>]=<index of arr1> * t2: all titles of arr2 that are also in arr1 as t2[<title>]=<index of arr2> * * @param arr1 @type {Array} * @param arr2 @type {Array} * @returns {{t1: Array, t2: Array}} */ compareByTitle(arr1, arr2) { //hmmm let i = 0; const t1 = []; for (const a1 of arr1) { t1[a1.title] = i; i++; } i = 0; const t2 = []; for (const a2 of arr2) { if (a2.title in t1) { t2[a2.title] = i; } i++; } return { t1: t1, // indices of arr1 t2: t2 // intersection + indices of arr2 } } } export default ViewerService;
const controller = require("egg").Controller class User extends controller{ /** *用户登录 * * @memberof User */ async signIn(){ const {username,password} = this.ctx.request.body; const user = await this.ctx.service.user.signIn(username,password) if(user){ this.ctx.helper.success(200,user,"请求成功") }else{ this.ctx.success(401, user, "用户名或密码错误"); } }; /** * 用户注册 * * @memberof User */ async signUp(){ const {username,password,code} = this.ctx.request.body; const userinfo = await this.ctx.service.user.signUp(username,password,code); userinfo?this.ctx.success(200,userinfo,"请求成功"):""; }; /** *用户退出 * * @memberof User */ async signOut(){ console.log("用户退出") }; /** * 获取用户信息 */ async userInfo(){ const userinfo = await this.ctx.service.user.getUserInfo(); userinfo?this.ctx.success(200,userinfo):""; } /** * 发送激活邮件 */ async sendEmail(){ const template = `<a href = '${this.ctx.origin}/user/emailVerify?token=2313'>点击链接进行验证</a>` const mailOptions = { from: 'wang839305939@outlook.com', to: '839305939@qq.com', subject: 'hello world', html: template }; const sendResult = await this.app.email.sendMail(mailOptions); if(sendResult){ this.ctx.success(200,{},'邮件发送成功'); }else{ this.ctx.success(400,'邮件发送失败'); } }; /** * 邮箱激活验证 */ emailVerify(){ console.info(chalk.green(`收到邮箱验证请求`)); this.ctx.success(200,{},'验证成功'); } } module.exports = User;
// Common JS let menu = require('./../blocks/common/menu/menu'); let rangeSlider = require('./../blocks/common/range-slider/range-slider'); let textField = require('./../blocks/common/text-field/text-field'); let counter = require('./../blocks/common/counter/counter'); //console.log("Common loaded..."); exports.menu = menu; exports.rangeSlider = rangeSlider; exports.textField = textField; exports.counter = counter;
const express = require('express'); const next = require('next'); const qs = require('qs'); const { NODE_ENV, ENV } = process.env; const dev = typeof NODE_ENV === 'undefined' || NODE_ENV === 'development'; const app = next({ dev }); const handle = app.getRequestHandler(); const http_port = process.env.PORT || 7001; const root_url_prefix = ENV === 'kubernetes' ? '/runregistry' : ''; app.prepare().then(() => { const server = express(); // We set depth of query parser to allow complicated url filters on the table (for bookmarkability) server.set('query parser', function (str) { return qs.parse(str, { depth: 50 }); }); // const router = express.Router(); // Redirects primary url to runs/all server.get('/', (req, res) => { res.redirect(`${root_url_prefix}/online/global`); }); server.get('/online', (req, res) => { res.redirect(`${root_url_prefix}/online/global`); }); server.get('/offline', (req, res) => { res.redirect(`${root_url_prefix}/offline/datasets/global`); }); //online: server.get('/online/:workspace', (req, res) => { req.params.type = 'online'; const params = { ...req.headers, ...req.params, filters: req.query }; app.render(req, res, `/online`, params); }); // offline: // section can be either datasets or cycles server.get('/offline/:section/:workspace', (req, res) => { req.params.type = 'offline'; const params = { ...req.headers, ...req.params, filters: req.query }; app.render(req, res, `/offline`, params); }); // json: server.get('/json', (req, res) => { req.params.type = 'json'; const params = { ...req.headers, ...req.params, filters: req.query }; app.render(req, res, `/json`, params); }); server.get('/json_portal', (req, res) => { req.params.type = 'json_portal'; const params = { ...req.headers, ...req.params, filters: req.query }; app.render(req, res, `/json_portal`, params); }); // log: server.get('/log', (req, res) => { req.params.type = 'log'; const params = { ...req.headers, ...req.params, filters: req.query }; app.render(req, res, `/log`, params); }); server.get('*', (req, res) => { return handle(req, res); }); server.listen(http_port, (err) => { if (err) throw err; console.log(`> HTTP listening in port ${http_port}`); }); });
"use strict"; // // generator.js // // Created by Alezia Kurdis, April 16th, 2021. // Copyright 2021 Vircadia and contributors. // // Generate a 3d portals in-world based on the places api. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // (function(){ //Fetch Data from Places API var placeApiUrl = "https://metaverse.vircadia.com/live/api/v1/places?current_page=1&per_page=1000"; var placesHttpRequest = null; var placesData; var portalList = []; var ROOT = Script.resolvePath('').split("generator.js")[0]; var hecatePortalModelUrl = ROOT + "hecate_portal4.fbx"; var hecateParkModelUrl = ROOT + "hecate_belvedere.fbx"; var hecateArrivalPlatformModelUrl = ROOT + "hecate_origine.fbx"; var hecateDeadEndModelUrl = ROOT + "deadend.fbx"; var hecateBuildingdModelUrl = ROOT + "hecate_Building_Wothal-B.fbx"; var hecateAirSoundUrl = ROOT + "air.mp3"; var airSound; var airSoundInjector = Uuid.NULL; var AIR_SOUND_VOLUME = 0.3; var hecateSkyUrl = ROOT + "sky.jpg"; var hecateMetalNormalUrl = ROOT + "metalNormal512c.jpg"; var imagePlaceHolderUrl = ROOT + "placeholder.jpg"; var particleBackUrl = ROOT + "particle.png"; var tpScriptUrl = ROOT + "teleporter.js?version=" + Math.floor(Math.random() * 65000); var backScriptUrl = ROOT + "back.js"; var installScriptUrl = ROOT + "install.js"; var installImageUrl = ROOT + "install.jpg"; var thisEntity = Uuid.NULL; var positionZero; var placeHistorySettingValue; var placeHistorySettingName = "3D_GOTO_PLACES_HISTORY"; var defaultPlaceHistorySettingValue = { "visitedPlacesHistory": [] }; var frequentPlaces = {}; var MIN_FREQUENCY_TO_BE_CONSIDERED = 3; var MAX_PLACE_HISTORY_ELEMENTS = 30; var STEP_HEIGHT = 0.2; var PARK_INTERVAL = 19; var PERSISTENCE_ORDERING_CYCLE = 5 * 24 * 3600 * 1000; //5 days var MAX_AGE_BEFORE_CONSIDER_OFFLINE = 600000; //10 minutes this.preload = function(entityID) { thisEntity = entityID; airSound = SoundCache.getSound(hecateAirSoundUrl); var properties = Entities.getEntityProperties(entityID, ["position"]); positionZero = properties.position; placeHistorySettingValue = Settings.getValue(placeHistorySettingName, defaultPlaceHistorySettingValue); frequentPlaces = getFrequentPlaces(placeHistorySettingValue.visitedPlacesHistory); getPlacesContent(placeApiUrl + "&acash=" + Math.floor(Math.random() * 999999)); if (airSound.downloaded) { playAirSound(); } else { airSound.ready.connect(onSoundReady); } }; function onSoundReady() { airSound.ready.disconnect(onSoundReady); playAirSound(); } function playAirSound() { airSoundInjector = Audio.playSound(airSound, { "loop": true, "localOnly": true, "volume": AIR_SOUND_VOLUME }); } function getPlacesContent(apiUrl) { placesHttpRequest = new XMLHttpRequest(); placesHttpRequest.requestComplete.connect(placesGetResponseStatus); placesHttpRequest.open("GET", apiUrl); placesHttpRequest.send(); } function placesGetResponseStatus() { if (placesHttpRequest.status === 200) { placesData = placesHttpRequest.responseText; try { placesData = JSON.parse(placesHttpRequest.responseText); } catch(e) { placesData = {}; } } placesHttpRequest.requestComplete.disconnect(placesGetResponseStatus); placesHttpRequest = null; processData(); //print("HECATE portal: " + JSON.stringify(portalList)); generatePortals(); } //Parse and sort the data function processData(){ //Get fundation data var isConnectedUser = AccountServices.isLoggedIn(); var supportedProtocole = Window.protocolSignature(); //Rules: //score = 120 + crowd //wrong protocole = discaded //domain offline = discarded //visibility != "open" and "connections" while connected: score - 2 ???need clarification ??? //visibility != "open" while NOT connected: score - 2 ???need clarification ??? //visibility != "open" while NOT connected: score - 2 ???need clarification ??? //No picture then score -4 //No description then score -3 //We add the 1st letter of the place name after teh score so it will secondary listed in alphabetic order. var places = placesData.data.places; for (var i = 0;i < places.length; i++) { var score = 99980; var category = ""; var accessStatus = "NOBODY"; var description = (places[i].description ? places[i].description : ""); var thumbnail = (places[i].thumbnail ? places[i].thumbnail : ""); score = score - places[i].current_attendance; if ( places[i].current_attendance > 0 ) { score = score - 20; } if ( places[i].domain.protocol_version === supportedProtocole ) { var age = getAgeFromDateString(places[i].domain.time_of_last_heartbeat); //print("AGE: " + age); //if ( places[i].domain.active ) { if ( age < MAX_AGE_BEFORE_CONSIDER_OFFLINE ) { //visibility rules would be here //visibility != "open" and "connections" while connected: score + 2 //visibility != "open" while NOT connected: score + 2 //visibility != "open" while NOT connected: score + 2 if ( thumbnail.substr(0, 4).toLocaleLowerCase() !== "http") { score = score + 4; } if (description === "") { score = score + 3; } if (thumbnail.substr(0, 4).toLocaleLowerCase() !== "http" && description === "") { category = "STONE"; } else { if ( thumbnail.substr(0, 4).toLocaleLowerCase() !== "http" && description !== ""){ category = "IRON"; } else { if (thumbnail.substr(0, 4).toLocaleLowerCase() === "http" && description === "") { category = "BRONZE"; } else { category = "SILVER"; } } } if (places[i].current_attendance > 0) { category = "GOLD"; if (places[i].domain.num_users >= places[i].domain.capacity && places[i].domain.capacity !== 0) { accessStatus = "FULL"; } else { accessStatus = "PEOPLE"; } } if (frequentPlaces[places[i].id] >= MIN_FREQUENCY_TO_BE_CONSIDERED) { score = MAX_PLACE_HISTORY_ELEMENTS - frequentPlaces[places[i].id]; category = "BLUESTEAL"; } var portal = { "order": zeroPad(score,5) + "_" + getSeededRandomForString(places[i].name), "category": category, "accessStatus": accessStatus, "name": places[i].name, "description": description, "thumbnail": thumbnail, "maturity": places[i].maturity, "address": places[i].address, "current_attendance": places[i].current_attendance, "id": places[i].id, "visibility": places[i].visibility, "capacity": places[i].domain.capacity, "managers": getListFromArray(places[i].managers) }; portalList.push(portal); } } } //Elect the promoted Silver place (RUBY class) var randomItem; var n = 0; while (n < 100) { randomItem = Math.floor(Math.random() * portalList.length); if (portalList[randomItem].category === "SILVER") { portalList[randomItem].category = "RUBY"; portalList[randomItem].order = "00001A_000"; break; } n++; } portalList.sort(sortOrder); } function getAgeFromDateString(dateString) { //print("TIME: " + dateString); var todayNow = new Date(); var now = todayNow.getTime(); //YYYY-MM-DDThh:mm:ss:nnn var year = parseInt(dateString.substr(0, 4),10); var month = parseInt(dateString.substr(5, 2),10) - 1; var day = parseInt(dateString.substr(8, 2),10); var hour = parseInt(dateString.substr(11, 2),10); var minute = parseInt(dateString.substr(14, 2),10); var second = parseInt(dateString.substr(17, 2),10); var millisecond = parseInt(dateString.substr(20, 3),10); //var fromTime = new Date(year, month, day, hour, minute, second, millisecond); var fromTime = Date.UTC(year, month, day, hour, minute, second, millisecond); //var from = fromTime.getTime(); //print("from: " + fromTime); //print("now: " + now); var age = now - fromTime; return age; } function getListFromArray(dataArray) { var dataList = ""; if (dataArray.length > 0) { for (var k = 0; k < dataArray.length; k++) { if (k !== 0) { dataList += ", "; } dataList += dataArray[k]; } if (dataArray.length > 1){ dataList += "."; } } return dataList; } function sortOrder(a, b) { var orderA = a.order.toUpperCase(); var orderB = b.order.toUpperCase(); if (orderA > orderB) { return 1; } else if (orderA < orderB) { return -1; } if (a.order > b.order) { return 1; } else if (a.order < b.order) { return -1; } return 0; } function zeroPad(num, places) { var zero = places - num.toString().length + 1; return Array(+(zero > 0 && zero)).join("0") + num; } //Generate the Portals function generatePortals() { var radius = 9; var espacement = 4.5; var angleRad = 0; var corridorFactor = 1.7; var coy = 0.0; var placeArea = 0; for (var i = 0;i < portalList.length; i++) { var numbrePossiblePerRing, cox, coz, relativePosition; if ((i%PARK_INTERVAL) === 0 && i !== 0) { placeArea++; numbrePossiblePerRing = (radius * 2 * Math.PI) / espacement; radius = radius + (espacement/numbrePossiblePerRing) * corridorFactor; angleRad = angleRad + ((2 * Math.PI)/numbrePossiblePerRing); cox = Math.cos(angleRad) * radius; coz = Math.sin(angleRad) * radius; relativePosition = {"x": cox, "y": coy, "z": coz }; var parkId = Entities.addEntity({ "type": "Model", "name": "PARK-" + i, "position": Vec3.sum(positionZero, relativePosition), "rotation": Quat.fromVec3Radians( {"x": 0.0, "y": -angleRad + Math.PI, "z": 0.0} ), "locked": true, "dimensions": { "x": 7.8822, "y": 501.1473, "z": 5.7883 }, "grab": { "grabbable": false }, "shapeType": "static-mesh", "script": ROOT + "areas/area_" + placeArea + ".js", "modelURL": hecateParkModelUrl, "useOriginalPivot": true }, "domain"); var areaTextId = Entities.addEntity({ "type": "Text", "parentID": parkId, "name": "AREA " + placeArea, "dimensions": { "x": 4, "y": 0.9, "z": 0.01 }, "localPosition": {"x": 0.7, "y": 0, "z": 0}, "localRotation": Quat.fromVec3Radians( {"x": -Math.PI/2, "y": Math.PI/2, "z": 0} ), "grab": { "grabbable": false }, "textColor": { "red": 255, "green": 200, "blue": 0 }, "text": "AREA " + placeArea, "lineHeight": 0.6, "backgroundAlpha": 0.0, "topMargin": 0.0, "unlit": false, "alignment": "center", "locked": true, "collisionless": true, "ignoreForCollisions": true }, "domain"); coy = coy - STEP_HEIGHT; } placeArea++; numbrePossiblePerRing = (radius * 2 * Math.PI) / espacement; radius = radius + (espacement/numbrePossiblePerRing) * corridorFactor; angleRad = angleRad + ((2 * Math.PI)/numbrePossiblePerRing); cox = Math.cos(angleRad) * radius; coz = Math.sin(angleRad) * radius; relativePosition = {"x": cox, "y": coy, "z": coz }; var portalId = Entities.addEntity({ "type": "Model", "name": "PORTAL - " + portalList[i].name, "position": Vec3.sum(positionZero, relativePosition), "rotation": Quat.fromVec3Radians( {"x": 0.0, "y": -angleRad + Math.PI, "z": 0.0} ), "locked": true, "dimensions": { "x": 8.0673, "y": 505.7698, "z": 5.7883 }, "grab": { "grabbable": false }, "shapeType": "static-mesh", "modelURL": hecatePortalModelUrl, "useOriginalPivot": true }, "domain"); coy = coy - STEP_HEIGHT; if (i == 0) { var platformId = Entities.addEntity({ "type": "Model", "name": "ARRIVAL", "locked": true, "dimensions": { "x": 6.3025, "y": 7.6355, "z": 4.9420 }, "rotation": Quat.fromVec3Radians( {"x": 0.0, "y": -angleRad, "z": 0.0} ), "position": positionZero, "grab": { "grabbable": false }, "shapeType": "static-mesh", "modelURL": hecateArrivalPlatformModelUrl, "useOriginalPivot": true },"domain"); //BACK if (location.canGoBack()) { var tpBackId = Entities.addEntity({ "type": "Box", "locked": true, "visible": false, "name": "PORTAL_BACK", "dimensions": { "x": 1.5, "y": 4, "z": 1.5 }, "rotation": Quat.fromVec3Radians( {"x": 0.0, "y": -angleRad, "z": 0.0} ), "position": Vec3.sum(positionZero, Vec3.multiplyQbyV(Quat.fromVec3Radians( {"x": 0.0, "y": -angleRad, "z": 0.0} ),{"x": -2.5, "y": 2.0, "z": 0.0})), "grab": { "grabbable": false }, "script": backScriptUrl, "shape": "Cube", "collisionless": true, "ignoreForCollisions": true },"domain"); var tpBackStopperId = Entities.addEntity({ "type": "Box", "locked": true, "visible": false, "name": "PORTAL_BACK_STOPPER", "dimensions": { "x": 0.5, "y": 4, "z": 1.5 }, "rotation": Quat.fromVec3Radians( {"x": 0.0, "y": -angleRad, "z": 0.0} ), "position": Vec3.sum(positionZero, Vec3.multiplyQbyV(Quat.fromVec3Radians( {"x": 0.0, "y": -angleRad, "z": 0.0} ),{"x": -2.8, "y": 2.0, "z": 0.0})), "grab": { "grabbable": false }, "shape": "Cube", },"domain"); var textBackId = Entities.addEntity({ "type": "Text", "locked": true, "name": "BACK_TEXT", "dimensions": { "x": 1, "y": 0.5, "z": 0.01 }, "rotation": Quat.fromVec3Radians( {"x": (-Math.PI/2), "y": (Math.PI/2) - angleRad, "z": 0.0} ), "position": Vec3.sum(positionZero, Vec3.multiplyQbyV(Quat.fromVec3Radians( {"x": 0.0, "y": -angleRad, "z": 0.0} ),{"x": -1.7, "y": 0.82, "z": 0.0})), "grab": { "grabbable": false }, "text": "BACK", "textColor": { "red": 0, "green": 128, "blue": 255 }, "lineHeight": 0.3, "backgroundAlpha": 0.0, "topMargin": 0.02, "rightMargin": 0.02, "leftMargin": 0.02, "bottomMargin": 0.02, "unlit": true, "textEffectThickness": 0.25, "alignment": "center", "collisionless": true, "ignoreForCollisions": true },"domain"); var backEffectId = Entities.addEntity({ "type": "ParticleEffect", "position": Vec3.sum(positionZero, Vec3.multiplyQbyV(Quat.fromVec3Radians( {"x": 0.0, "y": -angleRad, "z": 0.0} ),{"x": -2.5, "y": 2.0, "z": 0.0})), "locked": true, "name": "BACK_EFFECT", "dimensions": { "x": 3.75600004196167, "y": 3.75600004196167, "z": 3.75600004196167 }, "grab": { "grabbable": false }, "shapeType": "ellipsoid", "color": { "red": 0, "green": 119, "blue": 255 }, "alpha": 0.5, "textures": particleBackUrl, "maxParticles": 100, "lifespan": 4, "emitRate": 25, "emitSpeed": 0, "speedSpread": 0.11999999731779099, "emitOrientation": { "x": 0, "y": 0, "z": 0, "w": 1 }, "emitDimensions": { "x": 0.10000000149011612, "y": 0.10000000149011612, "z": 0.10000000149011612 }, "polarFinish": 3.1415927410125732, "emitAcceleration": { "x": 0, "y": 0, "z": 0 }, "particleRadius": 1.2000000476837158, "radiusSpread": 0.10000000149011612, "radiusStart": 0.20000000298023224, "radiusFinish": 1.2000000476837158, "colorStart": { "red": 219, "green": 236, "blue": 255 }, "colorFinish": { "red": 0, "green": 13, "blue": 255 }, "alphaSpread": 0.10000000149011612, "alphaStart": 0.800000011920929, "alphaFinish": null, "emitterShouldTrail": true, "spinSpread": 0.17000000178813934, "spinStart": -1.5700000524520874, "spinFinish": 1.5700000524520874 }, "domain"); } //Install var installed = isApplicationInstalled(); if (!installed) { var installerID = Entities.addEntity({ "type": "Image", "locked": false, "name": "INSTALL", "dimensions": { "x": 0.8, "y": 0.8, "z": 0.01 }, "rotation": Quat.fromVec3Radians( {"x": -Math.PI, "y": (Math.PI/16) - angleRad, "z": Math.PI} ), "position": Vec3.sum(positionZero, Vec3.multiplyQbyV(Quat.fromVec3Radians( {"x": 0.0, "y": -angleRad, "z": 0.0} ),{"x": 1.6, "y": 2.0, "z": 1.0})), "grab": { "grabbable": false }, "collisionless": true, "ignoreForCollisions": true, "script": installScriptUrl, "imageURL": installImageUrl, "emissive": true, "keepAspectRatio": false }, "domain"); } } //Material var metallic, roughness, albedo; switch(portalList[i].category) { case "GOLD": metallic = 1; roughness = 0.176; albedo = [ 1, 0.9372549019607843, 0.5411764705882353 ]; break; case "SILVER": metallic = 1; roughness = 0.176; albedo = [ 0.8627450980392157, 0.9215686274509803, 0.9254901960784314 ]; break; case "BRONZE": metallic = 1; roughness = 0.176; albedo = [ 0.9411764705882353, 0.6941176470588235, 0.5568627450980392 ]; break; case "IRON": metallic = 1; roughness = 0.176; albedo = [ 0.4117647058823529, 0.4235294117647059, 0.43137254901960786 ]; break; case "STONE": metallic = 0.104; roughness = 0.572; albedo = [ 0.32941176470588235, 0.2980392156862745, 0.2 ]; break; case "BLUESTEAL": metallic = 1; roughness = 0.15; albedo = [ 0.4745098039215686, 0.5725490196078431, 1 ]; break; case "RUBY": metallic = 1; roughness = 0.15; albedo = [ 1.0, 0.0, 0.0 ]; break; } var placeImage = imagePlaceHolderUrl; if (portalList[i].thumbnail !== "") { placeImage = portalList[i].thumbnail; } var tpColor = []; switch(portalList[i].accessStatus) { case "NOBODY": tpColor = [0.0, 0.6, 1.0 ]; tpColorBloom = [0.0, 1.116, 1.86]; break; case "PEOPLE": tpColor = [0.0, 1.0, 0.0]; tpColorBloom = [0.0, 1.86, 0.0]; break; case "FULL": tpColor = [1.0, 0.0, 0.0]; tpColorBloom = [1.86, 0.0, 0.0]; break; } //print("SCORE: " + portalList[i].order + " | CATEGORY: " + portalList[i].category); var materialDataWalls = { "materialVersion":1, "materials":[ { "name":"WALLS", "albedo": albedo, "metallic": metallic, "roughness": roughness, "normalMap": hecateMetalNormalUrl, "cullFaceMode":"CULL_BACK", "model":"hifi_pbr" } ] }; var materialDataImage = { "materialVersion":1, "materials":[ { "name":"IMAGE", "albedo":[ 1, 1, 1 ], "metallic":0.01, "roughness":0.07, "albedoMap": placeImage, "emissiveMap": placeImage, "cullFaceMode":"CULL_BACK", "model":"hifi_pbr" } ] }; var materialDataTp = { "materialVersion":1, "materials":[ { "name":"TP", "albedo":tpColor, "metallic":0.001, "roughness":0.509, "emissive": tpColorBloom, "cullFaceMode":"CULL_BACK", "model":"hifi_pbr" } ] }; var materialPortalWallsId = Entities.addEntity({ "type": "Material", "name": "PORTAL_WALLS_MATERIAL - " + portalList[i].name, "locked": true, "grab": { "grabbable": false }, "materialURL": "materialData", "priority": 1, "parentMaterialName": "[mat::WALLS]", "materialData": JSON.stringify(materialDataWalls), "parentID": portalId, "position": Vec3.sum(positionZero, {"x": cox, "y": 1.0, "z": coz}) },"domain"); var materialPortalImageId = Entities.addEntity({ "type": "Material", "name": "PORTAL_IMAGE_MATERIAL - " + portalList[i].name, "locked": true, "grab": { "grabbable": false }, "materialURL": "materialData", "priority": 1, "parentMaterialName": "[mat::IMAGE]", "materialData": JSON.stringify(materialDataImage), "parentID": portalId, "position": Vec3.sum(positionZero, {"x": cox, "y": 2.0, "z": coz}) },"domain"); var materialPortalTpId = Entities.addEntity({ "type": "Material", "name": "PORTAL_TP_MATERIAL - " + portalList[i].name, "locked": true, "grab": { "grabbable": false }, "materialURL": "materialData", "priority": 1, "parentMaterialName": "[mat::TP]", "materialData": JSON.stringify(materialDataTp), "parentID": portalId, "position": Vec3.sum(positionZero, {"x": cox, "y": 3.0, "z": coz}) },"domain"); //NAME text var textNamePortalId = Entities.addEntity({ "type": "Text", "parentID": portalId, "locked": true, "name": "PORTAL_NAME_TEXT - " + portalList[i].name, "dimensions": { "x": 2.4119091033935547, "y": 0.2888250946998596, "z": 0.009999999776482582 }, "localRotation": { "x": 0, "y": 0.7071067690849304, "z": 0, "w": 0.7071067690849304 }, "localPosition": { "x": 1.28, "y": 3.0775, "z": 0 }, "grab": { "grabbable": false }, "text": portalList[i].name.toUpperCase(), "lineHeight": 0.17000000178813934, "backgroundAlpha": 0.7, "topMargin": 0.05999999865889549, "unlit": true, "textEffectThickness": 0.23999999463558197, "alignment": "center" },"domain"); //Description text var descriptionText = portalList[i].description; //By: author name would be added here descriptionText = descriptionText + "\n\nManaged by: " + portalList[i].managers; descriptionText = descriptionText + "\n\nUsers: " + portalList[i].current_attendance; if (portalList[i].accessStatus === "FULL") { descriptionText = descriptionText + " (FULL)"; } //Capacity: portalList[i].capacity would be here. if (portalList[i].capacity == 0) { descriptionText = descriptionText + "\nCapacity: " + "Unlimited"; } else { descriptionText = descriptionText + "\nCapacity: " + portalList[i].capacity; } descriptionText = descriptionText + "\n\nMaturity: " + portalList[i].maturity.toUpperCase(); if ( portalList[i].category === "RUBY" ) { descriptionText = "*** FEATURED ***\n\n" + descriptionText; } if ( portalList[i].category === "BLUESTEAL" ) { descriptionText = "* FREQUENTLY VISITED *\n\n" + descriptionText; } var textDescPortalId = Entities.addEntity({ "type": "Text", "parentID": portalId, "locked": true, "name": "PORTAL_DESC_TEXT - " + portalList[i].name, "dimensions": { "x": 0.9366, "y": 1.8317, "z": 0.01 }, "localRotation": { "x": 0, "y": 0.7071067690849304, "z": 0, "w": 0.7071067690849304 }, "localPosition": { "x": 1.26, "y": 1.8763, "z": -0.7431 }, "grab": { "grabbable": false }, "text": descriptionText, "lineHeight": 0.08, "backgroundAlpha": 0.7, "topMargin": 0.02, "rightMargin": 0.02, "leftMargin": 0.02, "bottomMargin": 0.02, "unlit": true, "textEffectThickness": 0.25, "alignment": "left" },"domain"); if (portalList[i].current_attendance > 0) { var textNbrUserPortalId = Entities.addEntity({ "type": "Text", "parentID": portalId, "locked": true, "name": "PORTAL_NBR_USERS_TEXT - " + portalList[i].name, "dimensions": { "x": 1.8, "y": 1, "z": 0.01 }, "localRotation": { "x": 0, "y": 0.7071067690849304, "z": 0, "w": 0.7071067690849304 }, "localPosition": { "x": 0.693, "y": 1.5, "z": 0.4587 }, "grab": { "grabbable": false }, "text": portalList[i].current_attendance, "textAlpha": 0.3, "lineHeight": 0.6, "backgroundAlpha": 0.0, "topMargin": 0.02, "rightMargin": 0.02, "leftMargin": 0.02, "bottomMargin": 0.02, "unlit": true, "textEffectThickness": 0.25, "collisionless": true, "ignoreForCollisions": true, "alignment": "center" },"domain"); } //TP var tpData = { "placeID": portalList[i].id, "address": portalList[i].address }; var tpPortalId = Entities.addEntity({ "type": "Box", "parentID": portalId, "locked": true, "visible": false, "name": "PORTAL_TPBOX - " + portalList[i].name, "dimensions": { "x": 3, "y": 4, "z": 2 }, "localRotation": { "x": 0, "y": 0.7071067690849304, "z": 0, "w": 0.7071067690849304 }, "localPosition": { "x": 0.0, "y": 2.0, "z": 0.0 }, "grab": { "grabbable": false }, "script": tpScriptUrl, "userData": JSON.stringify(tpData), "shape": "Cube", "collisionless": true, "ignoreForCollisions": true },"domain"); if (i === (portalList.length - 1)) { var deadEndId = Entities.addEntity({ "type": "Model", "name": "DEADEND", "position": Vec3.sum(positionZero, relativePosition), "rotation": Quat.fromVec3Radians( {"x": 0.0, "y": -angleRad + Math.PI, "z": 0.0} ), "locked": true, "dimensions": { "x": 2.9488, "y": 1.2709, "z": 0.1825 }, "grab": { "grabbable": false }, "shapeType": "static-mesh", "modelURL": hecateDeadEndModelUrl, "useOriginalPivot": true }, "domain"); } } var d = new Date(); var n = d.getTime(); var sunOrientation = (n % 68400000) * 2 * Math.PI; var skyZoneId = Entities.addEntity({ "type": "Zone", "name": "SKY", "locked": true, "dimensions": { "x": 10000, "y": 2000, "z": 10000 }, "grab": { "grabbable": false }, "shapeType": "box", "keyLight": { "color": { "red": 255, "green": 244, "blue": 199 }, "intensity": 3, "direction": { "x": 0.0013233129866421223, "y": -0.5563610196113586, "z": -0.8309397101402283 }, "castShadows": true, "shadowBias": 0.02, "shadowMaxDistance": 60 }, "ambientLight": { "ambientIntensity": 0.6, "ambientURL": hecateSkyUrl }, "skybox": { "color": { "red": 255, "green": 255, "blue": 255 }, "url": hecateSkyUrl }, "haze": { "hazeRange": 1000, "hazeColor": { "red": 227, "green": 187, "blue": 138 }, "hazeGlareColor": { "red": 255, "green": 202, "blue": 87 }, "hazeEnableGlare": true, "hazeGlareAngle": 30, "hazeAltitudeEffect": true, "hazeCeiling": -30, "hazeBaseRef": -250 }, "bloom": { "bloomIntensity": 0.5 }, "keyLightMode": "enabled", "ambientLightMode": "enabled", "skyboxMode": "enabled", "hazeMode": "enabled", "bloomMode": "enabled", "position": positionZero, "rotation": Quat.fromVec3Radians( {"x": 0.0, "y": sunOrientation, "z": 0.0} ) }, "domain"); //Buildings var nbrBuidling = Math.floor(Math.random() * 17) + 3; for (i=0; i < nbrBuidling; i++) { var buildingRotation = Quat.fromVec3Radians( {"x": 0.0, "y": (Math.random() * 2 * Math.PI), "z": 0.0} ); var distance = Math.floor(Math.random() * 8000) + 600; var directionRad = Math.random() * 2 * Math.PI; var relativeBuidlingPosition = {"x": distance * Math.cos(directionRad), "y": (Math.floor(Math.random() * 600) - 350), "z": distance * Math.sin(directionRad)}; var buildingPosition = Vec3.sum(positionZero, relativeBuidlingPosition); var buildingId = Entities.addEntity({ "type": "Model", "locked": true, "name": "BUIDING-" + i, "dimensions": { "x": 328.3628845214844, "y": 1978.876220703125, "z": 313.246826171875 }, "grab": { "grabbable": false }, "shapeType": "static-mesh", "modelURL": hecateBuildingdModelUrl, "position": buildingPosition, "rotation": buildingRotation, "useOriginalPivot": true }, "domain"); } } function getFrequentPlaces(list) { var count = {}; list.forEach(function(list) { count[list] = (count[list] || 0) + 1; }); return count; } //####### seed random library ################ Math.seed = 75; Math.seededRandom = function(max, min) { max = max || 1; min = min || 0; Math.seed = (Math.seed * 9301 + 49297) % 233280; var rnd = Math.seed / 233280; return min + rnd * (max - min); } function getSringScore(str) { var score = 0; for (var j = 0; j < str.length; j++){ score += str.charAt(j).charCodeAt(0) - ('a').charCodeAt(0) + 1; } return score; } function getSeededRandomForString(str) { var score = getSringScore(str); var d = new Date(); var n = d.getTime(); var currentSeed = Math.floor(n / PERSISTENCE_ORDERING_CYCLE); Math.seed = score * currentSeed; return zeroPad(Math.floor(Math.seededRandom() * 1000),3); } //####### END of seed random library ################ function isApplicationInstalled() { var running = false; var currentlyRunningScripts = JSON.stringify(ScriptDiscoveryService.getRunning()); if (currentlyRunningScripts.indexOf("app_hecate.js") >= 0) { running = true; } return running; } this.unload = function(entityID) { if (airSoundInjector !== Uuid.NULL) { airSoundInjector.stop(); } }; })
"use strict"; // Create a string of random alphanumeric characters, of a given length let createRandomString = function (strLength) { strLength = typeof strLength == "number" && strLength > 0 ? strLength : false; if (strLength) { // Define all the possible characters that could go into a string const possibleCharacters = "abcdefghijklmnopqrstuvwxyz0123456789"; // Start the final string let str = ""; for ( let i = 1; i <= strLength; i++) { // Get a random charactert from the possibleCharacters string let randomCharacter = possibleCharacters.charAt( Math.floor(Math.random() * possibleCharacters.length) ); // Append this character to the string str += randomCharacter; } // Return the final string return str; } else { throw new Error({ Error: 'String Length is not a number', }) } }; module.exports = createRandomString;
import Vue from 'vue' //引入vue包 import Vuex from 'vuex' import * as actions from './actions' //获取里面所有的方法名 import * as getters from './getters' //获取里面所有的方法名 import state from './state' import mutations from './mutations' import createLogger from 'vuex/dist/logger' //修改日志,方便观察 Vue.use(Vuex) //严格模式,检测state数据修改是否来自mutation,其它修改就会警告 const debug = process.env.NODE_EVN !== 'production' export default new Vuex.Store({ //创建存放的仓库 actions, getters, state, mutations, strict:debug, plugins:debug ? [createLogger()] : [] })
import React, { useEffect, useState } from 'react' import CourseCard from '../CourseCard/CourseCard' import Carousel from './Subject-carousel' import { useDispatch, useSelector } from 'react-redux' import { loadAllCourses } from '../../store/courses/thunks' import { getAllCourses } from '../../store/courses/selectors' import RegistrationModal from '../Form/Registration' import LoginModal from '../Form/Login' import { getIsAuth } from '../../store/auth/selectors' import { useTranslation } from 'next-i18next' const CoursePage = () => { const { t } = useTranslation('programs') const [loginModalShow, setLoginModalShow] = useState(false) const [registrationModalShow, setRegistrationModalShow] = useState(false) const isAuth = useSelector(getIsAuth) const switchModals = () => { setLoginModalShow((prev) => !prev) setRegistrationModalShow((prev) => !prev) } const dispatch = useDispatch() const courses = useSelector(getAllCourses) useEffect(() => { dispatch(loadAllCourses(1, '')) }, []) const coursesBlock = courses.map((course, index) => { const countBlock = index % 3 === 0 ? 8 : 4 return ( <div className={`col-12 col-md-${countBlock}`} key={course._id}> <CourseCard course={course}/> </div> ) }) return ( <div> <div className="container my-3"> <div style={{ backgroundColor: '#f0c4d7', borderRadius: '8px' }}> <div className="row"> <div className="col-12 col-md-6 col-lg-8 m-auto"> <img className="content-image" src="/3.png" alt="photo"/> </div> <div className="col-12 col-md-6 col-lg-4 p-5 m-auto"> <h3 className="content-title mb-2">{t('title')}</h3> <p className="content-text">{t('subtitle')}</p> </div> </div> <div className="container" style={{ paddingBottom: '15px' }}> <section className="search-form"> <form action="" method="GET" name="search" role="search" className="border-form"> <p className="inp-wrap cat-wrap" style={{ borderRight: '1px solid rgba(51,51,51,0.3)' }}> <select name="search categories" id="categories" className="search-input"> <option value="category" defaultValue>{t('category')}</option> <option value="newyork">{t('math')}</option> <option value="chicago">{t('science')}</option> <option value="losangeles">{t('it')}</option> <option value="seattle">{t('geography')}</option> <option value="dallas">{t('art')}</option> <option value="boston">{t('english')}</option> <option value="sanfran">{t('history')}</option> </select> <i className="fas fa-caret-down"/> </p> <p className="inp-wrap search-wrap"> <input type="search" name="search-term" id="search-field" className="search-input" placeholder={t('example')} /></p> <p className="inp-wrap submit-wrap"> <button className="search-btn"> <i className="fas fa-search grid-100"/> </button> </p> </form> </section> </div> </div> </div> <div className="container my-5"> <h2 className="category-picker py-3">{t('popular')}</h2> <div className="row"> {coursesBlock} </div> </div> <div className="container my-5"> <h2 className="category-picker py-3">{t('subjects')}</h2> <Carousel/> </div> <div className="container my-5"> <h2 className="category-picker py-3">{t('themes')}</h2> <div className="row"> <div className="col-6 col-md-4"> <div className="carousel-card my-3" style={{ backgroundColor: '#B2CCFC' }}> <h3 className="carousel-title" style={{ color: '#466aa8' }}>Math</h3> <p className="carousel-subtitle" style={{ color: '#466aa8' }}>12 courses</p> </div> </div> <div className="col-6 col-md-4"> <div className="carousel-card my-3" style={{ backgroundColor: '#B2CCFC' }}> <h3 className="carousel-title" style={{ color: '#466aa8' }}>Math</h3> <p className="carousel-subtitle" style={{ color: '#466aa8' }}>12 courses</p> </div> </div> </div> </div> <div> {isAuth ? (<div/>) : ( <div className="container my-5"> <h2 className="category-picker py-3">{t('ownCourse')}</h2> <div style={{ backgroundColor: '#B2CCFC', borderRadius: '8px' }}> <div className="row"> <div className="col-12 col-md-3 m-auto"> <img className="content-image" src="/14.png" alt="photo"/> </div> <div className="col-12 col-md-9 p-5 m-auto"> <h3 className="content-title mb-2">{t('createAcc')}</h3> <p className="content-text">{t('newInfo')}</p> <button className="content-btn" onClick={() => setRegistrationModalShow(true)}>{t('start')}</button> </div> </div> </div> </div> )} </div> <RegistrationModal show={registrationModalShow} switchModals={() => switchModals()} onHide={() => setRegistrationModalShow(false)} /> <LoginModal show={loginModalShow} switchModals={() => switchModals()} onHide={() => setLoginModalShow(false)} /> </div> ) } export default CoursePage
// take a slice of the application state and return some data based on that import { useSelector } from 'react-redux'; export const useSitesData = () => { return useSelector((state) => state.siteRegistry.sites); }; export const useSitesArrayData = () => { return useSelector((state) => Object.values(state.siteRegistry.sites)); }; export const useSiteOptionsData = () => { return useSelector((state) => Object.values(state.siteRegistry.siteOptions)); }; export const useSitesSummaryData = () => { return useSelector((state) => Object.values(state.siteRegistry.sitesSummary)); }; export const useSiteDetailsData = () => { return useSelector((state) => state.siteRegistry.siteDetails); };
const express = require('express'); const path = require('path'); const logger = require('morgan'); const session = require('express-session'); const MongoStore = require('connect-mongo'); const cors = require('cors'); const createError = require('http-errors'); require('dotenv').config(); const authRouter = require('./routes/auth'); const restaurantsRouter = require('./routes/restaurants'); const menusRouter = require('./routes/menus'); const sectionsRouter = require('./routes/sections'); const itemsRouter = require('./routes/items'); const reactionsRouter = require('./routes/reactions'); async function setupApp() { const app = express(); app.use( cors({ credentials: true, origin: [process.env.FRONTEND_DOMAIN], }) ); app.use(logger('dev')); app.use(express.json()); app.use(express.urlencoded({ extended: false })); app.use(express.static(path.join(__dirname, 'public'))); app.set('trust proxy', 1); app.use( session({ store: MongoStore.create({ mongoUrl: process.env.MONGODB_URI, ttl: 24 * 60 * 60, }), secret: process.env.SECRET_SESSION, // should be inside .env resave: true, saveUninitialized: true, cookie: { maxAge: 24 * 60 * 60 * 1000, // httpOnly: process.env.COOKIES_HTTPONLY, // path: process.env.COOKIES_PATH, // sameSite: process.env.COOKIES_SAMESITE, // secure: process.env.COOKIES_SECURE, sameSite: process.env.COOKIES_SAMESITE === 'true' ? 'lax' : 'none', // secure: process.env.COOKIES_SAMESITE !== 'true', }, }) ); app.use('/', authRouter); app.use('/restaurants', restaurantsRouter); app.use('/menus', menusRouter); app.use('/sections', sectionsRouter); app.use('/items', itemsRouter); app.use('/reactions', reactionsRouter); // catch 404 and forward to error handler app.use((req, res, next) => { next(createError(404)); }); // eslint-disable-next-line no-unused-vars app.use((error, req, res, next) => { // eslint-disable-next-line no-console const rawStatus = error.status ?? error.statusCode; const status = typeof rawStatus === 'number' && rawStatus >= 400 && rawStatus < 600 ? rawStatus : undefined; const rawName = error.name; const name = typeof rawName === 'string' && status !== undefined ? rawName : undefined; const rawMessage = error.message; const message = typeof rawMessage === 'string' ? rawMessage : ''; const responseError = { status: status ?? 500, name: name ?? 'InternalServerError', message, }; res.locals.responseError = responseError; res.status(responseError.status).json({ error: responseError }); }); return app; } module.exports = setupApp;
class Game { //add 'socket' as one of the parameters constructor(socket) { this.board = []; this.color = ''; this.moves = 0; this.winner = ''; this.gameOver = false this.playerId = '' this.socket = socket this.roomId = '' } startNewGame(){ const data = {'roomID' : this.roomId, 'playerId' : this.playerId} this.socket.emit('leaveGame', data) } getMoves(){ return this.moves; } tileClickHandler(e) { console.log(e.target.id) //Get row from tile id let row; if(e.target.id.split('_')[1][1] != undefined){ row = e.target.id.split('_')[1][0] + e.target.id.split('_')[1][1]; }else { row = e.target.id.split('_')[1][0]; } //Get column from tile id let col; if(e.target.id.split('_')[2][1] != undefined){ col = e.target.id.split('_')[2][0] + e.target.id.split('_')[2][1]; }else{ col = e.target.id.split('_')[2][0]; } console.log(row) console.log(col) const coordinates = '(' + row.toString() + ',' + col.toString() + ')' this.updateBoard(this.getColor(), row, col, e.target.id); } //Create the Game board and attach click event to tiles createGameBoard() { //First load the board this.createTiles(); //Then either create/join a game on the server side or load var that = this; that.socket.on('addNewPlayer', function(data) { console.log(data); if (data['code'] === '201'){ that.color = data['color'] that.moves = data['moves'] document.getElementById("turn-num").innerText = that.moves; $('#color').css("background-color", `${that.color}`); document.cookie = 'userid:' + data['id'] + '___' + 'roomid:' + data['room'] that.playerId = data['id'] that.roomId = data['room'] if (data['color'] == 'black'){ that.loadPieces(data['gameBoard']) } } else{ alert('game is full!') } }); that.socket.on('loadPlayer', function(data){ console.log(data) that.color = data['color'] that.moves = data['moves'] document.getElementById("turn-num").innerText = that.moves; $('#color').css("background-color", `${that.color}`); that.playerId = data['id'] that.roomId = data['room'] that.loadPieces(data['gameBoard']) }); this.socket.on('message', function(data) { console.log('Received message'); //Don't play anymore if winner if (that.gameOver){ return } $(".center").prop(`disabled`, true); if(color !== that.getColor()){ $(".center").prop(`disabled`, false); } //Make move for the player //$('#color').css("background-color", `${this.getColor()}`); const move_row = data['your_row'] const move_col = data['your_col'] const move_id = 'button_' + move_row.toString() + '_' + move_col.toString() const move_color = data['color'] $(`#${move_id}`).css("backgroundImage", `url(images/${move_color}Piece.png)`).prop('disabled', true); that.board[move_row][move_col] = move_color[0]; that.moves++; document.getElementById("turn-num").innerText = that.moves; that.handleWin(data['gameover'] ,data['winner']) }); this.socket.on('errorMove', function(data) { alert(data['error']) }); that.socket.on('leaveGame', function(data) { document.cookie = '' if (data['playerId'] === that.playerId){ location.reload() } else{ alert("The other player has left, will refresh in 2 seconds") setTimeout(function () { location.reload() }, 2000) } }); } loadPieces(board){ console.log(board) var that = this $('.center').children('button').each(function () { console.log('hi') let elemIdArr = (this.id).toString().split('_') const row = parseInt(elemIdArr[1]) const col = parseInt(elemIdArr[2]) console.log(row) console.log(col) let color; if (board[row][col] === 'white'){ color = 'white' $(`#${this.id}`).css("backgroundImage", `url(images/${color}Piece.png)`).prop('disabled', true); that.board[row][col] = color[0]; } else if (board[row][col] === 'black'){ color = 'black' $(`#${this.id}`).css("backgroundImage", `url(images/${color}Piece.png)`).prop('disabled', true); that.board[row][col] = color[0]; } }); } //Create tiles for game board createTiles(){ //if cookie, load game, else create new game if ((document.cookie).includes("userid:") && (document.cookie).includes("roomid")){ const playerid = (document.cookie).split('___')[0].split('userid:')[1] const roomid = (document.cookie).split('___')[1].split('roomid:')[1] this.socket.emit('loadPlayer', {'room': roomid, 'player': playerid}) } else{ this.socket.emit('addNewPlayer', {}) } //Create tiles in the DOM for (let i = 0; i < 19; i++) { for (let j = 0; j < 18; j++) { $('.center').append(`<button class="tile" id="button_${i}_${j}"></button>`) } $('.center').append(`<button class="tile" id="button_${i}_18" style="float:none;"/>`); } //Attach click listener to tiles for (let i = 0; i < 19; i++) { this.board.push(['']); for (let j = 0; j < 19; j++) { $(`#button_${i}_${j}`).on('click', this.tileClickHandler.bind(this)); } } //Attach the event listener to the new game button $('#new_game').on('click', this.startNewGame.bind(this)); } //get current player getColor(){ return this.color } //get AI color getOppositeColor(){ if (this.color = 'white') { return 'black' } else{ return 'white' } } //Update board updateBoard(color, row, col) { //make a request to update the board var that = this console.log("COLOR") console.log(this.color) const id = this.playerId const data = {"x" : row.toString(), "y" : col.toString(), "id" : id, 'color' : color, 'roomID' : that.roomId} this.socket.send(data) } handleWin(game_is_over, gameWinner){ if (!game_is_over){ return } else if (game_is_over && gameWinner === ''){ alert('Tie!') this.gameOver = true document.cookie = '' } else { let winner = document.getElementById('winner') $('#color').css("margin-bottom", "5px"); winner.style.display = 'block' winner.style.fontSize = '20px' winner.style.marginBottom = '1em' winner.innerText = 'Winner: ' + gameWinner.toUpperCase() this.gameOver = true document.cookie = '' } } } export default Game
var bcrypt = require('bcryptjs'); var user = require('../models/user'); var jwt = require('jsonwebtoken'); const tokenKey = 'pwd123!'; const viewLogin = (req, res) => { res.render('login'); } const apiLogin = (req, res) => { if(req.body.email !== undefined && req.body.email.length > 0 && req.body.password !== undefined && req.body.password.length > 0 ) { user.getByEmail(req.body.email) .then(data => { if(bcrypt.compareSync(req.body.password, data.password)) { let token = jwt.sign({ email: data.email }, tokenKey); res.cookie('jwt', token); res.redirect('/dashboard'); } else { res.redirect('/?err=1') } }) .catch(err => { res.redirect('/?err=2'); }); } else { res.redirect('/?err=3'); } } const viewRegister = (req, res) => { res.render('register'); } const apiRegister = (req, res) => { if(req.body.first_name !== undefined && req.body.first_name.length > 0 && req.body.last_name !== undefined && req.body.last_name.length > 0 && req.body.email !== undefined && req.body.email.length > 0 && req.body.password !== undefined && req.body.password.length > 0 && req.body.password2 !== undefined && req.body.password2.length > 0 && req.body.password2 === req.body.password ){ let hash = bcrypt.hashSync( req.body.password, bcrypt.genSaltSync(10) ); user.createNew({ first_name: req.body.first_name, last_name: req.body.last_name, email: req.body.email, password: hash }) .then(() => { res.redirect('/'); }) .catch(err => { console.log(err); res.redirect('/register?err=1') }); } else { res.redirect('/register?err=2'); } } const apiLogout = (req, res) => { res.clearCookie('jwt'); res.redirect('/'); } module.exports = { viewLogin, apiLogin, viewRegister, apiRegister, tokenKey, apiLogout };
import React from "react"; import { Text, View, Image, TouchableOpacity, TouchableHighlight, Dimensions, StatusBar } from "react-native"; import { Camera, Permissions, Asset } from "expo"; import Colors from "../constants/Colors"; import {uploadPicture, uploadData} from '../utils/firebaseUtil'; import Loading from '../components/LoadingModal'; const { width, height } = Dimensions.get("window"); import { checkForLabels } from './ocr' export default class CameraExample extends React.Component { state = { hasCameraPermission: null, type: Camera.Constants.Type.back, taken: false, uri: null, loading: false, jsonInput: null, dict: [], }; async componentWillMount() { const { status } = await Permissions.askAsync(Permissions.CAMERA); this.setState({ hasCameraPermission: status === "granted" }); } takePicture = async () => { console.log("taking picture"); if (this.camera) { const options = { quality: 0, base64: true }; this.camera.takePictureAsync(options).then(({ uri, base64 }) => { // console.log(data); // this.setState({ uri, base64, taken: true }); this.setState({ uri: uri, base64, taken: true }); console.log(uri); console.log("uri loaded"); }); } }; // foo(input){ // console.log(input); // } async upload() { this.setState({loading: true}) const options = { format: 'jpeg', quality: 0, result: 'base64', height: 534, width: 300 } Expo.takeSnapshotAsync(this.image, options).then((data) => { if(this.state.base64){ console.log("shivansh!!"); } //console.log(data); uploadPicture(this.state.base64).then(() => { console.log("Dict is printing"); console.log(this.state.dict); this.setState({loading: true}); }); }) checkForLabels(this.state.base64) .then((responseJson) => { console.log("Flag2"); //console.log(JSON.stringify(responseJson)); this.setState({jsonInput: JSON.stringify(responseJson)}); console.log(this.state.jsonInput); let s = JSON.parse(this.state.jsonInput); let str = JSON.stringify(s.responses[0].textAnnotations[0].description); console.log(s.responses[0].textAnnotations[0].description); //let res = str.split("\n"); let res1 = s.responses[0].textAnnotations[0].description.split("\n"); //console.log(res); console.log(res1); var dictionary = { BloodTest: (Number(res1[3])), CTscan: (Number(res1[4])), Surgery: (Number(res1[5])) }; this.setState({dict: dictionary}); uploadData(JSON.stringify(this.state.dict)).then(() => { console.log("Dict is printing"); console.log(this.state.dict); this.setState({loading: false}) this.props.navigation.goBack(); }); }); // let base_image = this.state.base64; // let result = async (base_image) => { // try{ // console.log("Flag1"); // let aa = await checkForLabels(this.state.base64); // console.log(aa); // console.log("Flag2"); // }catch(error){ // console.log(error); // } // } //console.log(this.state.jsonInput); // let result = await checkForLabels(this.state.base64); // console.log(result); // uploadPicture(data).then(() => { // this.setState({loading: false}) // this.props.navigation.goBack(); // }); } renderCamera() { return ( <Camera ref={ref => { this.camera = ref; }} style={{ flex: 1 }} style={{ flex: 1 }} type={this.state.type} autoFocus={"on"} > <Image style={{ position: "absolute", top: 40, left: 0, width, height }} source={require("../assets/images/bill.png")} /> <View style={{ flex: 1, justifyContent: "flex-start", alignItems: "center" }} > <TouchableHighlight onPress={() => this.takePicture()}> <Image style={{ width: 48, height: 48, marginBottom: 24 }} source={require("../assets/images/icons8-camera.png")} /> </TouchableHighlight> </View> </Camera> ); } renderImage() { const { uri } = this.state; return ( <View style={{ flex: 1 }}> <Image ref={ref => this.image = ref} style={{ flex: 1, paddingTop: 24 }} source={{ uri }} /> <View style={{ flexDirection: "row", justifyContent: "space-between", alignItems: "center", padding: 8, height: 48, backgroundColor: "white" }} > <TouchableOpacity hitSlop={{ top: 8, right: 8, left: 8, bottom: 8 }} onPress={() => this.setState({ taken: false, uri: "" })} > <Text style={{ fontSize: 18, color: Colors.main }}>Retake</Text> </TouchableOpacity> <TouchableOpacity hitSlop={{ top: 8, right: 8, left: 8, bottom: 8 }} onPress={() => this.upload()} > <Text style={{ fontSize: 18, color: Colors.textBlack }}> Submit </Text> </TouchableOpacity> </View> </View> ); } render() { const { hasCameraPermission, taken, loading } = this.state; if (hasCameraPermission === null) { return <View />; } else if (hasCameraPermission === false) { this.props.navigation.goBack(); } else { return ( <View style={{ flex: 1 }}> <StatusBar barStyle="light-content" animated={true} /> {taken ? this.renderImage() : this.renderCamera()} <Loading visible={loading} text={'Uploading Document'}/> </View> ); } } }
import React from 'react'; import { Link } from 'react-router-dom'; import { useLocalization } from '~/common/components/localization'; const wrapperStyle = { minHeight: '100vh', }; const NotFound = () => { const dictionary = useLocalization(); return ( <div className="bg-dark h-100 p-3 text-light" style={wrapperStyle}> <h5 className="text-center mb-4">{dictionary.get('something-went-wrong')}</h5> <h5 className="text-center mb-5"> <Link to="/">{dictionary.get('back')}</Link> </h5> </div> ); }; export default NotFound;
import supertest from 'supertest' import { PasswordData, User } from '../../db/models' import { createAccessToken } from '../../src/utils/tokenHelper' import { encodeUserId } from '../../src/utils/userHelper' let user const req = supertest(`http://localhost:1616`) // define request header const header = { 'Content-Type': 'application/json' } const falseHeader = { 'Content-Type': 'application/json' } describe('password-controller', () => { beforeAll(async () => { user = await User.create({ name: 'test-user', password: 'test-password' }) // define password data await PasswordData.create({ userId: user.id, accountName: 'account1', username: 'test1', password: 'password1' }) await PasswordData.create({ userId: user.id, accountName: 'account2', username: 'test2', password: 'password2' }) // complete header definition const accessToken1 = await createAccessToken({userId: encodeUserId(user.id)}) const accessToken2 = await createAccessToken({userId: encodeUserId(user.id + 1)}) header.authorization = 'Bearer ' + accessToken1 falseHeader.authorization = 'Bearer ' + accessToken2 }) afterAll(async () => { await User.destroy({where:{}}) await PasswordData.destroy({where:{}}) }) it('should return error due to user not found', async() => { const res = await req .get('/password/list') .set(falseHeader) // check status expect(res.status).toBe(400) // check response expect(res.body).toEqual({ error: true, message: 'User not found.' }) }) it('successfully get list account', async() => { const res = await req .get('/password/list') .set(header) // check status expect(res.status).toBe(200) // check response expect(res.body).toEqual({ error: false, data: ['account1', 'account2'] }) }) it('get detail data should return error because account name not found', async() => { const payload = { account: 'account999' } const res = await req .post('/password/detail') .set(header) .send(payload) // check status expect(res.status).toBe(400) // check response expect(res.body).toEqual({ error: true, message: 'Data not found.' }) }) it('successfully get detail password data', async() => { const payload = { account: 'account1' } const res = await req .post('/password/detail') .set(header) .send(payload) // check status expect(res.status).toBe(200) // check response expect(res.body).toEqual({ error: false, data: { accountName: 'account1', username: 'test1', password: 'password1' } }) }) it('successfully add new password data', async() => { const payload = { account: 'account3', username: 'test3', password: 'password3' } const res = await req .post('/password/add') .set(header) .send(payload) // check status expect(res.status).toBe(200) // check response expect(res.body).toEqual({ error: false, data: { accountName: 'account3' } }) }) it('edit data should return error because account name not found', async() => { const payload = { account: 'account999' } const res = await req .patch('/password/edit') .set(header) .send(payload) // check status expect(res.status).toBe(400) // check response expect(res.body).toEqual({ error: true, message: 'Data not found.' }) }) it('successfully edit password data', async() => { const payload = { account: 'account3', new_account: 'account4', username: 'test4', password: 'password4' } const res = await req .patch('/password/edit') .set(header) .send(payload) // check status expect(res.status).toBe(200) // check response expect(res.body).toEqual({ error: false, data: 'Data successfully updated.' }) }) it('delete data should return error because account name not found', async() => { const res = await req .delete('/password/delete/account999') .set(header) // check status expect(res.status).toBe(400) // check response expect(res.body).toEqual({ error: true, message: 'Data not found.' }) }) it('successfully delete password data', async() => { const res = await req .delete('/password/delete/account1') .set(header) // check status expect(res.status).toBe(200) // check response expect(res.body).toEqual({ error: false, data: 'Data successfully deleted.' }) }) })
// Explore Collection // ============== // Includes file dependencies define([ "firebase", "backbonefirebase", "jquery", "backbone", "auth", "debug", // Models '../../models/explore/ExploreModel' ], function( Firebase, BackboneFirebase, $, Backbone, Auth, Debug, // Models ExploreModel ) { // The Collection constructor var ExploreCollection = Backbone.Collection.extend( { model: ExploreModel, // Must be set dynamically before a fetch //url: 'http://api.seatgeek.com/2/', initialize: function () { Debug.log('Collection - Explore Collection - Init!!!!'); }, // The SeatGeek Search API returns tweets under "performers". parse: function(response) { console.log(response.performers); return response.performers; } }); // Returns the Model class return ExploreCollection; } );
let barWidth = $('#sideSec').innerWidth(); let homeWidth = $('.sec-1').innerWidth(); $('#closeIcon').click(function () { $('#sideSec').animate({ 'left': - barWidth }, 1000); $('#openIcon').animate({ 'left': 0 }, 1000); $('.caption').animate({ 'margin-left': 0 }, 1000); }) $('#openIcon').click(function () { $('#sideSec').animate({ 'left': 0 }, 1000); $('#openIcon').animate({ 'left': barWidth }, 1000); $('.caption').animate({ 'margin-left': barWidth }, 1000); }) $('#singer1').click(function () { $('#about1').slideToggle(500); $('#about2').slideUp(500); $('#about3').slideUp(500); $('#about4').slideUp(500); }) $('#singer2').click(function () { $('#about2').slideToggle(500); $('#about1').slideUp(500); $('#about3').slideUp(500); $('#about4').slideUp(500); }) $('#singer3').click(function () { $('#about3').slideToggle(500); $('#about1').slideUp(500); $('#about2').slideUp(500); $('#about4').slideUp(500); }) $('#singer4').click(function () { $('#about4').slideToggle(500); $('#about1').slideUp(500); $('#about2').slideUp(500); $('#about3').slideUp(500); }) function countdown() { let date = new Date(); let eventDate = date.getTime(); // console.log(eventDate) document.getElementById('secs').innerHTML = `0-${date.getSeconds()} s`; document.getElementById('mins').innerHTML = `0-${date.getMinutes()} m`; document.getElementById('hrs').innerHTML = `0-${date.getHours()} h`; document.getElementById('days').innerHTML = `0-${date.getDay()} D`; setInterval(countdown, 1000); } countdown(); $('textarea').keyup(function () { var max = 100; var charLength = $(this).val().length; var character = max - charLength; if (character<=0) { $('#char').text("your available characters are finished"); } else { $('#char').text(character); } })
const Cropper = require('../shared/cropper'); jQuery(document).ready(function() { var routeDepartmentsList = $("#api-routes").attr("data-departments-route"); var routePixiesList = $("#api-routes").attr("data-pixies-route"); var routeUpload = $("#api-routes").attr("data-upload-route"); //--------------------------------------------- // Nested selects //--------------------------------------------- var regionSelect = $("#card_region"); var departmentSelect = $("#card_department"); var pixieSelect = $("#card_pixie"); regionSelect.change(function(){ var regionId = $(this).val(); $.get( routeDepartmentsList, { regionId: regionId }, function(departments) { departmentSelect.find(":gt(0)").remove(); $.each(departments, function (key, department) { departmentSelect.append('<option value="' + department.id + '">' + department.name + '</option>'); }); departmentSelect.val('').selectpicker('refresh'); } ); $.get( routePixiesList, { regionId: regionId }, function(pixies) { pixieSelect.find(":gt(0)").remove(); $.each(pixies, function (key, pixie) { pixieSelect.append('<option value="' + pixie.id + '">' + pixie.firstname + ' ' + pixie.lastname + '</option>'); }); pixieSelect.val('').selectpicker('refresh'); } ); }); //--------------------------------------------- // Card Info Collection //--------------------------------------------- // Store the collection tag var collectionSelector = [".card-template-infos-collection", ".card-template-attachments-collection"]; var $collectionHolder; var $collection; collectionSelector.forEach(function(selector){ // Get the tag that holds the collection and the add item button $collectionHolder = $(selector); // count the collection items we have on load $collectionHolder.data('index', $collectionHolder.find('.collection-row').length); // Add new collection item $(document).on('click', selector+' .add-item', function(e) { e.preventDefault(); $collection = $(this).parents(".repeater-container"); // Get the data-prototype var prototype = $collection.data('prototype'); // get the new index var index = $collection.data('index'); // Update the name and id var newForm = prototype; newForm = newForm.replace(/__name__/g, index); // Update the index and add the form $collection.data('index', index + 1); var $newFormLi = $('<li></li>').append(newForm); $collection.find(".add-item").parents("li").before($newFormLi.hide().fadeIn(300)); }); // Remove an item from the collection $(document).on('click', selector+' .delete-item', function(e) { e.preventDefault(); $(this).parents(".collection-row").fadeOut(300, function() { $(this).remove(); }); }); }); //--------------------------------------------- // Attachments //--------------------------------------------- var currentInput; var currentCropCallback; $(document).on('change', '.upload-zone .file-input', function() { var type = $(this).attr("data-type")?$(this).attr("data-type"):"multiple"; var callback = addAttachment; var crop = false; switch(type){ case "thumb": callback = addThumb; crop = 240/310; break; case "masterhead": callback = addMasterhead; crop = 1600/600; break; } onFileSelection(this, callback, crop); }); function onFileSelection(input, callback, crop){ if(!crop) { uploadImage(input, input.files[0], callback); } else{ currentInput = input; currentCropCallback = callback; var reader = new FileReader(); reader.onload = function(e) { Cropper.show(e.target.result, crop); }; reader.readAsDataURL(input.files[0]); } } function uploadImage(input, file, callback){ var $container = $(input).parents(".upload-zone"); var formData = new FormData(); formData.append("file", file); $container.addClass("uploading"); $.ajax({ url: routeUpload, type: 'POST', data: formData, cache: false, contentType: false, processData: false, xhr: function() { var myXhr = $.ajaxSettings.xhr(); if (myXhr.upload) { myXhr.upload.addEventListener('progress', function(e) { if (e.lengthComputable) { $container.find('.progress-bar').width((e.loaded / e.total) * 100 + "%"); } } , false); } return myXhr; } }).done(function(attachment) { callback($container, attachment); $container.removeClass("uploading"); }).fail(function(xhr, status, error) { $container.removeClass("uploading"); swal({icon: "error", text: "Votre fichier n'a pas pu être envoyé"}); $(input).val(""); }); } function addThumb($container, attachment){ $collection = $container.parents(".card-template-attachments-collection"); $collection.find(".thumb").attr("src", attachment.url); $collection.find(".field input").val(attachment.name); } function addMasterhead($container, attachment){ $collection = $container.parents(".card-template-attachments-collection"); $collection.find(".thumb").attr("src", attachment.url); $collection.find(".field input").val(attachment.name); } function addAttachment($container, attachment){ $collection = $container.parents(".card-template-attachments-collection"); var prototype = $collection.data('prototype'); var index = $collection.data('index'); var newForm = prototype; newForm = newForm.replace(/__name__/g, index); var $newFormRow = $(newForm); $collection.data('index', index + 1); $newFormRow.addClass("type-"+attachment.type); $newFormRow.find(".field input").val(attachment.name); $newFormRow.find(".thumb").css({backgroundImage: 'url('+attachment.url+')'}); $newFormRow.find(".name").text(attachment.name); $collection.find(".ajax-upload-item").parents("li").before($newFormRow.hide().fadeIn(300)); } //--------------------------------------------- // Crop and upload //--------------------------------------------- Cropper.init(); $(Cropper).on("crop", function(event, image){ uploadImage(currentInput, image, currentCropCallback); }); });
jQuery(document).ready(function ($) { var arrFileObj = new Array(); var arrIds = new Array(); var arrRemoveIds = new Array(); var __arrID = []; var contracts = []; var row = 1; var __arrCodes = []; Array.prototype.remove = function (el) { var idx = this.indexOf(el); if (idx !== -1) { { this.splice(idx, 1); } } return this; }; function ChangeRandom() { $("#imageRandom").attr("src", "/showCaptchaImage?width=90&height=34&t=" + new Date().getMilliseconds()); } $("#personalbuyBH").click(function () { $("#TypeBuyInsurance").val(1); }); // tính phí cơ bản $("#BMH_Insurance_Total").change(function () { var soTienBaoHiem = Number(($(this).val()).split('.').join("")); var age = $("#age1").val(); var heho = $("#AdditionalInsuranceMoneID").val(); if (heho > 1) { var name = $("#AdditionalInsuranceMoneID option:selected").text(); var heso = parseInt(name); var total = soTienBaoHiem * heso; $("#BMH_Insurance_TotalMore").val(formatPrice(total)); } else { $("#BMH_Insurance_TotalMore").val(formatPrice(0)); } $.post('/Illustration/PhiBaoHiemCoBan', { soTienBaoHiem: soTienBaoHiem, ageNDBH: age }, function (data) { $("#BMH_Insurance_FeeBase").val(formatPrice(data)); $("input[name=BMH_Insurance_FeeBase]").val(data); $("#PhiBaoHiemDuKien").val(formatPrice(data)); $("input[name=PhiBaoHiemDuKien]").val(data); const totalPhi = formatStringPrice($("#TongPhiBHBT").val()) + data; $('#TongPhiBHBT-SPC').val(formatPrice(totalPhi)); $("input[name=TongPhiBHBT-SPC]").val(totalPhi); }); }); $(".InputMoney").change(function () { var code = $(this).data('code'); var id = $(this).data('id'); var soTienNhap = Number($(this).val().split('.').join("")); var ageNDBH = Number($("#age1").val()); var genderNDBH = $('input[name=BeneficiaryGender]:checked', '#frmIllustration').val(); var ageBMBH = Number($("#age2").val()); var soTienBaoHiem = formatStringPrice($("#BMH_Insurance_Total").val()); console.log(ageNDBH, soTienNhap); if (code === "BHBT_BenhHiemNgheo") { if (ageNDBH === null || ageNDBH === '') { alert('Bạn chưa chọn ngày sinh người được bảo hiểm'); $(this).val(''); return false; } else if (soTienNhap === 0) { alert('Bạn chưa nhập số tiền bảo hiểm trong form sản phẩm bổ trợ'); $(this).val(''); return false; } else if (typeof genderNDBH === 'undefined' || genderNDBH === null) { alert('Bạn chưa chọn giới tính người được bảo hiểm'); $(this).val(''); return false; } else { if (ageNDBH > 18) { if (soTienNhap > 5000000000) { alert('Số tiền bảo hiểm tối đa của BH Bệnh hiểm nghèo nâng cao đối với NĐBH > 18 tối đa là 5 tỷ đồng'); $(this).val(''); return false; } else { port_BHBT_BenhHiemNgheo(soTienNhap, ageNDBH, genderNDBH, code); } } else { if (soTienNhap > 2500000000) { alert('Số tiền bảo hiểm tối đa của BH Bệnh hiểm nghèo nâng cao đối với NĐBH ≤ 18 tuổi là 2.5 tỷ đồng'); $(this).val(''); return false; } else { port_BHBT_BenhHiemNgheo(soTienNhap, ageNDBH, genderNDBH, code); } } } } else if (code === "BHBT_BenhHiemNgheo_CI20") { if (ageNDBH === null || ageNDBH === '') { alert('Bạn chưa chọn ngày sinh người được bảo hiểm'); $(this).val(''); return false; } else if (soTienBaoHiem === 0) { alert('Bạn chưa nhập số tiền bảo hiểm chính'); $(this).val(''); return false; } else if (soTienNhap === 0) { alert('Bạn chưa nhập số tiền bảo hiểm trong form sản phẩm bổ trợ'); $(this).val(''); return false; } else if (typeof genderNDBH === 'undefined' || genderNDBH === null) { alert('Bạn chưa chọn giới tính người được bảo hiểm'); $(this).val(''); return false; } else { if (soTienNhap > soTienBaoHiem) { alert('Số tiền bảo hiểm hỗ trợ bệnh hiểm nghèo không được vượt quá số tiền bảo hiểm cơ bản'); $(this).val(''); return false; } else if (soTienNhap > 4000000000) { alert('Số tiền bảo hiểm hỗ trợ bệnh hiểm nghèo không được vượt quá 4 tỷ'); $(this).val(''); return false; } else if (soTienNhap % 1000000 !== 0) { alert('Số tiền BH hỗ trợ bệnh hiểm nghèo phải là bội số của 1.000.000'); $(this).val(''); return false; } else { port_BHBT_BenhHiemNgheo_CI20(soTienNhap, ageNDBH, genderNDBH, code); } } } else if (code === "BHBT_TV_TTTBV") { if (ageNDBH === null || ageNDBH === '') { alert('Bạn chưa chọn ngày sinh người được bảo hiểm'); $(this).val(''); return false; } else if (soTienBaoHiem === 0) { alert('Bạn chưa nhập số tiền bảo hiểm chính'); $(this).val(''); return false; } else if (soTienNhap === 0) { alert('Bạn chưa nhập số tiền bảo hiểm trong form sản phẩm bổ trợ'); $(this).val(''); return false; } else { if (soTienNhap > soTienBaoHiem) { alert('Số tiền bảo hiểm hỗ trợ thương tật vĩnh viễn do tai nạn không được vượt quá số tiền bảo hiểm cơ bản'); $(this).val(''); return false; } else if (soTienNhap > 3000000000 || soTienNhap < 50000000) { alert('Số tiền bảo hiểm cho quyền lợi TV, TTTBVV do tai nạn từ 50.000.000 đến 3 tỷ'); $(this).val(''); return false; } else if (soTienNhap % 1000000 !== 0) { alert('Số tiền BH hỗ trợ thương tật vĩnh viễn do tai nạn phải là bội số của 1.000.000'); $(this).val(''); return false; } else { port_BHBT_TV_TTTBVV(soTienNhap, soTienBaoHiem, ageNDBH, code); } } } else if (code === "BHBT_TTTBV") { if (ageNDBH === null || ageNDBH === '') { alert('Bạn chưa chọn ngày sinh người được bảo hiểm'); $(this).val(''); return false; } else if (soTienNhap === 0) { alert('Bạn chưa nhập số tiền bảo hiểm trong form sản phẩm bổ trợ'); $(this).val(''); return false; } else if (soTienBaoHiem === 0) { alert('Bạn chưa nhập số tiền bảo hiểm chính'); $(this).val(''); return false; } else { port_BHBT_TTVV(soTienNhap, soTienBaoHiem, ageNDBH, code); } } else if (code === "BHBT_HoTroThuNhap") { if (ageBMBH === null || ageBMBH === '') { alert('Bạn chưa chọn ngày sinh người được bảo hiểm'); $(this).val(''); return false; } else if (soTienNhap === 0) { alert('Bạn chưa nhập số tiền bảo hiểm trong form sản phẩm bổ trợ'); $(this).val(''); return false; } else if (soTienBaoHiem === 0) { alert('Bạn chưa nhập số tiền bảo hiểm chính'); $(this).val(''); return false; } else { port_BHBT_HoTroThuNhap(soTienNhap, soTienBaoHiem, ageBMBH, code); } } }); $("#BMH_Insurance_FeeRecuring").change(function () { var value = $(this).val(); if (value === "1") { $("#TotalInsuranceFeeRecuring").html("1/2"); } else { $("#TotalInsuranceFeeRecuring").html("1"); } }); $("#LuaChonTienBaoHiem").change(function () { var code = $(this).data('code'); var luachon = $(this).val(); var ageNDBH = $("#age1").val(); if (code === "BHBT_NamVien") { if (ageNDBH === null || ageNDBH === '') { alert('Bạn chưa chọn ngày sinh người được bảo hiểm'); $(this).val(''); return false; } port_BHBT_NamVien(luachon, ageNDBH, code); } }); $("#groupbuyBH").click(function () { $("#TypeBuyInsurance").val(2); }); $("#samebuyBH").click(function () { $("#TypeBuyInsurance").val(1); }); $("#AdditionalInsuranceMoneID").change(function () { var name = $("#AdditionalInsuranceMoneID option:selected").text(); var id = $(this).val(); var soTienBaoHiem = Number(($("#BMH_Insurance_Total").val()).split('.').join("")); var heso = id > 1 ? parseInt(name) : 0; var total = soTienBaoHiem * heso; $("#BMH_Insurance_TotalMore").val(formatPrice(total)); $("#AdditionalInsuranceMone").val(name); }); function removeId(id) { __arrID = __arrID.filter(e => e !== id); $('#InsuranceMoreIds').val(__arrID.toString()); } function addId(id) { __arrID.push(id); $('#InsuranceMoreIds').val(__arrID.toString()); } function removeCode(code) { __arrCodes = __arrCodes.filter(e => e !== code); $('#InsuranceMoreCodes').val(__arrCodes.toString()); } function addCode(code) { __arrCodes.push(code); $('#InsuranceMoreCodes').val(__arrCodes.toString()); } function formatPrice(e) { var text = String(e).replace(/^0+/, ''); var l = text.length; if (l > 3) { var u = l % 3 === 0 ? (Math.floor(l / 3)) - 1 : Math.floor(l / 3); var text_new = text.substr(0, l - (u * 3)); for (i = u - 1; i >= 0; i--) { text_new = text_new + '.' + text.substr(-3 * (i + 1), 3); } return text_new; } else { return text; } } function formatStringPrice(e) { return Number(e.toString().split('.').join("")); } function port_BHBT_BenhHiemNgheo(soTienNhap, ageNDBH, genderNDBH, code) { $.post('/Illustration/BHBT_BenhHiemNgheo', { soTienNhap: soTienNhap, ageNDBH: ageNDBH, genderNDBH: genderNDBH }, function (data) { if (!data.IsError) { const totalMoney = formatStringPrice($("#" + code).val()); $("#" + code).val(formatPrice(data.Value)); const tongPhiBHBT = formatStringPrice($("#TongPhiBHBT").val()); const total = tongPhiBHBT + data.Value - totalMoney; $("#TongPhiBHBT").val(formatPrice(total)); $("input[name='TongPhiBHBT']").val(total); // tính tổng phí chính và bổ trợ const totalPhi = total + formatStringPrice($("#BMH_Insurance_FeeBase").val()); $('#TongPhiBHBT-SPC').val(formatPrice(totalPhi)); $("input[name='TongPhiBHBT-SPC']").val(totalPhi); } else { alert(data.Message); } }); } function port_BHBT_BenhHiemNgheo_CI20(soTienNhap, ageNDBH, genderNDBH, code) { $.post('/Illustration/BHBT_BenhHiemNgheo_CI20', { soTienNhap: soTienNhap, ageNDBH: ageNDBH, genderNDBH: genderNDBH }, function (data) { if (!data.IsError) { const totalMoney = formatStringPrice($("#" + code).val()); $("#" + code).val(formatPrice(data.Value)); const tongPhiBHBT = formatStringPrice($("#TongPhiBHBT").val()); const total = tongPhiBHBT + data.Value - totalMoney; $("#TongPhiBHBT").val(formatPrice(total)); $("input[name='TongPhiBHBT']").val(total); // tính tổng phí chính và bổ trợ const totalPhi = total + formatStringPrice($("#BMH_Insurance_FeeBase").val()); $('#TongPhiBHBT-SPC').val(formatPrice(totalPhi)); $("input[name='TongPhiBHBT-SPC']").val(totalPhi); } else { alert(data.Message); } }); } function port_BHBT_TV_TTTBVV(soTienNhap, soTienBaoHiem, ageNDBH, code) { $.post('/Illustration/BHBT_TV_TTTBVV', { soTienNhap: soTienNhap, soTienBaoHiem: soTienBaoHiem, ageNDBH: ageNDBH }, function (data) { if (!data.IsError) { const totalMoney = formatStringPrice($("#" + code).val()); $("#" + code).val(formatPrice(data.Value)); const tongPhiBHBT = formatStringPrice($("#TongPhiBHBT").val()); var total = tongPhiBHBT + data.Value - totalMoney; $("#TongPhiBHBT").val(formatPrice(total)); $("input[name='TongPhiBHBT']").val(total); // tính tổng phí chính và bổ trợ const totalPhi = total + formatStringPrice($("#BMH_Insurance_FeeBase").val()); $('#TongPhiBHBT-SPC').val(formatPrice(totalPhi)); $("input[name='TongPhiBHBT-SPC']").val(totalPhi); } else { alert(data.Message); } }); } function port_BHBT_TTVV(soTienNhap, soTienBaoHiem, ageNDBH, code) { $.post('/Illustration/BHBT_TTVV', { soTienNhap: soTienNhap, soTienBaoHiem: soTienBaoHiem, ageNDBH: ageNDBH }, function (data) { if (!data.IsError) { const totalMoney = formatStringPrice($("#" + code).val()); $("#" + code).val(formatPrice(data.Value)); const tongPhiBHBT = formatStringPrice($("#TongPhiBHBT").val()); const total = tongPhiBHBT + data.Value - totalMoney; $("#TongPhiBHBT").val(formatPrice(total)); $("input[name='TongPhiBHBT']").val(total); // tính tổng phí chính và bổ trợ const totalPhi = total + formatStringPrice($("#BMH_Insurance_FeeBase").val()); $('#TongPhiBHBT-SPC').val(formatPrice(totalPhi)); $("input[name='TongPhiBHBT-SPC']").val(totalPhi); } else { alert(data.Message); } }); } function port_BHBT_HoTroThuNhap(soTienNhap, soTienBaoHiem, ageBMBH, code) { $.post('/Illustration/BHBT_HoTroThuNhap', { soTienNhap: soTienNhap, soTienBaoHiem: soTienBaoHiem, ageBMBH: ageBMBH }, function (data) { if (!data.IsError) { const totalMoney = formatStringPrice($("#" + code).val()); $("#" + code).val(formatPrice(data.Value)); const tongPhiBHBT = formatStringPrice($("#TongPhiBHBT").val()); const total = tongPhiBHBT + data.Value - totalMoney; $("#TongPhiBHBT").val(formatPrice(total)); $("input[name='TongPhiBHBT']").val(total); // tính tổng phí chính và bổ trợ const totalPhi = total + formatStringPrice($("#BMH_Insurance_FeeBase").val()); $('#TongPhiBHBT-SPC').val(formatPrice(totalPhi)); $("input[name='TongPhiBHBT']").val(total); } else { alert(data.Message); } }); } function port_BHBT_NamVien(luachon, ageNDBH, code) { $.post('/Illustration/BHBT_NamVien', { luachon: luachon, ageNDBH: ageNDBH }, function (data) { if (!data.IsError) { const totalMoney = formatStringPrice($("#" + code).val()); $("#" + code).val(formatPrice(data.Value)); const tongPhiBHBT = formatStringPrice($("#TongPhiBHBT").val()); const total = tongPhiBHBT + data.Value - totalMoney; $("#TongPhiBHBT").val(formatPrice(total)); $("input[name='TongPhiBHBT']").val(total); // tính tổng phí chính và bổ trợ const totalPhi = total + formatStringPrice($("#BMH_Insurance_FeeBase").val()); $('#TongPhiBHBT-SPC').val(formatPrice(totalPhi)); $("input[name='TongPhiBHBT']").val(total); $('#LuaChonTienBaoHiem_help')[0].innerHTML = data.Message; } else { alert(data.Message); } }); } $(".contractYear").change(function () { const year = $(this).val(); if (Number(year) > 1) { const code = $(this).data('code'); var contract = contracts.find(e => e.code === code); if (contract) { contract.contractYear = year; } else { contracts.push({ code, contractYear: year }); } const contractYear = String(contracts.map(e => e.contractYear)); const totalMoney = String(contracts.map(e => e.contractTotalMoney)); $("input[name=ContractYear]").val(contractYear); $("input[name=TotalMoney]").val(totalMoney); } else { $(this).val(''); alert("Không được rút năm đầu tiên"); } }); $(".contractTotalMoney").change(function () { const text = $(this).val().split('.').join(""); const contractTotalMoney = Number(text); const code = $(this).data('code'); if (contractTotalMoney % 100000 !== 0) { alert('Số tiền rút phải là bội số của 100.000'); $(this).val(''); return false; } else { var contract = contracts.find(e => e.code === code); if (contract) { contract.contractTotalMoney = contractTotalMoney; } else { contracts.push({ code, contractTotalMoney }); } $(this).val(formatPrice(text)); const contractYear = String(contracts.map(e => e.contractYear)); const totalMoney = String(contracts.map(e => e.contractTotalMoney)); $("input[name=ContractYear]").val(contractYear); $("input[name=TotalMoney]").val(totalMoney); } }); $(".InsuranceMoreId").click(function () { var id = $(this).val(); var code = $(this).data('code'); if ($(this).is(':checked')) { addId(id); addCode(code); var ageNDBH = $("#age1").val(); if (ageNDBH === null || ageNDBH === '') { $(this).prop('checked', false); alert('Bạn chưa chọn ngày sinh người được bảo hiểm'); } else { if (code === "BHBT_NamVien") { $("#LuaChonTienBaoHiem").prop("disabled", false); var luachon = $("#LuaChonTienBaoHiem").val(); port_BHBT_NamVien(luachon, ageNDBH, code); } else { var soTienNhap = Number($("#InputMoney-" + code).val().split('.').join("")); var genderNDBH = $('input[name=BeneficiaryGender]:checked', '#frmIllustration').val(); var ageBMBH = Number($("#age2").val()); var soTienBaoHiem = $("#BMH_Insurance_Total").val(); if (soTienNhap > 0) { if (code === "BHBT_BenhHiemNgheo") { if (genderNDBH) { port_BHBT_BenhHiemNgheo(soTienNhap, ageNDBH, genderNDBH, code); } else { alert('Bạn chưa chọn giới tính người được bảo hiểm'); } } else if (code === "BHBT_BenhHiemNgheo_CI20") { if (genderNDBH) { port_BHBT_BenhHiemNgheo_CI20(soTienNhap, ageNDBH, genderNDBH, code); } else { alert('Bạn chưa chọn giới tính người được bảo hiểm'); } } else if (code === "BHBT_TV_TTTBV") { if (soTienBaoHiem === 0) { alert('Bạn chưa nhập số tiền bảo hiểm chính'); } else { port_BHBT_TV_TTTBVV(soTienNhap, soTienBaoHiem, ageNDBH, code); } } else if (code === "BHBT_TTTBV") { if (soTienBaoHiem === 0) { alert('Bạn chưa nhập số tiền bảo hiểm chính'); } else { port_BHBT_TTVV(soTienNhap, soTienBaoHiem, ageNDBH, code); } } else if (code === "BHBT_HoTroThuNhap") { if (soTienBaoHiem === 0) { alert('Bạn chưa nhập số tiền bảo hiểm chính'); } else { port_BHBT_HoTroThuNhap(soTienNhap, soTienBaoHiem, ageBMBH, code); } } } $("#InputMoney-" + code).prop("disabled", false); } if (code !== "BHBT_HoTroThuNhap") { $("#InputMoney-" + code).attr("readonly", false); $("#InputMoney-" + code).focus(); } } } else { const price = formatStringPrice($("#" + code).val()); const tongPhiBHBT = formatStringPrice($("#TongPhiBHBT").val()); $("#TongPhiBHBT").val(formatPrice(tongPhiBHBT - price)); $("input[name='TongPhiBHBT']").val(tongPhiBHBT - price) const TongPhiBHBT_SPC = formatStringPrice($("#TongPhiBHBT-SPC").val()); $("#TongPhiBHBT-SPC").val(formatPrice(TongPhiBHBT_SPC - price)); $("input[name='TongPhiBHBT-SPC']").val(TongPhiBHBT_SPC - price) removeId(id); removeCode(code); if (code === "BHBT_NamVien") { $("#LuaChonTienBaoHiem").prop("disabled", true); $("#" + code).val(0); } else { $("#InputMoney-" + code).prop("disabled", true); $("#" + code).val(0); } } }); });
import * as actionTypes from '../actions/actionTypes' import { updateState } from '../utility' const initialState = { order : [], loading: false, showModalForSuccess: false, error: false } const reducer = (state = initialState, action) => { switch (action.type) { case actionTypes.SHOW_LOADER: return updateState(state, {loading: true}) case actionTypes.STORE_ORDER: return updateState(state, {loading: false, showModalForSuccess: true, order: state.order.concat(action.order), error: false}) case actionTypes.PLACE_ORDER_FAILED: return updateState(state, {loading: false, showModalForSuccess: false, error: true}) case actionTypes.MODAL_HIDE: return updateState(state, {showModalForSuccess: false, loading: false}) default: return state } } export default reducer;
/* * Copyright (c) 2012,2013 DeNA Co., Ltd. et al. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ import "./analysis.jsx"; import "./type.jsx"; import "./util.jsx"; import "./statement.jsx"; import "./expression.jsx"; import "./parser.jsx"; import "./doc.jsx"; mixin TemplateDefinition { function buildInstantiationContext (errors : CompileError[], token : Token, formalTypeArgs : Token[], actualTypeArgs : Type[]) : InstantiationContext { // check number of type arguments if (formalTypeArgs.length != actualTypeArgs.length) { errors.push(new CompileError(token, "wrong number of template arguments (expected " + formalTypeArgs.length as string + ", got " + actualTypeArgs.length as string + ")")); return null; } // build typemap var typemap = new Map.<Type>; for (var i = 0; i < formalTypeArgs.length; ++i) { typemap[formalTypeArgs[i].getValue()] = actualTypeArgs[i]; } return new InstantiationContext(errors, typemap); } } class ClassDefinition implements Stashable { static const IS_CONST = 1; static const IS_ABSTRACT = 2; static const IS_FINAL = 4; static const IS_STATIC = 8; static const IS_NATIVE = 16; static const IS_OVERRIDE = 32; static const IS_INTERFACE = 64; static const IS_MIXIN = 128; static const IS_FAKE = 256; // used for marking a JS non-class object that should be treated like a JSX class instance (e.g. window) static const IS_READONLY = 512; static const IS_INLINE = 1024; static const IS_PURE = 2048; // constexpr (intended for for native functions) static const IS_DELETE = 4096; // used for disabling the default constructor static const IS_GENERATOR = 8192; static const IS_EXPORT = 16384; // no overloading, no minification of method / variable names static const IS_GENERATED = 32768; var _parser : Parser; var _token : Token; var _className : string; var _flags : number; var _extendType : ParsedObjectType; // null for interfaces, mixins, and Object class only var _implementTypes : ParsedObjectType[]; var _members : MemberDefinition[]; var _inners : ClassDefinition[]; var _templateInners : TemplateClassDefinition[]; var _objectTypesUsed : ParsedObjectType[]; var _docComment : DocComment; var _baseClassDef : ClassDefinition = null; var _outerClassDef : ClassDefinition = null; var _nativeSource : Token = null; var _analized = false; function constructor (token : Token, className : string, flags : number, extendType : ParsedObjectType, implementTypes : ParsedObjectType[], members : MemberDefinition[], inners : ClassDefinition[], templateInners : TemplateClassDefinition[], objectTypesUsed : ParsedObjectType[], docComment : DocComment) { this._parser = null; this._token = token; this._className = className; this._flags = flags; this._extendType = extendType; this._implementTypes = implementTypes; this._members = members; this._inners = inners; this._templateInners = templateInners; this._objectTypesUsed = objectTypesUsed; this._docComment = docComment; this._resetMembersClassDef(); if (! (this instanceof TemplateClassDefinition || this instanceof InstantiatedClassDefinition)) { this._generateWrapperFunctions(); } } function _generateWrapperFunctions() : void { this.forEachMemberFunction((funcDef) -> { funcDef.generateWrappersForDefaultParameters(); return true; }); this.forEachTemplateFunction((funcDef) -> { funcDef.generateWrappersForDefaultParameters(); return true; }); } function serialize () : variant { // FIXME implement in a way that is compatible with JSX return { "token" : this._token, "name" : this._className, "flags" : this._flags, "extends" : Util.serializeNullable(this._extendType), "implements" : Util.serializeArray(this._implementTypes), "members" : Util.serializeArray(this._members), "inners" : Util.serializeArray(this._inners), "templateInners" : Util.serializeArray(this._templateInners) } : Map.<variant>; } static function serialize (classDefs : ClassDefinition[]) : variant { var s = new variant[]; for (var i = 0; i < classDefs.length; ++i) s[i] = classDefs[i].serialize(); return s; } function getParser () : Parser { return this._parser; } function setParser (parser : Parser) : void { this._parser = parser; } function getNativeSource () : Token { return this._nativeSource; } function setNativeSource (nativeSource : Token) : void { this._nativeSource = nativeSource; } function getToken () : Token { return this._token; } function className () : string { return this._className; } function classFullName () : string { return this._outerClassDef != null ? this._outerClassDef.classFullName() + "." + this._className : this.className(); } function flags () : number { return this._flags; } function setFlags (flags : number) : void { this._flags = flags; } function extendType () : ParsedObjectType { return this._extendType; } function implementTypes () : ParsedObjectType[] { return this._implementTypes; } function members () : MemberDefinition[] { return this._members; } function setOuterClassDef (outer : ClassDefinition) : void { this._outerClassDef = outer; } function getOuterClassDef () : ClassDefinition { return this._outerClassDef; } function getInnerClasses () : ClassDefinition[] { return this._inners; } function getTemplateInnerClasses () : TemplateClassDefinition[] { return this._templateInners; } function getDocComment () : DocComment { return this._docComment; } function setDocComment (docComment : DocComment) : void { this._docComment = docComment; } function forEachClassToBase (cb : function(:ClassDefinition):boolean) : boolean { if (! cb(this)) return false; for (var i = this._implementTypes.length - 1; i >= 0; --i) { if (! cb(this._implementTypes[i].getClassDef())) return false; } if (this._extendType != null) { if (! this._extendType.getClassDef().forEachClassToBase(cb)) return false; } return true; } function forEachClassFromBase (cb : function(:ClassDefinition):boolean) : boolean { if (this._extendType != null) if (! this._extendType.getClassDef().forEachClassFromBase(cb)) return false; for (var i = 0; i < this._implementTypes.length; ++i) { if (! cb(this._implementTypes[i].getClassDef())) return false; } if (! cb(this)) return false; return true; } function forEachMember (cb : function(:MemberDefinition):boolean) : boolean { for (var i = 0; i < this._members.length; ++i) { if (! cb(this._members[i])) return false; } return true; } function forEachMemberVariable (cb : function(:MemberVariableDefinition):boolean) : boolean { for (var i = 0; i < this._members.length; ++i) { if (this._members[i] instanceof MemberVariableDefinition) { if (! cb(this._members[i] as MemberVariableDefinition)) return false; } } return true; } function forEachMemberFunction (cb : function(:MemberFunctionDefinition):boolean) : boolean { for (var i = 0; i < this._members.length; ++i) { var member = this._members[i]; if (member instanceof MemberFunctionDefinition && !(member instanceof TemplateFunctionDefinition)) { if (! cb(member as MemberFunctionDefinition)) return false; } } return true; } function forEachTemplateFunction (cb : function(:TemplateFunctionDefinition):boolean) : boolean { for (var i = 0; i < this._members.length; ++i) { if (this._members[i] instanceof TemplateFunctionDefinition) { if (! cb(this._members[i] as TemplateFunctionDefinition)) return false; } } return true; } function forEachInnerClass (cb : function(:ClassDefinition):boolean) : boolean { for (var i = 0; i < this._inners.length; ++i) { if (! cb(this._inners[i])) return false; } return true; } function forEachTemplateInnerClass (cb : function(:TemplateClassDefinition):boolean) : boolean { for (var i = 0; i < this._templateInners.length; ++i) { if (! cb(this._templateInners[i])) return false; } return true; } function _resetMembersClassDef () : void { // member defintions for (var i = 0; i < this._members.length; ++i) { this._members[i].setClassDef(this); this._members[i].forEachClosure(function setClassDef(funcDef) { funcDef.setClassDef(this); return funcDef.forEachClosure(setClassDef); }); } // member classes for (var i = 0; i < this._inners.length; ++i) { this._inners[i].setOuterClassDef(this); this._inners[i]._resetMembersClassDef(); } for (var i = 0; i < this._templateInners.length; ++i) { this._templateInners[i].setOuterClassDef(this); } } static const GET_MEMBER_MODE_ALL = 0; // looks for functions or variables from the class and all super classes static const GET_MEMBER_MODE_CLASS_ONLY = 1; // looks for functions or variables within the class static const GET_MEMBER_MODE_SUPER = 2; // looks for functions with body in super classes static const GET_MEMBER_MODE_FUNCTION_WITH_BODY = 3; // looks for function with body function getMemberTypeByName (errors : CompileError[], token : Token, name : string, isStatic : boolean, typeArgs : Type[], mode : number) : Type { // returns an array to support function overloading var types = new Type[]; function pushMatchingMember(classDef : ClassDefinition) : void { if (mode != ClassDefinition.GET_MEMBER_MODE_SUPER) { for (var i = 0; i < classDef._members.length; ++i) { var member = classDef._members[i]; if ((member.flags() & ClassDefinition.IS_DELETE) != 0) { // skip } else if (((member.flags() & ClassDefinition.IS_STATIC) != 0) == isStatic && name == member.name()) { if (member instanceof MemberVariableDefinition) { if ((member.flags() & ClassDefinition.IS_OVERRIDE) == 0) { var type = (member as MemberVariableDefinition).getType(); // ignore member variables that failed in type deduction (already reported as a compile error) // it is guranteed by _assertMemberVariableIsDefinable that there would not be a property with same name using different type, so we can use the first one (declarations might be found more than once using the "abstract" attribute) if (type != null && types.length == 0) types[0] = type; } } else if (member instanceof MemberFunctionDefinition) { // member function if (member instanceof InstantiatedMemberFunctionDefinition) { // skip } else { // explicitly passed type parameters. instantiate the member here if (member instanceof TemplateFunctionDefinition && typeArgs.length != 0) { if ((member = (member as TemplateFunctionDefinition).instantiateTemplateFunction(errors, token, typeArgs)) == null) { return; } } if ((member as MemberFunctionDefinition).getStatements() != null || mode != ClassDefinition.GET_MEMBER_MODE_FUNCTION_WITH_BODY || (member.flags() & (ClassDefinition.IS_NATIVE | ClassDefinition.IS_ABSTRACT)) == ClassDefinition.IS_NATIVE) { for (var j = 0; j < types.length; ++j) { // FIXME check types of template functions are equal if (Util.typesAreEqual((member as MemberFunctionDefinition).getArgumentTypes(), (types[j] as ResolvedFunctionType).getArgumentTypes())) { break; } } if (j == types.length) { types.push((member as MemberFunctionDefinition).getType()); } } } } else { throw new Error("logic flaw"); } } } } else { // for searching super classes, change mode GET_MEMBER_MODE_SUPER to GET_MEMBER_MODE_FUNCTION_WITH_BODY mode = ClassDefinition.GET_MEMBER_MODE_FUNCTION_WITH_BODY; } if (mode != ClassDefinition.GET_MEMBER_MODE_CLASS_ONLY) { if (classDef._extendType != null) { pushMatchingMember(classDef._extendType.getClassDef()); } for (var i = 0; i < classDef._implementTypes.length; ++i) { pushMatchingMember(classDef._implementTypes[i].getClassDef()); } } } pushMatchingMember(this); switch (types.length) { case 0: return null; case 1: return types[0]; default: return new FunctionChoiceType(types.map.<ResolvedFunctionType>(function(t) { return t as ResolvedFunctionType; })); } } function lookupInnerClass (className : string) : ClassDefinition { for (var i = 0; i < this._inners.length; ++i) { var inner = this._inners[i]; if (inner.className() == className) return inner; } return null; } function lookupTemplateInnerClass (errors : CompileError[], request : TemplateInstantiationRequest, postInstantiationCallback : (Parser,ClassDefinition)->ClassDefinition) : ClassDefinition { var instantiateCallback = this.createGetTemplateClassCallback(errors, request, postInstantiationCallback); if (instantiateCallback != null) return instantiateCallback(errors, request, postInstantiationCallback); return null; } function createGetTemplateClassCallback (errors : CompileError[], request : TemplateInstantiationRequest, postInstantiationCallback : (Parser,ClassDefinition)->ClassDefinition) : (CompileError[],TemplateInstantiationRequest,(Parser,ClassDefinition)->ClassDefinition)->ClassDefinition { // lookup the already-instantiated class for (var i = 0; i < this._inners.length; ++i) { var classDef = this._inners[i]; if (classDef instanceof InstantiatedClassDefinition && (classDef as InstantiatedClassDefinition).getTemplateClassName() == request.getClassName() && Util.typesAreEqual((classDef as InstantiatedClassDefinition).getTypeArguments(), request.getTypeArguments())) { return function (_ : CompileError[], __ : TemplateInstantiationRequest, ___ : (Parser,ClassDefinition)->ClassDefinition) : ClassDefinition { return classDef; }; } } // create instantiation callback for (var i = 0; i < this._templateInners.length; ++i) { var templateDef = this._templateInners[i]; if (templateDef.className() == request.getClassName()) { return function (_ : CompileError[], __ : TemplateInstantiationRequest, ___ : (Parser,ClassDefinition)->ClassDefinition) : ClassDefinition { var classDef = templateDef.instantiateTemplateClass(errors, request); if (classDef == null) { return null; } this._inners.push(classDef); classDef.setParser(this._parser); classDef.resolveTypes(new AnalysisContext(errors, this._parser, null)); postInstantiationCallback(this._parser, classDef); return classDef; }; } } return null; } function instantiate (instantiationContext : InstantiationContext) : ClassDefinition { var context = instantiationContext.clone(); // instantiate the members var succeeded = true; var members = new MemberDefinition[]; for (var i = 0; i < this._members.length; ++i) { var member = this._members[i].instantiate(context); if (member == null) succeeded = false; members[i] = member; } var inners = new ClassDefinition[]; for (var i = 0; i < this._inners.length; ++i) { var inner = this._inners[i].instantiate(context); if (inner == null) succeeded = false; inners[i] = inner; } var templateInners = new TemplateClassDefinition[]; for (var i = 0; i < this._templateInners.length; ++i) { var templateInner = this._templateInners[i].instantiate(context); if (templateInner == null) succeeded = false; templateInners[i] = templateInner; } // done if (! succeeded) return null; var extendType = null : ParsedObjectType; if (this._extendType != null) { var type = this._extendType.instantiate(instantiationContext, false); if (! (type instanceof ParsedObjectType)) { instantiationContext.errors.push(new CompileError(this._extendType.getToken(), "non-object type is not extensible")); return null; } extendType = type as ParsedObjectType; } var implementTypes = new ParsedObjectType[]; for (var i = 0; i < this._implementTypes.length; ++i) { var type = this._implementTypes[i].instantiate(instantiationContext, false); if (! (type instanceof ParsedObjectType)) { instantiationContext.errors.push(new CompileError(this._implementTypes[i].getToken(), "non-object type is not extensible")); return null; } implementTypes[i] = type as ParsedObjectType; } return new ClassDefinition( this._token, this._className, this._flags, extendType, implementTypes, members, inners, templateInners, context.objectTypesUsed, this._docComment ); } function normalizeClassDefs (errors : CompileError[]) : void { for (var x = 0; x < this._members.length; ++x) { for (var y = 0; y < x; ++y) { if (this._members[x].name() == this._members[y].name() && (this._members[x].flags() & ClassDefinition.IS_STATIC) == (this._members[y].flags() & ClassDefinition.IS_STATIC)) { var errorMsg : Nullable.<string> = null; if (this._members[x] instanceof MemberFunctionDefinition && this._members[y] instanceof MemberFunctionDefinition) { if (Util.typesAreEqual((this._members[x] as MemberFunctionDefinition).getArgumentTypes(), (this._members[y] as MemberFunctionDefinition).getArgumentTypes())) { errorMsg = "a " + ((this._members[x].flags() & ClassDefinition.IS_STATIC) != 0 ? "static" : "member") + " function with same name and arguments is already defined"; errorMsg += ":" + x as string + ":" + (this._members[x] as MemberFunctionDefinition).getArgumentTypes().length as string; errorMsg += ":" + y as string + ":" + (this._members[y] as MemberFunctionDefinition).getArgumentTypes().length as string; } } else { errorMsg = "a property with same name already exists (note: only functions may be overloaded)"; } if (errorMsg != null) { var error = new CompileError(this._members[x].getNameToken(), errorMsg); error.addCompileNote(new CompileNote(this._members[y].getNameToken(), "conflicting definition found here")); errors.push(error); break; } } } } } function resolveTypes (context : AnalysisContext) : void { // resolve types used for (var i = 0; i < this._objectTypesUsed.length; ++i) this._objectTypesUsed[i].resolveType(context); for (var i = 0; i < this._inners.length; ++i) this._inners[i].resolveTypes(context); // resolve base classes if (this._extendType != null) { var baseClass = this._extendType.getClassDef(); if (baseClass != null) { if ((baseClass.flags() & ClassDefinition.IS_FINAL) != 0) context.errors.push(new CompileError(this._extendType.getToken(), "cannot extend a final class")); else if ((baseClass.flags() & ClassDefinition.IS_INTERFACE) != 0) context.errors.push(new CompileError(this._extendType.getToken(), "cannot extend an interface, use the 'implements' keyword")); else if ((baseClass.flags() & ClassDefinition.IS_MIXIN) != 0) context.errors.push(new CompileError(this._extendType.getToken(), "cannot extend an mixin, use the 'implements' keyword")); } } for (var i = 0; i < this._implementTypes.length; ++i) { var baseClass = this._implementTypes[i].getClassDef(); if (baseClass != null) { if ((baseClass.flags() & (ClassDefinition.IS_INTERFACE | ClassDefinition.IS_MIXIN)) == 0) { context.errors.push(new CompileError(this._implementTypes[i].getToken(), "cannot implement a class (only interfaces can be implemented)")); } else { for (var j = i + 1; j < this._implementTypes.length; ++j) { if (this._implementTypes[j].getClassDef() == baseClass) { context.errors.push(new CompileError(this._implementTypes[i].getToken(), "cannot implement the same interface more than once")); break; } } } } } // create default constructor if no constructors exist if (this.forEachMemberFunction(function (funcDef) { return funcDef.name() != "constructor"; })) { var isNative = (this.flags() & ClassDefinition.IS_NATIVE) != 0; var func = new MemberFunctionDefinition( this._token, new Token("constructor", true), ClassDefinition.IS_FINAL | (this.flags() & (ClassDefinition.IS_NATIVE | ClassDefinition.IS_EXPORT)), Type.voidType, new ArgumentDeclaration[], isNative ? (null) : new LocalVariable[], isNative ? (null) : new Statement[], new MemberFunctionDefinition[], this._token, /* FIXME */ null); func.setClassDef(this); this._members.push(func); } // remove the deleted constructor for (var i = 0; i != this._members.length; ++i) { if (this._members[i] instanceof MemberFunctionDefinition && this._members[i].name() == "constructor" && (this._members[i].flags() & (ClassDefinition.IS_STATIC | ClassDefinition.IS_DELETE)) == ClassDefinition.IS_DELETE) { this._members.splice(i, 1); break; } } } function setAnalysisContextOfVariables (context : AnalysisContext) : void { this.forEachMemberVariable((member) -> { member.setAnalysisContext(context); return true; }); } function analyze (context : AnalysisContext) : void { if (this._analized) return; this._analized = true; try { this._analyzeClassDef(context); } catch (e : Error) { var token = this.getToken(); var srcPos = token != null ? Util.format(" at file %1, line %2", [token.getFilename(), token.getLineNumber() as string]) : ""; e.message = Util.format("fatal error while analyzing class %1%2\n%3", [this.classFullName(), srcPos, e.message]); throw e; } this._analyzeMembers(context); } function _analyzeClassDef (context : AnalysisContext) : void { this._baseClassDef = this.extendType() != null ? this.extendType().getClassDef() : null; var implementClassDefs = this.implementTypes().map.<ClassDefinition>(function (type) { return type.getClassDef(); }); // check that inheritance is not in loop, and that classes are extended, and interfaces / mixins are implemented if ((this.flags() & (ClassDefinition.IS_INTERFACE | ClassDefinition.IS_MIXIN)) == 0) { if (this._baseClassDef != null) { if ((this._baseClassDef.flags() & ClassDefinition.IS_FINAL) != 0) { context.errors.push(new CompileError(this.getToken(), "cannot extend final class '" + this._baseClassDef.classFullName() + "'")); return; } if ((this._baseClassDef.flags() & (ClassDefinition.IS_INTERFACE | ClassDefinition.IS_MIXIN)) != 0) { context.errors.push(new CompileError(this.getToken(), "interfaces (or mixins) should be implemented, not extended")); return; } if (! this._baseClassDef.forEachClassToBase(function (classDef : ClassDefinition) : boolean { if (this == classDef) { context.errors.push(new CompileError(this.getToken(), "class inheritance is in loop")); return false; } return true; })) { return; } } } else { for (var i = 0; i < implementClassDefs.length; ++i) { if ((implementClassDefs[i].flags() & (ClassDefinition.IS_INTERFACE | ClassDefinition.IS_MIXIN)) == 0) { context.errors.push(new CompileError(this.getToken(), "class '" + implementClassDefs[i].classFullName() + "' can only be extended, not implemented")); return; } if (! implementClassDefs[i].forEachClassToBase(function (classDef) { if (this == classDef) { context.errors.push(new CompileError(this.getToken(), "class inheritance is in loop")); return false; } return true; })) { return; } } } // check that none of the mixins are implemented twice var allMixins = new ClassDefinition[]; if (! this.forEachClassToBase(function (classDef) { if ((classDef.flags() & ClassDefinition.IS_MIXIN) != 0) { if (allMixins.indexOf(classDef) != -1) { context.errors.push(new CompileError(this.getToken(), "mixin '" + classDef.classFullName() + "' is implemented twice")); return false; } allMixins.push(classDef); } return true; })) { return; } // check that the properties of the class does not conflict with those in base classes or implemented interfaces for (var i = 0; i < this._members.length; ++i) { this._assertMemberIsDefinable(context, this._members[i], this, this._members[i].getToken()); } // check that the properties of the implemented interfaces does not conflict with those in base classes or other implement interfaces for (var i = 0; i < this._implementTypes.length; ++i) { var interfaceDef = this._implementTypes[i].getClassDef(); for (var j = 0; j < interfaceDef._members.length; ++j) this._assertMemberIsDefinable(context, interfaceDef._members[j], interfaceDef, this._implementTypes[i].getToken()); } // check that the member functions with "override" attribute are in fact overridable if ((this._flags & (ClassDefinition.IS_INTERFACE | ClassDefinition.IS_MIXIN)) == 0) { for (var i = 0; i < this._members.length; ++i) if (this._members[i] instanceof MemberFunctionDefinition && (this._members[i].flags() & ClassDefinition.IS_OVERRIDE) != 0) if (this._assertFunctionIsOverridableInBaseClasses(context, this._members[i] as MemberFunctionDefinition) == null) context.errors.push(new CompileError(this._members[i].getNameToken(), "could not find function definition in base classes / mixins to be overridden")); for (var i = 0; i < this._implementTypes.length; ++i) { if ((this._implementTypes[i].getClassDef().flags() & ClassDefinition.IS_MIXIN) == 0) continue; var theMixin = this._implementTypes[i].getClassDef(); var overrideFunctions = new MemberDefinition[]; theMixin._getMembers(overrideFunctions, true, ClassDefinition.IS_OVERRIDE, ClassDefinition.IS_OVERRIDE); for (var j = 0; j < overrideFunctions.length; ++j) { var done = false; if (this._baseClassDef != null) if (this._baseClassDef._assertFunctionIsOverridable(context, overrideFunctions[j] as MemberFunctionDefinition) != null) done = true; // check sibling interfaces / mixins for (var k = 0; k < i; ++k) { if (this._implementTypes[k].getClassDef()._assertFunctionIsOverridable(context, overrideFunctions[j] as MemberFunctionDefinition) != null) { done = true; break; } } // check parent interfaces / mixins of the mixin for (var k = 0; k < theMixin._implementTypes.length; ++k) { if (theMixin._implementTypes[k].getClassDef()._assertFunctionIsOverridable(context, overrideFunctions[j] as MemberFunctionDefinition) != null) { done = true; break; } } if (! done) context.errors.push(new CompileError(this.getToken(), "could not find function definition to be overridden by '" + overrideFunctions[j].getNotation() + "'")); } } } // check that there are no "abstract" members for a concrete class if ((this._flags & (ClassDefinition.IS_ABSTRACT | ClassDefinition.IS_INTERFACE | ClassDefinition.IS_MIXIN)) == 0) { var abstractMembers = new MemberDefinition[]; this.forEachClassToBase(function (classDef) { return classDef.forEachMember(function (member) { if ((member.flags() & ClassDefinition.IS_ABSTRACT) != 0) { for (var i = 0; i < abstractMembers.length; ++i) { if (ClassDefinition.membersAreEqual(abstractMembers[i], member)) { break; } } if (i == abstractMembers.length) { abstractMembers[i] = member; } } return true; }); }); this.forEachClassToBase(function (classDef) { return classDef.forEachMember(function (member) { if (abstractMembers.length == 0) { return false; } if ((member.flags() & ClassDefinition.IS_ABSTRACT) == 0) { for (var i = 0; i < abstractMembers.length; ++i) { if (ClassDefinition.membersAreEqual(abstractMembers[i], member)) { abstractMembers.splice(i, 1); break; } } } return true; }); }); if (abstractMembers.length != 0) { var msg = "class should be declared as 'abstract' since the following members do not have concrete definition: "; for (var i = 0; i < abstractMembers.length; ++i) { if (i != 0) msg += ", "; msg += abstractMembers[i].getNotation(); } context.errors.push(new CompileError(this.getToken(), msg)); } } // check that there are no conflicting exports (note: conflict names bet. var defs and functions are prohibited anyways) var usedNames = new Map.<MemberDefinition>; this._getMembers([], function (member) { if (! (member instanceof MemberFunctionDefinition)) { return false; } if ((member.flags() & (ClassDefinition.IS_STATIC | ClassDefinition.IS_EXPORT)) != ClassDefinition.IS_EXPORT || member.name() == "constructor") { return false; } if (! usedNames.hasOwnProperty(member.name())) { usedNames[member.name()] = member; return false; } var existingDef = usedNames[member.name()]; if (existingDef.getType().equals(member.getType())) { return false; } context.errors.push( new CompileError(member.getToken(), "methods with __export__ attribute cannot be overloaded") .addCompileNote(new CompileNote(usedNames[member.name()].getToken(), "previously defined here"))); return false; }); // check constructor conflicts var existingExportedCtor = null : MemberFunctionDefinition; this.forEachMemberFunction(function (funcDef) { if ((funcDef.flags() & (ClassDefinition.IS_EXPORT | ClassDefinition.IS_STATIC)) == ClassDefinition.IS_EXPORT && funcDef.name() == "constructor") { if (existingExportedCtor != null) { context.errors.push( new CompileError(funcDef.getToken(), "only one constructor is exportable per class (or interface or mixin), pleaose mark others using the __noexport__ attribute") .addCompileNote(new CompileNote(existingExportedCtor.getToken(), "previously defined here"))); } else { existingExportedCtor = funcDef; } } return true; }); } function _analyzeMembers (context : AnalysisContext) : void { for (var i = 0; i < this._members.length; ++i) { var member = this._members[i]; if (member instanceof MemberFunctionDefinition) { if (! (member instanceof TemplateFunctionDefinition)) { (member as MemberFunctionDefinition).analyze(context); } } else { (member as MemberVariableDefinition).analyze(context); } } } function analyzeUnusedVariables () : void { this.forEachMemberVariable((member) -> { member.getType(); return true; }); } function isConvertibleTo (classDef : ClassDefinition) : boolean { assert classDef != null; if (this == classDef) return true; if (classDef.className() == "Object") return true; if (this._extendType != null && this._extendType.getClassDef().isConvertibleTo(classDef)) return true; for (var i = 0; i < this._implementTypes.length; ++i) if (this._implementTypes[i].getClassDef().isConvertibleTo(classDef)) return true; return false; } function _assertMemberIsDefinable (context : AnalysisContext, member : MemberDefinition, memberClassDef : ClassDefinition, token : Token) : boolean { if ((member.flags() & ClassDefinition.IS_STATIC) != 0) return true; for (var numImplementsToCheck = 0; numImplementsToCheck < this._implementTypes.length; ++numImplementsToCheck) if (memberClassDef == this._implementTypes[numImplementsToCheck].getClassDef()) break; var isCheckingSibling = numImplementsToCheck != this._implementTypes.length; if (member instanceof MemberVariableDefinition) { if (this._extendType != null && ! this._extendType.getClassDef()._assertMemberVariableIsDefinable(context, member as MemberVariableDefinition, memberClassDef, token)) return false; for (var i = 0; i < numImplementsToCheck; ++i) { if (! this._implementTypes[i].getClassDef()._assertMemberVariableIsDefinable(context, member as MemberVariableDefinition, memberClassDef, token)) return false; } } else { // function var isCheckingInterface = (memberClassDef.flags() & ClassDefinition.IS_INTERFACE) != 0; if (this._extendType != null && ! this._extendType.getClassDef()._assertMemberFunctionIsDefinable(context, member as MemberFunctionDefinition, memberClassDef, token, false, isCheckingInterface)) return false; for (var i = 0; i < numImplementsToCheck; ++i) { if (memberClassDef != this._implementTypes[i].getClassDef() && ! this._implementTypes[i].getClassDef()._assertMemberFunctionIsDefinable(context, member as MemberFunctionDefinition, memberClassDef, token, isCheckingSibling, isCheckingInterface)) return false; } } return true; } function _assertMemberVariableIsDefinable (context : AnalysisContext, member : MemberVariableDefinition, memberClassDef : ClassDefinition, token : Token) : boolean { for (var i = 0; i < this._members.length; ++i) { if (this._members[i].name() == member.name()) { if ((this._members[i].flags() & ClassDefinition.IS_ABSTRACT) == 0) { context.errors.push(new CompileError(member.getNameToken(), Util.format("cannot define property '%1', the name is already used in class '%2'", [member.getNotation(), this.classFullName()]))); return false; } if (! this._members[i].getType().equals(member.getType())) { context.errors.push(new CompileError(member.getNameToken(), Util.format("cannot override property '%1' of type '%2' with different type '%3'", [member.getNotation(), this._members[i].getType().toString(), member.getType().toString() ]))); return false; } } } if (this._extendType != null && ! this._extendType.getClassDef()._assertMemberVariableIsDefinable(context, member, memberClassDef, token)) return false; for (var i = 0; i < this._implementTypes.length; ++i) if (! this._implementTypes[i].getClassDef()._assertMemberVariableIsDefinable(context, member, memberClassDef, token)) return false; return true; } function _assertMemberFunctionIsDefinable (context : AnalysisContext, member : MemberFunctionDefinition, memberClassDef : ClassDefinition, token : Token, reportOverridesAsWell : boolean, isCheckingInterface : boolean) : boolean { if (member.name() == "constructor") return true; for (var i = 0; i < this._members.length; ++i) { if (this._members[i].name() != member.name()) continue; if (this._members[i] instanceof MemberVariableDefinition) { var error = new CompileError(member.getNameToken(), "definition of the function conflicts with property '" + this._members[i].getNameToken().getValue() + "'"); error.addCompileNote(new CompileNote(this._members[i].getNameToken(), "property with the same name has been found here")); context.errors.push(error); return false; } if (! Util.typesAreEqual((this._members[i] as MemberFunctionDefinition).getArgumentTypes(), member.getArgumentTypes())) continue; if ((! isCheckingInterface) && ((member.flags() | this._members[i].flags()) & ClassDefinition.IS_STATIC) == 0 && (member.flags() & ClassDefinition.IS_OVERRIDE) == 0) { var error = new CompileError(member.getNameToken(), "overriding functions must have 'override' attribute set"); error.addCompileNote(new CompileNote(this._members[i].getNameToken(), Util.format("defined in base class '%1'", [this.classFullName()]))); context.errors.push(error); return false; } if (reportOverridesAsWell && (this._members[i].flags() & ClassDefinition.IS_OVERRIDE) != 0) { var error = new CompileError(member.getNameToken(), "definition of the function conflicts with sibling mix-in '" + this.classFullName() + "'"); context.errors.push(error); return false; } // assertion of function being overridden does not have 'final' attribute is done by assertFunctionIsOverridable return true; } // delegate to base classes if (this._extendType != null && ! this._extendType.getClassDef()._assertMemberFunctionIsDefinable(context, member, memberClassDef, token, false, isCheckingInterface)) return false; for (var i = 0; i < this._implementTypes.length; ++i) if (! this._implementTypes[i].getClassDef()._assertMemberFunctionIsDefinable(context, member, memberClassDef, token, false, isCheckingInterface)) return false; return true; } function _assertFunctionIsOverridable (context : AnalysisContext, overrideDef : MemberFunctionDefinition) : Nullable.<boolean> { for (var i = 0; i < this._members.length; ++i) { if (this._members[i].name() == overrideDef.name() && this._members[i] instanceof MemberFunctionDefinition && ((this._members[i] as MemberFunctionDefinition).flags() & ClassDefinition.IS_STATIC) == 0 && Util.typesAreEqual((this._members[i] as MemberFunctionDefinition).getArgumentTypes(), overrideDef.getArgumentTypes())) { if ((this._members[i].flags() & ClassDefinition.IS_FINAL) != 0) { context.errors.push(new CompileError(overrideDef.getToken(), "cannot override final function defined in class '" + this.classFullName() + "'")); return false; } var overrideReturnType = overrideDef.getReturnType(); var memberReturnType = (this._members[i] as MemberFunctionDefinition).getReturnType(); if (! (overrideReturnType.equals(memberReturnType) || overrideReturnType.isConvertibleTo(memberReturnType)) || (memberReturnType instanceof NullableType && ! (overrideReturnType instanceof NullableType))) { // only allow narrowing the return type context.errors.push(new CompileError(overrideDef.getToken(), "return type '" + overrideReturnType.toString() + "' is not convertible to '" + memberReturnType.toString() + "'")); return false; } else { return true; } } } return this._assertFunctionIsOverridableInBaseClasses(context, overrideDef); } function _assertFunctionIsOverridableInBaseClasses (context : AnalysisContext, member : MemberFunctionDefinition) : Nullable.<boolean> { if (this._extendType != null) { var ret = this._extendType.getClassDef()._assertFunctionIsOverridable(context, member); if (ret != null) return ret; } for (var i = 0; i < this._implementTypes.length; ++i) { var ret = this._implementTypes[i].getClassDef()._assertFunctionIsOverridable(context, member); if (ret != null) return ret; } return null; } function _getMembers(list : MemberDefinition[], cb : function (member : MemberDefinition) : boolean) : void { // fill in the definitions of base classes if (this._baseClassDef != null) this._baseClassDef._getMembers(list, cb); for (var i = 0; i < this._implementTypes.length; ++i) this._implementTypes[i].getClassDef()._getMembers(list, cb); // fill in the definitions of members for (var i = 0; i < this._members.length; ++i) { if (cb(this._members[i])) list.push(this._members[i]); } } function _getMembers (list : MemberDefinition[], functionOnly : boolean, flagsMask : number, flagsMaskMatch : number) : void { this._getMembers(list, function (member) { if (functionOnly && ! (member instanceof MemberFunctionDefinition)) return false; if ((member.flags() & flagsMask) != flagsMaskMatch) return false; for (var j = 0; j < list.length; ++j) if (list[j].name() == member.name()) if ((list[j] instanceof MemberVariableDefinition) || Util.typesAreEqual((list[j] as MemberFunctionDefinition).getArgumentTypes(), (member as MemberFunctionDefinition).getArgumentTypes())) return false; return true; }); } function hasDefaultConstructor () : boolean { var hasCtorWithArgs = false; for (var i = 0; i < this._members.length; ++i) { var member = this._members[i]; if (member.name() == "constructor" && (member.flags() & ClassDefinition.IS_STATIC) == 0 && member instanceof MemberFunctionDefinition) { if ((member as MemberFunctionDefinition).getArguments().length == 0) return true; hasCtorWithArgs = true; } } return ! hasCtorWithArgs; } static function membersAreEqual (x : MemberDefinition, y : MemberDefinition) : boolean { if (x.name() != y.name()) return false; if (x instanceof MemberFunctionDefinition) { if (! (y instanceof MemberFunctionDefinition)) return false; if (! Util.typesAreEqual((x as MemberFunctionDefinition).getArgumentTypes(), (y as MemberFunctionDefinition).getArgumentTypes())) return false; } else { if (! (y instanceof MemberVariableDefinition)) return false; } return true; } } // abstract class deriving Member(Function|Variable)Definition abstract class MemberDefinition implements Stashable { var _token : Token; var _nameToken : Token; var _flags : number; var _closures : MemberFunctionDefinition[]; var _docComment : DocComment; var _classDef : ClassDefinition; function constructor (token : Token, nameToken : Token, flags : number, closures : MemberFunctionDefinition[], docComment : DocComment) { this._token = token; this._nameToken = nameToken; // may be null this._flags = flags; assert closures != null; this._closures = closures; this._docComment = docComment; this._classDef = null; } abstract function serialize () : variant; abstract function instantiate (instantiationContext : InstantiationContext) : MemberDefinition; abstract function getType () : Type; // token of "function" or "var" function getToken () : Token { return this._token; } function getNameToken () : Token { return this._nameToken; } function name () : string { return this._nameToken.getValue(); } function flags () : number { return this._flags; } function setFlags (flags : number) : void { this._flags = flags; } function getClosures () : MemberFunctionDefinition[] { return this._closures; } function forEachClosure (cb : function(:MemberFunctionDefinition):boolean) : boolean { if (this._closures != null) for (var i = 0; i < this._closures.length; ++i) if (! cb(this._closures[i])) return false; return true; } function getDocComment () : DocComment { return this._docComment; } function setDocComment (docComment : DocComment) : void { this._docComment = docComment; } function getClassDef () : ClassDefinition { return this._classDef; } function setClassDef (classDef : ClassDefinition) : void { this._classDef = classDef; } abstract function getNotation() : string; function _instantiateClosures(instantiationContext : InstantiationContext) : MemberFunctionDefinition[] { var closures = new MemberFunctionDefinition[]; for (var i = 0; i < this._closures.length; ++i) { closures[i] = this._closures[i].instantiate(instantiationContext); } return closures; } function _updateLinkFromExpressionToClosuresUponInstantiation(instantiatedExpr : Expression, instantiatedClosures : MemberFunctionDefinition[]) : void { (function onExpr(expr : Expression) : boolean { if (expr instanceof FunctionExpression) { var idx = this._closures.indexOf((expr as FunctionExpression).getFuncDef()); if (idx == -1) throw new Error("logic flaw, cannot find the closure for " + this.getNotation()); (expr as FunctionExpression).setFuncDef(instantiatedClosures[idx]); } return expr.forEachExpression(onExpr); })(instantiatedExpr); } } class MemberVariableDefinition extends MemberDefinition { static const NOT_ANALYZED = 0; static const IS_ANALYZING = 1; static const ANALYZE_SUCEEDED = 2; static const ANALYZE_FAILED = 3; var _type : Type; // may be null var _initialValue : Expression; // may be null var _analyzeState : number; var _analysisContext : AnalysisContext; function constructor (token : Token, name : Token, flags : number, type : Type, initialValue : Expression, closures : MemberFunctionDefinition[], docComment : DocComment) { super(token, name, flags, closures, docComment); this._type = type; this._initialValue = initialValue; this._analyzeState = MemberVariableDefinition.NOT_ANALYZED; this._analysisContext = null; } override function instantiate (instantiationContext : InstantiationContext) : MemberDefinition { var type = this._type != null ? this._type.instantiate(instantiationContext, false) : null; var initialValue : Expression = null; if (this._initialValue != null) { initialValue = this._initialValue.clone(); initialValue.instantiate(instantiationContext); var closures = this._instantiateClosures(instantiationContext); this._updateLinkFromExpressionToClosuresUponInstantiation(initialValue, closures); } else { closures = [] : MemberFunctionDefinition[]; } return new MemberVariableDefinition(this._token, this._nameToken, this._flags, type, initialValue, closures, null); } override function toString () : string { return this.name() + " : " + this._type.toString(); } override function serialize () : variant { return { "token" : Util.serializeNullable(this._token), "nameToken" : Util.serializeNullable(this._nameToken), "flags" : this.flags(), "type" : Util.serializeNullable(this._type), "initialValue" : Util.serializeNullable(this._initialValue) } : Map.<variant>; } function analyze (context : AnalysisContext) : void { // Just sets the initial values and simple left-to-right type deduction; analysis of member variables is performed lazily (and those that where never analyzed will be removed by dead code elimination) if (this.getInitialValue() == null && (this.getClassDef().flags() & ClassDefinition.IS_NATIVE) != ClassDefinition.IS_NATIVE) { this.setInitialValue(Expression.getDefaultValueExpressionOf(this.getType())); } // left-to-right type deduction if (this.getInitialValue() != null) { var rhs = this.getInitialValue(); // handles v = [] or v = {} if (((rhs instanceof ArrayLiteralExpression && (rhs as ArrayLiteralExpression).getExprs().length == 0) || (rhs instanceof MapLiteralExpression && (rhs as MapLiteralExpression).getElements().length == 0)) && rhs.getType() == null) { if (! AssignmentExpression.analyzeEmptyLiteralAssignment(context, rhs.getToken(), this._type, rhs)) { return; } // ok } } } function setAnalysisContext (context : AnalysisContext) : void { this._analysisContext = context.clone(); } override function getType () : Type { switch (this._analyzeState) { case MemberVariableDefinition.NOT_ANALYZED: this._lazyAnalyze(); break; case MemberVariableDefinition.IS_ANALYZING: this._analysisContext.errors.push(new CompileError(this.getNameToken(), "please declare type of variable '" + this.name() + "' (detected recursion while trying to reduce type)")); break; default: break; } return this._type; } function _lazyAnalyze() : void { try { this._analyzeState = MemberVariableDefinition.IS_ANALYZING; var rhs = this._initialValue; if (rhs != null) { if (! rhs.analyze(this._analysisContext, null)) return; if (rhs.isClassSpecifier()) { this._analysisContext.errors.push(new CompileError(rhs._token, "cannot assign a class")); return; } var ivType = rhs.getType(); if (this._type == null) { if (ivType.equals(Type.nullType)) { this._analysisContext.errors.push(new CompileError(rhs.getToken(), "cannot assign null to an unknown type")); return; } if (ivType.equals(Type.voidType)) { this._analysisContext.errors.push(new CompileError(rhs.getToken(), "cannot assign void")); return; } this._type = ivType.asAssignableType(); } else if (! ivType.isConvertibleTo(this._type)) { this._analysisContext.errors.push(new CompileError(this._nameToken, "the variable is declared as '" + this._type.toString() + "' but initial value is '" + ivType.toString() + "'")); } } this._analyzeState = MemberVariableDefinition.ANALYZE_SUCEEDED; } finally { if (this._analyzeState != MemberVariableDefinition.ANALYZE_SUCEEDED) this._analyzeState = MemberVariableDefinition.ANALYZE_FAILED; } } function getInitialValue () : Expression { return this._initialValue; } function setInitialValue (initialValue : Expression) : void { this._initialValue = initialValue; } override function getNotation() : string { var classDef = this.getClassDef(); var s = (classDef != null ? classDef.classFullName(): "<<unknown:"+(this._token.getFilename() ?: "?")+">>"); s += (this.flags() & ClassDefinition.IS_STATIC) != 0 ? "." : "#"; s += this.name(); return s; } } class MemberFunctionDefinition extends MemberDefinition implements Block { var _returnType : Type; var _args : ArgumentDeclaration[]; var _locals : LocalVariable[]; var _statements : Statement[]; var _lastTokenOfBody : Token; var _parent : MemberFunctionDefinition; // null for the outermost closure of static variable initialization expression var _funcLocal : LocalVariable; function constructor (token : Token, name : Token, flags : number, returnType : Type, args : ArgumentDeclaration[], locals : LocalVariable[], statements : Statement[], closures : MemberFunctionDefinition[], lastTokenOfBody : Token, docComment : DocComment) { super(token, name, flags, closures, docComment); this._returnType = returnType; this._args = args; this._locals = locals; this._statements = statements; this._lastTokenOfBody = lastTokenOfBody; this._parent = null; this._funcLocal = null; this._classDef = null; for (var i = 0; i < this._closures.length; ++i) this._closures[i].setParent(this); } function isAnonymous() : boolean { // for anonymous function expression return this._nameToken == null; } function isGenerator() : boolean { return (this._flags & ClassDefinition.IS_GENERATOR) != 0; } /** * Returns a simple notation of the function like "Class.classMethod(:string):void" or "Class.instanceMethod(:string):void". */ override function getNotation() : string { var classDef = this.getClassDef(); var s = (classDef != null ? classDef.classFullName(): "<<unknown:"+(this._token.getFilename() ?: "?")+">>"); s += (this.flags() & ClassDefinition.IS_STATIC) != 0 ? "." : "#"; s += this.getNameToken() != null ? this.name() : "$" + this.getToken().getLineNumber() + "_" + this.getToken().getColumnNumber(); s += "("; s += this._args.map.<string>(function (arg) { return ":" + (arg.getType() ? arg.getType().toString() : "null"); }).join(","); s += ")"; return s; } override function toString () : string { var argsText = this._args.map.<string>(function (arg) { return arg.getName().getValue() + " : " + arg.getType().toString(); }).join(", "); return "function " + this.name() + "(" + argsText + ") : " + this._returnType.toString(); } class _CloneStash extends Stash { var newLocal : LocalVariable; var newFuncDef : MemberFunctionDefinition; function constructor () { this.newLocal = null; this.newFuncDef = null; } function constructor (that : MemberFunctionDefinition._CloneStash) { this.newLocal = that.newLocal; this.newFuncDef = that.newFuncDef; } override function clone () : MemberFunctionDefinition._CloneStash { return new MemberFunctionDefinition._CloneStash(this); } } function clone () : MemberFunctionDefinition { var stashesUsed = new MemberFunctionDefinition._CloneStash[]; function getStash(stashable : Stashable) : MemberFunctionDefinition._CloneStash { var stash = stashable.getStash("CLONE-FUNC-DEF"); if (stash == null) { stash = stashable.setStash("CLONE-FUNC-DEF", new MemberFunctionDefinition._CloneStash); } stashesUsed.push(stash as MemberFunctionDefinition._CloneStash); return stash as MemberFunctionDefinition._CloneStash; } function cloneFuncDef (funcDef : MemberFunctionDefinition) : MemberFunctionDefinition { // at this moment, all locals and closures are not cloned yet var statements = Util.cloneArray(funcDef.getStatements()); var closures = funcDef.getClosures().map.<MemberFunctionDefinition>((funcDef) -> { var newFuncDef = cloneFuncDef(funcDef); getStash(funcDef).newFuncDef = newFuncDef; return newFuncDef; }); // rewrite funcDefs Util.forEachStatement(function onStatement(statement : Statement) : boolean { if (statement instanceof FunctionStatement) { var newFuncDef; if ((newFuncDef = getStash((statement as FunctionStatement).getFuncDef()).newFuncDef) != null) { (statement as FunctionStatement).setFuncDef(newFuncDef); } return true; } return statement.forEachExpression(function onExpr(expr : Expression, replaceCb : function(:Expression):void) : boolean { if (expr instanceof FunctionExpression) { var newFuncDef; if ((newFuncDef = getStash((expr as FunctionExpression).getFuncDef()).newFuncDef) != null) { (expr as FunctionExpression).setFuncDef(newFuncDef); } return true; } return expr.forEachExpression(onExpr); }) && statement.forEachStatement(onStatement); }, statements); var funcLocal = funcDef.getFuncLocal(); if (funcLocal != null) { var newFuncLocal; if ((newFuncLocal = getStash(funcLocal).newLocal) != null) { // funcDef is defined as a function statement // ok } else { // clone newFuncLocal = new LocalVariable(funcLocal.getName(), funcLocal.getType(), funcLocal.isConstant()); getStash(funcLocal).newLocal = newFuncLocal; } funcLocal = newFuncLocal; } var args = funcDef.getArguments().map.<ArgumentDeclaration>((arg) -> { var newArg = arg.clone(); getStash(arg).newLocal = newArg; return newArg; }); var locals = funcDef.getLocals().map.<LocalVariable>((local) -> { var newLocal; if ((newLocal = getStash(local).newLocal) != null) { // in case local is a name of a function statement and the function statement already cloned return newLocal; } newLocal = new LocalVariable(local.getName(), local.getType(), local.isConstant()); getStash(local).newLocal = newLocal; return newLocal; }); // FIXME special hack: CatchStatement#clone does not clone and rewrite its caught variable Util.forEachStatement(function onStatement(statement : Statement) : boolean { if (statement instanceof CatchStatement) { var caughtVar = (statement as CatchStatement).getLocal().clone(); getStash((statement as CatchStatement).getLocal()).newLocal = caughtVar; (statement as CatchStatement).setLocal(caughtVar); } else if (statement instanceof FunctionStatement) { (statement as FunctionStatement).getFuncDef().forEachStatement(onStatement); } return statement.forEachExpression(function onExpr(expr, replaceCb) { if (expr instanceof FunctionExpression) { return (expr as FunctionExpression).getFuncDef().forEachStatement(onStatement); } return expr.forEachExpression(onExpr); }) && statement.forEachStatement(onStatement); }, statements); // rewrite locals Util.forEachStatement(function onStatement(statement : Statement) : boolean { if (statement instanceof FunctionStatement) { (statement as FunctionStatement).getFuncDef().forEachStatement(onStatement); } return statement.forEachExpression(function onExpr(expr : Expression, replaceCb : function(:Expression):void) : boolean { if (expr instanceof LocalExpression) { var newLocal; if ((newLocal = getStash((expr as LocalExpression).getLocal()).newLocal) != null) { (expr as LocalExpression).setLocal(newLocal); } } else if (expr instanceof FunctionExpression) { return (expr as FunctionExpression).getFuncDef().forEachStatement(onStatement); } return expr.forEachExpression(onExpr); }) && statement.forEachStatement(onStatement); }, statements); var clonedFuncDef = new MemberFunctionDefinition( funcDef.getToken(), funcDef.getNameToken(), funcDef.flags(), funcDef.getReturnType(), args, locals, statements, closures, funcDef._lastTokenOfBody, null ); clonedFuncDef.setFuncLocal(funcLocal); clonedFuncDef.setClassDef(this.getClassDef()); return clonedFuncDef; } var clonedFuncDef = cloneFuncDef(this); // erase stashes of original funcDef for (var i = 0; i < stashesUsed.length; ++i) { var stash = stashesUsed[i]; stash.newLocal = null; stash.newFuncDef = null; } if (this._parent == null) { var classDef = this._classDef; if (classDef == null) { // an orphan funcDef } else { // register to the classDef classDef.members().splice(classDef.members().indexOf(this)+1, 0, clonedFuncDef); // insert right after the original function } } else { this._parent.getClosures().push(clonedFuncDef); clonedFuncDef.setParent(this._parent); } return clonedFuncDef; } override function instantiate (instantiationContext : InstantiationContext) : MemberFunctionDefinition { return this._instantiateCore( instantiationContext, function (token, name, flags, returnType, args, locals, statements, closures, lastTokenOfBody, docComment) { return new MemberFunctionDefinition(token, name, flags, returnType, args, locals, statements, closures, lastTokenOfBody, docComment); }); } function _instantiateCore (instantiationContext : InstantiationContext, constructCallback : function(:Token,:Token,:number,:Type,:ArgumentDeclaration[],:LocalVariable[],:Statement[],:MemberFunctionDefinition[],:Token,:DocComment):MemberFunctionDefinition) : MemberFunctionDefinition { // rewrite arguments (and push the instantiated args) var args = new ArgumentDeclaration[]; for (var i = 0; i < this._args.length; ++i) { args[i] = this._args[i].instantiateAndPush(instantiationContext); } // rewrite function body if (this._statements != null) { // clone and rewrite the types of local variables var locals = new LocalVariable[]; for (var i = 0; i < this._locals.length; ++i) { locals[i] = this._locals[i].instantiateAndPush(instantiationContext); } var caughtVariables = new CaughtVariable[]; // stored by the order they are defined, and 'shift'ed Util.forEachStatement(function onStatement(statement : Statement) : boolean { if (statement instanceof CatchStatement) { caughtVariables.push((statement as CatchStatement).getLocal().instantiateAndPush(instantiationContext)); } return statement.forEachStatement(onStatement); }, this._statements); // clone and rewrite the types of the statements var statements = new Statement[]; for (var i = 0; i < this._statements.length; ++i) { if (this._statements[i] instanceof ConstructorInvocationStatement) { // ConstructorInvocationStatement only appears at the top level of the function statements[i] = (this._statements[i] as ConstructorInvocationStatement).instantiate(instantiationContext); } else { statements[i] = this._statements[i].clone(); } } Util.forEachStatement(function onStatement(statement : Statement) : boolean { if (statement instanceof CatchStatement) { if (caughtVariables.length == 0) throw new Error("logic flaw"); (statement as CatchStatement).setLocal(caughtVariables.shift()); } statement.forEachExpression(function (expr : Expression) : boolean { return expr.instantiate(instantiationContext); }); return statement.forEachStatement(onStatement); }, statements); // clone and rewrite the types of closures var closures = this._instantiateClosures(instantiationContext); // pop the instantiated locals for (var i = 0; i < this._locals.length; ++i) { if (this._locals[i].isInstantiated) throw new Error("logic flaw"); this._locals[i].popInstantiated(); } if (caughtVariables.length != 0) throw new Error("logic flaw"); Util.forEachStatement(function onStatement(statement : Statement) : boolean { if (statement instanceof CatchStatement) { (statement as CatchStatement).getLocal().popInstantiated(); } return statement.forEachStatement(onStatement); }, this._statements); // update the link from function expressions to closures Util.forEachStatement(function onStatement(statement : Statement) : boolean { if (statement instanceof FunctionStatement) { var idx = this._closures.indexOf((statement as FunctionStatement).getFuncDef()); if (i == -1) throw new Error("logic flaw, cannot find the closure for " + this.getNotation()); (statement as FunctionStatement).setFuncDef(closures[idx]); return true; } statement.forEachExpression(function (expr) { this._updateLinkFromExpressionToClosuresUponInstantiation(expr, closures); return true; }); return statement.forEachStatement(onStatement); }, statements); } else { locals = null; statements = null; closures = new MemberFunctionDefinition[]; } // pop the instantiated args for (var i = 0; i < this._args.length; ++i) this._args[i].popInstantiated(); // do the rest if (this._returnType != null) { var returnType = this._returnType.instantiate(instantiationContext, true); if (returnType == null) return null; } else { returnType = null; } return constructCallback(this._token, this._nameToken, this._flags, returnType, args, locals, statements, closures, this._lastTokenOfBody, this._docComment); } override function serialize () : variant { return { "token" : Util.serializeNullable(this._token), "nameToken" : Util.serializeNullable(this._nameToken), "flags" : this.flags(), "returnType" : Util.serializeNullable(this._returnType), "args" : Util.serializeArray(this._args), "locals" : Util.serializeArray(this._locals), "statements" : Util.serializeArray(this._statements) } : Map.<variant>; } var _analyzed = false; function analyze (outerContext : AnalysisContext) : void { if (this._analyzed == true) { return; } this._analyzed = true; // validate jsxdoc comments if ((this.flags() & ClassDefinition.IS_GENERATED) == 0) { var docComment = this.getDocComment(); if (docComment) { var args = this.getArguments(); docComment.getParams().forEach(function (docParam : DocCommentParameter, i : number) : void { for(; i < args.length; ++i) { if (args[i].getName().getValue() == docParam.getParamName()) { return; } } // invalid @param tag which is not present in the declaration. outerContext.errors.push(new CompileError(docParam.getToken(), 'invalid parameter name "' + docParam.getParamName() + '" for ' + this.name() + "()")); }); } } // return if is abtract (wo. function body) or is native if (this._statements == null) return; // setup context var context = outerContext.clone().setFuncDef(this); if (this._parent == null) { context.setBlockStack([ new BlockContext(new LocalVariableStatuses(this, null), this) ]); } else { context.setBlockStack(outerContext.blockStack); context.blockStack.push(new BlockContext(new LocalVariableStatuses(this, outerContext.getTopBlock().localVariableStatuses), this)); // make this function visible inside it if (! this.isAnonymous()) { if (this._returnType != null) { context.getTopBlock().localVariableStatuses._statuses[this.name()] = LocalVariableStatuses.ISSET; } else { // ban on recursive function without the return type declared context.getTopBlock().localVariableStatuses._statuses[this.name()] = LocalVariableStatuses.UNTYPED_RECURSIVE_FUNCTION; } } } try { // do the checks for (var i = 0; i < this._statements.length; ++i) if (! this._statements[i].analyze(context)) break; if (this._returnType == null) // no return statement in body this._returnType = Type.voidType; if (this.isGenerator()) { // ok } else { if (! this._returnType.equals(Type.voidType) && context.getTopBlock().localVariableStatuses.isReachable()) context.errors.push(new CompileError(this._lastTokenOfBody, "missing return statement")); } if (this._parent == null && this.getNameToken() != null && this.name() == "constructor") { this._fixupConstructor(context); } } finally { context.blockStack.pop(); } if (this._funcLocal != null) { this._funcLocal.setTypeForced(this.getType()); } this.getLocals().forEach((local) -> { if (! local.isUsedAsRHS()) { context.errors.push(new UnusedWarning(local.getName(), "unused variable " + local.getName().getValue())); } }); } function generateWrappersForDefaultParameters() : void { // `function f(a, b = x)` makes `f(a) { f(a, x) }` function createObjectType(classDef : ClassDefinition) : ObjectType { if (classDef instanceof TemplateClassDefinition) { var typeArgs = (classDef as TemplateClassDefinition).getTypeArguments().map.<Type>((token) -> { return new ParsedObjectType(new QualifiedName(token), new Type[]); }); return new ParsedObjectType(new QualifiedName(classDef.getToken()), typeArgs); } else { return new ObjectType(classDef); } } // skip arguments wo. default parameters for (var origArgIndex = 0; origArgIndex != this.getArguments().length; ++origArgIndex) { if (this.getArguments()[origArgIndex].getDefaultValue() != null) { break; } } // generate for (; origArgIndex != this.getArguments().length; ++origArgIndex) { // build list of formal args (of the generated function) var formalArgs = this.getArguments().slice(0, origArgIndex).map.<ArgumentDeclaration>((arg) -> { return new ArgumentDeclaration(arg.getName(), arg.getType()); }); // build function body var argExprs = formalArgs.map.<Expression>((arg) -> { return new LocalExpression(arg.getName(), arg); }); for (var i = origArgIndex; i != this.getArguments().length; ++i) { var defVal = this.getArguments()[i].getDefaultValue(); assert defVal != null; argExprs.push(defVal.clone()); } var statement : Statement; if (this.name() == "constructor") { statement = new ConstructorInvocationStatement(new Token("this", false), createObjectType(this.getClassDef()), argExprs); } else { var invocant = (this.flags() & ClassDefinition.IS_STATIC) == 0 ? new ThisExpression(new Token("this", false), this.getClassDef()) : new ClassExpression(new Token(this.getClassDef().className(), true), createObjectType(this.getClassDef())); var methodRef = new PropertyExpression(new Token(".", false), invocant, this.getNameToken(), this.getArgumentTypes()); var callExpression = new CallExpression(new Token("(", false), methodRef, argExprs); statement = new ReturnStatement(new Token("return", false), callExpression); } // build function if (!(this instanceof TemplateFunctionDefinition)) { var wrapper = new MemberFunctionDefinition( this.getToken(), this.getNameToken(), this.flags() | ClassDefinition.IS_INLINE | ClassDefinition.IS_GENERATED, this.getReturnType(), formalArgs, new LocalVariable[], [statement], this.getClosures().slice(0), this._lastTokenOfBody, this._docComment); } else { throw new Error("TODO: template function with default parameters in " + this.getNotation() + " is not yet supported"); } wrapper.setClassDef(this.getClassDef()); // register this.getClassDef().members().splice(this.getClassDef().members().indexOf(this)+1, 0, wrapper); // insert right after the original function // fix up function links inside defVal Util.forEachExpression(function onExpr(expr) { if (expr instanceof FunctionExpression) { var newFuncDef = (expr as FunctionExpression).getFuncDef().clone(); Util.unlinkFunction(newFuncDef, this); Util.linkFunction(newFuncDef, wrapper); (expr as FunctionExpression).setFuncDef(newFuncDef); return true; } return expr.forEachExpression(onExpr);; }, argExprs); } } function _fixupConstructor (context : AnalysisContext) : void { var success = true; var isAlternate = false; if ((this._flags & ClassDefinition.IS_GENERATOR) != 0) { context.errors.push(new CompileError(this._token, "constructor must not be a generator")); return; } // make implicit calls to default constructor explicit as well as checking the invocation order var stmtIndex = 0; if (stmtIndex < this._statements.length && this._statements[stmtIndex] instanceof ConstructorInvocationStatement && (this._statements[stmtIndex] as ConstructorInvocationStatement).getConstructingClassDef() == this._classDef) { // alternate constructor invocation isAlternate = true; ++stmtIndex; } else { for (var baseIndex = 0; baseIndex <= this._classDef.implementTypes().length; ++baseIndex) { var baseClassType = baseIndex == 0 ? this._classDef.extendType() : this._classDef.implementTypes()[baseIndex - 1]; if (baseClassType != null) { if (stmtIndex < this._statements.length && this._statements[stmtIndex] instanceof ConstructorInvocationStatement && baseClassType.getClassDef() == (this._statements[stmtIndex] as ConstructorInvocationStatement).getConstructingClassDef()) { // explicit call to the base class, no need to complement if (baseClassType.getToken().getValue() == "Object") this._statements.splice(stmtIndex, 1); else ++stmtIndex; } else { // insert call to the default constructor if (baseClassType.getClassDef().className() == "Object") { // we can omit the call } else if (baseClassType.getClassDef().hasDefaultConstructor()) { var ctorStmt = new ConstructorInvocationStatement(this._token, baseClassType, new Expression[]); this._statements.splice(stmtIndex, 0, ctorStmt); if (! ctorStmt.analyze(context)) throw new Error("logic flaw"); ++stmtIndex; } else { if (stmtIndex < this._statements.length) { context.errors.push(new CompileError(this._statements[stmtIndex].getToken(), "constructor of class '" + baseClassType.toString() + "' should be called prior to the statement")); } else { context.errors.push(new CompileError(this._token, "super class '" + baseClassType.toString() + "' should be initialized explicitely (no default constructor)")); } success = false; } } } } } for (; stmtIndex < this._statements.length; ++stmtIndex) { if (! (this._statements[stmtIndex] instanceof ConstructorInvocationStatement)) break; context.errors.push(new CompileError(this._statements[stmtIndex].getToken(), "constructors should be invoked in the order they are implemented")); success = false; } // NOTE: it is asserted by the parser that ConstructorInvocationStatements precede other statements if (! success) return; if (isAlternate) { return; // all the properties are initialized by the alternate constructor } var normalStatementFromIndex = stmtIndex; // find out the properties that need to be initialized (that are not initialized by the ctor explicitely before completion or being used) var initProperties = new Map.<boolean>; this._classDef.forEachMemberVariable(function (member) { if ((member.flags() & (ClassDefinition.IS_STATIC | ClassDefinition.IS_ABSTRACT)) == 0) initProperties[member.name()] = true; return true; }); for (var i = normalStatementFromIndex; i < this._statements.length; ++i) { if (! (this._statements[i] instanceof ExpressionStatement)) break; function onExpr(expr : Expression) : boolean { /* FIXME if the class is extending a native class and the expression is setting a property of the native class, then we should break, since it might have side effects (e.g. the property might be defined as a setter) */ if (expr instanceof AssignmentExpression) { var assignExpr = expr as AssignmentExpression; if (! onExpr(assignExpr.getSecondExpr())) { return false; } var lhsExpr = assignExpr.getFirstExpr(); if (lhsExpr instanceof PropertyExpression && (lhsExpr as PropertyExpression).getExpr() instanceof ThisExpression) { initProperties[(lhsExpr as PropertyExpression).getIdentifierToken().getValue()] = false; return true; } } else if (expr instanceof ThisExpression || expr instanceof FunctionExpression) { return false; } return expr.forEachExpression(onExpr); } var canContinue = this._statements[i].forEachExpression(onExpr); if (! canContinue) break; } // insert the initializers var insertStmtAt = normalStatementFromIndex; this._classDef.forEachMemberVariable(function (member) { if ((member.flags() & (ClassDefinition.IS_STATIC | ClassDefinition.IS_ABSTRACT)) == 0) { if (initProperties[member.name()]) { var stmt = new ExpressionStatement( new AssignmentExpression(new Token("=", false), new PropertyExpression(new Token(".", false), new ThisExpression(new Token("this", false), this._classDef), member.getNameToken(), new Type[], member.getType()), member.getInitialValue())); this._statements.splice(insertStmtAt++, 0, stmt); } } return true; }); } function getReturnType () : Type { return this._returnType; } function setReturnType (type : Type) : void { this._returnType = type; } function getArguments () : ArgumentDeclaration[] { return this._args; } function getArgumentTypes () : Type[] { var argTypes = new Type[]; for (var i = 0; i < this._args.length; ++i) argTypes[i] = this._args[i].getType(); return argTypes; } function getFuncLocal () : LocalVariable { return this._funcLocal; } function setFuncLocal (funcLocal : LocalVariable) : void { this._funcLocal = funcLocal; } function getParent () : MemberFunctionDefinition { return this._parent; } function setParent (parent : MemberFunctionDefinition) : void { this._parent = parent; } // return list of local variables (omitting arguments) function getLocals () : LocalVariable[] { return this._locals; } function getStatements () : Statement[] { return this._statements; } function setStatements (statements : Statement[]) : void { this._statements = statements; } // return an argument or a local variable function getLocal (context : AnalysisContext, name : string) : LocalVariable { // for the current function, check the caught variables for (var i = context.blockStack.length - 1; i >= 0; --i) { var block = context.blockStack[i].block; if (block instanceof MemberFunctionDefinition) { // function scope for (var j = 0; j < (block as MemberFunctionDefinition)._locals.length; ++j) { var local = (block as MemberFunctionDefinition)._locals[j]; if (local.getName().getValue() == name) return local; } for (var j = 0; j < (block as MemberFunctionDefinition)._args.length; ++j) { var arg = (block as MemberFunctionDefinition)._args[j]; if (arg.getName().getValue() == name) return arg; } } else if (block instanceof CatchStatement) { // catch statement var local = (block as CatchStatement).getLocal(); if (local.getName().getValue() == name) return local; } } return null; } override function getType () : ResolvedFunctionType { return (this._flags & ClassDefinition.IS_STATIC) != 0 ? new StaticFunctionType(this._token, this._returnType, this.getArgumentTypes(), false) : new MemberFunctionType(this._token, new ObjectType(this._classDef), this._returnType, this.getArgumentTypes(), false); } function deductTypeIfUnknown (context : AnalysisContext, type : ResolvedFunctionType) : boolean { // first, check if there are any unresolved types for (var i = 0; i < this._args.length; ++i) { if (this._args[i].getType() == null) break; } if (i == this._args.length && this._returnType != null) { if (this._funcLocal != null) this._funcLocal.setTypeForced(this.getType()); return true; } // resolve! if (type.getArgumentTypes().length != this._args.length) { context.errors.push(new CompileError(this.getToken(), "expected the function to have " + type.getArgumentTypes().length as string + " arguments, but found " + this._args.length as string)); return false; } else if (this._args.length != 0 && type.getArgumentTypes()[this._args.length - 1] instanceof VariableLengthArgumentType) { context.errors.push(new CompileError(this.getToken(), "could not deduct function argument (left hand expression is a function with an variable-length argument)")); return false; } for (var i = 0; i < this._args.length; ++i) { if (type.getArgumentTypes()[i] != null) { if (this._args[i].getType() != null) { if (! this._args[i].getType().equals(type.getArgumentTypes()[i])) { context.errors.push(new CompileError(this.getToken(), "detected type conflict for argument '" + this._args[i].getName().getValue() + "' (expected '" + type.getArgumentTypes()[i].toString() + "' but found '" + this._args[i].getType().toString() + "'")); return false; } } else { this._args[i].setTypeForced(type.getArgumentTypes()[i]); } } } if (type.getReturnType() != null) { if (this._returnType != null) { if (! this._returnType.equals(type.getReturnType())) { context.errors.push(new CompileError(this.getToken(), "detected return type conflict, expected '" + type.getReturnType().toString() + "' but found '" + this._returnType.toString() + "'")); return false; } } else { this._returnType = type.getReturnType(); } } if (this._funcLocal != null) this._funcLocal.setTypeForced(this.getType()); return true; } function forEachStatement (cb : function(:Statement):boolean) : boolean { return Util.forEachStatement(cb, this._statements); } function forEachStatement (cb : function(:Statement,:function(:Statement):void):boolean) : boolean { return Util.forEachStatement(cb, this._statements); } } class InstantiatedMemberFunctionDefinition extends MemberFunctionDefinition { function constructor (token : Token, name : Token, flags : number, returnType : Type, args : ArgumentDeclaration[], locals : LocalVariable[], statements : Statement[], closures : MemberFunctionDefinition[], lastTokenOfBody : Token, docComment : DocComment) { super(token, name, flags, returnType, args, locals, statements, closures, lastTokenOfBody, docComment); } } class TemplateFunctionDefinition extends MemberFunctionDefinition implements TemplateDefinition { var _typeArgs : Token[]; var _resolvedTypemap : Map.<Type>; var _instantiatedDefs : TypedMap.<Type[], MemberFunctionDefinition>; function constructor (token : Token, name : Token, flags : number, typeArgs : Token[], returnType : Type, args : ArgumentDeclaration[], locals : LocalVariable[], statements : Statement[], closures : MemberFunctionDefinition[], lastTokenOfBody : Token, docComment : DocComment) { super(token, name, flags, returnType, args, locals, statements, closures, lastTokenOfBody, docComment); this._typeArgs = typeArgs.concat(new Token[]); this._instantiatedDefs = new TypedMap.<Type[], MemberFunctionDefinition>(function (x, y) { for (var i = 0; i < x.length; ++i) { if (! x[i].equals(y[i])) { return false; } } return true; }); this._resolvedTypemap = new Map.<Type>; } override function getType () : TemplateFunctionType { return new TemplateFunctionType(this._token, this); } function getResolvedTypemap () : Map.<Type> { return this._resolvedTypemap; } function getTypeArguments () : Token[] { return this._typeArgs; } override function instantiate (instantiationContext : InstantiationContext) : MemberFunctionDefinition { var instantiated = new TemplateFunctionDefinition( this._token, this.getNameToken(), this.flags(), this._typeArgs.concat([]), this._returnType, this._args.concat([]), this._locals, this._statements, this._closures, this._lastTokenOfBody, this._docComment); for (var k in this._resolvedTypemap) { instantiated._resolvedTypemap[k] = this._resolvedTypemap[k]; } for (var k in instantiationContext.typemap) { instantiated._resolvedTypemap[k] = instantiationContext.typemap[k]; } return instantiated; } function instantiateByArgumentTypes (errors : CompileError[], notes : CompileNote[], token : Token, actualArgTypes : Type[], exact : boolean) : MemberFunctionDefinition { // notes is for reporting compiler notes when instantiaiton fails, errors is delegated to semantic analysis in instantiated funcDef var typemap = new Map.<Type>; for (var i = 0; i < this._typeArgs.length; ++i) { typemap[this._typeArgs[i].getValue()] = null; } for (var k in this._resolvedTypemap) { typemap[k] = this._resolvedTypemap[k]; } function unify (formal : Type, actual : Type) : boolean { // formal is a type parameter if (formal instanceof ParsedObjectType && (formal as ParsedObjectType).getTypeArguments().length == 0 && (formal as ParsedObjectType).getQualifiedName().getImport() == null && (formal as ParsedObjectType).getQualifiedName().getEnclosingType() == null && typemap.hasOwnProperty((formal as ParsedObjectType).getToken().getValue())) { var expectedType = typemap[(formal as ParsedObjectType).getToken().getValue()]; if (expectedType != null) { // already unified, check if arg type is the expected one if (exact && ! expectedType.equals(actual)) { // no need to report a compile note when exact matching return false; } if (! actual.isConvertibleTo(expectedType)) { notes.push(new CompileNote(token, "expected " + expectedType.toString() + ", but got " + actual.toString())); return false; } } else { typemap[(formal as ParsedObjectType).getToken().getValue()] = actual; } } else if (formal instanceof ParsedObjectType) { if (! (actual instanceof ObjectType)) { notes.push(new CompileNote(token, "expected " + formal.toString() + ", but got " + actual.toString())); return false; } // TODO import // TODO enclosing types assert (formal as ParsedObjectType).getQualifiedName().getImport() == null; assert (formal as ParsedObjectType).getQualifiedName().getEnclosingType() == null; var parser = this._classDef.getParser(); if ((formal as ParsedObjectType).getTypeArguments().length == 0) { (formal as ParsedObjectType).resolveType(new AnalysisContext(errors, parser, null)); if (! actual.isConvertibleTo(formal)) { notes.push(new CompileNote(token, "expected " + formal.toString() + ", but got " + actual.toString())); return false; } } else { var formalClassDef = (formal as ParsedObjectType).getQualifiedName().getTemplateClass(parser); assert (! (actual instanceof ParsedObjectType)) || (actual as ParsedObjectType)._classDef != null; var actualClassDef = (actual as ObjectType).getClassDef(); if (formalClassDef == null) { notes.push(new CompileNote(token, "not matching class definition " + formal.toString())); return false; } assert actualClassDef != null; if (! (actualClassDef instanceof InstantiatedClassDefinition && formalClassDef == (actualClassDef as InstantiatedClassDefinition).getTemplateClass())) { notes.push(new CompileNote(token, "expected " + formal.toString() + ", but got " + actual.toString())); return false; } var formalTypeArgs = (formal as ParsedObjectType).getTypeArguments(); var actualTypeArgs = (actualClassDef as InstantiatedClassDefinition).getTypeArguments(); assert formalTypeArgs.length == actualTypeArgs.length; for (var i = 0; i < formalTypeArgs.length; ++i) { if (! unify(formalTypeArgs[i], actualTypeArgs[i])) { return false; } } } } else if (formal instanceof NullableType) { if (! unify((formal as NullableType).getBaseType(), actual)) { return false; } } else if (formal instanceof StaticFunctionType) { if (! (actual instanceof StaticFunctionType)) { notes.push(new CompileNote(token, "expected " + formal.toString() + ", but got " + actual.toString())); return false; } var formalFuncType = formal as StaticFunctionType; var actualFuncType = actual as StaticFunctionType; if (formalFuncType.getArgumentTypes().length != actualFuncType.getArgumentTypes().length) { notes.push(new CompileNote(token, "expected " + formal.toString() + ", but got " + actual.toString())); return false; } // unify recursively for (var i = 0; i < formalFuncType.getArgumentTypes().length; ++i) { if (! unify(formalFuncType.getArgumentTypes()[i], actualFuncType.getArgumentTypes()[i])) return false; } if (! unify(formalFuncType.getReturnType(), actualFuncType.getReturnType())) return false; } else { // formal is a primitive type if (exact && ! formal.equals(actual)) { // no need to report a compile note when exact matching return false; } if (! actual.isConvertibleTo(formal)) { notes.push(new CompileNote(token, "expected " + formal.toString() + ", but got " + actual.toString())); return false; } } return true; } // infer type parameters from actual arguments var formalArgTypes = this.getArgumentTypes(); for (var i = 0; i < formalArgTypes.length; ++i) { if (! unify(formalArgTypes[i], actualArgTypes[i])) break; } if (i != formalArgTypes.length) return null; // run instantiation if typemap satisfies all type parameters var typeArgs = new Type[]; for (var i = 0; i < this._typeArgs.length; ++i) { if ((typeArgs[i] = typemap[this._typeArgs[i].getValue()]) == null) break; } if (i != this._typeArgs.length) { var remains = new string[]; this._typeArgs.forEach((typeArg) -> { if (typemap[typeArg.getValue()] == null) { remains.push(typeArg.getValue()); } }); notes.push(new CompileNote(token, "cannot decide type parameter(s) from given argument expressions: " + remains.join(", "))); return null; } else { return this.instantiateTemplateFunction(errors, token, typeArgs); } } function instantiateTemplateFunction (errors : CompileError[], token : Token, typeArgs : Type[]) : MemberFunctionDefinition { // return the already-instantiated one, if exists var instantiated : MemberFunctionDefinition = this._instantiatedDefs.get(typeArgs); if (instantiated != null) { return instantiated; } // instantiate var instantiationContext = this.buildInstantiationContext(errors, token, this._typeArgs, typeArgs); if (instantiationContext == null) { return null; } for (var k in this._resolvedTypemap) { instantiationContext.typemap[k] = this._resolvedTypemap[k]; } instantiated = this._instantiateCore( instantiationContext, function (token, name, flags, returnType, args, locals, statements, closures, lastTokenOfBody, docComment) { return new InstantiatedMemberFunctionDefinition(token, name, flags, returnType, args, locals, statements, closures, lastTokenOfBody, docComment); }); if (instantiated == null) { return null; } instantiated.setClassDef(this._classDef); this._classDef._members.push(instantiated); var analysisContext = new AnalysisContext(errors, this._classDef.getParser(), function (parser, classDef) { throw new Error("not implemented"); }); for (var i = 0; i < instantiationContext.objectTypesUsed.length; ++i) instantiationContext.objectTypesUsed[i].resolveType(analysisContext); instantiated.analyze(analysisContext); // register, and return this._instantiatedDefs.set(typeArgs.concat(new Type[]), instantiated); return instantiated; } } class TemplateClassDefinition extends ClassDefinition implements TemplateDefinition { var _typeArgs : Token[]; function constructor (token : Token, className : string, flags : number, typeArgs : Token[], extendType : ParsedObjectType, implementTypes : ParsedObjectType[], members : MemberDefinition[], inners : ClassDefinition[], templateInners : TemplateClassDefinition[], objectTypesUsed : ParsedObjectType[], docComment : DocComment) { super(token, className, flags, extendType, implementTypes, members, inners, templateInners, objectTypesUsed, docComment); this._token = token; this._className = className; this._flags = flags; this._typeArgs = typeArgs.concat(new Token[]); this._generateWrapperFunctions(); } override function getToken () : Token { return this._token; } override function className () : string { return this._className; } override function flags () : number { return this._flags; } function getTypeArguments () : Token[] { return this._typeArgs; } override function instantiate (instantiationContext : InstantiationContext) : TemplateClassDefinition { // shadow type args var typemap = new Map.<Type>; for (var key in instantiationContext.typemap) { typemap[key] = instantiationContext.typemap[key]; } for (var i = 0; i < this._typeArgs.length; ++i) { delete typemap[this._typeArgs[i].getValue()]; } var context = new InstantiationContext(instantiationContext.errors, typemap); // instantiate the members var succeeded = true; var members = new MemberDefinition[]; for (var i = 0; i < this._members.length; ++i) { var member = this._members[i].instantiate(context); if (member == null) succeeded = false; members[i] = member; } var inners = new ClassDefinition[]; for (var i = 0; i < this._inners.length; ++i) { var inner = this._inners[i].instantiate(context); if (inner == null) succeeded = false; inners[i] = inner; } var templateInners = new TemplateClassDefinition[]; for (var i = 0; i < this._templateInners.length; ++i) { var templateInner = this._templateInners[i].instantiate(context); if (templateInner == null) succeeded = false; templateInners[i] = templateInner; } // done if (! succeeded) return null; var extendType = null : ParsedObjectType; if (this._extendType != null) { var type = this._extendType.instantiate(instantiationContext, false); if (! (type instanceof ParsedObjectType)) { instantiationContext.errors.push(new CompileError(this._extendType.getToken(), "non-object type is not extensible")); return null; } extendType = type as ParsedObjectType; } var implementTypes = new ParsedObjectType[]; for (var i = 0; i < this._implementTypes.length; ++i) { var type = this._implementTypes[i].instantiate(instantiationContext, false); if (! (type instanceof ParsedObjectType)) { instantiationContext.errors.push(new CompileError(this._implementTypes[i].getToken(), "non-object type is not extensible")); return null; } implementTypes[i] = type as ParsedObjectType; } return new TemplateClassDefinition( this._token, this._className, this._flags, this._typeArgs, extendType, implementTypes, members, inners, templateInners, context.objectTypesUsed, this._docComment ); } function instantiateTemplateClass (errors : CompileError[], request : TemplateInstantiationRequest) : InstantiatedClassDefinition { // prepare var instantiationContext = this.buildInstantiationContext(errors, request.getToken(), this._typeArgs, request.getTypeArguments()); if (instantiationContext == null) { return null; } // instantiate the members var succeeded = true; var members = new MemberDefinition[]; for (var i = 0; i < this._members.length; ++i) { var member = this._members[i].instantiate(instantiationContext); if (member == null) succeeded = false; members[i] = member; } var inners = new ClassDefinition[]; for (var i = 0; i < this._inners.length; ++i) { var inner = this._inners[i].instantiate(instantiationContext); if (inner == null) succeeded = false; inners[i] = inner; } var templateInners = new TemplateClassDefinition[]; for (var i = 0; i < this._templateInners.length; ++i) { var templateInner = this._templateInners[i].instantiate(instantiationContext); if (templateInner == null) succeeded = false; templateInners[i] = templateInner; } // done if (! succeeded) return null; var extendType = null : ParsedObjectType; if (this._extendType != null) { var type = this._extendType.instantiate(instantiationContext, false); if (! (type instanceof ParsedObjectType)) { instantiationContext.errors.push(new CompileError(this._extendType.getToken(), "non-object type is not extensible")); return null; } extendType = type as ParsedObjectType; } var implementTypes = new ParsedObjectType[]; for (var i = 0; i < this._implementTypes.length; ++i) { var type = this._implementTypes[i].instantiate(instantiationContext, false); if (! (type instanceof ParsedObjectType)) { instantiationContext.errors.push(new CompileError(this._implementTypes[i].getToken(), "non-object type is not extensible")); return null; } implementTypes[i] = type as ParsedObjectType; } var instantiatedDef = new InstantiatedClassDefinition( this, request.getTypeArguments(), extendType, implementTypes, members, inners, templateInners, instantiationContext.objectTypesUsed); return instantiatedDef; } } class InstantiatedClassDefinition extends ClassDefinition { var _templateClassDef : TemplateClassDefinition; var _typeArguments : Type[]; function constructor (templateClassDef : TemplateClassDefinition, typeArguments : Type[], extendType : ParsedObjectType, implementTypes : ParsedObjectType[], members : MemberDefinition[], inners : ClassDefinition[], templateInners : TemplateClassDefinition[], objectTypesUsed : ParsedObjectType[]) { super( null, Type.templateTypeToString(templateClassDef.classFullName(), typeArguments), templateClassDef.flags(), extendType, implementTypes, members, inners, templateInners, objectTypesUsed, null /* docComment is not used for instantiated class */); this._templateClassDef = templateClassDef; this._typeArguments = typeArguments; } function getTemplateClass () : TemplateClassDefinition { return this._templateClassDef; } function getTemplateClassName () : string { return this._templateClassDef.className(); } function getTypeArguments () : Type[] { return this._typeArguments; } function typeArgumentsAreEqual (typeArgs : Type[]) : boolean { if (! (this._typeArguments.length == typeArgs.length)) return false; for (var i = 0; i < typeArgs.length; ++i) { if (! this._typeArguments[i].equals(typeArgs[i])) return false; } return true; } override function instantiate (instantiationContext : InstantiationContext) : InstantiatedClassDefinition { throw new Error("logic flaw"); } }
const video = document.getElementById('video') const source = document.getElementById('source') const videoPlayList = document.getElementsByClassName('video-wrap-container') for(let videoIter of videoPlayList) { videoIter.addEventListener('click',()=>{ const url = videoIter.getAttribute('data-url') source.setAttribute('src',url); video.load(); video.play(); }) } for(let i=0; i<videoPlayList.length; i++) { const url = videoPlayList[i+1].getAttribute('data-url') video.onended = ()=>{ source.setAttribute('src',url); video.load(); video.play(); } } // auto play const autoPlayBtn = document.getElementsByClassName('auto-play-control-btn')[0] const autoPlayBtnContainer = document.getElementsByClassName('auto-play')[0] autoPlayBtnContainer.addEventListener('click',()=>{ if(autoPlayBtn.style.cssFloat=="left"){ console.log('done') autoPlayBtn.style.cssFloat = "right" autoPlayBtnContainer.style.backgroundColor = "#66CD00"; } else{ autoPlayBtn.style.cssFloat = "left" autoPlayBtnContainer.style.backgroundColor = "white"; } })
var ParkingSystem = function(big, medium, small) { this.count = [big, medium, small]; //this.count[0] === big; //this.count[1] === medium; //this.count[2] ===small; }; //Parkingsystem(1, 1, 0) would looke like this this.count = [1, 1, 0] /** * @param {number} carType * @return {boolean} */ ParkingSystem.prototype.addCar = function(carType) { return this.count[carType - 1]-- > 0; //addCar(1) // carType is 1 (big) that's asking if there is a big space. //if big (or this.count[0] or this.count[1-1]) is 0, return false //because that means a space for a big car is unavailable //if it's more than 0 return false and then subtract 1 from this.big //addCar(2) //if carType is 2 (medium) addCar(2) is asking if there is a medium space. //if a medium (or this.count[1] or this.count[2-1]) is 0, //because that means a spac for a medium car is unavailable }; /** * Your ParkingSystem object will be instantiated and called as such: * var obj = new ParkingSystem(big, medium, small) * var param_1 = obj.addCar(carType) */
import loginService from '../services/login' import driverService from '../services/driver' import passengerService from '../services/passenger' import rideService from '../services/ride' import ridesService from '../services/rides' const loginReducer = (state = null, action) => { switch(action.type) { case 'LOGIN': return action.data case 'SET_ADMIN': return action.data default: return state } } export const login = (data) => { return async dispatch => { const admin = await loginService.login(data) window.localStorage.setItem( 'admin', JSON.stringify(admin) ) dispatch({ type: 'LOGIN', data: admin }) } } export const initializeUser = userData => { return dispatch => { driverService.setToken(userData.token) passengerService.setToken(userData.token) rideService.setToken(userData.token) ridesService.setToken(userData.token) dispatch({ type:'SET_ADMIN', data: userData }) } } export default loginReducer
const navBtns = document.querySelectorAll(".nav__item"); $(".nav__item:first-child").on("click", () => { $("body,html").animate( { scrollTop: $(".home").offset().top }, 500 ); }); $(".nav__item:nth-child(2)").on("click", () => { $("body,html").animate( { scrollTop: $(".about-me").offset().top }, 2000 ); }); $(".nav__item:nth-child(3)").on("click", () => { $("body,html").animate( { scrollTop: $(".technologies").offset().top }, 3000 ); }); $(".nav__item:nth-child(4)").on("click", () => { $("body,html").animate( { scrollTop: $(".projects").offset().top }, 4000 ); }); $(".nav__item:nth-child(5)").on("click", () => { $("body,html").animate( { scrollTop: $(".footer").offset().top }, 5000 ); }); $(document).bind("scroll", function(e) { $("section").each(function() { if ( $(this).offset().top < window.pageYOffset + 5 && $(this).offset().top + $(this).height() > window.pageYOffset + 5 ) { window.location.hash = $(this).attr("id"); } }); });
import React from 'react' export default class Weather extends React.Component{ state ={ currently: null } render(){ return( <div> </div> ); } }
console.log(projs.all); var testArr = []; var $projArr = projs.all; console.log($projArr); $projArr.map(function(bob) {testArr.push(bob.size);}); console.log($projArr); console.log(testArr); testArr.reduce(function(a,b) {console.log(a + b);});
module.exports = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ function(module, exports, __webpack_require__) { "use strict"; var meiosis_1 = __webpack_require__(1); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = meiosis_1.meiosis; /***/ }, /* 1 */ /***/ function(module, exports, __webpack_require__) { "use strict"; var merge_1 = __webpack_require__(2); var wire_1 = __webpack_require__(3); var meiosis = function (adapters) { var allReceivers = []; var wire = adapters.wire || wire_1.defaultWire; var rootWire = wire("meiosis"); var merge = adapters.merge || merge_1.defaultMerge; var rootModel = {}; var createComponent = function (config) { if (!config || !config.view) { throw new Error("At a minimum, you need to specify a view to create a component."); } rootModel = merge(rootModel, config.initialModel || {}); var componentWire = wire(); var next = componentWire.emit; var nextAction = { next: next }; var actions = config.actions ? merge(nextAction, config.actions(next)) : nextAction; var receivers = config.receivers; if (receivers && Array === receivers.constructor) { Array.prototype.push.apply(allReceivers, receivers); } componentWire.listen(function (update) { var updateTr = config.transform ? config.transform(rootModel, update) : update; allReceivers.forEach(function (receiver) { rootModel = receiver(rootModel, updateTr); return rootModel; }); rootWire.emit(rootModel); if (config.chain) { config.chain(update, actions); } }); return function (props) { return config.view(merge({}, props, { actions: actions })); }; }; var run = function (root) { if (allReceivers.length === 0) { allReceivers.push(merge); } var renderRoot = function (model) { adapters.render(root({ model: model })); }; rootWire.listen(renderRoot); rootWire.emit(rootModel); return renderRoot; }; return { createComponent: createComponent, run: run }; }; exports.meiosis = meiosis; /***/ }, /* 2 */ /***/ function(module, exports) { "use strict"; var defaultMerge = function (target) { var sources = []; for (var _i = 1; _i < arguments.length; _i++) { sources[_i - 1] = arguments[_i]; } if (target === undefined || target === null) { throw new TypeError("Cannot convert undefined or null to object"); } var output = Object(target); for (var index = 1; index < arguments.length; index++) { var source = arguments[index]; if (source !== undefined && source !== null) { for (var nextKey in source) { if (source.hasOwnProperty(nextKey)) { output[nextKey] = source[nextKey]; } } } } return output; }; exports.defaultMerge = defaultMerge; /***/ }, /* 3 */ /***/ function(module, exports) { "use strict"; var defaultWire = (function () { var wires = {}; var nextWireId = 1; var createWire = function () { var listener = null; var listen = function (lstnr) { return listener = lstnr; }; var emit = function (data) { return listener(data); }; return { emit: emit, listen: listen }; }; return function (wireName) { var name = wireName; if (!name) { name = "wire_" + nextWireId; nextWireId++; } var theWire = wires[name]; if (!theWire) { theWire = createWire(); wires[name] = theWire; } return theWire; }; })(); exports.defaultWire = defaultWire; /***/ } /******/ ]);
import React from 'react'; import { mount } from 'enzyme'; import Chip from '.'; describe('Chip', () => { const mockProps = { className: 'test-class', item: 'item' } const wrapper = mount(<Chip className={mockProps.className} item={mockProps.item}/>); it('should render Chip component with default class and given item', () => { expect(wrapper.find('.chip-container')).toHaveLength(1); expect(wrapper.find('.chip-item').text()).toEqual('item'); }) });
import {createStore, combineReducers, applyMiddleware} from "redux"; import {mainReducer} from './reducer' import thunk from "redux-thunk"; const rootReducer = combineReducers({ main: mainReducer }); export default createStore(rootReducer, applyMiddleware(thunk));
function isEven(number) { return (number & 1) == 0; } const userInput = 4; console.log(isEven(userInput) == true ? "Even" : "Odd");
//play sound with highlight //create hard mode var greenSound = "https://s3.amazonaws.com/freecodecamp/simonSound1.mp3"; var redSound = "https://s3.amazonaws.com/freecodecamp/simonSound2.mp3"; var yellowSound = "https://s3.amazonaws.com/freecodecamp/simonSound3.mp3"; var blueSound = "https://s3.amazonaws.com/freecodecamp/simonSound4.mp3"; function hideBtn() { document.getElementById('play-btns').style.visibility = "hidden"; document.getElementById('counter').style.visibility = "visible"; } function Quadrant (position, colour, sound) { this.position = position; this.colour = colour; this.sound = sound; } var allQuads = [ new Quadrant("top-left", "#297F00", greenSound), new Quadrant("top-right", "#E81005", redSound), new Quadrant("bottom-left", "#F7D627", yellowSound), new Quadrant("bottom-right", "#17537F", blueSound) ]; function randomNumber() { return Math.floor((Math.random() * 4) + 0); } function keepLightingUp(allQuads) { var genNum = randomNumber(); document.getElementById(allQuads[genNum].position).style.backgroundColor = allQuads[genNum].colour; } lightingUp = setInterval (function(){ keepLightingUp(allQuads); }, 1000); //if lightUp !== quadrant user clicked return game over //else add 1 to counter //check if quadrant is end of pattern //if not repeat until it is, adding to counter each time
// eslint-disable-next-line unicorn/filename-case import React from "react"; import Button from "react-bootstrap/Button"; import Modal from "react-bootstrap/Modal"; import "./ModalSettings.css"; import {FontAwesomeIcon} from "@fortawesome/react-fontawesome"; import {faUser, faAt, faUnlock} from "@fortawesome/free-solid-svg-icons"; function ModalSettings(props) { return ( <> <Modal className="modal-settings" show={props.showSettings} onHide={props.handleCloseSettings} centered={true} keyboard={false}> <Modal.Header closeButton> <Modal.Title>My Account</Modal.Title> </Modal.Header> <Modal.Body> <div className="modal-right"> <div className="modal-signup-text-input-container"> <FontAwesomeIcon icon={faUser} className="modal-signup-icon-username" /> <input className="modal-signup-text-input" type="text" name="username" placeholder="Username" /> </div> <div className="modal-signup-text-input-container"> <FontAwesomeIcon icon={faAt} className="modal-signup-icon-email" /> <input className="modal-signup-email-input" type="text" name="username" placeholder="Email" /> </div> <div className="modal-signup-text-password-container"> <FontAwesomeIcon icon={faUnlock} className="modal-signup-icon-password" /> <input className="modal-signup-password-input" type="password" name="password" placeholder="Password" /> </div> <div className="modal-signup-checkbox-container"> <input type="color" name="" /> <span className="modal-signup-span-checkbox"> Your color </span> </div> </div> </Modal.Body> <Modal.Footer> <Button variant="secondary" onClick={props.handleCloseSettings}> Close </Button> <Button variant="primary">Submit</Button> </Modal.Footer> </Modal> </> ); } export default ModalSettings;
import AjaxMore from './AjaxMore' import SlickSlider from './SlickSlider' import AjaxFilter from './AjaxFilter' export { AjaxMore, SlickSlider, AjaxFilter }
import React from 'react' import './index.css' const Register = () => { return ( <div className='login'> <div className='loginWrapper'> <div className='loginLeft'> <h3 className='loginLogo'> DT</h3> <span className='loginDesc'>Connect with friend and the world around you on DT</span> </div> <div className='loginRight'> <div className='loginBox'> <input placeholder='Username' className='loginInput' /> <input placeholder='Email' className='loginInput' /> <input placeholder='Password' className='loginInput' /> <input placeholder='Password Again' className='loginInput' /> <button className='loginButton'>Sign Up</button> <button className="loginRegisterButton">Login into Account</button> </div> </div> </div> </div> ) } export default Register
import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; import App from './App'; import reportWebVitals from './reportWebVitals'; import { Provider } from 'react-redux'; import { createStore } from 'redux'; import rootReducers from './Reducers'; import CustomLogging from './CustomLogging'; const custom = new CustomLogging(); custom.setBodyStyle({ color: 'red' }); custom.log('Created by Akshay Nair '); const store = createStore( rootReducers, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()); ReactDOM.render( <React.StrictMode> <Provider store={store}><App /></Provider> </React.StrictMode>, document.getElementById('root') ); reportWebVitals();
Grailbird.data.tweets_2014_05 = [ { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "472735876280115200", "text" : "The wind, my only friend.", "id" : 472735876280115200, "created_at" : "2014-05-31 13:46:30 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Unity Technologies", "screen_name" : "unity3d", "indices" : [ 30, 38 ], "id_str" : "15531582", "id" : 15531582 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "472732141395005440", "text" : "Sometimes I am tempted to use @unity3d. But I don't want to get stuck in a closed ecosystem again (Flash). That is one of the reasons.", "id" : 472732141395005440, "created_at" : "2014-05-31 13:31:40 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "472646626201194496", "text" : "Reading into this cordova.", "id" : 472646626201194496, "created_at" : "2014-05-31 07:51:51 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "472191347516915713", "text" : "Death perception", "id" : 472191347516915713, "created_at" : "2014-05-30 01:42:44 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "472180770648248321", "text" : "I keep starting new projects then abandoning them :(", "id" : 472180770648248321, "created_at" : "2014-05-30 01:00:43 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "472179323370098688", "text" : "Pop up blocker: Ctrl+Tab, Ctrl+W", "id" : 472179323370098688, "created_at" : "2014-05-30 00:54:58 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Chris Franklin", "screen_name" : "Campster", "indices" : [ 3, 12 ], "id_str" : "13640822", "id" : 13640822 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 14, 36 ], "url" : "http:\/\/t.co\/5OpDeER2PL", "expanded_url" : "http:\/\/futurismic.com\/2011\/03\/02\/seeing-like-a-state-why-strategy-games-make-us-think-and-behave-like-brutal-psychopaths\/", "display_url" : "futurismic.com\/2011\/03\/02\/see\u2026" } ] }, "geo" : { }, "id_str" : "471991902485483520", "text" : "RT @Campster: http:\/\/t.co\/5OpDeER2PL Someone in my comments linked this piece on strategy games and their oft. state-based views - it's pre\u2026", "retweeted_status" : { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 0, 22 ], "url" : "http:\/\/t.co\/5OpDeER2PL", "expanded_url" : "http:\/\/futurismic.com\/2011\/03\/02\/seeing-like-a-state-why-strategy-games-make-us-think-and-behave-like-brutal-psychopaths\/", "display_url" : "futurismic.com\/2011\/03\/02\/see\u2026" } ] }, "geo" : { }, "id_str" : "471648533805019137", "text" : "http:\/\/t.co\/5OpDeER2PL Someone in my comments linked this piece on strategy games and their oft. state-based views - it's pretty fantastic.", "id" : 471648533805019137, "created_at" : "2014-05-28 13:45:47 +0000", "user" : { "name" : "Chris Franklin", "screen_name" : "Campster", "protected" : false, "id_str" : "13640822", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/528418545827209217\/ZroTOLVW_normal.png", "id" : 13640822, "verified" : false } }, "id" : 471991902485483520, "created_at" : "2014-05-29 12:30:13 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "471979502109614080", "text" : "Cater to the unexpected", "id" : 471979502109614080, "created_at" : "2014-05-29 11:40:56 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Oliver Franzke", "screen_name" : "p1xelcoder", "indices" : [ 3, 14 ], "id_str" : "621693237", "id" : 621693237 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 90, 112 ], "url" : "http:\/\/t.co\/EgwOc1lTIi", "expanded_url" : "http:\/\/waitbutwhy.com\/2014\/05\/fermi-paradox.html", "display_url" : "waitbutwhy.com\/2014\/05\/fermi-\u2026" } ] }, "geo" : { }, "id_str" : "471958510511472640", "text" : "RT @p1xelcoder: Fantastic blog post about the Fermi Paradox and some of its implications: http:\/\/t.co\/EgwOc1lTIi", "retweeted_status" : { "source" : "\u003Ca href=\"http:\/\/twitter.com\/#!\/download\/ipad\" rel=\"nofollow\"\u003ETwitter for iPad\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 74, 96 ], "url" : "http:\/\/t.co\/EgwOc1lTIi", "expanded_url" : "http:\/\/waitbutwhy.com\/2014\/05\/fermi-paradox.html", "display_url" : "waitbutwhy.com\/2014\/05\/fermi-\u2026" } ] }, "geo" : { }, "id_str" : "471765944512299008", "text" : "Fantastic blog post about the Fermi Paradox and some of its implications: http:\/\/t.co\/EgwOc1lTIi", "id" : 471765944512299008, "created_at" : "2014-05-28 21:32:20 +0000", "user" : { "name" : "Oliver Franzke", "screen_name" : "p1xelcoder", "protected" : false, "id_str" : "621693237", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/582593385057247233\/_ERnzZwp_normal.jpg", "id" : 621693237, "verified" : false } }, "id" : 471958510511472640, "created_at" : "2014-05-29 10:17:32 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Jonathan Blow", "screen_name" : "Jonathan_Blow", "indices" : [ 3, 17 ], "id_str" : "107336879", "id" : 107336879 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 139, 140 ], "url" : "http:\/\/t.co\/SwjFbafgpG", "expanded_url" : "http:\/\/mollyrocket.com\/casey\/stream_0019.html", "display_url" : "mollyrocket.com\/casey\/stream_0\u2026" } ] }, "geo" : { }, "id_str" : "471880374629310465", "text" : "RT @Jonathan_Blow: This week on Witness Wednesday, Casey starts a new series that's very good. If you're a programmer, read it:\n\nhttp:\/\/t.c\u2026", "retweeted_status" : { "source" : "\u003Ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003ETwitter Web Client\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 110, 132 ], "url" : "http:\/\/t.co\/SwjFbafgpG", "expanded_url" : "http:\/\/mollyrocket.com\/casey\/stream_0019.html", "display_url" : "mollyrocket.com\/casey\/stream_0\u2026" } ] }, "geo" : { }, "id_str" : "471733635138084865", "text" : "This week on Witness Wednesday, Casey starts a new series that's very good. If you're a programmer, read it:\n\nhttp:\/\/t.co\/SwjFbafgpG", "id" : 471733635138084865, "created_at" : "2014-05-28 19:23:57 +0000", "user" : { "name" : "Jonathan Blow", "screen_name" : "Jonathan_Blow", "protected" : false, "id_str" : "107336879", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/528285314289127425\/TL-pussh_normal.png", "id" : 107336879, "verified" : false } }, "id" : 471880374629310465, "created_at" : "2014-05-29 05:07:03 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "471607788729167872", "text" : "Just started Thomas Was Alone. Very early, so I'll reserve judgement. But so far, come across a little didactic.", "id" : 471607788729167872, "created_at" : "2014-05-28 11:03:53 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 0, 22 ], "url" : "http:\/\/t.co\/bPtFVb7tjT", "expanded_url" : "http:\/\/james-forbes.com\/", "display_url" : "james-forbes.com" } ] }, "geo" : { }, "id_str" : "471531916751941632", "text" : "http:\/\/t.co\/bPtFVb7tjT got a much needed facelift today.", "id" : 471531916751941632, "created_at" : "2014-05-28 06:02:24 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 109, 132 ], "url" : "https:\/\/t.co\/RpbiWEKPM1", "expanded_url" : "https:\/\/www.youtube.com\/watch?v=1KLqdG6M6LI", "display_url" : "youtube.com\/watch?v=1KLqdG\u2026" } ] }, "geo" : { }, "id_str" : "471526966701461504", "text" : "Working in a cafe at Katoomba, talking to the Barista. Turns out he is a rapper, Tenth Dan: Check this out\n\nhttps:\/\/t.co\/RpbiWEKPM1", "id" : 471526966701461504, "created_at" : "2014-05-28 05:42:44 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "471469380593676289", "text" : "Reminds me of typing 'exit' in a python repl. It has a message that says \"Please type exit()\"\n\nIf you know what I am trying to do, do it.", "id" : 471469380593676289, "created_at" : "2014-05-28 01:53:54 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "471469116146987008", "text" : "Don't be coy with me chrome! You know damn well what user-select is. You do not need -webkit-user-select.", "id" : 471469116146987008, "created_at" : "2014-05-28 01:52:51 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 34, 57 ], "url" : "https:\/\/t.co\/OtHLatonEO", "expanded_url" : "https:\/\/github.com\/jaforbes\/temple", "display_url" : "github.com\/jaforbes\/temple" } ] }, "geo" : { }, "id_str" : "471427933144248321", "text" : "Temple is serving me well today.\n\nhttps:\/\/t.co\/OtHLatonEO", "id" : 471427933144248321, "created_at" : "2014-05-27 23:09:12 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Zoe Calton", "screen_name" : "ZoeAppleseed", "indices" : [ 10, 23 ], "id_str" : "2268581455", "id" : 2268581455 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "470869073320882176", "text" : "Everytime @ZoeAppleseed cooks anything: \"I didn't do ______, so hopefully it will be alright.\"", "id" : 470869073320882176, "created_at" : "2014-05-26 10:08:30 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "470759571791679488", "text" : "Tried to open a presentation on the benefits of an open source technology. And the presentation uses a proprietary format. Why?", "id" : 470759571791679488, "created_at" : "2014-05-26 02:53:22 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "470759343365701632", "text" : "Looking forward to the day when people no longer assume you have Office installed.", "id" : 470759343365701632, "created_at" : "2014-05-26 02:52:28 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "mcc", "screen_name" : "mcclure111", "indices" : [ 0, 11 ], "id_str" : "312426579", "id" : 312426579 }, { "name" : "\/'d\u0279\u0251k\u026An\/", "screen_name" : "droqen", "indices" : [ 12, 19 ], "id_str" : "64937130", "id" : 64937130 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "in_reply_to_status_id_str" : "470090543741956096", "geo" : { }, "id_str" : "470092189448425472", "in_reply_to_user_id" : 16025792, "text" : "@mcclure111 @droqen Descriptive and concise terms born out of the same process; Orwellian, Freudian, Darwinian, Dionysian, Herculean.", "id" : 470092189448425472, "in_reply_to_status_id" : 470090543741956096, "created_at" : "2014-05-24 06:41:26 +0000", "in_reply_to_screen_name" : "james_a_forbes", "in_reply_to_user_id_str" : "16025792", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "mcc", "screen_name" : "mcclure111", "indices" : [ 0, 11 ], "id_str" : "312426579", "id" : 312426579 }, { "name" : "\/'d\u0279\u0251k\u026An\/", "screen_name" : "droqen", "indices" : [ 12, 19 ], "id_str" : "64937130", "id" : 64937130 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "in_reply_to_status_id_str" : "470090166502031360", "geo" : { }, "id_str" : "470090543741956096", "in_reply_to_user_id" : 16025792, "text" : "@mcclure111 @droqen There is much lost history in games. Naming a genre after a game that codified a style, is respectful.", "id" : 470090543741956096, "in_reply_to_status_id" : 470090166502031360, "created_at" : "2014-05-24 06:34:54 +0000", "in_reply_to_screen_name" : "james_a_forbes", "in_reply_to_user_id_str" : "16025792", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "mcc", "screen_name" : "mcclure111", "indices" : [ 0, 11 ], "id_str" : "312426579", "id" : 312426579 }, { "name" : "\/'d\u0279\u0251k\u026An\/", "screen_name" : "droqen", "indices" : [ 12, 19 ], "id_str" : "64937130", "id" : 64937130 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "in_reply_to_status_id_str" : "469949764943896576", "geo" : { }, "id_str" : "470090166502031360", "in_reply_to_user_id" : 312426579, "text" : "@mcclure111 @droqen Incremental design is no better or worse than grand leaps. And naming genres after games could be a valuable tradition.", "id" : 470090166502031360, "in_reply_to_status_id" : 469949764943896576, "created_at" : "2014-05-24 06:33:24 +0000", "in_reply_to_screen_name" : "mcclure111", "in_reply_to_user_id_str" : "312426579", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "FAB", "indices" : [ 0, 4 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "469809275921915904", "text" : "#FAB = pink", "id" : 469809275921915904, "created_at" : "2014-05-23 11:57:14 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Zoe Calton", "screen_name" : "ZoeAppleseed", "indices" : [ 3, 16 ], "id_str" : "2268581455", "id" : 2268581455 } ], "media" : [ { "expanded_url" : "http:\/\/twitter.com\/ZoeAppleseed\/status\/469783326060867584\/photo\/1", "indices" : [ 57, 79 ], "url" : "http:\/\/t.co\/QzjzSdgfq5", "media_url" : "http:\/\/pbs.twimg.com\/media\/BoUBcdEIAAA1K66.jpg", "id_str" : "469783324479979520", "id" : 469783324479979520, "media_url_https" : "https:\/\/pbs.twimg.com\/media\/BoUBcdEIAAA1K66.jpg", "sizes" : [ { "h" : 453, "resize" : "fit", "w" : 340 }, { "h" : 533, "resize" : "fit", "w" : 400 }, { "h" : 150, "resize" : "crop", "w" : 150 }, { "h" : 533, "resize" : "fit", "w" : 400 }, { "h" : 533, "resize" : "fit", "w" : 400 } ], "display_url" : "pic.twitter.com\/QzjzSdgfq5" } ], "hashtags" : [ { "text" : "art", "indices" : [ 52, 56 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "469783488384598017", "text" : "RT @ZoeAppleseed: The egg keeper. Drew him today :) #art http:\/\/t.co\/QzjzSdgfq5", "retweeted_status" : { "source" : "\u003Ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003ETwitter Web Client\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ { "expanded_url" : "http:\/\/twitter.com\/ZoeAppleseed\/status\/469783326060867584\/photo\/1", "indices" : [ 39, 61 ], "url" : "http:\/\/t.co\/QzjzSdgfq5", "media_url" : "http:\/\/pbs.twimg.com\/media\/BoUBcdEIAAA1K66.jpg", "id_str" : "469783324479979520", "id" : 469783324479979520, "media_url_https" : "https:\/\/pbs.twimg.com\/media\/BoUBcdEIAAA1K66.jpg", "sizes" : [ { "h" : 453, "resize" : "fit", "w" : 340 }, { "h" : 533, "resize" : "fit", "w" : 400 }, { "h" : 150, "resize" : "crop", "w" : 150 }, { "h" : 533, "resize" : "fit", "w" : 400 }, { "h" : 533, "resize" : "fit", "w" : 400 } ], "display_url" : "pic.twitter.com\/QzjzSdgfq5" } ], "hashtags" : [ { "text" : "art", "indices" : [ 34, 38 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "469783326060867584", "text" : "The egg keeper. Drew him today :) #art http:\/\/t.co\/QzjzSdgfq5", "id" : 469783326060867584, "created_at" : "2014-05-23 10:14:07 +0000", "user" : { "name" : "Zoe Calton", "screen_name" : "ZoeAppleseed", "protected" : false, "id_str" : "2268581455", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/577990416483545088\/mhOWEjUQ_normal.jpeg", "id" : 2268581455, "verified" : false } }, "id" : 469783488384598017, "created_at" : "2014-05-23 10:14:46 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "469483251174617089", "text" : "Just deleting folders from my dropbox. So many forgotten good ideas. Interesting to look at old code.", "id" : 469483251174617089, "created_at" : "2014-05-22 14:21:44 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ { "expanded_url" : "http:\/\/twitter.com\/james_a_forbes\/status\/469422926442160128\/photo\/1", "indices" : [ 38, 60 ], "url" : "http:\/\/t.co\/nJfLOEQsMZ", "media_url" : "http:\/\/pbs.twimg.com\/media\/BoO5qb_IEAAwKjs.png", "id_str" : "469422924894834688", "id" : 469422924894834688, "media_url_https" : "https:\/\/pbs.twimg.com\/media\/BoO5qb_IEAAwKjs.png", "sizes" : [ { "h" : 355, "resize" : "fit", "w" : 333 }, { "h" : 355, "resize" : "fit", "w" : 333 }, { "h" : 355, "resize" : "fit", "w" : 333 }, { "h" : 150, "resize" : "crop", "w" : 150 }, { "h" : 355, "resize" : "fit", "w" : 333 } ], "display_url" : "pic.twitter.com\/nJfLOEQsMZ" } ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "469422926442160128", "text" : "Hand picking coordinates is relaxing. http:\/\/t.co\/nJfLOEQsMZ", "id" : 469422926442160128, "created_at" : "2014-05-22 10:22:01 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ { "expanded_url" : "http:\/\/twitter.com\/james_a_forbes\/status\/469413690387595264\/photo\/1", "indices" : [ 29, 51 ], "url" : "http:\/\/t.co\/vxk33RSjSc", "media_url" : "http:\/\/pbs.twimg.com\/media\/BoOxQ0GIUAA9Hj5.png", "id_str" : "469413688597041152", "id" : 469413688597041152, "media_url_https" : "https:\/\/pbs.twimg.com\/media\/BoOxQ0GIUAA9Hj5.png", "sizes" : [ { "h" : 150, "resize" : "crop", "w" : 150 }, { "h" : 680, "resize" : "fit", "w" : 250 }, { "h" : 818, "resize" : "fit", "w" : 301 }, { "h" : 818, "resize" : "fit", "w" : 301 }, { "h" : 818, "resize" : "fit", "w" : 301 } ], "display_url" : "pic.twitter.com\/vxk33RSjSc" } ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "469413690387595264", "text" : "We'll see where this goes... http:\/\/t.co\/vxk33RSjSc", "id" : 469413690387595264, "created_at" : "2014-05-22 09:45:19 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003ETwitter Web Client\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Ocean Leaves", "screen_name" : "oceanleavesband", "indices" : [ 0, 16 ], "id_str" : "206542186", "id" : 206542186 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "in_reply_to_status_id_str" : "469332927466070016", "geo" : { }, "id_str" : "469337491670319104", "in_reply_to_user_id" : 206542186, "text" : "@oceanleavesband I added it to my list.", "id" : 469337491670319104, "in_reply_to_status_id" : 469332927466070016, "created_at" : "2014-05-22 04:42:32 +0000", "in_reply_to_screen_name" : "oceanleavesband", "in_reply_to_user_id_str" : "206542186", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003ETwitter Web Client\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "469337253710675968", "text" : "People could then write drivers for the database backend for simple json stores, mysql, mongo etc. I think the strength is the synax.", "id" : 469337253710675968, "created_at" : "2014-05-22 04:41:35 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003ETwitter Web Client\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "469337011133100032", "text" : "I'm rethinking crescent. I built in a simple security access model. But I think it should be just a front end to other types of data.", "id" : 469337011133100032, "created_at" : "2014-05-22 04:40:37 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003ETwitter Web Client\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Ocean Leaves", "screen_name" : "oceanleavesband", "indices" : [ 0, 16 ], "id_str" : "206542186", "id" : 206542186 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "in_reply_to_status_id_str" : "469331348587429889", "geo" : { }, "id_str" : "469331743175372800", "in_reply_to_user_id" : 206542186, "text" : "@oceanleavesband Hope it works out. When I do that, the words never come. I have many instrumentals which I wish were songs.", "id" : 469331743175372800, "in_reply_to_status_id" : 469331348587429889, "created_at" : "2014-05-22 04:19:41 +0000", "in_reply_to_screen_name" : "oceanleavesband", "in_reply_to_user_id_str" : "206542186", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003ETwitter Web Client\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Ocean Leaves", "screen_name" : "oceanleavesband", "indices" : [ 0, 16 ], "id_str" : "206542186", "id" : 206542186 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "in_reply_to_status_id_str" : "469310333010464768", "geo" : { }, "id_str" : "469330525048819712", "in_reply_to_user_id" : 206542186, "text" : "@oceanleavesband What is your approach? I am in a rut too, but I think that is more to do with lack of space and time to jam.", "id" : 469330525048819712, "in_reply_to_status_id" : 469310333010464768, "created_at" : "2014-05-22 04:14:51 +0000", "in_reply_to_screen_name" : "oceanleavesband", "in_reply_to_user_id_str" : "206542186", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Deborah Lee", "screen_name" : "debsylee", "indices" : [ 3, 12 ], "id_str" : "41792496", "id" : 41792496 } ], "media" : [ { "expanded_url" : "http:\/\/twitter.com\/debsylee\/status\/468641051641909249\/photo\/1", "indices" : [ 35, 57 ], "url" : "http:\/\/t.co\/LOgKe0DphB", "media_url" : "http:\/\/pbs.twimg.com\/media\/BoDyjXaIAAAYN9C.jpg", "id_str" : "468641050639466496", "id" : 468641050639466496, "media_url_https" : "https:\/\/pbs.twimg.com\/media\/BoDyjXaIAAAYN9C.jpg", "sizes" : [ { "h" : 206, "resize" : "fit", "w" : 340 }, { "h" : 316, "resize" : "fit", "w" : 520 }, { "h" : 150, "resize" : "crop", "w" : 150 }, { "h" : 316, "resize" : "fit", "w" : 520 }, { "h" : 316, "resize" : "fit", "w" : 520 } ], "display_url" : "pic.twitter.com\/LOgKe0DphB" } ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "469301290506285056", "text" : "RT @debsylee: Do life on purpose \u2026 http:\/\/t.co\/LOgKe0DphB", "retweeted_status" : { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ { "expanded_url" : "http:\/\/twitter.com\/debsylee\/status\/468641051641909249\/photo\/1", "indices" : [ 21, 43 ], "url" : "http:\/\/t.co\/LOgKe0DphB", "media_url" : "http:\/\/pbs.twimg.com\/media\/BoDyjXaIAAAYN9C.jpg", "id_str" : "468641050639466496", "id" : 468641050639466496, "media_url_https" : "https:\/\/pbs.twimg.com\/media\/BoDyjXaIAAAYN9C.jpg", "sizes" : [ { "h" : 206, "resize" : "fit", "w" : 340 }, { "h" : 316, "resize" : "fit", "w" : 520 }, { "h" : 150, "resize" : "crop", "w" : 150 }, { "h" : 316, "resize" : "fit", "w" : 520 }, { "h" : 316, "resize" : "fit", "w" : 520 } ], "display_url" : "pic.twitter.com\/LOgKe0DphB" } ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "468641051641909249", "text" : "Do life on purpose \u2026 http:\/\/t.co\/LOgKe0DphB", "id" : 468641051641909249, "created_at" : "2014-05-20 06:35:08 +0000", "user" : { "name" : "Deborah Lee", "screen_name" : "debsylee", "protected" : false, "id_str" : "41792496", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/573231977245085697\/9cPdSnRc_normal.jpeg", "id" : 41792496, "verified" : false } }, "id" : 469301290506285056, "created_at" : "2014-05-22 02:18:41 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Jeff Atwood", "screen_name" : "codinghorror", "indices" : [ 3, 16 ], "id_str" : "5637652", "id" : 5637652 } ], "media" : [ { "expanded_url" : "http:\/\/twitter.com\/codinghorror\/status\/469254554282766336\/photo\/1", "indices" : [ 58, 80 ], "url" : "http:\/\/t.co\/W3PJlNRZPK", "media_url" : "http:\/\/pbs.twimg.com\/media\/BoMgh4tIAAARZOe.jpg", "id_str" : "469254552706088960", "id" : 469254552706088960, "media_url_https" : "https:\/\/pbs.twimg.com\/media\/BoMgh4tIAAARZOe.jpg", "sizes" : [ { "h" : 325, "resize" : "fit", "w" : 576 }, { "h" : 150, "resize" : "crop", "w" : 150 }, { "h" : 191, "resize" : "fit", "w" : 340 }, { "h" : 325, "resize" : "fit", "w" : 576 }, { "h" : 325, "resize" : "fit", "w" : 576 } ], "display_url" : "pic.twitter.com\/W3PJlNRZPK" } ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "469282951293714432", "text" : "RT @codinghorror: Wolfenstein game graphics, 1992 vs 2014 http:\/\/t.co\/W3PJlNRZPK", "retweeted_status" : { "source" : "\u003Ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003ETwitter Web Client\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ { "expanded_url" : "http:\/\/twitter.com\/codinghorror\/status\/469254554282766336\/photo\/1", "indices" : [ 40, 62 ], "url" : "http:\/\/t.co\/W3PJlNRZPK", "media_url" : "http:\/\/pbs.twimg.com\/media\/BoMgh4tIAAARZOe.jpg", "id_str" : "469254552706088960", "id" : 469254552706088960, "media_url_https" : "https:\/\/pbs.twimg.com\/media\/BoMgh4tIAAARZOe.jpg", "sizes" : [ { "h" : 325, "resize" : "fit", "w" : 576 }, { "h" : 150, "resize" : "crop", "w" : 150 }, { "h" : 191, "resize" : "fit", "w" : 340 }, { "h" : 325, "resize" : "fit", "w" : 576 }, { "h" : 325, "resize" : "fit", "w" : 576 } ], "display_url" : "pic.twitter.com\/W3PJlNRZPK" } ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "469254554282766336", "text" : "Wolfenstein game graphics, 1992 vs 2014 http:\/\/t.co\/W3PJlNRZPK", "id" : 469254554282766336, "created_at" : "2014-05-21 23:12:58 +0000", "user" : { "name" : "Jeff Atwood", "screen_name" : "codinghorror", "protected" : false, "id_str" : "5637652", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/2052442590\/coding-horror-official-logo-medium_normal.png", "id" : 5637652, "verified" : true } }, "id" : 469282951293714432, "created_at" : "2014-05-22 01:05:49 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "469281135101370368", "text" : "Bane of my existence: Thumbs.db", "id" : 469281135101370368, "created_at" : "2014-05-22 00:58:36 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "468714336727224320", "text" : "Streaming a show from a tablet to a TV via a $40 PC while I read a digital non-fiction book about massacres committed by flying robots.", "id" : 468714336727224320, "created_at" : "2014-05-20 11:26:20 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ { "expanded_url" : "http:\/\/twitter.com\/james_a_forbes\/status\/468679351588753408\/photo\/1", "indices" : [ 53, 75 ], "url" : "http:\/\/t.co\/ajE8D3VMUe", "media_url" : "http:\/\/pbs.twimg.com\/media\/BoEVYwlCAAA5pPY.jpg", "id_str" : "468679351324508160", "id" : 468679351324508160, "media_url_https" : "https:\/\/pbs.twimg.com\/media\/BoEVYwlCAAA5pPY.jpg", "sizes" : [ { "h" : 577, "resize" : "fit", "w" : 1024 }, { "h" : 577, "resize" : "fit", "w" : 1024 }, { "h" : 338, "resize" : "fit", "w" : 600 }, { "h" : 150, "resize" : "crop", "w" : 150 }, { "h" : 191, "resize" : "fit", "w" : 340 } ], "display_url" : "pic.twitter.com\/ajE8D3VMUe" } ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "468679351588753408", "text" : "Pro tip: cut the base before you put the topping on. http:\/\/t.co\/ajE8D3VMUe", "id" : 468679351588753408, "created_at" : "2014-05-20 09:07:19 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 78, 100 ], "url" : "http:\/\/t.co\/cL6Rbaxyrl", "expanded_url" : "http:\/\/canyongames.tumblr.com\/post\/86260540968\/open-source-releases-crescent-temple-and-canyon", "display_url" : "canyongames.tumblr.com\/post\/862605409\u2026" } ] }, "geo" : { }, "id_str" : "468551375400341504", "text" : "Blog: Three open source releases by yours truly.\nCrescent, Temple and Canyon\n\nhttp:\/\/t.co\/cL6Rbaxyrl", "id" : 468551375400341504, "created_at" : "2014-05-20 00:38:47 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Neil Young", "screen_name" : "Neilyoung", "indices" : [ 13, 23 ], "id_str" : "26763420", "id" : 26763420 } ], "media" : [ { "expanded_url" : "http:\/\/twitter.com\/james_a_forbes\/status\/468547404375924736\/photo\/1", "indices" : [ 47, 69 ], "url" : "http:\/\/t.co\/N16fnt3a79", "media_url" : "http:\/\/pbs.twimg.com\/media\/BoCdYVqIMAAVFkp.png", "id_str" : "468547402702794752", "id" : 468547402702794752, "media_url_https" : "https:\/\/pbs.twimg.com\/media\/BoCdYVqIMAAVFkp.png", "sizes" : [ { "h" : 346, "resize" : "fit", "w" : 340 }, { "h" : 582, "resize" : "fit", "w" : 570 }, { "h" : 150, "resize" : "crop", "w" : 150 }, { "h" : 582, "resize" : "fit", "w" : 571 }, { "h" : 582, "resize" : "fit", "w" : 570 } ], "display_url" : "pic.twitter.com\/N16fnt3a79" } ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "468547404375924736", "text" : "Listening to @Neilyoung and playing with arcs. http:\/\/t.co\/N16fnt3a79", "id" : 468547404375924736, "created_at" : "2014-05-20 00:23:01 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "468540874624733186", "text" : "I hate making ugly compromises when programming.", "id" : 468540874624733186, "created_at" : "2014-05-19 23:57:04 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "James Robert Somers", "screen_name" : "jsomau", "indices" : [ 0, 7 ], "id_str" : "93714279", "id" : 93714279 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "in_reply_to_status_id_str" : "468220402511388672", "geo" : { }, "id_str" : "468258783886458880", "in_reply_to_user_id" : 93714279, "text" : "@jsomau no, I didn't want to do that as the src is MIT but the music is copyright.", "id" : 468258783886458880, "in_reply_to_status_id" : 468220402511388672, "created_at" : "2014-05-19 05:16:08 +0000", "in_reply_to_screen_name" : "jsomau", "in_reply_to_user_id_str" : "93714279", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "468046369102364672", "text" : "I don't appreciate large bold self quotations when reading articles. I'll decide if a phrase is worthy of reading twice. They rarely are.", "id" : 468046369102364672, "created_at" : "2014-05-18 15:12:04 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "James Robert Somers", "screen_name" : "jsomau", "indices" : [ 0, 7 ], "id_str" : "93714279", "id" : 93714279 } ], "media" : [ { "expanded_url" : "http:\/\/twitter.com\/james_a_forbes\/status\/467951293084884992\/photo\/1", "indices" : [ 30, 52 ], "url" : "http:\/\/t.co\/R7z0chFxX5", "media_url" : "http:\/\/pbs.twimg.com\/media\/Bn5_OLrCYAEDqnj.jpg", "id_str" : "467951292921307137", "id" : 467951292921307137, "media_url_https" : "https:\/\/pbs.twimg.com\/media\/Bn5_OLrCYAEDqnj.jpg", "sizes" : [ { "h" : 999, "resize" : "fit", "w" : 600 }, { "h" : 1024, "resize" : "fit", "w" : 615 }, { "h" : 150, "resize" : "crop", "w" : 150 }, { "h" : 1024, "resize" : "fit", "w" : 615 }, { "h" : 566, "resize" : "fit", "w" : 340 } ], "display_url" : "pic.twitter.com\/R7z0chFxX5" } ], "hashtags" : [ ], "urls" : [ ] }, "in_reply_to_status_id_str" : "467832169058955265", "geo" : { }, "id_str" : "467951293084884992", "in_reply_to_user_id" : 16025792, "text" : "@jsomau forgot the screenshot http:\/\/t.co\/R7z0chFxX5", "id" : 467951293084884992, "in_reply_to_status_id" : 467832169058955265, "created_at" : "2014-05-18 08:54:17 +0000", "in_reply_to_screen_name" : "james_a_forbes", "in_reply_to_user_id_str" : "16025792", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 51, 74 ], "url" : "https:\/\/t.co\/dOYqZZCbNn", "expanded_url" : "https:\/\/github.com\/JAForbes\/temple", "display_url" : "github.com\/JAForbes\/temple" } ] }, "geo" : { }, "id_str" : "467930079213793280", "text" : "Just released a simple templating library: Temple\n\nhttps:\/\/t.co\/dOYqZZCbNn", "id" : 467930079213793280, "created_at" : "2014-05-18 07:29:59 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Zoe Calton", "screen_name" : "ZoeAppleseed", "indices" : [ 3, 16 ], "id_str" : "2268581455", "id" : 2268581455 } ], "media" : [ { "expanded_url" : "http:\/\/twitter.com\/ZoeAppleseed\/status\/467929789693587456\/photo\/1", "indices" : [ 69, 91 ], "url" : "http:\/\/t.co\/nGhc2LzOLW", "media_url" : "http:\/\/pbs.twimg.com\/media\/Bn5rqbKIcAAoZmO.jpg", "id_str" : "467929787882041344", "id" : 467929787882041344, "media_url_https" : "https:\/\/pbs.twimg.com\/media\/Bn5rqbKIcAAoZmO.jpg", "sizes" : [ { "h" : 441, "resize" : "fit", "w" : 400 }, { "h" : 374, "resize" : "fit", "w" : 340 }, { "h" : 150, "resize" : "crop", "w" : 150 }, { "h" : 441, "resize" : "fit", "w" : 400 }, { "h" : 441, "resize" : "fit", "w" : 400 } ], "display_url" : "pic.twitter.com\/nGhc2LzOLW" } ], "hashtags" : [ { "text" : "art", "indices" : [ 56, 60 ] }, { "text" : "artist", "indices" : [ 61, 68 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "467929836942417920", "text" : "RT @ZoeAppleseed: A little devil i drew the other night #art #artist http:\/\/t.co\/nGhc2LzOLW", "retweeted_status" : { "source" : "\u003Ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003ETwitter Web Client\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ { "expanded_url" : "http:\/\/twitter.com\/ZoeAppleseed\/status\/467929789693587456\/photo\/1", "indices" : [ 51, 73 ], "url" : "http:\/\/t.co\/nGhc2LzOLW", "media_url" : "http:\/\/pbs.twimg.com\/media\/Bn5rqbKIcAAoZmO.jpg", "id_str" : "467929787882041344", "id" : 467929787882041344, "media_url_https" : "https:\/\/pbs.twimg.com\/media\/Bn5rqbKIcAAoZmO.jpg", "sizes" : [ { "h" : 441, "resize" : "fit", "w" : 400 }, { "h" : 374, "resize" : "fit", "w" : 340 }, { "h" : 150, "resize" : "crop", "w" : 150 }, { "h" : 441, "resize" : "fit", "w" : 400 }, { "h" : 441, "resize" : "fit", "w" : 400 } ], "display_url" : "pic.twitter.com\/nGhc2LzOLW" } ], "hashtags" : [ { "text" : "art", "indices" : [ 38, 42 ] }, { "text" : "artist", "indices" : [ 43, 50 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "467929789693587456", "text" : "A little devil i drew the other night #art #artist http:\/\/t.co\/nGhc2LzOLW", "id" : 467929789693587456, "created_at" : "2014-05-18 07:28:50 +0000", "user" : { "name" : "Zoe Calton", "screen_name" : "ZoeAppleseed", "protected" : false, "id_str" : "2268581455", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/577990416483545088\/mhOWEjUQ_normal.jpeg", "id" : 2268581455, "verified" : false } }, "id" : 467929836942417920, "created_at" : "2014-05-18 07:29:01 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "467895737187971072", "text" : "I just made a really simple templating system. It is so obvious, I am sure someone else has done it before.", "id" : 467895737187971072, "created_at" : "2014-05-18 05:13:31 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "James Robert Somers", "screen_name" : "jsomau", "indices" : [ 13, 20 ], "id_str" : "93714279", "id" : 93714279 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "467832169058955265", "text" : "Progress\n\ncc @jsomau", "id" : 467832169058955265, "created_at" : "2014-05-18 01:00:55 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "467825206044545024", "text" : "So cool:\n\n1. Buy raspberry pi\n2. Install raspbmc\n3. Stream videos and music to your tv from your computer\/phone using upnp", "id" : 467825206044545024, "created_at" : "2014-05-18 00:33:15 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Thomas Bowker", "screen_name" : "Thomasbowker", "indices" : [ 0, 13 ], "id_str" : "108195355", "id" : 108195355 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "in_reply_to_status_id_str" : "467660845502066688", "geo" : { }, "id_str" : "467820986629230592", "in_reply_to_user_id" : 108195355, "text" : "@Thomasbowker yellow just doesn't compliment many colours.", "id" : 467820986629230592, "in_reply_to_status_id" : 467660845502066688, "created_at" : "2014-05-18 00:16:29 +0000", "in_reply_to_screen_name" : "Thomasbowker", "in_reply_to_user_id_str" : "108195355", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "James Robert Somers", "screen_name" : "jsomau", "indices" : [ 0, 7 ], "id_str" : "93714279", "id" : 93714279 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "in_reply_to_status_id_str" : "467453163789090816", "geo" : { }, "id_str" : "467526937951211522", "in_reply_to_user_id" : 93714279, "text" : "@jsomau Short on time but that is all functional already. Might put it up on github and invite you to the repo?", "id" : 467526937951211522, "in_reply_to_status_id" : 467453163789090816, "created_at" : "2014-05-17 04:48:02 +0000", "in_reply_to_screen_name" : "jsomau", "in_reply_to_user_id_str" : "93714279", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "James Robert Somers", "screen_name" : "jsomau", "indices" : [ 52, 59 ], "id_str" : "93714279", "id" : 93714279 } ], "media" : [ { "expanded_url" : "http:\/\/twitter.com\/james_a_forbes\/status\/467272028731744256\/photo\/1", "indices" : [ 60, 82 ], "url" : "http:\/\/t.co\/9XS7eXFIPO", "media_url" : "http:\/\/pbs.twimg.com\/media\/BnwVbr8CEAAegDV.png", "id_str" : "467272026734858240", "id" : 467272026734858240, "media_url_https" : "https:\/\/pbs.twimg.com\/media\/BnwVbr8CEAAegDV.png", "sizes" : [ { "h" : 477, "resize" : "fit", "w" : 600 }, { "h" : 729, "resize" : "fit", "w" : 915 }, { "h" : 150, "resize" : "crop", "w" : 150 }, { "h" : 270, "resize" : "fit", "w" : 340 }, { "h" : 729, "resize" : "fit", "w" : 916 } ], "display_url" : "pic.twitter.com\/9XS7eXFIPO" } ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "467272028731744256", "text" : "Worked a bit on my music archive project today.\n\nCC @jsomau http:\/\/t.co\/9XS7eXFIPO", "id" : 467272028731744256, "created_at" : "2014-05-16 11:55:07 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Surface", "screen_name" : "surface", "indices" : [ 0, 8 ], "id_str" : "612076511", "id" : 612076511 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "in_reply_to_status_id_str" : "467039100756037633", "geo" : { }, "id_str" : "467064164767105024", "in_reply_to_user_id" : 612076511, "text" : "@surface The device is wonderful. But my experience of Microsoft support was abysmal- the only thing that stops me from recommending them.", "id" : 467064164767105024, "in_reply_to_status_id" : 467039100756037633, "created_at" : "2014-05-15 22:09:09 +0000", "in_reply_to_screen_name" : "surface", "in_reply_to_user_id_str" : "612076511", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Surface", "screen_name" : "surface", "indices" : [ 41, 49 ], "id_str" : "612076511", "id" : 612076511 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "466849614184734720", "text" : "I just filled out a PDF paper form on my @surface using the stylus. Didn't have to do the whole print, write, scan, attach, send deal.", "id" : 466849614184734720, "created_at" : "2014-05-15 07:56:36 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "466786017681215488", "text" : "Our dog just hunted a rat out of the house. So much simpler than setting up traps etc.", "id" : 466786017681215488, "created_at" : "2014-05-15 03:43:53 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Casey Muratori", "screen_name" : "cmuratori", "indices" : [ 3, 13 ], "id_str" : "26452299", "id" : 26452299 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "466561995500978177", "text" : "RT @cmuratori: I feel like the + in Google+ must refer to the affirmative result on some test for a horrible sexually transmitted disease o\u2026", "retweeted_status" : { "source" : "\u003Ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003ETwitter Web Client\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "466497614758690816", "text" : "I feel like the + in Google+ must refer to the affirmative result on some test for a horrible sexually transmitted disease or something.", "id" : 466497614758690816, "created_at" : "2014-05-14 08:37:53 +0000", "user" : { "name" : "Casey Muratori", "screen_name" : "cmuratori", "protected" : false, "id_str" : "26452299", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/452880951710724096\/1d77bNCa_normal.jpeg", "id" : 26452299, "verified" : false } }, "id" : 466561995500978177, "created_at" : "2014-05-14 12:53:42 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "James Robert Somers", "screen_name" : "jsomau", "indices" : [ 0, 7 ], "id_str" : "93714279", "id" : 93714279 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "in_reply_to_status_id_str" : "466531695760789504", "geo" : { }, "id_str" : "466532845343612928", "in_reply_to_user_id" : 16025792, "text" : "@jsomau I'll make part of the archive tonight though, thanks for reminding me! What happened to that star wars news thing?", "id" : 466532845343612928, "in_reply_to_status_id" : 466531695760789504, "created_at" : "2014-05-14 10:57:52 +0000", "in_reply_to_screen_name" : "james_a_forbes", "in_reply_to_user_id_str" : "16025792", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "James Robert Somers", "screen_name" : "jsomau", "indices" : [ 0, 7 ], "id_str" : "93714279", "id" : 93714279 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 115, 138 ], "url" : "https:\/\/t.co\/pelHByc5Bn", "expanded_url" : "https:\/\/github.com\/JAForbes\/crescent", "display_url" : "github.com\/JAForbes\/cresc\u2026" } ] }, "in_reply_to_status_id_str" : "466530978559963136", "geo" : { }, "id_str" : "466531695760789504", "in_reply_to_user_id" : 93714279, "text" : "@jsomau I haven't started yet. I've been working on a simple json database with an interesting functional syntax. https:\/\/t.co\/pelHByc5Bn", "id" : 466531695760789504, "in_reply_to_status_id" : 466530978559963136, "created_at" : "2014-05-14 10:53:18 +0000", "in_reply_to_screen_name" : "jsomau", "in_reply_to_user_id_str" : "93714279", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 49, 72 ], "url" : "https:\/\/t.co\/t3hV4uRtLv", "expanded_url" : "https:\/\/www.youtube.com\/feather_beta", "display_url" : "youtube.com\/feather_beta" } ] }, "geo" : { }, "id_str" : "466370392366784512", "text" : "Youtube feather is great! (No ads, no comments)\nhttps:\/\/t.co\/t3hV4uRtLv\nWish there was a gmail feather.", "id" : 466370392366784512, "created_at" : "2014-05-14 00:12:20 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Tumblr", "screen_name" : "tumblr", "indices" : [ 0, 7 ], "id_str" : "52484614", "id" : 52484614 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "466369571621187585", "in_reply_to_user_id" : 52484614, "text" : "@tumblr has markdown support which is excellent! But I was disappointed that it was not github flavoured or markdown extra.", "id" : 466369571621187585, "created_at" : "2014-05-14 00:09:05 +0000", "in_reply_to_screen_name" : "tumblr", "in_reply_to_user_id_str" : "52484614", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "James Robert Somers", "screen_name" : "jsomau", "indices" : [ 0, 7 ], "id_str" : "93714279", "id" : 93714279 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "in_reply_to_status_id_str" : "466354662942441472", "geo" : { }, "id_str" : "466366641560096768", "in_reply_to_user_id" : 93714279, "text" : "@jsomau I like the concept! Haha battletoads! It'd be cool if you could pick or add your own items and affect the ratio.", "id" : 466366641560096768, "in_reply_to_status_id" : 466354662942441472, "created_at" : "2014-05-13 23:57:26 +0000", "in_reply_to_screen_name" : "jsomau", "in_reply_to_user_id_str" : "93714279", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ { "expanded_url" : "http:\/\/twitter.com\/james_a_forbes\/status\/466101438741897216\/photo\/1", "indices" : [ 68, 90 ], "url" : "http:\/\/t.co\/R02IuBMsFm", "media_url" : "http:\/\/pbs.twimg.com\/media\/BnfsyalCEAAiABa.png", "id_str" : "466101437328396288", "id" : 466101437328396288, "media_url_https" : "https:\/\/pbs.twimg.com\/media\/BnfsyalCEAAiABa.png", "sizes" : [ { "h" : 481, "resize" : "fit", "w" : 1024 }, { "h" : 281, "resize" : "fit", "w" : 600 }, { "h" : 150, "resize" : "crop", "w" : 150 }, { "h" : 159, "resize" : "fit", "w" : 340 }, { "h" : 536, "resize" : "fit", "w" : 1141 } ], "display_url" : "pic.twitter.com\/R02IuBMsFm" } ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "466101438741897216", "text" : "Been writing tests all day for my database project. 3 tests to go. http:\/\/t.co\/R02IuBMsFm", "id" : 466101438741897216, "created_at" : "2014-05-13 06:23:37 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "465344014770647041", "text" : "I used to think databases were the least interesting part of computer science. That is changing.", "id" : 465344014770647041, "created_at" : "2014-05-11 04:13:53 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "465127469968683008", "text" : "Just tried explaining my database API to my girlfriend.", "id" : 465127469968683008, "created_at" : "2014-05-10 13:53:25 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "465114174868033536", "text" : "I just wrote a very nice database API for a web project I am working on. So excited!", "id" : 465114174868033536, "created_at" : "2014-05-10 13:00:35 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "465057398546132993", "text" : "I just made an amazing thing.", "id" : 465057398546132993, "created_at" : "2014-05-10 09:14:58 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "adam", "screen_name" : "ADAMATOMIC", "indices" : [ 3, 14 ], "id_str" : "70587360", "id" : 70587360 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 51, 73 ], "url" : "http:\/\/t.co\/iMNiCGwavN", "expanded_url" : "http:\/\/vimeo.com\/94502406", "display_url" : "vimeo.com\/94502406" } ] }, "geo" : { }, "id_str" : "464940724547383296", "text" : "RT @ADAMATOMIC: via everybody, pitch perfect short http:\/\/t.co\/iMNiCGwavN", "retweeted_status" : { "source" : "\u003Ca href=\"http:\/\/tapbots.com\/software\/tweetbot\/mac\" rel=\"nofollow\"\u003ETweetbot for Mac\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 35, 57 ], "url" : "http:\/\/t.co\/iMNiCGwavN", "expanded_url" : "http:\/\/vimeo.com\/94502406", "display_url" : "vimeo.com\/94502406" } ] }, "geo" : { }, "id_str" : "464855645280153600", "text" : "via everybody, pitch perfect short http:\/\/t.co\/iMNiCGwavN", "id" : 464855645280153600, "created_at" : "2014-05-09 19:53:17 +0000", "user" : { "name" : "adam", "screen_name" : "ADAMATOMIC", "protected" : false, "id_str" : "70587360", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/583782677561507840\/w_Y9WDjX_normal.jpg", "id" : 70587360, "verified" : false } }, "id" : 464940724547383296, "created_at" : "2014-05-10 01:31:21 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Jonathan Whiting", "screen_name" : "whitingjp", "indices" : [ 3, 13 ], "id_str" : "154261726", "id" : 154261726 }, { "name" : "Holly Gramazio", "screen_name" : "severalbees", "indices" : [ 20, 32 ], "id_str" : "2870417379", "id" : 2870417379 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 85, 107 ], "url" : "http:\/\/t.co\/Qp3LH3TEYw", "expanded_url" : "http:\/\/severalbees.com\/blackbird\/how-to-be-a-blackbird.html", "display_url" : "severalbees.com\/blackbird\/how-\u2026" } ] }, "geo" : { }, "id_str" : "464746728562765824", "text" : "RT @whitingjp: This @severalbees twine about being a blackbird is super super lovely http:\/\/t.co\/Qp3LH3TEYw", "retweeted_status" : { "source" : "\u003Ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003ETwitter Web Client\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Holly Gramazio", "screen_name" : "severalbees", "indices" : [ 5, 17 ], "id_str" : "2870417379", "id" : 2870417379 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 70, 92 ], "url" : "http:\/\/t.co\/Qp3LH3TEYw", "expanded_url" : "http:\/\/severalbees.com\/blackbird\/how-to-be-a-blackbird.html", "display_url" : "severalbees.com\/blackbird\/how-\u2026" } ] }, "geo" : { }, "id_str" : "464732384852975616", "text" : "This @severalbees twine about being a blackbird is super super lovely http:\/\/t.co\/Qp3LH3TEYw", "id" : 464732384852975616, "created_at" : "2014-05-09 11:43:29 +0000", "user" : { "name" : "Jonathan Whiting", "screen_name" : "whitingjp", "protected" : false, "id_str" : "154261726", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/510788958536482816\/bKkEFHw5_normal.jpeg", "id" : 154261726, "verified" : false } }, "id" : 464746728562765824, "created_at" : "2014-05-09 12:40:29 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Zoe Calton", "screen_name" : "ZoeAppleseed", "indices" : [ 0, 13 ], "id_str" : "2268581455", "id" : 2268581455 } ], "media" : [ { "expanded_url" : "http:\/\/twitter.com\/james_a_forbes\/status\/464600373911904257\/photo\/1", "indices" : [ 36, 58 ], "url" : "http:\/\/t.co\/g1ykxNnWad", "media_url" : "http:\/\/pbs.twimg.com\/media\/BnKXlAsIEAAUTdW.jpg", "id_str" : "464600373668614144", "id" : 464600373668614144, "media_url_https" : "https:\/\/pbs.twimg.com\/media\/BnKXlAsIEAAUTdW.jpg", "sizes" : [ { "h" : 577, "resize" : "fit", "w" : 1024 }, { "h" : 577, "resize" : "fit", "w" : 1024 }, { "h" : 338, "resize" : "fit", "w" : 600 }, { "h" : 150, "resize" : "crop", "w" : 150 }, { "h" : 191, "resize" : "fit", "w" : 340 } ], "display_url" : "pic.twitter.com\/g1ykxNnWad" } ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "464600373911904257", "in_reply_to_user_id" : 2268581455, "text" : "@ZoeAppleseed and I scarving it up! http:\/\/t.co\/g1ykxNnWad", "id" : 464600373911904257, "created_at" : "2014-05-09 02:58:55 +0000", "in_reply_to_screen_name" : "ZoeAppleseed", "in_reply_to_user_id_str" : "2268581455", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Colossal", "screen_name" : "Colossal", "indices" : [ 3, 12 ], "id_str" : "203063180", "id" : 203063180 } ], "media" : [ { "expanded_url" : "http:\/\/twitter.com\/Colossal\/status\/464508592935022592\/photo\/1", "indices" : [ 139, 140 ], "url" : "http:\/\/t.co\/4UMY4KEKu8", "media_url" : "http:\/\/pbs.twimg.com\/media\/BnJEGoOIgAA4SQF.jpg", "id_str" : "464508592239181824", "id" : 464508592239181824, "media_url_https" : "https:\/\/pbs.twimg.com\/media\/BnJEGoOIgAA4SQF.jpg", "sizes" : [ { "h" : 150, "resize" : "crop", "w" : 150 }, { "h" : 531, "resize" : "fit", "w" : 800 }, { "h" : 398, "resize" : "fit", "w" : 600 }, { "h" : 225, "resize" : "fit", "w" : 340 }, { "h" : 531, "resize" : "fit", "w" : 800 } ], "display_url" : "pic.twitter.com\/4UMY4KEKu8" } ], "hashtags" : [ ], "urls" : [ { "indices" : [ 107, 129 ], "url" : "http:\/\/t.co\/JLLFBq8kZg", "expanded_url" : "http:\/\/www.thisiscolossal.com\/2014\/05\/kintsugi-the-art-of-broken-pieces", "display_url" : "thisiscolossal.com\/2014\/05\/kintsu\u2026" } ] }, "geo" : { }, "id_str" : "464572282091085824", "text" : "RT @Colossal: Kintsugi is a method for fixing broken ceramics with gold to create a more beautiful object. http:\/\/t.co\/JLLFBq8kZg http:\/\/t.\u2026", "retweeted_status" : { "source" : "\u003Ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003ETwitter Web Client\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ { "expanded_url" : "http:\/\/twitter.com\/Colossal\/status\/464508592935022592\/photo\/1", "indices" : [ 116, 138 ], "url" : "http:\/\/t.co\/4UMY4KEKu8", "media_url" : "http:\/\/pbs.twimg.com\/media\/BnJEGoOIgAA4SQF.jpg", "id_str" : "464508592239181824", "id" : 464508592239181824, "media_url_https" : "https:\/\/pbs.twimg.com\/media\/BnJEGoOIgAA4SQF.jpg", "sizes" : [ { "h" : 150, "resize" : "crop", "w" : 150 }, { "h" : 531, "resize" : "fit", "w" : 800 }, { "h" : 398, "resize" : "fit", "w" : 600 }, { "h" : 225, "resize" : "fit", "w" : 340 }, { "h" : 531, "resize" : "fit", "w" : 800 } ], "display_url" : "pic.twitter.com\/4UMY4KEKu8" } ], "hashtags" : [ ], "urls" : [ { "indices" : [ 93, 115 ], "url" : "http:\/\/t.co\/JLLFBq8kZg", "expanded_url" : "http:\/\/www.thisiscolossal.com\/2014\/05\/kintsugi-the-art-of-broken-pieces", "display_url" : "thisiscolossal.com\/2014\/05\/kintsu\u2026" } ] }, "geo" : { }, "id_str" : "464508592935022592", "text" : "Kintsugi is a method for fixing broken ceramics with gold to create a more beautiful object. http:\/\/t.co\/JLLFBq8kZg http:\/\/t.co\/4UMY4KEKu8", "id" : 464508592935022592, "created_at" : "2014-05-08 20:54:13 +0000", "user" : { "name" : "Colossal", "screen_name" : "Colossal", "protected" : false, "id_str" : "203063180", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/450852976337248256\/fOVTBYJu_normal.png", "id" : 203063180, "verified" : false } }, "id" : 464572282091085824, "created_at" : "2014-05-09 01:07:18 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "463949095149645824", "text" : "I'm building this interactive fiction sort of game, and I was going to use BackboneJS, but I'm thinking of scratching that and going ECS.", "id" : 463949095149645824, "created_at" : "2014-05-07 07:50:58 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "kyle pulver", "screen_name" : "kylepulver", "indices" : [ 0, 11 ], "id_str" : "50850314", "id" : 50850314 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "in_reply_to_status_id_str" : "463838846610710529", "geo" : { }, "id_str" : "463899094973284352", "in_reply_to_user_id" : 50850314, "text" : "@kylepulver Its so good to see an old Ludum Dare game revisted with care and attention. It makes me sad thinking of all the forgotten gems.", "id" : 463899094973284352, "in_reply_to_status_id" : 463838846610710529, "created_at" : "2014-05-07 04:32:17 +0000", "in_reply_to_screen_name" : "kylepulver", "in_reply_to_user_id_str" : "50850314", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "David Rosen", "screen_name" : "Wolfire", "indices" : [ 33, 41 ], "id_str" : "14679475", "id" : 14679475 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ { "indices" : [ 44, 66 ], "url" : "http:\/\/t.co\/aNm7BML9hE", "expanded_url" : "http:\/\/www.gdcvault.com\/play\/1020583\/Animation-Bootcamp-An-Indie-Approach", "display_url" : "gdcvault.com\/play\/1020583\/A\u2026" } ] }, "geo" : { }, "id_str" : "463597419364900864", "text" : "Procedural Animation GDC talk by @Wolfire. http:\/\/t.co\/aNm7BML9hE\n\nI'd love to try some of this stuff in 2d.", "id" : 463597419364900864, "created_at" : "2014-05-06 08:33:32 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "462128695658807297", "text" : "It'd be like space GTA", "id" : 462128695658807297, "created_at" : "2014-05-02 07:17:21 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "462128659722424320", "text" : "The interesting part to me was the tension of negotiating difficult traffic versus going off \"road\" and facing the wrath of the cops.", "id" : 462128659722424320, "created_at" : "2014-05-02 07:17:13 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "462128510820036608", "text" : "On the drive, I was imagining a space trader where trade routes were highways with speed limits and police.", "id" : 462128510820036608, "created_at" : "2014-05-02 07:16:37 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } } ]
"use strict" // write conde in here
'use strict'; /** * @name OnhanhSection * @description SectionConfig */ sectionModule .config(['$stateProvider', function($stateProvider) { var getCategories = ['Categories', function(Categories) { return Categories.query(); }]; var getSectionId = ['$stateParams', function($stateParams) { return $stateParams.id; }]; // Use $stateProvider to configure your states. $stateProvider .state("section", { title: "Mục", url: "/section", controller: 'sectionController', templateUrl: '/web/section/list.html', }) .state("section.new", { title: "New Section", url: "/new", views: { "@": { resolve: { categories: getCategories, sectionId: getSectionId, section:['Sections', function(Sections) { return new Sections(); }] }, controller: 'sectionDetailController', templateUrl: '/web/section/detail.html', } } }) .state("section.detail", { title: "Detail", url: "/:id", views: { "@": { resolve: { categories: getCategories, sectionId: getSectionId, section:['Sections', 'sectionId', function(Sections, sectionId) { return Sections.get({id: sectionId}); }] }, controller: 'sectionDetailController', templateUrl: '/web/section/detail.html', } } }); } ]);
import React from "react"; import gridIcon from "../assets/imgs/icon-1.svg"; import listIcon from "../assets/imgs/icon.svg"; import { Input } from "reactstrap"; export default function Sort() { return ( <div className="sort-bar"> <div className="left-bar"> <div className="mr-3">13 Items</div> <div className="sort-input"> <div className="mr-2">Sort By</div> <div className="bar-dropdown"> <Input type="select"> <option>Name</option> <option>Prices</option> <option>Rating</option> </Input> </div> </div> <div className="sort-input"> <div className="mr-2">Show</div> <div className="bar-dropdown"> <Input type="select"> <option>12</option> <option>13</option> <option>14</option> <option>15</option> <option>16</option> </Input> </div> </div> </div> <div className="right-bar"> <div className="active"> <img src={gridIcon} alt="grid-icon" /> </div> <div className="list-view"> <img src={listIcon} alt="grid-icon" /> </div> </div> </div> ); }
const categoryUI = ((SET) => { return { renderDetail: data => { let no = 1; let html = `` $('#main_content').html(html) }, } })(settingController) const categoryController = ((SET, DT, UI, LU) => { /* -------------------- DETAIL ACTION ----------------- */ const _fetchWorkOrder = (TOKEN, id, callback) => { $.ajax({ url: `${SET.apiURL()}work_order/${id}`, type: 'GET', dataType: 'JSON', beforeSend: xhr => { xhr.setRequestHeader("Authorization", "Bearer " + TOKEN) }, success: res => { callback(res.results) }, error: ({ responseJSON }) => { toastr.error(responseJSON.message, 'Failed', { "progressBar": true, "closeButton": true, "positionClass": 'toast-bottom-right' }); }, statusCode: { 404: () => { $('#app_content').load(`${SET.baseURL()}data_not_found`) }, 401: err => { let error = err.responseJSON if (error.message === 'Unauthenticated.') { $('#app_content').load(`${SET.baseURL()}unauthenticated`) } if (error.message === 'Unauthorized.') { $('#app_content').load(`${SET.baseURL()}unauthorized`) } } }, complete: () => { } }) } const _detailObserver = (TOKEN, id, data) => { MutationObserver = window.MutationObserver || window.WebKitMutationObserver; let container = document.querySelector("#detail_container") let observer = new MutationObserver(function (mutations, observer) { if (container.contains($('.btn-delete')[0])) { _openDelete('#main_content') _submitDelete(TOKEN, data => { location.hash = '#/administrator' }) } observer.disconnect(); }); observer.observe(container, { subtree: true, attributes: true, childList: true, }); } return { data: TOKEN => { const table = $('#t_category').DataTable({ autoWidth: true, responsive: false, scrollX: true, scrollY: 300, processing: false, // select: { // style: "multiple", // selector: "td:first-child" // }, language: SET.dtLanguage(), dom: "<'row mt-2 mb-2'<'col-md-6'B><'col-md-6'f>><t><'row'<'col-md-6'i><'col-md-6'p>>", keys: { columns: [1, 2] }, pageLength: 50, buttons: { dom: { button: { tag: 'button', className: 'btn btn-md btn-primary my-action' } }, buttons: [ { extend: 'collection', text: '<i class="fa fa-download"></i> ', titleAttr: 'Export Data', buttons: [ { extend: 'pdfHtml5', text: 'PDF', exportOptions: { columns: [0, 1, 2] }, filename: 'DATA_CATEGORY', title: 'Data Category', }, { extend: 'excelHtml5', text: 'Excel', exportOptions: { columns: [0, 1, 2] }, filename: 'DATA_CATEGORY', title: 'Data Category' }, { extend: 'csvHtml5', text: 'CSV', exportOptions: { columns: [0, 1, 2] }, filename: 'DATA_CATEGORY', title: 'Data Category' }, { extend: 'print', text: 'Print', exportOptions: { columns: [0, 1, 2] }, filename: 'DATA_CATEGORY', title: '<h4>Data Category</h4>' }, ] }, { extend: 'colvis', text: '<i class="fa fa-eye"></i>', columns: [1, 2], titleAttr: 'Hide Coloum' }, { text: '<i class="fa fa-spinner"></i>', action: function (e, dt, node, config) { dt.ajax.reload() }, titleAttr: 'Refresh' }, { text: '<i class="fa fa-search"></i>', action: function (e, dt, node, config) { $('#modal_search').modal('show') }, titleAttr: 'Search' }, ] }, ajax: { url: `${SET.apiURL()}category`, type: 'GET', dataType: 'JSON', beforeSend: xhr => { xhr.setRequestHeader("Content-Type", 'application/json') xhr.setRequestHeader("Authorization", "Bearer " + TOKEN) }, dataSrc: res => { $('#count_category').text(res.results.length) return res.results }, statusCode: { 401: err => { let error = err.responseJSON if (error.message === 'Unauthenticated.') { $('#app_content').load(`${SET.baseURL()}unauthenticated`) } if (error.message === 'Unauthorized.') { $('#app_content').load(`${SET.baseURL()}unauthorized`) } } }, error: err => { } }, columns: [ { data: "category_name", }, { data: "equipments_count", render: function (data, type, row) { return ` ${row.equipments_count} SKU `; } }, { data: "other_information", }, ], order: [[0, "asc"]] }) DT.dtFilter(table) }, detail: (TOKEN, id) => { _fetchWorkOrder(TOKEN, id, data => { console.log(data) _detailObserver(TOKEN, id, data) UI.renderDetail(data) }) } } })(settingController, dtController, categoryUI, lookupController) export default categoryController
let mockData =[{ _orderId: "012036487", _address: "北京市朝阳区曙光西里甲5号院", _people: "王先生", _tel: "18364871556", lat: 39.967411, lng: 116.460445 }, { _orderId: "012036488", _address: "曙光西里甲8号院", _people: "李先生", _tel: "14053265887", lat: 39.968838, lng: 116.456547, }, { _orderId: "012036489", _address: "北京市朝阳区左家庄北里58号", _people: "赵先生", _tel: "18452659663", lat: 39.964536, lng: 116.449079, }, { _orderId: "012036490", _address: "北京市朝阳区香河园路2号", _people: "黄先生", _tel: "13450624558", lat: 39.961466, lng: 116.456013, }, { _orderId: "012036491", _address: "北京市朝阳区东三环北路三源里北小街", _people: "尔先生", _tel: "1364578745", lat: 39.961478, lng: 116.462003, }, { _orderId: "012036492", _address: "北京市朝阳区东三环北路2号", _people: "刘先生", _tel: "13986521005", lat: 39.962904, lng: 116.463656, },] export default mockData
import React from 'react'; const Skill = () => ( <React.Fragment> <h2>Skill</h2> <ul> <li>Ruby</li> <li>Ruby on Rails</li> <li>PHP</li> <li>symfony</li> <li>JavaScript</li> <li>React.js</li> <li>Vue.js</li> <li>Node.js</li> <li>Java</li> <li>Swift</li> <li>HTML5</li> <li>CSS3</li> <li>Linux</li> <li>Git</li> </ul> </React.Fragment> ); export default Skill;