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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
9195aa71927436239eecfa62c6f58ea3cc6561a4 | JavaScript | budvinchathura/YDNJS | /3/20.js | UTF-8 | 1,399 | 4.0625 | 4 | [] | no_license | var obj1 = {
a : 2
};
var obj2 = Object.create(obj1);
console.log(obj2.a); //prints "a" of obj1
console.log("a" in obj2); //true, finds "a" in prototype chain
console.log(obj2.hasOwnProperty("a")); //false, obj2 itself does not has its own "a"
obj1.b = 100; //added to obj1, ac... | true |
b08e4748e08032dd6d6acc39aafa07844cb11579 | JavaScript | biroa/OOP-JS | /2.2/index.js | UTF-8 | 900 | 3.421875 | 3 | [] | no_license | //version 2.2
function onReady() {
var clock = createClock('clock');
var clock2 = createClock('clock2');
}
function createClock(id) {//function
var c = {};//or new Object();
c.updateClock = function () {//method
var clock, date, time;
date = new Date();
clock = document.getEl... | true |
f646509f75953c85a605381944b103f1c518f35a | JavaScript | MurkinVitaly/weather-app | /src/redux/actions/actions.js | UTF-8 | 1,327 | 2.71875 | 3 | [] | no_license | import { SET_SELECTED_CITY, SET_WEATHER_DATA } from './actionTypes';
import axios from 'axios';
export const setSelectedCity = (value) => {
return {
type: SET_SELECTED_CITY,
payload: value,
};
};
export const setWeatherData = (value) => {
return {
type: SET_WEATHER_DATA,
payload: value,
};
};
... | true |
3b32065fc1eacaedbc194d2582d4253d8f914128 | JavaScript | aichi/Skin.js | /lib/MVCArray.js | UTF-8 | 2,337 | 3.34375 | 3 | [
"MIT"
] | permissive | /**
* MVCArray is observable mutable array and is made by nokia.maps.util.OList
* @constructor
* @param {Variant[]} array
*/
google.maps.MVCArray = function(array) {
//nokia.maps.util.OList.removeAt method is same like in MVCArray but there is event triggered
this._removeAtOriginal = this.removeAt;
t... | true |
1458c555a50f5f9c7450a68ee3576fd54a58bec0 | JavaScript | dfriveros11/local_business_reserVAMOS | /front/src/components/Card.js | UTF-8 | 10,084 | 2.75 | 3 | [
"MIT"
] | permissive | /*
Componente que renderiza cada tienda en un card
*/
import React, { useState } from "react";
import PropTypes from "prop-types";
import StarRatingComponent from "react-star-rating-component";
import Modal from "react-modal";
import DatePicker from "react-datepicker";
import dateFormat from "dateformat";
import "react... | true |
9b96244004e5e3d74da418c3d721b91aaa3c8513 | JavaScript | david-crowell/football | /play.js | UTF-8 | 1,374 | 2.890625 | 3 | [] | no_license | var OFFENSE = 1;
var DEFENSE = -1;
var NO_ASSIGNMENT = '-';
// assignments = { positionName: gapName }
var Play = function(players, assignments, targetGap) {
this.players = players;
this.assignments = assignments;
this.targetGap = targetGap;
return this;
}
Play.prototype.unassignedPlayers = function() {... | true |
1ccb424ff1eb8f9d82f826c9867b729cbb972d54 | JavaScript | hungk1996a/books | /public/javascript/jsBook.js | UTF-8 | 2,050 | 2.71875 | 3 | [] | no_license | $('document').ready(() => {
function renderBook(data) {
let template = $('#bookTemplate').html();
const resultsHTML = data.map((item) => {
return template.replace(':bookTitle:', item.title)
.replace(':bookAuthor:', item.author)
.replace(':bookPrice:', item... | true |
6f5cb49675bc495d0982c5fa4de8b999edcc8e78 | JavaScript | MR-Stan/GifTastic | /assets/javascript/app.js | UTF-8 | 3,908 | 3.21875 | 3 | [] | no_license | let appObject = {
// array of searches, buttons created based on content of this
topics : ["hiking", "biking", "snowboarding", "running"],
// current search
search : "",
// number of gifs display on screen after button click
limit : "10", // returns 10 results
// create intial HTML eleme... | true |
922c7522caaff37af734d1db80c9a018a635582e | JavaScript | chevaro1/polopicker_latest | /js/click_through.js | UTF-8 | 4,310 | 2.921875 | 3 | [
"MIT"
] | permissive | var timeframe = parseInt($('#product-timeframe :selected').val());
const debugMode = true;
function log(output){
if (debugMode) {
console.log(output);
}
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... | true |
d6c82e4c5db4ad51236b90b2d45b7fd3b46efd7f | JavaScript | CristianCristea/anitavrhovac.com | /src/reducers/photos.js | UTF-8 | 776 | 2.71875 | 3 | [] | no_license | const initialState = [];
export default (state = initialState, action) => {
switch (action.type) {
case 'SET_PHOTOS':
return action.photos;
case 'ADD_PHOTO':
return state.concat(action.photo);
case 'DELETE_PHOTO':
return state.filter(photo => photo.id !== action.id);
case 'DELETE_PH... | true |
57d3d0c607d32ae08c5d3f098cef77262196b8f1 | JavaScript | fruitsamples/Trailers | /Trailers.dcproj/project/mobile/main.js | UTF-8 | 1,042 | 2.59375 | 3 | [] | no_license | /*
This file was generated by Dashcode.
You may edit this file to customize your widget or web page
according to the license.txt file included in the project.
*/
//
// Function: load()
// Called by HTML body element's onload event when the web application is ready to start
//
function load()
{
dashcode.set... | true |
e3e32410a0f14e410fc7c0df0532e302bca93291 | JavaScript | Margo-dev/project-one | /project_one/js/main.js | UTF-8 | 366 | 2.828125 | 3 | [] | no_license |
let menu = document.querySelector('.menu ul');
function toggle() {
if (menu.classList.contains('unshow')) {
menu.classList.remove('unshow');
menu.classList.add('show');
} else {
menu.classList.remove('show');
menu.classList.add('unshow');
}
}
document.querySel... | true |
5c027ba76fd4e7cd350094f0e6a9075b5a325ce9 | JavaScript | DupMix/microservice | /src/firebase/votes.js | UTF-8 | 2,099 | 2.796875 | 3 | [] | no_license | import admin from './admin'
import { isBefore, isAfter, sub, getDay, nextTuesday, nextSunday, format, parseISO } from 'date-fns'
export const submitVotesToFirebase = (userId, votes, date) => {
const voteFields = Object.keys(votes)
voteFields.forEach(field => {
if (field === 'heardBefore') return votes.heardBef... | true |
c5f1511bfe31db18bb8b52c2286535ac1db8b375 | JavaScript | igleson/angular-tutorial | /public/javascripts/controller5.js | UTF-8 | 1,370 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | app = angular.module("ExemploApp", []);
app.controller("controller", controller);
app.service("AlunosService", AlunosService);
function AlunosService($http) {
this.getAlunos = function () {
return $http.get('/alunos')
}
}
function controller($scope, AlunosService) {
$scope.busca = {}
$scop... | true |
54f4b2b8dd6e49bc22bbc3573b56c41616142e1f | JavaScript | walwoodr/react-props-and-state-lab-v-000 | /components/PetBrowser.js | UTF-8 | 556 | 2.515625 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | const React = require('react');
const Pet = require('./Pet');
class PetBrowser extends React.Component {
constructor(){
super();
};
render() {
const anything = this.props.pets.map(pet => <Pet
name={pet.name}
type={pet.type}
gender={pet.gender}
age={pet.age}
weight={pet.we... | true |
c43678b60b761bfc97f8854b8dafba5ed4bf7eca | JavaScript | HalkinK/weather-app | /src/components/UserLocation.js | UTF-8 | 1,709 | 2.734375 | 3 | [] | no_license | import { useState, useEffect } from "react";
import { colorOptions } from "./ColorsBase";
import styles from "./ColorsOptions.module.css";
export default function UserLocation() {
const [weather, setWeather] = useState(null);
const [lat, setLat] = useState("");
const [lon, setLon] = useState("");
useEffect(()... | true |
10b6db024ccf22bd05ab60a94d7f59e3d9945c53 | JavaScript | Blandine-Basabose/Endpoints | /Server/Controller/BlogPostController.js | UTF-8 | 3,406 | 2.71875 | 3 | [
"MIT"
] | permissive | import BlogData from "../Model/BlogPostModel.js";
const Posts = [];
class BlogController{
static articles =(req, res) => {
const blogId = Posts.length +1;
let{
UserId,
title,
content,
} = req.body;
const timestamp = new Date(Date.now());
... | true |
bc75456e308491c8228adc16c183f0756af4b17f | JavaScript | DelgadoJosh/HelloWorldWebsite | /index.js | UTF-8 | 2,941 | 4.78125 | 5 | [] | no_license | // Yay comment!
// HTML = content
// Javascript = behavior
// Can run this with either:
// 1: node index.js
// OR
// 1: Right click index.html in VS Code
// 2: Open with Live Server
// To stop, in the bottom bar, in the bottom right delete Port:5000
console.log("Hello world!")
console.log("And so the index begins");... | true |
a908802d73f3ddd99c64511fe26d23d850d587d9 | JavaScript | cacalo/QA09-Gonzalo-Bechara | /js/validateInput.js | UTF-8 | 3,033 | 2.953125 | 3 | [] | no_license | let blockedFields = {
email: false,
psw: false,
name: false,
psw2: false,
};
function validateEmail(e){
if(e.target.value != ""){
const re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
if(... | true |
07ff54af57e2151557cb63aa84854dedd4dca435 | JavaScript | wcl0801/xiaomiguanwang | /javascripts/index.js | UTF-8 | 3,366 | 2.671875 | 3 | [] | no_license | window.onload = function(){
var tupians = document.getElementsByClassName('tupian'),
ddians = document.getElementsByClassName('ddian'),
left = document.getElementById('left'),
right = document.getElementById('right'),
container= document.getElementById('container'),
lk = document.ge... | true |
7e3f2ae786038223f64a9f84f39cd7fec6a3a4ab | JavaScript | bahuzz/es6 | /src/app.js | UTF-8 | 1,005 | 3.046875 | 3 | [] | no_license | import EmployersNames from "./employers";
import Sponsors from "./sponsors";
class MakeBusiness {
constructor({
owner = "Dave",
director = "Victor",
cash = 0,
emp = ['emp']}) {
this.owner = owner;
this.director = director;
this.cash = cash;
this.emp =... | true |
715312bb446a7e58a689b218796f350c1b0c77a3 | JavaScript | Castle2107/brainiac | /resources/assets/js/static-data/styles.js | UTF-8 | 1,496 | 2.546875 | 3 | [
"MIT"
] | permissive | export const ec = [
{ text: "discerniendo", val: 1 }, //default value = 1
{ text: "receptivamente", val: 1 },
{ text: "sintiendo", val: 1 },
{ text: "aceptando", val: 1 },
{ text: "intuitivamente", val: 1 },
{ text: "abstracto", val: 1 },
{ text: "orientado al presente", val: 1 },
{ text: "apren... | true |
80ed70c5ba5a010f2123220b90bb506b3c9b1807 | JavaScript | mngatewood/promise-practice | /script.js | UTF-8 | 1,901 | 4.28125 | 4 | [] | no_license | const testNum = (num) => {
new Promise((resolve, reject) => {
if (typeof num === 'number') {
setTimeout(() => {
resolve(num);
}, 1000);
} else {
setTimeout(() => {
reject(num);
}, 1000);
}
})
.then((num) => {
if (num === 10) {
console.log('10 i... | true |
4488377aa80297848f9f6fe9c646f1afaf2b23ad | JavaScript | DataVis-Fall-2020-Team/uslanguages.github.io | /js/map.js | UTF-8 | 16,575 | 2.6875 | 3 | [] | no_license | /*
* Class that creates the second view, which is the map. It controls the positioning of the circles drawn on the map as well
*/
class US_Map{
// Creates a US_Map object showing language distribution
constructor(data, svg){
//Get and Modify Data
this.data=data[0];
this.state... | true |
4e6b0eccd1171eeb5256c4a0d1bb905276526bf7 | JavaScript | nicholajaneriley/js_practice_booking2019 | /challenges/week9.js | UTF-8 | 1,855 | 3.53125 | 4 | [] | no_license |
const sumMultiples = arr => {
if (arr === undefined) throw new Error("arr is required");
return arr.filter(nums => {
if (nums % 3 === 0 || nums % 5 === 0) {
return true;
}
return false;
}).reduce((total, amount) => total + amount, 0);
};
const isValidDNA = str => {
if (str === undefined) thr... | true |
a9f62dbaef7c2d125c6b6dffade4d8920ff645ad | JavaScript | satyam4484/Expense-Tracker-Udemy-React-Course | /src/App.js | UTF-8 | 1,221 | 2.546875 | 3 | [] | no_license | import React,{useState} from "react"
import Expenses from "./components/Expenses/Expenses"
import NewExpense from "./components/NewExpense/NewExpense"
const DummyExpense = [
{
id: "e1",
title: "Toilet Paper",
amount: 94.12,
date: new Date(2020, 7, 14),
},
{ id: "e2", title: "New TV", amount: 799.... | true |
5a93012391fca9c9ad23b5220221d4561803085b | JavaScript | ControllingTransmission/vectorfuzz | /BaseObject.js | UTF-8 | 1,472 | 3.046875 | 3 | [] | no_license | "use strict"
if (!String.prototype.capitalized) {
String.prototype.capitalized = function () {
return this.replace(/\b[a-z]/g, function (match) {
return match.toUpperCase();
});
}
}
class BaseObject {
static shared() {
if (!this._shared) {
this._shared = th... | true |
6fd93806a3603a47031462e04bdf5a237d045dc7 | JavaScript | Dkgiri619/Node_Practice | /LModule1/automation/promises.js | UTF-8 | 1,172 | 3.25 | 3 | [] | no_license | // // program to read in sync
const fs = require("fs");
// let f1 = fs.promises.readFile("./f1.txt");
// f1.then(function(data){
// console.log(data+"");
// let f2 = fs.promises.readFile("./f2.txt");
// f2.then(function(data){
// console.log(data+"");
// let f3 = fs.promises.readFile("./f3.... | true |
f10338adee294a16fef0a039a0f35cb4dfac8730 | JavaScript | jona872/planear5 | /resources/js/Components/ApiGet.js | UTF-8 | 1,094 | 2.96875 | 3 | [
"MIT"
] | permissive | import React from 'react';
class ApiGet extends React.Component {
constructor(props) {
super(props);
this.state = {
nombre: '',
descripcion: '',
errorMessage: '',
error: false,
isLoading: false
}
this.onClick = this.onClick.bind(this);
}
componentDidMount() {
console.log("Componente GET Mo... | true |
dbc85339eb16530641f6e28014d8246f9dad5c3a | JavaScript | MattRvt/plongee | /src/controller/javascript/historique.js | UTF-8 | 2,620 | 2.640625 | 3 | [] | no_license | function getHisto()
{
$(document).ready(function(){
$.ajax({
url: 'Historique',
type: 'post',
data: 'histo=0',
dataType: 'JSON',
success: function(response1){
afficheHisto(response1,"last");
},
error: functio... | true |
ac3108d32764bb30db97dc71b728aa87538ab0d8 | JavaScript | GavrilenkoGeorgi/artviva-frontend | /src/__tests__/reducers/branchesReducer.test.js | UTF-8 | 1,664 | 2.703125 | 3 | [
"MIT"
] | permissive | import branchesReducer from '../../reducers/branchesReducer'
import branches from '../../__mocks__/branches.json'
describe('Branches reducer', () => {
it('returs default state', () => {
const defaultState = branchesReducer(undefined, {})
expect(defaultState).toEqual([])
})
it('returns an array of all branches'... | true |
8968d0b448445baeceebd5b25326db6fab0d3a5a | JavaScript | DmitriyS87/exchangeratesapp | /src/servises/alfavantage-wrapper.js | UTF-8 | 2,427 | 2.5625 | 3 | [] | no_license | /* eslint-disable class-methods-use-this */
import DataParcer from '../utils/data-parser';
import SERVISES_CONSTANT from '../constants/servises.constant';
const checkStatus = (response) => {
if (response >= 200 && response <= 300) {
return true;
}
return false;
};
const createXhr = (onError) => {
let xhr... | true |
8599ffc7daed7d6fbde96ddb2d030af30832879b | JavaScript | majidux/messager | /src/Components/SearchArea.js | UTF-8 | 2,155 | 2.59375 | 3 | [] | no_license | import React, {Component} from 'react';
import {View, TextInput, StyleSheet, Image,Text} from 'react-native';
export default class SearchArea extends Component {
constructor(props){
super(props);
this.state={
loading:false,
data:[],
searchInput:'',
... | true |
bc4ef3f154cce9cf5f8c01f3aacd0434a7b6f630 | JavaScript | longlh1997/Process | /run.js | UTF-8 | 880 | 2.59375 | 3 | [] | no_license | const Koa = require('koa');
const app = new Koa();
const numberFilter = async(context, next) => {
const numberA = context.query.numberA;
const numberB = context.query.numberB;
const op = context.query.op;
if(numberA, numberB ){
return await next();
}
context.body = {
message: "... | true |
ea75704c142637377f3297ffd4130d1c562fdcc0 | JavaScript | SudaGit/week13-friendfind | /controllers/cats_controller.js | UTF-8 | 1,371 | 2.796875 | 3 | [] | no_license | /*
Here is where you create all the functions that will do the routing for your app, and the logic of each route.
*/
var express = require('express');
var router = express.Router();
var cat = require('../models/cat.js');
router.get('/', function (req, res) {
res.redirect('/cats');
});
router.get('/cats', function (r... | true |
b16fde902f85694434833d8af58280d3df0cc5be | JavaScript | TeaganBriggs/GDDocument | /需要重新整理/feature/单元测试/example1/test.js | UTF-8 | 219 | 3.0625 | 3 | [] | no_license | (function testAddThreeToNumber (){
var a = 5,
valueExpected= 8;
if (addThreeToNumber (a) === valueExpected) {
console.log("Passed!");
} else {
console.log("Failed!");
}
}()); | true |
253fad9b8db764c92cf499c8368323a1c7497cb7 | JavaScript | charles01pd2018/hacker-news | /src/components/search/input-with-label.js | UTF-8 | 673 | 2.5625 | 3 | [] | no_license | // Represents the input field and the label alongside it
import React from 'react';
// styles
import '../../scss/components/_search.scss';
let InputWithLabel = ({ id, value, type = 'text', onInputChange, isFocused, children }) => {
let inputRef = React.useRef()
React.useEffect(() => { if (isFocused) inputRef.... | true |
6d17eaec5dbc36c13690693515b1fde3e2844479 | JavaScript | Mitkun/BaiTapFord | /js/header-tct.js | UTF-8 | 894 | 2.828125 | 3 | [] | no_license | document.getElementById("fordSuv").onclick = function() {
openFunction("contentSuv", "contentTruck", "contentElec", "contentCar");
};
document.getElementById("fordTruck").onclick = function() {
openFunction("contentTruck", "contentElec", "contentCar", "contentSuv");
};
document.getElementById("fordElec").onclic... | true |
d8741471365e49124ac98330dafed4b01db0515f | JavaScript | Albanjin429/canvas-Game | /js/main.js | UTF-8 | 3,449 | 2.734375 | 3 | [] | no_license | /**
* Created by Administrator on 2016/9/5.
*/
$(function(){
getDate();
moonLeft();
moonRight();
//moonRightBlessing();
musicIcon();
addWords();
});
var canplay=true;
function getDate(){
var date=new Date();
var y=date.getFullYear();
var m=date.getMonth()+1;
var d=date.getDate(... | true |
8424db860cc54a34d2f13543fc7b135bfcdf7370 | JavaScript | benwrk/ISP-Tutorials | /TUT103 - PacMan/src/GameLayer.js | UTF-8 | 2,426 | 2.828125 | 3 | [] | no_license | var GameLayer = cc.LayerColor.extend({
init: function() {
this._super(new cc.Color(127, 127, 127, 255));
this.setPosition(0, 0);
console.log('Initialized');
this.scoreLabel = cc.LabelTTF.create('0', 'Arial', 40);
this.scoreLabel.setPosition(screenWidth - 50, screenHeight - 50);
this.addChild(this.scoreL... | true |
ba0241626b5ab9994530d60e382aa7fed684ed97 | JavaScript | msy234/nodejstutorial | /05-1-modules/os.js | UTF-8 | 601 | 3.09375 | 3 | [] | no_license | const os = require('os')
// info about user
const user = os.userInfo()
console.log(user)
/* output:
{ uid: -1,
gid: -1,
username: 'hp',
homedir: 'C:\\Users\\hp',
shell: null
}
*/
//method that returns the system uptime in seconds
console.log(`the system uptime is : ${os.uptim... | true |
e8b36adbe37711f1607e1898a21d84c62cf6e5a8 | JavaScript | ChrisCummins/chriscummins.cc | /www/js/index.js | UTF-8 | 31,985 | 2.9375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /*
* impress.js
*
* This file contains my modified version of impress.js, a presentation tool
* based on the power of CSS3 transforms and transitions in modern browsers and
* inspired by the idea behind prezi.com.
*
* impress.js credits:
*
* Copyright 2011-2012 Bartek Szopka (@bar... | true |
d8c26ddc5b866f8c94131a76144c1cb8fdbb8b2c | JavaScript | sstoicageorgiana/TEMAJS1 | /compare.js | UTF-8 | 340 | 3.765625 | 4 | [] | no_license |
let returnedStatamentForCompare = compare(5,2)
console.log("2. After comparation we have:", returnedStatamentForCompare);
function compare(fistNumber, secondNumber)
{
if ( fistNumber < secondNumber)
return -1
else if (fistNumber > secondNumber)
return 1
else if (fistNumber === secondNumber... | true |
380e5f2d3c6e18c4a077d7827046d2c9ca90089e | JavaScript | mansi2024/ScoreDisplayer | /project.js | UTF-8 | 2,005 | 3.21875 | 3 | [] | no_license | const p1Display = document.querySelector('#p1Display');
const p2Dispaly = document.querySelector('#p2Display');
const resetButton = document.querySelector('#Reset')
const p1button = document.querySelector('#button1');
const p2button= document.querySelector('#button2');
const winningscoreSelect = document.querySele... | true |
d057e6f651bb02801f46c81e88fa1022ae349446 | JavaScript | paulo-souza/tcc | /ads/src/Helper/Utilidades/SaoIguais/index.js | UTF-8 | 365 | 3.28125 | 3 | [] | no_license |
// Não funciona se um objeto possuir outro dentro de si
export default function SaoIguais(objetoA, objetoB) {
let aChaves = Object.keys(objetoA);
let bChaves = Object.keys(objetoB);
if (aChaves.length !== bChaves.length) return false;
let saoDiferentes = aChaves.some(chave => objetoA[chave] !== ob... | true |
2815eaaf4753bb357f1947fb3d7d0bc902b57b91 | JavaScript | tklow94/algorithms | /DataStructures/DoublyLinkedList/pop.js | UTF-8 | 1,442 | 4.3125 | 4 | [] | no_license | //Much easier to remove end on a doubly linked list because we can work backwards.
//start at the tail and use .prev to remove.
//if there is no head return null
//else store the current tail in a var
//if length is 1 set head and tail to be null
//update tail to be the previous node
//set newTail.n... | true |
7886e4b717ba7e0ad9717d19d3bbd50b5c50ba2b | JavaScript | genestd/dataviz | /src/components/Loading.js | UTF-8 | 716 | 2.8125 | 3 | [] | no_license | import React from 'react'
class Loading extends React.Component {
constructor(props){
super(props)
this.state = {
progress: "",
timer: 0
}
}
componentWillMount(){
let timerId = setInterval( ()=>{
let dots = this.state.progress
dots === "..." ? dots="" : dots = dots + ".... | true |
c0674662407aea2bfaf774c7a2a5e86095b8b674 | JavaScript | pantheonsh/luma | /comandos/petitube.js | UTF-8 | 1,977 | 2.53125 | 3 | [
"MIT"
] | permissive | const Command = require("../sistemas/Command.js");
const Discord = require("discord.js");
const snfetch = require("snekfetch");
const Util = require("../sistemas/Util.js");
class PetitTubeCommand extends Command {
constructor() {
super()
}
async execute(client, msg, args, CommandHandler, Database)... | true |
9e42a95c5334d698896a70529cec06d5eda92400 | JavaScript | Qiantengactive/Node.js-- | /02.回调&同步&异步调用.js | UTF-8 | 4,438 | 4.125 | 4 | [] | no_license | 单线程
异步
非阻塞
事件驱动
const a=10;
a=20//报错
const b={c:10}
b.c=20//正确
let局部变量作用域
const 常量
babeljs.io
同步调用和异步调用
同步调用
同步调用时一种阻塞式调用
异步调用:
1.一种非阻塞式调用 一段代码未执行完毕,可以继续执行下一段代码
2.代码执行完毕,通过回调函数返回继续执行相应的逻辑,而不耽误其他逻辑代码执行
异步调用:
function Person(){
think 异步方法 异步等待思考5分钟 思考结束输出thinking--
this.think=function(callback){
... | true |
3d180eebb1db46878f507926a54f9780a93dc716 | JavaScript | delafields/Favoritify | /client/src/components/display/tabContent/sounds/TempoBars.js | UTF-8 | 3,696 | 2.515625 | 3 | [
"MIT"
] | permissive | import React from 'react';
import Style from 'style-it';
import './styles/tempoBar.css';
/* Generates bars based on avg track tempo */
const TempoBars = props => {
const tempo = props.tempo;
const tabColor = props.tabColor;
/* Converts bpm to a useable bar height */
const formatTempoBars = parseInt(tempo / 2, 10);... | true |
e72d3e764e19c7bf78f621944f50720eaf25b926 | JavaScript | luciopaiva/automaton-lab | /index.js | UTF-8 | 14,078 | 3.046875 | 3 | [] | no_license |
class AutomatonLab {
/**
* @param {String} rawRules
* @param {String} rawMap
*/
constructor (rawRules, rawMap) {
this.isPaused = false;
this.isMakingNewMap = false;
this.wall = TileState.WALL;
this.tileSize = parseInt(getComputedStyle(document.documentElement).g... | true |
ff043588dd586fe9d0bd70a4ac204a8c1c135a34 | JavaScript | anthonyljones/JavaScriptUtilities | /retrieveItemFields.js | UTF-8 | 748 | 2.796875 | 3 | [] | no_license | //Takes a list name "Objectives" and an ID of "2"
//And Returns desired fields
//Consider using var itemId=GetUrlKeyValue("ID", false, location.href);
var url = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('Objectives')/items(2)";
var itemID = "";
var title = "";
var details = "";
$.ajax({
u... | true |
6119bb5287782ddd946574c5eac19f094742cec2 | JavaScript | dewanshDT/react-widgets | /src/components/pages/TextUtils.js | UTF-8 | 3,949 | 3.1875 | 3 | [] | no_license | import React, { useState } from 'react';
// Buttons Style
const btnStyle = {
backgroundColor: "#0d6efd",
color: "white",
padding: "12px",
borderRadius: "8px",
marginRight: "10px",
cursor: "pointer"
}
// TextArea Style
const TextAreaStyle = {
backgroundColor: "white",
color:"black"... | true |
390a55d3c49833c66823833755c94bd822a7365a | JavaScript | zhangtao19940520/PMS | /static/js/main.js | UTF-8 | 1,031 | 2.8125 | 3 | [
"MIT"
] | permissive | /**
* 倒计时
* @target 需要针对的dom对象
* time 倒计时时长(单位:s)
* */
function djs(target, time) {
$(target).addClass('layui-btn-disabled');
$(target).prop('disabled', true);
var timer = setInterval(function () {
if (time > 0) {
$(target).text(time + 's后重新获取');
} else {
$(target... | true |
54eacc8d48130bd1ff73a466709a9d0346b11f3c | JavaScript | tehsy97/Csci-4131-UMN | /teh00001_hw07/client/js/getListOfUsers.js | UTF-8 | 1,313 | 2.625 | 3 | [] | no_license | var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "/getListOfUsers", true);
xmlhttp.send();
xmlhttp.onreadystatechange = function () {
var state = xmlhttp.readyState;
var status = xmlhttp.status;
if (state == 4 && status == 200) {
var myuserObj = JSON.parse(xmlhttp.responseText);
... | true |
3eeb9fb6d2c4e35c0062dde72ed20941025ae3a1 | JavaScript | Hypertext-Sharukh/Basic_API_NodeJS_With_ExpressJs | /apihandler.js | UTF-8 | 2,402 | 2.546875 | 3 | [] | no_license |
const express = require('express');
const app = express();
var approute =express.Router();
// Accept Json
approute.use( express.json());
// Accept formdata
approute.use( express.urlencoded({extended:false}));
// Globel svar
var result_sucess = {
"status":"Sucessful"
};
var re... | true |
21a4be3320507e46e242b92cb841add372616253 | JavaScript | changecode/jscollection | /tools/ztree.js | GB18030 | 2,617 | 2.578125 | 3 | [] | no_license | var setting = {
view: {
selectedMulti: false
},
callback: {
beforeClick: beforeClick,
onClick: onClick
}
};
function beforeClick(treeId, treeNode, clickFlag) {
if (treeNode.isParent) {
zTree.expandNode(treeNode);
return false;
}else if(!treeNode.isText){
return false;
}... | true |
f38ad443ae0c82813b5e086d814f6d4e47ab68d2 | JavaScript | MinimumViablePerson/AliCalc | /src/AliquotPlan.js | UTF-8 | 2,975 | 2.703125 | 3 | [
"MIT"
] | permissive | class AliquotPlan {
constructor({
compound = "picrotoxin",
solvent = "DMSO",
mw = 602.59,
massMG = 1000,
stockConcMM = 100,
bathConcUM = 100
} = {}) {
this.state = {
compound,
solvent,
mw,
massMG,
... | true |
956b3799e7ad23896d806060bf1609a069129286 | JavaScript | Deepak-Kumar-D/Task-05 | /Problem 8.js | UTF-8 | 922 | 3.40625 | 3 | [] | no_license | var securityQuestions = [
{
"question": "What was your first pet’s name?",
"expectedAnswer": "FlufferNutter"
},
{
"question": "What was the model year of your first car?",
"expectedAnswer": 1985
},
{
"question": "What city were you born in?",
"expectedAnswer": "NYC"
}
]
var question="What was ... | true |
2cc2a13c156f8841c4a84602ebd09448a5ea4b3c | JavaScript | CarolinaGC16/RetoTiendaDondePepita | /backend/controllers/producto.js | UTF-8 | 1,887 | 2.734375 | 3 | [] | no_license | let Producto = require("../models/producto");
const registrarProducto = (req, res) => {
let params = req.body;
let producto = new Producto();
producto.name = params.name;
producto.description = params.description;
producto.cost = params.cost;
producto.save((err, saveProducto... | true |
2f07264f475ba229a6ac71397d543db68db11618 | JavaScript | CentroDL/express_auth_student_template | /client/public/js/weather.js | UTF-8 | 1,399 | 3.015625 | 3 | [] | no_license | $(function(){
$weatherSearch = $("#weather-search");
$weatherData = $("#weather-data");
var city;
$temperature = $("#temp");
$weatherSearch.submit(function(event){
event.preventDefault();
city = $weatherSearch.find("[name=weather]").val();
$.ajax({ method: "get",
url: "http://api.... | true |
8f39853c803f2da64741355b4956ad57b95de4bb | JavaScript | victoryqwei/Interplanetarium | /public/javascripts/util/Util.js | UTF-8 | 11,377 | 3.140625 | 3 | [] | no_license | import Vector from "../util/Vector.js";
import {camera} from '../visuals/Camera.js';
class Util {
constructor() {
this.now = true;
}
getRandomRgb() {
var num = Math.round(0xffffff * Math.random());
var r = num >> 16;
var g = num >> 8 & 255;
var b = num & 255;
return 'rgb(' + r + ', ' + g + ', ' + b + '... | true |
640db2f0fbcfd5cea9e9c2a9b83c8adba31e630c | JavaScript | green-fox-academy/smnkrisz | /week-08/day-01/events-2.js | UTF-8 | 219 | 3.109375 | 3 | [] | no_license | const button = document.querySelector('button');
const listItems = document.querySelectorAll('li');
const result = document.querySelector('.result');
button.onclick = () => {
result.innerHTML = listItems.length;
}; | true |
d4214df0f35432c2ef3ca5fd6c97f8124076304b | JavaScript | johnsonkwok/testbuilder | /detectNetwork.js | UTF-8 | 2,680 | 3.625 | 4 | [] | no_license | // Given a credit card number, this function should return a string with the
// name of a network, like 'MasterCard' or 'American Express'
// Example: detectNetwork('343456789012345') should return 'American Express'
var detectNetwork = function(cardNumber) {
// My outline
// input: a credit card number as a STRI... | true |
b0fdd34d603bce6c3f20be84d06ce7aa84bd89f0 | JavaScript | Ottesen02/barchart | /basics.js | UTF-8 | 143 | 3.109375 | 3 | [] | no_license | const name = "Peter";
const pet = "cat";
const petName = "Mandu";
console.log(`My name is Peter ${name}.
I have a ${pet} called ${petName}`);
| true |
4bdb964841253ce0b0926984f9772e2973c416dc | JavaScript | g-batalhao-a/LAIG | /TP3/game/MyPiece.js | UTF-8 | 4,451 | 2.828125 | 3 | [] | no_license | /**
* MyPiece
* @brief Class representing a Piece
*/
class MyPiece extends CGFobject {
/**
* @constructor
* @param {Object} scene Reference to MyScene object
* @param {number} playerOwnerShip Value of Piece
*/
constructor(scene, playerOwnerShip) {
super(scene);
this.playerOwnerShip = playerOwnerShip;
... | true |
1c8a63d9d9d5adaf7c91342132e67a5a0d8aba69 | JavaScript | Levi-Schubert/conditionals | /main.js | UTF-8 | 141 | 3.109375 | 3 | [] | no_license | var lastName = "Schubert";
if(lastName.length > 6){
console.log("I can't pronounce this last name");
}else{
console.log(lastName);
} | true |
73ee9de3c3ab220c935ca568db8c033f2ccb167c | JavaScript | CaiIsProgrammer/JavaScript-III | /assignments/this.js | UTF-8 | 955 | 4.34375 | 4 | [] | no_license | /* The for principles of "this";
* in your own words. explain the four principle for the "this" keyword below.
*
* 1. is it a function called by new?
* 2. using bind call or apply
* 3. is it a global function?
* 4. are you calling a method?
*
* write out a code example of each explanation above
*/
// Principle 1
// ... | true |
b7bc99f5d85914ece39e9144b1083220a0056f15 | JavaScript | whaleal/icefrog | /icefrog-script/src/test/resources/filter1.js | UTF-8 | 89 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | function filter1(a, b) {
if (a > b) {
return a > b;
}
return false;
} | true |
e4df0a8b2ae1b785a652fa1daee20d7135ff580f | JavaScript | Junior-Tucan-Team/sheets-to-website | /src/redux/reducers/authReducer.js | UTF-8 | 566 | 2.59375 | 3 | [] | no_license | import { LOGIN_FAILURE, LOGIN_REQUEST, LOGIN_SUCCESS } from '../constants/actionTypes';
const INITIAL_STATE = {
isLoading: false,
user: undefined,
error: null,
};
const authReducer = (state = INITIAL_STATE, { type, payload }) => {
switch (type) {
case LOGIN_REQUEST: {
return { ...state, isLoading: t... | true |
beea3712aca1668dc948855f212ce1f4e2077c5d | JavaScript | superhuman/trie-ing | /lib/node.js | UTF-8 | 4,450 | 3.140625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | /**
* A Node in the autocompleter Trie.
*/
var Node = function () {
/* The maximum score of all the values in this element
* or its children */
this.score = 0;
/* The children of the trie indexed by letter.
* {a: new Node(), b: new Node(), ...}
*/
this.children = {};
/* Both the c... | true |
1805aafc664b6f3e0c7dbba7233186c90971986f | JavaScript | Shokesu/us-elections-polltracker | /server/lib/results/homepage.js | UTF-8 | 2,989 | 2.640625 | 3 | [
"MIT"
] | permissive | import fs from 'fs';
import color from '../../../layouts/color';
// If a tab doesn't appear in this list then it's an unknown tab name
// If a tab does appear in this list but it's value is false
// then it should never display regardless of whatever the spreadsheet says
const knownTabs = Object.freeze({
president: ... | true |
14332b2eea1aba297f13fad89282406e7932f78a | JavaScript | XRater/computer-graphics2019 | /opengl/fractal/script.js | UTF-8 | 5,437 | 2.859375 | 3 | [] | no_license | "use strict";
let options = {
translation: [0, 0],
scale: [1, 1],
c: [-0.74543, 0.11301],
R: 1.70197192317588,
depth: 200,
};
function main() {
// Get A WebGL context
let canvas = document.getElementById("canvas");
let gl = initWebGL(canvas);
let program = createProgramFromScriptsB... | true |
b5d7585c9dc675d47f4a6da67895930f0dcbe3ee | JavaScript | dgminos/ada-react | /ejercicios-props/src/components/Stock/index.jsx | UTF-8 | 730 | 2.75 | 3 | [] | no_license | import React from 'react'
const Stock = ({ producto, cantidad, maximo }) => {
let color = '';
if (cantidad <= maximo * 0.1) {
color = 'red'
//console.log("color: " + color)
}
else if (cantidad > maximo * 0.1 && cantidad <= maximo * 0.25) {
color = 'orange'
}
else if (c... | true |
ef565cc4cf114e3d84f0710c57b7955bb132ea4c | JavaScript | alexdevero/edabit-challenges | /math/js-kinetic-energy.js | UTF-8 | 259 | 3.203125 | 3 | [] | no_license | function kineticEnergy(m, v) {
return Math.round(1/2 * m * Math.pow(v, 2))
}
kineticEnergy(60, 3) // 270
kineticEnergy(45, 10) // 2250
kineticEnergy(63.5, 7.35) // 1715
kineticEnergy(0, 7.35) // 0
kineticEnergy(88.4, 0) // 0
kineticEnergy(3.333, 5.4) // 49
| true |
96f5e64544804534b0d78c3093b005b0eba5f690 | JavaScript | gabbistein/friend-finder | /server.js | UTF-8 | 613 | 2.625 | 3 | [] | no_license | // Required:
const express = require("express");
const path = require("path");
var app = express();
var PORT = process.env.PORT || 8080;
// Pulling my routes in:
const htmlRoutes = require("./app/routing/htmlRoutes");
const apiRoutes = require("./app/routing/apiRoutes");
// Middleware for parsing:
app.use(express.ur... | true |
83ebd71877a2ba8d4f88283b8af9091cfc954230 | JavaScript | alcantariel/javascript-masterclass | /02_tipos_de_dados/62_symbol.js | UTF-8 | 662 | 2.75 | 3 | [] | no_license | // Symbol
console.log(Symbol.hasInstance); // Symbol(Symbol.hasInstance)
console.log(Symbol.isConcatSpreadable); // Symbol(Symbol.isConcatSpreadable)
console.log(Symbol.iterator); // Symbol(Symbol.iterator)
console.log(Symbol.match); // Symbol(Symbol.match)
console.log(Symbol.replace); // Symbol(Symbol.replace)
consol... | true |
117c14be22d6e951087ed1155331a671bff72b46 | JavaScript | neilbateman/forms | /js/scripts.js | UTF-8 | 611 | 2.546875 | 3 | [
"MIT"
] | permissive | $(document).ready(function() {
$('#blanks form').submit(function(event) {
event.preventDefault();
var nameInput = $("input#name").val();
var sexInput = $("#sex").val();
var orientationInput = $("input:radio[name=sexual-orientation]:checked").val();
console.log("The name is: " + nameInput );
alert(nameIn... | true |
0a01e3724db67e80f958bd935c8bd111891d87f3 | JavaScript | hardfist/node-debug-demo | /examples/profile/js_loop/redos_exit.js | UTF-8 | 389 | 3.296875 | 3 | [] | no_license | // for more info about ReDoS, see:
// https://en.wikipedia.org/wiki/ReDoS
var r = /([a-z]+)+$/
var s = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!'
console.log('Running regular expression... please wait')
for(let i=1;i<100000;i++){
if(i === 30){
break;
}
console.time('benchmark');
const s = '... | true |
322394c38bd3be120855cdf4ac1a37e92df40936 | JavaScript | vtirado73/todo-js | /index.js | UTF-8 | 2,071 | 3.09375 | 3 | [] | no_license | window.onload = ()=>{
listado = new ListadoTareas();
}
class Tarea{
constructor(nombre, descripcion, prioridad, responsables, etiquetas, proyectos, fVencimiento ){
this.id = this.generarId();
this.nombre = nombre;
this.descripcion = descripcion;
this.prioridad = prioridad;
... | true |
9f5d6b5d6591217153e897ca8d72a3de7d620275 | JavaScript | Hedg0305/teste-luby | /teste-logica/8.js | UTF-8 | 319 | 4.1875 | 4 | [] | no_license | // Implemente um método que remova os aninhamentos de
// um array de arrays para um array unico.
// Entrada do método([1, 2, [3], [4, 5]]),
// Resultado do método: [1, 2, 3, 4, 5]
const removeInnerArray = (array) => {
return array.flat()
}
const array = removeInnerArray([1, 2, [3], [4, 5]])
console.log(array); | true |
5a01965e64bb5684a566fa99cdd418d9d718bf5c | JavaScript | take44444/shogi_web_prototype | /main.js | UTF-8 | 15,197 | 2.953125 | 3 | [] | no_license | // coding rule: https://cou929.nu/data/google_javascript_style_guide/
let sounds = {};
let effects = {};
let shogiBoard;
let boardState;
let fromPoint;
let toPoint;
let selectedKoma;
let gameState;
let capFlg = false;
let nariFlg = false;
const SELECTING = 0;
const BOARD_SELECTED = 1;
const KOMADAI_SELECTED = 2;
c... | true |
8f06936a1d1f868a9323c2d65c24cd849fa2dc02 | JavaScript | apguerrera/ZkFlux | /circomlib/test/binsub.js | UTF-8 | 1,600 | 2.53125 | 3 | [
"MIT"
] | permissive | const chai = require("chai");
const path = require("path");
const snarkjs = require("snarkjs");
const compiler = require("circom");
const assert = chai.assert;
const bigInt = snarkjs.bigInt;
function print(circuit, w, s) {
console.log(s + ": " + w[circuit.getSignalIdx(s)]);
}
function checkSub(_a,_b, circuit) {... | true |
549bf64bdf6d78cab5fbe4393ba7a46ec5876475 | JavaScript | pgbillones/resume-portfolio | /app/script1.js | UTF-8 | 1,049 | 2.65625 | 3 | [] | no_license |
const openForm3 = document.getElementById("hover4");
const boxOpened3 = document.getElementById("elements3");
const closeWindow3 = document.getElementById("close3");
openForm3.addEventListener("click", function(){
boxOpened3.style.display = "block"
})
closeWindow3.addEventListener("click", function(){
boxOpened... | true |
9ad79b9374889c0c4be7ee7643957ab4a206f9c7 | JavaScript | zfreedman/course-2018-basic-programming-and-javascript | /numbers/incrementDecrement.js | UTF-8 | 455 | 3.78125 | 4 | [] | no_license | // game of basketball
let points = 0;
console.log(`points: ${points}`);
// shooting from on top of a volcano gives 5 points
points = points + 5;
console.log(`points: ${points}`);
// if you fart, you lose 3 points
points = points - 3;
console.log(`points: ${points}`);
// befriend a dinosaur, get 1 point
points += 1;
... | true |
09a2d31e5314583a978fd4367726a1c1a775dd4b | JavaScript | victoriapc/HockusPockus | /ui/src/js/webcam.js | UTF-8 | 6,353 | 2.6875 | 3 | [
"BSD-3-Clause"
] | permissive | // Radius
var radius_slider = null;
var radius_text = null;
// HSV
var h_slider = null;
var h_text = null;
var h_proposed;
var s_slider = null;
var s_text = null;
var s_proposed;
var v_slider = null;
var v_text = null;
var v_proposed;
// Variables
var config_started = false;
var start_pub = createPublisher('/visio... | true |
165fbe4217ab5fd653677c4b7512f2fab10dc628 | JavaScript | daniel-silva00/exercicios_javascript | /exercicio7.js | UTF-8 | 778 | 3.9375 | 4 | [] | no_license | // java e javascript são diferentes
// java é orientado a objetos e javascript suporta objetos
// javascript é interpretado pelo navegador
// javascript é uma linguagem de programaçao
// javascript é uma linguagem para web
function calcula(){
// declaração de variáveis
// javascript é não tipado, as variáveis não pos... | true |
73e4d84ba0cac679fc4ad0b820ddedf638940359 | JavaScript | aojarv/Weatherapp | /src/index.js | UTF-8 | 3,190 | 2.9375 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import axios from 'axios';
import logo from './logo.png';
import { Input, Button } from '@material-ui/core';
/** Hakee API-tarjoajan nettisivulta kutakin säätilaa vastaavat ikonit ja palauttaa aina hetkellistä säätilaa vastaava... | true |
7988c3eed135a7398b0098eb0b187b2e785d0fda | JavaScript | BlueJacket98/codesignal-challenges | /challenges/pointsCollision/js/pointsCollision.js | UTF-8 | 1,672 | 3.140625 | 3 | [
"MIT"
] | permissive | function main() {
const input0 = [[0, 0], [1, 7], [1, 1], [-3, 0], [1, 1], [1, 1]];
const input1 = [[10, 0], [1, -3], [30, 30], [-2, 0], [8, 2], [8, 2]];
const input2 = [[40, 0], [0, 1], [5, 5], [2, 0], [2, 6], [-2, -6]];
const input3 = [[-30, 0], [0, -1], [4, 4], [2, 0], [-12, 4], [12, -4]];
const expectedOutput ... | true |
3ec639cebbbb122f918b88d204339722388d60ea | JavaScript | Jefferson-Marcelo/SistemaParaInternet-P2 | /Linguagem_de_Script/exRevisao3.js | UTF-8 | 188 | 3.390625 | 3 | [] | no_license | numeros = [0,1,2,3,4,5,6]
novaLista = []
const somador = function(acc,ele) {
novaLista.push(acc+ele)
return acc + ele
}
let soma = numeros.reduce((somador),0)
console.log(novaLista)
| true |
41d6b47cf52912fba43a42342caea68fa73fc5b8 | JavaScript | KangJun-KJ/notes | /node/node包教不会/菜鸟教程/EventEmiter.js | UTF-8 | 775 | 3.546875 | 4 | [] | no_license | //Node.js 所有的异步 I/O 操作在完成时都会发送一个事件到事件队列。
//EventEmitter 的核心就是事件触发与事件监听器功能的封装。
//1、eventEmitter.on()与eventEmitter.addListener()没有区别,且一个事件可以绑定多个回调函数;
//2、若事件队列中出现一个未绑定事件则触发error事件,若未绑定 error事件则程序抛出异常结束执行
var EventEmitter = require("events");
var event = new EventEmitter.EventEmitter();
event.on("some_event", function()... | true |
efde38b0012fb6c0bd483856ad120736a85167b2 | JavaScript | 201626701044/NF | /src/main/webapp/js/personal-detail.js | UTF-8 | 1,311 | 3.34375 | 3 | [
"MIT"
] | permissive | // window.onload=function () {
// show(1);
// }
// function show(num)
// {
// for(var i=1; i<=5; i++)
// {
// document.getElementById("d"+i).style.display="none";
// }
// document.getElementById("d"+num).style.display="block";
// }
window.onload=function () {
var lis=document.getElemen... | true |
99017bda6515cee59719f831dd5b0d189261ba79 | JavaScript | DeathStalker72/Project-28 | /sketch.js | UTF-8 | 1,564 | 2.609375 | 3 | [] | no_license |
const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Body = Matter.Body;
const Render = Matter.Render;
const Constraint=Matter.Constraint;
var tree, stone, ground, launcher;
var mango1,mango2,mango3,mango4,mango5,mango6,mango7,mango8,mango9,mango10,mango11,mango12;
var... | true |
f5f1e26cd4dd916c3a394ea341a672e24cf9c3e7 | JavaScript | JaennPB/forkify-test | /src/js/controller.js | UTF-8 | 8,265 | 2.78125 | 3 | [] | no_license | // IN CHARGE OF APP FUNCTIONALITY / CONTROLLERS + SUBSCRIBERS
// likned to views and model
// *****************************************************************************************
// ********************************************************************************* imports
// model module
import * as model from './... | true |
8d4470c9133364b051cec18da868e7074b8b798b | JavaScript | cnorm35/task_manager | /routes/index.js | UTF-8 | 1,429 | 2.703125 | 3 | [] | no_license | module.exports = function Route(app){
//require the mongo mosule and connect to the db
var mongoose = require('mongoose');
//connect to the db!
var db = mongoose.connect('mongodb://localhost/tasks');
//make the task schema
//having issues with saving items into db passing in required: true for validation.
v... | true |
4b5d6262b8af27ea18ad6c632b4b21cda51dc1fc | JavaScript | agosh-saini/BlockchainBasics | /mySQL.js | UTF-8 | 1,740 | 2.796875 | 3 | [] | no_license | var mysql = require('mysql');
var con = mysql.createConnection({
host: "localhost",
user: "root",
password: ""
});
con.connect(function(err) {
//checking to see if the connection is established
if (err) throw err;
console.log("Connected!");
//creating Database
con.query('CREATE DATABA... | true |
edcfa66143c67d26afa9169c8d226e3c7c6b4c5a | JavaScript | hjm100/dy-react | /src/utils/validate.js | UTF-8 | 3,389 | 3.015625 | 3 | [] | no_license | /**
* 常用验证方法封装
* User: hjm100
* Date: 18-10-09 10:10
*/
/**
* 姓名验证
*/
export let isName = name=>{
let regExp = /^[\u4e00-\u9fa5]{2,6}$/; //匹配2到6个中文字符
if (regExp.test(name)) return true;
else return false;
}
/**
* 手机号验证
*/
export let isPhone = phone=>{
let regExp = /^(0|86|17951)?(13[0-9]|15[... | true |
47b816e7ad8754c4282e96b36b0faab71017e3d9 | JavaScript | aZerato/Game-Of-Life | /scripts/objects/Cellule.js | UTF-8 | 5,405 | 3.15625 | 3 | [] | no_license | var Cellule = (function() {
var Cellule = function(
posX,
posY,
state,
ctx)
{
this.typeOf = 'Cellule';
this.posX = posX;
this.posY = posY;
// state level.
this.state = 0;
this.step = 0;
// canvas context
this.ctx = ctx;
this.changeState(state, this.ctx);
... | true |
91327461074cf437c713165e60f17578f8f27b4a | JavaScript | tienloinguyen22/web-10 | /btvn-buoi2-js-practices/Practice1/searchPractice.js | UTF-8 | 225 | 2.921875 | 3 | [] | no_license | 'use strict'
function search(input, target) {
let result = -1;
for (let i=0; i<input.length; i+=1) {
if (input[i] == target) {
result = i;
break;
}
}
return result;
}
module.exports = search
| true |
6da4fd5ce83ff16f6e06a1aadc74651f54d6fdd1 | JavaScript | Saturn91/ToDoCASFE | /services/taskStorage.js | UTF-8 | 1,847 | 2.53125 | 3 | [] | no_license | import Datastore from 'nedb';
class TaskStorage {
constructor() {
this.db = new Datastore({filename: './data/tasks.db', autoload: true});
}
add(newTask, callback) {
this.db.insert({
title: newTask.title,
description: newTask.description,
finishDate: newT... | true |