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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ca776be523e2defd2e0be52d5186ff27ffa2bca7 | JavaScript | MatthewZaso/code-library | /packages/odo-tabs/src/tabs.js | UTF-8 | 10,138 | 2.546875 | 3 | [
"MIT"
] | permissive | /**
* @fileoverview Easy tabs. Inspired by bootstrap and jQuery UI.
*
* {@link http://jqueryui.com/tabs/}
* {@link https://github.com/jquery/jquery-ui/blob/master/ui/tabs.js}
* {@link http://www.marcozehe.de/2013/02/02/advanced-aria-tip-1-tabs-in-web-apps/}
* {@link http://git.aaronlumsden.com/tabulous.js/}
*
*... | true |
0aa37d356fefc50ea6fd1c91c4417c6b0f8b4288 | JavaScript | Wayne-Bai/AST-normalize | /data/Sage/SDataJavaScriptClientLib/tests/Utility.js | UTF-8 | 1,873 | 2.796875 | 3 | [] | no_license | (function() {
var nameToPathCache = {};
var nameToPath = function(name) {
if (typeof name !== 'string' || name === '.' || name === '') return []; // '', for compatibility
if (nameToPathCache[name]) return nameToPathCache[name];
var parts = name.split('.');
var pat... | true |
ef4feb26eafe55390c6559b6fd671faaf992c42c | JavaScript | cs-fullstack-2019-spring/javascript-set11c-arrays2-tdude0175 | /exercise31.js | UTF-8 | 487 | 4.4375 | 4 | [
"Apache-2.0"
] | permissive | //Create an array with 5 numbers.
// Ask the user for an index.
// Alert the user of the value of the array's index.
/*
defined array with number set
prompt user for an index
value of the arrays index?
indexOf tells you where that item is located
they want the value of the item in the array.
*/
var number_set ... | true |
ef5c79957fed6292438ceeec8f7ceb2c219c5ec4 | JavaScript | ahmedvuqarsoy/react-native | /boilerplates/task-plus-minus/screens/Home.js | UTF-8 | 1,656 | 2.6875 | 3 | [] | no_license | import React, {useState} from 'react';
import { StyleSheet, Text, View, Button, TouchableOpacity } from 'react-native';
const Home = () => {
const [count, setCount] = useState(0);
const plusHandler = () => {
console.log(count);
setCount(count+1);
};
const minusHandler = (... | true |
0c2c1315c22e39580b5f90b3b899f31228987db9 | JavaScript | Necroniuss/necroniuss.github.io | /SimpleTodo/scripts.js | UTF-8 | 2,733 | 2.890625 | 3 | [] | no_license |
let szamlalo = 0;
$('#nextTodoItem').focus();
$('#addTodoItem').click(() => {
$('#nextTodoItem').focus();
/* kiolvassa a beviteli mező értékét és beteszi egy változóba */
let newTodoItem = document.getElementById('nextTodoItem').value;
if (newTodoItem != 0) {
/* Ez ad hozzá egy új elemet a ... | true |
9bd31e57e01e156a4c77ea956f1670c857ad1fe3 | JavaScript | bryce-richards/lightbulbs-react | /src/utils/calculateLightbulbs.js | UTF-8 | 758 | 2.90625 | 3 | [] | no_license | export default (lightbulbs, people) => {
let i = 0,
lightFlips = 0,
dividend = 0,
divisor = 0,
quotient = 0,
switchedOn = [];
for (i = 1; i <= Math.sqrt(Math.min(lightbulbs, people)); i++) {
switchedOn.push(i * i);
}
for (dividend = people + 1; dividend <= lightbulbs; dividend++) {
... | true |
8497d0e960761d29e9ec086e15bb0e42840f7f35 | JavaScript | dpletzke/lotide | /test/tailTest.js | UTF-8 | 533 | 2.84375 | 3 | [] | no_license | const tail = require('../tail');
const { assert, expect } = require('chai');
describe('#tail', () => {
it('should return \'Labs\' when passed ["Yo Yo", "Lighthouse", "Labs"]', () => {
const arr = ["Yo Yo", "Lighthouse", "Labs"];
expect(tail(arr)).to.match(/Labs/);
});
it('should not mutate the array when... | true |
daa47eb00e4bd5680b0dcece68aa64ff8aaa07eb | JavaScript | jwchamb/Intro_To_Computer_Programming_For_Musicians | /ChordCompare_App/Node/web_db_connect.js | UTF-8 | 1,212 | 2.5625 | 3 | [] | no_license | "use strict"
// Server functions to pull postgres data and send to web client
// The server passes in the send-to-browswer callback function
const pgp = require('pg-promise')()
const cn = {
host: '192.168.0.11', // 'localhost' is the default;
port: 5432, // 5432 is the default;
database: 'joel',
user: 'final... | true |
0d3afc405232cdc76ca02e3f7eef21654f5bef28 | JavaScript | ServerSide-CLS/homework | /2017212212111/实验七/routes/index.js | UTF-8 | 783 | 2.609375 | 3 | [] | no_license | var express = require('express');
var router = express.Router();
/* GET home page. */
router.get('/', function(req, res, next) {
const totalpages = Array.from(Array(50), (v, i) => i+1)/*创建0-50的伪数组*/
const length = totalpages.length;
const pageSize = 8
const pageCount = Math.ceil(length / pageSize)
const page... | true |
fa0b602fb23ca0dea4d8d9c43b831471bd14d9a8 | JavaScript | ruzlicali16/quasar | /app/lib/helpers/logger.js | UTF-8 | 370 | 2.515625 | 3 | [
"MIT"
] | permissive | const ms = require('ms')
const chalk = require('chalk')
let prevTime
module.exports = function (banner, color = 'green') {
return function (msg) {
const curr = Date.now()
const diff = curr - (prevTime || curr)
prevTime = curr
console.log(
msg
? ` ${chalk[color](banner)} ${msg} ${chal... | true |
e850a36a7a8809ba14c7c449ccf2659e5346a6a4 | JavaScript | xiehaitao0229/Front-End-Knowledge | /JS对象模拟DOM对象的实现.js | UTF-8 | 2,141 | 3.1875 | 3 | [] | no_license | export default class Elememnt {
/**
* @param {String} tag 'div'
* @param {Object} props { class: 'item' }
* @param {Array} children [ Element1, 'text']
* @param {String} key option
*/
constructor(tag,props,children,key){
this.tag = tag;
this.props = props;
if... | true |
c61d4dfb3fb8986224c0baf5f6b2f0cee7df4fca | JavaScript | luizcouto1/Assessoria | /src/main/webapp/js/candidato.js | UTF-8 | 1,422 | 3.015625 | 3 | [] | no_license | var candidatos = [];
function buscarTodos(){
$.get("/candidatos", function(resposta){
candidatos = resposta;
atualizarTabela();
});
}
function atualizarTabela(){
for(i = 0; i < candidatos.length; i++){
var linha = $("#tabelaCandidatos").append("<tr></tr>");
linha.append("<td>" + candidatos[i].id + "</td>")... | true |
4f89d54550d4f6428133f9f4e365aba04eefefc4 | JavaScript | CIDARLAB/clotho3apps | /ananke/JS/query.js | UTF-8 | 6,645 | 2.953125 | 3 | [] | no_license | /**
* Created by prash on 2/17/15.
*/
var n_in = 1;
function initializeQueryPage()
{
resetForm();
}
function resetForm()
{
var input_table = document.getElementById("keyValueForm");
while(input_table.rows.length > 0) {
deleterow("keyValueForm");
}
n_in = 1;
document.getElementById('js... | true |
9e0d841559205365e6498714da8657fdad966ffe | JavaScript | faithanalog/colorz | /level_gen.js | UTF-8 | 2,569 | 2.515625 | 3 | [] | no_license | var lwip = require('lwip');
var _ = require('lodash');
var fs = require('fs');
var xLibPalette = new Array(256);
for (var i = 0; i < xLibPalette.length; i++) {
var rgb16 = (i << 8) | i;
var r = ((rgb16 >> 11) & 0x1F) * 0xFF / 0x1F;
var g = ((rgb16 >> 5) & 0x3F) * 0xFF / 0x3F;
var b = ( rgb16 ... | true |
df317bfcb7dfcaeeb65e146b5bfa7bffb41e20d0 | JavaScript | artton87/aenis_web_based | /www/bs/override/window/MessageBox.js | UTF-8 | 1,093 | 2.546875 | 3 | [] | no_license | Ext.define('BestSoft.override.window.MessageBox', {
override: 'Ext.window.MessageBox',
/**
* Displays a standard read-only message box with an OK button (comparable to the basic JavaScript alert prompt).
* If a callback function is passed it will be called after the user clicks the button, and the
* id of t... | true |
4ae02106ad5596991cf9c9092e6f78114ed66f5b | JavaScript | suissa/workshop-be-mean | /rotas/modules/db.js | UTF-8 | 2,176 | 2.59375 | 3 | [] | no_license | var mongoose = require("mongoose")
, Schema = mongoose.Schema
, url = require("url");
mongoose.connect('mongodb://localhost/workshop-sampa');
var db = mongoose.connection;
db.on('error', function(err){
console.log('Erro de conexao.', err)
});
db.once('open', function () {
console.log('Conexão aberta.')
});... | true |
e1709be19e9cdac9b0e15a1edfeee38b7ef3307f | JavaScript | MatiasCar/tp-integrador-interfaces | /web/src/componentes/FormRegister.js | UTF-8 | 3,206 | 2.65625 | 3 | [] | no_license | import React, {useState} from 'react'
import {useHistory } from 'react-router-dom';
import axios from "axios";
import '../estilos/Login.css'
function FormRegister(){
let history = useHistory()
const [name, setName] = useState("");
const [email, setEmail] = useState("");
const [password, setPassword] ... | true |
d165ef9d27280cbb3945db36a9fe503cc863fb94 | JavaScript | mayboroda1985/code-practice | /Lecture_2/homework2_fromstudents.js | UTF-8 | 10,359 | 4.0625 | 4 | [] | no_license | ERROR: type should be string, got "https://jsbin.com/sejiqawusu/edit?js,console\n\n// LESSON 2:\n\n/* #1\nYou were paid 5000 in January, and in February you were paid 20% more.\nCount your total payment, print in console the type of the total payment,\nand print in console concatenation of string \"I have \" and the total\npayment.\nYou want to buy a new car. Create a variable with the car cost\n20000. Then create a string with the name “question” and value\n\"Can I buy Nissan for \". Create a variable of Boolean data type with\nvalue where you compare your total pay and the car cost. Print in console\nthe sentence using concatenation of your variables in order to have\noutput in console you will see “Can I buy Nissan for my payment for\ntwo months ?”). The last step – print in console your comparison variable. */\n\nlet january = 5000;\nlet february = january + january * 0.2;\nlet totalPay = january + february;\nconsole.log(`I have ${totalPay}`);\nlet carCost = 20000;\nlet question = \"Can I buy Nissan for \";\nlet comparison = totalPay >= carCost;\nconsole.log(`${question} my payment for two months ? `);\nor\nconsole.log(question + \"my payment for two months ?\");\nconsole.log(comparison);\n\n\n/* #2\nA warehouse has 1500 boxes with size 24 x 24 x 12” and 2000 boxes\nwith size 24 x 18 x 12”. It needs to pack some goods with a volume\nof 15 000 cubic feet. Print in console true if the warehouse has enough\nboxes to pack all the goods, or false if it doesn’t have enough boxes. */\nlet qtySize1 = 1500;\nlet size1 = 24 * 24 * 12 ;\nlet qtySize2 = 2000;\nlet size2 = 24 * 18 * 12;\nlet total = size1 * qtySize1 + qtySize2 * size2;\nlet totalRequire = 15000;\nlet cubInch = 12 ** 3;\nconsole.log(cubInch);\nconsole.log(total / cubInch > totalRequire );\n\n/* #3\nОпределить вес символа под индексом 2 в строке “I love JavaScript”.\n В консоли вывести букву индекса который будет равно весу символа\n ( пример результата “ n = 120”)\n comment: когда вы определили вес символа под индеком два, сделайте так что бы\nв консоли распечаталась буква под индесом 2 которая равно весу X\n ( вес X вы должнны были узнать) */\n\nlet string = \"I love JavaScript\";\nlet letter = string[2];\nconsole.log(letter.charCodeAt(0));\nconsole.log(string.charCodeAt(2)); //console letter l\nconsole.log(`${letter} = ${string.charCodeAt(2)}`);\n\n\n// #4\n// Using the charCodeAt method, finds out which codes have English\n//uppercase and lowercase letters. Print in the console:\n// \"English capital letters have a code starting with \"firstLetterUp\"\n//and end with \"lastLetterUp\".\" and \"English lowercase letters have\n//a code starting with \"firstLetterDown\" and end with \"lastLetterDown \".\".\n\n// #5\n// Приведите строки в числа, а затем преобразуйте в boolean type,\n// при a = '23', b = '43';\n\n// #6\n// Есть два слова: «Welcome» и «Вэлкам», каждая четвертая буква которых\n// имеет свой вес. Определите, какая из них весит больше, во сколько раз\n// (и удивитесь, насколько отличается вес английских и русских букв :).\n// А затем проверьте бо́льшую букву на чётность/нечётность.\n\n// #7\n// In the string \"QA For Everyone\" find the code values of the first\n// letters in each word of the string, then comparing these values,\n// find the biggest one. After that, comparing the code values of the\n// last letters of each word, find the smallest one.\n\n// #8\n// First you have to assign two numbers (any numbers of your choice) and implement:\n// If one of the numbers is even and the other is odd you need to print out - true,\n// Otherwise you need to print out - false\n\n// #9\n// Create 2 vars. Assign the same float number to both of them : 0.2.\n// Multiply these 2 values. Check if the result of multiplying which we get\n// in the js equals to the real value (in this case equals to the 0.04).\n\n/* #10\n Four friends are going to the cinema, if everybody agrees (true).\n Create vars: Olya - using boolean, Natalya - using number, Jane - using space\nand Marina - using string. => answer - True */\n\n\nlet olya = true;\nlet natalya = 10;\nlet jane = \" \";\nlet marina = \"Marina\";\nconsole.log( olya && !!natalya && !!jane && !!marina);\n\n// #11\n// Declare variables named: apple, banana and kiwi with prices 5, 10 and 7.\n// Declare var sum which is the amount for three fruits one of each type.\n// Declare new variable result - which is equal to your actual amount spent, then check:\n// If result less than sum - “You forget to buy smth, check once again”;\n// If result is greater than sum - “You going to pay more for\n// ( subtraction sum from result) dollars, check again“;\n// If the result is equal to the sum- “Your shopping is done.”\n\n\n// #12\n// Длина диагонали ТВ = 86 inches. Длина коробки = 2 метра. ТВ влезет в коробку?\n// True or False ?\n\n// #13\n// // Colleges are collecting money for the trip. Natalya gave 5147$,\n// Jane gave 0$, Marina gave 2358$, Olya gave 1249$.\n// // The trip costs 9800$. Will they go?(=> false).\n\n// #14\n// Compare two wishes: \"I want to be a QA Engineer\" and \"I don't want to do my homework\".\n// The wish that has a higher value of the string will come true. Will I become\n// a QA Engineer?\n\n// #15\n// In the variable named day is assigned some number between 1 to 31. Determine\n// in which decade of the month this number belongs (to the first, second or third).\n\n// #16\n// let color= 'blue';\n// let price=10000;\n// let make='Toyota';\n// let used = true ;\n// Case1 I want new Mercedes car which is blue and price >15000 => false\n// Mercedes && blue && price >15000\n// let case1 = !make && color && !price;\n// console.log(case1);\n\n// Case2 I want used car with price 5000 or blue Toyota => true\n// price 5000 || blue && Toyota\n// let case2 = 5000 < price || color && make;\n// console.log(case2);\n\n// #17\n// Two friends shopped at the store. Olya bought 25 eggs, and Yulya bought\n// five times less eggs than Olya. Find if it is true or false that Olya bought\n// more eggs than Yulya.\n\n\n// #18\n// Bob and Bill have planned their trip to Hawaii. They are really busy\n// with work and need to find the best way to plan their trip.\n// They have 4 options to fly, but only 1 can be good for both of them:\n// Calendar hours to fly:\n// 1. Monday - 10am;\n// 2. Tuesday - 12pm;\n// 3. Friday - 6pm;\n// 4. Sunday - 1pm;\n// Case 1: Bob can fly Monday any time, and Tuesday after 3pm. And Friday\n// till 5pm, and Sunday till 12.30pm.\n// Bill can fly Monday after 4pm, and Tuesday anytime. And Friday after 9am,\n// and Sunday after 11am.\n// Case 2: Bob can fly only Friday after 3pm, and Sunday any time;\n// Bill can fly Monday after 10:01am, or Tuesday after 11:55pm.\n// Or Friday till afternoon, and Sunday he is free all day.\n// Find out which case is true or false, to know when they both can plan\n//their trip together.\n\n// #19\n// Create variables for the names with age: Tom, Sam, Jack, Ted.\n// Tom is 16, each friend is 2 years older, starting from Tom in order.\n// a)Count the age of each person;\n// b) Insert the names with the age to the string, using concatenation and ${}:\n// “Tom is - 16 years old, Sam is - …. years old, Jack is … years old,\n// Ted is … years old. And the total of our age is ….years old”.\n// c) Find out what is the Unicode Value of the 1sr letter of the name,\n// and add the total to the string: “The total of the Unicode values of\n// the 1st letter of the all names is ….!”.\n\n// #20\n// We have string let str = '124, 45, 8';\n// Show in Console if numbers in string are even: true/false.\n// Expected to see:\n// `Number 1: [show number] is even: true;\n// number 2: [show number] is even: false;\n// number 3: [show number] is even: true’\n\n// #21\n// Одним из приемов тестирования черного ящика является метод “Эквивалентное разбиение”.\n// Суть метода - выделяются множества значений, для которых система применяет\n// одинаковую логику.\n// Пример:\n// В поле можно ввести значения от 0 до 10 включительно, и от 40 до 60 включительно.\n// Вопрос: Сколько классов эквивалентности и что тестируем?\n// Ответ: 5.\n// Тестируемые диапазоны: три зоны некорректных значений (<0, (10;40), >60);\n// и две зоны корректных значений: [0;10) и (40 ;60) не включительно.\n\n// Необходимо составить и решить задачу для следующих чисел, выбранных для\n// тестирования, причем, если число из диапазона некорректных значений ,\n// то заменяем его на false, а если из диапазона корректных , то заменяем его\n// на true, если числа выбраны из одного диапазона , то между ними ставится знак || ,\n// а если из разных диапазонов, то знак &&.\n\n// Пример: (-1,19,61,1,56);\n// Решение: (false && false && false && true && true);\n\n// (0, 1, 75, 91, 45);\n// (-6, 0, 9, 39, 61).\n\n// #22\n\n// Выведите в консоле значение true при следующих переменных:\n// red = true;\n// green = false;\n// black = true;\n// grey = true;\n\n// Раскрасьте стены дома в ( red and green or black and grey and green or\n// grey and red and green). Порядок расставления скобок за Вами.\n\n// #23\n// Вывести в консоле числовое значение (математический вес) индекса 5 во\n// фразе «We are the champions”.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n//==================" | true |
ee2bf29e68d84f95e13eb746b6775ce9c402fffd | JavaScript | jordisala1991/archetype-drupal | /gulpfile.babel.js/config/fn.lint.formatter.js | UTF-8 | 1,108 | 2.515625 | 3 | [
"MIT"
] | permissive | import colors from 'colors';
import _ from 'underscore';
const lintFormatter = err => {
let errors = _.values(err),
icons = {
info: colors.blue('⬤'),
success: colors.green('⬤'),
warning: colors.yellow('⬤'),
error: colors.red('⬤')
},
tab = ' ',
space = ' ',
line,
has... | true |
fda6a9323a0033f4516d8e9cb4896e4f145996e8 | JavaScript | MarritNL/Winc_assignment_13_else_if | /script.js | UTF-8 | 608 | 3.40625 | 3 | [] | no_license | const myAge = 19;
if (myAge < 18) {
document.write ("You are too young, you can't enter. ");
} else if (myAge == 18) {
document.write ("You can enter. ");
} else {
document.write ("You can enter. ");
}
const isFemale = false
if (isFemale) {
document.write ("Would you like to buy some t... | true |
eedbe6afb72b5a0eddbfa63f474758eca59f40c2 | JavaScript | pandequesox/Taller-Pr-ctico-de-HTML-y-Javascript-I | /functions.js | UTF-8 | 2,810 | 4.125 | 4 | [] | no_license | //Autor: Santiago Osorio Obando
//Las primeras funciones son las funciones de sumar, restar, multiplicar y dividir para la calculadora.
//También cada una tiene integrada la funcionalidad de pintar de rojo el resultado si es menor a cero, y de verde si es mayor o igual a cero
function sumar(){
var d1 = parseFl... | true |
d2a1f663c86ba35f822a5de68ed8a724f350a0c9 | JavaScript | cs2b01-lab1-01-2020-2/To-dos-Manager-CSERN | /static/js/login.js | UTF-8 | 2,994 | 2.578125 | 3 | [] | no_license | function validEmail(element) {
var text = document.getElementById(element.id).value;
var regex = /^[-\w.%+]{1,64}@(?:[A-Z0-9-]{1,63}\.){1,125}[A-Z]{2,63}$/i;
if (!regex.test(text)) {
document.getElementById("bademail_register").className = "uk-animation-shake"
document.getElementById("bademail_register")... | true |
dd87bfba75c32e5aefa88d72f29001ad48165e73 | JavaScript | scottcarpenter28/365-day-coding-challenge | /365 day code challenge/scripts/pyramid.js | UTF-8 | 877 | 3.703125 | 4 | [] | no_license | var maxRow;
$(document).ready(function() {
// Get value on button click and show alert
$("#output").click(function() {
maxRow = $("#num").val();
if (maxRow <= 0 || maxRow % 2 === 0)
alert("Must be an odd number, greater than 0");
else {
var pyramid = makePyramid();
console.log(pyramid)
... | true |
35bb48cf3f534caf46c6becd778a17dae6c10d56 | JavaScript | thomii23/CursoIngresoJS | /jsIteraciones (9).js | UTF-8 | 2,082 | 3.234375 | 3 | [] | no_license | function Mostrar()
{
var nombreDelMayor;
var contador=0;
var nombre;
var sexo;
var nota;
var notaMinima;
var sexoNotaMinima;
var desaprobados;
var femenino;
var masculino;
var promedioDeNotas;
var sumadorDeNotas;
var contadorDeNotas;
var promedioDeMujeres;
// declarar variables
var edadMaxima;
var e... | true |
0f2f6672e9f6928bc8643b3891c2cb441c759234 | JavaScript | nmakarov/excercises | /Interview/wordly/calculate.js | UTF-8 | 3,776 | 3.375 | 3 | [
"MIT"
] | permissive | const { list } = require("./wordlist.json");
const matchesFilters = (wordList, filters) => {
return wordList.filter((word) => {
let match = true;
for (let i = 0; i < filters.length; i += 1) {
const { colour, position, letter } = filters[i];
if (colour === "black") {
if (word.includes(lett... | true |
7ff5188276ddc368b1e31b24f3ee1e8125a9c27e | JavaScript | WangKarel/KarelTank | /js/elements.js | UTF-8 | 39,047 | 2.859375 | 3 | [] | no_license | //页面宽度和高度
let winWidth2 = parseInt($(".father").css("width"));
let winHeight2 = parseInt($(".father").css("height"));
//随机加强效果
let move60,move100,shoot60,shoot100,moveOPP,addBlood,sing;
let strong = setInterval(function () {
let times = 8;
let chars = Math.floor(Math.random() * 6);//0-4整数
//alert(chars);
... | true |
a4c9e492f317901a7a95ae99dd5bb91490902fd8 | JavaScript | nbkragh/Computer_Grafik | /worksheet1/part3/work1part3.js | UTF-8 | 1,420 | 2.734375 | 3 | [] | no_license | window.onload = function(){
var canvas = document.getElementById("c");
var gl = canvas.getContext("webgl")
if(!gl){
console.log("no gl : "+gl)
}
gl.clearColor(0.3921, 0.5843, 0.9294, 1.0);
gl.clear(gl.COLOR_BUFFER_BIT);
//loader og compiler et shader program
var program =... | true |
e3b0f1efe5a761a9e37f3575fd6b65f33fe84481 | JavaScript | tianlili/Tangram-component | /src/baidu/fx/getTransition.js | UTF-8 | 2,788 | 2.828125 | 3 | [
"BSD-3-Clause"
] | permissive | /*
* Tangram
* Copyright 2010 Baidu Inc. All rights reserved.
*
* @author: meizz
* @create: 2010-07-15
* @namespace: baidu.fx.getTransition
*/
///import baidu.fx;
/**
* 获取线型函数
* @function
* @grammar baidu.fx.getTransition(name)
* @param {String} name transition的名称
* @return {function} ... | true |
a31565e14574f7cd9380ccef45bd93ebe39ad0db | JavaScript | jamurana/Deepak123 | /tour.js | UTF-8 | 4,563 | 2.65625 | 3 | [] | no_license | export var tourController = (function(){
const MAX_ANGLE = 360; //in degree
const MAX_TIME_INTERVAL = 100; //0.2 seconds
const MIN_TIME_INTERVAL = 25; // 0.025 seconds
const HEADING_INTERVAL = 1;
const MIN_RANGE = 40;
const MAX_RANGE = 120;
const defaultRange = 80;
let speedInterval = 5;
let flyDurat... | true |
fc64ad90779b701110479a9e5f8b3e3f68c8126f | JavaScript | rayuchtai/concoction-frontend | /src/components/EditForm.js | UTF-8 | 1,570 | 2.515625 | 3 | [] | no_license | import React, {useState} from 'react'
const EditForm = (props) => {
const newWorld = {id: props.world.id, name: '', creation: '', notes: ''}
const [world, setWorld] = useState(newWorld)
const handleChange = (e) => {
setWorld({...world, [e.target.name]: e.target.value})
}
const handleSubmit = (e) => {
... | true |
fdf956f817e000455a2bb8e14b20969d323ff357 | JavaScript | ybinstock/control_flow_lab | /control_flow_lab.js | UTF-8 | 1,023 | 3.765625 | 4 | [] | no_license |
// Question 1
// var foods = ["apples", "bannanas", "pears", "radishes"];
// if (foods.length === 0){
// console.log("You have no food!");
// }
// else if (foods.length===1) {
// console.log("You have one left!");}
// else {
// console.log("You have tons of food");
// }
// var foods = ["apples", "bannanas", "p... | true |
3667edc4485296b12f5385e95dd3af53abad2a05 | JavaScript | naveen-ithappu/Game-of-Life--HTML5 | /src/js/GameOfLife/gol-jqplugin.js | UTF-8 | 989 | 2.53125 | 3 | [
"MIT"
] | permissive | var old = $.fn.gol;
/*Function added to JQuery object to make it avail to be used on any Jquery wrapped DOM Element*/
$.fn.gol = function(options) {
var returnValue, _eles, _args = Array.prototype.slice.call(arguments, 1);
_eles = this.each(function() {
var $this = $(this),
data = $this... | true |
be3b78d31d1b56b2fb1beb31b81cef070cfa5bd3 | JavaScript | grant-c-wilhelm/Assignments | /prereact/constructive/app.js | UTF-8 | 1,798 | 4.28125 | 4 | [] | no_license | //constructive fucntions: prototypical inheritance is what javascript is based around. basically it means inheritcance from
//a first type; suppose you have some hierarchy of things like biology kingdoms, the prototype is the very top
//level. lower thigns on the chain inherit thigns from higher up on the chain
//fu... | true |
a36d6b7db13cdde937d0458922bf8cc87b6b3bb1 | JavaScript | dntPaAanic/594215-kekstagram-19 | /js/filters.js | UTF-8 | 4,976 | 2.953125 | 3 | [] | no_license | // Модуль работы с фильтрами для фото
'use strict';
(function () {
var MAX_BLUR = 3;
var MAX_PERCENT_VALUE = 100;
var Brightness = {
MIN: 0,
MAX: 3,
};
var EffectLevel = {
MIN: 0,
MAX: 100,
DEFAULT: 100
};
var Effect = {
CHROME: 'chrome',
SEPIA: 'sepia',
MARVIN: 'marvi... | true |
ff8cb8f0a82a9200daa6e7d436851ec64fd7660b | JavaScript | esraltintas/ProJsDesign | /JavascriptPro/Chp8/XHRConnectionQueue.js | UTF-8 | 2,105 | 2.640625 | 3 | [] | no_license | /**
* Created by esra on 19/04/15.
*/
var asyncRequest = (function() {
function handleReadyState(o, callback) {
var poll = window.setInterval(
function() {
if (o && o.readyState == 4) {
window.clearInterval(poll);
if (callback) {
... | true |
6c9ac7f8b5f0b8c7d7af2f6cb919cd528a63a858 | JavaScript | nmccready/goodhumans-pdf-workflow | /lib/functions/deprecated/formatUploadResponse.js | UTF-8 | 402 | 2.71875 | 3 | [] | no_license | /**
* @typedef {Object} Response
* @property {String} mergedPdf - The URL location of the PDF.
*/
/**
* Formats the URL of the merged file into a JS Object.
* @param {String} url - The URL of the merged PDF.
* @returns {Response}
*/
function formatUploadResponse(urls) {
console.log(`Stored at: ${urls}`);
... | true |
ba3a530b4cdfe6ee402558e4a310691fff219c81 | JavaScript | marekgacek/Memory-game | /js/app.js | UTF-8 | 7,637 | 3.46875 | 3 | [] | no_license | /*
* Create a list that holds all of your cards
*/
let symbols = ['fa fa-diamond', 'fa fa-diamond', 'fa fa-paper-plane-o', 'fa fa-paper-plane-o', 'fa fa-anchor', 'fa fa-anchor', 'fa fa-bolt', 'fa fa-bolt', 'fa fa-cube', 'fa fa-cube', 'fa fa-leaf', 'fa fa-leaf', 'fa fa-bicycle', 'fa fa-bicycle', 'fa fa-bomb', 'fa fa-b... | true |
dbd7d7081fb671ff0e1ee21ab7a1540ef643ab43 | JavaScript | jinhuashijie/test1 | /react招聘aap项目笔记.js | UTF-8 | 33,749 | 3.75 | 4 | [] | no_license | 1:create-react-app脚手架生成文件格式
它是官方已经配置 好的模板--不用手动配置webpack,react之类
npm install -g create-react-app
create-react-app -v 能跑通
create-react-app test 新建一个应用,之后会自动暗转一系列依赖
可以跑,速度很慢;非常慢
目录结构:
nodemodules
public 静态资源 index.html 在这里面
src 源代码
gitignone github
packagejson 项目依赖版本
readme.md
之后 npm... | true |
430ec99a849ad78a241c326e3c1c16e959d9921a | JavaScript | truongdx271/freddo | /validation/menuitem.js | UTF-8 | 670 | 2.59375 | 3 | [] | no_license | const Validator = require('validator');
const isEmpty = require('./is-empty');
module.exports = function validateMenuItemInput(data) {
let errors = {};
data.name = !isEmpty(data.name) ? data.name : '';
data.price = !isEmpty(data.price) ? data.price : '0';
data.discount = !isEmpty(data.discount) ? data.discoun... | true |
9e9bcb6ef689b7e5a529e04b1799bfddba4b1de0 | JavaScript | chaquen/academica_web | /js/funciones/utilidades.js | UTF-8 | 22,883 | 2.90625 | 3 | [
"MIT"
] | permissive | /**
* Variables globales con expresiones regulares
*
* */
var rgxEmail=/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.(?: |com.es|com|com.co|net.co|co|org|net|biz|info|mobi|cat|es|ar|futbol|rocks|)$/i;
var rgxNumero=/^-?(\d+\.?\d*)$|(\d*\.?\d+)$/;
/**
* url=//Ubicacion del archivo a consultar en la peticion HTTP
* data= datos en... | true |
b2bbf28d0c92b20604f10390be9de6f3b0833f83 | JavaScript | OGoodness/NKUGH7 | /js/main.js | UTF-8 | 2,028 | 2.828125 | 3 | [] | no_license | function languageSelect(id) {
var languageFlag = document.getElementById(id).src;
var languageAlt = document.getElementById(id).alt;
var languageData = document.getElementById(id).getAttribute("data");
console.log(languageFlag, languageAlt, languageData);
form = document.createElement('form');
f... | true |
f16e3d83b067a15d3ef174edc0f0a131fba2320d | JavaScript | sashrikasd/next-jobs | /pages/index.js | UTF-8 | 1,925 | 2.546875 | 3 | [] | no_license | import Head from 'next/head'
import styles from '../styles/Home.module.css'
import Link from 'next/link'
export async function getStaticProps(context) {
const res = await fetch(`https://f81l2jaz49.execute-api.us-east-1.amazonaws.com/dev/todos`)
const data = await res.json()
if (!data) {
return {
notFo... | true |
2add6c996883373a9d5436dd745a58d3a2ab22be | JavaScript | cmdw/percobaan3 | /js/GoogleMap.js | UTF-8 | 4,079 | 2.59375 | 3 | [
"MIT"
] | permissive |
createMap();
var markers = [];
var infowindow = new google.maps.InfoWindow();
var bounds = new google.maps.LatLngBounds();
function createMap()
{
var map = new google.maps.Map(document.getElementById('map_canvas'), {
... | true |
3453704c4e5a83046e9404149b94714066b7ed0e | JavaScript | rayzlui/l33t_code | /intersection.js | UTF-8 | 353 | 3.375 | 3 | [] | no_license | //From 349 in LeetCode
/**
* @param {number[]} nums1
* @param {number[]} nums2
* @return {number[]}
*/
function intersection(nums1, nums2) {
let set1 = Array.from(new Set(nums1));
let set2 = Array.from(new Set(nums2));
return set1.reduce((acc, curr) => {
if (set2.includes(curr)) {
acc.push(curr);
... | true |
c9a6f5562aac96d9073863ae6342e3405e66676f | JavaScript | victordulap/javascriptStudy | /lessons/lesson5/App/js/syntaxrules.js | UTF-8 | 162 | 3 | 3 | [] | no_license | /*
Message output and
arithmetic operation
*/
// Display
alert("Вычисление выражения");
// Math
var a = 5 + 8;
alert(a);
| true |
728c9cd48430007595c7f203295cd70744100205 | JavaScript | Tonnyk17/Weather | /src/containers/App.js | UTF-8 | 1,460 | 2.953125 | 3 | [] | no_license |
import Header from "../components/Header";
import React from "react";
import Data from "../components/Data";
class App extends React.Component{
state = {
country : "",
city:"",
temp: "",
mintemp: "",
maxtemp: "",
weather: "",
}
getWeather = (e)=>{
e... | true |
7b723be326833696a86249618d23d307bbc35e38 | JavaScript | ryanjaysalapare/Bing-Maps-Project | /maps.js | UTF-8 | 9,991 | 2.984375 | 3 | [] | no_license | // Author: Ryan Jay Salapare - 000823653
function loadMapScenario() {
$(document).ready(function () {
let lat
let long
function success(pos) {
lat = pos.coords.latitude
long = pos.coords.longitude
}
let id = navigator.geolocation.getCurren... | true |
0d84068307c6764545bd7e943842c45ae55ff74f | JavaScript | SubhamEzz/tip-calculator-app-main | /code.js | UTF-8 | 708 | 2.9375 | 3 | [] | no_license |
function discount(per){
var amount = $("#bill").val();
var numberOfPeople = $("#npeople").val();
var payAmount = (amount*per).toFixed(2);
var perPay = ((amount-payAmount)/numberOfPeople).toFixed(2);
$("#tip").text(payAmount);
$("#mBill").text(perPay);
}
$("#five").click(function(){
discount(0.05);
});
$... | true |
e0ba3f280d65600cd6af4eff3e635d4322a10591 | JavaScript | alirangwala/Creating-Photo-Negatives | /converter.js | UTF-8 | 2,845 | 3.15625 | 3 | [] | no_license | const fileInput = document.getElementById('fileInput');
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
const negative = document.getElementById('negative');
negative.onchange = run;
const srcImage = new Image;
let imgData = null;
let originalPixels = null;
let currentPixels = nul... | true |
4516523645b4b0877c30066991ddcc2c60abb426 | JavaScript | Eselbeus/echomusings | /src/reducers/podcastReducer.js | UTF-8 | 629 | 2.703125 | 3 | [] | no_license | const initialState = []
const podcastReducer = (podcastState = initialState, action) => {
switch (action.type) {
case("LOAD_PODCASTS"): {
return { ...podcastState, podcasts: action.payload }
}
case("POST_PODCAST"): {
return { ...podcastState, podcasts: [...podcastState.podcasts, action.payloa... | true |
fd29a28c697e67ebdb88ae3d2dbda406128e72a0 | JavaScript | StellaYangF/ES6 | /Coding/PubSub/PubSub.js | UTF-8 | 766 | 3.265625 | 3 | [
"MIT"
] | permissive | class Event {
constructor () {
this.stack = [];
}
on (eventName, callback) {
this.stack.push({ eventName, callback})
}
emit (eventName) {
!eventName
? this.stack.map(obj => obj.callback())
: this.stack.find(obj => obj.eventName === eventName).callback();
}
}
const fs = require('fs');
... | true |
00bb174a70768030ddc6b4a0cc5a5278e668b79b | JavaScript | dedushkakala/Paradigms-in-ITMO | /HW09/functionalExpression.js | UTF-8 | 2,474 | 3.359375 | 3 | [] | no_license | /**
* Created by Лев on 17.04.2017.
*/
"use strict"
var MY_CONSTS = {
"pi": Math.PI,
"e": Math.E
}
var VARIABLES = {
"x": 0,
"y": 1,
"z": 2,
"u": 3,
"v": 4,
"w": 5
};
var operation = function (action) {
return function () {
var operands = arguments;
return function... | true |
34cb20e4846ec8495705c686dee08c6bd918ad71 | JavaScript | MarckK/autocompleter | /src/loadFile.js | UTF-8 | 680 | 2.96875 | 3 | [] | no_license | const fs = require('fs');
let _fileAsString = null;
//function which reads the file only once (to be used on server.js)
function readFileAsString(filePath, callback) {
if(_fileAsString) {
return callback(_fileAsString); // if the file already exists return it.
}
// use readfile node module, file path is '/w... | true |
7e9e662aae5ef7f0db163510f1566db274a8fbc8 | JavaScript | DEFRA/water-abstraction-service | /integration-tests/billing/services/fixture-loader/SetLoader.js | UTF-8 | 1,183 | 2.703125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"OGL-UK-3.0"
] | permissive | 'use strict'
/**
* A class to help with loading YAML files from multiple
* loaders, maintaining a shared set of references among
* the loaders
*/
class SetLoader {
/**
* @param {Object} fixtureLoaders - key/value pairs of fixture loaders
*/
constructor (fixtureLoaders = {}) {
this._fixtureLoaders = ... | true |
2955f91fa7384bf08371279b151a46203fd01811 | JavaScript | abhishekS27/todoAPIs | /routes/toDoManagement.js | UTF-8 | 5,723 | 2.84375 | 3 | [] | no_license | /*
* @Author: Abhishek Singh
* @Date: 2020-02-18
*/
const queries = require('../dbConnection/queries.js');
const ObjectId = require("mongodb").ObjectID;
const toDoList = {};
module.exports = toDoList;
/**
* This method is used to add a task.
* @method insertTaskToDo
* @author Abhishek Singh
* @email ab278199... | true |
bc6989e1eeffee0e10f57e3dedf1fb3ccfb9f716 | JavaScript | Didar83/library_2021_09_18 | /model/authors.model.js | UTF-8 | 1,639 | 2.96875 | 3 | [] | no_license | const sql = require("./db.js");
const Author = function(author) {
this.name = author.name;
this.surname = author.surname;
this.patronymic = author.patronymic;
this.date_of_birth = author.date_of_birth;
this.date_of_death = author.date_of_death;
};
Author.create = (newAuthor, result) => {
sql.q... | true |
0dffab3ead3bb1c4111f83d3b8050141c56e74b6 | JavaScript | Leonzon95/choremates-frontend | /src/ruleAdapter.js | UTF-8 | 1,155 | 2.8125 | 3 | [
"MIT"
] | permissive | class RuleAdapter {
constructor(houseId) {
this.baseUrl = `http://localhost:3000/houses/${houseId}/rules`;
}
//create
createRule = (e) => {
e.preventDefault();
let description = document.querySelector("#new-house-rule-form #name").value;
document.getElementById("new-hous... | true |
abfc1c31452d6b30c322092dc1706f267d17b565 | JavaScript | Da-Shu/Cloud9BootcampWorkspace | /IntroToExpress/ExpressPracticeApp/app.js | UTF-8 | 1,856 | 3.359375 | 3 | [] | no_license | var express = require("express");
var app = express();
//Visiting "/" should print "Hi there, welcome to my assingment!"
app.get("/", function(req, res) {
res.send("Hi there, welcome to my assignment!");
});
//Visiting "/speak/animal" should print "the [animal] says [sound]"
// app.get("/speak/pig/", functio... | true |
a69288a1f52e8ee87212c6091adb94d279b098ad | JavaScript | zfis/phoneshop | /public/js/main.js | UTF-8 | 2,946 | 2.6875 | 3 | [
"MIT"
] | permissive | (function () {
"use strict";
var treeviewMenu = $('.app-menu');
// Toggle Sidebar
$('[data-toggle="sidebar"]').click(function(event) {
event.preventDefault();
$('.app').toggleClass('sidenav-toggled');
});
// Activate sidebar treeview toggle
$("[data-toggle='treeview']").click(function(event) {
event.pre... | true |
7d5a763b836161e35df8695a2c2007c765c4900b | JavaScript | jpaprakis/individual1 | /public/js/rating.js | UTF-8 | 1,199 | 3.0625 | 3 | [
"MIT"
] | permissive |
//document is our HTML page.
//dollar sign around it is jquery
//ready saying when it's ready, execute code inside
function vote_up(ideaID, item) {
$.post("/ratings/" + ideaID + "/1", function(data){
var mycol = document.getElementById('upvote'+ideaID).style.color;
if (mycol !== 'red')
{
var myhtml = docume... | true |
fa6ab3a4bd7202e2553ee519f6a7c1610ec9c69a | JavaScript | imkimchi/Merge.li | /public/javascripts/event.js | UTF-8 | 4,037 | 2.609375 | 3 | [
"MIT"
] | permissive | $(document).ready(function(){
//remove shadow-box when user clicks x button
$(document).on('click', '.remove', function(e) {
e.preventDefault();
$('.modal').remove();
});
function sleep (time) {
return new Promise((resolve) => setTimeout(resolve, time));
}
$(document).on('click', '.copy_icon',... | true |
a52860cff0a52da2606f2b77b0b70ba070137eb4 | JavaScript | RostyslavOstapyak/javaScriptPratice | /lesson23/task3/index.js | UTF-8 | 2,218 | 3.359375 | 3 | [] | no_license | const listElem = document.querySelector(".list");
const generateId = () => Math.random().toFixed(2) * 100;
const tasks = [
{ text: "Buy milk", done: false, id: generateId() },
{
text: "Pick up Tom from airport",
done: false,
id: generateId(),
},
{ text: "Visit party", done: false, id: generateId() ... | true |
2536aa553cf91c70d5fc885a63de79f92acb61e9 | JavaScript | blainejohnson17/js-algo-practice | /reverseVowels/reverseVowels.js | UTF-8 | 979 | 3.921875 | 4 | [] | no_license | const VOWELS = ['a', 'e', 'i', 'o', 'u'];
const isVowel = (char) => {
return VOWELS.includes(char);
}
function replaceAt(string, index, replace) {
return string.substring(0, index) + replace + string.substring(index + 1);
}
const reverseVowels = (str) => {
// start at front of string
// find first vowel
// ... | true |
8980c14dbf0e909b03b3e6d17d166c438772e38b | JavaScript | stanlemon/blueprint-taskmanager | /src/helpers/schemaHandler.js | UTF-8 | 1,330 | 2.53125 | 3 | [] | no_license | const asyncHandler = require("./asyncHandler");
const schemaHandler = (schema, fn) => async (req, res, next) => {
// Validate the input schema
const { value, error } = schema.validate(req.body, {
// False here will not allow keys that are not part of the schema
allowUnknown: false,
// True here will st... | true |
3eed038527ec7033518ddc167e9b007483a9f461 | JavaScript | marcinbunsch/WaterBug | /lib/runner.js | UTF-8 | 1,830 | 3.265625 | 3 | [] | no_license | /*
* WaterBug.Runner
*
*/
WaterBug.Runner = new Object()
// Storage for command history
WaterBug.Runner.history = []
// Go back one step in history and present command in command line
WaterBug.Runner.back = function() {
history_point = WaterBug.command_line.history_point
if (!history_point) history_point = W... | true |
e2447375ce3a87d5876e7faa103271edcb77e92d | JavaScript | JeffreyLiu90/tinyapp | /helpers.js | UTF-8 | 656 | 2.71875 | 3 | [] | no_license | const validateEmail = function(email, users) {
for (let usersKey in users) {
if (users[usersKey].email === email) {
return true;
}
} return false;
};
function findUser(users, email) {
for (id in users) {
const user = users[id];
if (user.email === email) {
return user;
}
}
retu... | true |
8edd2afc4073e6d837646de4744b8f9b979a15f9 | JavaScript | carlos-1198/simonDice-JS | /js/main.js | UTF-8 | 4,546 | 3.84375 | 4 | [] | no_license | var nombre = 'Carlos'
var apellido = 'Mendoza'
/*punto y coma en js, lineas pegadas = ejm/ 7y8, 9y10, etc...
1.se usa cuando la segunda linea de codigo de dos lineas "pegadas" empieza con un array.
2.cuando la segunda linea de codigo de dos lineas "pegadas" es un template string*/
var nombreCompleto = `${nombre} ${ape... | true |
1f8cacc6928714543ac9f5db760f271548fe7566 | JavaScript | Azihakkak/p4-MERN-backend | /models/http-error.js | UTF-8 | 617 | 3.125 | 3 | [] | no_license | // we can create a JS class
// A class is a blueprint of a JS object
class HttpError extends Error {
// we can add the constructor method to any class which allow us to run some logic whenever we instansite this class and create a new object based on it.
constructor(message, errorCode) {
super(message); // we ... | true |
e7a2d8240ed12edf0824d080bc8dc3f2f5d3d2ba | JavaScript | bryanfc117/appDeNotas | /src/routes/notas.js | UTF-8 | 2,271 | 2.6875 | 3 | [] | no_license | const router = require('express').Router();
const Note = require('../models/Notes');
const {isAuthenticated} = require('../helpers/auth');
router.get('/notes/add', isAuthenticated, (req, res) =>{
res.render('notes/new-note');
});
//recibir datos
router.post('/notes/new-note',isAuthenticated,async (req, res) => {... | true |
d2aacfcb44026a801c969538db3110979b29ddc0 | JavaScript | Liu-WenYue/cart263-2019 | /projects/project1/js/script.js | UTF-8 | 2,306 | 2.953125 | 3 | [] | no_license | "use strict";
// Store html elements and values in variables.
let $gear;
let $sisyphus;
let $coin;
let $tax;
let workingProgress = 0;
let bgImage;
let bgm;
let typing;
// preload()
//
// To preload the background image.
function preload() {
bgImage = loadImage("assets/images/bg.png");
bgm = new Audio("assets/soun... | true |
08a72788c8894125defb185ff9989558075d1c08 | JavaScript | nPelvin/findaname | /client/src/pages/Results.js | UTF-8 | 984 | 2.90625 | 3 | [
"ISC"
] | permissive | import React, { useState, useEffect } from "react";
import Filter from "./Filter";
function Results(props) {
const api = `/api/search/${props.location.searchRes}`;
const [gender, setGender] = useState("");
const [names, setNames] = useState([]);
useEffect(() => {
fetch(api)
.then((res) => res.json())
.the... | true |
9817f08e3d00d0f329bb404afecace73975b564e | JavaScript | thatvetdevrob/SalmonCookieStand | /js/app.js | UTF-8 | 4,227 | 3.3125 | 3 | [
"MIT"
] | permissive | /* eslint-disable no-unused-vars */
'use strict';
/*
Robert Rizo
The fish app
*/
// global variables
var hours = [' 9am ', ' 10am ', ' 11am ', ' 12pm ', ' 1pm ', ' 2pm ', ' 3pm ', ' 4pm ', ' 5pm '];
var allcookieshops = [];
var cookieshopTable = document.getElementById('cookieTable');
/*
THIS IS THE ADDED EVENT LISTENE... | true |
778b1862f7422b12866f3a62d9ad9d0ae51db294 | JavaScript | Ahana1105/C80-Attendance-with-for-loop | /main.js | UTF-8 | 1,083 | 3.578125 | 4 | [] | no_license | var student_array = [];
function submit() {
var display_array = [];
for (var i = 1; i <= 4; i++) {
var name = document.getElementById("student" + i).value;
student_array.push(name);
}
console.log(student_array);
var x = student_array.length;
for (var j = 0; j<x; j+... | true |
c260452b6e1335fa33e87ead657d2a6c7d5c8fa8 | JavaScript | Galatsan/frontTestTask | /src/containers/imageViwer.jsx | UTF-8 | 3,265 | 2.515625 | 3 | [] | no_license | import * as React from "react";
import { imageService } from "../service/imageService";
import Navigation from '../components/navigation'
import ImageGalery from "../components/image-galery";
import ImageView from '../components/imageView'
export default class ImageViwer extends React.Component {
constructor(props)... | true |
80c9902b12986c7695587621aea6abb4714bf947 | JavaScript | reliableJARED/heroku_1 | /version2/resources/server/graphicsWorldManager.js | UTF-8 | 5,900 | 3 | 3 | [] | no_license |
var graphicsWorldManager = function (texture_files_array,texture_files_index_key) {
this.INDEX = texture_files_index_key;// object whos keys represent index of files in the texture files array
this.TEXTURE_FILES = texture_files_array;//an array of image files ['pic.png', 'house.jpg', etc]
this.NoAssignment = -1;... | true |
120bd972b46a0fd12a3f89e30aaf49a545c2bc4a | JavaScript | tugenhua0707/popup | /app/pages/popup/index.js | UTF-8 | 5,799 | 2.515625 | 3 | [] | no_license | //对话框
/*
var $content = $("#page-modal").find('.content');
$content.on('click','.alert-text',function () {
$.alert('这是一段提示消息');
});
$content.on('click','.alert-text-title', function () {
$.alert('这是一段提示消息', '这是自定义的标题!');
});
$content.on('click', '.alert-text-title-callback',function () {
$.... | true |
2ac9b59312b8fe1539a5cfe7974811c77e441a9e | JavaScript | source-academy/journey-frontend | /library_function/modules/base_env/src/core.js | UTF-8 | 279 | 3.21875 | 3 | [
"Apache-2.0"
] | permissive | 'use strict';
function display(text) {
let outputDiv = document.getElementById('output-div');
let element = document.createElement('p');
element.appendChild(document.createTextNode(text));
outputDiv.appendChild(element);
}
function math_abs(x) {
return Math.abs(x);
} | true |
124082a96a9b775eb966409b6acde1ce4f4d4130 | JavaScript | s028041/meteoApi | /app.js | UTF-8 | 1,324 | 3.109375 | 3 | [] | no_license | window.addEventListener("load", () => {
// let long;
// let lat;
let temperatureDescription = document.querySelector(
".temperature-description"
);
let temperatureDegree = document.querySelector(".temperature-degree");
let location = document.querySelector(".location-timezone");
let timeUtc = document... | true |
9568ad2d20392a1a699f63a419c7802486ebfdb1 | JavaScript | JetmirAv/automatic_sql_injection | /server.js | UTF-8 | 1,800 | 2.53125 | 3 | [] | no_license | const { Client } = require("pg");
const express = require("express");
const app = express();
const port = 8000;
const client = new Client({
database: "sql_injection",
host: "localhost",
port: 5432,
user: "priosan",
password: "123456789"
});
client.connect();
app.use(express.urlencoded());
app.get("/", as... | true |
0b28c1bc9aa61778b859f8f08e1142355109578f | JavaScript | sharat94/mern_stack | /dct_mern/day_4/day4-session2-api/users/app.js | UTF-8 | 525 | 3.09375 | 3 | [] | no_license | var axios = require('axios');
//HTTP METHODS - GET, POST, DELETE, PUT
var url = `https://jsonplaceholder.typicode.com/users`;
axios.get(url).then(function(response){
console.log(`Listing Users`);
response.data.forEach(function(user){
console.log(`${user.id} ${user.name} - ${user.email} - ${user.address... | true |
2a49f86a950897192c5983b3fb3031fe05a4e009 | JavaScript | kotakamikawa/Full-Stack-Open-2019 | /fullstack/src/components/PersonForm.js | UTF-8 | 1,019 | 2.9375 | 3 | [] | no_license | import React, { useState } from 'react'
const PersonForm = (props) =>{
const{ newName, newNumber ,persons, setNewName, setNewNumber, setPersons } = props
const addPerson = (event) => {
event.preventDefault()
const foundPerson = persons.find(person => person.name === newName)
if(foundPerson){
... | true |
4bc91778c3706e9371b9307bce2113d6d4eac39d | JavaScript | kiidax/nablajs | /tests/regexp.js | UTF-8 | 557 | 2.6875 | 3 | [] | no_license | function assert(x) { if (!x) { print("error"); quit(1); }}
a = /test/;
assert(a.toString === RegExp.prototype.toString);
assert("asdf".toString !== RegExp.prototype.toString);
print('' + /ab(cd)+e*f/);
var re = /[a-z]+\(([a-z]+)\)/;
print('ok' + re);
re.source = re.global = re.multiline = re.ignoreCase = "NG";
delete... | true |
e8ea3e4e9060a9fc62ae6996d29f95751d0f8a58 | JavaScript | alliricker/Initial-Pre-Work | /5-Introduction-to-JavaScript/56-Use_Conditional_Logic_with_If_Statements.js | UTF-8 | 681 | 4.90625 | 5 | [] | no_license | // If statements are used to make decisions - if tells JavaScript to execute the code in {} only under certain conditions, defined in parentheses. These conditions are Boolean conditions. If the condition is true, the program will execute the statement; if it is false, it will not.
// Example
function ourTrueOrFalse(i... | true |
bb0c8d0fc6e73b1080f9fcf05caa2b7710bc71ac | JavaScript | sgmbr/annes-project | /tmp/Revision activity 3E 1f Chemical formulae 3 flip/scripts/game.js | UTF-8 | 4,626 | 2.5625 | 3 | [] | no_license | define("game",["jquery","ko","lib/xml","questions_model","lib/" + config.reporting,"lib/sound","vendor/jquery.falldown"],function($,ko,xml_parser,questions_model,reporting,sound) {
// the flip view model.
var game = function() {
var self = this;
self.questions = new questions_model();
//global answer me... | true |
4d939844cc1870c84b9e51fcbce53dc9d8cd3c0e | JavaScript | DanielGurevich1/Text-analisys | /text/text.js | UTF-8 | 345 | 3.15625 | 3 | [] | no_license |
let string = 'There is very little difference between the two, and which you use is down to personal preference. You should choose one and stick to it, however; differently quoted code can be confusing, especially if you use two different quotes on the same string! The following will return an error:';
console.log(st... | true |
e0188fce4b4d6eae8870a93f562e5d58d1e9cef7 | JavaScript | aliceknin/liveplaylists | /server/__tests__/createPlaylist.test.js | UTF-8 | 8,007 | 2.625 | 3 | [] | no_license | const PlaylistCreator = require("../playlists/createPlaylist");
const UserSpotifyAPI = require('../config/spotify');
jest.mock('../config/spotify');
let user = {
name: 'Alice Nin',
spotifyID: '12140404407'
}
let pc = new PlaylistCreator(user);
describe("adding tracks in batches of 100", () => {
const r... | true |
3efccd98aded8093e5a170d474d414ee98bef0eb | JavaScript | LiliyaStefanova/js_exercises | /syntax/celsius_farenheit.js | UTF-8 | 169 | 3.671875 | 4 | [] | no_license | const celsius = prompt('Enter temperature in degrees Celsius:');
const fahrenheit = celsius*9/5 + 32;
console.log(`${celsius} in Celsius is ${fahrenheit} in Fahreneit`); | true |
9c4fed056349456ec8cb0ce57db67764f9840f15 | JavaScript | 4trees/artg-2018 | /03-2-functions/index.js | UTF-8 | 2,925 | 4.5625 | 5 | [] | no_license | /*
1 Function scope
*/
//Carefully consider the scope of each of the variables
const apple = 'fuji';
function fruit() {
const orange = 'navel';
console.log(apple); //will this work? why?
};
console.log(apple); //will this work? why?
//console.log(orange); //will this work? why?
let b = 1;
function add(a) ... | true |
ebdf7b7a96f5dafda19155e871bf98068c27fe90 | JavaScript | nareshRobertson/ASP.NET-Core-MVC | /ModuleTwo/AssignmentTwo/wwwroot/js/site.js | UTF-8 | 2,251 | 2.578125 | 3 | [] | no_license | // Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
// for details on configuring this project to bundle and minify static web assets.
// Write your JavaScript code.
$(function () {
$('#deleteModal').on('show.bs.modal', function (event) {
var button = $(even... | true |
668b1822c1a8ecc7ab25ecdc0a3c67940315358e | JavaScript | dileep98/js | /p5js_Rain/sketch.js | UTF-8 | 711 | 2.90625 | 3 | [] | no_license | var drops = [];
var dropCount = 100;
var newDownfall = 500;
var rain;
var thunder;
function preload() {
rain = loadSound('rain.mp3');
thunder = loadSound('thunder.mp3');
}
function setup() {
createCanvas(windowWidth, windowHeight);
rain.setVolume(0.5);
rain.loop();
downfall();
}
function draw() {
backgroun... | true |
d598fe4492ee9711dd74c8736da372879c175462 | JavaScript | IACarvalho/Formacao_node | /Modulo03/index.js | UTF-8 | 822 | 2.96875 | 3 | [] | no_license | import express, { response } from 'express'
const app = express()
app.get('/', (request, response) => {
response.send('<h1>Hello world!</h1>')
})
app.get('/ola/:nome', (request, response) => {
const { nome } = request.params
response.send(`<h1>Olá, ${nome}!</h1>`)
})
app.get('/teste/:nome?', (requesicao, resp... | true |
3ea35ff39162f66c0493f647266e5d48279110af | JavaScript | lakshay-saini-au8/JS_Playgroud | /edabit/1.very_easy/7.js | UTF-8 | 445 | 4.375 | 4 | [] | no_license | /*
A palindrome is a word that is identical forward and backwards.
mom
racecar
kayak
Given a word, create a function that checks whether it is a palindrome.
Examples
checkPalindrome("mom") ➞ true
checkPalindrome("scary") ➞ false
checkPalindrome("reviver") ➞ true
*/
// solution
function checkPalindrome(str) {
... | true |
a18caed8f0e1844df651797338e6225fb6c968ec | JavaScript | kaylasommer/calculator | /app/models/calc.js | UTF-8 | 1,088 | 3.296875 | 3 | [] | no_license |
'use strict';
function Calc(){}
Calc.add = function(x, y){
return x + y;
};
Calc.sub = function(x, y){
return x - y;
};
Calc.distance = function(p1, p2){
var a = p2.x - p1.x;
var b = p2.y - p1.y;
return Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2));
};
Calc.line = function(p1, p2){
var x = p2.x - p1.x;
... | true |
1094ef79f024c5a3c08e3230b6f3b52a33eedb82 | JavaScript | elainewo/project-snake | /assets/js/main.js | UTF-8 | 557 | 2.84375 | 3 | [] | no_license | let section = document.createElement("section");
section.setAttribute("id", "snakeField");
for (let i = 0; i < 260; i++) {
let div = document.createElement("div");
div.className = "item";
section.appendChild(div);
}
document.body.appendChild(section);
for (let i of document.getElementsByTagName("div")) {
// c... | true |
ad9facfb69afa1447abf40779d7d6b2354d06e80 | JavaScript | Shiny-Project/Shiny | /api/services/CacheService.js | UTF-8 | 1,468 | 3.125 | 3 | [] | no_license | /**
* In-memory cache to speedup configuration reading
*/
class InvalidCacheItemError extends Error {}
class CacheService {
cacheData = {};
set(key, value, ttl = 1800000) {
if (!key || value === undefined) {
throw new InvalidCacheItemError("写入缓存失败:未指定Key或内容无效");
}
this.c... | true |
17c71a7340f5fd00852814eb2ca129260684bf0a | JavaScript | emmanueletti/tinyapp | /server/helpers.js | UTF-8 | 2,713 | 3.5 | 4 | [] | no_license | /**
* Function searches through user database and finds the id of the user object that has the matching email passed in.
* @param {string} email - user's email
* @param {object} database - database object
* @returns user's id || "null" if not found
*/
const getUserByEmail = (email, database) => {
for (const user... | true |
ecb89fbdc0b3f1e0c02375da3cc4858c83916f85 | JavaScript | Insanelyn/MandatoryTo-dolists | /src/TodoItems.js | UTF-8 | 851 | 2.5625 | 3 | [] | no_license | import React, { Component } from "react";
class TodoItems extends Component {
render() {
let todoEntries = this.props.entries;
let listItems = todoEntries.map((item, index)=>{
return (
<li key={index}>
<input type='checkbox' checked={item.checked} onClick={() ... | true |
3b9e578d40d9574a1804125f7d230c8ec897b1bd | JavaScript | Thalyen/Help17 | /listarUser.js | UTF-8 | 9,646 | 2.78125 | 3 | [] | no_license | function getDenunciasUser() {
window.location.href = "Listagem_Denuncia.html";
var xmlhttp = new XMLHttpRequest();
var data = JSON.parse(localStorage.getItem('usuario'));
xmlhttp.onreadystatechange = function () {
if (this.readyState === 4 && this.status === 200) {
var myObj = JSON.... | true |
800be8b98ae3e52aefeb95700aacfc75d791d627 | JavaScript | megwatson88/Team_Profile_Generator | /index.js | UTF-8 | 6,337 | 3.28125 | 3 | [
"MIT"
] | permissive | //npm packages set up
const inquirer = require('inquirer');
const fs = require('fs');
const { title } = require('process');
const { writeFileSync } = require('fs');
// This is where the code ref back to the classes created in a different folder.
const Engineer = require('./lib/engineer.js');
const Intern = require('... | true |
8030d43bcb8b01dd53b3ebc92b307e1ec24f4142 | JavaScript | ccarmesin/recurrent-neural-network | /js/learningRates.js | UTF-8 | 1,411 | 3.09375 | 3 | [] | no_license | import * as tf from '@tensorflow/tfjs';
/**
* Just returning the given learning Rate
*
* @param {number} lr
*
* @return {number} calculated lr
*/
export function fixedLr(lr) {
return lr;
}
/**
* Calculate lr as part of the maximum loss the network made during training
*
* @param {number} currentEpoch
... | true |