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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
60c3b1ac98d66a8f9ba7db800f20ae8d1428e931 | JavaScript | Webfreshener/ofs-utils | /src/string.test.js | UTF-8 | 485 | 2.59375 | 3 | [
"MIT"
] | permissive | "use strict";
import {Str} from './string';
describe("Str-Utils Tests", ()=> {
it("should capitalize string", ()=> {
expect(Str.capitalize("test")).toBe("Test");
});
it("should strip null characters", ()=> {
expect(Str.stripNull("A\0Z").length).toBe(2);
});
it("should escape regexp ... | true |
0a52110d95b30f6a0171ca0ee6ab98e973760f3d | JavaScript | kedikebba/CS427Assignment06 | /js/code.js | UTF-8 | 2,363 | 3.3125 | 3 | [] | no_license | window.onload = function(){
let biggerDecoId = document.getElementById("biggerDeco");
let textAreaId = document.getElementById("textArea");
let checkBoxId = document.getElementById("checkbox");
let pigLatinId = document.getElementById("pigLatin");
let malkovitchId = document.getElementById("m... | true |
d9dcda26d47164e4c0b5f591b56fb967cc38cd2f | JavaScript | misha-panyushkin/aloudly.education | /web/public/scripts/Helpers/Sound2CanvasLibrary.js | UTF-8 | 4,447 | 2.671875 | 3 | [] | no_license | import _ from 'lodash'
import 'Libs/Adapter'
import USER_MEDIA from 'Helpers/UserMedia'
import AUDIO_CONTEXT from 'Helpers/AudioContext'
export default class Sound2CanvasLibrary {
constructor (canvas, visualizationType, extraParams) {
Object.assign(this, {
canvas,
context: canvas.ge... | true |
482b74e11f843ce202ec88d1a9a9288588dc05b1 | JavaScript | xuyangHan/FreeCodeCamp-Data-Visualization | /Visualize data with a bar chart/main.js | UTF-8 | 3,019 | 2.953125 | 3 | [] | no_license | // get gdp json data
const req = new XMLHttpRequest();
req.open("GET", 'https://raw.githubusercontent.com/freeCodeCamp/ProjectReferenceData/master/GDP-data.json', true);
req.send();
req.onload = function() {
// get date and gdp pair
const json = JSON.parse(req.responseText).data;
// set size of the chart
... | true |
fb52b1ebb3c9a9184e53ff3d15e895b7508d8d0b | JavaScript | chrisblossom/hangman | /server/reducers/hangman/index.js | UTF-8 | 427 | 2.515625 | 3 | [] | no_license | import {fromJS} from 'immutable';
import {restart, next, guess} from './core';
import storedState from 'server/state.json';
import {RESTART, NEXT, GUESS} from './constant';
export default function reducer(state=fromJS(storedState), action){
switch (action.type) {
case RESTART:
return next(restart(state));
case NE... | true |
d03539fffb37bc10c996ef51cabd3f9f620594a9 | JavaScript | vtkrishn/leetcode-helper | /test/test.js | UTF-8 | 8,415 | 3.25 | 3 | [
"MIT"
] | permissive | 'use strict';
var expect = require('chai').expect;
var helper = require('../index');
describe('#leetcode-helper.createTree', function() {
//test createTree function
it('should create a tree for the structure', function() {
var result = helper.createTree("1,2,3");
... | true |
65920c74d601e949f8c49d3d4f62b3f9fc310772 | JavaScript | bimberman/practice-javascript | /Codesignal/Intro/Smooth Sailing/allLongestStrings.js | UTF-8 | 383 | 3.453125 | 3 | [] | no_license | function allLongestStrings(inputArray) {
let res = [];
let longestString = 0;
console.log(inputArray)
for (let i = 0; i < inputArray.length; i++) {
if (inputArray[i].length > longestString) {
res.splice(0);
}
if (inputArray[i].length >= longestString) {
res.push(inputArray[i]);
lo... | true |
29ec4f16bf515ba092a3f48bd0fbbb2034076b00 | JavaScript | CrissDefaz001/AppWEB_GR1_2019A | /03_Funciones/01_Funciones.js | UTF-8 | 2,187 | 4.46875 | 4 | [] | no_license | // Funciones JavaScript
function holaMundo() {
console.log("Hola Mundo !!");
}
holaMundo();
//console.log(holaMundo()); //undefined
// Las funciones pueden devolver un valor indefinido. No siempre lo esperado
// función con parámetros:
function sumar(num_1, num_2){
let esNumero_num_1 = typeof num_1 == "numbe... | true |
f1d9f418f08f21ffe5482b08a53ede84008062ff | JavaScript | h1l1ch/Hackerrank | /findMedian.js | UTF-8 | 721 | 4.40625 | 4 | [] | no_license | /*
HACKERRANK problem.
Title: "Find the Median"
Difficulty: "Easy".
Link: https://www.hackerrank.com/challenges/find-the-median/problem
The code is fully functional and passed 100% tests.
To test it you have two options:
1) Launch given code only passing your own "array" value.
2) Copy&Paste code on Hackerrank to make... | true |
831fde0f4940f76c0548ee99e15d402587951d26 | JavaScript | Sarath754/MeanStack- | /JavaScriptPrograms/object_oriented_programming/person.js | UTF-8 | 828 | 3.78125 | 4 | [] | no_license | //class=>blue print,plan,design,pattern for build a construction //22/12/2020 [22] 6:25
//object=>real world entity.............eg-(mi tv) mi is the object and tv is the class
//reference=>remote is the refrence taking any task in the object
class person{
setPerson=(age,names,gender)=>{
this.... | true |
2792e84d7d5d2840a4b05833393243e41f7e1ea3 | JavaScript | weilu/functional-javascript-workshop | /problems/basic_reduce/solution.js | UTF-8 | 548 | 3 | 3 | [] | no_license | function map(arr, fn, context) {
// don't forget the other arguments to both Array#map
// and the function you pass to it!
// I didn't check for them in the test but give yourself a
// pat on the back if you thought about them!
//
// See:
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Referenc... | true |
2aae6e2ac6e9158c5dbedd362dc9803089c14cc4 | JavaScript | yrosalesd/Curso-js-moderno | /38-PROYECTO-PixabayImagenes/js/app.js | UTF-8 | 4,818 | 3.171875 | 3 | [] | no_license | const resultado=document.querySelector('#resultado');
const formulario=document.querySelector('#formulario');
const paginacionDiv=document.querySelector('#paginacion');
const registrosPorPagina= 40;
let totalPaginas; //para que este disponible en todas la funciones
let iterador;
let paginaActual=1;
window.onloa... | true |
82bdc789c9ce3c5ff0b1acf6c332413e6f39b029 | JavaScript | BSidesSF/ctf-2019-release | /cloud2clown/challenge/src/static/butterbar.js | UTF-8 | 1,771 | 2.6875 | 3 | [
"MIT"
] | permissive | (function() {
var processedUrl = document.currentScript.getAttribute('data-base-url');
console.log(processedUrl);
var bar = document.createElement("div");
var p = document.createElement("p");
p.appendChild(document.createTextNode("Page rendered by Cloud2Clown."));
bar.appendChild(p);
var btn = document.cr... | true |
feffe67ce6e1155ee5f19ae90fc9bd742c2d4c38 | JavaScript | Thabai/Drum-kit | /script/drums.js | UTF-8 | 1,217 | 3 | 3 | [] | no_license |
function playSounds(e) {
// Get element that matches the key pressed
const audio = document.querySelector(`audio[data-key="${e.keyCode}"]`);
if (!audio) return; // Stop function from running all together
this.playSound(audio.id);
}
window.addEventListener('keydown', playSounds);
function bigSmall(e... | true |
f7113b28115c69ced2d115caf200bee27b547892 | JavaScript | hrgdavor/mi2js | /src/Base.js | UTF-8 | 18,342 | 2.78125 | 3 | [
"MIT"
] | permissive | (function(){
/**
<p>Event object used for firing events inside components</p>
<p><b>src and target are added automatically, you can not pass them to fireEvent</b></p>
<p>If you listen to 'submit' event on a Form, src will be the input that originated the 'submit' event
and target will be the Form</p>
@typedef Even... | true |
e56ef2cef38c39e716d361c6e72005dd44d2c161 | JavaScript | marchenkoe/luxoft_react | /js/Components/user-details.js | UTF-8 | 3,579 | 2.515625 | 3 | [] | no_license | import React from "react";
import PropTypes from "prop-types";
import {GridRecord} from "./grid";
const detailsRecords = [{
id: 1,
name: "John Doe",
about: "Nice guy",
hobby: "Likes drinking wine",
skills: ["html", "javascript", "redux"]
}, {
id: 2,
name: "Mary Moe",
about: "Cute girl"... | true |
5c9c3bc4e795b78167828dad49cb336d470ac3c5 | JavaScript | rmachamerschool/JSINTERN | /strictSoft.js | UTF-8 | 626 | 3.71875 | 4 | [] | no_license | //Rebecca Machamer //strictSoft.js
//Febuary 2 2019 //JSINTERN
//Write a JavaScript program to check if three given numbers (integers) are increasing in strict mode and
//flag is "false", however if "true" is false the numbers will soft mode. Note: Strict mode-> 10, 15, 31:
//Soft mode -> 24, 22, 31 or 22, 22, 31
//#... | true |
b42618209993557b8a94c18f5cce357db1432753 | JavaScript | JStephenD/ITPWebsite | /assets/js/tracing/employee_log.js | UTF-8 | 6,653 | 2.6875 | 3 | [] | no_license | if (typeof form == 'undefined') {
let form = document.querySelector('#employee-log-form');
let url = window.location.href;
let date_input = $('#date');
let time_input = $('#time');
let set_current_time = $('#set-current-time');
date_input.on('keydown', () => false);
time_input.on('keydown'... | true |
a2e69c9e8a9a0e110f00bf7130f787434dd8bd2e | JavaScript | nyx-code/node-chat-app | /server/utils/users.test.js | UTF-8 | 1,751 | 2.890625 | 3 | [] | no_license | const expect = require('expect');
var {Users} = require('./users');
describe('Users', () => {
var users;
beforeEach(()=>{
users = new Users();
users.users = [{
id: '1',
name: 'UserOne',
room: 'Node Course'
},{
id: '2',
name:... | true |
aebf69dcad8da364336202b40a959f1482ae52cc | JavaScript | totbsb/Curso-JavaScript | /esnext/usandoPromises.js | UTF-8 | 1,863 | 4.34375 | 4 | [] | no_license | //Utilizando sem promise, usando callbacks
// Não foi usado axios porque não é o intuito, mas seria o ideal
const http = require('http')
const getTurma = letra => {
const url = `http://files.cod3r.com.br/curso-js/turma${letra}.json`
//Retorna uma Promise que executa o resolve (Dando certo) ou reject (Dando er... | true |
50aee2379f136a26fd961c634fe34be6fa450a6a | JavaScript | ommoss/Lighthouse-Work | /wk1/d3/Counting/counting.js | UTF-8 | 476 | 3.390625 | 3 | [] | no_license | var agrs = process.argv.slice(2);
function countLetters(words){
var object ={
};
for (var j = 0; j < words.length; j++){
var letterArray = words[j].split("");
if(letterArray[j] === " "){
}
for(var i = 0; i < letterArray.length; i++){
var x = letterArray[i]
if(object[x] === undefined){
... | true |
b054796a13c0108f46cc12eff424dcc6fcae4346 | JavaScript | wucheng666/RNDemo | /src/modules/network/http.js | UTF-8 | 1,018 | 2.53125 | 3 | [] | no_license | /**
* http请求
*/
import assign from 'object-assign';
export default (url, req, method) => {
if (!method || (method.toUpperCase() != 'GET' && method.toUpperCase() != 'POST')) {
method = 'GET';
}
let request = {
method: method.toUpperCase(),
headers: {
'Accept': 'applic... | true |
37235a735700eed2ac51cbd4a52e1673a89082e0 | JavaScript | NadiiaMatsko/goit-js-hw-07 | /js/task-06.js | UTF-8 | 553 | 3.296875 | 3 | [] | no_license | const input = document.querySelector("#validation-input");
input.addEventListener("blur", fnChange);
function fnChange({ target }) {
if (target.value.length === Number(target.dataset.length)) {
updateClass("valid", "invalid");
// target.classList.add("valid");
// target.classList.remove("invalid");
... | true |
e621c3a2c7951c1a7a5f99d91c621a5d851d9cee | JavaScript | omshivaprakash/gaia | /tv_apps/smart-system/js/input_layouts.js | UTF-8 | 5,949 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | /* global KeyboardHelper */
'use strict';
(function(exports) {
/**
* InputLayouts is responsible for processing and bookkeeping layouts returned
* from KeyboardHelper for use by KeyboardManager.
*/
var InputLayouts = function(keyboardManager, TYPE_GROUP_MAPPING) {
this._keyboardManager = keyboardMan... | true |
1351146515643a11822fba3a945dfc1841daf767 | JavaScript | junioryauricasa/sistema1 | /js/valida.js | UTF-8 | 2,706 | 3.15625 | 3 | [] | no_license | window.onload = function(){
var form = document.getElementById("formulario");
var txt = document.getElementsByTagName("input");
for(var i=0;i<txt.length;i++){
if (txt[i].type == "text") {
foco(txt[i].id);
desel(txt[i].id);
}
}
//form.addEventListener("submit",val... | true |
8be045427079444f5399f16b1ece3c19a1c841f3 | JavaScript | ems-git/mayapark | /frontend/src/components/Index/Home/OpenBtn.js | UTF-8 | 1,426 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react';
import moment from 'moment';
import 'moment/locale/fr';
export default class OpenBtn extends Component {
/** VALUE OF BUTTON DEPENDING WITH USER SELECTION */
isDate=()=>
{
return (this.props.btnValue !== "Début" && this.props.btnValue !== "Fin") ?
... | true |
43f9e32979641c460663fa0de3b2d40fd433b5d8 | JavaScript | Faris-hehe/Hquery | /Hquery.js | UTF-8 | 5,735 | 2.921875 | 3 | [] | no_license | /**
* Created by Administrator on 2016/1/9.
*/
function bindEvent(obj,events,fn){
if(obj.addEventListener){
obj.addEventListener(events,fn,false);
}
else{
obj.attachEvent('on'+events,fn);
}
}
function getStyle(obj,attr){
if(obj.currentStyle){
return obj.currentStyle[attr];
... | true |
dd1f650ac8f1b5db6bc921d7835d0a3adb91782c | JavaScript | shevkenov/softuni | /JavaScript/js-fundamentals/07.Arrays-and-Matrices-Exercise/05.Extract-Increasing-Subsequence-from-Array.js | UTF-8 | 256 | 3.125 | 3 | [] | no_license | function solution(arr) {
let currentElement = arr[0]
console.log(arr.filter(function (el) {
if(el >= currentElement){
currentElement = el
return true
}
}).join('\n'));
}
solution([1,3,8,4,10,12,3,2,24,]) | true |
04c0d8da96fa0fd7f3eba3a0cfecd9d8b2acbbfb | JavaScript | himanshugt90/toDoandCovid | /force-app/main/default/lwc/toDoManager/toDoManager.js | UTF-8 | 2,675 | 2.890625 | 3 | [] | no_license | import { LightningElement,track } from 'lwc';
import addTask from '@salesforce/apex/toDoController.addTodo';
import getCurrentTodos from '@salesforce/apex/toDoController.getCurrentTodos'
export default class ToDoManager extends LightningElement {
@track time;
@track greetings;
@track tasks=[];
connecte... | true |
87ddd86885fcd99b1b0965f8aef7be8523a29fe1 | JavaScript | aslakhol/taletid | /js/main.js | UTF-8 | 796 | 2.671875 | 3 | [] | no_license | import { selectStylesheet } from "./stylesheet-selection.js";
import { toggleTimerHighlight } from "./highlight.js";
import { startTimer, stopTimer } from "./timer.js";
let timerRunning = false;
let interval;
const toggleTimer = () => {
if (timerRunning) {
stopTimer(interval);
timerRunning = false;
} else... | true |
454a7a47088e0d86ad3bd60d3256d90eebd8769a | JavaScript | acouette/giteway | /src/main/webapp/resources/js/giteway-repository.js | UTF-8 | 3,999 | 2.78125 | 3 | [] | no_license | //variable to keep track of which view is displayed
var currentView = "#timeline";
// intitialize view : timeline
$(document).ready(function() {
// initialize radio button behaviour
$("#radio").buttonset();
$("#timeline-radio").click(function() {
setView('#timeline');
});
$("#activity-radio").click(function() ... | true |
625b84a841881aa2baa10f84133bf2fa7bf72937 | JavaScript | rjavier3/my-school-works | /sept2019-meme-generator/js/main.js | UTF-8 | 1,713 | 3.375 | 3 | [] | no_license | // Enter your JavaScript for the solution here...
let selectMeme = document.getElementById("meme-image");
let inputTextTop = document.getElementById("meme-top-text");
let inputTextBottom = document.getElementById("meme-bottom-text");
let memeForm = document.querySelector("form.meme-form");
let image = document.querySe... | true |
a68a7d4c71b1ee7921b51986f920d1e048b7cb32 | JavaScript | ZackAttax/expenses-frontend | /src/reducers/accountReducer.js | UTF-8 | 1,067 | 2.546875 | 3 | [] | no_license | //import { fetchAccounts } from "../actions/fetchAccounts";
export default function accountReducer(state = {accounts: []}, action) {
switch (action.type) {
case 'FETCH_ACCOUNTS':
return {accounts: action.payload}
case 'ADD_ACCOUNT':
return {...state, accounts: [...state.acco... | true |
00825a532760adeb8192f3f98b138b49cb4c8f26 | JavaScript | Nebosmile/nodeTrainer | /server/user/index.js | UTF-8 | 445 | 2.515625 | 3 | [] | no_license | var db =require('../db');
var log = require('../logger')(module);
var util = require('util');
var obj = {
a:5,
b:6,
inspect:function(){
return 123;
}
}
console.log(util.inspect(obj));
console.log("My %s %d %j", "string", "...",{test:'obj'});
function User(name) {
this.name=name;
}
User.proto... | true |
7844c1cf91c016c74d454c3979ab73ba2719ef6e | JavaScript | moon2019wang/es6_test | /app/js/class/model.js | UTF-8 | 422 | 2.71875 | 3 | [] | no_license | // export let A = 123;
// export function test(){
// console.log('test');
// }
// export class Hello{
// test(){
// console.log('hello class');
// }
// }
let A = 123;
function test(){
console.log('test');
}
class Hello{
test(){
console.log('hello class');
}
}
// 推荐使用这种方式导出,... | true |
3b9f7c5841774e530263b680abdb1a411dda3b14 | JavaScript | eeshangarg/COMP4770 | /client/Sprite.js | UTF-8 | 1,089 | 3.015625 | 3 | [
"MIT"
] | permissive | import {spriteLoaded} from './Assets.js';
let ctx = document.getElementById('gameCanvas').getContext('2d');
// The object class to handle sprites, which area a extension of images.
class Sprite {
// Create a spirte based of Assets.json.
constructor(spriteName, imgSrc, frameCount) {
var self = this;
... | true |
e3bbf1b63f5910bdc13545cda4ecf7e91f44a9d4 | JavaScript | alysyuk/dots | /lib/models/user.js | UTF-8 | 1,098 | 2.78125 | 3 | [] | no_license | var crypto = require('crypto');
module.exports = function(db) {
var User = function() {};
//
// Locate a user by a user name
//
User.findByUser = function(userName, callback) {
db.collection('users').findOne({userName: userName}, callback);
};
//
// Locate a user by user name and password
//
... | true |
8548e6c8ce2a018bfc1250e52d87abc06252bb6f | JavaScript | maira1001001/deep-javascript-v3 | /objects-exercises/this/hardBinding.js | UTF-8 | 261 | 3 | 3 | [] | no_license | /** @format */
// Hard binding
workshop = {
teacher: 'Kyle',
ask: function ask(question) {
console.log(this.teacher, question);
},
};
setTimeout(workshop.ask.bind(workshop), 2000, 'Hard bound this?');
setTimeout(workshop.ask, 4000, 'Lost this?');
| true |
96fe2ca8ad2cb3edd2acc8249232462b905a7a29 | JavaScript | istamosh/Simple-Hybrid-Socket-Chat | /userMan.js | UTF-8 | 1,711 | 3.34375 | 3 | [
"MIT"
] | permissive | const users = [];
function addUser({ id, name }) {
const user = { id, name };
users.push(user);
return;
};
// find user within users array using incoming id param. by matching
// their id inside the pool.
function getUser(id) {
return users.find((user) =>
user.id === id);
};
const updateUser = (id, data) =... | true |
f4e1929345912607c41e58e0cec13f586f8cd7ac | JavaScript | lmh0506/nodeJsStudyfirst | /Nunjucks.js | UTF-8 | 1,431 | 2.78125 | 3 | [] | no_license | 'use strict'
const nunjucks = require('nunjucks');
function createEnv(path,opts){
var autoescape = opts.autoescape && true,//给每个参数设置默认值
noCache = opts.noCache || false,
watch = opts.watch || false,
throwOnUndefined = opts.throwOnUndefined || false,
env = new nunjucks.Environment(
... | true |
bd29af6618ccff6d2e8adc167f6d771dae542d2d | JavaScript | qronix/chatbox | /src/components/chat-box-container/chat-box.container.jsx | UTF-8 | 5,484 | 2.53125 | 3 | [] | no_license | import React, {useState, Fragment, useEffect} from 'react';
import ChatBubble from '../chat-bubble/chat-bubble.component';
import ChatStartForm from '../chat-start-form/chat-start-form.component';
import ChatBoxHeader from '../chat-box-header/chat-box-header.component';
import ChatBox from '../chat-box/chat-box.compon... | true |
c7f5e49bf4140526fdadf7c083e2e9e66353f1ea | JavaScript | Walter1412/2016_10_maybelline_eyes | /src/lib/TransformTool/TransformCanvasPictures.js | UTF-8 | 7,692 | 2.609375 | 3 | [
"MIT"
] | permissive | function App() {
this.canvas = document.getElementById("canvas2");
this.ctx = this.canvas.getContext("2d");
this.displayList = [];
this.tool = new TransformTool(this.ctx);
this.bindHandlers();
this.loader = new ImagesLoader(this.handleImagesLoaded);
// this.loader.load([
// "./img/_d... | true |
1c5ea6b882650aa045cd7c12059ee6be0a801c77 | JavaScript | Tigronix/raz-new | /src/actions/product.js | UTF-8 | 621 | 2.546875 | 3 | [] | no_license | // get product
const productGetRequested = () => {
return {
type: 'GET_PRODUCT_REQUEST'
};
};
const productGetLoaded = (product) => {
return {
type: 'GET_PRODUCT_SUCCESS',
payload: product
};
};
const productGetError = (error) => {
return {
type: 'GET_PRODUCT_FAILURE',
payload: error
}... | true |
0f8b744bded04432842e1f0a9362e104cc7c91f4 | JavaScript | MikailaAkeredolu/es6bookapp | /app.js | UTF-8 | 4,067 | 3.578125 | 4 | [] | no_license | //Book Constructor
function Book(title, author, isbn){
this.title = title;
this.author = author;
this.isbn = isbn;
}
//Ui Constructor
function UI(){}
//Ui prototype creation
UI.prototype.addBookToList = function(book){ //takes book object
const list = document.getElementById('book-list');
//create... | true |
b6cc746475c2a1f4d69d1894c9a082e6aef49574 | JavaScript | trickii/photos | /src/js/app.js | UTF-8 | 3,416 | 2.734375 | 3 | [] | no_license | "use strict";
class App {
constructor(albums) {
this.locale = 'de';
this.gallery = null;
this.albums = albums;
this.album = null;
if (!this.detectTouch()) {
document.querySelector('body').classList.add('notouch');
}
this.initAlbums();
th... | true |
ae1aa4ebb84f89bc3b5e379e76c92a9303846561 | JavaScript | bw-water-my-plants/water-my-plants-BE | /src/controllers/plantsController.js | UTF-8 | 5,737 | 2.578125 | 3 | [
"MIT"
] | permissive | require('dotenv').config();
const uuid = require('uuid');
const Plants = require('../database/helpers/plants');
async function createPlant(req, res) {
const { name, watering_frequency, last_watered_at } = req.body;
if (!name || !watering_frequency || !last_watered_at) {
return await res.status(400).jso... | true |
e39387c4bcfa7ded7fed8a6ec7a1bb5e8dac3222 | JavaScript | NamesAreStupid/CS-GO-WeaponChallenge | /Util/test.js | UTF-8 | 720 | 4.09375 | 4 | [] | no_license | var arrays = require('./Arrays.js');
/*
var array = [1,2,3,4];
arrays.forEach(array, function(element) {
element = 0;
console.log(array);
return false;
});
*/
var array = ["Cat", "Dog", "Fish"];
/*
var dogFilter = function(element) {
if(element != "Dog") {
return true;
} else {
return false;
}
};
var catFi... | true |
927343ed2444520bebc55dc0f5b9eec619e0ae3a | JavaScript | NevesLucas/411_Project | /app_api/controllers/user.js | UTF-8 | 804 | 2.515625 | 3 | [] | no_license | var Boom = require('boom'),
User = require('../models/user').user;
var mongoose = requires("mongoose");
exports.getUser = function (request, reply){
var queryTxt = new RegExp('^'+request+'$', "i");
user.find({ name: queryTxt }, function (err, doc) {
if (!err) {
console.log("Query user:... | true |
03835f31245e281801a14fde20a073228a0627d8 | JavaScript | tlam212/javascript-arithmetic-lab-js-intro-000 | /index.js | UTF-8 | 362 | 2.90625 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | function add(a,b) {
return a + b
}
function subtract(a, b) {
return a - b
}
function multiply(a, b) {
return a * b
}
function divide(a, b) {
return a / b
}
function inc(a) {
return ++a
}
function dec(a) {
return --a
}
function makeInt(a) {
var toString = parseInt(a, 10)
return toString
}
function pre... | true |
43e1b940f8d585cff7729c0c9e72495e9f6f8569 | JavaScript | jhans3br/coating-guide | /src/components/charts/coating-viscosity-chart.js | UTF-8 | 5,792 | 2.6875 | 3 | [] | no_license |
import { LitElement, html } from '@polymer/lit-element';
import { connect } from 'pwa-helpers/connect-mixin.js';
import { store } from '../../store.js';
import { select } from 'd3-selection';
import { scaleLinear } from 'd3-scale';
import { axisBottom, axisLeft } from 'd3-axis';
import { line, curveNatural } from 'd... | true |
08bfd698cb2474cbe24a4a09724c229753ad078d | JavaScript | thunder913/JS-Applications | /2. REST services and AJAX/03.PHONEBOOK/app.js | UTF-8 | 3,426 | 3.34375 | 3 | [] | no_license | function attachEvents() {
let loadButton = document.querySelector('#btnLoad');
let createButton = document.querySelector('#btnCreate');
let getOrPostURL = `https://phonebook-nakov.firebaseio.com/phonebook.json`;
let ulPeople = document.querySelector('#phonebook');
let personI... | true |
c0402da4993c3139f197180c2e8f06fe02908ffb | JavaScript | RajeshJangid911/WordMean-public | /server.js | UTF-8 | 2,659 | 2.6875 | 3 | [] | no_license | //jshint esversion: 6
const express = require("express");
const bodyParser = require("body-parser");
const request = require("request");
const app = express();
app.use(express.static("public"));
app.use(bodyParser.urlencoded({ extended: true }));
app.set("view engine", "ejs");
app.post("/", (req, res) => {
var w =... | true |
d231c245c00f606160200e8a19390445bd076794 | JavaScript | okyfunoky/whereinseattleiscarmen | /assets/scripts/getClues.js | UTF-8 | 2,371 | 3.171875 | 3 | [] | no_license | var Question = /** @class */ (function () {
function Question(answer, clue) {
this.cityName = answer;
this.clue = clue;
this.answer = false;
}
return Question;
}());
var quests;
var usedCitys = Array();
var currentQuestions = Array();
function buildQuestions(response) {
var quest... | true |
2080595a78104a10216db2eeb51a928a076b3a20 | JavaScript | Dima000/AdventOfCode-2017 | /day4/day4-test.js | UTF-8 | 410 | 2.578125 | 3 | [] | no_license | let path = require('path')
let dayName = path.basename(__filename).split('-')[0]
let source = require(`./${dayName}.js`)
let test1 = 'iiii oiii ooii oooi oooo'
let test2 = 'a ab abc abd abf abj'
let test3 = 'oiii ioii iioi iiio'
console.log('test1:')
source.secondTask(test1) // result 1
console.log('test2:')
source.... | true |
8382c24aac50a65bf3f5ce1b1821f519621c13b1 | JavaScript | hmilx90/saber-account | /src/common/js/curd.js | UTF-8 | 2,026 | 2.53125 | 3 | [] | no_license | /**
* @file 数据库基本的CRUD
* @author linjing03@
*/
define(function (require) {
var exports = {};
localforage.config({
name : 'myApp',
version : 1.0,
storeName : 'db_account', // Should be alphanumeric, with underscores.
description : 'this is a db for account'
});... | true |
09cce45ed8f823be3e9c5ccc5e5e3ce372895646 | JavaScript | google/earthengine-community | /samples/javascript/apidocs/ee-number-tanh.js | UTF-8 | 1,281 | 3.34375 | 3 | [
"Apache-2.0",
"CC-BY-4.0"
] | permissive | /**
* Copyright 2021 The Google Earth Engine Community Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required... | true |
5974baa731721229ece964aed96b913eedf31e68 | JavaScript | elena-m-writer/e-m-portfolio | /learningJS.js | UTF-8 | 1,042 | 3.25 | 3 | [] | no_license | document.getElementById("code").addEventListener("mouseover", mouseOverCode);
document.getElementById("code").addEventListener("mouseout", mouseOutCode);
document.getElementById("type").addEventListener("mouseover", mouseOverType);
document.getElementById("type").addEventListener("mouseout", mouseOutType);
document.g... | true |
bf0aad81d8aecdb509cc199b867165913d62af22 | JavaScript | jingbeibei/JS | /day33/10.11上午/01 - jQuery-Callbacks/index.js | UTF-8 | 1,892 | 3.96875 | 4 | [] | no_license | // index.js
// 创建一个回调对象
var callbacks = $.Callbacks();
// 添加一个回调函数
// 如果需要使用匿名函数的名字,可以给
// 匿名函数添加名字,加名字之后不会影响它
// 作为匿名函数被使用
// 匿名函数的名字只能在匿名函数内部使用(递归调用)
callbacks.add(function cb(){
console.log(cb);
console.log('等一会我会被调用');
});
// console.log(cb)
function sayHello(){
console.log('等一会说你好!');
}
function s... | true |
72924d43bc295f3d1afc4cc491a5bcb54ebec769 | JavaScript | jferraz84/curso-javaScript-Guanab-YouTube | /aulas/estruturasDerepeticao/aula012Ambiente.js | UTF-8 | 137 | 3.28125 | 3 | [] | no_license |
for (let i = 1; i <= 10 ; i++) {
let cont = 2;
let mult = cont * i;
console.log(`${cont} X ${i} = ${mult}`);
} | true |
63450b1ec5dad550e80f0dc6867b8e447f7d33c5 | JavaScript | smilenovel/leetcode | /113/1.js | UTF-8 | 961 | 3.25 | 3 | [] | no_license | /**
* Definition for a binary tree node.
* function TreeNode(val) {
* this.val = val;
* this.left = this.right = null;
* }
*/
/**
* @param {TreeNode} root
* @param {number} sum
* @return {number[][]}
*/
const { buildBTree } = require('../utils/BTree');
var pathSum = function(root, sum) {
let ret = [... | true |
a9dfc148836ec49b01a32269257e10fcb3d129d9 | JavaScript | mireadev/locations-on-map | /sources/js/locations/create.js | UTF-8 | 3,144 | 2.921875 | 3 | [] | no_license | //creates div for location
function createLocationDiv(id, location) {
//create div for location
var div = createElement('div', 'location');
div.id = 'location' + id;
div.style.left = location.x + 'px';
div.style.top = location.y + 'px';
//bind highlight location in menu function
div.addEven... | true |
2f31175a8f8602cdef234ba816347da586481fdf | JavaScript | fkfmzm771/carender | /test2.js | UTF-8 | 2,519 | 2.734375 | 3 | [] | no_license | function btn01(){
var base_x = 5;
var base_y = 20;
var width = 530;
var height = 10;
var recodeLen = 10;
var con = document.getElementById("content1");
var content = '<table class="table table-striped table-bordered">'
for (var i = 0; i < recodeLen; i++) {
content += '<tr>';
cont... | true |
47987a568e9af9f184b898f853aa6b69bcf28889 | JavaScript | nkeyes94/projectThreeRND | /public/js/facialRecognitionModified.js | UTF-8 | 3,453 | 3.125 | 3 | [] | no_license | // * Ensuring that the file is being loaded
console.log("hello world");
// * Document ready
$(document).ready(function(){
console.log("Hitting the file: facialRecognition.js");
const cameraImage = document.getElementById("image"); // ! Note: this image should be one from the webcam.
// * These should be r... | true |
1e583a9fd58b520d75747d6bcfde6d6982ef21bd | JavaScript | smabsout/bamazon | /bamazonCustomer.js | UTF-8 | 2,336 | 3.046875 | 3 | [] | no_license | var inquirer = require("inquirer");
var mysql = require("mysql");
//creating sql connection
var connection = mysql.createConnection({
host: "localhost",
port: 3306,
user: "root",
password: "MAB439110!!@#s",
database: "products_db"
});
connection.connect(function (err) {
if (err) throw err;
... | true |
e0701e83d55450f96177d7e2f09c5a112339e11b | JavaScript | BangkokCryp/stellar-expert-refractor | /api/business-logic/finalization/callback-handler.js | UTF-8 | 903 | 2.8125 | 3 | [
"MIT"
] | permissive | const axios = require('axios')
let callbackHandler = function (txInfo) {
const {tx, network, hash, callbackUrl} = txInfo
return axios.post(callbackUrl, {tx, hash, network})
}
/**
*
* @param {TxModel} txInfo
* @returns {Promise}
*/
async function processCallback(txInfo) {
if (!txInfo.callbackUrl) throw... | true |
a468cdf9b070164f7ecc3b94927de9f98b70b1e6 | JavaScript | VickyKoblinski/shop-keeper | /src/store/modules/items.js | UTF-8 | 2,133 | 3.203125 | 3 | [] | no_license | /** Items Module */
import items from '../../data/items';
/** Vuex - State
*
* Vuex uses a single state tree - that is, this single object
* contains all your application level state and serves as the
* "single source of truth". This also means usually you will have
* only one store for each application. A s... | true |
70a61104e232f8dc824f02e64cb6f7fdad3aa574 | JavaScript | Styles-Theandriod/igbo_api | /src/shared/utils/normalization.js | UTF-8 | 3,218 | 3.25 | 3 | [] | no_license | /* Code inspired by goodyduru/igbo-text: https://github.com/goodyduru/igbo-text */
import { forEach } from 'lodash';
import unicharadata from 'unicharadata';
/* Removes all periods and numbers */
const clean = (text) => {
if (!text) {
return '';
}
return text.replace(/[0-9+.]/g, '').trim();
};
const removeT... | true |
2a42e9338c6f339ee3a9d51fef79ce428de2c1aa | JavaScript | haasken/Courier | /Courier.js | UTF-8 | 8,805 | 3.203125 | 3 | [] | no_license | var Courier = function(posX, posY) {
/* Start out facing to the right. */
this.direction = DIRECTIONS.right;
/* Set up the images for each direction. */
this.images = new Array();
this.images[DIRECTIONS.up] = IMAGES.redCarUp;
this.images[DIRECTIONS.down] = IMAGES.redCarDown;
this.images[DIRECTIONS.left] = IMAGE... | true |
5d05ad48e4f7e03d1dbddcdc152e0ba1b8dd9914 | JavaScript | 500apps-psvnaveen/practiced_test-4_paper | /main.js | UTF-8 | 1,794 | 2.625 | 3 | [] | no_license |
// try {
// function errorshandling() {
// test = val * 45;
// console.log("test", val);
// }
// errorshandling();
// } catch (err) {
// console.log(err.message);
// }
const app = Vue.createApp({
data() {
return {
fullName1: '',
// d... | true |
6c32f1fe963d6deaa3552461471c714f689cb5ce | JavaScript | panchaldineshb/GitHubRepository | /CRUD_using_nodejs/pro_nodejs_for_developers-master/05_command_line_interface/command-line-parser-using-commander.js | UTF-8 | 429 | 2.953125 | 3 | [] | no_license | var commander = require('commander');
commander
.option("-f, --foo <i>", "Integer value for foo", parseInt, 0)
.option("-b, --bar [j]", "Integer value for bar", parseInt, 0)
.option("-z, --baz", "Boolean argument baz")
.parse(process.argv);
console.log(commander.foo);
console.log(commander.bar);
console.log(comma... | true |
02912b22a0c4f5be4a0a320ed74114fdd403a235 | JavaScript | aganovski2020/website | /ok/index.js | UTF-8 | 247 | 2.609375 | 3 | [] | no_license | function start(){
myClick();
}
function myClick() {
setTimeout(
function() {
document.getElementById('div').setAttribute("class", "style");
document.getElementById('text').setAttribute("class", "style2");
}, 8000);
} | true |
7058d6b5b9110a339e327154fc23d6d8dcccd540 | JavaScript | jm02169/blades-dashboard | /app/javascript/react/containers/GamesIndexContainer.js | UTF-8 | 1,429 | 2.609375 | 3 | [] | no_license | import React, { Component } from 'react'
import { Link } from 'react-router'
import GameTile from '../components/GameTile'
class GamesIndexContainer extends Component {
constructor(props) {
super(props);
this.state = {
games: []
}
}
componentDidMount() {
fetch("/api/v1/games", {
cred... | true |
d31842286578c3d6b4e20840ebca735579328442 | JavaScript | railwaymen/Localizar | /src/modules/apiClient.js | UTF-8 | 1,572 | 2.515625 | 3 | [] | no_license | import networking from './networking'
const toURLParameter = (parameter) => {
return parameter
? "/" + parameter
: ""
}
const Endpoint = {
locales: () => '/locales',
projects: (slug) => '/projects' + toURLParameter(slug),
sessions: () => '/sessions',
translations: (projectSlug, translationID) => '/p... | true |
2f0aa3e5bfc13e5ede01eb4915c3a1eed88f9e39 | JavaScript | chiafangcheng/chiafangcheng.github.io | /examples/3-18/3-18.js | UTF-8 | 523 | 3.078125 | 3 | [] | no_license | window.onload = function (){
var profile = {
name:'TY Chen',
age: 39,
height: 180
};
for (var key in profile){
console.log(key);
console.log(profile[key]);//這個是在profile這個物件中取得每個欄位的資料
console.log(profile.key);//這個是指在profile中拿到叫做key的變數的值 但是因為我們沒有這個欄位 故undefined
}//意思是:我去建立一個迴圈 其中的物件叫做key 而key是來自於profile這... | true |
c859940d1b182d815387e4f6b531fc91f10ccf5a | JavaScript | Yanchenyu/Javascript-Design-Patterns | /src/decorator/index.js | UTF-8 | 1,411 | 3.4375 | 3 | [] | no_license | /**
* @description 装饰器模式
* @author yancy
*/
/**
* 优点:
* 装饰类和被装饰类可以独立发展,不会相互耦合,装饰模式是继承的一个替代模式,装饰模式可以动态扩展一个实现类的功能。
*
* 缺点:
* 多层装饰比较复杂。
应用场景:
1,扩展一个类的功能。
2,动态增加功能,动态撤销。
*/
class Sale {
constructor(price) {
this.price = price;
this.decorator_list = []; // 用来存储所有的装饰器
}
... | true |
155ba75b6008d7620c8726c256e45eef2f760e7a | JavaScript | Lindsen13/Flask-Tableau-Extension-Maker | /extension_app/static/js/main.js | UTF-8 | 533 | 2.609375 | 3 | [] | no_license | image = ''
if (new URLSearchParams(window.location.search).get('reload') == "True") {
console.log('reloaded!');
image = document.getElementById("execute-button").src;
image_split = image.split("/");
image_name = image_split[image_split.length - 1];
new_image_name = image.replace(image_name, 'reload... | true |
eb2a189dd24f84b4e511551657a9f455a2732f8b | JavaScript | LauraArcidiacono/Synergy-Proyect-Full-Stack | /src/controllers/resourceControllers.js | UTF-8 | 1,557 | 2.640625 | 3 | [] | no_license | const Resource = require('../models/resourceModel');
async function getAllResources({ query }, res) {
try {
const resources = await Resource.find(query);
res.json(resources);
} catch (error) {
res.status(500);
res.send(error);
}
}
async function createOneResource({ body }, res) {
try {
con... | true |
52980cd4779339e1fda1c0d4f1e3fc72bf2f9d67 | JavaScript | leotammaro/Pokedex | /pokedex.js | UTF-8 | 5,253 | 3.125 | 3 | [] | no_license | const $listadoPokemons = document.querySelector(".lista");
const pokemonDetallado = document.querySelector(".pokemon-detallado");
async function mostrarListadoPokemones(pagina){
const pokemons = await fetch(`https://pokeapi.co/api/v2/pokemon/?offset=${pagina*20}`)
.then(response=>response.json())
... | true |
1291becb96d2da0355c391bee9ea1e50fc77a7a8 | JavaScript | emmanuelflores/draw-me-express | /app02.js | UTF-8 | 1,324 | 2.921875 | 3 | [] | no_license | //Express' dependencies
//we need these in order to use Express
var express = require('../node_modules/express')
, routes = require('./routes')
, user = require('./routes/user')
, simple = require('./routes/simple')
, http = require('http')
, path = require('path');
var app = express();
//General app config... | true |
cbcd655550b7dd78f18bb38477444149bef6444c | JavaScript | ShayReichert/random_quote_machine | /src/RandomQuotesMachine/Buttons.js | UTF-8 | 1,254 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react'
class Buttons extends Component {
//Import 2 props in one function for onClick' event :
randomClickandOnClick = () => {
this.props.randomclick();
this.props.onclick();
}
render() {
const { randomColor, randomSentence, randomAuthor ... | true |
3cf5d76ad055cf8641e4990789df73cc0fc61f51 | JavaScript | jodylane/Coursework | /i308/LaneProject2/js/main.js | UTF-8 | 3,042 | 3.15625 | 3 | [
"MIT"
] | permissive | /**
* Created by Josh Lane on .
N215 N320
*/
var map, marker, userLocation, db;
db = new Dexie("projectTwo");
db.version(1).stores({locations: "++id,location,time"});
db.open();
//list all of my drawings
listDrawings();
console.log(window.innerWidth);
//create map on my location
function initMap() {
map = n... | true |
f7535134fb3da2d0d7352693bb2c098ce93e229b | JavaScript | rfay/ddev | /docs/content/assets/temp-fix-header-links-in-tabs.js | UTF-8 | 1,685 | 3.0625 | 3 | [
"Apache-2.0"
] | permissive | const fixTabs = () => {
// Get current hash
let currentHash = window.location.href.split('#')[1];
if (!currentHash) return
// Get element associated with hash
let hashElement = document.getElementById(currentHash);
if (!hashElement) return
// Detect if element is located in a tab
let p... | true |
a1bd7fb8463719f7a138af9b5aad6123baa9304f | JavaScript | WeltyTimothy/Welty_Tim_WPF | /conditionasl_industry/js/conditionals.js | UTF-8 | 841 | 3.453125 | 3 | [] | no_license | // Timothy Welty 11/13/2013
var furnHeight = prompt("Please enter the height of the FURNACE COIL"); //telling me what the height of everything is
var padding = prompt("Please enter the height of the FURNACE PADDING");
var limit = prompt("Please enter the MAXIMUM HEIGHT allowed for Furnace placement"); //telling me what... | true |
6e1081e05ac58bed6ba3f2d7658add127a82bb87 | JavaScript | damlois/fintech | /electronpay/js/receipt.js | UTF-8 | 2,352 | 3.1875 | 3 | [] | no_license |
//Receipts Filter
function searchReceipts() {
var input, filter, table, tr, td, i, j;
input = document.getElementById("filter");
filter = input.value.toUpperCase();
table = document.getElementById("receipts-list");
tr = table.getElementsByTagName("tr");
for (i = 1; i < tr.length; i++) {
tr[i].style.dis... | true |
ec9d15e2d5c2391e4d700edd3782a815b1546d26 | JavaScript | smirnovs/newsexplorer-front | /src/js/user/signup.js | UTF-8 | 1,665 | 2.5625 | 3 | [] | no_license | import { goodStatus } from '../helpers/messages.js';
export class Signup {
constructor(popup, popupElement, miniPopup, miniPopupCallback, api, validate) {
this.popup = popup;
this.popupElement = popupElement;
this.miniPopupCallback = miniPopupCallback;
this.api = api;
this.v... | true |
65088fc92675a53f7a19590c24c06f2e3636c19f | JavaScript | dingzew/web_practice | /image_filter/js/index.js | UTF-8 | 5,037 | 3.078125 | 3 | [
"MIT"
] | permissive | var image = null;
var file = null;
var pixel = null;
var avgColor = null;
var red = null;
var blue;
var green;
function uploadImage() {
file = document.getElementById("fileUpload");
var canvas = document.getElementById("imageCanvas");
image = new SimpleImage(file);
image.drawTo(canvas);
}
function doGray() {
... | true |
82c4a970c924d263963818fc2d9695a9fdb78e0b | JavaScript | kach-ann/calendar | /calendar.js | UTF-8 | 3,834 | 3.578125 | 4 | [] | no_license | const months = ['Jan', 'Feb', 'March', 'Apr', "May", 'Jun', 'Jul', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec'];
const days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
const dayAndMonth = [ 31, 30, 28, 30, 31, 30, 31, 31, 30, 31, 30, 31];
let selectedDate = new Date();
let allEvents = [];
... | true |
9051a35392a522ab4a437f2878e55392da62b973 | JavaScript | zhanghui000/Resume | /js/resume.js | UTF-8 | 8,544 | 2.609375 | 3 | [] | no_license | var naru=document.querySelector("#fix img");
naru.onmouseover=function(){
var tell=document.querySelector("#fix span");
tell.style.display="block";
}
naru.onmouseout=function(){
var tell=document.querySelector("#fix span");
tell.style.display="none";
}
window.onscroll=function(){
if(window.pageYOffset>900){
var ... | true |
13cb66b580bc14b76cfb9fe3e4422ff97adbd097 | JavaScript | Linschlager/react-sudoku-solver | /src/tools/sudoku-checker.js | UTF-8 | 2,969 | 3.859375 | 4 | [
"MIT"
] | permissive | const check = (sudoku, col, row) => {
let valid = true;
const numbers = [];
for (let i = 0; i < 9 && valid; i++) {
let value;
if (row !== null) {
value = sudoku[row][i];
} else if (col !== null) {
value = sudoku[i][col];
} else {
throw new Error('Row or Col is required');
}
... | true |
eae624aeb4c32af929aff8c4e87f2b40fe1f2b24 | JavaScript | butuhanov/todo-notes | /service/frontend/src/components/User.js | UTF-8 | 2,801 | 2.75 | 3 | [] | no_license | import React from 'react'
const UserItem = ({user}) => { // Это простой компонент без состояния.
// Такие компоненты удобнее создавать как функции.
// В нашем случае применяется стрелочная функция,
// но можно... | true |
31be2be13185081a22771ee416c36d9d3d71968a | JavaScript | elbacb/rdwmir | /sesion/11/_test_/division.test.js | UTF-8 | 502 | 2.640625 | 3 | [] | no_license | const { division } = require('./../modulos/division');
beforeEach(() => {
console.log(`beforeEach ${new Date().toLocaleString()}`);
});
afterEach(() => {
console.log(`afterEach ${new Date().toLocaleString()}`);
});
describe('division', () => {
test('2 numbers to be', () => {
expect(division(5, 4)).toBe(1.25... | true |
8387c63319214235701a357555f68b43c3e4e8c1 | JavaScript | xixirock/Server-activity | /server-activity.js | UTF-8 | 891 | 3.28125 | 3 | [] | no_license | var http = require ("http");
//create http that listen on port 7000
var GOOD_PORT = 7000;
//port 7000 always tells user something good about themselves
function handleGoodReq(req, res) {
response.end("You've made a server: " + req.url);
};
var goodServer = http.createServer(handleGoodReq);
goodServer.listen(GOOD... | true |
c6edeaf37eef58179ac105d966f1d59378a357ef | JavaScript | MarioLema/Memory-Game | /app.js | UTF-8 | 8,627 | 3.390625 | 3 | [] | no_license | //===========================================DATA OBJECT========================================================
const DATA = {
boardArr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
matchTable: [],
currPair: [],
moves: 0,
pairsSolved: 0,
timeLeft: 100,
gameOngoing: false,
bus... | true |
36661389fd373886633ea14d0d99a1d31c19b25f | JavaScript | laurenoutloud/ModernJS | /Fundamentals/strings.js | UTF-8 | 1,872 | 4.5625 | 5 | [] | no_license | /* Strings */
const firstName = 'William';
const lastName = 'Johnson';
let val;
const age = 25;
val = firstName + lastName;
//Concatenation
val = firstName + ' ' + lastName;
//Appending
val = 'Joe ';
val += 'Smith';
val = "Hello my name is " + firstName + " and I am " + age;
//Escaping
val = 'That\'s awesome, I c... | true |
52acb20bc7b19f6b5a38903881ba64cc71dc797e | JavaScript | LasseWolter/RL_Trading_Helper | /contentScript.js | UTF-8 | 8,137 | 2.921875 | 3 | [] | no_license | chrome.runtime.onMessage.addListener(function (request) {
if (request.bumpAll === "yes") {
// Pass keepBumping boolean to bumpAll function
bumpAll(request.keepBumping)
}
});
// Bumps all trades
// In case of keepBumping===true this function calls itself recursively
function bumpAll(keepBumping... | true |
175e24711962daf2837ff34e8fdae5d86447ede2 | JavaScript | MonicaHoward/little-web-assignments | /day-11-random/randomClass.js | UTF-8 | 515 | 3.515625 | 4 | [] | no_license | console.log('hi');
var peeps = ['Stevie', 'Ali', 'Haley', 'Monica', 'Nikki', 'Sam', 'Brian', 'David'];
var randomNumber = Math.random();
randomNumber = randomNumber * peeps.length;
randomNumber = Math.floor(randomNumber);
console.log(randomNumber);
console.log(randomNumber, peeps[randomNumber]);
for (var i = 0;... | true |
e991db34cc202ec1040377441c057175224a4986 | JavaScript | gregoriopiriz/Obp2 | /WSinternal/AppCliente/JS/App/Categories.js | UTF-8 | 3,701 | 2.671875 | 3 | [] | no_license | window.onload = load;
function load() {
GetCategories();
}
function AddCategory() {
var newCategory = new Object;
newCategory.nombre = $('#nombreCategoria').val();
newCategory.precio = $('#precioCategoria').val();
$.ajax({
method: "POST",
contentType: "application/json",
... | true |
ffa8bdd592ffd087ba4783ba5b8547daebc608a7 | JavaScript | adaau/Marina | /public/js/boats/index.js | UTF-8 | 721 | 2.53125 | 3 | [] | no_license | $(function() {
API.getBoats().then(function(boats) {
boats.forEach(function(boat) {
$("#boat-list").append(
'<li>' +
'<div class="row col-xs-12 col-sm-6 col-md-4 thumb">' +
'<div class="container-img">' +
'<a class="thumbnail" href="/boats/'+ boat._id + '">' +
... | true |
1fdfb6cae47719dcb15a5d35d2a3d75783f8aef4 | JavaScript | Rami-HM/developer-skillup | /react-counter/src/counter2/index.js | UTF-8 | 4,239 | 3.109375 | 3 | [] | no_license | import React, { PureComponent } from 'react';
import '../counter/counter.css';
// 이전 내역이 있을 경우에는 undo, 다음 내역이 있을 경우에는 redo
// undo 를 한 후 redo 값이 있는 상태에서 값 입력 후 값 계산을 할 경우 기존 redo 값은 새로 갱신된다.
// input에 숫자를 입력하고 + 버튼을 클릭하면 결과값에 입력한 숫자 만큼 더해지고 input의 값은 없어진다.
// input에 숫자를 입력하고 - 버튼을 클릭하면 결과값에 입력한 숫자 만큼 빼지고 input의 값은 없... | true |
8398e0d87d030af06a224f87c7acb7a3a1b16203 | JavaScript | parikh-reetu/news_scraper | /login.js | UTF-8 | 12,275 | 2.671875 | 3 | [] | no_license | // to include packages, we store modules in these variables
var mysql = require('mysql');
var express = require('express');
var session = require('express-session');
var bodyParser = require('body-parser');
var path = require('path');
var cors = require('cors');
var fs = require('fs');
const { json } = require('express... | true |