text stringlengths 7 3.69M |
|---|
// Create express app
var express = require('express');
var app = express();
var cors = require('cors');
var db = require('./database.js');
app.use(cors()); // ?
// Server port
var HTTP_PORT = 8000;
// Start server
app.listen(HTTP_PORT, () => {
console.log('Server running on port %PORT%'.replace('%PORT%', HTTP_POR... |
var { IEnumerable } = require("./IEnumerable");
class IGrouping extends IEnumerable {
constructor(key, source) {
super(function* () {
yield* source;
});
this._key = key;
}
get Key() {
return this._key;
}
}
module.exports = { IGrouping };
|
// Core
import React from 'react';
import { render } from 'react-dom';
// Router
import {Router, Route, browserHistory} from 'react-router';
// Components
import App from './components/App';
import StreamPicker from './components/StreamPicker';
// Routes
var routes = (
<Router history={browserHistory}>
<Route pat... |
var Stream = require('stream').Stream,
util = require('util'),
spawn = require('child_process').spawn;
var GZipStream = function() {
// readable stream
this.readable = true;
// writable stream
this.writable = true;
this._gzipper = spawn('gzip');
// emit data at some point
this._gzipper.stdout.on('da... |
// --------------------------------
// ------- GLOBAL VARIABLES -------
// --------------------------------
// size of square tiles in pixels
const SQUARE_SIZE = 20;
// Informations about the game status
const game = {
status: "playing",
score: 0,
speed: 40
}
// Game boards characteristcs
const width = ... |
const midLogin = (req, res, next) => {
let logged = true;
if(logged) next();
else res.send('No tiene permisos de acceso');
}
module.exports = midLogin; |
const express = require('express')
const bodyParser = require('body-parser');
const cors = require('cors')
const ObjectId = require('mongodb').ObjectId;
const app = express();
app.use(bodyParser.json());
app.use(cors())
require('dotenv').config()
const MongoClient = require('mongodb').MongoClient;
const uri = `mongo... |
'use strict';
var app = angular.module('app', ['ngAnimate', 'ui.grid', 'ui.grid.edit', 'ui.bootstrap', 'angularjs-dropdown-multiselect']);
app.controller('MainCtrl', ['$scope', '$modal', '$http', 'uiGridConstants', function ($scope, $modal, $http, uiGridConstants) {
$scope.gridOptions = {
showFooter: true,
... |
import React, { Component } from 'react';
import { View, Text, StyleSheet, Dimensions, TouchableOpacity, Image } from 'react-native';
const width_R = Math.round(Dimensions.get('window').width/5)
const height_R= Math.round(Dimensions.get('window').height/8.5)
const added = width_R+height_R
const circle = Math.round(add... |
var studentName;
console.log(typeof studentName); // "undefined"
console.log(typeof doesntExist); // "undefined"
console.log(typeof studentName === typeof doesntExist) // true |
import React, { useRef, useEffect } from 'react';
import * as d3 from 'd3';
import classes from './tinyAxis.module.css';
const TinyAxis = ({ dimensions, xScale, yScale }) => {
const xTinyAxisRef = useRef(null);
const yTinyAxisRef = useRef(null);
const xAxis = d3.axisTop();
const yAxis = d3.axisLeft();
useE... |
import React, { Component } from "react";
import RouletteWheel from "assets/roulette-wheel.png";
import RouletteWheelLight from "assets/roulette-wheel-light.png";
import Konva from "konva";
import PropTypes from "prop-types";
import Sound from "react-sound";
import { getAppCustomization } from "../../lib/helpers";
impo... |
// Write your JavaScript code.
$(function () {
$(".heading-compose").click(function () {
$(".side-two").css({
"left": "0"
});
});
$(".newMessage-back").click(function () {
$(".side-two").css({
"left": "-100%"
});
});
})
// Stop carousel
$('.carousel').carousel({
interval: false
}); |
import TaskItem from './TaskItem';
const Todos = ({todos,deletTodoItem,handleIsDone,triggerEditColumn,handleSave}) =>(
<div className="todos">
{todos?.map((item)=>(<TaskItem key={item.id} pk={item.id} deletTodoItem={deletTodoItem} handleSave={handleSave} handleIsDone={handleIsDone} todo={item} triggerEditC... |
const express = require('express');
const routes = express.Router();
routes.get('/',(request, response)=>{
response.send('Welcome to the Home Page');
});
routes.post('/register', async (request, response)=>{
let userObject = request.body;
const userOperations = require('../db/services/useroperations');
... |
import React,{ Component } from 'react';
import { StyleSheet, Text , View } from 'react-native';
const styles = StyleSheet.create({
red: {
color : 'red',
fontWeight: 'bold',
fontSize: 30,
},
blue: {
color : 'blue',
},
});
class Greeting extends Component{
render(){
... |
// helper class to wrap node including its meshInstances
class BakeMeshNode {
constructor(node, meshInstances = null) {
this.node = node;
this.component = node.render || node.model;
meshInstances = meshInstances || this.component.meshInstances;
// original component properties
... |
const buttonUser = $('.press-button');
const result = $('.result');
const buttonAdmin = $('.button_admin');
const adminButton = $('.admin-button');
const adminForm = $('.admin-form');
const buttonRuleCancel = $('.button_rule-cancel');
const converterForm = $('.converter-form');
con... |
db.superheroes.deleteMany({publisher:"George Lucas"})
|
$(document).ready(function () {
insertar();
});
var insertar=function () {
$(document).on('click','#buscar',function () {
var buscar=$('#buscador').val();
console.log(buscar);
$.ajax({
url: 'https://api.giphy.com/v1/gifs/translate?api_key=bb2006d9d3454578be1a99cfad65913d&s='+buscar,
t... |
'use strict';
app.controller('EmployeeController', ['$rootScope','$scope','$state','$timeout','roleBtnService',function($rootScope, $scope, $state, $timeout,roleBtnService) {
var roleBtnUiClass = "app.employee.";//用于后台查找按钮权限
roleBtnService.getRoleBtnService(roleBtnUiClass,$scope);
var url = app.url.e... |
export default {
"resourceType": "Questionnaire",
"id": "f201",
"url": "http://hl7.org/fhir/Questionnaire/f201",
"status": "active",
"subjectType": [
"Patient"
],
"date": "2010",
"item": [
{
"linkId": "1",
"text": "Do you have allergies?",
"type": "boolean"
},
{
"... |
const params = new URLSearchParams(location.search);
if (params.get('error')) {
const errBox = document.getElementById('account-error');
errBox.textContent = params.get('error');
errBox.style.display = 'block';
}
|
import React, { Component } from "react";
import "../../styles/number_input.css";
class NumberInput extends Component {
render() {
return (
<div>
<label className="option-label">{this.props.title}: </label>
<input
type="number"
className="number-input"
path={th... |
function solve(word) {
function isPalindrome(word) {
for(let i = 0; i < word.length; i++){
if(word[i] !== word[word.length -1 - i]){
return false;
}
}
return true;
}
if(isPalindrome(word)){
console.log('true');
} else {
cons... |
const Sequelize = require('sequelize');
const databaseManager = require('../user_modules/database-manager');
const attributeStringMap = require('./maps/attribute-string.map');
const AttributeStringValue = require('./attribute-string-value.model');
module.exports = {};
const AttributeString = databaseManager.context... |
"use strict";
//어..음...이미지 추가 버튼
// function imgInsert() {
// console.log(`text`);
// const browseBtn = document.querySelector('.btn-input-img');
// const realInput = document.getElementById(`file-input-img`);
// browseBtn.addEventListener('click', () => {
// console.log("22323");
// realInput.click()... |
/* eslint-disable prefer-promise-reject-errors,no-console,prefer-promise-reject-errors,prefer-promise-reject-errors,no-warning-comments */
const Base = require('./base');
const {PasswordHash} = require('phpass');
let fields = [
'id',
'user_login as login',
// 'user_pass as pass',
'user_nicename as nicename',
... |
import React, { Component } from 'react';
import { Text, View, ScrollView, TouchableOpacity, Linking, Alert } from 'react-native';
import { Avatar, Rating, Divider } from 'react-native-elements';
import PhoneCall from 'react-native-phone-call';
import { Popup } from 'react-native-map-link';
import colors from '../../co... |
// definisco la variabile che conterrà gli elementi
// creo il ciclo contenente i box numerati
// inserisco le condizioni legate ai multipli
const contenitore = document.querySelector(".row");
for (let i = 1; i <= 100; i++) {
const box = document.createElement("div");
box.className = "box";
box.innerHT... |
$(function() {
$(document).ready(function(){
$('body').on('click', '.show-reply', function(){
var par_id = $(this).attr('id'),
token = $('#token').val(),
cur = $('#cur').val();
$('#' + par_id + '').prop('disabled... |
var socket = io();
socket.on('connect', function () {
console.log('Connected to the server !');
});
socket.on('disconnect', function () {
//console.log('Disconnected from to the server !');
});
socket.on('newMessage', function (Data) {
var formatedTime = moment(Data.createdAt);
var template = $('#me... |
import React from 'react';
import PropTypes from 'prop-types';
//darkMode -> colorMode
const Module = props => (
<div className={`box ${props.colorMode}`}>
<h1 className="title">{props.title}</h1>
<p>{props.content}</p>
<div>
{props.menu.map(i => <a href={i} key={i}>{i}</a>)}
</div... |
import fs from 'fs'
import express from 'express'
import Schema from './data/schema'
import GraphQLHTTP from 'express-graphql'
import { MongoClient } from 'mongodb'
import { graphql } from 'graphql'
import { introspectionQuery } from 'graphql/utilities'
const app = express()
app.use(express.static('public'))
console... |
import React, { Component } from 'react';
import { View, ScrollView, Text, Dimensions } from 'react-native';
import { Card, CardSection, Button } from './common';
import { noteToObjet, gammeToObjet } from './GammesList';
import { renderPositions } from './PositionsList';
import PositionsList from './PositionsList'... |
import api from '../api';
import config from '../config';
// TODO: ChatStore? as a child store to the main one?
export default class ChatClient {
constructor(socket, data) {
this.socket = socket;
this.isConnected = true;
this.rooms = data.rooms; // TODO: move this to store somehow :/ ?
// this.users = [] ?
... |
import style from './style.module.css'
const AboutPage = () => {
return (
<h1> This is About Page </h1>
)
}
export default AboutPage; |
const assert = require('assert');
const sinon = require('sinon');
const { stream } = require('logtify')({});
const serializeError = require('serialize-error');
const Kafka = require('../src/index.js');
const { Message } = stream;
describe('Kafka plugin', () => {
before(() => {
delete process.env.KAFKA_HOST;
... |
import {
FETCHING_PATIENT,
FETCHING_PATIENT_SUCCESS,
FETCHING_PATIENT_FAILURE,
REMOVE_FETCHING_PATIENT,
UPDATE_CONDITION_INPUT,
UPDATE_ASSESSMENT_INPUT,
TOGGLE_BADGE,
FETCHING_ADD_PATIENT_FORM_SUCCESS,
UPDATE_ADD_PATIENT_FORM_VALUE,
} from './types';
import {
fetchPatient, fetchAddPatientForm,
} fr... |
/**
* Created by Niki on 18/9/16.
*/
$(function () {
// $("#outbox").one("click", function () {
var senderJS = $('#user').text();
$.ajax({
url: 'assets/pdos/outgoing.php',
method: 'POST',
dataType: 'json',
data: {senderphp: senderJS},
success: function (response) ... |
import React from 'react'
import {ContextProvider} from "../Global/Context"
import {db} from "../config"
const Comments=(props)=> {
const {loader, user, publishComment} = React.useContext(ContextProvider)
const [state, setState]= React.useState('')
const [comments, setComments]= React.useState([])
const... |
const express = require('express');
const bodyParser = require('body-parser');
const helper = require('../helpers/github.js');
const getRepos = helper.getReposByUsername;
const db = require('../database/index.js');
let app = express();
app.use(express.static(__dirname + '/../client/dist'));
app.use(express.json());
ap... |
import { sortTeams } from "../utils/aux.js";
import { scoreGoals } from "../utils/aux.js";
import { playMatch } from "../utils/aux.js";
export default class Group {
constructor(name, teams = [], config = {}) {
this.name = name;
this.schedule = [];
this.setup(config);
this.setupTeam... |
import React from 'react';
import styled, { css } from 'react-emotion';
import { PlaceIcon } from 'mdi-react';
const MapMarker = ({ name, date }) => {
const Container = styled('div')`
display: flex;
width: ;
flex-direction: column;
align-items: center;
justify-content: ce... |
'use strict';
module.exports = function(Expense) {
Expense.observe('access', async (ctx) => {
console.log('expense access')
})
};
|
function solve(input) {
const materials = {
fragments:0,
motes:0,
shards:0
};
const trashes = {};
let result = '';
const tokens = input.split(' ');
for (let i = 0; i < tokens.length; i+=2) {
const value = +tokens[i];
const material = ... |
var controllers = angular.module('starter.controllers', ['ionic'])
var services = angular.module('starter.services', []) |
import React from "react";
import PropTypes from "prop-types";
import { makeStyles } from "@material-ui/core/styles";
import AppBar from "@material-ui/core/AppBar";
import Tabs from "@material-ui/core/Tabs";
import Tab from "@material-ui/core/Tab";
import Box from "@material-ui/core/Box";
import Container from "@materi... |
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { setAddress } from '../ducks/propertyReducer';
import { Link } from 'react-router-dom';
class Wiz2 extends Component {
constructor() {
super();
this.state = {
street: '',
city: '',
state: '',
zip:... |
import React from 'react'
import '../index.css'
import styled from 'styled-components'
function Header() {
return (
<Nav>
<Logo src="/images/logo.svg"/>
<NavMenu>
<a>
<img src="/images/home-icon.svg"/>
<span>HOME</span>
... |
// EXAMPLE 3. READ AND WRITE FILES ASYNCHRONOUSLY WITH PROMISES
var Promise = require('bluebird');
var fs = Promise.promisifyAll(require('fs'));
var text = 'Hello Faster World with Promises'
// Same as example2 but using promises to avoid callback hell
fs.mkdirAsync('./example3')
.catch(err => console.log('director... |
module.exports = function () {
'use strict';
var qs = require('qs')
, url = require('url');
return function (req) {
return ~req.url.indexOf('?') ?
qs.parse(url.parse(req.url).query) : {};
};
}();
|
/*
* File: app/view/UserOperLog.js
*
* This file was generated by Sencha Architect version 3.2.0.
* http://www.sencha.com/products/architect/
*
* This file requires use of the Ext JS 4.2.x library, under independent license.
* License of Sencha Architect does not include license for Ext JS 4.2.x. For more
* det... |
import React, {Component} from "react";
import "./Testimonial.scss";
class Testimonial extends Component {
render () {
return (
<div class="oneTestimonial">
<img className='testimonialImage' src={require(`${this.props.image}`)} alt={""} />
<h1 className='testimon... |
const requestURL = "https://byui-cit230.github.io/weather/data/towndata.json";
fetch(requestURL)
.then(function (response) {
return response.json();
})
.then(function (jsonObject) {
//console.table(jsonObject); // temporary checking for valid response and data parsing
const towns = jsonObject["towns"... |
require('jquery-validation');
var $form = $('form[name="client"]');
$form.validate({
rules:{
"client[firstName]":{required: true, maxlength: 30},
"client[lastName]":{required: true, maxlength: 30},
"client[company]":{required: true, maxlength: 50},
"client[password]":{required: tru... |
define(function() {
'use strict';
var Student = (function() {
function Student(firstName, lastName, age, mark) {
if (validateData(firstName, "string")) {
this._firstName = firstName;
}
if (validateData(lastName, "string")) {
this._lastName = lastName;
}
if (validateData(age, "number")) {... |
const passport = require('passport')
module.exports = function(){
const _getRedirectUrl = (req) => {
return req.user.role === 'admin' ? '/admin/orders' : '/customer/orders'
}
return{
login(req,res){
res.render('auth/login')
},
postLogin(req, res, next) {
... |
/*
* The MIT License (MIT)
* Copyright (c) 2019. Wise Wild Web
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
... |
/* eslint-disable no-console */
/* eslint-disable camelcase */
/* eslint-disable no-undef */
import chai from 'chai';
import chaiHttp from 'chai-http';
import jwt from 'jsonwebtoken';
import moment from 'moment';
import app from '../src/index';
import { User, Meal } from '../src/models';
const { assert } = chai;
chai... |
let players = [];
function initPlayers() {
let plr1 = {
x: 1,
y: 2,
movement: [38, 39, 40, 37, 32],
colour: "darkblue"
}
let plr2 = {
x: 11,
y: 11,
movement: [87, 68, 83, 65, 13],
colour: color(255, 20, 20)
}
players.push(new Player(plr1.x, plr1.y, plr1.moveme... |
// Title: SPUtilities
// Version: 0.1
// Description: jQuery plugin for SharePoint customization.
// Compatibility: jQuery 1.10.2
// Author: Christopher H. Lincoln
(function($){
////////////////////////////////////////////////////////////////////////////////////////////////////
// SPUtils namespace
$.SPUtils = f... |
/*
* Copyright (C) 2021 Radix IoT LLC. All rights reserved.
*/
import pageTemplate from './adminHomePage.html';
import './adminHomePage.css';
import sqlSvg from './svgs/sql-icon.svg'
import noSqlSvg from './svgs/nosql-icon.svg'
import diskspaceSvg from './svgs/diskspace-icon.svg'
import ramSvg from './svgs/ram-icon... |
//app.js
var tonk0006_giftr = {
loadRequirements: 0,
personName: '',
occasionName: '',
person_name: '',
init: function () {
document.addEventListener('deviceready', this.onDeviceReady);
document.addEventListener('DOMContentLoaded', this.onDomReady);
},
onDeviceReady: functio... |
import React, { useEffect, useState } from "react";
import { Redirect } from "react-router-dom";
import { Normal } from "../Pages/Dashboard/Dashboard";
import getTokenDetails from "../lib/jwt";
/**const PrivateRoute = () => {
const token = localStorage.getItem("UserToken");
const [tokenIsValid, settokenIsValid... |
jQuery(document).ready(function() {
var sortRoute = $("#api-routes").attr("data-sort-route");
//---------------------------------------------
// Menu items
//---------------------------------------------
// Store the collection tag
var collectionSelector = [".menu-items-collection"];
var ... |
import React from 'react';
import ReactHowler from 'react-howler';
import { useSfx } from 'contexts/sfxContext';
import menuMp3 from 'assets/sounds/menu-toggle.mp3';
const MenuSounds = () => {
const { menuSounds } = useSfx();
return (
<>
{menuSounds.map(() => (
<ReactHowler
src={menuM... |
"use strict";
function isVehicleDriver(player) {
if (!player.vehicle || player.seat != -1) {
return false;
}
return true;
}
exports.isVehicleDriver = isVehicleDriver; |
const solve = (data, n) => {
const nums = data.split(",").map(Number);
let last = nums.pop();
const used = new Map(nums.map((x, i) => [x, i]));
for (let i = nums.length + 1; i < n; i++) {
const lastIndex = used.get(last);
used.set(last, i - 1);
last = lastIndex !== undefined ? i - lastIndex - 1 : 0;... |
export default function todos(state = ['How are you?\n'], action) {
switch (action.type) {
case 'ADD_TODO':
return state.concat([action.payload]);
default:
return state;
}
}
|
/*
Write a program that deletes a given element e from the array a.
Input: e = 2, a = [4, 6, 2, 8, 2, 2]
Output array: [4, 6, 8]
*/
var deleteElement = function (a){
var e = 2;
var newArray = [];
for(var i = 0; i < a.length; i++){
if(a[i] !== e){
newArray[newArray.length] = a[i];
... |
import React from 'react';
import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
//importing CSS file
import './QuestionsModal.css';
class QuestionsModal extends React.Component {
constructor(props) {
super(props);
console.log(this.props);
}
render() {
console.log(this.props... |
/**
* Module dependencies.
*/
var mongoose = require('mongoose'),
Match = mongoose.model('Match'),
Bot = mongoose.model('Bot'),
User = mongoose.model('User');
exports.retrieveLatest = function(skip, callback) {
Match.find({}).sort('-completedOn').skip(skip).limit(20).populate('blackBot', 'name').populate('... |
const { importUserClient, mainFeedsCacheClient } = require('./redis');
const { LANGUAGES, TREND_NEWS_CACHE_PREFIX, HOT_NEWS_CACHE_PREFIX } = require('../constants');
/**
* Add user name to namespace of currently importing users
* @param userName {String}
* @returns {Promise<void>}
*/
exports.addImportedUser = asyn... |
const tag = () => import('../pages/tag.vue')
export default [{
path: '/tag/:tag',
component: tag
}, {
path: '/tag/:tag/page/:page',
component: tag
}]
|
import {useRef} from 'react';
import Card from '../ui/Card';
import classes from './NewMeetupForm.module.css';
function NewMeetupForm(props){
const titleRef = useRef();
const urlRef = useRef();
const addressRef= useRef();
const descriptionRef = useRef();
function handleSubmit(event){
even... |
function deleteDate( id ) {
if ( confirm('Você tem certeza dessa ação?') ) {
$('#delete-blacklist-form').attr('action', '/blacklist/'+id);
$('#delete-blacklist-form').submit();
}
} |
require(["ex1/Home", "ex1/Business"], function (Home, Business) {
"use strict";
var hjemme = new Home("Hjemme", 59.922315, 10.49115, "A+M+M+M+H");
var hotellet = new Business("Hotellet", 61.229968, 7.098702);
console.log(hjemme.toString());
console.log(hotellet.toString());
});
|
// 1 : Khai bao bien
// var a = 5
// const b = 6
// a = 10
// b = 12
// console.log(a)
// console.log(b)
// 2 : Kieu du lieu
// null
// undenfined
// Th1 : Khai bao 1 bien khong gan gia tri
// var a
// console.log(a)
// TH2 : Truy van toi key khong ton tai cua object
// const teo = {
// name : "Nguyen Van Teo",
... |
export const MORNING_MINUTES_LIMIT = 180
export const EVENING_MINUTES_LIMIT = 240
export const MAX_MINUTES_PER_TRAIL = 420
export const EVENT_TYPES = Object.freeze({ MEET: 'meet', BREAK: 'break' })
export const CATEGORIES = Object.freeze([
{ name: 'Advanced Topics', color: '#1A55AF' },
{ name: 'Beginner', color: ... |
const express = require('express');
const bodyParser = require('body-parser');
const app = express();
const port = process.env.PORT || 3005;
const { createRouteRegistry } = require('../src/index.js');
app.use(bodyParser.json());
const openAPIRoot = {
swagger: '2.0',
info: {
description: 'Example OpenAPI Docu... |
var Player = function(playerID){
this.playerID = playerID;
this.isMainPlayer= false;
this.mesh;
console.log("ID asignado a este player: " + playerID);
var scope = this;
this.init = function(){
// Load a glTF resource
// loader.load('/client/js/mono.glb',
loader.load('/client/assets/mono.glb',
func... |
const stringTimes = (word, num) => {
let apple = '';
Array(num).fill().forEach(() => {
apple += word
})
return apple
}
console.log(stringTimes('Hi', 3))
console.log(stringTimes('Hi', 2))
console.log(stringTimes('Hi', 1))
|
import {
SET_NAME_PRACTICE,
SET_LOCATION_PRACTICE,
SET_EMAIL_PRACTICE,
GET_IMAGES_BY_EMAIL,
SAVE_IMAGES_ON_DEVICE,
SET_VALIDATE_EMAIL,
} from '../constants/ActionTypes'
export function setValidateEmail(bool) {
return {
type: SET_VALIDATE_EMAIL,
payload: { bool }
}
}
expo... |
module.exports = {
mongoDb_Atlas_URL: "YWRtaW46YWRtaW4xMjNAY2x1c3RlcjAuc2dtbGsubW9uZ29kYi5uZXQvbXlEQg=="
} |
/**************
* @package WordPress
* @subpackage Cuckoothemes
* @since Cuckoothemes 1.0
* URL http://cuckoothemes.com
**************/
jQuery(document).ready(function($){
$("#cuckoo-contact-form").submit(function() {
var contactSubmit = $(this);
if(typeof contactSubmit != "undefined"){
var name = $(t... |
$(document).ready(function () {
$('#chkViewAll').change(function () {
ViewAllTickets();
});
});
var ViewAllTickets = function () {
if ($('#chkViewAll').is(':checked')) {
url = $('#lnkShowAll').val();
window.location.href = url;
}
else {
url = $('#lnkShowClosed').val... |
const albumModel = require('../model/albumModel');
//We need to require path & multer dependencies
const path = require('path');
//Get multipart & asigns different keys. Parse files from forms to object
const multer = require('multer')({
//Specifying final destination for uploads
dest: 'public/uploads'
});
con... |
import { domain } from './domain'
export const incrementLoading = domain.event('incrementLoading')
export const decrementLoading = domain.event('decrementLoading')
export const loading = domain.store(0, {name: 'loading'})
.on(incrementLoading, val => val + 1)
.on(decrementLoading, val => val - 1)
|
window.onload = function() {
document.getElementById("js-search-input").focus();
}
function post(path, params, method) {
method = method || "post";
var form = document.createElement("form");
form.setAttribute("method", method);
form.setAttribute("action", path);
for(var key in params) {
if(param... |
$('#event-pdf').click(function () {
var pdf = new jsPDF('l', 'pt', 'legal');
source = $('#event-table')[0];
specialElementHandlers = {
'#bypassme': function (element, renderer) {
return true
}
};
margins = {
top: 20,
bottom: 20,
left: 20... |
import React, { Component } from 'react';
import Input from './input'
import Form from './form'
import Joi from "joi"
class LoginForm extends Form {
state = {
data :{
username: "",
password: ""
},
errors:{}
}
schema = {
username: Joi.strin... |
const angles = document.querySelectorAll('.angle-input');
const btn = document.querySelector('#btn');
const outputBlock = document.querySelector('#block__output');
const sumOfAngles = (angle1, angle2, angle3) => angle1 + angle2 + angle3;
const isTriangle = () => {
if (
angles[0].value === '' ||
angles[1].va... |
const Navigation = {
init: function (){
this.addListeners();
},
addListeners: function(){
let nav = $('.nav-top')
let menu = $('.side-menu')
let closeMenu = $('.close-menu')
nav.on('click', event => {
menu.removeClass('hidden')
})
closeM... |
import React, { Component } from 'react';
import Carousel from 'nuka-carousel';
import Slide from './Slide'
import './PizzaSlider.css';
class PizzaSlider extends Component {
render() {
var Decorators = [];
return (
<div className="container">
<div className="row">
<Carousel class... |
const fs = require('fs-extra');
const path = require('path');
const chokidar = require('chokidar');
const enfsensure = require('enfsensure');
const ffmpeg = require('fluent-ffmpeg');
if (/^win/.test(process.platform)) {
ffmpeg.setFfmpegPath(path.resolve(__dirname + '/../../../bin/ffmpeg'));
ffmpeg.setFfprobePath(p... |
(function () {
'use strict'
window.GOVUK = window.GOVUK || {}
function WordsToAvoidAlerter (wordsToAvoidRegexps, options) {
var $el = $(options.el)
var $wordsToAvoidAlert = $(options.wordsToAvoidAlert)
var $alertCount = $('<strong />').attr('id', 'js-words-to-avoid-count')
var wordsToAvoidMatcher... |
var $window = $(window), $body = $('body'), $document = $(document);
(function($){
dl.create = function(s){
s = objectval(s);
var d = document.createElement(s.name || 'x'), e = $(d);
if(is_string(s.src))d.src = s.src;
if(is_object(s.attr))e.attr(s.attr);
if(is_object(s.css))e.css(s.css);
if(is_string(s.htm... |
$(document).ready(function(){
//If guest is true, hide the profile icon
var guest = window.localStorage.getItem('guest');
console.log(guest);
if (guest == 'true'){
console.log("Guest is true");
//hide the profile icon
$('#profileBtn').hide();
}
else {
console.log("Gu... |
var showCollection = angular.module("showCollection",['ngRoute']);
showCollection.config(function($routeProvider){
$routeProvider.when("/",{
templateUrl:"views/collection.html",
controller:"TodoCTRL"
});
$routeProvider.when("/swag",{
template:"<h1>SWAG!</h1>"
});
$routeProvider.otherwise({
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.