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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
18527ddd9dec2a80fe489a0b3277f53ff6dde566 | JavaScript | bengtuggla/HTMLCSS-inlupp1 | /js/script.js | UTF-8 | 181 | 2.625 | 3 | [] | no_license |
const yearNow = new Date().getFullYear();
// Hittade non breaking space (\u00A0 ) efter mycket letande
document.getElementById("footer").innerHTML = ` \u00A0 ${yearNow}\u00A0 ` ;
| true |
70c190093fcbb0c61c7a9e408d3dcdf0ffb0953a | JavaScript | andreiButenka/piskel-clone | /piskel-clone/src/js/components/tools-list/shape-select-tool/shape-selection-tool.js | UTF-8 | 8,891 | 2.578125 | 3 | [] | no_license | import layers from '../../layers-list/layers-list';
import utilities from '../../utilities-list/utilities-list';
const shapeSelectionTool = {
marker: true,
moveShape: false,
insideCanvas: false,
beginMoveSelectedShape: false,
coordsMoveOrNot: {
x: undefined,
y: undefined,
},
posToMove: [],
posT... | true |
00c86b95e894b3fc68d0cb629aa308e82dd21907 | JavaScript | peterkisfaludi/chrome-app-samples | /samples/websocket-serial-server/index.js | UTF-8 | 5,384 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | function $(id) {
return document.getElementById(id);
}
function log(text) {
$('log').value += text + '\n';
}
var ws;
//////////////////////////////////////////////////////////////
//Serial port
const DEVICE_PATH = '/dev/ttySCRATCHX';
const serial = chrome.serial;
/* Interprets an ArrayBuffer as UTF-8 encoded st... | true |
73cf7dd420c2f101ea04da954ff9877c5cc8fb91 | JavaScript | mgechev/graphql-js | /src/language/parser.js | UTF-8 | 14,517 | 2.921875 | 3 | [
"BSD-3-Clause"
] | permissive | /**
* Copyright (c) 2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
import { Sour... | true |
2e8d796f082e8a7b08f9bec9ce5a5139716a529d | JavaScript | Shimazaki-T/Shimazaki01 | /vuejs01/03/script/vuejs03.js | UTF-8 | 661 | 2.578125 | 3 | [] | no_license | new Vue({
el: '#app',
data() {
return {
count: 1,
show: true
};
},
methods: {
increment() {
this.count++;
},
decrement() {
this.count--;
},
zeropoint() {
this.count = 0;
... | true |
968dd307de9c38531d4262072f9442050c14f0e1 | JavaScript | karan0299/hangman-js-game | /hangman.js | UTF-8 | 5,329 | 3.4375 | 3 | [] | no_license | var word = [["Hangman", "That game you are playing right now."],
["JavaScript", "Make web-page dynamic without reload the web page."]]
// Game keyboard
var keyboard = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
// Game memory
var select = 0
var wordLeft = []
var fail = 0
// Create keyboard
function createKeyboard() {
... | true |
6013b25125200b05fb69157f3a08fb06060c4137 | JavaScript | Andreloui5/EmployeeTracker | /components/addEmployee.js | UTF-8 | 764 | 2.84375 | 3 | [] | no_license | const mysql = require("mysql");
const inquirer = require("inquirer");
const consoleTable = require("console.table");
const connection = require("../db/connection");
function addEmployee() {
inquirer.prompt([
{
type:"input",
name:"firstName",
message:"What's the employee's first name?"
},
... | true |
34167bd605f8f8722188cd5e6fd3f0bf56486a8b | JavaScript | dnlowman/truth-table | /src/App/TruthTable/selectors/getVariables.test.js | UTF-8 | 446 | 2.9375 | 3 | [
"MIT"
] | permissive | import getVariables from './getVariables';
describe('The extractVariables function', () => {
it('should extract out the distinct variables in the expression', () => {
// Given
const expression = '(x || y) || (!x && z)';
// When
const result = getVariables(expression);
// Then
expect(result.... | true |
18a2b624a8d46d52a39149211a495cfd70c0b2d5 | JavaScript | fbouakline/pasen | /js/calender_manager.js | UTF-8 | 1,776 | 2.84375 | 3 | [] | no_license | function dagNaPasen(dag){
this.dag = dag;
this.getDag = function(){
var D = this.parent.Pasen.datum.getDate() + this.dag;
var M = this.parent.Pasen.datum.getMonth();
var Y = this.parent.Pasen.datum.getFullYear();
this.datum = new Date(Y, M, D)
return this;
}
}
var Calender = {
Pasen : {
getPasen : fu... | true |
fa5a6f8e5895718751ff47a41e2cc0c1b65c7f08 | JavaScript | jckmrrs/thermostat | /jasmine-standalone-3/src/thermostat.js | UTF-8 | 1,245 | 3.625 | 4 | [
"MIT"
] | permissive | "use strict";
class Thermostat {
constructor() {
this.MIN_TEMP = 10;
this._maxTemp = 25;
this._temp = 20;
this._psmIsOn = true;
}
up(delta = 1) {
if (delta <= 0)
throw new Error("Up must be called with a value greater than 0");
if (this.currentTemperature() + delta > this._maxTemp)... | true |
ef3eee06d90f454ee1d4c56b100f38a476d78ee8 | JavaScript | adrice727/subclass-dance-party | /src/flyingDancer.js | UTF-8 | 640 | 2.859375 | 3 | [] | no_license | var FlyingDancer = function(top, left, timeBetweenSteps){
Dancer.call(this, top, left, timeBetweenSteps);
this.$node.prepend('<img class="flyer" src="images/astronaut.png" />');
this.$node.addClass('flyer').removeClass('dancer');
this.large = false;
};
FlyingDancer.prototype = Object.create(Dancer.prototype);
... | true |
1840ddc84d1ee8ef70f49ae8dcd51fcd246587dc | JavaScript | AlexMantulenko/AlgorithmPrima | /prima.js | UTF-8 | 2,767 | 3.28125 | 3 | [] | no_license | const INF = Infinity;
let minKey = (min_e, visited) => {
let minIndex, min = INF;
for (let v = 0; v < V; v++) {
if (visited[v] == false && min_e[v] < min) {
min = min_e[v];
minIndex = v;
}
}
return minIndex;
}
let printEdges = (sel_e, graph, v) => {
let minWeight = 0;
console.log('Edges: ');
for (let... | true |
c4111564abbe784a364d24cc3795ad85643f84b3 | JavaScript | TalyaGabso/AppleSeeds-Node-Exercises | /11.1-express_with_react/bank-app/src/App.js | UTF-8 | 701 | 2.625 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import axios from "axios";
import "./App.css";
function App() {
const [data, setData] = useState([]);
useEffect(() => {
const getData = async () => {
const response = await axios.get("http://localhost:8000/api/bank/users");
setData(response.data.users);
... | true |
a92f9ed982badae2c558a0ae5fe03b32c0e35414 | JavaScript | amalshehu/algorithms-hackerrank | /Implementation/the-time-in-words/the-time-in-words.js | UTF-8 | 1,919 | 3.703125 | 4 | [
"MIT"
] | permissive | function timeInWords(h, m) {
numbersBelowTwentyArray = [
'',
'one ',
'two ',
'three ',
'four ',
'five ',
'six ',
'seven ',
'eight ',
'nine ',
'ten ',
'eleven ',
'twelve ',
'thirteen ',
'fourteen ',
'fifteen ',
'sixteen ',
'seventeen ',
'eight... | true |
69b1bcc7beb6fbce4b7c0c144df85414e137034d | JavaScript | SongXinxing/algorithm_practice | /leetcode/parseHtml/parse_o.js | UTF-8 | 4,746 | 3.515625 | 4 | [] | no_license | // 遍历处理字符所处于的模式
const MODE_SLASH = 0;
const MODE_TEXT = 1; // 进入普通模式
const MODE_TAGNAME = 2; // 进入元素模式
const MODE_ATTRIBUTE = 3; // 进入属性模式
const MODE_WHITESPACE = 4; // 进入空格模式
function compile(tmpl) {
let mode = MODE_TEXT; // 初始普通模式
let buffer = ""; // 进行记录之前遍历过的字符 += char
let propName = ""; // 属性名{}
let quote... | true |
026cdf997fb2c9af2af08bb1b69d8fb0a2033c9f | JavaScript | lanna817/StayHealthy | /sei/week-4/react-control/src/App.js | UTF-8 | 1,142 | 2.578125 | 3 | [] | no_license | import React from 'react';
import './App.css';
import Login from './components/Login';
import Main from './components/Main'
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
username: '',
password: '',
loggedIn: false
}
}
handleChange = (event) =... | true |
3b7c54f633bda99d24755f4950fa17c334901a06 | JavaScript | zhu-tom/Thought-Bank | /frontend/src/components/Post.js | UTF-8 | 2,709 | 2.53125 | 3 | [] | no_license | import React from 'react';
import { Segment, Form, Button, Container, Checkbox, Message, Transition } from 'semantic-ui-react';
export default class Post extends React.Component {
constructor(props) {
super(props);
this.state = {
post: "",
isAnon: false,
loading:... | true |
53b3fb5350cb8cfb784e5b80e5c64d56252ff740 | JavaScript | Autumn1992/EgretDemoExample | /OfficalExample/CoreExample/bin-debug/egret/net/HttpRequestExample.js | UTF-8 | 4,140 | 2.953125 | 3 | [] | no_license | var __reflect = (this && this.__reflect) || function (p, c, t) {
p.__class__ = c, t ? t.push(c) : t = [c], p.__types__ = p.__types__ ? t.concat(p.__types__) : t;
};
var __extends = this && this.__extends || function __extends(t, e) {
function r() {
this.constructor = t;
}
for (var i in e) e.hasOwnProperty(i) &&... | true |
74bbe3aefa0aabed8477606882dc82290838f948 | JavaScript | VadimDez/news | /app/details/details.js | UTF-8 | 3,588 | 2.625 | 3 | [
"MIT"
] | permissive | /**
* Created by Vadym Yatsyuk on 24.08.17
*/
import React from 'react';
import { Button } from 'antd';
import { NewsService } from '../services/news.service';
import { CommentForm } from '../comment-form/comment-form';
import { Comment } from '../comment/comment';
import { News } from '../news/news';
import { Stor... | true |
a43024259f644968f8c89e5e443b9c1e079f5bc4 | JavaScript | sunhaikuo/waterfall | /js/use_javascript.js | UTF-8 | 2,490 | 2.890625 | 3 | [] | no_license | var imgData = [{"src":"30.jpg"},{"src":"31.jpg"},{"src":"32.jpg"},{"src":"33.jpg"},{"src":"34.jpg"}];
window.onload=function(){
if(checkScrollSide()) {
loadData();
}
waterfall('main','box');
window.onscroll = function() {
if(checkScrollSide()) {
loadData();
waterfall('main','box');
}
}
}
// 加载数据方法... | true |
7509c85aeae73374e71cc75ea28216e4b91f4e73 | JavaScript | tusharadi25/Texto | /texto/scr.js | UTF-8 | 485 | 2.875 | 3 | [] | no_license | function validateform() {
var x = document.forms["Login"]["email"].value;
var password = document.forms["Login"]["passwd"].value;
var atpos = x.indexOf("@");
var dotpos = x.lastIndexOf(".");
if (atpos < 1 || dotpos < atpos + 2 || dotpos + 2 >= x.length) {
alert("Not a valid e-mail addr... | true |
e2609e94b98a6402e47d21681092b2a5b0d0e503 | JavaScript | fluxroid/calculator-react | /src/App.js | UTF-8 | 3,049 | 2.9375 | 3 | [] | no_license | import React, { Component } from 'react';
import calculate from './util.js';
import {numbers, operations, keywords} from './constants.js';
import './App.css';
class App extends Component {
render() {
return (
<Calculator />
);
}
}
class Calculator extends Component {
constructor(props) {
super... | true |
52ab9e322ac536f5ffcf1fd9a64f057b70042f2d | JavaScript | maxim-bogdanov/Snake-game | /js/components/renderer/renderer.js | UTF-8 | 5,054 | 3.171875 | 3 | [] | no_license | class Renderer {
#cellSize;
#gameField;
#snake;
#canvas;
#ctx;
#width;
#height;
firstBonus = true;
t = 1;
constructor( gameField, snake, cellSize ){
this.#gameField = gameField;
this.#snake = snake;
this.#cellSize = cellSize;
}
reset() {
... | true |
21b845334d9ffb43c25113827c89d9373350f10a | JavaScript | RedMarbles/sun-qiang | /commands/backstory.js | UTF-8 | 2,763 | 2.90625 | 3 | [] | no_license | // Creates a random backstory for the user's convenience
const { RichEmbed } = require('discord.js');
const colors = require('../data/colors.js');
const backstory_data = [
{
tag: 'origins',
intro: 'You grew up happily in a ',
options: [
'quiet farming village,',
'prosperous merchant town,',
'universit... | true |
0f9889ddfe91f43426a96292febfa1a0fa6d86e9 | JavaScript | raimundojimenez/jwt-crack | /test/hmac/test.js | UTF-8 | 466 | 2.796875 | 3 | [
"MIT"
] | permissive | // Some don't match, but they already take longer so there's no point
const libs = require('./lib');
const data = require('./data');
Object.keys(libs).forEach(test);
function test(lib) {
console.log(lib + '>');
if (check(lib, 1)) {
check(lib, 2);
}
}
function check(lib, num) {
const hmac = libs[lib];
c... | true |
fcaede1fe7b55d6d45cd97a349f0582224ddc558 | JavaScript | AnnaLangner/myOwnTrello | /js/script.js | UTF-8 | 7,918 | 2.90625 | 3 | [] | no_license | 'use strict';
document.addEventListener('DOMContentLoaded', function() {
var baseUrl = 'https://cors-anywhere.herokuapp.com/https://kodilla.com/pl/bootcamp-api';
var url = 'https://kodilla.com/pl/bootcamp-api';
var myHeaders = {
'X-Client-Id': 3928,
'X-Auth-Token': '0ea2f56d8f2dfe1f0937c687e65bfc4b'
};
//Add... | true |
2d7dc7a0507f07330d19891ba7175a35f3500497 | JavaScript | christophebrumby/FEWD | /Week06/lesson12/homework/carousel/js/index.js | UTF-8 | 804 | 3.25 | 3 | [] | no_license | var images = ["animal1", "animal2", "animal3", "animal4", "animal5", "animal6"];
var position = 0;
function imageSource(slideNumber) {
$("img").attr("src","./images/animals/" + images[slideNumber] + ".jpg");
}
function showPrevious () {
if (position > 1) {
position--;
imageSource(position);
$("#forw... | true |
771b4f8df30131a7fce07b299466a96b18c2f1c3 | JavaScript | jayz28/Slashbot | /_content/boosts/watermoon/force.js | UTF-8 | 1,806 | 2.828125 | 3 | [
"MIT"
] | permissive | const WatermoonBoost = require('@app/content/boosts/watermoon').WatermoonBoost;
const BOOST_TYPE = 'watermoon-force';
const FLAG_BOOST_WATERMOON_FORCE_3_DAY_WARNING_GIVEN = 'boost_watermoon_force_3_day_warning_given';
/**
* +25% Force while in Watermoon.
*/
class WatermoonForceBoost extends WatermoonBoost {
/**
... | true |
6fb88742040d3a41c8b5fddfb891021d3689eb7e | JavaScript | mukulkhanna/Visualizations-with-p5js | /Prominent color extraction using K-Means algorithm/sketch.js | UTF-8 | 4,391 | 2.84375 | 3 | [] | no_license | var colors = []
var clusterzero = []
var clusterone = []
var clustertwo = []
var iteration = 0
function preload() {
img = loadImage("https://scontent-lht6-1.cdninstagram.com/vp/612e0b1342e36a1301d7cb6137ba46f9/5C8FA513/t51.2885-15/e35/s320x320/44519032_2038704929754898_4866812445527614875_n.jpg")
}
function setup... | true |
232d78eb2c85eb2773f9e904261a528f66ba2816 | JavaScript | jesse-spevack/Pretty-Good-Booking | /lib/Event.js | UTF-8 | 2,303 | 2.703125 | 3 | [] | no_license | function createCalendarEvent() {
var eventData = getEventInputsFromLastResponse();
var calendar = CalendarApp.getCalendarById(getCalendarId_());
try {
calendar.createEvent(eventData.title, eventData.startDateTime, eventData.endDateTime)
} catch(error) {
showAlert('Something went wrong', 'We could not c... | true |
c3ab831055a2f40be688f7c3ea6c8805bf02a054 | JavaScript | Islemmellehi/Learning-Axios | /src/components/Patch.js | UTF-8 | 1,228 | 2.828125 | 3 | [] | no_license | import axios from "axios";
import Modal from "react-modal";
import { useState } from "react";
function Patch() {
const [x,setX]= useState(null);
const [modalisOpen, setModalIsOpen] = useState(false);
const[loading,setLoading] = useState(false);
function closeModelHandler() {
setModalIsOpen(false);
... | true |
53a904d02df4190089ded44b18cd9c522f8607a4 | JavaScript | IvanMelo1/retosjs | /js/Reto6.js | UTF-8 | 748 | 3.5625 | 4 | [] | no_license | var muestra = " ";
var sumaar = 0;
function calcularmedia(){
suma = 0;
sumaar = 0;
muestra = document.getElementById('muestra-no').value;
muestra=muestra.trim();
let array = muestra.split(",");
console.log(array);
for(let i = 0; i<array.length; i++){
suma += Number(array[i]);
... | true |
c4841c77c8c3bb1b5aed64d7942fc4d2274a3a9e | JavaScript | Jamsek-m/krv-project-code | /testing/simple-web-client/script.js | UTF-8 | 4,290 | 2.9375 | 3 | [] | no_license | const CLIENT_ID = "testni";
function getQueryParam(paramName) {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get(paramName);
}
class AuthState {
static __instance = null;
/**
* Returns singleton instance
* @returns {AuthState}
*/
static getInstanc... | true |
b6352e11ebf1ba9963f00f7ca425c8e0850241e7 | JavaScript | panfuzeng/hkzf-mobile | /src/utils/index.js | UTF-8 | 861 | 2.671875 | 3 | [] | no_license | import axiox from 'axios'
// 取当前城市
function getCity() {
return JSON.parse(localStorage.getItem('cityName'))
}
// 存当前城市
export function setCity(city) {
return localStorage.setItem('cityName', JSON.stringify(city))
}
export function getCurrenCity() {
const city = getCity()
if (city) {
return Promise.resolve(... | true |
07e5ff29b7b65b84881876230a48fddd8ba4a218 | JavaScript | catriona-reader/d3-inspiration | /random_rainbow_bars/theScript.js | UTF-8 | 537 | 3.15625 | 3 | [] | no_license | let dataset = [];
for (let i = 0; i < 20; i++) {
dataset.push(Math.random() * 30)
};
const colors = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet']
function randomColor() {
let c = colors[ Math.floor(Math.random() * 7) ];
console.log(c);
return c
};
d3.select("body").selectAl... | true |
4b3f3425619b6188f87e1fbfbddc763f9c275227 | JavaScript | matthewort/js-snack-es6 | /ex8/js/myscript.js | UTF-8 | 1,196 | 3.484375 | 3 | [] | no_license |
// Creare un array di oggetti di squadre di calcio. Ogni squadra avrà diverse proprietà: nome, punti fatti, falli subiti.
// Nome sarà l’unica proprietà da compilare, le altre saranno tutte settate a 0.
// STEP”:
// Generare numeri random al posto degli 0 nelle proprietà: punti fatti e falli subiti
// consegna 12.25
... | true |
b295603aa2e9db10e84032404a3a4bf3f39db8ec | JavaScript | jtvarughese/scope_dom_event | /events.js | UTF-8 | 993 | 3.46875 | 3 | [] | no_license | //Question 1
// button click event
function button1() {
document.getElementById('response').innerText = "I'm right!";
}
function button2() {
document.getElementById('response').innerText = "No I'm right!"
}
// Question 2
// hover paragraph
document.getElementById("hoverParagraph").addEventListener("mouseenter", fun... | true |
08f9a3ca2339e0f8e4fdb375d08d14c7cb1c2238 | JavaScript | junbeomAn/used-book-dealing | /src/store/modules/postItem.js | UTF-8 | 2,244 | 2.71875 | 3 | [] | no_license | import { createAction, handleActions } from "redux-actions";
import axios from "axios";
// 게시글 추가, 수정 모듈
const port = 3001;
const url = "http://192.168.64.145";
const postItemApi = productData => {
return axios.post(`${url}:${port}/product/insertProduct`, productData);
};
const updateItemApi = (productData) => {... | true |
5d02a2740becb11ebc91883f1986b3f8b87b9747 | JavaScript | RichCaloggero/audio-components | /source/ui-number.js | UTF-8 | 3,579 | 2.71875 | 3 | [] | no_license | import {PolymerElement, html} from "./@polymer/polymer/polymer-element.js";
import {UI, defineKey, hasModifierKeys} from "./ui.js";
let instanceCount = 0;
class UINumber extends UI {
static get template () {
return html`
<div class="ui-number">
<label for="input">[[label]]</label>
<br><input id="input" type="[[type... | true |
2b15dd9c562603342d35cef3d9140e6008f30c44 | JavaScript | Xerios/piecs | /packages/asm-piecs/__tests__/Query.js | UTF-8 | 1,180 | 2.53125 | 3 | [
"MIT"
] | permissive | const assert = require('assert')
const { describe, test } = require('./utils')
const {
Archetype,
BitMask,
} = require('..')
const {
and,
or,
all,
any,
not,
query
} = require('../glue')
module.exports = describe('Query', () => {
const archMask = new BitMask(5)
archMask.or(0)
... | true |
447a74e9a2916fc7e8dde59623dc529ddc64ea43 | JavaScript | tuBARetkin/lookbook | /lookbook-web/src/main/webapp/resources/js/app/dictionary/DictionaryModel.js | UTF-8 | 4,599 | 2.625 | 3 | [] | no_license | /**
* User: NGorelov
* Date: 04.09.12
* Time: 13:27
*/
$(function(){
window.DictionaryData = Backbone.Model.extend({
url: '/lookbook/dictionary/save/',
defaults: {
dicName: null,
dataKey: null,
ruValue: null,
enValue: null,
subData: n... | true |
3e57d75b93877c90e3045e449a07fff127cd9fdf | JavaScript | llndklzr/thinkful-grad-jobs | /front-end/src/components/map/MapParent.js | UTF-8 | 1,571 | 2.578125 | 3 | [] | no_license | import React, {useState, useEffect} from "react";
import GoogleApiWrapper from "./GoogleApiWrapper";
import MapMenu from "./MapMenu";
import { filterResultsForMap } from "../../utils/apiFetcher";
export default function MapParent(){
const initialFilterOptions = {
companyFilter: "",
locationFilter: "",
f... | true |
fc3704b85df4ff1c9e82acd15cee185bd99740d7 | JavaScript | up887818/Team7A-Meal-Planner | /client/js/home.js | UTF-8 | 791 | 2.5625 | 3 | [] | no_license | 'use strict';
import {
search,
searchBar
} from "./search.js"
async function showAllRecipes(event) {
search();
}
async function showFavRecipes(event) {
return "this function isn't ready yet";
}
async function showCalendar(event) {
window.location.href = "calendar.html";
}
function homeSearchBar(event) {
... | true |
a2a109e17cb24a073653a191a0e370d04a008f5e | JavaScript | kirel/detexify | /source/javascripts/lib/jquery.raphael.canvassify.js | UTF-8 | 3,574 | 2.71875 | 3 | [
"MIT"
] | permissive | (function($) {
function Point(x,y) {
this.x = x;
this.y = y;
this.t = (new Date()).getTime();
}
function stroke2path(stroke) {
var first = _.first(stroke);
var path = _.map(_.rest(stroke), function(point) { return ["L", point.x, point.y]; })
if (path.length == 0)
return [["M", ... | true |
21d41e20322e3f875f12163123e17e05e6aee678 | JavaScript | Einsteinder/pajamastollamas | /src/reducers/posts.js | UTF-8 | 1,222 | 2.8125 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license |
const posts = (state = [], action) => {
switch (action.type) {
case 'ADD_LIKE':
return state.map(post=>
(post.id===action.id)?{...post,voteScore:post.voteScore+1}:post)
case 'ADD_POST':
return [
...state,
action.post
]
case 'RECEIVE_POS... | true |
0540851226f2b29c610349dd7c78fa56b0ea618b | JavaScript | nabrus/js-exercises | /algorithms/freeCodeCamp/sliceAndSplice.js | UTF-8 | 1,539 | 5.15625 | 5 | [] | no_license | /*
You are given two arrays and an index.
Use the array methods slice and splice to copy each element of the first
array into the second array, in order.
Begin inserting elements at index n of the second array.
Return the resulting array. The input arrays should remain the same after
the function runs.
... | true |
559d9712271f4c425ea02654f85eab833efc91a6 | JavaScript | open768/CA | /js/CA/cacell.js | UTF-8 | 7,555 | 2.828125 | 3 | [
"CC-BY-4.0"
] | permissive | "use strict"
/**************************************************************************
Copyright (C) Chicken Katsu 2013-2022
This code is protected by copyright under the terms of the
Creative Commons Attribution 4.0 International License
https://creativecommons.org/licenses/by/4.0/legalcode
For licenses that allow ... | true |
8e2f6bca5a38565b97046de445332ce7e1dce75d | JavaScript | spat-ne-hochu/t-26.08.19 | /src/App.js | UTF-8 | 1,678 | 2.515625 | 3 | [] | no_license | import React from 'react';
import { connect } from 'react-redux'
import Chart from './components/Chart';
import {changePeriodThunk, changeValueThunk, loadingThunk} from "./thunks";
const periods = [
{ value: 7, text: 'Week' },
{ value: 30, text: 'Month' },
{ value: 120, text: 'Quarter' },
{ value: 365, text: '... | true |
d7c07f38546f75c7a5dea7f26654967d8d92714c | JavaScript | b1a9id/clothes-house | /frontend/src/reducers/Genre.js | UTF-8 | 497 | 2.640625 | 3 | [] | no_license | import * as actionType from '../constants/ActionType';
const initialState = {
genres: [],
error: false
}
export default (state = initialState, action) => {
switch (action.type) {
case actionType.START_GET_GENRES:
return {
genres: [],
error: false
};
case actionType.GET_GENRES... | true |
908b54585d0d29e75b86de422562c149e868125b | JavaScript | yorch-el-profe/TECP0006FSPYOL2104 | /circulo_estudio/jersey_api/ejemplo_import_export/calculadora.js | UTF-8 | 453 | 3.03125 | 3 | [] | no_license | function suma(a, b) {
return a + b;
}
function resta(a, b) {
return a - b;
}
function multiplicacion(a, b) {
return a * b;
}
function division(a, b) {
return a / b;
}
/*
exports.suma = function (a, b) {
return a + b;
}
exports.resta = function (a, b) {
return a - b;
}
*/
// Exportar todo d... | true |
ef73b1e49c60a768ee51ad91ec671defa3202d71 | JavaScript | farque65/noadsgaming | /src/GamingTools.js | UTF-8 | 2,558 | 2.96875 | 3 | [] | no_license | import React, { useState } from 'react'
import './GamingTools.css'
import { TextareaAutosize } from '@material-ui/core';
import _ from 'lodash';
const GamingTools = () => {
const [members, setMembers] = useState();
const [teamNames, setTeamNames] = useState();
const [teams, setTeams] = useState('');
function copy... | true |
ea645f61f39accbb4a436abc974034ec27ba5e8b | JavaScript | ubipo/web4pe | /src/main/resources/static/js/blog.js | UTF-8 | 1,444 | 2.921875 | 3 | [] | no_license | /**
* Blog client UI
*/
window.addEventListener('load', () => {
const ePostSections = document.getElementsByClassName('post-sections')
const s = new Stomp()
s.connect().then(() => {
console.log('Connected!')
const commentsLists = {}
for (const ePostSection of Array.from(ePostSections)) {
con... | true |
c5dee67664120aaf4bc014e02828d6422014649e | JavaScript | narayand-vb/restApi | /src/modal/user.js | UTF-8 | 1,127 | 2.53125 | 3 | [] | no_license | const mongoose = require("mongoose");
const bcrypt = require("bcrypt");
const jwt = require("jsonwebtoken");
// SCHEMA DEFINATION //
const userSchema = mongoose.Schema({
first_name: String,
last_name: String,
email: {
type: String,
required: true,
unique: true,
},
role: String,
profile_image: ... | true |
9a69e0853c01cfe3d76f42fac076ec14d1dbdd98 | JavaScript | Nhiokh/gatsby-blog | /src/components/Contact/index.js | UTF-8 | 3,277 | 2.53125 | 3 | [
"MIT"
] | permissive | import React from "react";
import Link from "gatsby-link";
import Helmet from "react-helmet";
import './contact.scss'
function encode(data) {
return Object.keys(data)
.map(key => encodeURIComponent(key) + "=" + encodeURIComponent(data[key]))
.join("&");
}
export default class Contact extends React.Comp... | true |
ea99579bc04825a165e241ccdeb9249cbb3d6e2b | JavaScript | CristobalBravo/firstapp-react | /src/helpers/GetGiftByCategory.js | UTF-8 | 471 | 2.6875 | 3 | [] | no_license | const API_KEY = 'vXM8u3nRlBTItbN2qfKcNVF5aHpAxWH6';
export const getGifByCategory = async( category) =>{
const limit = 10;
const url =`https://api.giphy.com/v1/gifs/search?q=${category}&limit=${limit}&api_key=${API_KEY}`;
const resp = await fetch(url);
const {data} = await resp.json();
const gifts ... | true |
a4e0eb04aa2ca0748e75dfc9e8a1306975e21748 | JavaScript | sirleito/juego-cartas | /js/inicio/inicio.js | UTF-8 | 3,338 | 2.828125 | 3 | [] | no_license | (function(){
peticion("mapa.html", mapaFunc)
function mapaFunc(){
mapa.addEventListener("click", iniciar)
}
function iniciar(e){
peticion("ministros.html", ministrosFunc)
console.log(e.target.dataset.link)
}
// global.maquetarMapas = maquetarMapas
function ministrosFunc(){
const cartaSigno = global.creador("img... | true |
b25c5a3c49811a0c12f9a3d50da507cc53b243d9 | JavaScript | limaoxuan/limaoxuan.github.io | /assignments/homework8/js/fifteen.js | UTF-8 | 4,737 | 3.25 | 3 | [] | no_license | // record random point;
(function () {
'use strict';
let record = [];
let myDiv;
let empty = {left: 300, top: 300};
let stack = [];
var divs = [];
let init = function () {
var puzzleArea = document.getElementById('puzzlearea');
divs = puzzleArea.getElementsByTagName("div");... | true |
bf4f937eff7ac372fcc241f26834baac3b1f4c5d | JavaScript | MagusM/Angular1-github-simple-website | /UserController.js | UTF-8 | 2,572 | 2.546875 | 3 | [] | no_license | (function(){
var app = angular.module("cindy");
var UserController = function($scope, cindy) {
cindy.instantiateDB();
/*
* show add/remove another repo divs
*/
$scope.showAddDiv = function() {
$scope.show = "addRepoDiv";
};
$scope.showRemoveDiv = function() {
$scope.show = "removeRepoDiv";
};... | true |
9efe6d7724a229e45ef72e9c7569ec133320875e | JavaScript | dardenfall/practiceProblems | /old/oneLine.js | UTF-8 | 2,873 | 3.78125 | 4 | [] | no_license | "use strict";
function getOneLineWordsBrute (words){
var oneLineWords = [];
const keyRows = [['q','w','e','r','t','y','u','i','o','p'],
['a','s','d','f','g','h','j','k','l'],
['z','x','c','v','b','n','m']];
oneLineWords = words.filter(function(word){
word = word.toLowerCase();
return keyRows.so... | true |
98df887bea0335b7205d93f9f671d3321eb8970c | JavaScript | developma/react-study | /review-timing/src/App.js | UTF-8 | 3,612 | 2.71875 | 3 | [] | no_license | import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import DatePicker from 'react-datepicker'
import moment from 'moment'
import 'react-datepicker/dist/react-datepicker.css';
class App extends Component {
constructor (props) {
super(props)
this.state = {
start... | true |
fd785a944f7c7ccb029f5884469d8a34611c444b | JavaScript | egunn/2016-SWC | /NoahsThreeFiles/2016-SWC-1-master/01/js/survey.js | UTF-8 | 3,860 | 2.75 | 3 | [] | no_license | (function() {
var data = [];
var dimensions = [
{ key: "criticalcommunication", value: 'Communication'},
{ key: "criticalcommunication_2", value: "Communication 2"},
{ key: "graphicdesign", value: "Graphic Design"},
{ key: "graphicdesign_2", value: "Graphic Design 2"},
{ key: "howlongdidittakeyo... | true |
d78e2487002c2fbe0f3c1ce3dc80415722c70d6e | JavaScript | vishaljansari/ReactJS | /src/app/index.js | UTF-8 | 2,154 | 2.796875 | 3 | [] | no_license | const React = require("react")
const ReactDom = require("react-dom")
require("./css/index.css")
import {Router,Route,browserHistory, Link} from 'react-router'
const TodoItem = require("./todoitem")
const AddItem = require("./additem")
const About = require("./about")
const App = React.createClass({
render:func... | true |
8b8f22fdeaa920e44bd7f8a9d80eaad0ae5645ed | JavaScript | Aayush2398/healthViz | /UHacks-master/HealthViz/js/chart.js | UTF-8 | 3,810 | 2.671875 | 3 | [] | no_license |
base_url = 'http://192.168.43.3:8000';
$(document).ready(function(){
var date = $('#time_ser').find(':selected').text();
$('#myChart2Trigger').html('');
$.ajax({
type: 'POST',
url: base_url+'/api/v1/time_series_plot',
//crossDomain: true,
data: {
'from_date': '2017-10-14' ,
'to... | true |
5c1cfbbe9d066b2f94f6a60560bf949f798ae0e1 | JavaScript | keshavbansal20/file_system_HW | /raw/test1.js | UTF-8 | 624 | 2.75 | 3 | [] | no_license | let fs = require("fs");
const readline = require('readline');
let path = require("path");
let input = process.argv.slice(2);
src = input[0];
for(let i = 0 ; i < input.length ; i++){
src = input[i];
display(path.join(src));
}
function display(file){
const readInterface = readline.createInterface({
... | true |
5f7c1a45e002ba63fdccac49c79e93ab3012df60 | JavaScript | carlosstc1/3e20ds | /2p/Grafos/Ej1.js | UTF-8 | 1,151 | 3.609375 | 4 | [] | no_license | class size {
constructor(o) {
this.n = o
}
addVertex(v) {
this.n[v] = 0
}
addEdge(e, x) {
if (typeof (this.n[e] === "number")) {
this.n[e] = []
}
this.n[e][x] = 1
}
fill() {
for (let... | true |
583c580dc2168f25bea618e67fefe867f5822fee | JavaScript | nxidplease/nwRisk | /battleDialogController.js | UTF-8 | 1,259 | 2.8125 | 3 | [] | no_license | const MAX_ATTACKERS = 3;
const MAX_DEFENDERS = 2;
function BattleDialogController(sourceArea, destArea) {
this.sourceArea = sourceArea;
this.destArea = destArea;
this.modalBackground = select('.modal-background');
this.modalContentDiv = select('.modal-content');
if (this.modalBackground === null) ... | true |
6927505c2bc2d186a04fb514d2965e0056e161e7 | JavaScript | sproutcore/sproutcore | /frameworks/runtime/mixins/copyable.js | UTF-8 | 2,574 | 3.03125 | 3 | [
"MIT"
] | permissive | // ==========================================================================
// Project: SproutCore Costello - Property Observing Library
// Copyright: ©2006-2011 Strobe Inc. and contributors.
// Portions ©2008-2011 Apple Inc. All rights reserved.
// License: Licensed under MIT license (see license.js)
... | true |
b5ff821f51e09f0c8f66934d07b51b9b52d410ac | JavaScript | SonTrungTo/Full_Stack | /EloquentJS/highOrderFunction.js | UTF-8 | 1,325 | 4.15625 | 4 | [
"MIT"
] | permissive | // array.forEach(f) => action on element of an array
function repeat(array, action) {
for (let element of array) {
action(element);
}
}
// array.filter(f) => an array of whose element is filtered(Boolean) by a function
function filter(array, test) {
let passed = [];
for (let element of array) {
if (tes... | true |
e2fe4693aa729ed84104217b709b38e8ee0d73f9 | JavaScript | nfears19/Employee-Tracker | /employeeTracker.js | UTF-8 | 1,810 | 2.796875 | 3 | [] | no_license | const mysql = require('mysql')
const inquirer = require('inquirer')
const connection = mysql.createConnection({
host: 'localhost',
port: 3306,
user: 'root',
password: process.env.DB_password,
database: 'employee_tracker_db',
})
const promptUser = () => {
inquirer.prompt([
{
type: 'l... | true |
8634ffeab6ad62a7eae5513b67324d2d4454b107 | JavaScript | worldsaber/fe | /src/modules/main/desktop/common/base/js/date4YearMonDay.js | UTF-8 | 1,336 | 3.328125 | 3 | [] | no_license | export const monthData = [
{ name: 'Jan', value: '01' },
{ name: 'Feb', value: '02' },
{ name: 'Mar', value: '03' },
{ name: 'Apr', value: '04' },
{ name: 'May', value: '05' },
{ name: 'June', value: '06' },
{ name: 'July', value: '07' },
{ name: 'Aug', value: '08' },
{ name: 'Sept', value: '09' },
{ name: 'O... | true |
991a4b5e914cde360f916e8c6a1f92c6fe053f36 | JavaScript | orthecreedence/mootools-core | /Specs/1.4client/Element/Element.Style.js | UTF-8 | 6,667 | 2.625 | 3 | [] | no_license | /*
---
name: Element Specs
description: n/a
requires: [Core/Element.Style]
provides: [Element.Style.Specs]
...
*/
describe('Element.Style', function(){
describe('opacity', function(){
beforeEach(function(){
var className = String.uniqueID();
var style = this.style = $(document.createElement('style'));
sty... | true |
3767796767b32ede5615dbb35f96b6175bc30cab | JavaScript | itsrafsanjani/react-todo-app | /src/Components/ToDoList.jsx | UTF-8 | 1,482 | 2.6875 | 3 | [] | no_license | import React from "react";
import { v4 as uuid } from "uuid";
import ToDoItem from "./ToDoItem";
import TodoForm from "./ToDoForm";
export default class ToDoList extends React.Component {
constructor(props) {
super(props);
this.state = {
todos: JSON.parse(localStorage.getItem("todos")) || [
{ content: "Add... | true |
c61aa8b8364c4f175691a588a683e0ebbbdded95 | JavaScript | znamazbayeva/my-app | /src/component/randomUser.js | UTF-8 | 713 | 2.640625 | 3 | [] | no_license | import React, { Component } from 'react'
import {connect} from 'react-redux'
import {getRandomUser} from '../store/actions/randomAction'
class randomUser extends Component {
constructor(props) {
super(props);
}
componentDidMount(){
this.interval = setInterval(() => {
this.props... | true |
16c3b52eeae835fc274173a4caaff60bab51d5a6 | JavaScript | mojie178/algorithm_list | /jump_game.js | UTF-8 | 1,291 | 4.09375 | 4 | [] | no_license | /*
* @Title: 跳跃游戏
* @Descripttion: https://leetcode-cn.com/problems/jump-game-ii/
* @Question:
* 给定一个非负整数数组,最初位于数组的第一个位置。
* 数组中的每个元素代表在该位置可以跳跃的最大长度
* 目标是使用最小的跳跃次数到达数组的最后一个位置
*/
/**
* @name jump_game
* @param {number[]} nums
* @return {number}
*/
function jump_game(nums) {
let len = nums.length; // 获取长度
... | true |
052e1497fdaa62f9c106153d29eb24f12c5e0c1e | JavaScript | TeamYowie/MeetUps-WebApp | /app/scripts/utils.js | UTF-8 | 755 | 2.734375 | 3 | [
"MIT"
] | permissive | const STORAGE_ID_KEY = "id";
const STORAGE_AUTH_KEY = "auth-key";
export class Utils {
static isLoggedIn() {
return Promise
.resolve()
.then(() => {
return !!localStorage.getItem(STORAGE_ID_KEY) && !!localStorage.getItem(STORAGE_AUTH_KEY);
});
}
s... | true |
1dd6410038f823b4d065b975c2ef8886ca9123cd | JavaScript | PaulElis/freestyle-front-end | /src/actions/actions.js | UTF-8 | 3,887 | 2.53125 | 3 | [] | no_license | // const URL = 'http://localhost:3000/api/v1'
const URL = 'https://freelancer-backend.herokuapp.com/api/v1'
const headers = { "Content-Type": "application/json"}
export function login(username, password){
return (dispatch) => {
return fetch(URL + "/login", {
method: "POST",
headers: headers,
body: JSON.str... | true |
fa6d9c8ec2fa58d2885af8c370dfe77481387acd | JavaScript | bervenuzik/reactionGame | /script.js | UTF-8 | 3,102 | 2.953125 | 3 | [] | no_license | document.body.addEventListener("click", redLigth);
let startTime;
let finishTime;
let resultTime;
let check = true;
let done = false;
let resultStorage = localStorage;
let bestresultNode = document.querySelector(".bestResult");
console.log(resultStorage);
if (resultStorage.getItem("bestResult") == !true ) {
... | true |
395167a1ee985349e38a64bcffa5a8cbe29dcc54 | JavaScript | ilian6806/ilian-iliev.com | /games/Basketball/scripts/game.js | UTF-8 | 2,645 | 2.9375 | 3 | [
"MIT"
] | permissive |
$(document).ready(function() {
game();
});
//prevent images dragging
$('.static').on('dragstart', function(event) { event.preventDefault(); });
function game(){
var MAX_POINTS = 200;
var MAX_TIME = 30;
var SCREEN_OFFSET = 300;
var MIN_LEFT_OFFSET = 10;
var MIN_TOP_OFFSET = 120;
$('#score').html(0);
/... | true |
01a24108365cc3bffe6944e72782782921af6db2 | JavaScript | LeeGar/toy-problemos | /reverseVowels.js | UTF-8 | 489 | 3.859375 | 4 | [] | no_license | var reverseVowels = function (string) {
var vowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'];
var str = '';
var foundVowels = [];
for (var i=0; i < string.length; i++) {
if (vowels.indexOf(string[i]) !== -1) {
foundVowels.unshift(string[i])
}
};
for (var i=0; i < string.length; i++) {
if (v... | true |
b652e3877341c417bb19f5bea8d55cfedee7bbac | JavaScript | sanalpanicker-zz/Books-Key-Value-Sorting | /script/app.js | UTF-8 | 1,582 | 3.3125 | 3 | [] | no_license | //Setting constants
var DATA_URL = "https://api.myjson.com/bins/ho58r",
data;
//Initial load call
getData(DATA_URL);
/**
* @desc displays the UI based on data formatted
* @param object $data - the data to be iterated
* @return NA
*/
function displayData(data) {
//getting val arrays to form the chart
... | true |
9dd04ec270b3434f449b2f865cd4789912fc9b0b | JavaScript | magedbgt/txtrpg | /currentRoom.js | UTF-8 | 1,857 | 2.984375 | 3 | [] | no_license | //global variables
let currentRoom = 'start';
let backRoom = '';
let inventory = [];
let hp = 100;
let maxHP = 100;
let mp = 50;
let maxMP = 50;
let xp = 0;
let level = 1;
let charName = 'Adventurer';
let saveGameState = 0;
let screenName = 'start';
let atk = 5;
let atkm = 2;
//randomizing numbers
function getRndInteg... | true |
8d0509e22beef9635f5bc1765791a6453f46404b | JavaScript | mlgjsk/DataVisualization | /Data Visualization/04.change-data-styles.js | UTF-8 | 693 | 3.71875 | 4 | [
"MIT"
] | permissive | /**
* Add the style() method to the code in the editor to set the color of the h2 elements conditionally. Write the callback function
* so if the data value is less than 20, it returns "red", otherwise it returns "green".
Note
You can use if-else logic, or the ternary operator.
*/
<body>
<script>
const datase... | true |
6ffdca8778c360475ed1fe59265b23228bb3ddf1 | JavaScript | 785184273/school | /www/test/js/index.js | UTF-8 | 1,557 | 3.859375 | 4 | [] | no_license | /* 每个参数的数组整合成一个数组
* _.zip(['a', 'b'], [1, 2], [true, false]); // => [['a', 1, true], ['b', 2, false]]
* _.zip(['a', 'b'], [1, 2, 3], [true, false]); // => [['a', 1, true], ['b', 2, false]]
* _.zip(['a'], [1, 2, 3]); // => [['a', 1]]
*
*/
var zip = function () {
var arrays = [];
for (var _i = 0; _i < arguments.l... | true |
6dac8adebf51279bab47d6175207c231fee94632 | JavaScript | g010329/STYLiSH | /JS/cartPage.js | UTF-8 | 10,083 | 2.703125 | 3 | [] | no_license | let ptID = location.search.substring(4,location.search.length);
let cartArray = JSON.parse(localStorage.getItem('cart'));
let calItemTotal=0;
function render(){
cartArray = JSON.parse(localStorage.getItem('cart'));
//渲染商品頁
//從localStorage抓總商品數並顯示在右上角
totalCount=0;
if (cartArray==null){
doc... | true |
1078e5466a5e63f32baae5e583a6e52f16d88cab | JavaScript | A-Team-Has-No-Name/Web | /src/components/category_detail/charts/Chart.js | UTF-8 | 1,550 | 2.671875 | 3 | [] | no_license | import React from 'react';
import axios from 'axios';
export default class Chart extends React.Component{
chart(){
let dps = []; // dataPoints
let chart = new CanvasJS.Chart("chartContainer", {
title :{
text: "Dynamic Data"
},
axisY: {
... | true |
4725bbb7de36c405482aa30a0b22b39c9832b33c | JavaScript | dimitrijejankov/buffermanager-viewer | /web/load-page.js | UTF-8 | 6,687 | 2.671875 | 3 | [] | no_license | // this is initalizing our environment
function loadMe() {
var timeline;
var timelinePoints = [];
var symbols = null;
var backendSymbols = null;
var traces = null;
var backendTraces = null;
google.charts.load('current', {'packages':['treemap']});
// init the timeline file loading
... | true |
4ce544b766eadf727453b82829b1cfb10641c6c5 | JavaScript | brunocardosof1991/geradorxml | /js/tableResponsive.js | UTF-8 | 384 | 3.0625 | 3 | [] | no_license | $(document).ready(function(){
$('.js-table-data td').each(function(){
var tdIndex = $(this).index();
if ($('tr').find('th').eq(tdIndex).attr('data-label')) {
var thText = $('tr').find('th').eq(tdIndex).data('label');
} else {
var thText = $('tr').find('th').eq(tdIndex).text();
... | true |
a6bda6b1bfd2aed19b4840dead100242d4c374b0 | JavaScript | lvs007/web-base | /sangong/src/main/resources/static/js/socket.js | UTF-8 | 771 | 2.734375 | 3 | [] | no_license | var websocket = null;
//判断当前浏览器是否支持WebSocket
if('WebSocket' in window){
var token = getToken("nb_token");
websocket = new WebSocket("ws://127.0.0.1:9095/gamesocket?token="+token);
}
else{
alert('Not support websocket')
}
//连接发生错误的回调方法
websocket.onerror = function(){
};
//连接关闭的回调方法
websocket.onclose = fun... | true |
7be54ea1c46eaac76c5d1cdb8361c3f8e77c1e9e | JavaScript | benforshey/FSU-WDD | /ASL/tutorial/helloNode.js | UTF-8 | 383 | 2.84375 | 3 | [
"MIT"
] | permissive | var http = require('http'); // add the node http module
var myServer = http.createServer(function (request, response) { // create a server
response.writeHead(200, {
"Content-Type" : "text/html"
});
response.write("You just got served (Oh, and '<b>Hello World</b>')!");
response.end();
});
mySe... | true |
936e7f31195fe62dafe5ceff737a7565d62f930d | JavaScript | BernC/metafinal | /public_html/searchbox_scripts.js | UTF-8 | 761 | 2.859375 | 3 | [] | no_license | function validateForm()
{
var x=document.forms["search"]["find"].value; //get the query input
if (x==null || x=="" || x.length < 2 || x == "\" \"") // invalid query detectors
{
alert("Inaccurate Query input"); //display alert to user
return false;
}
return OnSubmitForm(); //if query is valid trigger the onSub... | true |
7b85e6eae1cd84214c49c6eb242a364f22a72455 | JavaScript | sinha-arpita/javascript | /sorting/bubbleSort.js | UTF-8 | 712 | 3.75 | 4 | [] | no_license | //using to for loops ;first for loop for the number of passes,which will always be less than no of elements in the array.
//second for loop will be responsible to check the numbers and if small then swap.[3,0,1,9,5]
//first pass[0,3,1,9,5]-[0,1,3,9,5]-[0,1,3,5,9]
function bubbleSort(arr){
var i,j,swap,temp;
fo... | true |
ec8e31aafc41184851778df66329268f68828689 | JavaScript | apoorvateli/math4kids | /public/js/quiz.js | UTF-8 | 4,779 | 3.28125 | 3 | [] | no_license | document.addEventListener('DOMContentLoaded',function() {
const quiz = document.querySelector('#quiz');
const score = document.querySelector('#score');
const level = quiz.querySelector('#level');
const num1Element = quiz.querySelector('#num1');
const num2Element = quiz.querySelector('#num2');
const operatorEleme... | true |
20a85628a3bca590bde69da14ff40a5a870f78a2 | JavaScript | Vutov/SoftUni | /JavaScript Basics/Exams/Exam-27-July/04.Concerts/Concerts.js | UTF-8 | 2,432 | 3.109375 | 3 | [] | no_license | function solve(arr) {
var output = {};
for (var i = 0; i < arr.length; i++) {
var line = arr[i];
var data = line.split(/[| ]+ /g);
var city = data[1].toString();
var place = data[3].toString();
var band = data[0].toString();
if (!output[city]) {
... | true |
48642631203bdf4305f5b51d59ff7d11452044a7 | JavaScript | klequis/private-money-client | /src/lib/removeLeadingSlash.js | UTF-8 | 113 | 2.5625 | 3 | [] | no_license | export const removeLeadingSlash = (str) => {
return str.startsWith('/') ? str.substring(1, str.length) : str
}
| true |
7a2c9303dd2c07c60a80d40bb93ad05bbf4a060c | JavaScript | luciotato/waitfor-javascript | /ajax.js | UTF-8 | 3,909 | 2.546875 | 3 | [
"MIT"
] | permissive | //---------------------------------
var AJAX={
new_XMLHttpRequest: function() {
var ref = null;
if (window.XMLHttpRequest) {
ref = new XMLHttpRequest();
} else if (window.ActiveXObject) { // Older IE.
ref = new ActiveXObject("MSXML2.XMLHTTP.3.0");
}
if... | true |
a74ff4171d83426986f8b222c24f08a713868ccb | JavaScript | ventsislavivanov/SoftUniPractice | /ProgrammingBasicwithJavaScript/Lesson/04.ComplexConditonalStetement/07.FruitShop.js | UTF-8 | 1,832 | 3.59375 | 4 | [
"MIT"
] | permissive | function store([arg1, arg2, arg3]) {
let fruit = arg1.toLowerCase();
let day = arg2.toLowerCase();
let quantity = Number(arg3);
let price = -1;
if (day == "monday" || day == "tuesday" || day == "wednesday" || day == "thursday" || day == "friday") {
if (fruit == "banana") {
price = (quantity * 2.50).toFix... | true |
b0693f0c6c4abbbacf66612ad461a787fe9afa72 | JavaScript | ahanser/xinzhougutu | /src/utils/validate.js | UTF-8 | 1,357 | 2.96875 | 3 | [
"MIT"
] | permissive |
/*合法的用户名验证*/
export function isvalidUsername(str) {
const userRegex = /^[a-z0-9_-]{3,16}$/
return userRegex.test(str)
}
/*合法的密码*/
export function isvalidPassword(pass) {
const passRegex = /^[a-z0-9_-]{6,18}$/
return passRegex.test(pass)
}
/*合法的邮箱*/
export function isvalidEmail(email) {
const emailRegex =... | true |
b176eeca40f4ab1904f0a38685621a3b55389e54 | JavaScript | tntthinh/c4e36-NguyenTienThinh | /session7/homework2.js | UTF-8 | 237 | 2.640625 | 3 | [] | no_license | let a = document.getElementById("list");
let del= document.getElementById("dlt")
del.addEventListener("click",()=>{
for (let i = 0; i <= a.options.length; i++) {
if(a.options[i].selected){
a.remove(i)}}
}) | true |
f7c6b2b073293e9ebfd86c7cdc45302ae9b3a499 | JavaScript | Mayankjh/X_Code_Quiz | /index.js | UTF-8 | 2,130 | 3.328125 | 3 | [
"MIT"
] | permissive | var player = {
__score: 0,
__live: 3,
__total: 30
}
function check(){
if(document.getElementById('name').value == "" && document.getElementById('age').value=="" ){
document.getElementById("start").disabled = true;
}else{
document.getElementById("start").disabled = false;
}
}
setInterval(check,... | true |
6c66564751f1de88840de9c9517e93f743c03fc0 | JavaScript | nameeshgabru/data-structures-and-algorithms | /searching.js | UTF-8 | 922 | 3.984375 | 4 | [] | no_license | function linearSearch(arr, num) {
for (let l = 0; l < arr.length; l++) {
if (arr[l] === num) {
return l;
}
}
return -1;
}
console.log(linearSearch([2, 1, 3, 4], 3));
console.log(linearSearch([2, 1, 3, 4], 5));
function binarySearch(arr, num) {
let startIndex = 0;
let endIndex = arr.length - 1;... | true |