blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 132 | path stringlengths 3 236 | src_encoding stringclasses 29
values | length_bytes int64 8 7.94M | score float64 2.52 5.72 | int_score int64 3 5 | detected_licenses listlengths 0 142 | license_type stringclasses 2
values | text stringlengths 8 7.94M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
d8364e61d3eed5d81dc218c380d1aab00e7b18dc | JavaScript | yacinechaouaa/propscheck | /src/profile/componant.js | UTF-8 | 988 | 2.59375 | 3 | [] | no_license | import React from "react";
const MyComponent = (props) => {
const handleClick = (e) => {
e.preventDefault();
alert(`the name is ${props.fullName}`);
};
return (
<div>
<p className="myText">
Hello , am{" "}
<span style={{ textDecoration: "underline" }}>
{props.fullName}... | true |
13da04b94eecbd20a68e3379fa80995959a83209 | JavaScript | hoff2/reactfizzbuzz | /src/App.test.js | UTF-8 | 3,459 | 3.328125 | 3 | [] | no_license | import React from 'react';
import {shallow, mount} from 'enzyme';
import sinon from 'sinon';
import App, {calculateFizzBuzz} from "./App";
describe('fizzbuzz app', () => {
let fizzBuzzApp;
beforeEach(() => {
fizzBuzzApp = shallow(<App />);
});
it('has a text input', () => {
expect(fiz... | true |
779c8693de825c5be55e7840796e9249d18a7916 | JavaScript | MeganGerwick/my_stream | /routes/html/index.js | UTF-8 | 1,999 | 2.515625 | 3 | [
"MIT"
] | permissive | // Requiring path to so we can use relative routes to our HTML files
const path = require("path");
// Requiring our custom middleware for checking if a user is logged in
const isAuthenticated = require("../../config/middleware/isAuthenticated");
const router = require("express").Router();
const db = require("../../mode... | true |
2cdd05d2551e942bead54fae4d98b7e0b9d0a9d3 | JavaScript | yashAgarwal41/Awesome-Projects-Collection | /Web Dev Projects_or_Portfolios/iNotebook/routes/auth.js | UTF-8 | 3,561 | 2.6875 | 3 | [] | no_license | const express = require("express");
const router = express.Router();
const User = require("../models/User");
const { body, validationResult } = require("express-validator");
const bcrypt = require("bcryptjs");
const fetchUser = require("../middleware/fetchUser");
var jwt = require("jsonwebtoken");
// ROUTE 1 : - Creat... | true |
8c89f74d54fcb0a1c6775aa24eb489e892d2f289 | JavaScript | Madonis21/PureJS | /pure.js | UTF-8 | 2,719 | 3.140625 | 3 | [] | no_license | function manageRoutes() {
var htmlElem, xhttpobj;
var pathname = window.location.pathname;
var currentRoute = routes.filter((route) => route.path === pathname);
var collection = document.getElementsByTagName("div");
for (let elem of collection) {
htmlElem = elem.getAttribute("include-html");
if (html... | true |
9fb9ce67d41dca0c648d043cb152d6af98618dda | JavaScript | UpAndAtThem/javascriptExercises | /invoice.js | UTF-8 | 388 | 3.40625 | 3 | [] | no_license | // function invoiceTotal(amount1, amount2, amount3, amount4) {
// return amount1 + amount2 + amount3 + amount4;
// }
function invoiceTotal(...lineItems) {
return lineItems.reduce((accum, item) => item + accum );
}
console.log(invoiceTotal(20, 30, 40, 50)); // works as expected
console.log(invoiceTotal(20... | true |
96c7d1b1d506daec7215cae4b84a2e10bc6a3158 | JavaScript | Shreyank18/Merge-Sort-Visualizer | /src/SortingAlgorithms/SortingAlgorithms.js | UTF-8 | 2,799 | 3.421875 | 3 | [] | no_license | /* this is a better version of merge sort with optimal space complexity*/
/* comments added */
export function getMergeSortAnimations(array) {
const animations = [];
if(array.length <= 1)
return array;
const auxArray = array.slice();
mergeSortHelper(array, 0, array.length - 1, auxArray, animati... | true |
8391cae363a7b57b40c2b15f730ade64e4cdc8f6 | JavaScript | burkhartt/PromiseKata | /src/Promise.test.js | UTF-8 | 7,482 | 3.03125 | 3 | [] | no_license | const P = require('./Promise');
describe('Testing Promise', () => {
let thenFn;
let catchFn;
const successResult = 'succeeded';
const errorResult = 'errored';
beforeEach(() => {
thenFn = jest.fn();
catchFn = jest.fn();
});
describe('When wrapping a synchronous function in ... | true |
a52832ad9e124a34c714e4af58753006a4e527f5 | JavaScript | anticlockwise-999/JAVASCRIPT | /1.3 Switch.js | UTF-8 | 871 | 4.09375 | 4 | [] | no_license | //Switch
console.log("Select an option: \na. Option 1 \nb. Option 2 \nc. Option 3");
choice = prompt();
var text;
switch(choice){
case "a":
text= "Option 1 selected"; //if(choice="a")
break;
case "b":
text= "Option 2 selected";
break;
case "c":
text= "... | true |
7e8abe04a5fb9a8f84bf84ea44cd8ac6fbeb30ee | JavaScript | AccentsResearchLab/GamifyPsycholinguisticsExperiments | /public/src/Mission.js | UTF-8 | 6,603 | 2.921875 | 3 | [
"Apache-2.0"
] | permissive | // Functions related to the Mission.
// Loads the game description into window.games.
loadData("./../json/game_description.json", null);
// Display the mission text and play the mission audio for the given
// gameindex. Valid game indexes are the valid index in the
// window.games array.
var setGameLanguage = functi... | true |
3f416b34ed6ebfc75fd3a140c103c50cd0a9cfb6 | JavaScript | marianopasquali/bloque2 | /Filter/index.js | UTF-8 | 416 | 3.828125 | 4 | [] | no_license | /*
[Filter] Crear una función que reciba un array de números como argumento y
retorne un array con los elementos distintos
Ejemplo:
[1,2,3,4,5,4,3,2,1,0] debería retornar [1,2,3,4,5,0]
*/
const SinRepetidos = (array)=>{
const ArrayLimpio=[];
for (i=0;i<array.length;i++){
ArrayLimpio.i... | true |
4916684f346c271d43cc5a110de88c2e663fc994 | JavaScript | seura710/phase-1-first-class-functions | /index.js | UTF-8 | 211 | 2.625 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | function receivesAFunction(someFunction) {
someFunction();
}
function returnsANamedFunction() {
return function namedFunction() {};
}
function returnsAnAnonymousFunction() {
return function() {};
} | true |
d9191d9fab1340d60f3f5bbda46b383dd826b09d | JavaScript | TAYFUN-KAYA/CoreProject | /node_project/app.js | UTF-8 | 335 | 2.53125 | 3 | [] | no_license |
const express = require('express');
const app = express()
const port = 5555;
app.get('/',(req,res)=>{
res.send('Anasayfa');
})
app.get('/staj',(req,res)=>{
res.send("Hello World from Node.JS!");
})
app.get('/kartaca',(req,res)=>{
res.send("Kartaca");
})
app.listen(port,()=>{
console.log("5555,sta... | true |
edfdab3acf0ccf244b0e91105bad238ec177bdbc | JavaScript | pbeshai/linked-highlighting-react-d3-reflux | /src/util/Util.js | UTF-8 | 731 | 3.546875 | 4 | [] | no_license | import d3 from 'd3';
/**
* Like d3.bisect but chooses the closest element, not always the left or right
* That is, finds the element in the array closest to the value through the use of accessor
*/
export function findClosest(array, value, accessor) {
if (!array || !array.length) {
return null;
}
const b... | true |
a215cfdf67e11950b56ba9c8aaa240c95f244b60 | JavaScript | JYL123/AI_In_Finance | /server/controller/app.js | UTF-8 | 1,642 | 3.015625 | 3 | [
"MIT"
] | permissive | const express = require('express')
const cors = require('cors')
const app = express()
const port = process.env.PORT || 3001 // running on port 3001
app.use(cors())
//for post url
var bodyParser = require('body-parser')
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
// routes will go h... | true |
5dbe91b9a3e9fc9f2f0052e99d26f89f7ee70696 | JavaScript | oraichain/hackathon-ibc | /ibc-proxy/get-account.js | UTF-8 | 913 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | const fs = require('fs');
const readline = require('readline');
const passAccount = (fileName, network) => {
return new Promise((resolve, reject) => {
const rl = readline.createInterface(fs.createReadStream(fileName));
let lastLine = '';
const account = { network };
rl.on('line', (line) => {
if... | true |
422a837e0fb8b014be99e9840f7256ee84b12ba4 | JavaScript | gabrielizalo/HackerRank | /10 Days of Javascript/05 Arrow Functions.js | UTF-8 | 366 | 3.265625 | 3 | [
"MIT"
] | permissive | /**
* Created by gporras on 2018-08-30.
*/
/*
* Modify and return the array so that all even elements are doubled and all odd elements are tripled.
*
* Parameter(s):
* nums: An array of numbers.
*/
function modifyArray ( nums ) {
const multiplyArray = nums.map ( function ( a ) {
return a % 2 === 0 ? a * ... | true |
ab0ab6d7bd431112782ae4a1f7dd39a954375014 | JavaScript | MaxGsprd/Mytodos | /script.js | UTF-8 | 2,501 | 2.921875 | 3 | [] | no_license | // CODE POUR POP UP D'INSCRIPTION
var openRegister = document.querySelector(".registerLink");
if(openRegister){
openRegister.addEventListener("click", registerPopUp, false);
}
var showRegister = document.querySelector(".registerWindow");
var close = document.querySelector(".close-register");
close.addEventListe... | true |
cc522b65c818335ca42dfb08a6fac90460d9bb16 | JavaScript | IceyIsAlreadyTaken/WebPractice | /2019garbage/3/210312简易留言板⭐️.js | UTF-8 | 2,915 | 3.078125 | 3 | [] | no_license | //url 中不能出现空格汉字问号等
//url 编码使用一个百分号和16进制的数字来对字符进行编码
// encodeURIComponent('http://a.com/foo?name=miao&message=yes?')
//"http%3A%2F%2Fa.com%2Ffoo%3Fname%3Dmiao%26message%3Dyes%3F"
// decodeURIComponent("http%3A%2F%2Fa.com%2Ffoo%3Fname%3Dmiao%26message%3Dyes%3F")
//"http://a.com/foo?name=miao&message=yes?"
// \r 回到行首 ... | true |
c233a99b8731de84cca1059b6d3c0ca046201c88 | JavaScript | carolinagiorno/11semana | /backend/src/controllers/IncidentController.js | UTF-8 | 2,193 | 2.609375 | 3 | [] | no_license | const connection = require('../database/connection');
module.exports = {
//listando casos
async index (request, response) {
//paginação (default: 1)
const { page = 1 } = request.query;
//entre [] para retornar apenas um resultado
const [count] = await connection('incidents').co... | true |
4fbc157aac692483c092534a5d3221af15b40b01 | JavaScript | phamtanphat/server2912node | /index.js | UTF-8 | 2,332 | 2.609375 | 3 | [] | no_license | const express = require("express");
const app = express();
const cors = require("cors");
const {json} = require("body-parser");
const { Word } = require('./words.model')
app.use(json());
app.use(cors());
app.get('/word' , (req,res) => {
Word.find({})
.then(words => res.send({success : true , words}... | true |
c09fc8e5519f575fe10623ed6db5a04257ea0928 | JavaScript | sqroc/cxroom | /js/check_egg.js | UTF-8 | 1,312 | 3.03125 | 3 | [] | no_license | $(document).ready(function(){
$('input[name="ideaname"]').blur(function(){
check_name();
});
$('textarea[name="ideaintro"]').blur(function(){
check_intro();
//alert('a')
});
});
function check_egg(){
var TAG_NAME = false;
var TAG_INTRO = false;
var TAG_COVER = false;
if(check_name()){
TAG_NAME = ... | true |
f2c4cef54f75d506cdbc9dc52570dc93c99f0e99 | JavaScript | saurabhdhankar/chatserver | /server.js | UTF-8 | 1,846 | 2.890625 | 3 | [] | no_license | // console.log("Saurabh "," Welcome to NodeJS World!");
var mongo = require('mongodb').MongoClient,
client = require('socket.io').listen(8080).sockets;
mongo.connect('mongodb://127.0.0.1/chat' , function(err , db){
if(err){
console.log("Saurabh ","err in databse connection ");
throw err;
}
// conso... | true |
8aa25319523fa363fda598c80e65ab5e02368bd2 | JavaScript | rakeshvora2007/lead-exporter-for-marketers | /main.js | UTF-8 | 3,414 | 3.65625 | 4 | [] | no_license | /*
Importing File:
CSV, Excelsheet
*/
var arr = Array();
let importedFile = document.getElementById("file-importer");
// Identifyinh the screen
let screen = document.getElementById("screen");
// Adding event listener
importedFile.addEventListener("change", importFile);
// Function that would start importing the file ... | true |
75cc2fabd959447ecec4f14ad9c3874cafb9b8db | JavaScript | hmanasi/toprecipe | /public/javascripts/fooditems/index.js | UTF-8 | 210 | 2.546875 | 3 | [
"MIT"
] | permissive | (function() {
listRecipesClicked = function(e) {
var recipeId = $(this).attr('itemId');
$("#list-recipes-form-" + recipeId).submit();
};
$("[name=list-recipes-button]").click(listRecipesClicked);
}());
| true |
1ba38ddf738fa1915d9c5075761a17470c1946d9 | JavaScript | Duoquote/duo-launcher | /app/minecraft.js | UTF-8 | 31,219 | 2.859375 | 3 | [] | no_license | const fetch = require('node-fetch');
const fs = require('fs');
const path = require('path');
const os = require('os');
const _ = require('lodash');
const crypto = require('crypto');
const yauzl = require('yauzl');
var logger = require('log4js').getLogger();
const base = "data"
console.time("1.12.2");
/**
* This cla... | true |
12fdbdfa496cd5d8eff0a319c702c5f42e8eb32b | JavaScript | rangheet/rangheet.github.io | /src/component/electives/ducks.js | UTF-8 | 923 | 2.734375 | 3 | [] | no_license |
const elective1 = {
name: "E1",
courseCode: "IT-105",
institute: "DA-IICT",
};
const elective2 = {
name: "E2",
courseCode: "IT-110",
institute: "DA-IICT",
};
const initialState = {
electives:[]
};
export const actionType = {
GET_ELECTIVES: "[Electives] Get Electives",
UPDATE_ELEC... | true |
f00b5dd41285f95cc3aa4eeacd61b82f7d95fb9d | JavaScript | Lirycs228/Lirycs228.github.io | /Lumberjack/script.js | UTF-8 | 1,188 | 2.71875 | 3 | [] | no_license | //FullPageJsActivated
$(document).ready(function() {
$('#wrapper').fullpage();
});
function frosting() {
particlesJS.load('particles-js', 'assets/particles/app.json', function() {
console.log('callback - particles.js config loaded');
});
}
function httpGetAsync(theUrl, callback) {
var xmlHtt... | true |
8dfb1b97f853631e21419665479612c863455fa0 | JavaScript | Zarinaa14/js | /5lesson/clock.js | UTF-8 | 549 | 3.171875 | 3 | [] | no_license | var div = document.getElementsByClassName("clock")[0];
var p = document.getElementsByClassName("p")[0];
setInterval(function(){
var elem= new Date();
var End = new Date();
End.setHours(23,59,59,59);
var hours = End.getHours() - elem.getHours();
var minutes = End.getMinutes() - elem.getMinutes();
var seconds ... | true |
baca9e74816d04498803b715a0cd6583ec7dccb7 | JavaScript | johnBrereton/Country-Info-App | /code.js | UTF-8 | 9,307 | 3.34375 | 3 | [] | no_license | /**
* @author John Brereton
* @since 5/1/2021
* @source https://github.com/johnBrereton/Country-Info-App
*/
// Create lists to represent datasets
var countryNameList1 = getColumn("Countries and Territories", "Country Name");
var countryCodeList = getColumn("Countries and Territories", "Three Letter Country Code");... | true |
f61021dde90fc59573607e21b327866eee839674 | JavaScript | ozgurmuraterhan/crypto-tracker | /frontend/src/components/search/search_bar.jsx | UTF-8 | 1,898 | 2.609375 | 3 | [] | no_license | import React, { useState } from 'react';
import SearchItem from './search_item';
const SearchBar = ({ tickers }) => {
const [focus, setFocus] = useState(false);
const [searchStr, setSearchStr] = useState("");
const renderSearchResult = () => {
if (tickers.length) {
const filt =tickers.filter((ticker) ... | true |
41f13e3325ee8283688da7d16f3d19a267527700 | JavaScript | tiwarishi/twitthere | /user/user.controller.js | UTF-8 | 688 | 2.609375 | 3 | [] | no_license | var mongoose = require('mongoose');
var User = require('./user.model');
exports.getUser = function (req, res){
console.log("Dummyname is " + req.headers['dummyname']);
User.find(function(err, data){
if(err){
return res.json({'message':err});
}
return res.send({'response':data});
});
}
exports.addUse... | true |
9a694190cd279592a1ae1a39c6569a2e0cbf791d | JavaScript | andreaak/cs | /WebTest/WebTest/09_Node/03_console_program/007_FS/002_writeFile.js | UTF-8 | 575 | 3.171875 | 3 | [] | no_license | // Модуль fs предназначен для работы с файлами. методы содержащиеся в модуле имеют синхронную и асинхронную формы
var fs = require('fs');
var utils = require('util');
user = {
fname : "Ivan",
lname : "Ivanov",
age : 30,
position : "developer"
}
console.log('File writing...');
fs.writeFile(... | true |
d6c6922023165348c24561b2e391ac1a2b0f972b | JavaScript | aneesh-k/teewt | /react_ui/src/Components/HomeComponents/DisplayUserComponent/DisplayUser.js | UTF-8 | 2,099 | 2.59375 | 3 | [] | no_license | /* eslint-disable */
import React, { useEffect, useState } from "react";
import "./DisplayUser.css";
const DisplayUser = props => {
const [loading, setLoading] = useState(false);
const assignRoles = async e => {
setLoading(true);
console.log(e.target.value);
const bodyJson = JSON.stringify({
role... | true |
a8e5ffacb8add33c76b9d19505c54224d2cc5e52 | JavaScript | charithperera/LaunchSchool | /Front End/JavaScript/lesson_1/exercise_js_logic/app.js | UTF-8 | 626 | 3.65625 | 4 | [] | no_license | var apples = 3;
var bananas = 1;
var are_equal = apples === bananas;
var either_or = apples || bananas;
console.log("Are equal: " + are_equal);
console.log("Either or: " + either_or);
var either_or = bananas || apples;
console.log("Either or after: " + either_or);
if (apples === bananas) {
console.log("Q1-4: Tru... | true |
19f6205a92ed1ed52993dbc400b21d410774a112 | JavaScript | jvitaleamplify/angular-scratch-work | /content/js/UserService.js | UTF-8 | 363 | 2.625 | 3 | [] | no_license | function UserService($http){
var API = '//jsonplaceholder.typicode.com/users/';
this.getUser = function(userId){
return $http
.get(API + userId)
.then(function(response){
return response.data;
},function(reason){
//error
})
}
}
angular.module(... | true |
b1050c50416285f566fa96a894109382faedd8ae | JavaScript | Wizcorp/dom-loader | /index.js | UTF-8 | 1,006 | 2.703125 | 3 | [
"MIT"
] | permissive | var loaderUtils = require('loader-utils');
var textTags = ['title', 'style', 'script'];
module.exports = function (str) {
if (this.cacheable) {
this.cacheable();
}
var query = loaderUtils.parseQuery(this.query);
var tag = query.tag || 'div';
var asText = query.asText || textTags.indexOf(tag) !== -1;
var attr... | true |
3ae4ea4d787e03e527a3fea8e35619a116c29333 | JavaScript | daliborkoenig/fbw48-2_shared | /2021/03_March/11_03_2021/pb-operators-arithmetic-pt2-daliborkoenig/exercise_2.js | UTF-8 | 2,159 | 3.90625 | 4 | [] | no_license | // Q1
ticketRevenue = 6450
tickets = 15
numberOfTickets = ticketRevenue / tickets
console.log('if the ticket revenue in one night is', ticketRevenue, '$', 'and the price of tickets is', tickets, '$, then we sold', numberOfTickets, 'tickets');
// Q2
console.log(500/7*365);
// Q3
percentage = 17 / 30 * 100
console.log(... | true |
1b1e8e736ce399e717afed3e7c46f74db965b5ce | JavaScript | foye3/CS546 | /cs-546-lab-4/todo.js | UTF-8 | 2,553 | 2.859375 | 3 | [] | no_license | const mongoCollections = require("./mongoCollections.js");
const uuid = require("uuid/v4");
const tasks = mongoCollections.todoItems;
async function createTask(title, description){
if(!title || !description) throw "You must provide a title and a description";
try {
let newid = uuid();
//console... | true |
2f98470c2e268b5c8b931563e18ee22136663499 | JavaScript | gilleswittenberg/WhatYouSimple | /js/jquery.whatyousimple.js | UTF-8 | 2,218 | 2.6875 | 3 | [] | no_license | (function($) {
$.fn.whatYouSimple = function(options) {
var defaults = {
controls: {
b: {name: 'Bold', title: 'Bold', html: '<b>b</b>', 'class': false},
i: {name: 'Italic', title: 'Italic', html: '<i>i</i>', 'class': false},
u: {name: 'Underline', title: 'Underlined', html: '<u>u</u>', 'class': fals... | true |
bbc996d3d556f96fd41cd5cef5853bfcc7be0296 | JavaScript | charlersamani/can | /assets/js/charles.js | UTF-8 | 3,011 | 2.578125 | 3 | [] | no_license | $(".portfolios .video-link").magnificPopup({
type: "iframe"
});
$(".portfolios .image-link").magnificPopup({
type: "image"
});
const config = {};
config.container = document.querySelector('.canvas-wrap');
config.height = window.innerHeight-70;
config.width = window.innerWidth-350;
config.halfX = confi... | true |
6642fd40a3648346cfe2609e63032271fb08b75c | JavaScript | catalinstrimbei/oop-bus-track | /TrackJavaScript/Start_OOJS/WebContent/js/DefObjects.js | UTF-8 | 352 | 2.828125 | 3 | [] | no_license | console.log("Load DefObjects.js ...");
function testDefObjectFunction(){
console.log("Test Object Function!");
var poj = new Object(1);
poj.id = 1001;
for (pro in poj){
console.log("Object property " + pro + ":" + poj[pro]);
}
console.log("Type of object: " + (typeof poj));
console.log("Object supe... | true |
83383ef614040dc674b48af36a16602f7e30ebf5 | JavaScript | hkfernandez/Team_Profile_Generator | /lib/Intern.js | UTF-8 | 809 | 2.890625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | const Employee = require('./Employee.js');
class Intern extends Employee {
constructor (name, id, email, school) {
super (name, id, email);
this.school = school;
this.role = 'Intern';
}
getSchool() {
return this.school;
}
}
// const internQuesti... | true |
5f00c498555cf606b1a9959d3ad8b7d8de002dae | JavaScript | asc5025/SyncUp | /Frontend/src/user.js | UTF-8 | 173 | 2.578125 | 3 | [] | no_license | class User {
constructor(name, email) {
this.name = name;
this.email = email;
this.id = userId++
User.all.push(this)
}
}
User.all = [];
let userId = 1;
| true |
8a700237644b7ad13c2e0cd91a0bbec65e5de4f5 | JavaScript | driera/tweet-ui | /src/main.js | UTF-8 | 1,938 | 2.625 | 3 | [] | no_license | import Velocity from 'velocity-animate'
import Vue from 'vue'
const MAX_TWEET_LENGTH = 140;
let message = 'Compose New Tweet'
new Vue({
el: '#twitterVue',
data: {
tweet: '',
message: message,
photos: [],
modalShowing: false
},
computed: {
tweetIsOutOfRange() {
... | true |
5b8c961adc04db4711007e23f656ec4d16be99e5 | JavaScript | anyuzer/arc-object | /__tests__/freeze.js | UTF-8 | 611 | 2.796875 | 3 | [] | no_license | import ArcObject from "../index.js";
//Test freeze methods
describe('ArcObject.freeze',() => {
let testObj = new ArcObject({a:'a',b:'b',c:'c'});
//Freeze it
testObj.freeze();
it('should not be able to set a new value', () => {
//Attempt overwrite
expect(() => {testObj.a = 'test'}).toT... | true |
6c4a68034b2428ae8ebeb66c04975a5946f68480 | JavaScript | TiagoMaiaL/EloquentJS-solutions | /chapter4/list.js | UTF-8 | 727 | 3.484375 | 3 | [
"MIT"
] | permissive | /**
* Solutions to Eloquent js exercises.
*
* Chapter 4
* A list
*/
var arrayToList = function(array) {
if (array.length == 0) return null;
return {
value : array.shift(),
rest : arrayToList(array)
}
}
var listToArray = function(list) {
if (list.rest == null) return [list.value];
return [list... | true |
dbd4c199a027aca9229d2dc4a22e9f41ebba7370 | JavaScript | mosikoo/nowa-i18n | /src/utils.js | UTF-8 | 3,023 | 2.546875 | 3 | [
"MIT"
] | permissive | const fs = require('fs');
const chalk = require('chalk');
const path = require('path');
const assign = require('object-assign');
const utils = {};
utils.isExcel = (filepath) => {
const isExist = fs.existsSync(filepath);
if (isExist) {
const ext = path.extname(filepath).slice(1);
return ext === 'xlsx' || ex... | true |
b6fa2046f15d791f28b8044a412181e81f405019 | JavaScript | andrvyal/tinyutils | /src/Deferred.js | UTF-8 | 495 | 2.671875 | 3 | [
"MIT"
] | permissive | const PRIVATE = new WeakMap();
export default class Deferred {
constructor() {
let hidden = {};
hidden.promise = new Promise((resolve, reject) => {
hidden.resolve = resolve;
hidden.reject = reject;
});
PRIVATE.set(this, hidden);
}
get promise() {
let {promise} = PRIVATE.get(this... | true |
76e3af1d12c8ece50e109e9d5db20b7183fb4923 | JavaScript | starzonmyarmz/TinyMusicEditor | /app.js | UTF-8 | 7,852 | 2.578125 | 3 | [] | no_license | import React from 'react'
import Context from './context.js'
import Piano from './piano.js'
import Settings from './settings.js'
import Timeline from './timeline.js'
import TinyMusic from 'tinymusic'
import BubbleView from './bubble.js'
import {Bubble} from './bubble.js'
const { useEffect, useMemo, useRef, useState } ... | true |
21538e8e171abfd1d1ae1814e743de5a4bc1f359 | JavaScript | Karinabarsk/JavaScript-Project | /if18/script.js | UTF-8 | 641 | 3.4375 | 3 | [] | no_license | "use strict";
const {getRandomIntInterval, getRandomFloatInterval} = require('./utils') // Импортируем функции из файла utils.js
// Даны три целых числа, одно из которых отлично от двух других, равных между собой. Определить порядковый номер числа, отличного от остальных
let A = getRandomIntInterval(1, 10)
let B = g... | true |
020a5aa85f44e722151361428008b21a392ce93f | JavaScript | remo-zaros-fcc-challenges/weather-api | /app/components/WeatherElement.js | UTF-8 | 856 | 2.734375 | 3 | [
"MIT"
] | permissive | import weatherElementData from './weatherElementData'
import loadImage from '../js/loadImage'
import getIconName from '../js/getIconName'
export default function (data) {
let image, id, daytime
const iconElement = document.createElement('div')
const dataElement = document.createElement('div')
iconElement.setAt... | true |
f023ec33f90a0963604e5b87622860115cc7d645 | JavaScript | uhm-ics/databet | /app/imports/api/databet_collections/MeteorUsers.js | UTF-8 | 2,047 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | // import { Meteor } from 'meteor/meteor';
//
// class MeteorUsersCollection {
//
// constructor(config) {
// this._name = "MeteorUsers";
// }
//
// export_to_JSON() {
// return "[ ]"; // does nothing
// }
//
// check_JSON_against_schema(doclist) {
// // do nothing
// }
//
// import_from_JSON(... | true |
189d63dff1ee3a24b1e86ed8d3c1d0f7738f3901 | JavaScript | xuexue95/node.js-chat | /app.js | UTF-8 | 2,196 | 2.703125 | 3 | [] | no_license | // 引入 express 包
var express = require('express');
// 创建应用
var app = express();
//静态目录设置
app.use(express.static('./static'));
// 模板存放目录
app.set('views', './views');
app.set('view engine', 'ejs')
var server = require('http').createServer(app);
// 创建 socket 服务
var io = require('socket.io')(server);
// 路由规则
app.get('... | true |
a46bc873009aa920e9d2c0abbeb6bbb3e7b7c85b | JavaScript | MuffinHop/sswkartta | /js/tool/get/getAllSuggested.js | UTF-8 | 2,388 | 2.53125 | 3 | [] | no_license | /*
Followring Javacript map interpreter code made by Sampo Savilampi for Suomen Street Workout - non-profit organization
Used libraries and services
Google Maps API by Google inc.
JQuery API by JQuery Team
Openweathermap by Extreme Electronics LTD. (openweathermap.org)
Copyright (c) 2016 Sampo Savilampi
Permis... | true |
74559132af8bade4f05f14f8d2157e0e130fadd3 | JavaScript | TheBobbyLlama/portfolio-react | /src/components/Contact/index.js | UTF-8 | 2,187 | 2.84375 | 3 | [] | no_license | import React, { useState } from "react";
import { validateEmail } from "../../utils/helpers";
import "./style.css";
function Contact(props) {
const [contactData, setContactData] = useState({ contactName: "", contactEmail: "", contactMessage: ""});
function handleChange(e) {
var validEntry = false;
var errorDiv ... | true |
b0cab62fd828910206ee31b7c47e5cece2b2ffe1 | JavaScript | estgvz/estgvz.github.io | /testconsole01.js | UTF-8 | 1,523 | 2.859375 | 3 | [] | no_license | //test program 01 - individual js file. this is all program-specific
//webconsole.js must be loaded before this!
nextDirective = "Yo, it's me, computer. Input command:";
commandSeparator = " ";
outputSeparator = "\n";
directiveSeparator = "\n";
textHist = nextDirective;
document.getElementById("consoleOut").innerHTML... | true |
a066856c7a3941e6fb2d59c1239453a757bdaca0 | JavaScript | CubicZed/TheVortexBot | /commands/pings/gaw.js | UTF-8 | 851 | 2.65625 | 3 | [] | no_license | module.exports = {
name: 'gaw',
description: 'Used with donators',
args: true,
usage: '<donator> <message>',
execute(message, args) {
const Discord = require('discord.js');
if (message.member.roles.cache.some(role => role.name == 'Staff')) {
const donator = args[0]
args.shift()
... | true |
d2bfdd25d32c7cae3e8b340ecd6573c15c9a3a2f | JavaScript | MiaXIA/LeetCodeJSSolutions | /401 - 500/453. Minimum Moves to Equal Array Elements.js | UTF-8 | 527 | 4 | 4 | [] | no_license | // Given a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a move is incrementing n - 1 elements by 1.
// Example:
// Input:
// [1,2,3]
// Output:
// 3
// Explanation:
// Only three moves are needed (remember each move increments two elements):
// [1... | true |
264297d0bf9649a3f7a0a26afe9245280867ab53 | JavaScript | Chance722/leetcode | /array/lc_561.js | UTF-8 | 753 | 3.828125 | 4 | [] | no_license | /**
* 561.数组拆分1
* 给定长度为 2n 的数组, 你的任务是将这些数分成 n 对, 例如 (a1, b1), (a2, b2), ..., (an, bn) ,使得从1 到 n 的 min(ai, bi) 总和最大。
示例 1:
输入: [1,4,3,2]
输出: 4
解释: n 等于 2, 最大总和为 4 = min(1, 2) + min(3, 4).
*/
// 自己解法1
/**
* @param {number[]} nums
* @return {number}
*/
var arrayPairSum = function(nums) {
let so... | true |
f5a63d0270c4ccc5791484bc9c6ee5df2c9e52b5 | JavaScript | gara501/polymerpres | /Custom Elements/profilecardm.js | UTF-8 | 3,291 | 2.953125 | 3 | [] | no_license | // Create a class for the element
class ProfileCardm extends HTMLElement {
constructor() {
// Always call super first in constructor
super();
// Create a shadow root
var shadow = this.attachShadow({mode: 'open'});
// Create spans
var wrapper = document.createElement('div');
wrapper.setAt... | true |
609fc9afa3bb0a1d8676413aedfdccb94df67d59 | JavaScript | Roberto12586/Pruebas-tecnicas-javascript | /ejercicios_1/ejercicio6.js | UTF-8 | 417 | 3.90625 | 4 | [] | no_license | 'use strict'
// programa que diga si un numero es par o impar y tiene que tener ventana prompt, si no es valido que pida de nuevo el numero
var numero = parseInt(prompt("introduce un numero", 0));
while(isNaN(numero)){
var numero = parseInt(prompt("introduce un numero", 0));
}
if(numero%2 ==0){
... | true |
49e89b426255a4c98289303dffc1329bcc2cdaae | JavaScript | 1712203vantran/tkgd_foodbook | /public/javascripts/service/utils.js | UTF-8 | 1,987 | 2.671875 | 3 | [] | no_license | function SweetAlert() {
const timer = 5 * 60 * 1000;
this.warning = (message, options) => {
return Swal.fire({
title: "<span style='color: #28A745;'>Thông báo</span>",
icon: "warning",
html: message + "!",
timer: timer,
showCloseButton: true,
... | true |
9022b0a44780877a498f8851fa9b0587d4a1bb37 | JavaScript | shape-of-myHeart/shape-of-myHeart | /web_design_samples/Game Main Form/main.js | UTF-8 | 727 | 2.6875 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | var Global = new Object();
window.addEventListener('load', function () {
var bgm = Global.bgm = new Audio('./resources/AI_RASK.mp3');
bgm.play();
Global.btnActive = new Audio('./resources/button-active.mp3');
Global.btnOver = new Audio('./resources/button-over.mp3');
function Sound(audio){
... | true |
4d10ff88adf961b7e82ba6be0e03bc42fb98e4fd | JavaScript | erickemp84/ToDoList | /src/components/TaskCard.jsx | UTF-8 | 733 | 2.515625 | 3 | [] | no_license |
const TaskCard = props => {
/*Deconstructed props...*/
const{tasks, handleToggleCheck, handleDeleteTask, idx} = props;
return(
<div className="col-3 card-body">
<h2 className="card-title" style={tasks.isCompleted ? {textDecoration: "line-through"} : {} }>{tasks.title}</h2>
... | true |
861f06dd795c727df26eeadcce2f362d6c8aee7e | JavaScript | znanjie/.leetcode | /fucking-algorithm/二分搜索/34.在排序数组中查找元素的第一个和最后一个位置.js | UTF-8 | 2,247 | 4.1875 | 4 | [] | no_license | /*
* @lc app=leetcode.cn id=34 lang=javascript
*
* [34] 在排序数组中查找元素的第一个和最后一个位置
*
* https://leetcode-cn.com/problems/find-first-and-last-position-of-element-in-sorted-array/description/
*
* algorithms
* Medium (37.96%)
* Likes: 474
* Dislikes: 0
* Total Accepted: 102.4K
* Total Submissions: 257.6K
* Te... | true |
e36b8f243c7ea777ebe98a689128cc56bddc60da | JavaScript | bootandy/WhackACake | /whackacake/src/game.js | UTF-8 | 14,455 | 2.984375 | 3 | [] | no_license | // http://www.tutorialspoint.com/javascript/array_foreach.htm
if (!Object.prototype.forEach)
{
Object.prototype.forEach = function(fun /*, thisp*/)
{
var len = this.length;
if (typeof fun != "function")
throw new TypeError();
var thisp = arguments[1];
for (var i = 0;... | true |
09db0fd66440255614ecbbdc8222e6f40df08075 | JavaScript | camcharp/pokemon-app | /src/components/Tile.jsx | UTF-8 | 3,266 | 2.890625 | 3 | [] | no_license | import React, { Component } from 'react';
import axios from 'axios';
export default class Tile extends Component {
constructor(props) {
super(props);
this.state = {
pokemon: [], // Pokemon de la carte
frontCard: true,
liked: false, // mis en favori ?
cardClasses: [ 'card' ]
};
this.flipCard = this... | true |
4523420bab754e592e66a2db8e4226eed6a68dd0 | JavaScript | pavithravinay/DemographicsDashboard | /Dashboard/Model/BarChart.js | UTF-8 | 1,348 | 2.5625 | 3 | [] | no_license | class BarChart extends ConfiguredChart {
constructor(ctx, label, chartData, chartLabel) {
super(label);
this.ctx = ctx;
this.label = label;
this.chartData = chartData;
this.chartLabel = chartLabel;
}
drawChart() {
var label = this.label;
... | true |
500ecdad42b106f3ac1f848a5e48743f9981e6c0 | JavaScript | blin432/Cumulative-algorithms | /javascript-exercises/first-set/subString.js | UTF-8 | 537 | 3.65625 | 4 | [] | no_license | //Question: How can you match substring of a sting?
function subStringFinder(str, subStr){
var idx = 0;
var i = 0;
var j = 0;
var len = str.length;
var sublen = subStr.length;
for (; i < len; i++){
if (str[i] == subStr[j])
j++;
else
j = 0;
//che... | true |
4f9d94451a914f824dec66eafe9e28e1ec636c6c | JavaScript | masandprakash/MySampleNodeJSApp | /services/EmployeeService.js | UTF-8 | 2,360 | 2.640625 | 3 | [] | no_license | const fs = require('fs');
const util = require('util');
const config = require('./OICSettings.js');
const https = require('https');
const { Http2ServerResponse } = require('http2');
const readFile = util.promisify(fs.readFile);
class EmployeeService {
/**
* Constructor
* @param {*} datafile Path to a J... | true |
7cdd8b88051344c1d560b04e8a7acc72a616fee3 | JavaScript | yifandp/myFrontEndStudy | /FrontEndSource/Node/node01/js.js | UTF-8 | 548 | 2.78125 | 3 | [] | no_license | let fs = require('fs');
// 打开文件
fs.open('test1.txt','w',(err, fd) => {
// 判断是否出错
if(!err){
// 写入数据
fs.writeFile(fd,'Node.js异步操作文件',(err) => {
if(!err){
// 关闭并保存文件
fs.close(fd,(err) => {
if(!err){
console.log(... | true |
f8ed87e7014af519916a718c29a6661633df28fb | JavaScript | acparkgh/09-data-structures-operations | /starter/scriptCodeChallenge1n2.js | UTF-8 | 3,197 | 3.328125 | 3 | [] | no_license | 'use strict';
const game = {
team1: 'Bayern Munich',
team2: 'Borrussia Dortmund',
players: [
[
'Neuer',
'Pavard',
'Martinez',
'Alaba',
'Davies',
'Kimmich',
'Goretzka',
'Coman',
'Muller... | true |
6b6deef5b2b32cb57c036e6635d2aaa548b030dc | JavaScript | MichaelAdamBerry/weather-react- | /app/utils/api.js | UTF-8 | 734 | 2.671875 | 3 | [] | no_license | import axios from 'axios';
const id = '4cc8ed9f6d9e1ceed2264a132cbc3d5e';
const params = '?zip=';
const zipcode = '11222';
const url = 'https://api.openweathermap.org/data/2.5/forecast'+ params+ zipcode + '&APPID=' + id;
//API call:
//http://api.openweathermap.org/data/2.5/forecast?id=524901&APPID={APIKEY}
//Parameter... | true |
e1497ca3c01c9623fe00f65995992fdd43cd81b4 | JavaScript | sylvesterlan100/cs_coursework | /angularjs/service-service/app.js | UTF-8 | 730 | 2.890625 | 3 | [] | no_license | var app=angular.module('myApp', []);
app.controller('MainController', function($scope, myService){
alert(myService.getData());
});
// app.service('myService', function(){
// var myString = 'This is Data';
// var addToString = function(newstr){
// myString+=newstr;
// };
// this.getData= function(){
// retu... | true |
72c4c449d3db39247b5d40fbdad8ba14f6081ea7 | JavaScript | alkapone312/3DEngineJS | /functions.js | UTF-8 | 658 | 3.921875 | 4 | [] | no_license | //function to clear canvas
function clearCanvas()
{
ctx.fillStyle="black";
ctx.fillRect(-canvas.width/2,-canvas.height/2,canvas.width,canvas.height);
}
//function to draw a point(drawing square)
function point(x, y, size)
{
ctx.fillRect(x,y,size,size);
}
//function to connect points (vector.x vector.y),(vector.x,v... | true |
51e300d6a91f342dc3a6cc30d99eeb6aa0e53e3b | JavaScript | heet2107/Module-3-Project | /profile.js | UTF-8 | 581 | 3.265625 | 3 | [] | no_license | let color = document.querySelector('#color');
color.addEventListener('click', favColor);
function favColor(evt) {
evt.preventDefault();
//console.log('form submit');
alert("Black");
}
let place = document.querySelector('#place');
place.addEventListener('click', favPlace);
function favPlace(evt) {
evt.preventDe... | true |
0bebacc00f03105e50d01028579e83d42c4ae387 | JavaScript | gabriel-vasque/aprendendoaprogramar | /6 Curso JS/Fundamentos/booleanos.js | UTF-8 | 1,040 | 3.859375 | 4 | [] | no_license | let isAtivo = false
console.log(isAtivo)
isAtivo = true
console.log(isAtivo)
//não reconhece isAtivo como boolen
isAtivo = 1
console.log(!!isAtivo)
//para inteiros, uma ! nega a variável, e !! retorna o valor dela
//os verdadeiros...
console.log('retornam valor verdadeiro...')
console.log(!!3)
console.log(!!-1)
con... | true |
558e1520727c0d6d8c5a25ef05ad6d6c11c0d4da | JavaScript | spencermountain/compromise | /tests/one/change/hyphenate.test.js | UTF-8 | 2,108 | 2.796875 | 3 | [
"MIT"
] | permissive | import test from 'tape'
import nlp from '../_lib.js'
const here = '[one/hyphens] '
test('hyphen-tokenize', function (t) {
let r = nlp('super-cool work')
t.equal(r.terms().length, 3, here + 'super, cool')
t.equal(r.out('text'), 'super-cool work', here + 'preserve hyphen')
t.equal(r.out('normal'), 'super cool wo... | true |
e788f49233e9ae90f2453c122fe768c76b35728a | JavaScript | jrosales90/test-gb | /server-test/routes/index.js | UTF-8 | 2,839 | 2.6875 | 3 | [] | no_license | const mongoose = require('mongoose');
const User = mongoose.model('users');
const API_URL = '/api/user';
const API_SUM = '/api/sum';
const ID_PREFIX = '/:id'
const BAD_REQUEST = 400;
const OK = 200;
const CREATED = 201;
const ACCEPTED = 202;
module.exports = (app) => {
app.get(API_URL, async (req, res) => {
... | true |
c99fc83d6b3b85e996ab1ffcdfacdfe77ade5f93 | JavaScript | Mansfield-R/Final-Submission---Dev10 | /lucky-sevens/luckySevens.js | UTF-8 | 1,502 | 3.90625 | 4 | [] | no_license | // Begin Function
function luckySevens() {
var initialAmount = 25; // <--- I couldn't properly figure out how to use:
// getElementsByClassName('className') but if you run this in a terminal the function works.
var amountHistory = [initialAmount];
var rollCount = 0;
//Begin loo... | true |
01cafb0fa453e6f4a5f12ef516da0443e3042405 | JavaScript | crazydoglady/crazydoglady.github.io | /HarveyFilms/scripts/harveyFilms.js | UTF-8 | 546 | 2.828125 | 3 | [
"MIT"
] | permissive | $(document).ready(function($) {
$('.tab').click(function() {
var $tab = $(this); /*store tab we click on in variable */
var index = $tab.index(); /*index of <li. we just clicked */
var $tab_content = $('.tab-section').eq(index); /*grab respective tab-section at same index*/
if ( !$ta... | true |
b2339c76186e728681e68a70afac4a8ef899debe | JavaScript | stevekevin1005/flycan-f2e | /excercise/1-9/main.js | UTF-8 | 314 | 2.734375 | 3 | [] | no_license | window.onload = function() {
var photos;
var req = new XMLHttpRequest();
req.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
photos = JSON.parse(this.responseText);
}
}
req.open('GET', 'photos.json', false);
req.send();
}
| true |
b9ef2df921edf83465be8b6ba556a7709ce57205 | JavaScript | alanross/basics | /Source/React/src/chat/server.js | UTF-8 | 1,561 | 2.625 | 3 | [] | no_license | var fs = require( 'fs' );
var path = require( 'path' );
var express = require( 'express' );
var bodyParser = require( 'body-parser' );
var app = express();
var COMMENTS_FILE = path.join( __dirname, 'comments.json' );
app.set( 'port', (process.env.PORT || 3000) );
app.use( '/', express.static( path.join( __dirname, '... | true |
7ed563161401638638a71dcee6aac453377b85ca | JavaScript | jasonawise/Form-Validation | /js/main.js | UTF-8 | 842 | 3 | 3 | [] | no_license | var fname = document.getElementById('fname');
var lname = document.getElementById('lname');
var email = document.getElementById('email');
var phone = document.getElementById('phone');
var dob_month = document.getElementById('dob_month');
var dob_day = document.getElementById('dob_day');
var dob_year = document.getEleme... | true |
047ac5d775af36fab8727c18d839dfa2cacc4520 | JavaScript | thegreenwebfoundation/datasets | /transport/train/specific/electric/default.js | UTF-8 | 1,423 | 2.578125 | 3 | [
"MIT"
] | permissive | var gwpCH4 = dataFinder.getDataItemValue('planet/greenhousegases/gwp','gas=CH4','GWP'); //global warming potential for CH4
var gwpN2O = dataFinder.getDataItemValue('planet/greenhousegases/gwp','gas=N2O','GWP'); //global warming potential for N2O
// establish if country specified
try {
var c=country;
}
catch(err)... | true |
6f5cf7ee5dfcfb7118cc6cc84afaa01a61da4c72 | JavaScript | tjhgit/scriptcraft_js | /plugins/stomp.js | UTF-8 | 614 | 2.6875 | 3 | [] | no_license | exports.stomp = function() {
events.playerMove(do_stomp);
}
function do_stomp(evt) {
var me = evt.getPlayer();
var loc = me.getLocation();
var nearbyEntities=me.getNearbyEntities(10,10,10); // ?????
var n = nearbyEntities.size();
//echo(me,'in stomp');
for(var i_index=0; i_index<n;i_index+... | true |
c6fe00b1eb3fe073256a7fe14cbc2290e33346a1 | JavaScript | Riadji/week3 | /excercise15_mengelompokkan_hewan.js | UTF-8 | 835 | 3.640625 | 4 | [] | no_license | function groupAnimals(animals) {
var arr = [];
for(i = 0; i < animals.length; i++) {
var a = animals[i].toLowerCase().charAt(0);
if(arr.includes(a) == false) {
arr.push(a);
}
}
arr.sort();
var ar = [];
for(j = 0; j < arr.length; j++) {
ar.push([]);
}
for(k = 0; k < animals... | true |
5eef2e585ffc2e9ffc21410ffbf10c1fc06b65e2 | JavaScript | aceteam-tech/TeamHealthCheck-mobile | /screens/Teams/TeamDashboard/current-results.js | UTF-8 | 685 | 2.984375 | 3 | [] | no_license | function sortResults(categories) {
return categories.slice().sort((a, b) => a.value - b.value)
}
export const getResults = (currentResults, comparedResults) => {
const sorted = sortResults(currentResults)
const results = comparedResults ?
addPreviousValues(sorted, comparedResults) :
sorted... | true |
89e6690576a294d78e691168d64160d06af07363 | JavaScript | abelalonso/super-mario | /script.js | UTF-8 | 3,165 | 3.09375 | 3 | [] | no_license | window.onload = function() {
document.getElementById("start-button").onclick = function() {
var game = new Game("canvas");
game.start();
$("#start-button").css({"pointer-events": "none"}).blur();
};
};
function Game(canvasID){
this.canvas = document.getElementById(canvasID);
this.fps = 60;
this.c... | true |
21cb9f209168db93d8af8626775bb494bccc610e | JavaScript | Henr1queNogueira/pagamento-MercadoPago | /controllers/indexController.js | UTF-8 | 1,889 | 2.59375 | 3 | [] | no_license | const Usuario = require('../models/Usuario.js');
const bcrypt = require('bcryptjs');
module.exports = app => {
//Pag Principal
app.get('/', (req, res) => {
res.status(200).render('index');
});
//TELA DE LOGIN
app.get('/login', (req, res) => {
var ms... | true |
7fd6dbc70c93a080f32543ba8af314374d06cb36 | JavaScript | asksonar/chrome | /app/javascripts/audio/speech_recognition.js | UTF-8 | 2,495 | 2.875 | 3 | [] | no_license | function SpeechRecognition(studyStart) {
this.studyStart = studyStart;
this.init();
}
SpeechRecognition.prototype.init = function() {
this.results = [];
}
SpeechRecognition.prototype.start = function() {
//console.log(Date.now() + ": Starting new speech" );
this.recognition = new webkitSpeechRecognition();
... | true |
84c4144b9cd7c18977db33cf35230b0aa5a3d0c3 | JavaScript | msmithnova/DEV283x | /csv-to-json/csv-to-json-e.js | UTF-8 | 3,282 | 3.453125 | 3 | [] | no_license | // needed requires
const fs = require('fs');
const path = require('path');
// test command line options
processArgs(process.argv);
// set filename to command line option or default
let fileName = process.argv[2] || 'customer-data.csv';
// set full system path to file
let fullPath = path.join(__dirname, fileName);
l... | true |
e2c2686e709bb41bb0ac688a75428b658db177b2 | JavaScript | airum82/game-time | /lib/Character.js | UTF-8 | 538 | 3.359375 | 3 | [] | no_license | class Character {
constructor(img, x, y, width, height, velocity) {
this.img = img;
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.velocity = velocity;
}
animate(context, color) {
context.clearRect(this.x, this.y, this.width, this.height);
context.fillStyle... | true |
ddc7bcade39ed6a598f4ae15c1d26d384a3ca3a4 | JavaScript | iouoi/browserCompatibilty | /server/index.js | UTF-8 | 1,347 | 3.015625 | 3 | [] | no_license | const express = require("express");
const path = require("path");
// this is our production server for servimg index.html and bundle
const app = express();
const PORT = 3000;
// app.use(express.static(path.join(__dirname, "../build")))
app.get('/', (req, res)=>{
res.sendFile(path.join(__dirname, "../build/index.htm... | true |
6697110eadd4dec1d98ba8f5d79e852a9806b410 | JavaScript | 86Hydrant/RobotQuotes | /app.js | UTF-8 | 1,570 | 3.421875 | 3 | [] | no_license | import mrRobotQuotes from "./robotquotes.js";
const robot = new p5.Speech(); // speech synthesis object
// make a function for generating the quote on click
const generateQuote = () => {
//create a p element for the text and append it to the container element
document.getElementById("textWrapper").innerHTML = "";... | true |
a9dbfd6b8fac7b0bd89a0aff5832f1fa509c058f | JavaScript | penny95/News-API | /index.js | UTF-8 | 1,577 | 3.28125 | 3 | [] | no_license | const Request = require("request");
console.log("Please select The News Source:\n");
console.log("1. The New York Times\n2. CNN\n3. USA Today\n4. NBC News");
process.stdin.once('data', (newsSource)=>{
var newsSource = Number(newsSource);
function newsApi () {
if(newsSource === 1){
Req... | true |
ac116121623a6581330d122fdf37b2e16f92629a | JavaScript | emilieshen/COGS-120 | /static/function.js | UTF-8 | 560 | 2.921875 | 3 | [
"MIT"
] | permissive | $(document).ready(function() {
var prev = 0;
$('#spin').click(function() {
var rand = Math.floor(Math.random() * 3);
while (rand === prev) {
rand = Math.floor(Math.random() * 3);
}
prev = rand;
if (rand === 0) {
$('img').attr('src', 'http://lorempixel.com/400/200/food');
//prev = ... | true |
b4972c24fb49d1ded15d3003deb42baf0c131a42 | JavaScript | Cooteekoola/frappe | /lesson03/dop/tempCodeRunnerFile.js | UTF-8 | 92 | 2.671875 | 3 | [] | no_license | function newFunction (argument) {
console.log("Здесь строка!")
}
newFunction(); | true |
87c0ff8ec265aba85ca47d663f3f862d1543b8ba | JavaScript | Jarek0/battleCraftFrontEnd | /src/components/accountPanel/registrationPanel/validator/RegisterValidator.js | UTF-8 | 1,858 | 2.703125 | 3 | [] | no_license | import checkIfObjectIsNotEmpty from "../../../../main/functions/checkIfObjectIsNotEmpty";
import validateAddress from './../../../entityPanel/validators/AddressValidator'
export default (entity) => {
let validationErrors = {};
let fieldErrors = {};
console.log("username:");
console.log(entity.nameChan... | true |