text
stringlengths
7
3.69M
module.exports = function($scope, $state, $location, $http, ImageService, QueryParser, ImageApiService, envService, UserService) { $scope.doImageSearch = function(){ console.log('_IMAGE: search controller') var query = QueryParser.parse($scope.searchText) var url = env...
// Generated by CoffeeScript 1.4.0 (function() { var TestResult; TestResult = (function() { function TestResult(_case, logs, error) { this["case"] = _case; this.logs = logs; this.error = error; this.pass = !this.error; } return TestResult; })(); module.exports = TestResu...
/* * * 文件名称:baseInfo.js * 摘 要:單一商品修改和新增 商品基本資料頁面 * */ var columnCount_freight; var columnCount_mode; var PRODUCT_ID, OLD_PRODUCT_ID = ''; var isChange = false; var SAVEPANEL, COURSEPANEL; var productInfo;///add by wwei0216w 定義一個productInfo 用來存儲查詢到的商品信息,以便其他代碼調用 //品牌Model Ext.define("gigade.Brand", { ...
import axios from 'axios' import router from '../router/index' import Cookies from 'js-cookie' //request header 根据需求添加 // axios.defaults.baseURL = 'http://test.178lottery.com'; // axios.defaults.headers.post['encryptDisable'] = true; // axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';...
import React, { useEffect, useState } from 'react'; import './App.scss'; //import de React Router import { BrowserRouter as Router, Switch, Route, Link } from 'react-router-dom'; //iport des composants import Nav from './Component/Nav'; import Popular from './Component/Popular'; import Upcoming from './Component/Upcom...
import React from 'react'; import { map, get, size, } from 'lodash'; import { Link } from 'react-router-dom'; import { loadAds } from '../api/ads'; import Pager from './Pager'; import Ad from './Ad'; import styles from './Ads.css'; export default class Ads extends React.Component { constructor(props) { sup...
var app = { showAlert: function (message, title) { if (navigator.notification) { navigator.notification.alert(message, null, title, 'OK'); } else { alert(title ? (title + ": " + message) : message); } }, registerEvents: function() { var self = this; if ( 'ontouchstart' in document.documentElement ...
import React from 'react' import authentication from '../services/authentication' import {Link} from 'react-router' const styles = { error: { color: '#FF0000', marginTop: '15px', }, }; const Login = React.createClass({ contextTypes: { router: React.PropTypes.object.isRequired, ...
// const object = { // methodOne: function() { // console.log('nilai method one') // }, // methodTwo: function() { // return this.methodOne() // } // } // const object = { // methodOne: ()=> { // console.log('aha') // }, // methodTwo: ()=> object.methodOne() // } // ...
import React from "react"; import styles from "./footer.module.scss"; import Icon from "../../utils/icon"; const Footer = () => { return ( <div className={"container-fluid " + styles.main_wrapper}> <div className="row"> <div className={styles.footer_wrapper}> <div className={styles.footer_...
import React from 'react' import { makeStyles, Grid, Typography, List, ListItem, ListItemText, Link } from '@material-ui/core' const useStyles = makeStyles(theme => ({ root: { backgroundColor: '#2D2D2D', color: theme.palette.common.white, }, component: { padding: theme.spacing(8, 8, 4), [theme.br...
'use strict'; const codependency = require('codependency'); codependency.register(module, { index: ['optionalPeerDependencies'] }); const connectors = require('./connectors'); const migrate = require('./migrate'); const models = require('./models'); let dbConfigs; // exports.registerConnectorType = (typeName, mo...
//* 全部的意思 import * as mod1 from './mod1'; console.log(mod1.a,mod1.b,mod1.c);
const API_URL = "http://localhost:8000/graphql"; class AuthService { login(email, password) { let requestBody = { query: ` query { login(email: "${email}", password: "${password}") { userId token tokenExpiration ...
/** Shuffle a set of numbers without duplicates. Example: // Init an array with set 1, 2, and 3. int[] nums = {1,2,3}; Solution solution = new Solution(nums); // Shuffle the array [1,2,3] and return its result. Any permutation of [1,2,3] must equally likely to be returned. solution.shuffle(); // Resets the array b...
let soma = require("./somar"); let subtrai = require("./subtrair"); let multplica = require("./multiplicar"); let divide = require("./dividir") function calculadora(num1,num2,operador){ switch(operador){ case "+": return soma(num1,num2); case "-": return subtrai(num1,num2); ...
const { NETLIFY_ENV } = require('../env') const hosting = [ // this (optional) plugin enables Progressive Web App + Offline functionality // To learn more, visit: https://gatsby.dev/offline // 'gatsby-plugin-offline', { resolve: 'gatsby-plugin-prefetch-google-fonts', options: { fonts: [ {...
import React, { Component } from 'react'; import { Container,Col, Row, Button, Form, FormGroup, Label, Input, FormText, Card } from 'reactstrap'; import { Link } from 'react-router-dom'; import './input-form.css'; class InputForm extends Component { render() { return ( <Container className="App...
import { nanoid } from 'nanoid'; import { hash as create, compare } from 'bcrypt'; import { api as apiConfig, web as webConfig } from 'modules/config'; const { passwords: { saltRounds }, tokens: { length: tokenLength } } = apiConfig; export const generateToken = () => { return nanoid(tokenLength); }; export c...
var http = require('http'), url = require('url'), matches = require('./matches'), zlib = require('zlib'), config = require('../config.json'), xml2js = require('xml2js'); function read(feedurl, cb) { var urldata = url.parse(feedurl); var options = { host: urldata.ho...
import { useLoaderData, Form, redirect } from "react-router-dom"; import { deleteNote, getNote } from "../notes"; export default function Note() { const note = useLoaderData(); return ( <div> <h2>{note.title}</h2> <div>{note.content}</div> <Form method="post" style={{ marginTop: "2rem" }}> ...
/** * Created by xiaojiu on 2017/4/14. */ define(['../app'], function (app) { app.directive('autofocus', ['$timeout', function ($timeout) { return { restrict: 'A', link: function ($scope, $element) { $timeout(function () { $element[0].focus()...
module.exports = ({ node }) => `<p>${node.getContent()}</p>`;
import NavigationService from '../../services/navigation.service.js'; export default { name: 'Home', // components: { PageAvatar }, data() { return { apps: [], }; }, mounted() { this.apps = NavigationService.Apps; }, };
'use strict'; var util = require('util'); var path = require('path'); var yeoman = require('yeoman-generator'); var yosay = require('yosay'); var JadePreviewGenerator = yeoman.generators.Base.extend({ initializing: function () { this.pkg = require('../package.json'); }, prompting: function () { var done...
import React, { useEffect } from 'react'; import styled from 'styled-components'; import { connect } from 'react-redux'; import { setCurrentNamespace, setCurrentNamespaceData } from '../actions/namespaceActions'; import { setCurrentRoomName, setRoomInfo } from '../actions/roomActions'; import UserBox from '../component...
// Creates a products array let _products = []; /* Fetches json data from the file persons.json */ fetch('json/products.json') .then(function (response) { return response.json(); }) .then(function (json) { console.log(json); // Json array gets inserted into empty products array products = json;...
import * as React from 'react'; import { List, ListItem } from 'material-ui/List'; class ActionShowRecentImagery extends React.Component { constructor(props) { super(props); this.state = { visibility: false }; } addImagery() { if (this.props.map.getLayer('Imagery')) { va...
angular.module('ngApp.mileStone').controller('TradelaneTrackingMileStoneController', function ($scope, TradelaneMilestoneService, $translate, $uibModal, toaster, ModalService) { var setMultilingualOptions = function () { $translate(['FrayteError', 'FrayteInformation', 'FrayteValidation', 'FrayteSuccess', '...
import React from 'react'; import { Title, TextBlock, InvasivePotential, Resources, Resource, Summary, SexualReproduction, AsexualReproduction, EcologicalNiche, PopulationDensity, EnvironmentImpact, ManagementMethod, ManagementApplication, OriginalArea, SecondaryArea, Introduction, Breeding, CaseImage...
import React from 'react' import styled from "styled-components"; const Card = styled.div` padding-left:15px; margin-top:-10px; font-size:0.8rem; width:42%; color:red; ` const Error = ({code}) => { let errorMessage = "" switch (code){ case 1: errorMessage = "Selecione um token" break...
import fetch from 'isomorphic-fetch'; import Promise from 'bluebird'; Promise.promisifyAll(fetch); export const LOAD_LOCALE = 'LOAD_LOCALE'; export const loadLocale = ( locale ) => { return { type: LOAD_LOCALE, locale }; }; export const isLocaleLoaded = ( globalState ) => { return globalState.locale &&...
tippy('#books-statistics', { theme: 'light-border', arrow: false, allowHTML: true, placement: 'right', touch: false, maxWidth: 550, interactive: true, interactiveBorder: 1, content: '<div class="article-component"><h1>Statistics</h1><ul><li>Ellenberg, How Not to Be Wrong (2014)</li><...
//https://www.hackerrank.com/challenges/quicksort3 //Lomuto partition scheme function processData(input) { 'use strict'; const len = input.split('\n'); const arr = len.pop().split(' ').map(Number); let partition = function(arr, lo, hi){//splits array in half based on high and low ends of array. ...
import {SEARCH_TASK} from '../actions/search'; export default function search(state = "", action) { switch (action.type) { case SEARCH_TASK: return action.payload; default: return state; } }
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const bringToFront = require('bindings')('bringToFront'); function pid(pid) { return bringToFront.pidToFront(pid); } exports.pid = pid;
import styled from "styled-components"; const Overlay = styled.div` width: 200 !important; height:10% !important; background-color: rgba(255, 255, 255, 1); overflow-x: hidden; transition: 0.5s; a { padding: 8px; text-decoration: none; font-size: 36px; color: #d31027; display: block; ...
var express = require('express'); var nunjucks = require('nunjucks'); var db = require('./db.js') var path = require('path') var app = express(); app.set('view engine', 'html'); app.engine('html', nunjucks.render); app.use('/vendor', express.static(path.join(__dirname, 'node_modules'))); //static routing. express let...
import feathers from 'feathers-client' import io from 'socket.io-client' const prodConfig = { appURL: 'https://io-app-backend.now.sh' } const devConfig = { appURL: 'http://localhost:3030' } const getConfig = () => window.location.hostname.startsWith('localhost') ? devConfig : prodConfig const socket = io(ge...
//CARICAMENTO ELEMENTI E AGGIORNAMENTO COSTO TOTALE var costoTotale = 0; let divCostoTotale = document.getElementById("prezzoTotale"); divCostoTotale.textContent="€ " + costoTotale; function onJson(json){ console.log(json); if(json.length === 0){ //se il carrello è vuoto: let divMessaggio = do...
import React, {useState, useEffect} from 'react' import axios from 'axios' import Posts from '../Components/posts' import ProfileCard from '../Components/ProfileCard' import PostSection from '../Components/PostSection' import getCookie from '../Components/getCookie' function Feed(){ const [posts, setPosts] = us...
import styled from 'styled-components'; export const Login = { wrap: styled.div` flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; background-color: #000000; color: #ffffff; `, input: styled.input` width: 80%; max-width: 300px; h...
export const mainActionTypes = { GET_DATA: 'GET_DATA', DELETE_ITEM: 'DELETE_ITEM', CLEAR_REDUCER: 'CLEAR_REDUCER' }
const myPromise = new Promise((resolve, reject) => { if (false) { setTimeout(() => { resolve("I have succeed"); }, 1000); } else { reject("I have failed"); } }); myPromise .then((value) => value + '!!!!') .then(newValue => console.log(newValue)) .catch((errorValue) => console.log(errorVal...
import { expect } from 'chai'; import { shortHash, validateHash } from './hashUtils'; describe('shortHash()', () => { it('shorten the hash when too long', () => { const h = '387b5d41024cb8b99d6d4baec3d2651e0999e73e51ee88df01496d08917a3b65'; const expected = '387b5d41..65'; expect(shortHash(h)).to.e...
/* See license.txt for terms of usage */ define([ "firebug/firebug", "firebug/lib/trace", "firebug/lib/events", "firebug/lib/string", "firebug/lib/url", "firebug/debugger/debuggerLib", "firebug/debugger/script/sourceLink", "firebug/net/netUtils", ], function(Firebug, FBTrace, Events, St...
import botkit from 'botkit'; require('dotenv').config(); // I struggled to get my environmental variables working correctly, so I went with the dotenv method of importing instead. // I learned about the Yelp API from the following link: https://github.com/olalonde/node-yelp . const Yelp = require('yelp'); const yelp...
function getURL(fileID){ wx.cloud.downloadFile({ fileID: fileID, success: res => { // get temp file path console.log(res.tempFilePath) return res.tempFilePath }, fail: err => { // handle error console.log('getURL失败', err) } }) } module.exports.getURL = getURL
module.exports = function(req, res, next){ if(!req.session.user){ req.session.user = { auth0_id: '', profile_name: '', picture: '', email: '', room_name: '' } } next(); }
import React from 'react' import PropTypes from 'prop-types' function Search(props) { return ( <div> </div> ) } Search.propTypes = { } export default Search
import React from "react"; import { getStoryName } from "storybook/storyTree"; import UncontrolledFooterApp from "./examples/UncontrolledFooter"; const storyName = getStoryName("ListBoxWithTags"); export default { title: storyName, }; export const ListBoxWithTagsUncontrolledFooter = () => <UncontrolledFooterApp />...
var num=parseInt(process.argv[2]); function hanoi(num){ move("1","3",num); } var step=0; function move(start,end,move_num){ if(move_num==1){ console.log("第"+(++step)+"步 ",start,"---->",end); }else{ var other="123".replace(start,"").replace(end,""); move(start,other,move_num-1); ...
import img from "../../../assets/attachment.svg"; import menuSvg from "../../../assets/menu.svg"; import { getElement, $, Events } from "../router/utils"; import { getChatData, MessageManager, updateDb } from "./chat-logic.js"; import { noAuth } from "../ext"; import { IDB } from "../idb"; const typingBox = { elemen...
(function (window) { 'use strict'; /** * Defines global d3Scomos object for export */ //var d3scomos = d3.scomos = {version: "0.0.1"}; //library version var d3scomos = {version: "0.0.1"}; //library version /** private method to init library instance with dependencies * @param {Object} config object with opt...
var mongoose = require('mongoose'); var tagSchema = new mongoose.Schema({ tagName: { type: String, required: true }, dreams: { type: [mongoose.Schema.Types.ObjectId], ref: 'Dream' } }) mongoose.model('Tag', tagSchema);
/* global requirejs */ requirejs.config({ baseUrl: '/javascripts/libs', paths: { app: '/javascripts', jquery: '/bower_components/kendo-ui/js/jquery.min', k: '/bower_components/kendo-ui/js', templates: '/templates', lodash: '/bower_components/lodash/dist/lodash.min' }, shim: { k: ['jquery...
export default { name: "language", title: "Language", type: "document", fields: [ { name: "name", title: "Name", type: "string", }, { name: "filed", title: "Filed", type: "string", }, { name: "id", title: "Id", type: "number", }, ...
var ng = {}; ng.a = angular.module('todoDomain', ['ngSanitize', 'angular-sortable-view']); ng.a.config(function () { });
import React from "react"; import "./Header.css"; import HomeIcon from "@material-ui/icons/Home"; import FlashOnIcon from "@material-ui/icons/FlashOn"; import LiveTvIcon from "@material-ui/icons/LiveTv"; import VideoLibraryIcon from "@material-ui/icons/VideoLibrary"; import SearchIcon from "@material-ui/icons/Search"; ...
import 'normalize.css'; import '../css/index.css' import * as THREE from 'three'; import CANNON from 'cannon'; import Renderer from './engine/Renderer'; import Syncer from './engine/Syncer'; import User from './entities/User'; import Player from './entities/Player'; import Sun from './entities/Sun'; import Cube fro...
const fs = require('fs'); const path = require('path'); const Sequelize = require('sequelize'); const config = require('../config/config.js'); const db = {}; const sequelize = new Sequelize( config.db.database, config.db.user, config.db.password, config.db.options, { define: { char...
module.exports = function(app) { require(__dirname + '/header')(app) }
require('../lib/config'); var Redis = require('../lib/util/redis'); global.redis = { _connection: null, connect: function() { this._connection = Redis.connect(); }, disconnect: function() { this._connection.quit(); }, sets: function(k, v) { this._connection.sets(k, v, function(err, created, ...
(function () { angular .module('myApp') .controller('FeedbackAnswer2Controller', FeedbackAnswer2Controller) FeedbackAnswer2Controller.$inject = ['$state', '$scope', '$rootScope']; function FeedbackAnswer2Controller($state, $scope, $rootScope) { $rootScope.setData('showMenubar', tr...
"use strict"; const {Router} = require(`express`); const {HttpCode} = require(`~/constants`); const { routeParamsValidator, articleExist, articleValidator, commentValidator, } = require(`~/service/middlewares`); module.exports = (app, service, commentService) => { const route = new Router(); app.use(`/a...
describe('Hello Github Packages', () => { it('Should Load Package Registry by Github', () => { const HelloGithubPackages = require('@guilouro/hello-github-packages') expect(HelloGithubPackages.Hi()).toBe('Github Packages works fine!') }) })
import Vue from 'vue' import App from './App.vue' import './registerServiceWorker' import router from './router' import Buefy from 'buefy' import 'buefy/dist/buefy.css' Vue.use(Buefy) Vue.config.productionTip = false Vue.prototype.$vuescrollConfig = { mode: 'slide', bar: { background: '#000' } };...
/* @flow */ 'use strict'; import type { Path } from '../drawing/Path'; import type { BoundCurves } from '../Bounds'; import type ResourceLoader, { ImageElement } from '../ResourceLoader'; import type { Border } from './border'; import type { Padding } from './padding'; import Color from '../Color'; import Length from ...
const oddArray = [1, 3, 5, 7, 9, 11, 13]; test('should start correctly', () => { expect(oddArray).toContain(1); expect(oddArray).toContain(3); expect(oddArray).toContain(5); expect(oddArray).toContain(7); expect(oddArray).toContain(9); });
import React from "react"; import Game from "../../ticTacToe/classes.js"; class TicTacToe extends React.Component { constructor(props) { super(props); this.state = { board: new Game.Board(), player: 1, difficulty: 'easy' } this.togglePlayer = this.togglePlayer.bind(this); this.sp...
import React from 'react'; import LoginForm from '../../components/LoginForm'; import SignupForm from '../../components/SignupForm'; import ForgotPasswordForm from '../../components/ForgotPasswordForm'; import { StyledSection, StyledForm, StyledButton, StyledText, StyledForgotPasswordButton, St...
$(document).ready(function () { Cargar(); $(function () { $("#productonombre").on('input', function () { var val = this.value; if ($('#productolist').find('option').filter(function () { return this.value.toUpperCase() === val.toUpperCase(); }).length) ...
import React, { useContext } from "react"; import { Context } from "../store/appContext"; import { Login } from "../component/login.js"; import { Inside } from "../component/inside.js"; import { Footer } from "../component/footer.js"; export const Home = () => { const { store, actions } = useContext(Context); return...
// pages/code/code.js Page({ data: {}, onLoad: function (options) { // 页面初始化 options为页面跳转所带来的参数 wx.setNavigationBarTitle({ title: '交流合作', success: function (res) { // success } }) }, // 分享 onShareAppMessage: function () { return { title: '关注我们', path: '/pa...
exports.user_server = { num_worker: 1, port: 4002 }; exports.mongodb_options = { host: "JCloud-DB-01", port: 27018, database: "user" }; exports.lego_remotes = [ {host: "JCloud-04",port:6006}, {host: "JCloud-04",port:6106} ];
/** * Created by xiaojiu on 2017/3/28. */ 'use strict'; define(['../../../app'], function (app) { app.factory('platformExpenseAudit', ['$http','$q','$filter','HOST',function ($http,$q,$filter,HOST) { return { getThead: function () { return [ {name:'序号',type:...
import React from 'react'; import { Link } from 'react-router-dom'; const NavigationBar = () => { return ( <div> <ul className='app-navbar'> <li> <Link to='/'>Home</Link> </li> <li> <Link to='/WebApp'>Web App</Link> </li> <li> <Link to='/ChatApp'>Chat App</Link> </li> ...
import React from "react"; export default function Content() { return <React.Fragment />; } Content.displayName = "OverflowMenu.Content";
var app = angular.module('itemEdit', ['toastr']); app.controller('itemEditCtrl', function($scope, itemSer,$stateParams,$state,toastr){ $scope.showed=true itemSer.getArea().then(function(response){ if(response.data.code == 0){ $scope.areas = response.data.data; } }); itemSer.getPr...
'use strict'; angular.module('toons', []);
import React from "react"; import { withRouter } from "react-router-dom"; import moment from 'moment' import SearchForm from "./SearchForm"; class SearchFormContainer extends React.Component { state = { barrio: "", deporte: "", fecha: undefined, createdAt: moment(), calendarFocused: fa...
// @ts-nocheck // eslint-disable-next-line no-unused-vars import elementCreator from './elementCreator'; const style = document.createElement('template'); style.innerHTML = ` <style> #inputEl { width: 0.1px; height: 0.1px; opacity: 0; overflow: hidden; position: absolute; z-in...
import React, { PropTypes } from 'react'; import ReactDOM from 'react-dom'; import withStyles from 'isomorphic-style-loader/lib/withStyles'; import s from './EditPage.less'; import {SuperTable, ModalWithDrag} from '../../../../components'; const props = { title: PropTypes.string, config: PropTypes.object, contro...
export const HOURS_PER_DAY = 24; export const MINUTES_PER_HOUR = 60; export const SECONDS_PER_MINUTE = 60; export const MSECONDS_PER_SECOND = 1000; export const SECONDS_PER_DAY = HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE;
import React, { Component } from "react"; import styled from "styled-components"; import { NavLink } from "react-router-dom"; import ButtonIcon from "../../atoms/ButtonIcon/ButtonIcon"; import Logo from "../../atoms/Logo/Logo"; import ListItem from "../../atoms/ListItem/ListItem"; import { faShoppingCart, faHamburger }...
export default { state: { ssjg: [], qq: {} }, getters: { }, actions: { // 异步操作,请求数据 getssjg (context, value) { fetch(`/zs/book/fuzzy-search?query=${value}&start=0&limit=15`) .then(res => res.json()) .then(dataa => { console.log(dataa) contex...
app.controller("undergraduateCtrl", function ($scope, $http, $location) { //write the code over here var getDiplomski = function () { $http.get("/api/subjects/undergraduate").then( function success(res) { $scope.diplomski = res.data; }, func...
"use strict"; // // lib and utils // const util = require("util"), fs = require("fs"), http = require("http"), https = require("https"), URL = require("url").URL, crypto = require("crypto"), path = require("path"); // // g suite settings // const GSSCOPE = "https://www.googleapis.com/auth/gmail.readonl...
/** * Created by prasanndubey on 13/09/17. */ import React, { Component } from 'react'; import { StyleSheet, Text, View, TouchableOpacity,ScrollView,TextInput } from 'react-native'; const Note = ({keyval,key,val,deleteMethod}) => { return ( <View key={keyval} style={styles.note}> ...
const Discord = require("discord.js"); //unban @member module.exports.run = async (bot, message, args) => { let tounban = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0])); let repchannel = message.guild.channels.find(`name`, "🌘reports_bots"); let errorschannel = messa...
// test the website navbar links var baseUrl = casper.cli.options.baseUrl; casper.test.begin("test the navbar links", 5, function(test) { casper.start(baseUrl, function() { test.assertTitle('Home'); this.click('nav a[href="music"]'); }); casper.then(function() { t...
import React from 'react'; import './scss/components/login.scss'; import spotifyLogo from './images/spotify-logo.png'; class Login extends React.Component { async spotifyLogin() { let res = await fetch('/login') let resText = await res.text() console.log(resText); window.location.replace(resText)...
import shopList from './data/shopes' import mockUtil from './mock_util' export default { list (reqBody) { return new Promise((resolve, reject) => { setTimeout(() => { resolve(mockUtil.success(mockUtil.buildPageResp(shopList))) }) }) }, get (id) { const listFilterById = shopList.fi...
/** * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.md. */ 'use strict'; const fs = require( 'fs' ); const path = require( 'upath' ); const shell = require( 'shelljs' ); /** * @param {Object} callOptions Call options. * @param {String} cwd An a...
// export de module // on defini notre fnc de requete reponse et next module.exports = { admin: (req, res, next) => { // console.log('Middleware Admin: ', req.session) //la requete session n'est pas admin on redirige sur ('/') if (!req.session.isAdmin) res.redirect('/') // simo...
// this looked for matching items within two arrays const bobsFollowers = ['Joe', 'Mike', 'Mary', 'Jan']; const tinasFollowers = ['Joe', 'Mark', 'Mary']; const mutualFollowers = [] for (let i = 0; i < bobsFollowers.length; i++) { // this goes through each item in the first array for (let j = 0; j < tinasFollowers.l...
// @flow import * as React from "react"; import moment from "moment"; import Select from "lk/components/Select/Select.jsx"; import { AdminFileUpload } from "./components/AdminFileUpload.js"; function singleFileContainer( props: Props ): React.Node { const onChange = ( field: string, value: any ) => props.onChang...
import React, { Component } from "react"; import PropTypes from "prop-types"; import ItemFeed from "./ItemFeed"; import SelectListGroup from "../common/SelectListGroup"; import fetchItems from "../common/hoc/fetchItems"; import fetchCurrentUser from "../common/hoc/fetchCurrentUser"; import { SecondaryHeader } from "../...
var Error = require('../errors'); var User = require('../models/user'); module.exports = function (req,res,next) { console.log(req.session); if ((!req.session) || (!req.session.token)) { console.log('redirect 1'); res.redirect('/login.html'); return; } User.findById(req.session.token,function(e...
import React from 'react'; import {Link} from 'react-router-dom'; const Nav = () => { return( <div> <nav className="navbar navbar-expand-md navbar-dark bg-dark mb-4"> <div className="container-fluid"> <Link to="/" className="navbar-brand">Log in</Link> <div> <ul clas...