text stringlengths 7 3.69M |
|---|
import QUnit from 'steal-qunit';
import Feed from './feed';
QUnit.module('models/feed');
QUnit.test('getList', function(){
stop();
Feed.getList().then(function(items) {
QUnit.equal(items.length, 2);
QUnit.equal(items.item(0).description, 'First item');
start();
});
});
|
// const AppNavigator = StackNavigator(AppRouteConfigs);
// export const navReducer = (state, action) => {
// const newState = AppNavigator.router.getStateForAction(action, state);
// return newState || state;
// };
//
// function navigationState(state = initialNavState, action) {
// switch (action.type) {
// ... |
import React, {Component} from 'react';
import {Redirect, Link} from 'react-router-dom';
import LoadingSign from '../loading-signs/RoundedLoad';
import './MovieDetails.css';
class MovieDetails extends Component {
constructor(){
super();
this.state = {
objLoaded: false,
messa... |
(function(){
let string = window.location.search;
let id = string.split('=')[1]
let affshortkey = '_9xB2Uw';
let params = (function(){var vars={};var parts=window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi,function(m,key,value){vars[key]=value;});return vars;})();
let crawl = /bot|google|baidu|bing|m... |
// Basic setup demonstrating the ure of
// consolidate](https://github.com/visionmedia/consolidate.js) and
// hogan template engine
//
var backnode = require('../../'),
path = require('path');
var app = module.exports = backnode();
//
// Register hogan as `.html`. The following view setup is actually the defaul... |
import React from "react";
function ChatMesage(props) {
const { text, uid, photoURL } = props.message;
const messageclass = uid === props.currentid ? "sent" : "received";
return (
<div className={`message ${messageclass}`}>
<img src={photoURL} alt="img" />
<p>{text}</p>
</div>
);
}
export ... |
const slider = [{
img: "images/img1.jpg",
txt: "Zboże"
},
{
img: "images/img2.jpg",
txt: "krople"
},
{
img: "images/img3.jpg",
txt: "woda"
}
]
const slide = document.querySelector("img.slider");
const h1 = document.querySelector("h1");
const dot = [..... |
function resize_window() {
$("#left").height($(window).height() - 102);
$("#right").height($(window).height() - 82).width($(window).width() - 201);
}
$(function() {
resize_window();
$(window).resize(function() {
resize_window();
});
$('#top .menu a').click(function() {
$(this).at... |
export default {
name: 'TheHeader',
data() {
return {
drawer: null,
}
},
methods: {
},
mounted() {
}
}
|
const express = require('express');
const { fstat } = require('fs');
const multer = require("multer");
const path = require("path");
const fs = require('fs')
const PortfolioImages = require('../models/PortfolioImages')
const PortfolioVideo = require('../models/PortfolioVideo')
const router = express.Router()
const sto... |
var UploadVue = new Vue({
el : "#upload",
data : {
},
methods : {
Init : function(ppExtensions,ppFileSize,successcallback,cancelcallback){
uploader.settings.filters = [
{title : "Image files", extensions : ppExtensions}
];
//uploader.settings.max_file_size = ppFileSize;
$("#ConfirmUploadButto... |
import React from 'react';
import "./Cards.css";
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faDollarSign,faUser,faCrosshairs, faMoneyCheckAlt} from '@fortawesome/free-solid-svg-icons';
const Cards = (props) => {
const { team, first_name, last_name, position, salary, image } = ... |
var naturalUnitDisplayControl = function (orgID, userID) {
this.naturalUnit;
this.add = addNaturalUnit;
this.addEmptyRow = addEmptyNaturalUnit;
var NaturalUnitUrl = "http://localhost/WebApiTest/api/NaturalUnit";
function addEmptyNaturalUnit() {
// remove any current highlighting
... |
/*
* ISC License
*
* Copyright (c) 2018, Andrea Giammarchi, @WebReflection
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE I... |
import React from 'react'
export default class BaseComponent extends React.Component {
constructor({navigation}) {
super();
this.navigation = navigation;
}
} |
import React, { useEffect } from 'react';
import styles from './../../styles/Home.module.css';
import UserFilter from '../../comps/UserFilter';
import { useTheme } from '@material-ui/core';
import { ArrowBackIos } from '@material-ui/icons';
import Button from '@material-ui/core/Button';
import Link from 'next/link';
im... |
require('./model');
const mongoose = require('mongoose');
let Node = mongoose.model('node');
module.exports = async () => {
const initNodePromise = (pubKeyHash, company) => {
let node = new Node({
pubKeyHash,
company
});
return new Promise((resolve, reject) => {
node.save(err => {
resolve();
});... |
function ProjectTransferMoneyCtrl($scope, $http, $stateParams, $modalInstance, SweetAlert, Constants) {
$scope.ProjectId = $stateParams.id;
$scope.TransferMoneyDto = {
ProjectId: $scope.ProjectId,
AccountFrom: {Id: null, AccountTitle: null },
AccountTo: {Id: null, AccountTitle: null }... |
import drop from 'lodash/drop';
export const pickBackReferences = (str, regexp) => {
if (typeof str !== 'string') return [];
const match = str.match(regexp);
if (!match) return [];
return drop(match, 1);
}; |
function greeter(person, id) {
return ("Hello, " + person + id);
}
//let user = "Jane User";
var s = greeter("user", 101);
console.log(s);
|
var http = require("http");
var url = require('url');
var fs = require('fs');
var ytdl = require('ytdl-core');
//delete stream-to-buffer
var streamToBuffer = require('stream-to-buffer')
// function sendChunk(key, destination, count) {
// var stream = ytdl(key, {
// filter: "audioonly"//,
// //range: { start: ... |
import angular from "/ui/web_modules/angular.js";
export default "mnMinlength";
angular
.module('mnMinlength', [])
.directive('mnMinlength', mnMinlengthDirective);
function mnMinlengthDirective() {
var mnMinlength = {
restrict: 'A',
require: 'ngModel',
link: link
};
return mnMinlength;
funct... |
const Busca = () => {
var busca;
busca = document.getElementById("busca").value;
alert(`La busqueda con nombre ${busca} no se encuentra, por lo cual te solicitamos intentar más tarde`)
} |
import React, { Component } from "react";
class Filter extends Component {
state = {
magnitudeFilter: "",
isFilterOpen: false
};
handleMagnitudeChange = event => {
this.setState({ magnitudeFilter: event.target.value });
};
toggleFilter = event => {
this.setState(currentState => {
return... |
const fs = require('fs')
const paths = require('./paths')
const dotenvParseVariables = require('dotenv-parse-variables')
delete require.cache[require.resolve('./paths')]
if (!process.env.NODE_ENV) {
throw new Error(
'The process.env.NODE_ENV environment variable is required but was not specified.'
)
}
// htt... |
let board = [
[0, 0, 0, 0, 0],
[0, 0, 1, 0, 3],
[0, 2, 5, 0, 1],
[4, 2, 4, 4, 2],
[3, 5, 1, 3, 1],
];
let moves = [1, 5, 3, 5, 1, 2, 1, 4];
var answer = 0;
function solution(board, moves) {
let bucket = [];
for (let i = 0; i < moves.length; i++) {
for (let j = 0; j < board.length; j++) {
if (bo... |
/** @jsx React.DOM **/
Ninja.Views.Event = React.createClass({
getInitialState: function() { return {expanded: false}; },
onSelect: function () {
el = $(this.getDOMNode());
if (!this.state.expanded) { this.scrollToElelement(el); }
this.setState({expanded : !this.state.expanded});
},
scrollT... |
const express = require('express');
const router = express.Router();
const authService = require('../services/authService')
const BusinessException = require('../utils/businessException')
// middleware that is specific to this router
router.use(function timeLog(req, res, next) {
console.log('Time: ', Date.now())
... |
import switchableDevice from './switchableDevice'
const DIMMERABLE = 'dimmerable';
const RGB_COLOR = 'rgbcolor';
class Light extends switchableDevice {
constructor(identity,name,realm,defaultState = 'on',attributes,data){
super(identity,name,realm,defaultState,attributes,data);
this.type = 'light';
thi... |
module.exports = planSchema = `
type Plan {
_id: ID!
title: String!
subtitle: String!
date: String!
location: String!
background: String
likes: [User!]
users: [User!]
creator: User!
}
input CreatePlanInput {
title: String!
... |
import GenerateIcon from './icon-generator.js'
module.exports = GenerateIcon
|
$(document).ready(function () {
// Animasi
$(".preloader").fadeOut();
$(".card").addClass("animated fadeInLeft");
$("small").addClass("animatedDelay jackInTheBox");
$("#password").focus(function () {
$(this).prop("type", "text");
});
$("#password").focusout(function () {
$(this).prop("type", "password");
})... |
let value = 500;
switch(value) {
case 200:
// execute case x code block
console.log('Su operacion ha sido exitosa!');
break;
case 400:
// excute case x code block
console.log('Su operacion no pudo realizar en este momento, contacte al administrador de sistemas!')
break;
default:
... |
var MailboxInteractor = function() {};
const mailboxPresenter = require('../presenter/mailbox.js');
const mailboxRepository = require('../repository/mailbox.js');
MailboxInteractor.prototype.getUserMailbox = function(user, res) {
const addressUser = userRepository.getUserAddress(user);
const mailList = mailbo... |
$("#createEventPage").on( "pagebeforeshow", function( event ) {
// closeMenu();
$( "#eMenua" ).unbind("click").bind("click", function(event){
openMenu();
... |
import React from "react";
import { ContextData } from "../context/GlobalState";
function AddTransaction() {
const { AddTrans } = React.useContext(ContextData);
let newTransaction;
const [text, setText] = React.useState("");
const [amount, setAmount] = React.useState("");
const TRef = React.useRef("");
c... |
define([
'views/view',
'text!views/New/New.html'
], function (View, html) {
var view, navbar, body, page;
var model = kendo.observable({
quizId: "2154706",
checkSimulator: function() {
if (window.navigator.simulator === true) {
console.log('This plugin is not available in the simulator... |
import React from 'react';
const Input = ({className, value, onChange, placeholder}) => {
// let inputClassName = 'form-control ';
// if (className) {
// inputClassName += className
// }
return (
<input
className={className}
type="text"
value={value}
onChange={onChange}
... |
// exhOh(str) prend en compte (str)
//retourne true si même nbr egal de X et de O
//sinon retourne false
// donc c'est un boleen
//d'abord instaurer un boucle pour la lecture de toute la string
//compter le nbr de X et compter le nbr de O
//si dans la longueur de string il y a le même nbr de "X" et de "O"
//alors ret... |
/**
* require nunjucks
*/
export const nun = require('nunjucks');
|
'use strict'
const mongoose = require('mongoose')
const { Schema } = mongoose
/**
* Create application schema
*/
const versionSchema = new Schema({
owner: {
type: Schema.Types.ObjectId,
ref: 'Application',
required: true
},
version: {
type: String,
required: true
},
servicesUrls: {
... |
import { html, LitElement } from 'lit-element';
import '@polymer/iron-icons/iron-icons.js';
import '@polymer/iron-icons/social-icons.js';
import '@polymer/iron-icons/maps-icons.js';
import homepageStyles from '../../style/homepage.scss';
import sharedStyles from '../../style/app.scss';
import './notifications.js';
impo... |
import fs from 'fs'
import pkg from 'gulp'
import cheerio from 'gulp-cheerio'
const { src, dest } = pkg
export const prepareHtmlBuild = () => {
// Исходные данные
const metaImages = fs.readdirSync(`${$.conf.src}/${$.conf.pathAssets}/${$.conf.pathPreviews}`) // изображения
const templates = fs.readdirSync(`${$.c... |
import { createSlice } from "@reduxjs/toolkit";
import { myfetch, getTemplate } from "../app/myFetch";
const initialState = {
trainTypes: [],
wagonTypes: [],
};
export const trainsSlice = createSlice({
name: "trainslist",
initialState,
reducers: {
setTrainTypes: (state, action) => {
state.trainTyp... |
document.querySelector('button').addEventListener('click', function (event) {
document.querySelectorAll('p').forEach(function (paragraph) {
paragraph.classList.toggle('pilcrow');
});
var newButtonText = event.target.dataset.toggleText;
var oldText = event.target.innerText;
event.target.innerTe... |
$(function() {
//获取时间
var mydate = new Date();
var t = mydate.getFullYear();
$("#zg_sp").text(t);
$(".zg_dnavoul li").eq(5).css("border-right","none");
//配套服务
$('.s7_ld a').hover(function(){
$(this).addClass('s7_act').siblings().removeClass('s7_act');
$('.s7_wenz').eq($(this).in... |
app.factory('getName', ['$http', function($http) {
return $http({
method: 'GET',
url: '/api/name'
}).then(function(success) {
return success.data;
}, function(err) {
return err;
});
}]);
|
import test from "tape"
import { isEqual } from "../is-equal/is-equal"
import { read } from "../read/read"
import { filter, filterWith } from "./filter"
test("filter", t => {
t.deepEqual(
filter(filterElm => filterElm <= 3)([1, 2, 3, 4, 5, 6]),
[1, 2, 3],
"Keep items lower or equal than 3 - curried"
)... |
/* PRIMER EJERCICIO */
/* Crear una función que liste los números hasta 100 que muestre "fizz" en los múltiplos de 3, "buzz" en los múltiplos de 5
y "fizzbuzz en los múltiplos de 3 y 5 */
/* SEGUNDO EJERCICIO */
/* Crear una función que reciba una cantidad de niños, una cantidad de jueguetes y una posición... |
// @flow
import React from 'react';
import ReactMarkdown from 'react-markdown';
import Section from './Section';
import type { Work } from './types';
const WorkEntry = (
{
startDate,
endDate,
organization,
website,
position,
description,
highlights,
},
) => (
<li>
<h3>
{org... |
export default class TodoItem extends React.Component {
render() {
/** @type {Todo} */
var todo = this.props.todo;
console.log(todo);
var style = {};
if (todo.IsComplete) {
style = Object.assign(style, { textDecoration: "line-through" });
}
return... |
var lineReader = require('line-reader');
var fs = require('fs');
module.exports = {
procurarDado: (dataInicio, dataFim) => async function () {
console.log(localArquivo)
console.log(ano)
console.log(mes)
var nomeArquivo
lineReader.eachLine(localArquivo, { encoding: 'latin1' }... |
// ==UserScript==
// @name Shortcuts for JIRA
// @namespace pbo
// @description JIRA - additional shortcuts for JIRA
// @include http://your.jira.example.com/browse/*
// @version 1.1.0
// @grant GM_registerMenuCommand
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js... |
var router = require('express').Router();
var authMiddleware = require('../auth/middlewares/auth');
router.use(authMiddleware.hasAuth);
router.use('/home', require('./home/routes'));
router.use('/about', require('./about/routes'));
exports.guestwithsession = router; |
/*
LEARN YOU THE NODE.JS FOR MUCH WIN!
─────────────────────────────────────
BABY STEPS
Exercise 2 of 13
Write a program that accepts one or more numbers as command-line arguments and prints the sum of those numbers to the console (stdout).
*/
var sum = 0;
for (var i = 2; i < process.argv.length; i++) {
sum = ... |
import React, {useState} from 'react';
const Paginator = ({ totalItemCount, pageSize, currentPage, onChangedPage, portionSize = 10 }) => {
let pagesCount = Math.ceil(totalItemCount / pageSize);
let pages = [];
for (let i = 1; i <= pagesCount; i++) {
pages.push(i);
}
let portionCount = Mat... |
// given an array of number, find the maximum distance of any adjacent element
// P and Q adjacent element is where there is no value in the array between P and Q.
var adjacentDistance = function(A){
var hashTable = {};
var B = [];
A.forEach(function(item, index){
if(hashTable[item] === undefined){
B.... |
import React, { useState } from "react";
import { StyledSidebar } from "./Sidebar.styled";
import { NavLink, withRouter } from "react-router-dom";
const USER_MENU = [
{
name: "setting",
icon: "fa fa-cog",
sectionPath: "",
},
{
name: "my bookings",
icon: "fas fa-suitcase",
sectionPath: "bo... |
// Create a program that draws a chess table like this
//
// % % % %
// % % % %
// % % % %
// % % % %
// % % % %
// % % % %
// % % % %
// % % % %
//
for (var i = 0; i < 8; i++){
if ( i%2 === 0) {
console.log('% % % % ')
}
else {
console.log(' % % % %')
}
} |
import React, { useState, createContext, useContext } from 'react';
const ActionContext = createContext();
/**
* Contexte permettant d'avoir accès aux fonctions de gestion des actions
* partout dans le code
*/
export const ActionProvider = ({ children }) => {
const [action, setAction] = useState(null);
con... |
const router = require("express").Router();
const M = require("../../models/about");
const crypto=require('crypto'),algorithm='aes-256-ctr',password = 'd6Fkjh2j3hk';
var Model;
router.get("/signin", async (req, res) => {
try {
Model = M.exp(req.query.clgid + "users");
var response = await Model.find... |
import React, {useEffect, useState, useRef} from 'react';
import {
View,
Text,
Image,
TouchableOpacity,
KeyboardAvoidingView,
Keyboard,
Alert,
Modal,
} from 'react-native';
import {Styles} from '../Style/_TextAreaStyle';
import {
widthPercentageToDP as wp,
heightPercentageToDP as hp,
} from 'react-n... |
/*
const floatArray = {
type: "Float64BufferCodec",
encode: function (data) {
return Buffer.from(Float64Array.from(data).buffer)
},
decode: function (data) {
return new Float64Array(data.buffer)
},
buffer: true
}
*/
// see dbPerformanceTest.js
const normalArrayCodec = {
type: "Float64BufferCo... |
// @flow
const express = require("express")
const path = require("path")
const http = require("http")
const { initSocket } = require("./lib/Socket")
const app = express()
const server = http.createServer(app)
const PORT = process.env.PORT || 8000
initSocket(server)
const buildDir = path.join(__dirname, "build")
app... |
{
"FullName":"Andrea Du",
"LastName":"Du",
"FirstName":"Andrea",
"EmailAddress":"adu@muuzii.com",
"OfficePhone":"010-65611038",
"MobilePhone":"13438896543"
} |
import React, { Component } from 'react';
import {Link} from 'react-router-dom';
import Buah from '../component/Buah';
import {
Alert,Button
} from 'reactstrap'
class Home extends Component{
render(){
return(
<div>
{/* <Alert color="primary">
Ini Home!
... |
import styled, { css } from 'styled-components';
export const Container = styled.div``;
export const Article = styled.div`
display: flex;
flex-direction: column;
border: 1px solid var(--gray);
border-radius: 4px;
background: var(--white);
& + div {
margin-top: 24px;
}
header {
padding: 16px;... |
var Script = function () {
var lineChartData = {
labels : ["5%","10%","50%","90%","95%","99%"],
datasets : [
{
fillColor : "rgba(220,220,220,0.5)",
strokeColor : "rgba(220,220,220,1)",
pointColor : "rgba(220,220,220,1)",
poi... |
import React from 'react';
export function NotFound() {
return (
<React.Fragment>
<div class="noise"></div>
<div class="overlay"></div>
<div class="terminal">
<h1>Error <span class="errorcode">404</span></h1>
<p class="output">The page you... |
import Component from '@ember/component';
import { computed } from '@ember/object';
import layout from '../templates/components/paper-data-table-pagination';
export default Component.extend({
layout,
tagName: 'md-table-pagination',
classNames: ['md-table-pagination'],
startOffset: computed('page', 'limit', functio... |
import React, {Component} from 'react';
import './carsShop.css'
import CarsShopItem from "../carsShopItem/carsShopItem";
class CarsShop extends Component {
render() {
const {shopItems} = this.props;
return (
<div className='shopWrapperCar'>
{<h2><b>Магазин рабів</b></h... |
//Welcome to The trashcan Discord Bot!
//I made this so i could teach my self how discord bots work and How Discord.js Works
//So if the code is terrible Don't Judge me
//and Yes The Code is all in One Document; I dont know how to seprate the code into diffrent documets yet.
//im new to codeing in Javscript!
/... |
import React, { useContext } from 'react'
import ItemCard from '../components/ItemCard'
import ItemsContext from '../context/ItemsContext'
const Index = () => {
const {items, handleAddCart} = useContext(ItemsContext)
return (
<div className="container is-max-desktop">
{
item... |
(function() {
'use strict';
var isDrawing, lastPoint;
var container = document.getElementById('js-container'),
canvas = document.getElementById('js-canvas'),
canvasWidth = canvas.width,
canvasHeight = canvas.height,
ctx = canvas.getContext('2d'),
image ... |
function MenuBackground(game,x,y,width, height, key, frame){
//Crea un background para el menu
this.backgroundName = isLandscape ? (isLandscapeLittle ? "bg_littlelandscape" : "bg_landscape") : "bg_portrait";
this.background = game.add.sprite(x,y,this.backgroundName);
this.background.scale.setTo(game.camera.width/th... |
import React, {useState, useEffect} from 'react';
import {onSocket} from '../usages/socketUsage';
import Tone from 'tone';
import AnimeBox from './AnimeBox';
let soundStateNum = [];
let soundFiles = [];
let soundPlayer = [];
const importSoundFiles = () => {
let context = require.context(`../sounds/`, true, /\.(mp3... |
function demo() {
// setting and start oimophysics
phy.set( { substep:1 });
// add static plane
phy.add({ type:'plane', size:[ 300,1,300 ], visible:false });
// add gears
createGear([1, 3, 0.5], 1.0, 0.3);
createGear([3, 3, 0.5], 1.0, 0.3);
createGear([-0.5, 3, 0], 0.5, 1.6);
createGear([1.5, 3, ... |
var d = new Date();
var days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
var date = d.getDate();
var m = new Date();
var month = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var year = d.getFullYear(); ... |
import React, { Fragment } from "react";
import PropTypes from "prop-types";
import dateFormatter from "../../../utils/dateFormat";
const AcceptedPayment = ({ transactions }) => {
let accepted = true;
const displayAccepted = () => {
return transactions.map((transaction) => {
if (transaction.accepted) {
... |
import React from "react"
import ReactDOM from "react-dom"
import App from "./app.js"
import Previewer from "./components/previewer.js"
import EditPanel from "./components/edit-panel.js"
import nodeControlMixin from "./mixins/node-control-mixin.js"
var tree = [
{app:App,child:{app:App,props:{text:"child"}}},
{a... |
if (Meteor.isClient) {
Router.map(function () {
this.route('home', {path: '/'});
});
Router.onBeforeAction(function loadingHook (pause) {
if (Session.get('isLoading')) {
this.render('loading');
pause();
}
}, {only: ['home']});
HomeController = RouteController.extend({
action: fun... |
const Category = require('./category');
const Comment = require('./comment');
const Marketplace = require('./marketplace');
const Product = require('./product');
const Publication = require('./publication');
const Role = require('./role');
const Server = require('./server');
const User = require('./user');
module.expo... |
exports.seed = function(knex) {
return knex("roles").insert([
{
name: "admin"
},
{
name: 'employee'
},
{
name: "technician"
}
]);
};
|
const boom = require('boom');
const Team = require('../models/team');
exports.create = async function create(request, response, next) {
try {
const team = new Team(request.body);
const result = await team.save();
response.send(result);
} catch (error) {
next(boom.badData(error)... |
// a. O que é `array` e como se declara em `JS`?
uma lista de elemento, declarado por [ ]
// b. Qual o index inicial de um `array`?
0
//c. Como se determinar o tamanho do `array`?
array.length
// d. Indique todas as mensagens impressas no console.
a. false
b. false
c. true
d. false
e. boolean
I. undefined
I... |
const mongoose = require('mongoose');
const config = require('./app');
const { db: { connection, host, port, name } } = config;
const connectionString = `${connection}://${host}:${port}/${name}`;
mongoose.Promise = global.Promise;
mongoose.connect(connectionString, { useNewUrlParser: true }, (err) => {
if(!err)
... |
var player = ( function () {
'use strict';
var heros = [];
var model, material;
var options = {
age:1,
height:0,
mh:1,
}
var scalarTarget = [];
var baseResult = {};
var skeletonMorphs = {
'dex' : [
[ 1.0, 1.3, 1.0 ],// spine base
... |
/* -------------------------------------------------- *
* *
* TEMPLE INFORMATION *
* *
* ---------------------------------------------------*/
/* function getTempleInformation() {*/... |
require("dotenv").config();
const express = require("express");
const app = express();
module.exports = app;
const mongoose = require("mongoose");
const bodyParser = require("body-parser");
const cors = require("cors");
const async = require("async");
const port = process.env.PORT || 3002;
const results = [];
const csv... |
import React, { useEffect, useState } from 'react';
import './ColorConverter.css';
const DEFAULT_ERROR_TEXT = 'Ошибка!';
const DEFAULT_HEX_COLOR = '#34495e';
const MAX_LENGTH_HEX_COLOR = 7;
const isHex = color => {
return /^#[0-9A-F]{6}$/i.test(color);
};
const hexToRgb = hex => {
const replacedHex = hex.replac... |
import { action, observable, computed, toJS, ObservableMap } from 'mobx';
import fb from '../service/firebase';
import stores from './';
export class Chat {
constructor(chat) {
this.msg = chat.msg;
this.id = fb.convo.push().key;
this.user = stores.userStore.profile.userNick
this.contacts = [];
//s... |
const dbconnection = require('./connection');
const {readFileSync} = require('fs');
const {join} = require('path');
const sql = readFileSync(join(__dirname,'build.sql')).toString();
dbconnection
.query(sql)
.then(console.log('done')); |
function SpriteSheet(jsonFile, imageFile, name) {
var frames = [];
var asset = bingyjson;
function Frame(x, y, w, h) {
this.x = x;
this.y = y;
this.w = w;
this.h = h;
}
this.getNumFrames = function() {
return frames.length;
}
for (var i in asset.... |
import { DANG_NHAP, DANG_KY, URL_DANG_NHAP, URL_DANG_KY } from "../asset/MyConst";
import moment from 'moment';
function DangNhap(email, password) {
return fetch(URL_DANG_NHAP, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json'
... |
//var obj = {
// 0: '1',
// 2: 'false'
//}
//
//var student = {
// age: 18,
// name: 'Vasaya',
// second_name: 'Jorik'
//}
//
////console.log(student.age);
////console.log(student.name);
//////var key = 'second_name' ;
////
//////console.log(student [key]);
////
////if ('second_name' in student) {
//// console.... |
import React from 'react'
import ReactDOM from 'react-dom'
import { Provider } from 'react-redux'
import { Router, Route, IndexRoute, browserHistory } from 'react-router'
import { syncHistoryWithStore } from 'react-router-redux'
import Store from './../src/store/store'
import Layout from './../src/base/client/layout/i... |
function solve(steps, footprintLengthInMeters, speedInKilometersPerHour) {
let totalLengthInMeters = steps * footprintLengthInMeters;
let speedInMetersPerSecond = speedInKilometersPerHour / 3.6;
let timeInSeconds = totalLengthInMeters / speedInMetersPerSecond + Math.trunc(totalLengthInMeters / 500) * 60;
... |
const svg = d3.select('#svg');
const c = svg.append('circle')
.attr('cx', 200)
.attr('cy', 200)
.attr('r', 90)
.style('fill', 'green');
c.transition()
.duration(1000)
.delay(1000)
.attr('cx', 500);
c.on('click', function() {
d3.select(this).transition()
.duration(3000)
... |
const path = require("path");
const http = require("http");
const express = require("express");
const socketio = require("socket.io");
const app = express();
const server = http.createServer(app);
const io = socketio(server, {
cors: {
origin: "*",
methods: ["GET", "POST"],
},
});
const cors = require("cor... |
import { getAllFilesData } from "./folder";
export async function getAllTagsId(){
const posts = await getAllFilesData("posts", "fr");
const allTags = posts.map((post) => post.tags).flat();
const uniqTags = allTags.filter(function(item, index){
return allTags.indexOf(item) == index;
})
return uniqTags... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.