text
stringlengths
7
3.69M
const gulp = require("gulp"); const babel = require("gulp-babel"); const uglify = require("gulp-uglify"); const header = require("gulp-header"); // using data from package.json var pkg = require("./package.json"); var banner = ["/**", " * <%= pkg.name %>", " * @version v<%= pkg.version %>", " * @link <%= pkg.homepage %>", " * @license <%= pkg.license %>", " */",""].join("\n"); gulp.task("default", () => { return gulp.src([ "src/*.js", "src/**/*.js"]) .pipe(babel({ presets: ["env"], // minified: true, comments: false })) .pipe(uglify()) .pipe(header(banner, {pkg: pkg})) .pipe(gulp.dest("dest")) .pipe(gulp.dest("docs")); }); gulp.task("debug", () => { return gulp.src([ "src/*.js", "src/**/*.js"]) .pipe(babel({ presets: ["env"], minified: false, comments: true })) .pipe(header(banner, {pkg: pkg})) .pipe(gulp.dest("dest")) .pipe(gulp.dest("docs")); });
Template.video.isActive = function () { return Session.get('status') === 'video'; }; Template.video.rendered = function () { if (Session.equals('status', 'video')) { var tag = document.createElement('script'); tag.src = "https://www.youtube.com/player_api"; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); } }
function demo() { // config physics setting phy.set( {substep:1, gravity:[0,-9.81,0]}); // add static ground phy.add({ type:'plane', size:[300,1,300], visible:false }); // add dynamic sphere phy.add({ name:'box1', size:[1,1,1], pos:[-100,2,0], density:1, restitution:0.5, friction:0.9 }); phy.add({ name:'box2', size:[1,1,1], pos:[ 100,2,0], density:1, restitution:0.5, friction:0.9 }); // add simple joint phy.add({ type:'joint', mode:'ragdoll', b1:'box1', b2:'box2', pos1:[1,0,0], pos2:[-1,0,0], sd:[10, 1] }); phy.add({ type:'ray' }); phy.add({ type:'ray', begin:[1,4,0], end:[1,0.1,0] }); phy.add({ type:'ray', begin:[-1,4,0], end:[-1,0.1,0] }); }
const chalk = require('chalk'); module.exports = function(){ console.log(chalk.yellow( ` 1) Try googling along the lines of "random integer javascript" or "random num in range js" and "round up number javascript" 2) Make sure that the final value is stated on the same line after the "return" keyword ` )); process.exit(); };
import React, { Component } from 'react'; // import { Link } from 'react-router-dom'; import {Grid, Row, Col, Image,} from 'react-bootstrap'; import API from "../utils/API" import './About.css' export default class About extends Component { state = { email: [], }; componentDidMount() { this.loadEmail(); console.log(this.state); } loadEmail = () => { API.getinfo() .then(res => this.setState({ email: res.data, })) .catch(err => console.log(err)); }; render() { return ( <Grid> <Row className="show-grid text-center"> <Col xs={12} lg={6} className="person-wrapper"> <Image src="assets/Jaguar.jpg" square className="guitar-pic" /> </Col> <Col xs={12} lg={6} className="person-wrapper"> <Image src="assets/IMG_2641.jpg" square className="machine-pic" /> </Col> </Row> <h4>{this.state.email.email}</h4> </Grid> ); } }
var gulp = require("gulp"); // # 1) Chargement du "task automater" var browserSync = require('browser-sync').create(); var sass = require('gulp-sass'); var ts = require('gulp-typescript'); var sourcemaps = require('gulp-sourcemaps'); gulp.task('browser-sync', ['sass', 'ts'],() => { browserSync.init({ server: { baseDir: "./" } }); gulp.watch("styles/scss/*.scss", ['sass']); gulp.watch('./Ts/**/*.ts', ['ts']); gulp.watch('*.html').on('change', browserSync.reload); // gulp.watch("Js/*.js").on('change', browserSync.reload); }); gulp.task('sass', () => { return gulp.src('./styles/sass/*.scss') .pipe(sass().on('error', sass.logError)) .pipe(gulp.dest('./styles/css')) .pipe(browserSync.stream()); }); gulp.task('ts', () => { return gulp.src('Ts/*.ts') .pipe(sourcemaps.init()) .pipe(ts({ module : "system", // Spécifie le module du 'code generation' (tsc) noImplicitAny : true, // Va forcer à demander un type (non any) target : "ES6", // Je veux cibler de l'es2017 sourceMap : true, // Permet de générer le mappage (console.log des ts affichés à la place des console.log Js) preserveConstEnums : true, // N'effaces pas les constantes déclarées experimentalDecorators : true, })) .pipe(sourcemaps.write()) .pipe(gulp.dest('Js')) .pipe(browserSync.stream()); }); gulp.task('default', ['browser-sync']);
/* 给你个整数数组 arr,其中每个元素都 不相同。请你找到所有具有最小绝对差的元素对,并且按升序的顺序返回。 示例 1: 输入:arr = [4,2,1,3] 输出:[[1,2],[2,3],[3,4]] 示例 2: 输入:arr = [1,3,6,10,15] 输出:[[1,3]] 示例 3: 输入:arr = [3,8,-10,23,19,-4,-14,27] 输出:[[-14,-10],[19,23],[23,27]]   提示: 2 <= arr.length <= 10^5 -10^6 <= arr[i] <= 10^6 来源:力扣(LeetCode) */ /** * @param {number[]} arr * @return {number[][]} */ var minimumAbsDifference = function(arr) { let sorted = arr.sort((a, b) => a - b); let res = [], tmp; let min = sorted[1] - sorted[0]; for (let i = 1; i < sorted.length; i++) { tmp = sorted[i] - sorted[i - 1]; if(min > tmp) { min = tmp res = [[sorted[i - 1], sorted[i]]]; } else if(min == tmp) { res.push([sorted[i - 1], sorted[i]]); } } return res; }; // const arr = [4,2,1,3]; // const arr = [1,3,6,10,15]; const arr = [3,8,-10,23,19,-4,-14,27]; console.log(minimumAbsDifference(arr));
import React from "react"; import ProductHero from "../ProductHero"; function Products() { return ( <> <ProductHero /> </> ); } export default Products;
/*jshint esversion: 6 */ import { $, $$ } from "./helpers.js"; import { getList } from "./template.js"; const url = "/api/todo"; // setting the api path const fetchTodos = () => { // GET TODOS function fetch(url) // FetchAPI GET .then(res => res.json()) .then(todos => { getList(todos); const buttons = $$(".delete"); // after getting the list add event listeners fo delete buttons buttons.forEach((button) => { button.addEventListener("click", deleteTodo); }); }); }; const addTodo = (e) => { // POST TODO function e.preventDefault(); // prevent page reload const todoValue = $(".input").value; // get the input value of the new todo fetch(url, { // FetchAPI POST method: "POST", headers: { "Accept": "application/json", "Content-Type": 'application/json' }, body: JSON.stringify({todo: todoValue}) }) .then(fetchTodos()); // after inserting new todo get the whole list }; const deleteTodo = (e) => { // DELETE TODO function e.preventDefault(); // prevent page reload const id = e.target.value; // get the id of the todo to be deleted fetch(url, { // FetchAPI DELETE method: "DELETE", headers: { "Accept": "application/json", "Content-Type": 'application/json' }, body: JSON.stringify({id: id}) }) .then(fetchTodos()); // after deleting a todo get the whole list }; export {fetchTodos, addTodo, deleteTodo};
var maildir_2lib_8h = [ [ "maildir_check_empty", "maildir_2lib_8h.html#ac1193cf5991629c477975ee74c97a65a", null ], [ "maildir_gen_flags", "maildir_2lib_8h.html#ac1b43584aaf8f3ddc0ebf28da7cc2bfb", null ], [ "maildir_msg_open_new", "maildir_2lib_8h.html#ae87ffa67156fad45fc687d8453fc384d", null ], [ "maildir_open_find_message", "maildir_2lib_8h.html#a8c1dd82fc41fced471926501135b95d4", null ], [ "maildir_parse_flags", "maildir_2lib_8h.html#afad70ac642ae3a3a925778412bb64097", null ], [ "maildir_parse_message", "maildir_2lib_8h.html#a8fc323eb62e562ccedcba11e29a39631", null ], [ "maildir_parse_stream", "maildir_2lib_8h.html#a0f75c9821ec9e4b65add4260c35e61d4", null ], [ "maildir_sync_mailbox_message", "maildir_2lib_8h.html#a84c07eea1c6efb479a562ba1e9629350", null ], [ "maildir_update_flags", "maildir_2lib_8h.html#a79713d04e839c3782ef9e0b7bc25e9c0", null ], [ "mh_check_empty", "maildir_2lib_8h.html#a0bc1f221906f8f540fa7a98e81f0dc31", null ], [ "mh_sync_mailbox_message", "maildir_2lib_8h.html#a233a7a0d01e5a50160e42219674f2e16", null ], [ "config_init_maildir", "maildir_2lib_8h.html#a6ef3e1ae79d5e93c50bf6d68b9b0d49b", null ], [ "C_MaildirTrash", "maildir_2lib_8h.html#a0d0cecbc72552d9702502c21b938d581", null ], [ "MxMaildirOps", "maildir_2lib_8h.html#a0748343fa768080ad12f35154d7dfbde", null ], [ "MxMhOps", "maildir_2lib_8h.html#a1c6613efa24f50ed6d0c077738937838", null ] ];
vti_encoding:SR|utf8-nl vti_timelastmodified:TW|06 Mar 2015 16:20:13 -0000 vti_author:SR|DWANE\\Dwane vti_modifiedby:SR|DWANE\\Dwane vti_nexttolasttimemodified:TW|06 Mar 2015 16:20:13 -0000 vti_timecreated:TR|06 Mar 2015 21:00:21 -0000 vti_cacheddtm:TX|06 Mar 2015 21:00:21 -0000 vti_filesize:IR|95931 vti_extenderversion:SR|12.0.0.0 vti_backlinkinfo:VX|AddMember.html Layout.html
// ########################CONFIG######################## var express = require('express'); var app = express(); var bodyParser = require('body-parser'); var path = require('path'); var mongoose = require('mongoose'); app.use(bodyParser.json()); app.use(express.static( __dirname + '/anonymousNotesApp/dist' )); // ######################################################## // ########################MONGOOSE######################## mongoose.connect('mongodb://localhost/anonymous_notes') let noteSchema = new mongoose.Schema({ note: {required: true, type: String, minlength: [3, "Message length needs to be greater than 3 characters"]} }, {timestamps: true}); mongoose.model('note', noteSchema); var Note = mongoose.model('note'); // ######################################################## // ########################Routes######################## // // Root Request // //get all notes app.get('/show-all', function(req, res) { Note.find({}, function(err, data) { if (err) { console.log('got an error'); res.json({error: err}); } else { console.log('showing all notes'); res.json({message: "success", notes: data}); } }) }) //new note app.post('/new', function(req, res) { var newNote = new Note({note: req.body.text}) //".body" is the entire object you sent in from the service console.log("IN THE SERVER: ", req.body.text) newNote.save(function(err, results) { console.log("AFTER SAVE: ", results); if (err) { console.log(err); } else { console.log('successfully added a note'); res.json({success: results}); } }) }) // delete author // app.delete('/delete/:id', function(req, res) { // console.log("server deleting: ", req.params.id) // Author.findByIdAndRemove(req.params.id, function(err, results) { // if(err) { // res.json({error: err}) // } else { // console.log('successfully deleted'); // res.json({success:results}) // } // }) // }) // // show one author // app.get('/authors/:id', function(req, res){ // console.log("id:", req.params.id) // Author.findById(req.params.id, function(err, data){ // if (err) { // console.log(err); // res.json({error: err}); // } else { // res.json(data); // } // }); // }); // // //ADD QUOTE to this author - votes start at 0 // app.post('/authors/:id/quotes', function(req, res) { // var quote = {text: req.body.text, votes: 0} // Author.update({_id: req.params.id}, { $push: { quotes: quote}}, function(err, results) { // if (err) { // console.log(err); // res.json({error: err}); // } else { // res.json({success: results}); // } // }); // }); // // //update author // app.put('/update/:id', function(req, res) { // Author.findById(req.params.id, function(err, author) { // if (err) { // res.json({error: err}) // console.log("error updating author", err); // } else { // author.name = req.body.name; // author.save(function(err, author) { // if(err) { // console.log('something went wrong'); // res.json({error: err}) // } else { // console.log('updated author', author) // res.json({success: author}) // } // }) // } // }) // }) //upvote quote // app.put('/authors/:id/quotes/up', function(req, res) { // Author.findById(req.params.id, function(err, _author) { // if (err) { // console.log(err); // res.json({error: err}); // } else { // let _updatedQuotes = _author.quotes; // _updatedQuotes[req.body.index].votes += 1; // //res.json({success: results}); // _author.update({quotes: _updatedQuotes}, function(err, results) { // if (err) { // console.log(err); // res.json({error: err}); // } else { // res.json({success: results}); // } // }); // } // }); // }); // // //downvote quote // // app.put('/authors/:id/quotes/down', function(req, res) { // Author.findById(req.params.id, function(err, _author) { //get author // if (err) { // console.log(err); // res.json({error: err}); // } else { // let _updatedQuotes = _author.quotes; // _updatedQuotes[req.body.index].votes -= 1; //get the index of the quote, score down // //res.json({success: results}); // _author.update({quotes: _updatedQuotes}, function(err, results) { // if (err) { // console.log(err); // res.json({error: err}); // } else { // res.json({success: results}); // } // }); // } // }); // }); //delete quote // app.delete('/authors/:id/quotes/:index', function(req, res) { // Author.findById(req.params.id, function(err, _author) { // if (err) { // console.log(err); // res.json({error: err}); // } else { // let _updatedQuotes = _author.quotes; // _updatedQuotes.splice(req.params.index, 1); // //res.json({success: results}); // _author.update({quotes: _updatedQuotes}, function(err, results) { // if (err) { // console.log(err); // res.json({error: err}); // } else { // res.json({success: results}); // } // }); // } // }); // }); app.all("*", (req,res,next) => { res.sendFile(path.resolve("./anonymousNotesApp/dist/index.html")) }); //########################Start Server######################## // Setting our Server to Listen on Port: 8000 app.listen(8000, function() { console.log("Anonymous Notes listening on port 8000"); })
import { Text, View, StyleSheet, SafeAreaView, FlatList, TouchableOpacity, ActivityIndicator } from "react-native"; import React, { useEffect } from 'react'; import { connect } from 'react-redux'; import { scheduleReducer } from '../services'; import { getSchedules } from "../services"; import { Card } from 'react-native-elements'; import dayjs from "dayjs"; const timeOptions = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric' }; const scheduleScreen = (props) => { //yukarı refresh veya her tab navigatorda refresh useEffect(() => { props.getSchedules(); }, []); if (props.loading) { return ( <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}> <ActivityIndicator size="large" color="#000000"></ActivityIndicator> </View> ); } return ( <SafeAreaView style={styles.container}> <FlatList data={props.schedules} keyExtractor={(item, index) => index + ""} renderItem={({ item }) => ( <Card containerStyle={styles.card}> <Card.Title style={{ color: 'white' }}>{item.title}</Card.Title> <Text style={{ color: 'white' }}>Kullanıcı: {item.user}</Text> <Text style={{ color: 'white' }}>Açıklama: {item.description}</Text> <Text style={{ color: 'white' }}>startDate: {new Date(item.startDate).toLocaleDateString('tr-TR', timeOptions)}</Text> <Text style={{ color: 'white' }}>endDate: {new Date(item.endDate).toLocaleDateString('tr-TR', timeOptions)}</Text> <Text style={{ color: 'white' }}>Görüşülecek Kullanıcı: {item.meetingUser}</Text> <Text style={{ color: 'white' }}></Text> <View styles={styles.buttons}> <TouchableOpacity style={styles.chatButton} onPress={() => props.navigation.navigate('Chat', { id: item.id })}> <Text style={{ color: 'white' }}>CHAT</Text> </TouchableOpacity> <TouchableOpacity style={styles.videoButton} onPress={() => props.navigation.navigate('VideoCall', { id: item.id })}> <Text style={{ color: 'white' }} >VIDEO CALL</Text> </TouchableOpacity> </View> </Card> )} /> </SafeAreaView> ); } const mapStateToProps = (state) => ({ scheduleReducer: state.scheduleReducer, schedules: state.scheduleReducer.schedules, loading: state.scheduleReducer.loading, }) const ScheduleScreen = connect(mapStateToProps, { scheduleReducer, getSchedules })(scheduleScreen); const styles = StyleSheet.create({ container: { //flex: 1, paddingTop: 22, }, card: { backgroundColor: '#b3a7a6', padding: 20, marginVertical: 10, borderRadius: 10, justifyContent: 'center', }, chatButton: { padding: 20, alignItems: 'center', borderRadius: 8, backgroundColor: 'green', }, videoButton: { padding: 20, alignItems: 'center', borderRadius: 8, backgroundColor: 'blue', }, }); export default ScheduleScreen;
const categories = [ { _id: "5fe5c183db9b000a30e0774a", name: "Ichimlik", }, { _id: "5fe5c18bdb9b000a30e0774b", name: "Shirinlik", }, { _id: "5fe5c169db9b000a30e07749", name: "Taom", }, ]; export const getCategories = () => { return [...categories]; };
console.log("hello world"); // This tutorial will cover many ways to use conditional statements in JavaScript. // What are conditionals? // Very often when you write code, you want to perform different actions for different decisions. // You can use conditional statements in your code to do this. // In JavaScript we have the following conditional statements: // Use "if' to specify a block of code to be executed, if a specified condition is true. // Use "else" to specify a block of code to be executed, if the same condition is false. // Use "else if" to specify a new condition to test, if the first condition is false. // Use "switch" to specify many alternative blocks of code to be executed. // We will also be using comparison and logical operators in our conditional statements. // What are comparison operators? // Comparison operators are used in logical statements to determine equality or difference between variables or values. // Lets start with a simple example. // Uncomment the code below: // ====================================================== // if (1 == 1) { // console.log("They are equal!"); // } else { // console.log("They are not equal."); // }; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Comment the code above. // Let's break it down: // We declared our if statement and followed it with a set of brackets (parentheses) // The brackets will hold our logical statement (where we will make our comparison) // We never use a single "=" to compare objects, we will use "==" or "===" // After our comparison we defined what will happen IF our comparison is TRUE // We then follow with an else statement // Else statements do not use a comparison. they are meant to run if your previous comparisons are all false // We then defined what will happen if our previous comparisons came out as false // 1 is obviously equal to 1 so we get "They are equal!" in the console. // So why did we use a "==" comparison operator? // "==" is a looser comparison than "===" which is more strict. // Lets see the difference between the two. // Uncomment the code below: // ====================================================== // if (1 == "1") { // console.log("They are equal!"); // } else { // console.log("They are not equal."); // }; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Comment the code above. // Now lets do this same statement but with "===" as our comparison operator. // Uncomment the code below: // ====================================================== // if (1 === "1") { // console.log("They are equal!"); // } else { // console.log("They are not equal."); // }; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Comment the code above. // Using "==" will convert any strings to numbers if possible for comparison. // Using "===" will also compare the object type as well as checking if the objects are equal. // For the most part we will want to use "===" as our conditional operator. // We can use the "typeof" statement to check what the type of an object is. // Uncomment the code below: // ====================================================== // console.log(typeof 1); // console.log(typeof "1"); // console.log(typeof [1, 2, 3]); // console.log(typeof true); // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Comment the code above. // typeof returns the type of object as a STRING. We can use type of in comparisons like so. // Uncomment the code below: // ====================================================== // if (typeof "Hello World" === "string") { // console.log("It's a string!"); // } else { // console.log("It's not a string"); // }; // if (typeof 1 === "number") { // console.log("It's a number!"); // } else { // console.log("It's not a number"); // }; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Comment the code above. // We can also use a single statement comparison in our conditionals to check if items return the true statement. // We use this method to check if objects exist or if they are true. // Uncomment the code below: // ====================================================== // var sentence = "Check to see if I'm true!"; // if (sentence) { // console.log("It's true!"); // } else { // console.log("It's false."); // }; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Comment the code above. // Lets talk about "<", ">", "<=", and ">=". // These are the same as math operators that check for greater than, less than, greater than or equal to, and // less than or equal to. // Lets use some else if statements in our example // Uncomment the code below: // ====================================================== // if (2 < 2) { // console.log("Less than"); // } else if (2 <= 2) { // console.log("less than or equal to"); // } else { // console.log("I don't know what I am comparing..."); // }; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Comment the code above. // The else if statement gives us an extra comparison. Lets see how that works by looping through an array. // Uncomment the code below: // ====================================================== // var colorArr = ["red", "orange", "yellow", "green", "blue", "purple"]; // for (var i = 0; i < colorArr.length; i++) { // if (colorArr[i] === "red") { // console.log("It's red!", colorArr[i]); // } else if (colorArr[i] === "green") { // console.log("It's green!", colorArr[i]); // } else if (colorArr[i] === "blue") { // console.log("It's blue!", colorArr[i]); // } else { // console.log("I don't know what color this is...", colorArr[i]); // }; // }; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Comment the code above. // We can chain as many else if statements together as we want. Although, we generally don't want to // chain many else if statements together. // Instead, we can use a switch statement. Lets take a look. // Uncomment the code below: // ====================================================== // var color = "blue"; // switch(color) { // case "red": // console.log("It's red!", color); // break; // case "orange": // console.log("It's orange!", color); // break; // case "yellow": // console.log("It's yellow!", color); // break; // case "green": // console.log("It's green!", color); // break; // case "blue": // console.log("It's blue!", color); // break; // case "purple": // console.log("It's purple!", color); // break; // default: // console.log("I don't know what color this is...", color); // }; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Comment the code above. // Ok, This may seem like a lot of stuff going on, so lets break it down. // First we declared a variable named color and gave it the value of "blue". // This is the color we want to check for in our switch statement. // Then, we declare our switch statement. We set "color" as our argument. // "case" is where our comparison happens. We declare a value after each case statement // to compare our argument to. // Essentially we are writing out `if (color === red) {do something}` // We decide we want to console log the color if the case is a match. // After our code to be executed if our case is a match to our argument we use the "break" statement. // "Break" will stop our switch statement once it finds a match. // At the very bottom of the switch statement we have our "default" case. // "Default" in a switch statement is our "else". If no case matches our argument, our default code will execute. // Seems like a lot of work for one, simple comparison. And frankly, yes. Yes it is. // Lets use a switch statement that will do different things depending on what type of object we get. // Uncomment code below: // var mixedArr = ["hello world", 5, false, "coding is fun", 7, mixedArr, true, "switch statement", -25, false]; // function multi(arr){ // for (var i = 0; i < arr.length; i++) { // switch(typeof arr[i]) { // case "string": // arr[i] = arr[i].split(" "); // console.log("New array is: ", arr[i]); // break; // case "number": // arr[i]++; // console.log((arr[i]-1) + " now equals: " + arr[i]); // break; // case "boolean": // arr[i] ? arr[i] = false : arr[i] = true; // console.log(!arr[i] + " is now " + arr[i]); // break; // default: // console.log("Not A Valid Object!"); // continue; // }; // }; // }; // multi(mixedArr); // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Comment the code above. // We ran our switch in a loop to check the object type for each element in an array. // If it is a number, we increased it's value by 1. If it is a string, we split that string at each word and make it an array with those words. // If it is a boolean, we change it to the opposite boolean. And, finally, our default just lets us know when an object isn't valid and // continues the loop. // Now you are probably wondering what line 205 is all about. And that is an excellent question that brings us to the last segment of this tutorial. // Line 205 is a "ternary operator". It is a quick way of doing a comparison and deciding what happens if it is true or false. // Lets look at the syntax of a ternary operator. // ` <expression to be compared> ? <what to do if the object is true> : <what to do if the object is false> ` // Lets look at an example. // Uncomment the code below: // ====================================================== // var age1 = 27; // var age2 = 18; // var drinkingAge = 21; // var overAge = age1 >= drinkingAge ? "Order a beer" : "Order a soda"; // console.log(overAge); // var underAge = age2 >= drinkingAge ? "Order a beer" : "Order a soda"; // console.log(underAge); // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Comment the code above. // A quick note, we need to declare the ternary operator as a variable if we want to see the value it returns through a console.log. // We made a comparison (the person's age compared to the drinking age) and if they were over the drinking age they // order a beer. // If they aren't, they order juice instead. // We can also chain ternary operators together like an if, else if, else statement like so. // Uncomment the code below: // ====================================================== // function chooseRed(color) { // return color === "red" ? console.log("Hooray it's red!") // : color === "blue" ? console.log("Ugh, I hate blue!") // : color === "green" ? console.log("Green is ok, I guess...") // : console.log("Do you even know what a color is???"); // }; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Comment the code above. // chooseRed("red"); // chooseRed("blue"); // chooseRed("green"); // chooseRed(1);
let putUrl = "http://localhost:9595/product"; let gUrl = "http://localhost:9595/product/all"; function display(url, callback){ let xhr = new XMLHttpRequest(); xhr.open("GET", url); xhr.onreadystatechange = function(){ if(this.readyState===4 && this.status===200){ callback(this); console.log(this); }else{ console.log(xhr.response); } } xhr.send(); } function pick(){ display(gUrl,Link); } function Link(xhr){ let products = JSON.parse(xhr.response); let delI = document.getElementById("delDext"); let e = document.getElementById("putsel"); let num = e.options[e.selectedIndex].text-1; for(product of products){ var sel =document.getElementById("putsel").value if(sel == product.id){ let num = e.options[e.selectedIndex].text-2; //let num = e.options[e.selectedIndex].text-2; document.getElementById("prod").innerHTML = `Product ID: ${product.id} Selected Product: ${product.name} At Warehouse: ${product.warehouse.name}`; document.getElementById("wareAd").value = product.warehouse.address; document.getElementById("wareName").value = product.warehouse.name; } console.log("ERROR"); } } // if(num>=delI){ // let num = e.options[e.selectedIndex].text-2; //document.getElementById("prod").innerHTML = `Product Index:${products[num].id} Selected Product: ${products[num].name} , At Warehouse: ${products[num].warehouse.name}`; //document.getElementById("wareAd").value = products[num].warehouse.address; // document.getElementById("wareName").value = products[num].warehouse.name; // console.log(num+"HIII"); // }else{ // document.getElementById("prod").innerHTML = `Product Index:${products[num].id} Selected Product: ${products[num].name} , At Warehouse: ${products[num].warehouse.name}`; // console.log(num+"NOOO"); // document.getElementById("wareAd").value = products[num].warehouse.address // document.getElementById("wareName").value = products[num].warehouse.name // } // } function show (xhr){ let products = JSON.parse(xhr.response); //console.log(product); for(product of products){ addOption(product.id); } } function addOption(id,name){ let option = document.createElement("option"); option.text= id; option.value = id; document.getElementById("putsel").appendChild(option); //document.getElementById("delsel").appendChild(option); } document.getElementById("putsel").addEventListener("change",pick); window.onload = function test(){ display(gUrl,show); } function UpdateAProduct(url, callback, updateProduct){ let xhr = new XMLHttpRequest(); xhr.open("PUT",url); xhr.onreadystatechange = function(){ if(xhr.readyState === 4 && xhr.status===201){ callback(this); }else{ console.log(xhr.response); } } xhr.setRequestHeader("Content-Type","application/json"); let jsonProd = JSON.stringify(updateProduct); console.log(jsonProd); xhr.send(jsonProd); } function printResponse(xhrObj){ console.log(xhrObj.response); } function UpdateExistingProduct(){ let selectedWarehouse ={ "warehouse":{ "address":document.getElementById("wareAd").value, "id": document.getElementById("putsel").value, "name":document.getElementById("wareName").value }, "address":document.getElementById("wareAd").value, "id": document.getElementById("putsel").value, "name":document.getElementById("wareName").value }; let newPut={ "id": document.getElementById("putsel").value, "name": document.getElementById("prodPutName").value, "price":document.getElementById("prodPutPrice").value, "quantity": document.getElementById("prodPutQuantity").value, "warehouse":selectedWarehouse } console.log(newPut); UpdateAProduct(putUrl,printResponse,newPut); } document.getElementById("putButton").addEventListener("click",UpdateExistingProduct);
import PropTypes from 'prop-types' import { css } from '@emotion/core' import { sizes } from '../../config' // eslint-disable-next-line import/prefer-default-export export const gridded = { styles: ({ theme, gapped, gap, breakpoint }) => { let gapValue = null if (gapped) { gapValue = gap ? theme.sizing.getPX(gap) : theme.grid.getGap() } const displayCSS = breakpoint ? css` display: block; ${theme.grid.break(breakpoint)} { display: grid; } ` : css` display: grid; ` return css` grid-gap: ${gapValue}; ${displayCSS} ` }, propTypes: () => ({ gapped: PropTypes.bool, gap: PropTypes.oneOf([null, ...sizes]), // breakpoint is granted by the responsive trait. }), defaultProps: (gapped = false, gap = null) => ({ gapped, gap, }), }
// Paperless should be the only globally exposed object Paperless = {}; window.D = console; /* * Manage all of the files on the page */ Paperless.FileManager = { files: [], // Hide all files from display hide_all_files: function(){ $('.code_container').hide(); $('.filelink a.selected').removeClass('selected'); }, // Show all of the files show_all_files: function(){ $('.code_container').show(); }, show_file: function(filename){ Paperless.FileManager.hide_all_files(); $('.code_container[data-name="'+ filename +'"]').show(); $('.filelink a[data-name="'+filename+'"]').addClass('selected'); }, hide_file: function(filename){ $('.code_container[data-name="'+ filename +'"]').hide(); }, // Add a file to the file manager add_file: function(file){ this.files.push(file); }, get_file: function(name) { console.info(this.files); for(var idx in this.files) { var file = this.files[idx]; console.info(file); if(file.name == name) { return file; } } return null; }, setup: function(){ var first_file_name = Paperless.FileManager.files[0].name; Paperless.FileManager.show_file(first_file_name); } }; /* * Controls the functions relating to the setup of the comments, and dealing * with the preset comments. * * Handle shortcuts on comments, such as tab for submit */ Paperless.CommentManager = { // The current comment object current_comment: null, // A list of all of the preset comments for the current submission preset_comments: [], /* * Return html to be displayed in a modal dialog containing * all of the preset comments for this assignment. */ get_preset_comment_html: function(){ var result = ""; for(var i = 0; i < this.preset_comments.length; i++){ result += "<div class='preset_option'>"; result += this.preset_comments[i]; result += "</div>"; } return result; }, tab_submit: function(){ $(document).keyup(function(e) { if(e.keyCode == 9){ // tab key D.log("SUBMIT COMMENT"); if(Paperless.CommentManager.current_comment){ Paperless.CommentManager.current_comment.save(); } } }); }, setup: function(){ Paperless.CommentManager.tab_submit(); $('.preset_option').live('click', function(){ var chosen_option = $(this).html(); var textarea = $('textarea'); var oldval = textarea.val(); if(oldval.length == 0){ textarea.val(chosen_option); }else{ textarea.val(oldval + '\n\n' + chosen_option); } }); } } /* * Handle the setup of the page. */ Paperless.Setup = { create_comments: function(){ $('.filelink').each(function(idx, elem) { var name = $("a", elem).attr('data-name'); // Create a new CodeFile object var new_file = new CodeFile({ name: name }); // When you click a link, show this file $("a", elem).click(function(e){ e.preventDefault(); Paperless.FileManager.show_file(name) }) // Add this file to the list of files Paperless.FileManager.add_file(new_file); }); // For every file create a new CodeFile object $('.file_comments').each(function(idx, elem){ // For every comment on this file, create a new comment object // and add it to the code file cur_file = Paperless.FileManager.get_file($(this).attr('data-file')); $(this).children().each(function(idx, comment) { var new_comment = new Comment({ text: $(comment).attr('data-comment'), commenter: $(comment).attr('data-commenter'), range_string: $(comment).attr('data-range'), file: cur_file }); cur_file.add_comment(new_comment); }) ; }); Paperless.FileManager.setup(); }, create_preset_comments: function(){ Paperless.CommentManager.preset_comments = []; $('.preset_comment').each(function(idx, elem){ var comment = $.trim($(elem).html()); D.log(comment); Paperless.CommentManager.preset_comments.push(comment); }); }, start: function(){ $(document).bind("status.finishedSyntaxHighlighting", Paperless.Setup.create_comments); Paperless.Setup.create_preset_comments(); Paperless.CommentManager.setup(); D.log(Paperless); } };
import { Image } from './Image' import React from 'react' import { theme } from '../theme' import { Card } from './Card' import { LinkAreaAnchor } from './LinkAreaAnchor' import { VisuallyHidden } from './VisuallyHidden' import { responsiveSpace } from './HorizontalList' export const GoodreadsCard = ({ book: { hasCoverImage, bookLink, title, authorLink, name, childrenFile: [ { childImageSharp: { fluid }, }, ], }, }) => { const Wrapper = hasCoverImage ? VisuallyHidden : React.Fragment return ( <div css={{ marginTop: -25, paddingBottom: 110, height: '100%', display: 'flex', alignItems: 'center', }} > <Card css={[ { position: 'relative', display: 'inline-block', boxShadow: '0 25px 50px -12px rgba(0, 0, 0, 0.35)', padding: hasCoverImage ? 0 : theme.space.medium, }, hasCoverImage ? theme.mq({ width: [ `calc(80vw - 2 * ${responsiveSpace[0]})`, 240, 240, 240, ], }) : theme.mq({ width: [ `calc(80vw - 2 * ${responsiveSpace[0]} - ${ hasCoverImage ? 0 : `2 * ${theme.space.medium}` })`, 210, 210, 210, ], height: 305, border: `1px solid ${theme.color.cloud}`, }), ]} > {hasCoverImage && ( <Image fluid={fluid} style={{ display: 'block', }} imgStyle={{ height: '100%', width: '100%', borderRadius: theme.borderRadius, }} /> )} <Wrapper> <div css={{ marginBottom: theme.space.medium }}> <LinkAreaAnchor href={bookLink} target="_blank" rel="noopener noreferrer" css={{ fontSize: theme.fontSize.large, textDecoration: 'none', ':hover': { textDecoration: 'underline', }, color: theme.color.black, wordBreak: 'break-word', fontWeight: 500, }} > {title} </LinkAreaAnchor> </div> <div> <a href={authorLink} target="_blank" rel="noopener noreferrer" css={{ color: theme.color.gray, textDecoration: 'none', ':hover': { textDecoration: 'underline', }, }} > {name} </a> </div> </Wrapper> </Card> </div> ) }
const app = getApp() Page({ data: { list: [], page: 1, limit: 10, finished:false }, goToPage(e) { wx.navigateTo({ url: `/pages/job/index?id=${e.currentTarget.dataset.id}` }) }, onLoad() { app.fun.post('/user/deliveryList', { page: this.data.page, limit: this.data.limit }).then((res) => { this.setData({ list: res.result }) }) }, onReachBottom() { let that = this if (this.data.finished === true) { return } app.fun.post('/user/deliveryList', { page: this.data.page + 1, limit: this.data.limit }).then((res) => { if (res.result.length) { this.setData({ list: this.data.list.concat(res.result) }) this.data.page++ this.setData({ page:this.data.page }) } else { this.setData({ finished: true }) } }) }, })
import PropTypes from 'prop-types' import React from 'react' import MainIndicatorContainer from './LoadingIndicatorContainers/MainIndicatorContainer' function MessagesListHeader(props) { const {messagesCount} = props return ( <div className='c12q1r7z'> <h2 className='c17zq7b5'>Messages</h2> <p> <span className='ca2ougy'>There are </span> <span className='c1lerdlx'>{messagesCount}</span> <span className='ca2ougy'>messages showing</span> </p> <MainIndicatorContainer /> </div> ) } MessagesListHeader.propTypes = { messagesCount: PropTypes.number.isRequired } export default MessagesListHeader
config({ 'menu': {requires: ['event','component/base','component/extension','node']} });
import React from 'react'; import { makeStyles } from '@material-ui/core/styles'; import Modal from '@material-ui/core/Modal'; import Backdrop from '@material-ui/core/Backdrop'; import Fade from '@material-ui/core/Fade'; import Fab from '@material-ui/core/Fab'; import SendRoundedIcon from '@material-ui/icons/SendRounded'; import QuestionAnswerOutlinedIcon from '@material-ui/icons/QuestionAnswerOutlined'; import IconButton from '@material-ui/core/IconButton'; import ArrowRightAltIcon from '@material-ui/icons/ArrowRightAlt'; // import ArrowBackIcon from '@material-ui/icons/ArrowBack'; import logo from '../../assets/logo/logo.png'; import './InfoModal.scss'; const useStyles = makeStyles(theme => ({ modal: { display: 'flex', alignItems: 'center', justifyContent: 'center' } })); const scrollToRef = ref => window.scrollTo(0, ref.current.offsetTop); const useMountEffect = fun => React.useEffect(fun, []); const InfoModal = () => { const classes = useStyles(); const [open, setOpen] = React.useState(false); const [clicked, setClicked] = React.useState(0); const [qns, setQns] = React.useState([ { qn: 'Hello there smarty! What’s your name?', type: 'text' }, { qn: 'Welcome to Pvot! I am your digital assistant P-bot and I will help you get started. On Pvot, there are many kinds of Stock Market Experts And what kind of Expert are you?', type: 'option', options: ['Fundamental', 'Technical', 'Both'] }, { qn: 'Good to know that! Are you SEBI Registered RIA or NISM Certified Analyst?', type: 'option', options: ['Yes', 'No'] }, { qn: [ 'That’s great! Our team will reach out to you for further verification. Once verified and profile set up, investors would be able to subscribe to your trading activity on the platform. I will always be available within the app under the “more” section. Feel free to ping me if you are stuck somewhere.', 'We welcome everyone! Pvot is designed to recognize smart talent.' ], type: 'end' } ]); const [qnType, setQnType] = React.useState(qns[0]['type']); const [ans, setAns] = React.useState([]); const [state, setState] = React.useState(); const [buttonOptions, setButtonOptions] = React.useState([]); const messagesEndRef = React.useRef(null); const handleOpen = () => { setOpen(true); }; const handleClose = () => { setOpen(false); }; React.useEffect(() => { window.setTimeout(handleOpen, 1000); }, []); useMountEffect(() => scrollToRef(messagesEndRef)); const showQuestion = qn => { return ( <div className='mb-2'> <div className='shadow bg-white rounded-right rounded question_text mr-auto'> <p className='py-2 px-2 text-dark'>{qn}</p> </div> </div> ); }; const showAns = ans ? Object.values(ans).map((ansObject, i) => { return ( <div key={i}> <div className='mb-2'> <div className='shadow bg-primary rounded-left rounded question_text ml-auto'> <p className='py-2 px-2 text-white'>{ansObject.reply} </p> </div> </div> <div ref={messagesEndRef}></div> {showQuestion( ansObject.clicked === 2 ? ansObject.reply === 'Yes' ? ansObject.showQuestion[0] : ansObject.showQuestion[1] : ansObject.showQuestion )} </div> ); }) : null; const ansButton = buttonValues => { const buttonArray = []; buttonValues.map((value, i) => { buttonArray.push( <button key={i} type='button' id={value} value={value} onClick={() => onAnsButtonClick(value)} className='btn btn-outline-primary btn-sm col mx-1 rounded-pill' > {value} </button> ); }); return buttonArray; }; const inputChange = e => { setState({ [e.target.id]: e.target.value }); }; const onAnsButtonClick = data => { let reply = qnType === 'option' ? clicked === 1 ? `I am a ${data} Expert` : `${data}` : qnType === 'text' ? state['textReply'] : null; let showQuestion = clicked === 0 ? `Hi ${data.textReply.split(' ')[0]}. ${qns[clicked + 1]['qn']}` : qns[clicked + 1]['qn']; setAns([...ans, { clicked, reply, showQuestion, qnType }]); setQnType(qns[clicked + 1]['type']); setClicked(clicked + 1); if (qns[clicked + 1]['type'] === 'option') { setButtonOptions(qns[clicked + 1]['options']); } scrollToRef(messagesEndRef); }; const onSubmitClick = e => { e.preventDefault(); let listOfQnAns = []; for (let i = 0; i < ans.length; i++) { let qnAns = { ...qns[i], ...ans[i] }; delete qnAns.type; delete qnAns.clicked; delete qnAns.showQuestion; delete qnAns.qnType; listOfQnAns.push(qnAns); } console.log(listOfQnAns); setOpen(false); }; // const scrollToBottom = () => { // scrollToRef(messagesEndRef); // }; // React.useEffect(() => { // scrollToBottom(); // }, [qns]); // console.log(clicked, qns, ans, qnType, buttonOptions); return ( <div> <Fab color='primary' aria-label='edit' onClick={handleOpen} className='modalFab'> <QuestionAnswerOutlinedIcon /> </Fab> <Modal aria-labelledby='transition-modal-title' aria-describedby='transition-modal-description' className={classes.modal} open={open} onClose={handleClose} closeAfterTransition BackdropComponent={Backdrop} BackdropProps={{ timeout: 500 }} > <Fade in={open}> <div className='modalView rounded-md bg-white px-3 py-3'> <div className='chatheader row mb-3'> <img src={logo} alt='pvotLogo' className='mx-auto' /> </div> <div className='chatbox py-2'> {showQuestion(qns[0]['qn'])} {showAns} </div> {clicked < qns.length ? ( qnType === 'option' ? ( <div className='chatbuttons row justify-content-center py-3 my-auto' role='group'> {ansButton(buttonOptions)} </div> ) : qnType === 'text' ? ( <form className='chatbuttons input-group input-group-sm'> <input type='text' onChange={inputChange} id='textReply' className='form-control mr-1 my-auto rounded border-primary' /> <div className='input-group-append'> <IconButton type='submit' onClick={() => onAnsButtonClick(state)} color='primary' className='ml-1 my-auto' > <SendRoundedIcon /> </IconButton> </div> </form> ) : qnType === 'end' ? ( <div className='chatbuttons row py-2'> <button type='button' onClick={onSubmitClick} className='btn btn-primary mx-1 my-1 p-1 rounded-circle mx-auto shadow' > <ArrowRightAltIcon fontSize='large' /> </button> </div> ) : null ) : null} </div> </Fade> </Modal> </div> ); }; export default InfoModal;
define(function (require) { 'use strict'; var View = require('view'), // Templates menuTemplate = require('text!templates/menu.html'); function MenuView () { View.apply(this, arguments); } _.extend(MenuView.prototype, View.prototype, { classList: ['menu'], domEvents: { '.main .item.create-grid': { 'click': '_eCreateGrid' }, '.main .item.create-building': { 'click': '_eCreateBuilding' }, '.main .item.create-unit': { 'click': '_eCreateUnit' }, }, init: function () {}, _eCreateGrid: function () { this.trigger('create:grid'); }, _eCreateBuilding: function () { this.trigger('create:building'); }, _eCreateUnit: function () { this.trigger('create:unit'); }, renderContent: function () { this.el.innerHTML = this.template(menuTemplate, { menu: this.menu }); } }); return MenuView; });
$(document).on("click", ".add-to-cart", function() { var id = $(this).data("id"); $.ajax({ type: "POST", url: "assets/include/add_to_cart.php", data: { pid: id }, }); var items = parseInt($(".cart-items").text()); $(".cart-items").text(items + 1); var current = parseInt($(".cart-items").text()); sessionStorage.setItem("cart-items", current); }); var session_items = sessionStorage.getItem("cart-items"); if (session_items==null) { sessionStorage.setItem("cart-items", 0); } $(document).ready(function () { $(".cart-items").text(sessionStorage.getItem("cart-items")); });
import React, {Component} from 'react'; import shouldPureComponentUpdate from 'react-pure-render/function'; //ref1 { statuses: [] } //ref1 { statues: [{id:1, content: "asdf"}] } if(JSON.stringify(statues) === JSON.stringify(statuses)){ } class Toolbar extends Component { //onClick={this.addLike.bind(this)} toggleLike() { this.props.toggleLike(this.props.statusIndex); } shouldComponentUpdate: shouldPureComponentUpdate; render() { console.log('Re-rendering toolbar...'); return ( <small> <a className="button" onClick={this.toggleLike.bind(this)}> <i ref="likeBox">{this.props.likes}</i> {(this.props.liked ? 'Unlike' : 'Like')} </a> <a className="button"><i className="fa fa-pencil" /> Reply</a> </small> ); } } export default Toolbar;
import React from 'react'; import BlendedStars from './BlendedStars.jsx'; import SearchReviews from './SearchReviews.jsx'; import { TopBarStyleContainer } from './Styles.js'; const TopBarContainer = (props) => { return ( <TopBarStyleContainer> <BlendedStars stars={props.stars} visibleReviews={props.visibleReviews}/> <SearchReviews getFilteredReviews={props.getFilteredReviews} /> </TopBarStyleContainer> ) } export default TopBarContainer;
import React from 'react'; import PropTypes from 'prop-types'; import { Route, Redirect } from 'react-router'; import { withStyles } from '@material-ui/core/styles'; import Grid from '@material-ui/core/Grid'; import Card from '@material-ui/core/Card'; import CardMedia from '@material-ui/core/CardMedia'; import { connect } from 'react-redux'; import loginHeader from '../../assets/loginHeader.png'; import Login from './login'; import SignUp from './signUp'; import TokenCheck from './tokenCheck'; const styles = theme => ({ root: { flexGrow: 1, height: 'calc(100% - 71px)', }, divider: { margin: '25px 0 25px 0', }, container: { display: 'flex', flexWrap: 'wrap', }, textField: { marginLeft: theme.spacing.unit, marginRight: theme.spacing.unit, }, dense: { marginTop: 16, }, menu: { width: 200, }, button: { margin: theme.spacing.unit, }, card: { maxWidth: 345, }, media: { height: 140, }, }); class SignInAndUp extends React.Component { constructor(props) { super(props); this.state = { email: '', password: '', }; } handleChange = name => (event) => { this.setState({ [name]: event.target.value, }); }; render() { const { classes, location, token } = this.props; return ( <form className={classes.container}> <Grid container direction="row" justify="center" alignItems="center" className={classes.root} > <Card className={classes.card}> <CardMedia className={classes.media} image={loginHeader} title="Login Header" /> { token } {/* <Typography gutterBottom variant="h5" component="h2"> Blog de evaluación </Typography> */} {token ? ( <Redirect to={{ pathname: '/main', state: { from: location }, }} /> ) : undefined} <Route exact path="/signUp" component={SignUp} /> <Route exact path="/confirmarCorreo" component={TokenCheck} /> <Route exact path="/" component={Login} /> </Card> </Grid> </form> ); } } SignInAndUp.propTypes = { classes: PropTypes.object, location: PropTypes.object, token: PropTypes.string, }; const mapStateToProps = ({ auth }) => ({ token: auth.token, }); export default connect(mapStateToProps, {})(withStyles(styles)(SignInAndUp));
import { takeLatest, put } from 'redux-saga/effects'; import log from '../../common/libs/logger'; import { SECTION_GET } from '../actions/types'; import { sectionSet } from '../actions'; import api from '../../common/libs/api'; export function* sectionGet({ payload: { id } }) { log.info('sectionGet fired...', id); const promise = api.collections.getCollection(id) .then(data => data.json()) .then(data => data) .catch(error => { log.error('Exception occurred', error); }); const result = yield promise; try { if (result) { // Data received log.info('[sectionGet] Data received: ', result); if(result.errors) { // TODO: Handle the exception } else { yield put(sectionSet(result)); } } else { // No data received } } catch (e) { log.info('Exception occured: ', e); } } export function* watchSectionGet() { log.info('watchSectionGet starting'); yield takeLatest(SECTION_GET, sectionGet); }
//set up var flash = require('connect-flash'); var express = require('express'); var http = require('http'); var mongoose = require('mongoose'); var autoIncrement = require('mongoose-auto-increment'); var passport = require('passport'); var d = require('domain').create(); var fs = require('fs'); var app = express(); //configuration var connection = mongoose.connect('localhost/lacquertracker'); // connect to database autoIncrement.initialize(connection); require(__dirname+'/app/passport')(passport); // pass passport for configuration app.configure(function() { //set up express app.set('port', process.env.LTPORT || 3000); app.engine('html', require('ejs').renderFile); app.enable('trust proxy'); app.use(function (req, res, next) { if ('/robots.txt' == req.url) { res.type('text/plain') res.send("User-agent: *\nDisallow: /admin\nDisallow: /blog/add\nDisallow: /blog/*/add\nDisallow: /blog/*/*/add\nDisallow: /blog/*/*/remove\nDisallow: /blog/*/*/removepermanent\nDisallow: /blog/*/edit\nDisallow: /email\nDisallow: /forums/*/add\nDisallow: /forums/*/*/*/add\nDisallow: /forums/*/*/edit\nDisallow: /forums/*/*/add\nDisallow: /forums/*/*/*/remove\nDisallow: /forums/*/*/*/removepermanent\nDisallow: /forums/*/*/remove\nDisallow: /photo\nDisallow: /swatch\nDisallow: /addown\nDisallow: /addwant\nDisallow: /addownbrowse\nDisallow: /addwantbrowse\nDisallow: /removeown\nDisallow: /removewant\nDisallow: /polish/*/*/delete\nDisallow: /profile/edit\nDisallow: /profile/*/edit\nDisallow: /profile/*/*/remove\nDisallow: /profile/*/*/add\nDisallow: /profile/*/*/delete\nDisallow: /review\nDisallow: /validate\nDisallow: /revalidate\nDisallow: /reset\nDisallow: /logout\nDisallow: /scripts\nDisallow: /stylesheets\nDisallow: /polishsuccessful\nDisallow: /polishid"); } else { next(); } }); app.use(express.static(__dirname+'/public')); // Catch static files app.use(express.logger('dev')); // log every request to the console /*app.use(express.logger({format: 'dev', stream: fs.createWriteStream('app.log', {'flags': 'w'})}));*/ var cookieSecret = process.env.LTCOOKIESECRET || "Development Cookie Secret"; app.use(express.cookieParser(cookieSecret)); // read cookies (needed for auth) app.use(express.bodyParser({uploadDir:__dirname+'/public/images/tmp/'})); // get information from HTML forms app.use(express.favicon(__dirname+'/public/images/lt.png')); app.use(express.json()); app.use(express.urlencoded()); app.use(express.methodOverride()); app.use(express.session({cookie: {maxAge: 365 * 24 * 60 * 60 * 1000}})); // session secret app.use(flash()); // use connect-flash for flash messages stored in session app.use(passport.initialize()); app.use(passport.session()); // persistent login sessions app.use(function (req, res, next) { res.locals({ get user() { // as a getter to delay retrieval until `res.render()` return req.user; }, isAuthenticated: function () { return req.user != null; } }) next(); }); app.use(express.timeout(10000)); app.use(app.router); app.use(function(req,res){ res.redirect('/error'); }); }); // development only if ('development' == app.get('env')) { app.use(express.errorHandler()); } //routes require(__dirname+'/routes/index.js')(app, passport); // load our routes and pass in our app and fully configured passport //launch d.on('error', function(er) { console.log('Error!', er.message); }); d.run(function() { http.createServer(app).listen(app.get('port'), function(){ console.log('Express server listening on port ' + app.get('port')); }); });
/** * component class */ class Component { constructor(options) { Object.assign(this, options); // transfer scope to Scope defineGetterSetter(this.scope); // debug Component.instances.push(this); } /** * render to a dom node * @param {String} name - component name * @param {DOMNode} target - target dom node */ static render(aComponent, target) { let component = new aComponent(); target.innerHTML = component.tmpl; parseDom(target, component); } } Component.instances = [];
import React from "react"; import PropTypes from "prop-types"; const Student = () => { return <>hello from student component</>; }; Student.propTypes = {}; export default Student;
exports.withdrawableExplain = { WITHDRAWN: 1, REFUNDED: 2, DISABLED_BY_ADMIN: 3, NORMAL: 4, NOT_YET_PAYABLE: 5, }; exports.paymentRecordMeaning = { FAILED_PAYMENT_REFUND: -10, FAILED_PAYMENT_EXECUTION: -5, PAYMENT_CREATED: 0, PAYMENT_COMPLETE: 5, PAYMENT_REFUNDED: 10, }; exports.ProcessFlow = { REFUNDED: -5, REFUNDING: -2, INITIAL: 0, UNCLAIMED: 5, CLAIMED: 10, UNINSPECTED:15, REJECTED: 20, INSPECTED: 25 }; exports.UserRole = { CONSUMER: 5, SALER: 10, WRITER: 15, INSPECTOR: 20, ADMIN: 25 }; exports.OrderListingType = { MY_CURRENT: 100, MY_PAST: 101, MY_CANCELLED: 102, MY_ALL: 103, ALL_UNCLAIMED: 200, MY_SOLVED_BY_ME: 201, MY_UNSOLVED_BY_ME: 202, ALL_UNVERIFIED: 300, ALL_UNSOLVED: 301, ALL_SOLVED: 302, ALL_REFUNDING: 303 }; exports.OrderMessageType = { ORDER_POSTED: 100, ORDER_PAID: 101, ORDER_REFUNDED: 102, ORDER_DETAIL_REQ: 103, ORDER_DETAIL_RES: 104, ORDER_CLAIMED: 105, ORDER_SOLUTION_SUBMIT: 106, ORDER_SOLUTION_REJECTED: 107, ORDER_SOLUTION_ACCEPTED: 108, ORDER_SOLUTION_REVISITED: 109, CUSTOMER_POST: 109, WRITER_POST: 110, INSPECTOR_POST: 111 }; exports.OrderSubState = { QUESTION_UPDATE_NEEDED: 101, ANSWER_UPDATE_NEEDED: 102 }; exports.BonusRelationType = { WRITER_REWARD: 101, SALE_SHARE: 102, }; exports.specialEmailType = { ORDER_DETAIL_REQ: 101, ORDER_DETAIL_RES: 102, ORDER_SOLUTION_REJECTED: 103, ORDER_SOLUTION_REVISITED: 104, NEW_SOLUTION: 105 }; exports.spacing = { SPACING_SINGLE: 10, SPACING_DOUBLE: 5 }
const os = require('os'); const fs = require('fs'); console.log("Filesystem "); let filename = 'test.txt'; let message = 'Welcome to Nodejs'; let cpu = os.cpus(); fs.appendFile(filename, message, function (error) { if (error) { console.log('Error on create the file: ' + filename); } }); fs.readFile(filename, 'utf8', (err, data) => { if (err) { console.error(err) return } console.log(data) }); fs.unlink(filename, function (err) { if (err) throw err; console.log('File: ' + filename + ' deleted!'); }); filename = 'cpu.txt'; let cpu_string = JSON.stringify(cpu); message = `CPU Information: \n + ${cpu_string}`; fs.appendFile(filename, message, function (error) { if (error) { console.log('Error on create the file: ' + filename); } }); fs.readFile(filename, 'utf8', (err, data) => { if (err) { console.error(err) return } console.log(data) }); fs.unlink(filename, function (err) { if (err) throw err; console.log('File: ' + filename + ' deleted!'); });
export const fetchSummoner = (summoner, success, errors) => { $.ajax({ url: `/api/summoners/${summoner}`, success, errors }); };
import theme from './theme'; import Button from './button-default'; export default function Hero(props) { const buttonStyles = ` background-color: #3333339c; ` return ( <div> <div className="hero-container"> <div className="content-container"> <div className="tagline-box"> <div>Creating your collegiate esports program. Together.</div> </div> <Button className="button" text="Services" onClick={scrollToServices} styles={buttonStyles} > </Button> </div> </div> <div className="pillars-container"> <div className="container"> <span>Competitive Excellence &nbsp;&nbsp;| &nbsp;&nbsp;Diversity and Inclusion &nbsp;&nbsp;| &nbsp;&nbsp;Student Engagement</span> </div> </div> <style jsx>{` .hero-container { background-image: url("/images/HERO_BLUE.jpg"); background-size: 100% auto; background-position: center; background-repeat: no-repeat; height: 35vw; display: flex; justify-content: center; } .content-container { align-self: center; display: flex; justify-content: center; flex-direction: column; } .tagline-box { color: ${theme.colors['med-blue']}; background-color: #3333339c;; align-self: center; font-size: 30px; padding: 60px; max-width: 550px; text-align: center; letter-spacing: 2px; box-shadow: 0px 0px 1px 0px rgba(0,0,0,0.75); } .button { background-color: #3333339c; } .pillars-container { background-color: ${theme.colors["med-blue"]}; font-size: 26px; background: linear-gradient(90deg, rgba(0,212,255,1) 0%, rgba(42,196,238,1) 68%, rgba(26,118,186,1) 100%); } .pillars-container > .container { text-align: center; } .pillars-container span { color: #165d92; margin: auto; display: inline-block; padding: 40px 0px; font-weight: 900; letter-spacing: 1px; } @media(max-width: 900px) { .hero-container { height: 60vw; background-size: 100% 100%; } .tagline-box { font-size: 24px; padding: 30px; } .pillars-container { font-size: 16px; } } @media(max-width: 480px) { .hero-container { height: 300px; } .tagline-box { margin: 0px 20px; } } `}</style> </div> ) } function scrollToServices() { const element = document.querySelector('.mission') window.scroll({ top: element.offsetTop - 100, left: 0, behavior: 'smooth' }) }
const express = require('express') const cors = require('cors') const logger = require('morgan') const app = express() app.use(logger('dev'))// combined = full info && dev = development info app.use(express.json()) app.use(express.urlencoded({ extended: false })) app.use(cors()) app.get('/status', (req, res) => { res.send({ message: 'Dorood Giti~' }) }) // Ezafeh kardane yek User app.post('/register', (req, res) => { res.send(`Dorood ${req.body.password}, ${req.body.email} | Uw gebruiker is toegevoegd! | Ga verder.!`) }) app.listen(process.env.PORT || 8081)
'use strict'; const path = require('path'); const Metalsmith = require('metalsmith'); const collections = require('metalsmith-collections'); const layouts = require('metalsmith-layouts'); const watch = require('metalsmith-watch'); //const markdown = require('metalsmith-markdown'); //const permalinks = require('metalsmith-permalinks'); const inPlace = require('metalsmith-in-place'); const codeHighlight = require('./metalsmith/metalsmith-code-highlight'); const textContents = require('./metalsmith/metalsmith-text-contents'); const babel = require('./metalsmith/metalsmith-babel'); const i18n = require('./metalsmith/metalsmith-i18n-files'); const mstatic = require('metalsmith-static'); const registerHbsPartials = require('./handlebars/register-partials'); const registerHbsHelpers = require('./handlebars/helpers'); const { isEnabledVersion, getDocumentVersion, getFailbackVersion, packageVersion, packageVersionX, watchMode, devMode} = require('./buildcommon'); const hbs = { directory: '../hbs/layouts', partials: '../hbs/partials', }; registerHbsPartials({ dirname: __dirname, partialsPath: hbs.partials, }); registerHbsHelpers(); const demos = { allDemos: { pattern: 'demos/**/*.html*', sortBy: 'order' }, }; const docScript = require('../src/script/script'); Metalsmith(__dirname).//eslint-disable-line new-cap metadata({ demoCategorys: [ 'Introduction', 'Usage', 'Usage Vue Component', 'FAQ', ], script: docScript, packageVersion, packageVersionX, docLinkVersion: getDocumentVersion(), failbackVersion: getFailbackVersion(), debug: watchMode || devMode, }). source('../src'). destination(`../../../docs/${getDocumentVersion()}`). clean(true). use(watchMode ? watch({ paths: { '${source}/**/*': true, '${source}/*': true, }, livereload: true, }) : (files, metalsmith, done) => done()). use(mstatic({ src: path.relative(path.resolve(__dirname), require.resolve('highlight.js/styles/kimbie.dark.css')), dest: 'css/highlightjs.css' })). // use(assets( // )). use(layouts({ engine: 'handlebars', directory: hbs.directory, partials: hbs.partials, pattern: ['**/*.dummy'], suppressNoFilesError: true, })). use((files, metalsmith, done) => { // 非表示ドキュメントはdisabledフラグを立てる Object.keys(files).forEach((file) => { const data = files[file]; if (data.docVersion) { if (!isEnabledVersion(data.docVersion)) { data.disabled = true; } } if (data.docAbolishedVersion) { if (isEnabledVersion(data.docAbolishedVersion)) { data.disabled = true; } } }); done(); }). use(i18n()). use(collections(demos)). use(textContents({ demos: 'demos/**/*.parts*' })). use(textContents({ demos: 'demos/*.parts*' })). use(inPlace({ pattern: '*.hbs', suppressNoFilesError: true, })). use(inPlace({ pattern: '**/*.hbs', suppressNoFilesError: true, })). use(layouts({ engine: 'handlebars', directory: hbs.directory, // partials: hbs.partials, // pattern: ['**/*.html', '**/*.svg'], pattern: '**/*.html', engineOptions: { cache: false } // default: '{{{contents}}}', })). use(codeHighlight()). use(babel()). build((err) => { if (err) { throw err; } // error handling is required });
/** * Created by dell-pc on 2017/6/28. */ function Drag(id) { this.disX = 0; this.disY = 0; this.oDiv = document.getElementById(id); //·ÀÖ¹ÍϳöÒ³Ãæ var _this = this; this.oDiv.onmousedown =function(){ _this.fnDown(); }; } Drag.prototype.fnDown=function(e) { var oe = e || event; this.disX = oe.clientX - this.oDiv.offsetLeft; this.disY = oe.clientY - this.oDiv.offsetTop; var _this = this; document.onmousemove = function () { _this.fnMove(); }; document.onmouseup = function () { _this.fnUp(); }; return false; }; Drag.prototype.fnMove=function(e){ var oe = e||event; var l = oe.clientX-this.disX; var t = oe.clientY-this.disY; //if(l<0){ // l = 0; //}else if(l>document.documentElement.clientWidth-this.oDiv.offsetWidth){ // l = document.documentElement.clientWidth-this.oDiv.offsetWidth; //} //if(t<0){ // t = 0; //}else if(t>document.documentElement.clientHeight-this.oDiv.offsetHeight){ // t = document.documentElement.clientHeight-this.oDiv.offsetHeight; //} this.oDiv.style.left= l+'px'; this.oDiv.style.top= t+'px'; }; Drag.prototype.fnUp=function(){ document.onmousemove = null; document.onmouseup = null; }
//link to http var http = require('http'); var url = require('url'); //start http server so we can run in browser http.createServer(function(req, res) { //get the temperature from url - we need the true parameter to read the individual values var query = url.parse(req.url, true).query; //get the number in degrees celsius var celsius = query.celsius; //convert to an integer celsius = parseInt(celsius); //convert the tempurature into fahrenheit var farhenheit = (celsius*9/5) +32; //output to the browser res.write(celsius + ' degrees C equals ' + farhenheit + ' degrees F.'); res.end(); //output to the console console.log(celsius + ' degrees C equals ' + farhenheit + ' degrees F'); }).listen(1337); console.log('Server is running on port 1337.');
function logout() { auth.signOut(); console.log('User Logged Out! '); console.log("Opened: "+window.location.href); var path = window.location.href; var split = path.split("/"); var x = split.slice(0, split.length - 1).join("/") + "/"; console.log("To be replaced with : "+ x+"index.html"); window.location.replace(x+"index.html"); }
import React from 'react'; const Bit = props => ( <div className={props.className}> <p>{props.body}</p> <h5>{props.timestamp}</h5> </div> ); export default Bit;
import React from 'react'; import './index.scss'; import Calendar from 'react-calendar'; const CalendarComponent = ({ onChangeValue, shadow }) => ( <div className="Calendar__component" style={!shadow ? { boxShadow: 'none' } : {}}> <Calendar onChange={onChangeValue} /> </div> ); export default CalendarComponent;
'use strict' const {ServiceProvider} = require('@adonisjs/fold') const admin = require('firebase-admin') class FirebaseAdminProvider extends ServiceProvider { register () { this.app.singleton('FirebaseAdmin', () => { const Config = this.app.use('Adonis/Src/Config') const config = { credential: Config.get('firebase.credential'), databaseURL: Config.get('firebase.databaseURL'), storageBucket: Config.get('firebase.storageBucket') } config.credential = admin.credential.cert(config.credential) return admin.initializeApp(config) }) this.app.alias('FirebaseAdmin', 'FirebaseAdmin') } } module.exports = FirebaseAdminProvider
if(window.Promise){ var promise = new Promise(function(resolve, reject){ var request = new XMLHttpRequest() request.open('GET', 'http://api.icndb.com/jokes/random') request.onload = function(){ if(request.status == 200){ resolve(request.response); console.log('we got data') } else { reject(Error(request.statusText)) console.log('rejected') } } request.onerror = function(){ reject(Error('Error fetching data')) // error occurred - rejected the promise } request.send() }) promise.then(function(data){ data = JSON.parse(data) console.log(data) $('#joke').html(data['value'].joke) }, function(error){ console.log('we got an error') console.log(error.message) }) } else { console.log('get a new browser dipshit!') }
var mongo = require('mongoskin'); var Promise = require('bluebird'); var helper = require('./helper.js'); var config = { host: '127.0.0.1', port: '27017', dbName: 'library' }; var log = helper.getLogger('db'); exports.connect = function(callback) { if (helper.db) { callback(null, helper.db); } log.info('连接数据库', config.dbName); var db = mongo.db('mongodb://' + config.host + ':' + config.port + '/' + config.dbName + '?auto_reconnect=true&poolSize=3', {native_parse: true}); init(db) .then(function() { callback(null, db); }) .catch(function(err) { callback(err); }); }; function init(db, callback) { WrapperDbMethodByPromise(db); return db .find('groups', {}) .then(function(data) { log.info('数据库连接成功'); if(data && data.length > 0) { log.debug('users 已经初始化'); } else { // db.insert('groups', { // name: 'test', // photo: '', // times: '2015-12-03', // id: -1, // identify: 'admin' // }) } }); } function WrapperDbMethodByPromise(db) { db.find = function(dbName, query) { // if(query._id) { // query._id = helper.toObjectID(quert._id); // } return new Promise(function(resolve, reject) { db.collection(dbName).find(query).toArray(function(err, data) { return err ? reject(err) : resolve(data); }); }); }; db.insert = function(dbName, rowData) { return new Promise(function(resolve, reject) { db.collection(dbName).insert(rowData, function(err, data) { return err ? reject(err) : resolve(data); }); }) }; db.update = function(dbName, query, newData) { if (query._id) { query._id = helper.toObjectID(query._id); } return new Promise(function(resolve, reject) { db.collection(dbName).update(query, newData, function(err) { return err ? reject(err) : resolve(); }); }); }; db.remove = function(dbName, query) { return new Promise(function(resolve, reject) { db.collection(dbName).remove(query, function(err) { err ? reject(err): resolve(); }); }); } }
const https = require('https'); const slack_path = process.env.SLACK_PATH; const slack_channel = process.env.SLACK_CHANNEL; const textFromPayload = function (payload) { if (payload._raw) { return payload._raw; } if (payload.errorMessage) { return payload.errorMessage; } return JSON.stringify(payload); }; const colorFromPayload = function (payload) { if ("WARN" === payload.loggingLevel) { return "#b8660a"; } if ("ERROR" === payload.loggingLevel) { return "#b82004"; } if (payload._raw) { if (payload._raw.includes("WARN")) { return "#b8660a"; } if (payload._raw.includes("ERROR")) { return "#b82004"; } return "#3fb836"; } if (payload.errorMessage) { return "#b82004"; } return "#b8af05"; }; const fieldsFromPayload = function (payload) { const fields = []; Object.entries(payload).filter( entry => "_raw" !== entry[0] && "errorMessage" !== entry[0]).forEach( entry => fields.push({ "title": entry[0], "value": entry[1], "short": !entry[1] || !entry[1].length || entry[1].length < 200 }) ); return fields; }; exports.handler = (event, context, callback) => { console.info('Event received [json=\"%s\"]\n', JSON.stringify(event)); const jsonBody = JSON.parse(event.body); const request = { "channel": slack_channel, "username": "splunk-slack-webhook", "icon_url": "https://www.splunk.com/content/dam/splunk2/images/icons/products-solutions/splunk-icon-01.png", "attachments": [ { "title": jsonBody.search_name, "title_link": jsonBody.results_link, "text": textFromPayload(jsonBody.result), "color": colorFromPayload(jsonBody.result), "fields": fieldsFromPayload(jsonBody.result), "ts": new Date().getTime() / 1000 } ] }; // Build the post string from an object const post_data = JSON.stringify(request); // An object of options to indicate where to post to const post_options = { host: 'hooks.slack.com', port: '443', path: slack_path, method: 'POST', headers: { 'Content-Type': 'application/json', 'Content-Length': post_data.length } }; const post_request = https.request(post_options, function (res) { console.log('Response received [status=%s,]', res.statusCode); let body = ''; res.on('data', function (chunk) { body += chunk; }); res.on('end', function () { callback(null, body); }); }); post_request.on('error', context.fail); // Post the data. post_request.write(post_data); post_request.end(); };
/** * @file RadioSelect.js * @author leeight */ import {DataTypes, defineComponent} from 'san'; import {create} from './util'; import {asInput} from './asInput'; const cx = create('ui-radioselect'); const cx2 = create('ui-radio'); /* eslint-disable */ const template = `<div class="{{mainClass}}"> <ul> <li on-click="onItemClick(item)" class="{{item | itemClass(value)}}" s-for="item in datasource"> <div class="${cx2('item-hover')}" s-if="item.tip">{{item.tip}}<br/></div> <div class="arrow-down" s-if="item.tip"><i></i></div> {{item.text}} </li> </ul> </div>`; /* eslint-enable */ const RadioSelect = defineComponent({ template, computed: { mainClass() { return cx.mainClass(this); } }, filters: { itemClass(item, value) { const klass = [cx2('block')]; if (item.disabled) { klass.push(cx2('disabled')); } if (item.value === value) { klass.push(cx2('selected')); } return klass; } }, initData() { return { value: null, datasource: [] }; }, dataTypes: { /** * 组件的禁用状态 * @default false */ disabled: DataTypes.bool, /** * 组件当前的值 * @bindx */ value: DataTypes.any, /** * 组件的数据源 * <pre><code>{ * text: string, * value: any, * tip?: string * }</code></pre> */ datasource: DataTypes.array }, onItemClick(item) { const disabled = this.data.get('disabled'); if (item.disabled || disabled) { return; } this.data.set('value', item.value); this.fire('change', item); } }); export default asInput(RadioSelect);
export const state = () => ({}); export const mutations = {}; export const getters = {}; export const actions = { async list({ commit }, { filters, currentPage, pageSize, sort }) { let r = await this.$axios.post( "/api/category", { filters: filters, currentPage: currentPage, pageSize: pageSize, sort: sort, }, { useCache: true } ); return r; }, async menu({ commit }) { let r = await this.$axios.post("/api/category/menu"); return r; }, };
const Burger = () => ` <div class="burger"> <span class="burger-line"></span> <span class="burger-line"></span> <span class="burger-line"></span> </div> `; export default Burger;
import React from "react" import { View, Image, ImageBackground, TouchableOpacity, Text, Button, Switch, TextInput, StyleSheet, ScrollView } from "react-native" import Icon from "react-native-vector-icons/FontAwesome" import { CheckBox } from "react-native-elements" import { connect } from "react-redux" import { widthPercentageToDP as wp, heightPercentageToDP as hp } from "react-native-responsive-screen" import { getNavigationScreen } from "@screens" export class Blank extends React.Component { constructor(props) { super(props) this.state = {} } render = () => ( <ScrollView contentContainerStyle={{ flexGrow: 1 }} style={styles.ScrollView_1} > <View style={styles.View_2} /> <View style={styles.View_722_3377} /> <View style={styles.View_722_3379}> <View style={styles.View_I722_3379_217_6977} /> </View> <View style={styles.View_722_3381}> <View style={styles.View_722_3382}> <Text style={styles.Text_722_3382}>$2000</Text> </View> </View> <View style={styles.View_722_3384}> <View style={styles.View_722_3385}> <View style={styles.View_722_3386}> <View style={styles.View_722_3387}> <Text style={styles.Text_722_3387}>Type</Text> </View> <View style={styles.View_722_3388}> <Text style={styles.Text_722_3388}>Transfer</Text> </View> </View> <View style={styles.View_722_3392}> <View style={styles.View_722_3393}> <Text style={styles.Text_722_3393}>From</Text> </View> <View style={styles.View_722_3394}> <Text style={styles.Text_722_3394}>Paypal</Text> </View> </View> <View style={styles.View_722_3437}> <View style={styles.View_722_3438}> <Text style={styles.Text_722_3438}>To</Text> </View> <View style={styles.View_722_3439}> <Text style={styles.Text_722_3439}>Chase</Text> </View> </View> </View> </View> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/93da/9901/db631bff8e182c65489ea30aa757f56d" }} style={styles.ImageBackground_722_3395} /> <View style={styles.View_722_3396}> <Text style={styles.Text_722_3396}>Description</Text> </View> <View style={styles.View_722_3397}> <Text style={styles.Text_722_3397}> Amet minim mollit non deserunt ullamco est sit aliqua dolor do amet sint. Velit officia consequat duis enim velit mollit. Exercitation veniam consequat sunt nostrud amet. </Text> </View> <View style={styles.View_722_3398}> <Text style={styles.Text_722_3398}>Attachment</Text> </View> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/f7f2/ebf9/3478821bf4948f62bc5d1465d3f69718" }} style={styles.ImageBackground_722_3399} /> <View style={styles.View_722_3400}> <View style={styles.View_722_3401}> <Text style={styles.Text_722_3401}>Saturday 4 June 2021</Text> </View> <View style={styles.View_722_3402}> <Text style={styles.Text_722_3402}>16:20</Text> </View> </View> <View style={styles.View_913_0}> <View style={styles.View_I913_0_642_45}> <View style={styles.View_I913_0_642_46}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/98c6/6b57/0b0e789e64a5f61427be44aa42d2ff87" }} style={styles.ImageBackground_I913_0_642_46_280_5123} /> </View> <View style={styles.View_I913_0_642_47}> <Text style={styles.Text_I913_0_642_47}>Detail Transaction</Text> </View> <View style={styles.View_I913_0_642_49}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/031f/9eb0/596cc8839062ca65c0836f4d5854ad61" }} style={styles.ImageBackground_I913_0_642_49_280_5638} /> </View> </View> </View> <View style={styles.View_1037_5592}> <View style={styles.View_I1037_5592_568_4137}> <Text style={styles.Text_I1037_5592_568_4137}>Edit</Text> </View> </View> <View style={styles.View_722_3403}> <View style={styles.View_I722_3403_217_6977} /> </View> <View style={styles.View_831_399}> <View style={styles.View_I831_399_816_117}> <View style={styles.View_I831_399_816_118}> <Text style={styles.Text_I831_399_816_118}>9:41</Text> </View> </View> <View style={styles.View_I831_399_816_119}> <View style={styles.View_I831_399_816_120}> <View style={styles.View_I831_399_816_121}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/42fe/75df/eee86effef9007e53d20453d65f0d730" }} style={styles.ImageBackground_I831_399_816_122} /> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/323b/7a56/3bd8d761d4d553ed17394f5c34643bfe" }} style={styles.ImageBackground_I831_399_816_125} /> </View> <View style={styles.View_I831_399_816_126} /> </View> <View style={styles.View_I831_399_816_127}> <View style={styles.View_I831_399_816_128} /> <View style={styles.View_I831_399_816_129} /> <View style={styles.View_I831_399_816_130} /> <View style={styles.View_I831_399_816_131} /> </View> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/2e76/21a5/ca49045f4b39546b3cfd31fde18b9385" }} style={styles.ImageBackground_I831_399_816_132} /> </View> </View> </ScrollView> ) } const styles = StyleSheet.create({ ScrollView_1: { backgroundColor: "rgba(255, 255, 255, 1)" }, View_2: { height: hp("111%") }, View_722_3377: { width: wp("100%"), minWidth: wp("100%"), height: hp("39%"), minHeight: hp("39%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%"), backgroundColor: "rgba(0, 119, 255, 1)", borderTopLeftRadius: 0, borderTopRightRadius: 0, borderBottomLeftRadius: 16, borderBottomRightRadius: 16 }, View_722_3379: { width: wp("100%"), minWidth: wp("100%"), height: hp("5%"), minHeight: hp("5%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("111%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I722_3379_217_6977: { flexGrow: 1, width: wp("36%"), height: hp("1%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("32%"), top: hp("3%"), backgroundColor: "rgba(0, 0, 0, 1)" }, View_722_3381: { width: wp("91%"), minWidth: wp("91%"), height: hp("11%"), minHeight: hp("11%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("4%"), top: hp("15%") }, View_722_3382: { width: wp("91%"), minWidth: wp("91%"), minHeight: hp("11%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%"), justifyContent: "center" }, Text_722_3382: { color: "rgba(252, 252, 252, 1)", fontSize: 38, fontWeight: "700", textAlign: "center", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_722_3384: { width: wp("91%"), minWidth: wp("91%"), height: hp("10%"), minHeight: hp("10%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("4%"), top: hp("34%"), backgroundColor: "rgba(255, 255, 255, 1)" }, View_722_3385: { width: wp("78%"), minWidth: wp("78%"), height: hp("6%"), minHeight: hp("6%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("7%"), top: hp("2%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_722_3386: { width: wp("18%"), minWidth: wp("18%"), height: hp("6%"), minHeight: hp("6%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_722_3387: { width: wp("9%"), minWidth: wp("9%"), minHeight: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("4%"), top: hp("0%"), justifyContent: "center" }, Text_722_3387: { color: "rgba(145, 145, 159, 1)", fontSize: 11, fontWeight: "500", textAlign: "center", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_722_3388: { width: wp("18%"), minWidth: wp("18%"), minHeight: hp("3%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("4%"), justifyContent: "center" }, Text_722_3388: { color: "rgba(13, 14, 15, 1)", fontSize: 13, fontWeight: "400", textAlign: "center", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_722_3392: { width: wp("19%"), minWidth: wp("19%"), height: hp("6%"), minHeight: hp("6%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("28%"), top: hp("0%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_722_3393: { width: wp("9%"), minWidth: wp("9%"), minHeight: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("5%"), top: hp("0%"), justifyContent: "center" }, Text_722_3393: { color: "rgba(145, 145, 159, 1)", fontSize: 11, fontWeight: "500", textAlign: "center", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_722_3394: { width: wp("19%"), minWidth: wp("19%"), minHeight: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("4%"), justifyContent: "center" }, Text_722_3394: { color: "rgba(13, 14, 15, 1)", fontSize: 13, fontWeight: "400", textAlign: "center", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_722_3437: { width: wp("19%"), minWidth: wp("19%"), height: hp("6%"), minHeight: hp("6%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("58%"), top: hp("0%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_722_3438: { width: wp("19%"), minWidth: wp("19%"), minHeight: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%"), justifyContent: "center" }, Text_722_3438: { color: "rgba(145, 145, 159, 1)", fontSize: 11, fontWeight: "500", textAlign: "center", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_722_3439: { width: wp("19%"), minWidth: wp("19%"), minHeight: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("4%"), justifyContent: "center" }, Text_722_3439: { color: "rgba(13, 14, 15, 1)", fontSize: 13, fontWeight: "400", textAlign: "center", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, ImageBackground_722_3395: { width: wp("91%"), minWidth: wp("91%"), height: hp("0%"), minHeight: hp("0%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("4%"), top: hp("46%") }, View_722_3396: { width: wp("91%"), minWidth: wp("91%"), minHeight: hp("3%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("4%"), top: hp("48%"), justifyContent: "center" }, Text_722_3396: { color: "rgba(145, 145, 159, 1)", fontSize: 13, fontWeight: "400", textAlign: "left", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_722_3397: { width: wp("91%"), minWidth: wp("91%"), minHeight: hp("10%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("4%"), top: hp("53%"), justifyContent: "center" }, Text_722_3397: { color: "rgba(13, 14, 15, 1)", fontSize: 13, fontWeight: "500", textAlign: "left", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_722_3398: { width: wp("91%"), minWidth: wp("91%"), minHeight: hp("3%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("4%"), top: hp("65%"), justifyContent: "center" }, Text_722_3398: { color: "rgba(145, 145, 159, 1)", fontSize: 13, fontWeight: "400", textAlign: "left", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, ImageBackground_722_3399: { width: wp("89%"), minWidth: wp("89%"), height: hp("16%"), minHeight: hp("16%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("4%"), top: hp("70%"), resizeMode: "cover" }, View_722_3400: { width: wp("87%"), minWidth: wp("87%"), height: hp("2%"), minHeight: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("6%"), top: hp("26%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_722_3401: { width: wp("36%"), minWidth: wp("36%"), minHeight: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("19%"), top: hp("0%"), justifyContent: "center" }, Text_722_3401: { color: "rgba(252, 252, 252, 1)", fontSize: 10, fontWeight: "500", textAlign: "center", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_722_3402: { width: wp("9%"), minWidth: wp("9%"), minHeight: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("59%"), top: hp("0%"), justifyContent: "center" }, Text_722_3402: { color: "rgba(252, 252, 252, 1)", fontSize: 10, fontWeight: "500", textAlign: "center", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_913_0: { width: wp("100%"), minWidth: wp("100%"), height: hp("9%"), minHeight: hp("9%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("6%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I913_0_642_45: { flexGrow: 1, width: wp("91%"), height: hp("4%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("4%"), top: hp("2%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I913_0_642_46: { width: wp("9%"), minWidth: wp("9%"), height: hp("4%"), minHeight: hp("4%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%"), backgroundColor: "rgba(0, 0, 0, 0)", overflow: "hidden" }, ImageBackground_I913_0_642_46_280_5123: { flexGrow: 1, width: wp("6%"), height: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("1%"), top: hp("1%") }, View_I913_0_642_47: { width: wp("66%"), minWidth: wp("66%"), minHeight: hp("4%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("13%"), top: hp("0%"), justifyContent: "center" }, Text_I913_0_642_47: { color: "rgba(255, 255, 255, 1)", fontSize: 14, fontWeight: "400", textAlign: "center", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_I913_0_642_49: { width: wp("9%"), minWidth: wp("9%"), height: hp("4%"), minHeight: hp("4%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("83%"), top: hp("0%"), backgroundColor: "rgba(0, 0, 0, 0)", overflow: "hidden" }, ImageBackground_I913_0_642_49_280_5638: { flexGrow: 1, width: wp("6%"), height: hp("4%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("1%"), top: hp("0%") }, View_1037_5592: { width: wp("91%"), minWidth: wp("91%"), height: hp("8%"), minHeight: hp("8%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("4%"), top: hp("96%"), backgroundColor: "rgba(127, 61, 255, 1)" }, View_I1037_5592_568_4137: { flexGrow: 1, width: wp("9%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("41%"), top: hp("2%"), justifyContent: "center" }, Text_I1037_5592_568_4137: { color: "rgba(252, 252, 252, 1)", fontSize: 14, fontWeight: "400", textAlign: "center", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_722_3403: { width: wp("100%"), minWidth: wp("100%"), height: hp("5%"), minHeight: hp("5%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("106%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I722_3403_217_6977: { flexGrow: 1, width: wp("36%"), height: hp("1%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("32%"), top: hp("3%"), backgroundColor: "rgba(0, 0, 0, 1)" }, View_831_399: { width: wp("100%"), minWidth: wp("100%"), height: hp("6%"), minHeight: hp("6%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I831_399_816_117: { flexGrow: 1, width: wp("14%"), height: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("5%"), top: hp("2%") }, View_I831_399_816_118: { width: wp("14%"), minWidth: wp("14%"), minHeight: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%"), justifyContent: "flex-start" }, Text_I831_399_816_118: { color: "rgba(255, 255, 255, 1)", fontSize: 12, fontWeight: "400", textAlign: "center", fontStyle: "normal", letterSpacing: -0.16500000655651093, textTransform: "none" }, View_I831_399_816_119: { flexGrow: 1, width: wp("18%"), height: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("78%"), top: hp("2%") }, View_I831_399_816_120: { width: wp("7%"), minWidth: wp("7%"), height: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("11%"), top: hp("0%") }, View_I831_399_816_121: { width: wp("7%"), height: hp("2%"), top: hp("0%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%") }, ImageBackground_I831_399_816_122: { width: wp("6%"), minWidth: wp("6%"), height: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%") }, ImageBackground_I831_399_816_125: { width: wp("0%"), minWidth: wp("0%"), height: hp("1%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("6%"), top: hp("1%") }, View_I831_399_816_126: { width: wp("5%"), minWidth: wp("5%"), height: hp("1%"), minHeight: hp("1%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("1%"), top: hp("0%"), backgroundColor: "rgba(255, 255, 255, 1)", borderColor: "rgba(76, 217, 100, 1)", borderWidth: 1 }, View_I831_399_816_127: { width: wp("5%"), height: hp("1%"), top: hp("0%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%") }, View_I831_399_816_128: { width: wp("1%"), minWidth: wp("1%"), height: hp("1%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("1%"), backgroundColor: "rgba(255, 255, 255, 1)" }, View_I831_399_816_129: { width: wp("1%"), minWidth: wp("1%"), height: hp("1%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("1%"), top: hp("1%"), backgroundColor: "rgba(255, 255, 255, 1)" }, View_I831_399_816_130: { width: wp("1%"), minWidth: wp("1%"), height: hp("1%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("3%"), top: hp("0%"), backgroundColor: "rgba(255, 255, 255, 1)" }, View_I831_399_816_131: { width: wp("1%"), minWidth: wp("1%"), height: hp("1%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("4%"), top: hp("0%"), backgroundColor: "rgba(255, 255, 255, 1)" }, ImageBackground_I831_399_816_132: { width: wp("4%"), minWidth: wp("4%"), height: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("6%"), top: hp("0%") } }) const mapStateToProps = state => { return {} } const mapDispatchToProps = () => { return {} } export default connect(mapStateToProps, mapDispatchToProps)(Blank)
var express = require('express'); const querystring = require('querystring'); var router = express.Router(); var page = require('../views/framed_article/template.marko'); var feedmodel = require('../model/feeds'); var feedkey = "local"; router.get('/', function (req, res, next) { var source = req.query.source; res.redirect('/article/redirecting?source='+source); // res.marko(page, { source: source, return_url: return_url }) }) router.get('/redirecting', function (req, res, next) { var source = req.query.source; res.redirect(source); }) module.exports = router;
document.addEventListener("DOMContentLoaded", function(event) { // Hamburguer toggle function toggleNav(){ document.getElementById("nav-list").classList.toggle("is-open"); } document.querySelector("#hamburguer").addEventListener("click", toggleNav); });
require(['view/a', 'view/b'], function(a, b) { a.say('hello'); b.say('world'); });
const math = require("./app").math; describe("math function", () => { test("multiply is correct", () => { const input1 = 11, input2 = 22, method = "times"; output = 242; expect(math(input1, input2, method)).toEqual(output); }); test("pass an invalid input", () => { const input1 = "11", input2 = 22, method = "times"; output = "Parameter is not a number or the method is not supported!"; expect(() => { math(input1, input2, method); }).toThrowError( "Parameter is not a number or the method is not supported!" ); }); });
import React, { useState, useContext } from "react"; import { makeStyles, withStyles } from "@material-ui/core/styles"; import Select from "react-select"; import Paper from "@material-ui/core/Paper"; import Typography from "@material-ui/core/Typography"; import Avatar from "@material-ui/core/Avatar"; import exclude from "../../assets/exclude.svg"; import anonymous from "../../assets/anonymous.svg"; import FeedsContext from "../../context/feed/feedsContext"; import UserContext from "../../context/user/userContext"; import CourseContext from "../../context/course/courseContext"; const useStyles = makeStyles((theme) => ({ root: { margin: "1em 0", }, paper: { padding: "1em", }, courseDiv: { display: "flex", flexDirection: "row-reverse", alignItems: "center", }, select: { height: "2.25rem", width: "12rem", marginLeft: "0.5rem", backgroundColor: "#FFFFFF", "& .css-yk16xz-control": { minHeight: "0px", height: "2.25rem", borderColor: "#E5E5E5", }, "& .css-1wa3eu0-placeholder, & .css-1uccc91-singleValue": { fontFamily: "Roboto", color: "#111111", fontSize: "1rem", fontWeight: "400", }, "& .css-1pahdxg-control, & .css-1pahdxg-control:hover": { borderColor: "#E5E5E5", boxShadow: "none", }, }, post: { marginTop: "1em", height: "6em", width: "100%", backgroundColor: "#f7f7f7", outlineWidth: "0em", border: "none", }, buttons: { display: "flex", justifyContent: "flex-end", width: "98%", marginTop: "-1.6em", }, anonymous: { margin: "0.2em", width: "32px", height: "32px", backgroundColor: "white", }, exclude: { margin: "0.2em", width: "32px", height: "32px", }, })); const options = [ { value: 1, label: "Course 1" }, { value: 2, label: "Course 2" }, { value: 3, label: "Course 3" }, ]; const Post = () => { const userContext = useContext(UserContext); const feedsContext = useContext(FeedsContext); const courseContext = useContext(CourseContext); const classes = useStyles(); const [content, setContent] = useState(""); const [courseID, setCourseID] = useState(-1); const [courseName, setCourseName] = useState(""); const onCreatePost = () => { console.log(courseID) console.log(courseName) if (content && courseName) { feedsContext.addFeed({ postID: -1, message: content, courseID: courseID, userID: userContext.userID, firstName: "Shren", lastName: "Tseng", courseName: courseName, childComments: [], likes: 0, unlikes: 0, }); setContent(""); setCourseID(-1); setCourseName("") alert("Submit Successful"); } else { alert( "Post cannot be empty!!\nPlease choose a course you want to post!!" ); } }; const handleSelectChange = (event) => { setCourseName(event.courseName) setCourseID(event.courseID); }; return ( <div className={classes.root}> <Paper className={classes.paper} elevation={5}> <div className={classes.courseDiv}> <Select className={classes.select} classNamePrefix="react-select" options={courseContext.myCourses} getOptionLabel={option => option.courseNumber} getOptionValue={option => option.courseID} onChange={handleSelectChange} ></Select> </div> <div> <textarea className={classes.post} type="text" placeholder="Start a discussion... " value={content} onChange={(event) => setContent(event.target.value)} /> </div> <div className={classes.buttons}> <Avatar className={classes.anonymous} src={anonymous} /> <Avatar className={classes.exclude} src={exclude} onClick={() => onCreatePost()} /> </div> </Paper> </div> ); }; export default Post;
import React, { Component, Fragment } from 'react'; import Button from '../UI/button'; import Image from '../UI/image'; import Par from '../UI/paragraphs'; import Counter from '../holders/counter'; import Modal from 'react-modal'; import WhatsApp from '../../images/iconfinder_whatsapp_287520.png' import Ig from '../../images/6225234-download-instagram-logo-icon-free-png-transparent-image-and-clipart-instagram-symbol-transparent-400_400_preview.png' import Tel from '../../images/iconfinder_telegram_3069742.png' import Fb from '../../images/facbook.png' Modal.setAppElement('#root') class ProducBox extends Component { state = { openModal: false } componentDidMount() { } showTickets = () => { this.setState({ openModal: true }) } opneModal = () => { this.setState({ modal: true }) if (typeof this.props.openModl == "function") { this.props.openModl() } } returnNum = (num) => { if (num == null) { return 0 } else { return JSON.parse(num).length } } render() { if (this.returnNum(this.props.info.sold) === parseInt(this.props.info.fortunes)) { // this.props.onFinish() } let numberWithCommas = x => { return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); } console.log(this.props) return ( <Fragment> {!this.state.openModal ? <div> <Counter date={this.props.info.date} hour={this.props.info.hour} onFinish={(status) => this.props.onFinish(status)} /> {this.props.info.type == "Brand New" ? <div className="protype amber darken-2">{this.props.info.type}</div> : <div className="protype light-green darken-2">{this.props.info.type}</div>} <div className="bordered"> <Image info={{ class: "image", // image type: "bidImage", //bidImage squareImg src: this.props.info.image }} /> <Par info={{ type: "bidName", //homeText homePara text: this.props.info.name }} /> <Par info={{ type: "bidText", //homeText homePara text: "Ticket Price = " + " " + numberWithCommas(JSON.parse(localStorage.currency).currency + (parseFloat(this.props.info.price) / JSON.parse(localStorage.currency).rate).toFixed(2)) }} /> <div className="gridTwo topBottom"> <div> <Par info={{ type: "winnersPara", //homeText homePara text: "For" + " " + this.props.info.winners + " " + "winners" }} /> </div> <div> {!this.props.check ? <Button style={this.props.text ? "btn black white-text" : "btn light-green darken-2"} text={this.props.text ? this.props.text : "Bid Now"} info={{ type: "submit", name: "action", }} clicked={this.props.showTickets} /> : <Button style="btn light-green darken-2" text="Bid Now" info={{ type: "submit", name: "action", }} clicked={this.props.login} />} </div> </div> <Par info={{ type: "winnersPara", //homeText homePara text: (parseInt(this.props.info.fortunes) - this.returnNum(this.props.info.sold)).toString() + " " + '/' + this.props.info.fortunes + " " + "fortunes remains" }} /> <Button style="btn blue darken-3" text="share now" info={{ type: "submit", name: "action", }} clicked={() => { if (this.props.openModalaSec) { this.props.openModalaSec() } else { this.opneModal() } }} /> </div> </div> : null } <Modal style={{ overlay: { position: 'fixed', top: 0, left: 0, right: 0, bottom: 0, backgroundColor: 'rgba(0, 0, 0, 0.304)' }, content: { position: 'absolute', top: '20%', left: '10%', right: '10%', height: "100px", border: '1px solid #fff', background: '#fff', overflow: 'auto', WebkitOverflowScrolling: 'touch', borderRadius: '10px', outline: 'none', padding: '30px' } }} isOpen={this.state.modal} onRequestClose={() => { this.setState({ modal: false }) if (typeof this.props.closeMdl == "function") { this.props.closeMdl() } } }> <div className="fixed-action-btn"> <a className="btn-floating black" onClick={ () => { this.setState({ modal: false }) if (typeof this.props.closeMdl == "function") { this.props.closeMdl() } } }> <i className="material-icons">clear</i> </a> </div> {/* https://telegram.me/share/url?url=<URL><TEXT></TEXT> */} <div className="picturesShare"> <a href="#" target="_blank" onClick={() => { window.open( 'https://telegram.me/share/url?url=' + location.href + "&text=" + " Never has such a global guarantee platform been made that enables you to have the opportunity to get your heart wishes for as low as $1.Don’t Miss out! Check it out now!" + " ") return false; }}> <img src={Tel} width="35px" height="35px" alt="" /> </a> <a href="#" target="_blank" onClick={() => { window.open( 'whatsapp://send?text=' + " Never has such a global guarantee platform been made that enables you to have the opportunity to get your heart wishes for as low as $1.Don’t Miss out! Check it out now!" + " " + encodeURIComponent(location.href)) return false; }}> <img src={WhatsApp} width="35px" height="35px" alt="" /> </a> <a href="#" target="_blank" onClick={() => { window.open( 'https://www.facebook.com/sharer/sharer.php?u=' + " Never has such a global guarantee platform been made that enables you to have the opportunity to get your heart wishes for as low as $1.Don’t Miss out! Check it out now!" + " " + comencodeURIComponent(location.href), 'facebook-share-dialog', 'width=626,height=436') return false; }}> <img src={Fb} width="35px" height="35px" alt="" /> </a> <a href="#" target="_blank" onClick={() => { window.open( 'https://www.instagram.com/?url=' + " Never has such a global guarantee platform been made that enables you to have the opportunity to get your heart wishes for as low as $1.Don’t Miss out! Check it out now!" + " " + encodeURIComponent(location.href)) return false; }} > <img src={Ig} width="35px" height="35px" alt="" /> </a> </div> </Modal> </Fragment> ) } } export default ProducBox;
var sha256 = require("js-sha256"); /** * =========================================== * Export model functions as a module * =========================================== */ module.exports = dbPoolInstance => { const create = (user, callback) => { // run user input password through bcrypt to obtain hashed password var hashedValue = sha256(user.password); // set up query // UPDATING QUERYSTRING to reject duplicate name entries const queryString = "INSERT INTO users (name, password) SELECT ($1), ($2) WHERE NOT EXISTS ( SELECT * FROM users WHERE name=($3)) RETURNING *"; const values = [user.name, hashedValue, user.name]; // execute query dbPoolInstance.query(queryString, values, (error, queryResult) => { // invoke callback function with results after query has executed callback(error, queryResult); }); }; const login = (user, callback) => { const queryString = "SELECT * FROM users WHERE name = '"+user.name+"'"; dbPoolInstance.query(queryString, (err, queryResult) => { callback(err, queryResult) }) } const showUser = (user, callback) => { const queryString = "SELECT users.user_id, users.name, tweets.content FROM users, tweets WHERE users.user_id='"+user.id+"'"; dbPoolInstance.query(queryString, (err, queryResult) => { callback(err, queryResult) }) } const followUser = (user, followedUser, callback) => { const queryString = "INSERT INTO followers (user_id, follower_user_id) SELECT ($1), ($2) WHERE NOT EXISTS (SELECT * FROM followers WHERE followers.follower_user_id=($3))"; const values = [followedUser.id, user.user_id, user.user_id] dbPoolInstance.query(queryString, values, (err, queryResult)=> { callback(err, queryResult) }) } return { create, login, showUser, followUser }; };
import React, { useReducer } from 'react'; import './GiftBox.css'; //ACTIONS const TOGGLE_BOX = '[GiftBox] Toggle' const toggleBox = () => { return { type: TOGGLE_BOX } } //REDUCERS (Update) const DEFAULT = { open: false, wasOpen: false } const reducer = ( state = DEFAULT, {type} ) => { switch(type) { case TOGGLE_BOX: { return { open: !state.open, wasOpen: state.open } } default: return state } } //COMPONENT const GiftBox = () => { //hooks are an amazing functional solution! const [state, dispatch] = useReducer(reducer, DEFAULT) return ( <div className="floor"> <div className='shadow'></div> <div className='shadow2'></div> <div className='shadow3'></div> <div className="box"> { state.open ? (<i className="heart-gift">❤️</i>) : <></> } <div className={ state.open ? 'lid open' : state.wasOpen ? 'lid close' : 'lid' } onClick={e => dispatch(toggleBox())}> <div className="qmark">{ state.open? '!' : '?' } </div> <div className="face ltop"></div> <div className="face lleft"></div> <div className="face lright"></div> </div> <div className="face top"></div> <div className="face left"></div> <div className="face right"></div> </div> </div> ) } export default GiftBox;
import React from "react"; import Card from "./Card"; //CategoryList displays a list of all 6 default categories inside a Card component class CategoryList extends React.Component { render() { return( <div> { this.props.categories.map((categoria, index) => { return ( //Card Component displaying the info of each item //in this case, the categories <Card key={this.props.categories[index]} title={categoria} clicked={this.props.clickedFunction} /> ) }) } </div> ) } } export default CategoryList;
(function() { 'use strict'; angular.module('app') .directive('headerShrink', function($document) { return { restrict: 'A', link: function($scope, $element, $attr) { var resizeFactor, scrollFactor, blurFactor; var header = $document[0].body.querySelector('.about-header'); $scope.$on('userDetailContent.scroll', function(event, scrollView) { if (scrollView.__scrollTop >= 0) { scrollFactor = scrollView.__scrollTop / 3.5; header.style[ionic.CSS.TRANSFORM] = 'translate3d(0, +' + scrollFactor + 'px, 0)'; } else if (scrollView.__scrollTop > -70) { resizeFactor = -scrollView.__scrollTop / 100 + 0.99; // blurFactor = -scrollView.__scrollTop/50; header.style[ionic.CSS.TRANSFORM] = 'scale(' + resizeFactor + ',' + resizeFactor + ')'; // header.style.webkitFilter = 'blur('+blurFactor+'px)'; } }); } } }) .factory("Abouts", function($firebaseArray, FURL) { var aboutsRef = new Firebase(FURL + "abouts") return $firebaseArray(aboutsRef); }) .factory('AboutService', function($firebaseArray, $firebaseObject, FURL) { var ref = new Firebase(FURL); return { getAbouts: function() { return $firebaseArray(ref.child('abouts')); }, getAbout: function(aboutId) { return $firebaseObject(ref.child('about').child(aboutId)); } } }) .controller('MyProfileCtrl', MyProfileCtrl); function MyProfileCtrl($scope, $state, FURL, $firebaseArray, Profiles, ProfilesService, $ionicActionSheet, $timeout, $ionicModal, Abouts, AboutService, $ionicLoading, $ionicPopover, ProfilePics, ProfilePicsService, HeaderPics, HeaderPicsService) { var ref = new Firebase(FURL); var authData = ref.getAuth(); // console.log(authData); $scope.myprofile = authData; console.log(authData); $scope.logout = function() { var authData = null; $state.go('login'); } // Get all profiles then filter from the views $scope.profiles = ProfilesService.getProfiles(); $scope.profiles = Profiles; console.log(Profiles); $scope.refresh = function() { $scope.profiles = Profiles; console.log(Profiles); //Stop the ion-refresher from spinning $scope.$broadcast('scroll.refreshComplete'); }; $scope.abouts = AboutService.getAbouts(); $scope.abouts = Abouts; console.log(Abouts); //fetch profile picture for logged in user $scope.profilepics = ProfilePicsService.getProfilePics(); $scope.profilepics = ProfilePics; console.log(ProfilePics); //fetch header photo $scope.headerpics = HeaderPicsService.getHeaderPics(); $scope.headerpics = HeaderPics; console.log(HeaderPics); // Triggered on a button click, or some other target $scope.showSheet = function() { // Show the action sheet var hideSheet = $ionicActionSheet.show({ buttons: [{ text: '<b>Logout</b>' }], titleText: 'Options', cancelText: 'Cancel', cancel: function() { // add cancel code.. }, buttonClicked: function(index) { if (index === 0) { // add edit 2 code var authData = null; $state.go('login'); } // return true; } }); // For example's sake, hide the sheet after two seconds $timeout(function() { hideSheet(); }, 6000); }; // About modal $ionicModal.fromTemplateUrl('app/authentication/myprofile/editabout.html', { scope: $scope, animation: 'slide-in-up' }).then(function(modal) { $scope.modalabout = modal; }); $scope.AboutModal = function() { $scope.modalabout.show(); /** $timeout(function () { $scope.modal.hide(); }, 20000); **/ }; // Cleanup the modal when we're done with it $scope.$on('$destroy', function() { $scope.modalabout.remove(); }); $scope.aboutclose = function() { $scope.modalabout.hide(); }; // Post to AboutModal $scope.updateAbout = function(about) { Abouts.$add({ update: about.update, date: Date(), user: authData, email: authData.password.email }); about.update = ""; about.user = ""; // $scope.goBack(); // $state.go('app.events'); $scope.close(); }; // Do this in a modal // Profileupdate modal $ionicModal.fromTemplateUrl('app/authentication/myprofile/profilepic.html', { scope: $scope, animation: 'slide-in-up' }).then(function(modal) { $scope.modalprofile = modal; }); $scope.PicModal = function() { $scope.modalprofile.show(); /** $timeout(function () { $scope.modal.hide(); }, 20000); **/ }; // Cleanup the modal when we're done with it $scope.$on('$destroy', function() { $scope.modalprofile.remove(); }); $scope.profilepicclose = function() { $scope.modalprofile.hide(); }; // header $ionicModal.fromTemplateUrl('app/authentication/myprofile/headerpic.html', { scope: $scope, animation: 'slide-in-up' }).then(function(modal) { $scope.modalheader = modal; }); $scope.HeaderModal = function() { $scope.modalheader.show(); /** $timeout(function () { $scope.modal.hide(); }, 20000); **/ }; // Cleanup the modal when we're done with it $scope.$on('$destroy', function() { $scope.modalheader.remove(); }); $scope.headerpicclose = function() { $scope.modalheader.hide(); }; // DO popover for ppic Options $ionicPopover.fromTemplateUrl('app/authentication/myprofile/popover.html', { scope: $scope }).then(function(popover) { $scope.popover = popover; }); $scope.openPopover = function($event) { $scope.popover.show($event); }; $scope.closePopover = function() { $scope.popover.hide(); }; //Cleanup the popover when we're done with it! $scope.$on('$destroy', function() { $scope.popover.remove(); }); // Execute action on hide popover $scope.$on('popover.hidden', function() { // Execute action }); // Execute action on remove popover $scope.$on('popover.removed', function() { // Execute action }); // Do for header modal $ionicModal.fromTemplateUrl('app/authentication/myprofile/headerpic.html', { scope: $scope, animation: 'slide-in-up' }).then(function(modal) { $scope.modalheader = modal; }); $scope.HeaderModal = function() { $scope.modalheader.show(); /** $timeout(function () { $scope.modal.hide(); }, 20000); **/ }; // Cleanup the modal when we're done with it $scope.$on('$destroy', function() { $scope.modalheader.remove(); }); $scope.headerclose = function() { $scope.modalheader.hide(); }; } })();
//Define Objects and see if it working //https://api.myjson.com/bins/13ocs4 console.log("It works!"); var inputBox = document.querySelector("#input"); console.log("inputBox", inputBox); var obj = document.querySelector("#object"); console.log("object", object); var logList = document.querySelector("#logList"); console.log("logList", logList); var but1 = document.querySelector(".but1"); console.log("but1", but1); var but2 = document.querySelector(".but2"); console.log("but2", but2); var but3 = document.querySelector(".but3"); console.log("but3", but3); var boxQuestion = document.querySelector("#question"); console.log("boxQuestion", boxQuestion); var boxResponse = document.querySelector("#response"); console.log("boxResponse", boxResponse); var onSubmit = true; console.log("onSubmit", onSubmit); var question_list; //Sample Data https://api.myjson.com/bins/13ocs4 fetch("https://api.myjson.com/bins/119t1g").then(function (response) { response.json().then(function (theData) { question_list = theData; }); }); console.log(question_list); //Because I was using fetch and assign the var, it didn't have time to respone //in time to assign question_list. Which is why I need make sure to only //ask the fetch using a event and not automaticlly. //Start the question //get the length of question list and start loop //while there is still number in the loop, you must //get rid of them for by being correct or wrong //once the there nothing in arrary, reset. && but2.innerHTML="Start Question" var questionSlot = []; but2.onclick = function(){ //INTIZLAE if (question_list.length == 0 || question_list == []) { question_list.forEach(function(question){ questionSlot.push(question); }); } //GENERATE RANDOM INEX var max = (question_list.length - 1) var min = (0) questionIndex = Math.floor(Math.random() * (max - min) + min); //REMOVE FROM INDEX //console.log(question_list) //question_list.splice(questionIndex, 1) //CHANGE QUESTION ON SITE if (question_list.length == 0 || question_list == []) { boxQuestion.innerHTML = "Good job!"; } else{ boxQuestion.innerHTML = question_list[questionIndex].question; } but2.innerHTML = "Skip Question" //prevent user inputing another thing on same question response.innerHTML = "" but1.disabled=false; inputBox.disabled=false; }; but1.onclick = function(){ if (inputBox.value.toLowerCase() === question_list[questionIndex].answer) { response.innerHTML = "Correct! The answer was: " + question_list[questionIndex].answer var createLog = document.createElement("li"); createLog.innerHTML = "Correct! The answer was: ' " + question_list[questionIndex].answer + " ' "; //replace 0 with Index, make var of index createLog.style.color = "green"; logList.appendChild(createLog); but2.innerHTML = "Next Question"; inputBox.value = ""; but1.disabled=true; inputBox.disabled=true; } else { response.innerHTML = "What is " + question_list[questionIndex].answer + "?" var createLog = document.createElement("li"); createLog.innerHTML = "Wrong! The answer was: ' " + question_list[questionIndex].answer + " ' "; //replace 0 with Index, make var of index createLog.style.color = "red" logList.appendChild(createLog); but2.innerHTML = "Next Question" inputBox.value = "" but1.disabled=true; inputBox.disabled=true; }; }; but3.onclick = function(){ while (logList.firstChild){ logList.removeChild(logList.firstChild) }; };
blue_21_interval_name = ["佳里","塭子內","看坪","樹林","槺榔口","永吉","三股","十份里","金德興","九塊厝"]; blue_21_interval_stop = [ ["佳里站","愛明橋","南佳里","南勢","鎮南宮"], // 佳里 ["蚶西港","劉厝","西劉厝","外渡頭","塭子內","永昌宮","蚶寮","蚶寮尾"], // 塭子內 ["看坪","下看坪","春園休閒農場"], // 看坪 ["樹林"], // 樹林 ["義合","下義合","槺榔口"], // 槺榔口 ["永吉"], // 永吉 ["東三股","三股","佳里榮民之家"], // 三股 ["十份里"], // 十份里 ["金德興"], // 金德興 ["東九塊厝","九塊厝"] // 九塊厝 ]; blue_21_fare = [ [26], [26,26], [28,26,26], [35,26,26,26], [42,26,26,26,26], [46,26,26,26,26,26], [52,30,26,26,26,26,26], [57,35,28,26,26,26,26,26], [61,39,32,26,26,26,26,26,26], [64,43,36,29,26,26,26,26,26,26] ]; // format = [time at the start stop] or // [time, other] or // [time, start_stop, end_stop, other] blue_21_main_stop_name = ["佳里","南勢","劉厝","塭子內","春園<br />休閒農場","下義合","永吉","三股","佳里<br />榮民之家","九塊厝"]; blue_21_main_stop_time_consume = [0, 4, 7, 10, 17, 21, 24, 27, 32, 35]; blue_21_important_stop = [0, 8, 9]; // 佳里, 佳里榮民之家, 九塊厝 blue_21_time_go = [["06:00",[8]],["07:40",['繞',[9,5]]],["10:40",['繞',[9,5]]],["16:40",[8]],["19:00",[8]]]; blue_21_time_return = [["06:40",[8]],["08:20",['繞',[8,5]]],["11:30",['繞',[8,5]]],["17:20",[8]],["19:40",[8]]];
import React from 'react' import ReactDOM from 'react-dom' import Modal from '../../node_modules/react-bootstrap/lib/Modal' import Popover from '../../node_modules/react-bootstrap/lib/Popover' import Tooltip from '../../node_modules/react-bootstrap/lib/Tooltip' import OverlayTrigger from '../../node_modules/react-bootstrap/lib/OverlayTrigger' import Button from '../../node_modules/react-bootstrap/lib/Button' import Glyphicon from '../../node_modules/react-bootstrap/lib/Glyphicon' import Row from '../../node_modules/react-bootstrap/lib/Row' import Col from '../../node_modules/react-bootstrap/lib/Col' import Form from '../../node_modules/react-bootstrap/lib/Form' import Label from '../../node_modules/react-bootstrap/lib/Label' import FormControl from '../../node_modules/react-bootstrap/lib/FormControl' import FormGroup from '../../node_modules/react-bootstrap/lib/FormGroup' import RecipeForm from './RecipeForm' import EditForm from './EditForm' // Local storage --------------------------------------- import Lockr from '../../node_modules/lockr/lockr' var EditPopup = React.createClass({ getInitialState() { return { show: false, recipes: Lockr.get('recipes')} }, render() { let close = () => this.setState({ show: false}) return ( <div className="text-center modal-container"> <Button className='btn btn-default action'bsStyle='info' onClick={() => this.setState({ show: true})}>Edit</Button> <Modal show={this.state.show} onHide={close} container={this.parent} aria-labelledby="contained-modal-title"> <Modal.Header closeButton> <Modal.Title id="contained-modal-title"> Edit Recipe </Modal.Title> </Modal.Header> <Modal.Body> <EditForm close={close} recipes={this.state.recipes} recipe={this.state.recipes[this.props.recIndex]} nameValue={this.state.recipes[this.props.recIndex][0]} ingredientsValue={this.state.recipes[this.props.recIndex][1]} instructionsValue={this.state.recipes[this.props.recIndex][2]} CategoriesValue={this.state.recipes[this.props.recIndex][3]}/> </Modal.Body> <Modal.Footer> <Button onClick={close}>Cancel</Button> </Modal.Footer> </Modal> </div> ) } }) export default EditPopup
jQuery(document).ready(function(){ jQuery('#nav-account').addClass('active'); get_account_data(); // fill input fields with account data function get_account_data() { jQuery.ajax({ url: base_url+"account/get_account_data", cache: false, contentType: false, processData: false, dataType: 'text', type: 'post', success: function(data) { data = JSON.parse(data); client_data = data[0]; for (i in client_data) { jQuery('input#'+i).val(client_data[i]); } } }); } jQuery(document).on("click", "#save_account", function(){ if (validate_account_form()) { var data = {}; jQuery('input').each(function() { data[this.id] = jQuery(this).val(); }); var form_data = new FormData(); form_data.append('client_data', JSON.stringify(data)); update_account_data(data); } }) function update_account_data(data) { var form_data = new FormData(); form_data.append('account_data', JSON.stringify(data)); jQuery.ajax({ url: base_url+"account/update_account_data", cache: false, contentType: false, processData: false, dataType: 'text', data: form_data, type: 'post', success: function(data) { jQuery.alert({ title: 'Update!', content: 'Zmenené.', }); get_account_data(); } }); } });
import { Meteor } from 'meteor/meteor'; import { createContainer } from 'meteor/react-meteor-data'; import React, { Component, PropTypes } from 'react'; import { Link } from 'react-router'; import RaisedButton from 'material-ui/RaisedButton'; import baseTheme from 'material-ui/styles/baseThemes/lightBaseTheme'; import getMuiTheme from 'material-ui/styles/getMuiTheme'; import Header from '../components/Header'; import { Url } from '../api/currentTime.js'; class App extends Component { constructor(props,context) { super(props,context); this.imgLoaded = this.imgLoaded.bind(this); this.imgError = this.imgError.bind(this); this.download = this.download.bind(this); this.state = { url: 'https://storage.googleapis.com/img_store/', status: 'false', loaded: false }; } download() { Meteor.call('records.insert', window.localStorage.username, this.state.url + this.props.time.url); } imgLoaded(e) { console.log(e.target.src); if(e.target.src === (this.state.url + this.props.time.url)) { this.setState({ loaded: true, status: 'true' }); } else { this.setState({ loaded: false, status: 'false' }); } } imgError(e) { e.target.src='/default.jpg'; this.setState({ loaded: false, status: 'false' }) } getChildContext() { return { muiTheme: getMuiTheme(baseTheme) }; } render() { return ( <div> <Header /> <div className="container"> <header> <h1>Grab Image! </h1> <Link to="/gallery"><RaisedButton label="my gallery" primary={true} /></Link> <br /> <RaisedButton label="Download" disabled={!this.state.loaded} primary={true} onClick={this.download} /> </header> <p>{ this.state.url + this.props.time.url }</p> <p>{this.state.status}</p> <img id="image" height="300px" width="300px" src={ this.state.url + this.props.time.url } onError={this.imgError} onLoad={this.imgLoaded} /> </div> </div> ); } } //onError={this.imgError} App.propTypes = { time: PropTypes.object, }; App.childContextTypes = { muiTheme: React.PropTypes.object.isRequired }; export default createContainer(() => { return { time: Url.findOne({id:'addr'}) }; }, App);
/* Facebook sharing*/ window.fbAsyncInit = function() { // FB JavaScript SDK configuration and setup FB.init({ appId : '1679995098975056', // FB App ID cookie : true, // enable cookies to allow the server to access the session xfbml : true, // parse social plugins on this page version : 'v2.8' // use graph api version 2.8 }); // Check whether the user already logged in FB.getLoginStatus(function(response) { if (response.status === 'connected') { //display user data } }); }; // Load the JavaScript SDK asynchronously (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); (function() { var fbShare = function() { FB.ui({ method: "feed", display: "iframe", link: link, caption: title, description: description, picture: productImage }); }; $("#fb-publish").click(function() { FB.login(function(response) { if (response.authResponse) { fbShare(); } }); }); })(); /* Facebook sharing*/ /* Twitter shaing*/ $('.popup').click(function(event) { var width = 575, height = 400, left = ($(window).width() - width) / 2, top = ($(window).height() - height) / 2, url = this.href, opts = 'status=1' + ',width=' + width + ',height=' + height + ',top=' + top + ',left=' + left; window.open(url, 'twitter', opts); return false; }); /* Twitter shaing*/
import React from 'react' import { graphql } from 'gatsby' import { Container, Section, BigHeading } from '../elements' import specialBackground from '../../static/specialSectionBackground.png' import Layout from '../components/Layout/Layout' import SEO from '../components/SEO' import PostCarousel from '../components/PostCarousel' import HomeAbout from '../components/About/HomeAbout' import PostList from '../components/PostList' import HomeShowcase from '../components/HomeShowcase' import MegaButton from '../components/MegaButton' const Index = ({ data }) => { const { posts, showcaseCategory, showcasePost } = data const { website } = data.site.siteMetadata return ( <Layout> <SEO /> {website.home.HAS_CAROUSEL && ( <Section id='carousel'> <Container> <PostCarousel /> </Container> </Section> )} <Section id='about-me' specialBackground={specialBackground}> <Container> <HomeAbout /> </Container> </Section> <Section id='showcase'> <Container> {showcaseCategory && showcasePost && showcasePost.edges[0] && ( <HomeShowcase showcaseCategory={showcaseCategory} showcasePost={showcasePost.edges[0].node} /> )} </Container> </Section> <Section id='latest-posts'> <Container> <BigHeading textCenter>I miei ultimi articoli..</BigHeading> <PostList posts={posts.edges} /> <MegaButton text='Tutti gli articoli' linkTo='/page-1' /> </Container> </Section> </Layout> ) } export default Index export const pageQuery = graphql` query IndexQuery($showcaseCategoryUid: String, $postNumber: Int!) { site { siteMetadata { titleAlt website { home { HAS_CAROUSEL } } } } homepage: prismicHomepage { data { title { text } content { html } } } posts: allPrismicPost( sort: { fields: data___date, order: DESC } limit: $postNumber ) { edges { node { uid data { date(formatString: "DD MMMM YYYY", locale: "it") featured_image { fluid(maxWidth: 800) { ...GatsbyPrismicImageFluid } } title destination description categories { category { document { ... on PrismicPostCategory { uid data { name } } } } } } } } } showcaseCategory: prismicPostCategory(uid: { eq: $showcaseCategoryUid }) { data { name heading subheading } } showcasePost: allPrismicPost( sort: { fields: data___date, order: DESC } limit: 1 filter: { data: { categories: { elemMatch: { category: { uid: { eq: $showcaseCategoryUid } } } } } } ) { edges { node { uid data { date(formatString: "DD MMMM YYYY", locale: "it") featured_image { fluid(maxWidth: 600) { ...GatsbyPrismicImageFluid } } title body { ... on PrismicPostBodyText { slice_type id primary { text { html } } } } destination categories { category { document { ... on PrismicPostCategory { uid data { name } } } } } } } } } } `
var NAVTREEINDEX3 = { "command__parse_8c.html#a8769157e701120c7855feed61fa6741f":[2,0,32,23], "command__parse_8c.html#a89f64a00e7616e86cb8a32502bf51bd2":[2,0,32,22], "command__parse_8c.html#a8cd7794996f6a70cacd47a88c9182366":[2,0,32,16], "command__parse_8c.html#a9606ade62612df075df6ae982722ed63":[2,0,32,48], "command__parse_8c.html#a98a737c5b392a1e5381bfc4e2e5893bc":[2,0,32,28], "command__parse_8c.html#ab9987d00e9a64d38e459db1cf1e58d33":[2,0,32,26], "command__parse_8c.html#abbd9abd9a9e82ae4de6db96b7c6d8df2":[2,0,32,36], "command__parse_8c.html#abfa8a44f9af30a491c602f484ca656c8":[2,0,32,6], "command__parse_8c.html#ad99f485e120b50345092407b57f02497":[2,0,32,39], "command__parse_8c.html#ad9a616dd25dd5e92e35ea7e29ad0d6c1":[2,0,32,4], "command__parse_8c.html#add5dbbf0bd35a9aa93a19537a939aafe":[2,0,32,24], "command__parse_8c.html#ae940c8a2d277f104d28f9998cd73ead5":[2,0,32,13], "command__parse_8c.html#aecb1b2c60446e7de5fbae18b9ea7721f":[2,0,32,2], "command__parse_8c.html#aed640aef855cb08e585f231d4aa5d110":[2,0,32,31], "command__parse_8c.html#aee3223470a0b07c94daa068a8db2d265":[2,0,32,29], "command__parse_8c.html#af433f0af5d00dc471fbcd0b62c1b2f9b":[2,0,32,15], "command__parse_8c.html#af9fdb8fa1c75d49cdf90529da7b683b7":[2,0,32,21], "command__parse_8c.html#afafced1b84e7868cb29d1cde26c7c74a":[2,0,32,7], "command__parse_8c.html#afbf3fcb4f4e98aa1f1844c546cb145b5":[2,0,32,9], "command__parse_8c_source.html":[2,0,32], "command__parse_8h.html":[2,0,33], "command__parse_8h.html#a0630fd47a9b1455ded08f6b1f85d501c":[2,0,33,26], "command__parse_8h.html#a0bb2743c6260e509642ea6025e15b652":[2,0,33,19], "command__parse_8h.html#a19a6473b10de513f181bd0ea4fa0c80f":[2,0,33,20], "command__parse_8h.html#a1ee4159cd29b919a3ffbc3b0f62439f6":[2,0,33,28], "command__parse_8h.html#a2246a1378a7b22b8a164077a0522cc07":[2,0,33,27], "command__parse_8h.html#a25f38c8598d83fa49328925e85bfc837":[2,0,33,11], "command__parse_8h.html#a2b802266d3a89bc30f84dda0854c54c8":[2,0,33,0], "command__parse_8h.html#a441b580ab90bd2bc9e1346bc82fd973c":[2,0,33,31], "command__parse_8h.html#a4afcead942937013d0508ebbec9c57ac":[2,0,33,6], "command__parse_8h.html#a4b83a280b9b7bc4124d008acb4b98f46":[2,0,33,3], "command__parse_8h.html#a4bb7ede873ae3c2de2b75c6064702088":[2,0,33,16], "command__parse_8h.html#a4de6648a96f0b42657a3b5bb3eccfa22":[2,0,33,30], "command__parse_8h.html#a54533252c9370371d97e1325015c0961":[2,0,33,21], "command__parse_8h.html#a5b8e0c7c244c9976bcf776e20105432a":[2,0,33,25], "command__parse_8h.html#a5cac54aaf46eabaae1a85acd1e36a309":[2,0,33,29], "command__parse_8h.html#a5daaca3326b46c2a331585bfdda3a26e":[2,0,33,23], "command__parse_8h.html#a763dad4385f6f04bd6f19829cb8ff0e3":[2,0,33,4], "command__parse_8h.html#a7c8121690dd6af6cb8212d815b1e4077":[2,0,33,24], "command__parse_8h.html#a7efc4ec1c2dc8ab06a302452b9c66d38":[2,0,33,18], "command__parse_8h.html#a8351acfae62dec43e37e90bc9d837cf9":[2,0,33,32], "command__parse_8h.html#a837b7ba6d366f3151fbe47441ca34cc9":[2,0,33,5], "command__parse_8h.html#a84bf2b09085394db9bbbfc6656914fbd":[2,0,33,13], "command__parse_8h.html#a8769157e701120c7855feed61fa6741f":[2,0,33,9], "command__parse_8h.html#a89f64a00e7616e86cb8a32502bf51bd2":[2,0,33,8], "command__parse_8h.html#a8cd7794996f6a70cacd47a88c9182366":[2,0,33,2], "command__parse_8h.html#a98a737c5b392a1e5381bfc4e2e5893bc":[2,0,33,14], "command__parse_8h.html#ab9987d00e9a64d38e459db1cf1e58d33":[2,0,33,12], "command__parse_8h.html#abbd9abd9a9e82ae4de6db96b7c6d8df2":[2,0,33,22], "command__parse_8h.html#add5dbbf0bd35a9aa93a19537a939aafe":[2,0,33,10], "command__parse_8h.html#ae940c8a2d277f104d28f9998cd73ead5":[2,0,33,33], "command__parse_8h.html#aed640aef855cb08e585f231d4aa5d110":[2,0,33,17], "command__parse_8h.html#aee3223470a0b07c94daa068a8db2d265":[2,0,33,15], "command__parse_8h.html#af433f0af5d00dc471fbcd0b62c1b2f9b":[2,0,33,1], "command__parse_8h.html#af9fdb8fa1c75d49cdf90529da7b683b7":[2,0,33,7], "command__parse_8h_source.html":[2,0,33], "commands_8c.html":[2,0,28], "commands_8c.html#a02ca5373d05a327109310e13d0f66309":[2,0,28,20], "commands_8c.html#a19d616ec18ecbcc219d91d0fb2540ca4":[2,0,28,9], "commands_8c.html#a1d7e589609c99aec9285cdce17d0679e":[2,0,28,11], "commands_8c.html#a25c8d66a816a581b83480082bc1cb012":[2,0,28,14], "commands_8c.html#a285a3606fd845c0e1373a25863bfcbf5":[2,0,28,1], "commands_8c.html#a2fc497abbb4426b3352d9ec6676cc39f":[2,0,28,4], "commands_8c.html#a3cdbfc5a93d706c080d0fb24a905a5e9":[2,0,28,5], "commands_8c.html#a46f55db076fe1d038056bc59cc4aeaa9":[2,0,28,10], "commands_8c.html#a4d2efe569432972181e14dd1bc24c917":[2,0,28,27], "commands_8c.html#a59ddef95d9da473164d2e93ced35abfb":[2,0,28,12], "commands_8c.html#a7137b6425845f3ca8a126e273ec8022a":[2,0,28,28], "commands_8c.html#a736c53062dd85b1a3a22ae35a87963ae":[2,0,28,29], "commands_8c.html#a7842a20a2f9fce0b9d6e46a8a898e66d":[2,0,28,24], "commands_8c.html#a7df7475c1534f3b9d1334389856468d4":[2,0,28,2], "commands_8c.html#a84666d102dc87cf5d3a33c6315896373":[2,0,28,19], "commands_8c.html#a8640d6fc4382e7fe783d34f40393199e":[2,0,28,15], "commands_8c.html#a8a46a520d098c69d31753164679300ac":[2,0,28,3], "commands_8c.html#a8fcae96bc18ef785ff84a05cf96f5d85":[2,0,28,18], "commands_8c.html#a9b5874c3558cb300404bb50f60fc6a31":[2,0,28,17], "commands_8c.html#a9d50376776e9a6bb8bc85d98e18f0a5a":[2,0,28,22], "commands_8c.html#aadbef88d335f58b95141690f1fc7b3d5":[2,0,28,6], "commands_8c.html#ab2bcc76de7d22e205ac917021f919929":[2,0,28,26], "commands_8c.html#abe55beb9d502d856dcf21d2bc91cd3ac":[2,0,28,25], "commands_8c.html#ad530b4882f28c249efdc9a4c5efe9503":[2,0,28,8], "commands_8c.html#adeb357fcd9a2f66205ced23bea756ec6":[2,0,28,21], "commands_8c.html#ae32812dd02476b8d30d33de490856e53":[2,0,28,0], "commands_8c.html#ae8344fc08f0dc93828501cc20ce56a27":[2,0,28,16], "commands_8c.html#af6b7cf574e3369a8f6e91472c9f81411":[2,0,28,7], "commands_8c.html#af74f4a746f477efa94a5e576e285bb71":[2,0,28,13], "commands_8c.html#afeca6ee60af4383c966c1393a307e4f1":[2,0,28,23], "commands_8c_source.html":[2,0,28], "commands_8h.html":[2,0,34], "commands_8h.html#a02ca5373d05a327109310e13d0f66309":[2,0,34,1], "commands_8h.html#a19d616ec18ecbcc219d91d0fb2540ca4":[2,0,34,9], "commands_8h.html#a1d7e589609c99aec9285cdce17d0679e":[2,0,34,13], "commands_8h.html#a285a3606fd845c0e1373a25863bfcbf5":[2,0,34,3], "commands_8h.html#a2fc497abbb4426b3352d9ec6676cc39f":[2,0,34,0], "commands_8h.html#a46f55db076fe1d038056bc59cc4aeaa9":[2,0,34,12], "commands_8h.html#a4d2efe569432972181e14dd1bc24c917":[2,0,34,20], "commands_8h.html#a59ddef95d9da473164d2e93ced35abfb":[2,0,34,7], "commands_8h.html#a7842a20a2f9fce0b9d6e46a8a898e66d":[2,0,34,17], "commands_8h.html#a84666d102dc87cf5d3a33c6315896373":[2,0,34,2], "commands_8h.html#a8640d6fc4382e7fe783d34f40393199e":[2,0,34,10], "commands_8h.html#a8a46a520d098c69d31753164679300ac":[2,0,34,5], "commands_8h.html#a9b5874c3558cb300404bb50f60fc6a31":[2,0,34,6], "commands_8h.html#a9d50376776e9a6bb8bc85d98e18f0a5a":[2,0,34,15], "commands_8h.html#ab2bcc76de7d22e205ac917021f919929":[2,0,34,19], "commands_8h.html#abe55beb9d502d856dcf21d2bc91cd3ac":[2,0,34,18], "commands_8h.html#ad530b4882f28c249efdc9a4c5efe9503":[2,0,34,8], "commands_8h.html#adeb357fcd9a2f66205ced23bea756ec6":[2,0,34,14], "commands_8h.html#ae8344fc08f0dc93828501cc20ce56a27":[2,0,34,11], "commands_8h.html#af74f4a746f477efa94a5e576e285bb71":[2,0,34,4], "commands_8h.html#afeca6ee60af4383c966c1393a307e4f1":[2,0,34,16], "commands_8h_source.html":[2,0,34], "common_8c.html":[2,0,10,1], "common_8c.html#afe662c7f2a62dbfb76f8ec83696b7a63":[2,0,10,1,0], "common_8c_source.html":[2,0,10,1], "compile_8c.html":[2,0,23,0], "compile_8c.html#a026ca7488dc3d79eb51f762eae318790":[2,0,23,0,22], "compile_8c.html#a04d5def454506ddddecd813fd10025ca":[2,0,23,0,14], "compile_8c.html#a05c35546f8ae6e83b41a0c65c789469d":[2,0,23,0,13], "compile_8c.html#a11ef2ee2078f96e37fc2378d7cbdd837":[2,0,23,0,2], "compile_8c.html#a140c0500650ce75616102048de33823c":[2,0,23,0,0], "compile_8c.html#a17082f7c01812c4ab654b44d3b01dd0f":[2,0,23,0,31], "compile_8c.html#a1af94bb9ebe18b51340dd5286e7735e3":[2,0,23,0,27], "compile_8c.html#a20e645effab0dbabefd7a5ff7970ad1e":[2,0,23,0,19], "compile_8c.html#a2a12b20dc51f879eeb72a289878da9b7":[2,0,23,0,26], "compile_8c.html#a2f73b95e29ef9649a55b2bd4418915b0":[2,0,23,0,10], "compile_8c.html#a3251cb49ad34aa053e8c8c58b453a37c":[2,0,23,0,6], "compile_8c.html#a34120478ddc4976939fb82e05bb42cb7":[2,0,23,0,29], "compile_8c.html#a37249909aeac1eb098eb030162029d55":[2,0,23,0,23], "compile_8c.html#a3d9e5469d68019037b923e2fd48ec80a":[2,0,23,0,4], "compile_8c.html#a5c8b5d38c73da21e67373c7450a1d4d1":[2,0,23,0,12], "compile_8c.html#a5d78ec5d08ad752dc6e0f92f6fac5f5d":[2,0,23,0,18], "compile_8c.html#a6e05ff9ad02882ea8a969b1c3fc8ec09":[2,0,23,0,16], "compile_8c.html#a78a6115b485de47c7cc56b224c558ea2":[2,0,23,0,9], "compile_8c.html#a790dcdec77411eda7d364acfb4495ebc":[2,0,23,0,11], "compile_8c.html#a790dcdec77411eda7d364acfb4495ebca90047675101eae9b7450873839f84618":[2,0,23,0,11,0], "compile_8c.html#a790dcdec77411eda7d364acfb4495ebca924de662d6bf4829a23a8440ce81a6d2":[2,0,23,0,11,1], "compile_8c.html#a790dcdec77411eda7d364acfb4495ebcaad461d4ac4d5678e84ef677aac883f67":[2,0,23,0,11,2], "compile_8c.html#a7dfd74a9c3f049b98a30f18e13405690":[2,0,23,0,5], "compile_8c.html#a8a1b9cc62e4725626e58ab32a2307adb":[2,0,23,0,24], "compile_8c.html#a9d8f54c9e4c2990b9171d1c88119f454":[2,0,23,0,8], "compile_8c.html#aa80fa13035b4a96b39d64ee7121bf865":[2,0,23,0,17], "compile_8c.html#ab4e20611f907b5dc67a8c45bac3983c9":[2,0,23,0,15], "compile_8c.html#ac2a8729662aa8d0b6cf21d7c5ab7826f":[2,0,23,0,32], "compile_8c.html#ac2f3c767660113e75cd54b1bb608e2ed":[2,0,23,0,25], "compile_8c.html#acf5730921b217e3288a616e243895054":[2,0,23,0,7], "compile_8c.html#ae447e834babbe84bef7005199ec39962":[2,0,23,0,30], "compile_8c.html#ae88dd7b2c480f6d555b55b6730ec7889":[2,0,23,0,28], "compile_8c.html#af149b6e961deb0d26719afd29193c6a0":[2,0,23,0,1], "compile_8c.html#af2a229242dd3931823311964a36d4c51":[2,0,23,0,21], "compile_8c.html#af87ec061f604dd69acc8c84330a97b96":[2,0,23,0,20], "compile_8c.html#af9c34a67a5bd83258f9c270a6e63adaf":[2,0,23,0,3], "compile_8c_source.html":[2,0,23,0], "complete_8c.html":[2,0,35], "complete_8c.html#a72b3c85bc14241321c26350fd4a26b37":[2,0,35,0], "complete_8c_source.html":[2,0,35], "compmbox_2compress_8c.html":[2,0,4,0], "compmbox_2compress_8c.html#a08818c1789d0341db65745d36f50f1b3":[2,0,4,0,32], "compmbox_2compress_8c.html#a0e6812b4bba1845ea248f4df93c06fea":[2,0,4,0,24], "compmbox_2compress_8c.html#a1570c091fe68f805495bcdd1c457b47a":[2,0,4,0,20], "compmbox_2compress_8c.html#a164a2844f1899843274d6c80a194ca86":[2,0,4,0,30], "compmbox_2compress_8c.html#a186f83caeb64abb53f83cdf0e7811972":[2,0,4,0,18], "compmbox_2compress_8c.html#a1c0b7ffa4578c0b91fda494e873f13e7":[2,0,4,0,27], "compmbox_2compress_8c.html#a449d225488040512f5696e4f76f36694":[2,0,4,0,22], "compmbox_2compress_8c.html#a5a72d9df3a0aeedccf7bd6ac0fb4e12b":[2,0,4,0,13], "compmbox_2compress_8c.html#a5ae987f4dda46e1423fedf6a0ac0b2de":[2,0,4,0,6], "compmbox_2compress_8c.html#a5c3fd55d08b7899a9010df6088a3c1ce":[2,0,4,0,16], "compmbox_2compress_8c.html#a60e1b3c821fbb441941a42b24149fbb3":[2,0,4,0,3], "compmbox_2compress_8c.html#a616221215cd9a4dd6d750ae4235553ff":[2,0,4,0,19], "compmbox_2compress_8c.html#a69f737b0581952c0ef57f37af78ac6c7":[2,0,4,0,33], "compmbox_2compress_8c.html#a6baf16b10893271190480d29fbc8b493":[2,0,4,0,26], "compmbox_2compress_8c.html#a77600af8755fc3921168f6c0727abf18":[2,0,4,0,9], "compmbox_2compress_8c.html#a7ad6d8fff1d3afeb0ff6b88263a99725":[2,0,4,0,15], "compmbox_2compress_8c.html#a804a1a638527ebaddb0d693ec35d5198":[2,0,4,0,7], "compmbox_2compress_8c.html#a8440ad71a5e3d43cd2c836c777bccded":[2,0,4,0,0], "compmbox_2compress_8c.html#a877acb05482802a48bc56da5e24c8c54":[2,0,4,0,4], "compmbox_2compress_8c.html#a8c82fa05ac9a30a1cd0e5c5b472ae066":[2,0,4,0,1], "compmbox_2compress_8c.html#a8ee2e7c8c528fd5338663badb7763d45":[2,0,4,0,21], "compmbox_2compress_8c.html#a958dff103de14a95ce0a8a5dd977167b":[2,0,4,0,5], "compmbox_2compress_8c.html#a9cedad82abc13c823ff2d0e7bc1b66f9":[2,0,4,0,23], "compmbox_2compress_8c.html#a9f3c7362d3b06ea8c32ce55d5c3db5f1":[2,0,4,0,10], "compmbox_2compress_8c.html#aa35e239a0ed2772ae5824c317276f83a":[2,0,4,0,2], "compmbox_2compress_8c.html#aacc5514861dae8839d75317159500fcb":[2,0,4,0,17], "compmbox_2compress_8c.html#ab1af5dae348409b32251325a3c91d890":[2,0,4,0,14], "compmbox_2compress_8c.html#ab77ea42f102d3aced8ea915e95a83bd4":[2,0,4,0,12], "compmbox_2compress_8c.html#ab807f84b5a28020a4250500f9fa7463c":[2,0,4,0,31], "compmbox_2compress_8c.html#abec93f40f46e453d46cb9d7181ae39f9":[2,0,4,0,8], "compmbox_2compress_8c.html#ac329588156f6dfd55072cc812ff043cd":[2,0,4,0,25], "compmbox_2compress_8c.html#ad886126ad1805be0c69f9b2fe138db10":[2,0,4,0,28], "compmbox_2compress_8c.html#af5e4caf583046a535cf5fda9933d3c74":[2,0,4,0,11], "compmbox_2compress_8c.html#afc352b335c9a8dd1d6e89bcc566dba80":[2,0,4,0,29], "compmbox_2compress_8c_source.html":[2,0,4,0], "compmbox_2lib_8h.html":[2,0,4,1], "compmbox_2lib_8h.html#a69f737b0581952c0ef57f37af78ac6c7":[2,0,4,1,5], "compmbox_2lib_8h.html#a8440ad71a5e3d43cd2c836c777bccded":[2,0,4,1,1], "compmbox_2lib_8h.html#a9f3c7362d3b06ea8c32ce55d5c3db5f1":[2,0,4,1,2], "compmbox_2lib_8h.html#ab77ea42f102d3aced8ea915e95a83bd4":[2,0,4,1,4], "compmbox_2lib_8h.html#af5e4caf583046a535cf5fda9933d3c74":[2,0,4,1,3], "compmbox_2lib_8h_source.html":[2,0,4,1], "compmbox_compress.html":[3,4,0], "compose_2config_8c.html":[2,0,5,1], "compose_2config_8c.html#a0c9facb50eed07bff7e37fabc23f7f73":[2,0,5,1,2], "compose_2config_8c.html#a3f6ac46618c7ee1f87a39031678d5590":[2,0,5,1,1], "compose_2config_8c.html#aa4edd692877f894c7864779c8cdf767b":[2,0,5,1,0], "compose_2config_8c_source.html":[2,0,5,1], "compose_2lib_8h.html":[2,0,5,2], "compose_2lib_8h.html#a7c91de124318eeb1933c61cc75b8e665":[2,0,5,2,2], "compose_2lib_8h.html#acbb0d4100be90b597c9229f13cd7ef2b":[2,0,5,2,1], "compose_2lib_8h.html#adf568d592758fae1758bbb4dc4e3e554":[2,0,5,2,0], "compose_2lib_8h_source.html":[2,0,5,2], "compose_8c.html":[2,0,5,0], "compose_8c.html#a06eaad0402e7c6919916f45932477419":[2,0,5,0,33], "compose_8c.html#a094c42d2adc33086bf5e51684819cd24":[2,0,5,0,24], "compose_8c.html#a09885d2cb5854aa82240411a1708abf7":[2,0,5,0,5], "compose_8c.html#a10fb95e2265c7801f3cc2dcb92c3b836":[2,0,5,0,34], "compose_8c.html#a1531d785d4faa4bc82cd8c43ff6e9f04":[2,0,5,0,8], "compose_8c.html#a1c8ed66a5996c5748a22515f6915d559":[2,0,5,0,14], "compose_8c.html#a260eba8ce50a7b007ccd1e42df97bd4f":[2,0,5,0,19], "compose_8c.html#a2dc7f233f069332ab5fd13ebb6a32934":[2,0,5,0,40], "compose_8c.html#a2fa8cea9616d3eeb400aa36f9ff1034c":[2,0,5,0,25], "compose_8c.html#a390ced109c2d496e6a6661db461d3f50":[2,0,5,0,22], "compose_8c.html#a3a2628773125cc354856c45fbffbb224":[2,0,5,0,13], "compose_8c.html#a3ab795b188471453ebe6cdb5fb15ab41":[2,0,5,0,3], "compose_8c.html#a3de3b86ab6b21aee74c81d3b6d93cf45":[2,0,5,0,4], "compose_8c.html#a4d1badace8a605f05e3094d32837b3ab":[2,0,5,0,20], "compose_8c.html#a577b891ac761db94d93ff7d31e9670bb":[2,0,5,0,42], "compose_8c.html#a5ce2f7dfd6942654a9610af1c19a5f21":[2,0,5,0,21], "compose_8c.html#a5d9bfff8fe9b32f6ffa8df2576ef0e88":[2,0,5,0,2], "compose_8c.html#a6d6517aa9ace035c5e1449dd0bbcdeed":[2,0,5,0,31], "compose_8c.html#a785f04ab170c17ce970ceea7d2615150":[2,0,5,0,43], "compose_8c.html#a7cd542de4349c167dd99566a9ce04a85":[2,0,5,0,11], "compose_8c.html#a81116139e0a71a3bd2b6967f7dcaa71b":[2,0,5,0,28], "compose_8c.html#a82dc12838cf57973070cdd4e9c554d41":[2,0,5,0,36], "compose_8c.html#a8faee93bf8b76d2c9fd2fa1f99aa73e7":[2,0,5,0,32], "compose_8c.html#a995fe70fb321e85b2799e74e3e3322f0":[2,0,5,0,27], "compose_8c.html#aa57902c74e4b99785680a0bc4e263029":[2,0,5,0,41], "compose_8c.html#aa5d7e91e9396582befc17198ad78464c":[2,0,5,0,44], "compose_8c.html#aafa46e29920afd47903620b3d77ac45f":[2,0,5,0,26], "compose_8c.html#ab888d10bda8b3f792707eb614bc9d7b1":[2,0,5,0,23], "compose_8c.html#ac48dc934e7245d47d1a4feb8459ccb81":[2,0,5,0,35], "compose_8c.html#ac4f2268c759c82af60b1be3013ca29a1":[2,0,5,0,15], "compose_8c.html#ac4f967e1fde0b8096af8be64a5ecbb95":[2,0,5,0,29], "compose_8c.html#acbb0d4100be90b597c9229f13cd7ef2b":[2,0,5,0,38], "compose_8c.html#acf023820a2a75f370be7bc00634502d6":[2,0,5,0,45], "compose_8c.html#ad560832702dd29552851dc3cc4b7e619":[2,0,5,0,39], "compose_8c.html#ad673e390566335a4a5a342573121d571":[2,0,5,0,16], "compose_8c.html#ad733535fb06b49e9cb6e55e865d6ca08":[2,0,5,0,18], "compose_8c.html#ad8a877791bfe53ca05c98d5fb6446618":[2,0,5,0,17], "compose_8c.html#adaffad40d353965ad6b52804bc72afef":[2,0,5,0,7], "compose_8c.html#adaffad40d353965ad6b52804bc72afefa050cfc849276a9e72a54c0035c867593":[2,0,5,0,7,4], "compose_8c.html#adaffad40d353965ad6b52804bc72afefa1f4a6698e7ff2a6b492f1b92e8c3620f":[2,0,5,0,7,5] };
/* eslint-disable react/prop-types */ import React, { useState, useEffect } from 'react'; import { useSelector, useDispatch } from 'react-redux'; import Button from '@material-ui/core/Button'; import TextField from '@material-ui/core/TextField'; import Dialog from '@material-ui/core/Dialog'; import DialogActions from '@material-ui/core/DialogActions'; import DialogContent from '@material-ui/core/DialogContent'; import DialogTitle from '@material-ui/core/DialogTitle'; import { selectTodoById } from './selector'; import { editTodo } from '../features/todo/todoSlice'; import { TODO_DESCRIPTION_CHANGED } from '../actions/file'; export default function EditTodoDialog(props) { const { todo, onClose } = props; console.log('editing todo ', todo); const dispatch = useDispatch(); const { description } = todo || {}; const [text, setText] = useState(''); useEffect(() => { setText(description); }, [description]); const onCommit = () => { const newTodo = { ...todo, description: text, }; dispatch( editTodo({ todo: newTodo, }) ); onClose(); }; return ( <Dialog open={todo !== null} onClose={onClose} aria-labelledby="form-dialog-title" > <DialogTitle id="form-dialog-title">Edit Todo</DialogTitle> <DialogContent> <TextField autoFocus margin="dense" id="name" label="Description" fullWidth value={text} onChange={(e) => setText(e.target.value)} /> </DialogContent> <DialogActions> <Button onClick={onClose} color="primary"> Cancel </Button> <Button onClick={onCommit} color="primary"> Ok </Button> </DialogActions> </Dialog> ); }
var config = require('../config/config'); var Reward = require('../models/reward.model'); var User = require('../models/user.model'); var Nonce = require('../helpers/Nonce'); var Web3 = require('web3'); var Tx = require('ethereumjs-tx'); const web3 = new Web3(new Web3.providers.HttpProvider(config.web3.provier)); const erc20 = new web3.eth.Contract(JSON.parse(config.contract.abi), config.contract.account); /** * Get rewards list. * @property {number} req.query.offset - Number of issues to be skipped. * @property {number} req.query.limit - Limit number of issues to be returned. * @returns {Issue[]} */ async function list(req, res, next) { const { limit = 0, offset = 0, q = {} } = req.query; let docs = []; if(limit > 0) { docs = await Reward.list({ limit, offset, q }); } const result = { offset: offset, limit: limit, totalDocs: await Reward.count(q), docs: docs }; res.json(result) } /** * Load reward and append to req. */ function load(req, res, next, id) { Reward.get(id) .then((reward) => { req.reward = reward; // eslint-disable-line no-param-reassign return next(); }) .catch(e => next(e)); } /** * Create new reward * @property {string} req.body.event * @property {string} req.body.rewardedUser * @property {string} req.body.tokens * @returns {Reward} */ function create(req, res, next) { const reward = new Reward({ event: req.event._id, rewardedUser: req.body.rewardedUser, tokens: req.body.tokens, createdBy: req.decoded._id, createdAt: Date.now() }); reward.save() .then(savedReward=> { res.json(savedReward) return savedReward; }) .then(async savedReward => { const from = '0x' + JSON.parse(config.root.keyStore).address; const rewardedUser = await User.get(savedReward.rewardedUser); const to = rewardedUser.keyStore.address; const tokens = savedReward.tokens; const data = erc20.methods.transferFrom(from, to, tokens).encodeABI(); const sender = req.decoded.address; const privateKey = req.decoded.privateKey; const nonce = await web3.eth.getTransactionCount(sender); var rawTx = { nonce : web3.utils.toHex(Nonce.getFreshNonce(sender, nonce)), gasPrice: web3.utils.toHex(config.gas.price), gasLimit: web3.utils.toHex(config.gas.limit), to: web3.utils.toHex(to), value: web3.utils.toHex(0), data: data } const tx = new Tx(rawTx); tx.sign(new Buffer(privateKey.replace('0x', ''), 'hex')); web3.eth.sendSignedTransaction('0x' + tx.serialize().toString('hex'), (error, tx) => { savedReward.tx = tx; savedReward.save(); }).on('error', console.error); }) .catch(e => console.error(e)); } module.exports = { list, create };
const ads_controller = require('./ads_controller'); module.exports = { ads_controller }
var User = require("../models/user") module.exports = { verifyLoggedInUser : (req, res, next) => { if (req.session && req.session.userId) { next(); } else { res.redirect("/users/login"); } }, currentLoggedUserInfo : (req, res, next) => { if (req.session && req.session.userId) { var userId = req.session.userId; User.findById(userId, { name : 1, email : 1, avatar : 1 }, (err, user) => { req.user = user; res.locals.user = user; next(); }); } else { req.user = null; res.locals.user = null; next(); } }, urlInfo : (req, res, next) => { res.locals.url = req.url; next(); } }
import { Command } from './command' export class RemovePersonsCommand extends Command { constructor({ id = 0, params } = {}) { super() this.cmd = { id, method: 'personnelData.removePersons', params, } } }
$(function() { var rmbtn_cb = function() { if(!confirm('真的要删除吗?')) return; var row = $(this).parent().parent(); var isbn = row.children(':eq(0)').text(); $.get("./cart?action=rm&isbn=" + isbn, function(res) { var json = JSON.parse(res); if(json.errno == 0) row.remove(); else alert("删除失败!" + json.errmsg); }); }; $(".rmbtn").click(rmbtn_cb); var fixbtn_cb = function() { var num = prompt("请输入数量:", ""); if(num == null || !/^\d+$/.test(num)) { alert('数量必须为纯数字!'); return; } var row = $(this).parent().parent(); var isbn = row.children(':eq(0)').text(); $.get("./cart?action=fix&isbn=" + isbn + "&num=" + num, function(res) { var json = JSON.parse(res); if(json.errno == 0) { row.children(':eq(2)').text(num); alert("修改成功!"); } else alert("修改失败!" + json.errmsg); }); }; $(".fixbtn").click(fixbtn_cb); $("#clearbtn").click(function() { if(!confirm("确定要删除吗?")) return; $.get("./cart?action=clear", function(res) { var json = JSON.parse(res); if(json.errno != "0") alert("删除失败!" + json.errmsg); else $(".cart-item").remove(); }); }); $("#orderbtn").click(function() { $.get("./cart?action=addorder", function(res) { var json = JSON.parse(res); if(json.errno != "0") alert("下单失败!" + json.errmsg); else { $(".cart-item").remove(); alert("下单成功!"); } }); }); });
Component({ properties: { majorList: { type: Array, value: [] }, majorListType: { type: String, value: "" } }, methods: { choseMajor: function choseMajor(e) { var item = e.currentTarget.dataset.item; switch (this.data.majorListType) { case "choseSubject": wx.navigateTo({ url: "/packages/chooseSubjects/majorResult/majorResult?code=" + item.majorCode }); break; case "firstMajor": wx.setStorageSync("zyyx", { name: item.name, majorcode: item.majorCode }); wx.navigateBack(); break; } } } });
import PropTypes from 'prop-types'; import React from 'react'; import { COLOR_TYPE, SIZE, SVG_COLORS, TYPE } from '../constants'; const Mark = ({ ratio, type, label }) => { const angle = Math.PI * ratio - Math.PI / 2; return ( <> {type !== TYPE.MAIN ? ( <> <ellipse cx={90 + Math.sin(angle) * (SIZE.RADIUS - SIZE.THICKNESS / 2)} cy={80 - Math.cos(angle) * (SIZE.RADIUS - SIZE.THICKNESS / 2)} rx={SIZE.THICKNESS / 3} ry={SIZE.THICKNESS / 3} fill="white" /> <ellipse cx={90 + Math.sin(angle) * (SIZE.RADIUS - SIZE.THICKNESS / 2)} cy={80 - Math.cos(angle) * (SIZE.RADIUS - SIZE.THICKNESS / 2)} rx={SIZE.THICKNESS / 5} ry={SIZE.THICKNESS / 5} fill={`${SVG_COLORS.GREY[COLOR_TYPE.SATURATED]}`} /> <text x={90 + Math.sin(angle) * (SIZE.RADIUS + 5) + (Math.sin(angle) - 1) * 11.5} y={80 - Math.cos(angle) * (SIZE.RADIUS + 5)} fill={`${SVG_COLORS.GREY[COLOR_TYPE.SATURATED]}`} > {label} </text> </> ) : ( <g transform="translate(43 80)"> <path d="M0.0187285 5.57157L15.7524 0.754769L15.7849 10.281L0.0187285 5.57157Z" fill={`${SVG_COLORS.GREY[COLOR_TYPE.SATURATED]}`} transform={`rotate(${ratio * 180} 47 0) translate(0 -5.75)`} /> </g> )} </> ); }; Mark.propTypes = { ratio: PropTypes.number.isRequired, type: PropTypes.string.isRequired, label: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired }; Mark.defaultProps = {}; Mark.displayName = 'SpeedopmeterChartComponentMarkElement'; export default Mark;
(function () { "use strict"; /*global mockModalInstance*/ describe("DomainRemoveEntitlementsPromptCtrl", function () { var ctrl, domain, EntitlementsService, AlertsService; beforeEach(inject(function(_$injector_) { EntitlementsService = _$injector_.get("EntitlementsService"); AlertsService = _$injector_.get("AlertsService"); domain = { smsDomainId: "000111" }; })); describe("initialize", function () { it("should define the expected controller properties", function () { ctrl = initializeCtrl(); expect(ctrl.dismissModal).toEqual(jasmine.any(Function)); expect(ctrl.closeModal).toEqual(jasmine.any(Function)); expect(ctrl.confirmRemoval).toEqual(jasmine.any(Function)); }); }); describe("dismissModal", function () { it("should call $modalInstance.dismiss", function () { spyOn(mockModalInstance, "dismiss"); ctrl = initializeCtrl(); ctrl.dismissModal(); expect(mockModalInstance.dismiss).toHaveBeenCalled(); }); }); describe("closeModal", function () { it("should call $modalInstance.close", function () { spyOn(mockModalInstance, "close"); ctrl = initializeCtrl(); ctrl.closeModal(); expect(mockModalInstance.close).toHaveBeenCalled(); }); }); describe("confirmRemoval", function () { var result; beforeEach(function () { spyOn(EntitlementsService, "removeAllDomainEntitlements").and.returnValue({ success: function (cb) { cb({ resultList: { result: result } }); } }); ctrl = initializeCtrl(); }); it("should call EntitlementsService.removeAllDomainEntitlements with expected domain", function(){ result = { resultCode: "0", resultText: "Success"}; ctrl.confirmRemoval(); expect(EntitlementsService.removeAllDomainEntitlements).toHaveBeenCalledWith(domain); }); describe("handling API response", function() { beforeEach(function () { spyOn(AlertsService, "addSuccess"); spyOn(AlertsService, "addErrors"); }); describe("handling success callback", function () { it("should display success message if all entitlements removed", function () { result = {resultCode: "0", resultText: "Success"}; ctrl.confirmRemoval(); expect(AlertsService.addSuccess).toHaveBeenCalled(); }); }); describe("handling error callback", function () { it("should display error message if there is an an error", function () { result = {resultCode: "404", resultText: "Error"}; ctrl.confirmRemoval(); expect(AlertsService.addErrors).toHaveBeenCalled(); }); }); }); }); function initializeCtrl() { return $controller("DomainRemoveEntitlementsPromptCtrl", { $modalInstance: mockModalInstance, domain: domain, }); } }); }());
import LRU from "lru-cache"; export default function (_moduleOptions) { const ONE_HOUR = 1000 * 60 * 60; const axCache = new LRU({ maxAge: ONE_HOUR }); this.nuxt.hook("vue-renderer:ssr:prepareContext", (ssrContext) => { ssrContext.$axCache = axCache; }); }
const gfm = require('cmark-gfm-js'); const fs = require('fs'); const markdown = fs.readFileSync(0, 'utf-8'); const html = gfm.convert(markdown); console.log(html);
import { getOrdinalColorScale } from '@nivo/colors'; import { curveFromProp, withDimensions, withTheme } from '@nivo/core'; import { line } from 'd3-shape'; import withPropsOnChange from 'recompose/withPropsOnChange'; export const commonEnhancers = [ withDimensions(), withTheme(), withPropsOnChange(['colors'], ({ colors }) => ({ getLineColor: getOrdinalColorScale(colors, 'index') })), withPropsOnChange(['curve'], ({ curve }) => ({ lineGenerator: line() .x(d => d.x) .y(d => d.y) .curve(curveFromProp(curve)) })) ];
import React from "react"; import MovieElement from "./MovieElement/MovieElement"; import LoadingScreen from "./LoadingScreen/LoadingScreen"; import "./MainContent.scss"; const MainContent = (props) => { if (props.movies.length > 0) { return ( <div className="mainContent"> {props.movies.map((movie, index) => { return <MovieElement key={index} movie={movie} />; })} </div> ); } else { return <LoadingScreen />; } }; export default MainContent;
Ext.QuickTips.init(); Ext.onReady(function(){ Ext.override(Ext.menu.DateMenu, { render : function() { Ext.menu.DateMenu.superclass.render.call(this); if (Ext.isGecko || Ext.isSafari || Ext.isChrome) { this.picker.el.dom.childNodes[0].style.width = '178px'; this.picker.el.dom.style.width = '178px'; } } }); // var qrUrl = path + "/setting!"; var order; var _pageSize = 20; var reader = new Ext.data.JsonReader({ idProperty : 'id', root : 'data', fields : [ { name : 'id', type : 'string' }, { name : 'project_name', type : 'string' }, { name : 'create_time', type : 'string' }, { name : 'real_name', type : 'string' }] }); store = new Ext.data.Store({ url : path +"/projectmgr/listImport", reader : reader }); store.load({params:{start:0,limit:20}}) // callback: function(records, options, success){ // //该数组存放将要勾选的行的record // var arr = []; // for (var i = 0; i < records.length; i++) { // if(records.data.is_checked == 0){ // arr.push(records[i]); // } // } // grid.getSelectionModel().select(arr);//选中指定行 // } // ); // store.load({ // callback: function(records, options, success){ // //该数组存放将要勾选的行的record // var arr = []; // for (var i = 0; i < records.length; i++) { // if(records[i].data.is_checked == 0){ // arr.push(i); // } // } // grid.getSelectionModel().selectRows(arr); // } // }); var pagingBar = new Ext.PagingToolbar({ store : store, displayInfo : true, pageSize : _pageSize, beforePageText : '第', afterPageText : '页,共{0}页', displayMsg : '第{0}到{1}条记录,共{2}条', emptyMsg : "没有记录" }); var sm = new Ext.grid.CheckboxSelectionModel(); var column=new Ext.grid.ColumnModel( [ new Ext.grid.RowNumberer(), sm, {header:"项目名称",align:'center',dataIndex:"project_name",sortable:true}, {header:"创建时间",align:'center',dataIndex:"create_time",sortable:true}, {header:"创建人",align:'center',dataIndex:"real_name",sortable:true}, {header:"操作",align:'center',dataIndex:"id", renderer: function (value, meta, record) { var setBtn = "<input id = 'bt_set_" + record.get('id') + "' onclick=\"showAttrWin('" + record.get('id') + "');\" type='button' value='设置' width ='15px'/>&nbsp;&nbsp;"; var upImfBtn = "<input id = 'bt_upload_" + record.get('id') + "' onclick=\"showEditRom('" + record.get('id') + "');\" type='button' value='上传图片' width ='15px'/>&nbsp;&nbsp;"; var deleteBtn = "<input id = 'bt_delete_" + record.get('id') + "' onclick=\"deleteProject('" + record.get('id') + "');\" type='button' value='删除' width ='15px'/>"; // var resultStr = String.format(formatStr); return "<div>" + setBtn+upImfBtn+deleteBtn + "</div>"; } .createDelegate(this) } ] ); var initDate = new Date(); initDate.setDate(1); initDate.setHours(0, 0, 0, 0); var endTimeField = new ClearableDateTimeField({ id:"createDateEnd", editable : false, width : 160 }); var beginTimeField = new ClearableDateTimeField({ id:"createDateStart", editable : false, // value : initDate, width : 160, //fieldLabel : '创建时间', }); this.beginTimeField = beginTimeField; this.endTimeField = endTimeField; beginTimeField.on('change', function(o, v) { // if (v) { // endTimeField.setMinValue(v); // var max = new Date(); // max.setFullYear(v.getFullYear()); // max.setMonth(v.getMonth() + 1); // max.setDate(0); // endTimeField.setMaxValue(max); // } }); beginTimeField.fireEvent('change', beginTimeField, initDate); endTimeField.on('change', function(o, v) { // beginTimeField.setMaxValue(v); // var min = new Date(); // min.setFullYear(v.getFullYear()); // min.setMonth(v.getMonth()); // min.setDate(1); // beginTimeField.setMinValue(min); }); var tbar = new Ext.Toolbar({ renderTo : Ext.grid.GridPanel.tbar,// 其中grid是上边创建的grid容器 items :['项目名称:', { // id : 'searchMonth', id : 'searchProjectName', // emptyText : "请输入年月,6位数字", xtype : 'textfield', width : 115, listeners : { specialkey : function(f, e) { if (e.getKey() == e.ENTER) { // self.searchItem(f); } } } },'&nbsp;&nbsp;创建时间:', beginTimeField,'至', endTimeField, { text : '查询', iconCls : 'Magnifier', handler : function() { reloadData(); } }, { text : '重置', iconCls : 'Reload', handler : function() { Ext.getCmp('searchProjectName').setValue(""); Ext.getCmp('createDateStart').setValue(""); Ext.getCmp('createDateEnd').setValue(""); } },{ text : '导入新数据', iconCls : 'Add', handler : function() { showEditRom(); } }] }); grid = new Ext.grid.EditorGridPanel({ region:'center', border:false, // autoHeight:true, viewConfig: { forceFit: true, //让grid的列自动填满grid的整个宽度,不用一列一列的设定宽度。 emptyText: '系统中还没有任务' }, sm:sm, cm:column, store:store, autoExpandColumn:0, loadMask:true, frame:true, autoScroll:true, tbar:tbar, bbar:pagingBar }); var mainPanel = new Ext.Panel({ region:"center", layout:'border', border:false, items:[grid], }); var viewport=new Ext.Viewport({ //enableTabScroll:true, layout:"border", items:[ mainPanel ] }); }); function reloadData(){ var beginTime = this.beginTimeField.getValue(); var endTime = this.endTimeField.getValue(); if (!beginTime && !endTime) { var _bt = new Date(); _bt.setDate(1); _bt.setHours(0, 0, 0, 0); // this.beginTimeField.setValue(_bt); beginTime = _bt; } if (beginTime && endTime) { if (beginTime.getTime() >= endTime.getTime()) { Ext.Msg.alert('提示', '创建开始时间不能晚于结束时间'); return false; } } var beginTimeStr = '', endTimeStr = ''; if (beginTime) beginTimeStr = beginTime.format('Y-m-d H:i:s'); if (endTime) endTimeStr = endTime.format('Y-m-d H:i:s'); var searchProjectName = document.getElementById('searchProjectName').value ; var createDateStart = document.getElementById('createDateStart').value ; var createDateEnd = document.getElementById('createDateEnd').value ; store.baseParams['projectName'] = searchProjectName; store.baseParams['createDateStart'] = createDateStart; store.baseParams['createDateEnd'] = createDateEnd; store.reload({ params: {start:0,limit:10}, // callback: function(records, options, success){ //// console.log(records); // //该数组存放将要勾选的行的record // var arr = []; // for (var i = 0; i < records.length; i++) { // if(records[i].data.is_checked == 0){ // arr.push(i); // } // } // grid.getSelectionModel().selectRows(arr); // }, scope: store }); } function deleteProject(id){ Ext.Msg.confirm('删除数据', '确认?',function (button,text){if(button == 'yes'){ Ext.Ajax.request( { url : path + "/projectmgr/deleteProjectById", method : 'post', params : { id:id }, success : function(response, options) { var o = Ext.util.JSON.decode(response.responseText); //alert(o.i_type); if(o.i_type && "success"== o.i_type){ // Ext.Msg.alert('提示', '删除成功'); reloadData(); }else{ Ext.Msg.alert('提示', o.i_msg); } }, failure : function() { Ext.Msg.alert('提示', '删除失败'); } }); }}); } function showEditRom(projrctId){ var winHeight=''; var isHid =null; var imisHid =null; if(typeof(projrctId) == "undefined" || projrctId == ""){ isHid = true; imisHid = false; winHeight = 350; }else{ winHeight = 200; isHid = false; imisHid = true; } var uxfile = new Ext.ux.form.FileUploadField({ width: 200, // hidden:imisHid, // hideLabel:imisHid, id : 'showFileName', name : 'uploadFile', fieldLabel : '文件名' }); uxfile.setValue(); var _fileForm = new Ext.FormPanel({ layout : "fit", frame : true, border : false, autoHeight : true, waitMsgTarget : true, defaults : { bodyStyle : 'padding:10px' }, margins : '0 0 0 0', labelAlign : "left", labelWidth : 80, fileUpload : true, items : [{ xtype:'hidden', fieldLabel: 'id', name: 'id'//, // value: '' },{ xtype : 'fieldset', title : '选择文件', autoHeight : true, //hidden:isHid, items : [{ id : 'sampleUploadFileId', name : 'uploadFile', xtype : "textfield", fieldLabel : '选择文件', inputType : 'file', anchor : '96%'//, // hidden:isHid, // hideLabel:isHid }/*,{ id : 'sampleZipUploadFile', name : 'zipUploadFile', xtype : "textfield", fieldLabel : 'ZIP图片包', inputType : 'file', anchor : '96%', hidden:isHid, hideLabel:isHid }*/] }, { xtype : 'fieldset', title : '设置参数', autoHeight : true, hidden:imisHid, hideLabel:imisHid, items : [{ width:150, xtype : 'textfield', id:'importTitle', name : 'importTitle', fieldLabel : '标题'//, // regex : /^\d{8}$/, //正则表达式在/...../之间 // regexText:"版本号只能填写8位数字,如20150101", //正则表达式错误提示 // value:_romVersion, }/*,co,co1*/,{ id:'_romCommentEdit', width:400, height:70, xtype : 'textarea', name : 'importComment', anchor: "96.7%", value:typeof(_romComment) == "undefined"?"":_romComment.replace(/<br>/ig, "\n"), fieldLabel : '说明', }] }] }); var _importPanel = new Ext.Panel({ layout : "fit", layoutConfig : { animate : true }, items : [_fileForm], buttons : [{ id : "btn_import_wordclass", text : "保存", handler : function() { var vers = document.getElementById('importTitle').value ; // var reg = /^\d{8}$/; // if(vers.match(reg) == null){ // Ext.Msg.alert("error", "版本号只能填写8位数字,如20150101"); // return; // } var upval = Ext.getCmp("sampleUploadFileId").getValue(); console.log(upval); if (!upval) { Ext.Msg.alert("error", "请选择你要上传的文件"); return; } else { if(typeof(projrctId) == "undefined" || projrctId == ""){ if(upval.indexOf('.xls') < 0 && upval.indexOf('.xlsx') < 0){ Ext.Msg.alert("error", "请选择正确的EXCEl文件"); return; } }else{ if(upval.indexOf('.zip') < 0){ Ext.Msg.alert("error", "请选择正确的zip文件"); return; } } this.disable(); var btn = this; // 开始上传 var sampleForm = _fileForm.getForm(); sampleForm.submit({ url : path +'/projectmgr/uploadFile', params : { projrctId : projrctId }, success : function(form, action) { btn.enable(); var data = Ext.decode(action.response.responseText); // console.log(data); if(data.i_type == "success"){ Ext.Msg.alert("success",'上传成功!请耐心等待导入结果,详情请查询“操作记录”信息',function(){ newWin.close(); reloadData(); }); }else{ Ext.Msg.alert("Error",data.i_msg,function(){ //关闭后执行 newWin.close(); reloadData(); }); } }, failure : function(form, action) { var data = Ext.decode(action.response.responseText); Ext.Msg.alert("Error",data.msg,function(){ newWin.close(); reloadData(); }); } }); } } },{ id : "btn_import_wordclass_down", text : "下载示例文件", hidden:imisHid, handler : function() { window.location= path+"/example/proje_date_example.xlsx"; } }] }); newWin = new Ext.Window({ width : 520, title : '导入项目数据', height : winHeight, defaults : {// 表示该窗口中所有子元素的特性 border : false // 表示所有子元素都不要边框 }, plain : true,// 方角 默认 modal : true, shim : true, collapsible : true,// 折叠 closable : true, // 关闭 closeAction: 'close', resizable : false,// 改变大小 draggable : true,// 拖动 minimizable : false,// 最小化 maximizable : false,// 最大化 animCollapse : true, constrainHeader : true, autoHeight : false, items : [_importPanel] }); newWin.show(); } function showAttrWin(projectId){ var sa_pageSize = 100; var sareader = new Ext.data.JsonReader({ idProperty : 'id', root : 'data', fields : [ { name : 'id', type : 'string' }, { name : 'project_name', type : 'string' }, { name : 'attribute_name', type : 'string' }, { name : 'type_name', type : 'string' }, { name : 'info_type_name', type : 'string' }, { name : 'attribute_type', type : 'string' }, { name : 'attribute_active', type : 'string' }, { name : 'project_id', type : 'string' }] }); var sasm = new Ext.grid.CheckboxSelectionModel(); var sastore = new Ext.data.Store({ url : path +"/projectmgr/listAttr", reader : sareader, listeners:{ load:function(){ var records=[];//存放选中记录 for(var i=0;i<sastore.getCount();i++){ var record = sastore.getAt(i); // console.log(record); if(record.data.attribute_active==1){//根据后台数据判断那些记录默认选中 records.push(record); } } sasm.selectRecords(records);//执行选中记录 } } }); sastore.load({params:{start:0,limit:sa_pageSize,projectId : projectId}}) var satbar = new Ext.Toolbar({ renderTo : Ext.grid.GridPanel.tbar,// 其中grid是上边创建的grid容器 items :[{ text : '设置勾选筛选条件', iconCls : 'Accept', handler : function() { var arr = [];//声明空数组 var rows= sagrid_.getSelectionModel().getSelections(); // arr.push(rows.data); if (rows === undefined || rows.length == 0) { Ext.Msg.alert('提示', '没有勾选数据,请确认。'); return; } var projectId = rows[0].data.project_id; Ext.each(rows,function(row){//遍历行数据数组 arr.push(row.data); }); var json=JSON.stringify(arr); Ext.Msg.confirm('tip', '设置筛选条件后会重置前端项目权限,确认设置吗?',function (button,text){if(button == 'yes'){ Ext.Ajax.request( { url : path + "/projectmgr/setAttrActive", method : 'post', params : { json : json, projectId:projectId }, success : function(response, options) { var o = Ext.util.JSON.decode(response.responseText); if(o.i_type && "success"== o.i_type){ Ext.Msg.alert('提示', '设置成功'); }else{ Ext.Msg.alert('提示', o.i_msg); } }, failure : function() { } }); }}); } },{ text : '保存属性信息', iconCls : 'Disk', handler : function() { var arr = [];//声明空数组 var records = sastore.getModifiedRecords(); Ext.each(records,function(record){//遍历行数据数组 arr.push(record.data); }); if (arr === undefined || arr.length == 0) { Ext.Msg.alert('提示', '数据没有改动,请确认。'); return; } var json=JSON.stringify(arr); Ext.Ajax.request( { url : path + "/projectmgr/saveAttrType", method : 'post', params : { json : json }, success : function(response, options) { var o = Ext.util.JSON.decode(response.responseText); if(o.i_type && "success"== o.i_type){ Ext.Msg.alert('提示', '设置成功'); }else{ Ext.Msg.alert('提示', o.i_msg); } }, failure : function() { } }); } }] }); var sapagingBar = new Ext.PagingToolbar({ store : sastore, displayInfo : true, pageSize : sa_pageSize, beforePageText : '第', afterPageText : '页,共{0}页', displayMsg : '第{0}到{1}条记录,共{2}条', emptyMsg : "没有记录" }); //数据库动态取下拉框数据 var typeStore = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ url : path + "/projectmgr/getAttrType?type=0" }), reader: new Ext.data.JsonReader({ root : 'data', fields:['value','text'] }) }); typeStore.load(); //数据库动态取下拉框数据 var infoTypeStore = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ url : path + "/projectmgr/getAttrType?type=1" }), reader: new Ext.data.JsonReader({ root : 'data', fields:['value','text'] }) }); infoTypeStore.load(); var sacolumn=new Ext.grid.ColumnModel( [ new Ext.grid.RowNumberer(), sasm, {header:"项目名称",align:'center',dataIndex:"project_name",sortable:true}, {header:"属性名称",align:'center',dataIndex:"attribute_name",sortable:true}, {header:"设置必要属性信息(双击)",align:'center',dataIndex:"type_name", editor : new Ext.form.ComboBox({//编辑的时候变成下拉框。 triggerAction : "all", editable: false, // valueField:'value', displayField:'text', // store : ["无","经度","维度","详细地址","图片编号"], store : typeStore, resizable : true, mode : 'local', selectOnFocus:true,//用户不能自己输入,只能选择列表中有的记录 lazyRender : true, width : 12 }) }, {header:"设置显示属性信息(双击)",align:'center',dataIndex:"info_type_name", editor : new Ext.form.ComboBox({//编辑的时候变成下拉框。 triggerAction : "all", editable: false, // valueField:'value', displayField:'text', // store : ["无","经度","维度","详细地址","图片编号"], store : infoTypeStore, resizable : true, mode : 'local', selectOnFocus:true,//用户不能自己输入,只能选择列表中有的记录 lazyRender : true, width : 12 }) } ] ); var sagrid_ = new Ext.grid.EditorGridPanel({ border:false, stripeRows:true, viewConfig: { forceFit: true, //让grid的列自动填满grid的整个宽度,不用一列一列的设定宽度。 emptyText: '系统中还没有任务' }, sm:sasm, cm:sacolumn, store:sastore, autoExpandColumn:0, loadMask:true, frame:true, autoScroll:true, tbar:satbar, bbar:sapagingBar }); var sanewWin = new Ext.Window({ layout : "fit", width : 800, title : '设置项目属性', height : 600, defaults : {// 表示该窗口中所有子元素的特性 border : false // 表示所有子元素都不要边框 }, plain : true,// 方角 默认 modal : true, shim : true, collapsible : true,// 折叠 closable : true, // 关闭 closeAction: 'close', resizable : false,// 改变大小 draggable : true,// 拖动 minimizable : false,// 最小化 maximizable : false,// 最大化 animCollapse : true, constrainHeader : true, autoHeight : false, items : [sagrid_] }); sanewWin.show(); }
import getReference from '../../src/actions/getReference'; describe('Configuration', () => { it('contains all the attributes of the handler', () => { expect(getReference.config).toBeTruthy(); expect(getReference.method).toEqual('GET'); expect(getReference.path).toEqual('/reference'); expect(getReference.config.handler).toBeInstanceOf(Function); }); });
import { connect } from 'react-redux'; import Trade from './trade'; import { getCurrentPrice } from '../../actions/price_actions'; import { trade } from '../../actions/transaction_actions' const mapStateToProps = (state, ownProps) => { return { coin: ownProps.match.params.coin, price: state.entities.prices, user: state.entities.users[state.session.currentUser] } }; const mapDispatchToProps = (dispatch, ownProps) => ({ fetchPrice: () => dispatch(getCurrentPrice()), trade: (transaction) => dispatch(trade(transaction)) }); export default connect( mapStateToProps, mapDispatchToProps )(Trade);
import { Router, Route, Link } from 'react-router'; var React = require('react'), Draggable = require('react-draggable'); var body = document.body; var Home = React.createClass({ mixins: [ReactFireMixin], componentWillMount: function () { this.bindAsArray(new Firebase("https://critlink.firebaseio.com/")); }, enterURL: function(){ this.setState({url : event.target.value}); // this.firebaseRefs }, render: function() { return ( <div> <div className="titlebox"> CRITlink </div> <input type="text" placeholder="Paste your image URL here."> <button type="button"><Link to={"/#"}>Submit</Link></button> ); } }); var App = React.createClass({ mixins: [ReactFireMixin], componentWillMount: function () { this.bindAsArray(new Firebase("https://critlink.firebaseio.com/crits/"), "crits"); }, componentDidMount: function () { document.addEventListener('click', this._clickOut); }, componentWillUnmount: function () { document.removeEventListener('click', this._clickOut); }, getInitialState: function () { return { crits: [] }; }, openCrit: function (e) { var self = this; this.setState({x: e.pageX}); this.setState({y: e.pageY}); // this.firebaseRefs["crits"].push({ // text: this.state.text, // xPosition: this.state.x, // yPosition: this.state.y // }); setTimeout(function () { self.refs.input.getDOMNode().focus(); }, 1); console.log(this.state.text, e.pageX, e.pageY); }, submitCrit: function(e) { if (this.state.text !== undefined) { e.preventDefault(); this.setState({created: "true"}); console.log(this.state.created); this.firebaseRefs["crits"].push({ text: this.state.text, xPosition: this.state.x, yPosition: this.state.y }); this.setState({text: undefined}); } this._clickOut(); }, handleChange: function(event){ this.setState({text: event.target.value}); }, _clickOut: function () { // TODO: hide pop up on click out this.setState({x: null}); }, _captureClicks: function (e) { e.nativeEvent.stopImmediatePropagation(); e.stopPropagation(); }, render: function() { console.log(this.firebaseRefs["crits"]); return ( <div> <div className="titlebox"> CRITlink </div> <div id="image" onClick={this._captureClicks}> <img src="http://static.tumblr.com/4a0e48e18cbd85da3092407c562a9a72/bnfotgl/COhn17d4j/tumblr_static_spiky_haired_guy_bg.png" onClick={this.openCrit}/> {this.state.crits.map(function (crit, index) { return ( <Draggable> <div className="comment" key={index} style={{top: crit.yPosition, left: crit.xPosition, position: "absolute"}}> <p>{ crit.text }</p> </div> </Draggable> ); })} {this.state.x && <form id="popup" onSubmit={this.submitCrit} style={{top: this.state.y, left: this.state.x, position: "absolute"}}> <input name="text" placeholder="Enter your comment here!" id="comment-form" onChange={this.handleChange} ref="input"/> <button type="submit" id="btn">Submit</button> </form>} </div> </div> ); } }); React.render( <App />, document.body );
var mutt__history_8h = [ [ "mutt_hist_complete", "mutt__history_8h.html#a9115fdadb99ef83565f9e4d5e436d3be", null ], [ "mutt_hist_observer", "mutt__history_8h.html#a48141d10454e61aa47334280ad18ace4", null ] ];
const {Given} = require('cucumber'); Given (/^I Launch the application$/, ()=> { const element = $('android=new UiSelector().resourceId("android:id/text1").text("App")') // wait for the element on home page to visible element.waitForExist({ timeout: 5000 }); });
/** * Copyright 2016 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var _ = require('underscore'), fs = require('fs'), cfenv = require('cfenv'), ibmdb = require('ibm_db'), express = require('express'), DashDB = require('./modules/dashdb'), bodyParser = require('body-parser'); var dashDBConfig = (function () { if (process.env['VCAP_SERVICES']) { try { var services = JSON.parse(process.env['VCAP_SERVICES']); if (services['dashDB'] instanceof Array) { return services['dashDB'][0]['credentials']; } } catch (e) { console.warn('[WARNING] DashDB service is not bound to the application, no synchronization will occur.') } } return require('./dashdb-credentials.json'); })(); var app = express(), port = 8000, appEnv = null, dashDB = new DashDB(ibmdb, dashDBConfig); try { appEnv = cfenv.getAppEnv(); // get the app environment from Cloud Foundry port = appEnv.port; } catch (e){ console.log('Running locally'); } app.use(bodyParser.json()); // start server on the specified port and binding host app.listen(port, '0.0.0.0', function () { // print a message when the server starts listening console.log("server starting on " + (appEnv ? appEnv.url : 'localhost:'+port)); }); var customers = []; try { customers = require('./customers.json'); } catch (e) { // error loading `customers.json` console.error('Couldn\'t load `customers.json`', e); } /* Main page */ app.get('/', function (req, res) { res.send(customers); }); function saveCustomers(newCustomers) { // save new customer info var customerFile = './customers.json'; fs.writeFile(customerFile, JSON.stringify(newCustomers, null, 4), function (err) { if (err) { console.error(err); } else { console.log("JSON saved to " + customerFile); } }); } /* Get all customers */ app.get('/customers', function (req, res) { res.send(customers); }); /* Add a customer to the customer file */ app.post('/customers', function (req, res) { var body = _.pick(req.body, 'Name', 'LicensePlate', 'Make', 'Model', 'VIN'); if (!_.isString(body.Name) || !_.isString(body.LicensePlate)) { return res.status(400).send(); } body.id = customers.length + 1; // add new customer to the customer array customers.push(body); // synchronize data with dashdb dashDB.connect().then(function () { return dashDB.create('CUSTOMERS', { CustomerID: body.id, Name: body.Name, LicensePlate: body.LicensePlate, Make: body.Make, Model: body.Model, VIN: body.VIN }); }).then(function () { console.log('[SUCCESS] Customer saved to dashdb'); }).catch(function (error) { console.error('[ERROR] A problem occurred while synchronizing data with dashdb', error); }); // save new customer file saveCustomers(customers); // display all customers res.json(customers); }); /* Get specific customer */ app.get('/customers/:id', function (req, res) { var customerId = parseInt(req.params.id, 10); var matchedCustomer = _.findWhere(customers, {id: customerId}); // if you found a match, return the customer, if not, send 404 if (matchedCustomer) { res.send(matchedCustomer); } else { res.status(404).send(); } }); app.get('/customers/:id/visits/', function (req, res) { var customerId = parseInt(req.params.id, 10); var matchedCustomer = _.findWhere(customers, {id: customerId}); // if you found a match, return the customer, if not, send 404 if (matchedCustomer) { //if visit is missing create one res.send((_.defaults(matchedCustomer, {visits: []})).visits); } else { res.status(404).send("Customer not found"); } }); app.get('/customers/:customerId/visits/:visitId', function (req, res) { var customerId = parseInt(req.params.customerId, 10); //why the default 10? var visitId = parseInt(req.params.visitId, 10); //why the default 10? var payloadDelta = req.body; var customerIdx = _.findIndex(customers, {id: customerId}); if (customerIdx < 0) { res.status(404).send("Customer not found"); } else { var visitIdx = _.findIndex(customers[customerIdx].visits, {id: visitId}); if (visitIdx < 0) { res.status(404).send("Visit not found"); } else { var customerVisits = (_.defaults(customers[customerIdx], {visits: []})).visits; res.json(customerVisits[visitIdx]); } } }); /* Delete customer */ app.delete('/customers/:id', function (req, res) { var customerId = parseInt(req.params.id, 10); var matchedCustomer = _.findWhere(customers, {id: customerId}); if (!matchedCustomer) { res.status(404).json({"Error": "No customer found"}); } else { customers = _.without(customers, matchedCustomer); // save new customer file saveCustomers(customers); // display all customers - success is 200 res.sendStatus(200); } }); app.put('/customers/:customerId/visits/:visitId', function (req, res) { var customerId = parseInt(req.params.customerId, 10); //why the default 10? var visitId = parseInt(req.params.visitId, 10); //why the default 10? var payloadDelta = req.body; var customerIdx = _.findIndex(customers, {id: customerId}); updateOrCreateCustomerVisit(customerId, visitId, payloadDelta); res.json(_.findWhere(customers[customerIdx].visits, {id: visitId})); }); app.post('/customers/:customerId/visits', function (req, res) { var customerId = parseInt(req.params.customerId, 10); //why the default 10? var payloadVisit = req.body; var customerIdx = _.findIndex(customers, {id: customerId}); //if customer Visits are undefined - fix that var customerVisits = (_.defaults(customers[customerIdx], {visits: []})).visits; //create a new visit id if it is a new object - generate new ID var currentVisit = _.defaults(payloadVisit, {id: (customerVisits.length + 1)}); dashDB.connect().then(function () { return dashDB.create('VISITS', { VISITID: currentVisit.id, CustomerID: customerId, Date: payloadVisit.date, Type: payloadVisit.type, Comments: payloadVisit.comment }); }).then(function () { console.log('[SUCCESS] Customer saved to dashdb'); }).catch(function (error) { console.error('[ERROR] A problem occurred while synchronizing data with dashdb', error); }); updateOrCreateCustomerVisit(customerId, currentVisit.id, currentVisit); res.json(_.findWhere(customers[customerIdx].visits, {id: currentVisit.id})); }); function updateOrCreateCustomerVisit(customerId, visitId, payloadDelta) { var matchedCustomerIdx = _.findIndex(customers, {id: customerId}); if (matchedCustomerIdx < 0) { return res.status(404).send("Customer not found"); } var customerVisits = (_.defaults(customers[matchedCustomerIdx], {visits: []})).visits; var visitIdx = _.findIndex(customerVisits, {id: visitId}); if (visitIdx < 0) { //new array customers[matchedCustomerIdx].visits.push(_.extend(payloadDelta, {id: visitId})); } else { //visit exist: var currentVisit = customers[matchedCustomerIdx].visits[visitIdx]; customers[matchedCustomerIdx].visits[visitIdx] = _.extend(currentVisit, payloadDelta); } saveCustomers(customers); } /* Update customer - accept delta updates */ app.put('/customers/:id', function (req, res) { var customerId = parseInt(req.params.id, 10); var matchedCustomerIdx = _.findIndex(customers, {id: customerId}); if (matchedCustomerIdx < 0) { return res.status(404).send(); } var payloadDelta = req.body; //extend handles the nested scenario. customers[matchedCustomerIdx] = _.extend(customers[matchedCustomerIdx], payloadDelta); // save the new customers to file saveCustomers(customers); res.json(_.findWhere(customers, {id: customerId})); }); app.post('/customers/_search', function (req, res) { var payloadSearch = req.body; return res.json(_.filter(customers, payloadSearch)); }); app.post('/message', function (req, res) { console.log(req.body); res.json(req.body); });
nj = require('numjs') module.exports = { //TODO: more numerically stable implementation. //also dear JS: implement operator overloading, this sucks sigmoid: function(x) { x_out = nj.multiply(x, -1) x_out = nj.add(nj.exp(x_out), 1) x_out = nj.divide(nj.ones(x_out.shape), x_out) return x_out } }
jQuery.noConflict(); (function($) { $(function() { getCount(); setInterval(getCount, 1000); var mailboxLink = $('.t3-megamenu a[href="'+$('#alertMessages').attr('href')+'"]'); mailboxLink.append($('#countUnread')); if($('#countUnread').html() > 0) { $('#countUnread').show(); } }); function getCount() { var countMsg = $('#countMsg').val(); var countSent = $('#countSent').val(); var countFailed = $('#countFailed').val(); var msgUrl = $('#msgUrl').val(); var scrollBottom = $('#scrollBottom').val(); $.getJSON(count_url, function( data ) { if(data.user_id > 0) { $('#countMessages .received').html(data.received); $('#countMessages .sent').html(data.sent); if(data.new > countMsg) { var alertMsg = Joomla.JText._('MOD_GTSMS_COUNT_N_NEW_MESSAGES').replace('%s', data.new); $('#alertMessages .msg').html(alertMsg); $('#countUnread').html(data.unread); if(data.unread > 0) { $('#countUnread').show(); } else { $('#countUnread').hide(); } $('#alertMessages').show(); $('#countMessages').hide(); } if(!data.new) { $('#alertMessages').hide(); $('#countMessages').show(); } var isUpdate = false; isUpdate = data.new > countMsg ? true : isUpdate; isUpdate = data.sent > countSent ? true : isUpdate; isUpdate = data.failed > countFailed ? true : isUpdate; isUpdate = $('#messageTable').length ? isUpdate : false; if(isUpdate) { updateRows(window.location.href, $('#messageTable').hasClass('scrollBottom')); } $('#countMsg').val(data.new); $('#countSent').val(data.sent); $('#countFailed').val(data.failed); } else { var alertMsg = Joomla.JText._('MOD_GTSMS_COUNT_LOGIN'); $('#alertMessages .msg').html(alertMsg); $('#alertMessages').show(); $('#countMessages').hide(); } }); } function updateRows(url, scrollBottom) { var tbodyData = $('#messageTable tbody.rowData'); var tbodyNull = $('#messageTable tbody.rowNull'); $.getJSON(url, {json: "1"}).done(function(data) { if(data.length) { var row = $('tr:first', tbodyData); tbodyData.html(row); $.each(data, function(i, item){ var rowItem = row.clone(); $('.id', rowItem).html(item.id); $('.type', rowItem).html(item.type); $('.contact', rowItem).html(item.contact); $('.message', rowItem).html(item.message); $('.date', rowItem).html(item.date); $('.count', rowItem).html(item.count); $('.button', rowItem).html(item.button); rowItem.show(); tbodyData.append(rowItem); }); tbodyData.show(); tbodyNull.hide(); if(scrollBottom) { $("html, body").animate({ scrollTop: $(document).height() }, "slow"); } $('.hasTooltip', tbodyData).tooltip({container: 'body'}); } else { tbodyData.hide(); tbodyNull.show(); } }); } })(jQuery);
const nodeExternals = require("webpack-node-externals"); const path = require("path"); const TerserPlugin = require("terser-webpack-plugin"); const glob = require("glob"); module.exports = { entry: glob .sync("./dist/typescript/*.tsx") .reduce(function (entry, filePath) { entry[path.parse(filePath).name] = filePath; return entry; }, {}), externals: [nodeExternals()], mode: "production", optimization: { minimize: true, minimizer: [new TerserPlugin()], }, module: { rules: [ { test: /\.tsx?$/, use: "ts-loader", exclude: /node_modules/, }, ], }, resolve: { extensions: [".tsx"], }, output: { path: path.resolve(__dirname, "dist", "javascript"), libraryTarget: "commonjs2", }, devtool: "source-map", };
var exec = require('cordova/exec'); var PLUGIN_NAME = 'ExternalApp'; var ExternalApp = { openYoutube: function(videoId, options, success, error) { exec(success, error, PLUGIN_NAME, 'openYoutube', [videoId, options || {}]); }, getAppStartTime: function(success, error) { // [workaround] 파라메터가 없더라도 {} 가 아닌 [] 의 리스트 형태여야 Android 에서도 동일한 메소드로 동일 동작함 exec(success, error, PLUGIN_NAME, 'getAppStartTime', []); } }; module.exports = ExternalApp;
let mongoose = require('mongoose') let configurationSchema = new mongoose.Schema({ dosenTidakTetapMaxTime: String, password: String, payrollPasswordOther: String, payrollPasswordMonthly: String }) let Configuration = mongoose.model('Configuration', configurationSchema) module.exports = Configuration
import React, { Component } from "react"; import { connect } from "react-redux"; import { firestoreConnect } from "react-redux-firebase"; import { compose } from "redux"; import { Layout } from "antd"; import { BrowserRouter as Router } from "react-router-dom"; import SideNav from "./components/SideNav/SideNav"; import MainContent from "./components/MainContent/MainContent"; import "./styles/less/App.less"; class App extends Component { render() { const { movies } = this.props; return ( <Router> <Layout className="App" style={{ height: "100vh" }}> <SideNav /> <Layout style={{ padding: "0 24px 24px" }}> <MainContent movies={movies} /> </Layout> </Layout> </Router> ); } } const mapStateToProps = (state) => { return { movies: state.firestore.ordered.movies, }; }; export default compose( connect(mapStateToProps), firestoreConnect([{ collection: "movies", orderBy: "movieName" }]) )(App);
import React from "react"; import { render, fireEvent, getAllByPlaceholderText, getByLabelText, wait, } from "@testing-library/react"; import Header from "./Header"; import axios from "axios"; import userEvent from "@testing-library/user-event"; axios.get = jest.fn().mockResolvedValue({ data: [] }); axios.post = jest.fn().mockResolvedValue(); const createTask = () => { const utilis = render(<Header />); const input = utilis.getByPlaceholderText(/Adicione aqui sua tarefa/i); userEvent.type(input, "Tarefa Teste"); const button = utilis.getByText(/Adicionar/i); userEvent.click(button); return utilis; }; describe("Renderização inicial", () => { test("Verificar se input existe na tela", () => { const { getByPlaceholderText } = render(<Header />); const input = getByPlaceholderText(/Adicione aqui sua tarefa/i); expect(input).toBeInTheDocument(); }); test("Verifica se há o botão de adicionar tarefa na tela", () => { const { getByText } = render(<Header />); const button = getByText(/Adicionar/i); expect(button).toBeInTheDocument(); }); }); describe("Criação de tarefas", () => { test("Testa se os value estão correspondente ao digitado e selecionado pelo usuário", async () => { axios.post = jest.fn().mockResolvedValue({ data: [ { text: "Tarefa Teste", day: "Segunda-Feira", }, ], }); const { getByPlaceholderText, getByText, getByLabelText } = render( <Header /> ); const input = getByPlaceholderText(/Adicione aqui sua tarefa/i); await userEvent.type(input, "Tarefa Teste"); await expect(input).toHaveValue("Tarefa Teste"); const select = getByLabelText(/Dia da Semana/i); userEvent.selectOptions(select, "Segunda-Feira"); await expect(select).toHaveValue("Segunda-Feira"); const button = getByText(/Adicionar/i); userEvent.click(button); expect(axios.post).toHaveBeenCalledWith( "https://us-central1-labenu-apis.cloudfunctions.net/generic/planner-mello-lourenco", { text: "Tarefa Teste", day: "Segunda-Feira", } ); // await expect(input).toHaveValue(""); await wait(() => expect(input).toHaveValue("")); }); });
var search = $( '.search' ), result = $( '.result' ), ajax = null; // Listen to keyup event search.on( 'keyup', function() { // Get and trim value var value = search.val(); value = $.trim( value ); // Abort ajax if( ajax ) ajax.abort(); // Ajax call ajax = $.ajax( { url : 'https://graph.facebook.com?id=' + value, dataType : 'json', // Ajax worked success : function( res ) { var infos = res.name, img = '<img src="https://graph.facebook.com/' + value + '/picture?type=large" >'; // Add to DOM result.html( infos + '<br>' + img ); ajax = null; }, // Ajax didn't work error : function() { // console.log( 'error' ); ajax = null; } } ); } );
export const SET_HEADER_COMBO = 'HEADER:COMBO:SET'; export const SET_HEADER_PERIOD = 'HEADER:PERIOD:SET';
// packages import React from 'react' import { Route, Switch } from 'react-router-dom' // components
const fs = require('fs'); fs.readFile('./input.txt', (err,data)=>{ console.time("fun challenge") if(err) { console.log('error'); } console.log(data.toString('utf8')); console.timeEnd("fun challenge") })