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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
5267331038d60a27d7d53575f286fc098ce29826 | JavaScript | ChelesteWang/js-leetcode | /剑指offer/32-easy-从上到下打印二叉树 II.js | UTF-8 | 1,097 | 3.9375 | 4 | [] | no_license | // 32 easy 从上到下打印二叉树2
// 从上到下按层打印二叉树,同一层的节点按从左到右的顺序打印,每一层打印到一行。
//
// 例如:
// 给定二叉树: [3,9,20,null,null,15,7],
//
// 3
// / \
// 9 20
// / \
// 15 7
// 返回其层次遍历结果:
//
// [
// [3],
// [9,20],
// [15,7]
// ]
//
//
// 提示:
// 节点总数 <= 1000
// 面试题32 - 从上到下打印二叉树2
var levelOrder2 = function(root) {
... | true |
27edc26b0989f978200bd3a43f46678f5d981cd8 | JavaScript | dev-jian/spring-mission-006 | /src/main/webapp/resources/js/modify.js | UTF-8 | 872 | 2.796875 | 3 | [] | no_license | document.querySelector('#modifyForm').addEventListener('click', modifyBoard);
async function modifyBoard(e) {
e.preventDefault();
if (e.target.id === 'modifyBtn'|| e.target.id === 'modifyByHeaderBtn') {
const boardNo = document.querySelector('#boardNo').value;
const title = document.querySelector('#title').val... | true |
7ac5092ee72b2a587ec456a42395b651cc408773 | JavaScript | cg-group/Quadrilaterals | /js/interactions.js | UTF-8 | 3,980 | 2.8125 | 3 | [
"MIT"
] | permissive | var current_polygon;
var current_region;
var current_ring;
var current_vertex;
var current_direction;
(function resetAll() {
current_polygon = new Polygon();
current_region = new Region();
current_ring = new Ring();
current_vertex = null;
current_direction = null;
current_polygon.pushRegion(cur... | true |
882972a0c2ab1a30f4c7345f55809a7be543cae4 | JavaScript | Gabehaus/FatHacker2021 | /client/src/reducers/healthDataReducer.js | UTF-8 | 1,475 | 2.75 | 3 | [] | no_license | import {
GET_HEALTHDATA,
ADD_HEALTHDATA,
EDIT_HEALTHDATA,
HEALTHDATA_LOADING,
GETHEALTHDATA_FAIL
} from "../actions/types";
const initialState = {
healthData: "",
loading: false,
sex: "",
age: "",
height: "",
weight: "",
goal: "",
activityLevel: "",
healthDataExists: false,
newHealthDataA... | true |
c5a3c4815e9526a771a9f03f99d1d8281014e454 | JavaScript | ThunderBoltEngineer/calendar-events | /src/utils/date.js | UTF-8 | 503 | 3.0625 | 3 | [] | no_license | function daysInMonth(year, month) {
const d = new Date(year, month, 0);
return d.getDate();
}
function firstDayOfMonth(year, month) {
const d = new Date(year, month - 1, 1);
return d.getDay();
}
function getCurrentYear() {
return new Date().getFullYear();
}
function getCurrentMonth() {
return new Date().... | true |
9ac68ea387e348649cfca1601d20bc40b1879d8d | JavaScript | moribaleta/tictactoa-socket | /public/resources/js/game.js | UTF-8 | 9,319 | 2.671875 | 3 | [] | no_license | const app = new Vue({
el: "#app",
data: {
user : null,
users : [],
session : new Session(),
socket : io(),
connected : false,
input_text: ""
},
methods: {
onStart() {
console.log("session %o", this.session)
this.soc... | true |
d496221bd6119a829fec332aa458e5d1439d038c | JavaScript | ZaZo0o/FreeBoards | /public/javascripts/board.js | UTF-8 | 3,354 | 2.703125 | 3 | [] | no_license | $(function() {
/****** Read Json ******/
var listCount = 0;
var objectCount = 0;
if (boardContent == "{}"){
listCount++;
var board = {"list1":{"id":"list1","objects":[]}};
$(".queryWorkbench").append(initContent);
} else {
var board = boardContent;
loadFromJson(board);
}
function loadFromJson(board){
... | true |
9262a4728fe4ab6994c57b008e29eb35c29eb6da | JavaScript | Petrozza/JSAdvanced | /SYNTAX-FUNCTIONS-STATEMENTS/Same Numbers.js | UTF-8 | 437 | 3.40625 | 3 | [] | no_license | function same(numb){
let numbAsString = numb.toString();
let isSame = true;
let sum = 0;
for (let i = 0; i < numbAsString.length; i++) {
if (i < numbAsString.length-1) {
if (numbAsString[i] != numbAsString[i+1]) {
isSame = false;
}
... | true |
539450b01731f8836b335ead6bc0bb0888f0804e | JavaScript | bprinty/jest-axios | /tests/nesting.test.js | UTF-8 | 2,621 | 2.625 | 3 | [
"MIT"
] | permissive | /**
* Testing for package.
*/
// imports
// -------
import axios from 'axios';
import { assert } from 'chai';
import server from './server';
// config
// ------
jest.mock('axios');
server.init(axios);
beforeEach(() => {
server.reset();
});
// tests
// -----
describe('nesting', () => {
let res;
test('nest... | true |
3585585b088a306a3b718f86197d742a11aea3da | JavaScript | muntasir2165/Toronto-Star-News-Feed | /models/Article.js | UTF-8 | 1,292 | 2.765625 | 3 | [
"MIT"
] | permissive | var mongoose = require("mongoose");
// Save a reference to the Schema constructor
var Schema = mongoose.Schema;
// Using the Schema constructor, create a new ArticleSchema object
var ArticleSchema = new Schema({
// `headline` is required and of type String
headline: {
type: String,
required: true
},
/... | true |
0d390400e57a4518d7df3658482981bf79e68580 | JavaScript | nofun97/Curator | /App/Components/InventoryItems.js | UTF-8 | 2,541 | 2.6875 | 3 | [] | no_license | import React, { Component } from 'react';
import { StyleSheet, View, Image, Text, TouchableOpacity } from 'react-native';
export default class InventoryItems extends Component {
constructor(props){
super(props);
this.state = {
id: this.props.item.id,
owners: this.props.item.owners, // user ids
... | true |
ad6ee930ad918808ef432ebdf61f1fd789ef1869 | JavaScript | Alex427427427/hypothetical_shipment_planner | /scripts/step3.js | UTF-8 | 8,570 | 3.15625 | 3 | [] | no_license | "use strict";
/* function to retrieve origin and destination from local storage.*/
function retrievePorts()
{
origin.fromData(JSON.parse(localStorage.getItem("origin"))); //overwrites origin and destination global var.
destination.fromData(JSON.parse(localStorage.getItem("destination")));
}
/* function to store li... | true |
4a09220fa4cb5ee6515d8ca2f2de6d4d6a38853d | JavaScript | NTMHuong/CaseStudy---Module1 | /Obstacle.js | UTF-8 | 556 | 3.171875 | 3 | [] | no_license | class Obstacle {
x;
y;
weight;
height;
color;
constructor (x, y, weight, height, color) {
this.x = x;
this.y = y;
this.weight = weight;
this.height = height;
this.color = color;
this.dx = -gameSpeed;
}
Update () {
this.x += this.d... | true |
a26baf039311d26fd14767cd62017249e27300c3 | JavaScript | amajor/tdd-playground | /Examples/PigLatin/pigLatin.js | UTF-8 | 483 | 2.859375 | 3 | [] | no_license | 'use strict';
var PigLatin;
PigLatin = {
moveConsonant: function(word) {
const firstLetter = word.match(/\w/);
const remainingWord = word.split(/^./);
const newWord = remainingWord[1] + firstLetter;
return newWord;
},
appendAy: function(word) {
return word + 'ay';
},
translate: functio... | true |
7ce2d97fbbde7b223c0d168e537eab2f204a55a5 | JavaScript | NickF1260/NYT.React | /app/components/Save.js | UTF-8 | 2,948 | 2.78125 | 3 | [] | no_license | // Include React
var React = require("react");
// Helper for making AJAX requests to our API
var helpers = require("../utils/helpers");
// Creating the Main component
var Save = React.createClass({
// Here we set a generic state associated with the number of clicks
// Note how we added in this history state var... | true |
fd87d11760c1d41e339fc8cf444856e04de8c870 | JavaScript | Aman09Singh/Capgemini_ADAPT | /ES6 & TypeScript/Assignment 1/Ques5c.js | UTF-8 | 230 | 3.828125 | 4 | [] | no_license | let displayLetter = function(letters) {
for (const letter of letters) {
console.log(letter.charAt(0).toUpperCase() + letter.slice(1));
}
}
let letters = ["a", "q", "b", "j", "k"];
displayLetter(letters) | true |
cd2f01b8a8220ccfe2b8a6723904930037dc2c9e | JavaScript | gslav27/Codewars | /LiveAndLetDiceRoll_test.js | UTF-8 | 2,352 | 3.484375 | 3 | [] | no_license | /* eslint-disable func-names, no-param-reassign */
const Dice = {};
const defs = [1, 6, 0];
const parseAttrs = (numberOfDice, numberOfSides, modifier) => {
if (!numberOfDice) {
[numberOfDice, numberOfSides] = defs;
} else if (typeof (numberOfDice) === 'string') {
if (/[+-]/.test(numberOfDice)) {
... | true |
1f032c2e48582b2422d8326ef3f4af67eb058fd5 | JavaScript | zoulianmp/linacqa | /static/src/framework/Loader.js | UTF-8 | 533 | 2.796875 | 3 | [] | no_license | window.Loader = {
loadText: function(path, onLoadedFunc){
var request = new XMLHttpRequest();
request.open("GET", path);
request.onreadystatechange = function(){
if (request.readyState == 4) {
onLoadedFunc.call(null, request.responseText);
}
};
request.send();
},
loadJSON: function(path, onL... | true |
1e7b1f66e96243aa84555ef85df69132e789c688 | JavaScript | ggyurov/ggyurov.github.io | /js/app.js | UTF-8 | 757 | 2.84375 | 3 | [] | no_license | $("#contact").submit(function(e){
e.preventDefault();
var name = $("#name").val();
var email = $("#email").val();
var text = $("#text").val();
var dataString = 'name=' + name + '&email=' + email + '&text=' + text;
function isValidEmail(emailAddress) {
var pattern = new RegExp(/^([\w-]+(?:\.[\w-]+)*)@((?... | true |
c1b106c36c47c6624b3c85f780da054c4eee28de | JavaScript | beastehg/js_lesson_12 | /dist/js/script.js | UTF-8 | 2,534 | 2.859375 | 3 | [] | no_license | const $input = $("[data-id=search-video]");
const $searchForm = $("#search-form");
const $slider = $(".slider");
const slickTrack = $(".slick-slide");
function playVid(vid) {
vid.play();
}
$searchForm.on("submit", (event) => {
event.preventDefault();
const text = $input.val().replace(/\s/g, "+");
getVideos(text);... | true |
3b313affd15432895e331d80d61fae3790db050c | JavaScript | dimo89/type | /src/components/WordCheck.js | UTF-8 | 1,897 | 2.84375 | 3 | [] | no_license | import React from 'react';
import propTypes from 'prop-types';
import './styles.css';
class WordCheck extends React.Component {
constructor(props) {
super(props);
this.state = {
correctWordsCount: 0,
falseWordsCount: 0,
lettersCount: 0,
}
}
updateState(items) {
this.setState({... | true |
2985ca8b20fb0a673cf37cc607d0bdad4dbae3df | JavaScript | Theracon/electronic-medical-records | /src/shared/utils/formValidation.js | UTF-8 | 761 | 3.125 | 3 | [] | no_license | const checkValidity = (value, rules) => {
let isValid = true;
if (rules.required) {
isValid = value.trim() !== "" && isValid;
}
if (rules.isNumber) {
isValid = !isNaN(value) && isValid;
}
if (rules.max) {
isValid = +value <= rules.max && isValid;
}
if (rules.min) {
isValid = +value >... | true |
8b2b2cdbf44da0cbf676fc521ff4615f742929be | JavaScript | dotstudio-io/fi-fileman | /lib/multiparser.js | UTF-8 | 1,236 | 2.546875 | 3 | [
"MIT"
] | permissive | const Parser = require('./parser');
const Busboy = require('busboy');
/**
* Parses any incoming multipart form data via POST or PUT.
*
* @type Express Middleware
*/
module.exports = tempdir => (req, res, next) => {
/* Parse only POST and PUT request with multipart form data */
if ((req.method !== 'POST' && req... | true |
b16564c3dd26446e015acb91016466077daf37b9 | JavaScript | tam3marie/react-weather-app | /src/FormattedDate.js | UTF-8 | 1,292 | 2.546875 | 3 | [] | no_license | import React, { useContext } from "react";
import { UnitContext } from "./UseContexts";
import FormattedMilitaryTime from "./FormattedMilitaryTime";
import FormattedStandardTime from "./FormattedStandardTime";
export default function FormattedDate(props) {
const { unit } = useContext(UnitContext);
let days = [
... | true |
23d7e14976dea6608927879df8bb5d04193c2828 | JavaScript | RomaZherko21/CodeWars | /5kyu/WhereIsMuAnagramsAt.js | UTF-8 | 321 | 3.078125 | 3 | [] | no_license | function anagrams(word, words) {
let sum = 0;
let arr = [];
for (let item of word) {
sum += item.charCodeAt();
}
for (let item of words) {
let sum2 = 0;
for (let char of item) {
sum2 += char.charCodeAt();
}
if(sum2==sum) arr.push(item)
}
return arr;
... | true |
1bf9c32d9b9f9eac25b529a914b16e28ae1aba82 | JavaScript | BadmasterY/learn-demo | /PC/server-mongoose/db/Dao.js | UTF-8 | 6,008 | 3.140625 | 3 | [] | no_license | /**
* Dao
* 这里为基础类, 一个面向对象的数据库接口
*/
class Dao {
/**
* 需要创建好的模型
*/
constructor(model) {
if(!model) throw new Error(`Paramer 'model' not found.`);
this.Model = model;
}
/**
* 创建数据,
* 使用 model.create()
* @param {Object} obj 需要添加的数据
*/
create(obj) {
... | true |
2c0372e6aec4c9436d45a98ecaf001b8c781d967 | JavaScript | whysosunny/learning-node | /playground/js_playground.js | UTF-8 | 704 | 3.984375 | 4 | [] | no_license | console.log("HEYA CONSOLE!");
//Functions are abstractions. Every line can be abstracted into a block.
var store_arr = [1,2,3,4,5];
for(var i=0; i<store_arr.length; i++) {
console.log(store_arr[i]);
}
//or
function god_each(arr, action) {
for(var i=0; i<arr.length; i++) {
action(arr[i]);
}
}
v... | true |
c627de4cac8a4cc5461bd96e72a4df9824fb25e4 | JavaScript | andy4thehuynh/seinfeld | /script.js | UTF-8 | 3,781 | 3.171875 | 3 | [] | no_license | //////////////////////////////////////////
//
//
// Namespace
//
//
//////////////////////////////////////////
var seinfeld = {};
//////////////////////////////////////////
//
//
// Model
//
//
//////////////////////////////////////////
seinfeld.save = function(list) {
localStorage["seinfeld-app.list"] = JSON.... | true |
9a316f58fc19f4ad34a4afbdd20601a776c47bb5 | JavaScript | FAsami/travel-guru | /src/Components/SignIn/validation.js | UTF-8 | 1,893 | 2.96875 | 3 | [] | no_license | export const validateFirstName = (firstName, error, setError) => {
if (!firstName) {
setError({
...error,
firstName: 'FirstName is required',
firstNameError: true,
});
} else if (firstName.length < 3) {
setError({
...error,
firstName: 'FirstName must contain at least 3 char... | true |
6da2bf87e3d5112fa5760814dec3e5b899249910 | JavaScript | rakheegit/WebAmazers | /webamazers/app_server/public/scripts/set-active-section.js | UTF-8 | 2,953 | 2.828125 | 3 | [] | no_license | /* ------------------------------
Set event listeners
------------------------------ */
if(window.addEventListener) {
addEventListener('DOMContentLoaded', setActiveSection, false);
addEventListener('load', setActiveSection, false);
addEventListener('scroll', setActiveSection, false);
addEventList... | true |
f061c4ae9b97f4c02ddd1d928acc622f5a509f3a | JavaScript | kevinfaridap/tugas-introjavascript | /Week2-Tugas4/soal_3.js | UTF-8 | 3,850 | 3.796875 | 4 | [] | no_license | // =======================No.1===============
// Penjumlahan
const addition = (num1, num2) =>{
return new Promise((resolve, reject)=>{
if(typeof (num1) != 'number' || typeof (num2) != 'number' ||
num1=== "" || num2 === ""){
return reject(new Error("inputan salah"))
... | true |
8c14e039f57b49b32b63c8d50d4ba9f0a216cfbd | JavaScript | rosong1/node-module-demo-2018-2-1 | /index.js | UTF-8 | 108 | 3.15625 | 3 | [] | no_license | export const add = (n, sum = 0) => {
sum += n
if (n - 1 === 0) return sum
return add(n - 1, sum)
} | true |
a3443488d0ff826a83eefdb6b542a61076728231 | JavaScript | SaoriKaku/what-is-popular | /src/components/movie-item/movie-item.js | UTF-8 | 2,656 | 2.546875 | 3 | [] | no_license | import React, {Component} from "react";
import PropTypes from "prop-types";
import {URL_IMAGE_PREFIX} from "../../constants";
import "./movie-item.css";
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faHeart } from '@fortawesome/free-solid-svg-icons';
export default class MovieItem extends ... | true |
cf80b3d0fee8efbcd4a6be102eb69b107afb2fc2 | JavaScript | Dpavaman/GUVI_prebootcamp | /Task 3/print the names that consists of letter a in the Array.js | UTF-8 | 339 | 3.65625 | 4 | [] | no_license | /*Find the friends names who has letter ‘a’ and return the list.
*/
var friends = [
"Gabbar",
"Rajinikanth",
"Mass",
"Spiderman",
"Jeff",
"ET"
];
var newArr =[];
for(let ind = 0 ;ind < friends.length ; ind++)
{
if(friends[ind].includes("a"))
{
newArr.push(friends[ind]);
}
}
conso... | true |
9e678d5629126a6ac638d354b96ad88fd14fed00 | JavaScript | goright-io/storybook-react-tailwind-starter | /src/components/Buttons/Button.js | UTF-8 | 1,342 | 2.75 | 3 | [] | no_license | import React from 'react';
import PropTypes from 'prop-types';
import './button.css';
/**
* Primary UI component for user interaction
*/
const BASE_BUTTON =
"rounded outline-none shadow font-normal"
const BUTTON_PRIMARY = `${BASE_BUTTON} bg-black border border-black text-white`
const BUTTON_SECONDARY = `${BASE_BU... | true |
6b2d115278ce0053912c22669ff9f56058abb74b | JavaScript | ei1125/asset-station | /app/assets/javascripts/top.js | UTF-8 | 2,133 | 2.703125 | 3 | [] | no_license | $(function(){
function buildHTML_when(data){
var html =
`${data.year}年${data.month}月`
return html
};
function buildHTML_edit(data){
var html =
`<a class="m-icon" href="/years/${data.year_id}/months/${data.month_id}">
<i class="fas fa-cog"></i></a>
<a class="m-icon" rel=... | true |
02fe8f0f048b7c5950a226e032eb73f655c2f938 | JavaScript | dragino/console-decoders | /GlamosDecoder.js | UTF-8 | 1,032 | 2.703125 | 3 | [] | no_license | //GLAMOS Combined Decoder for Mappers, Cargo and Helium Vision
function Decoder(bytes, port) {
var decoded = {};
var position = {};
position.lat = ((bytes[0] << 16) >>> 0) + ((bytes[1] << 8) >>> 0) + bytes[2];
position.lat = (position.lat / 16777215.0 * 180) - 90;
position.lat = position.lat.toFi... | true |
b6abb0eb4ebd5e49a351b8d48ecb10a33ba70fcf | JavaScript | FinniByh/YouTube | /src/buildVideoBar.js | UTF-8 | 2,163 | 2.890625 | 3 | [] | no_license |
function buildVideoBar(videoInfo) {
const videoList = document.getElementById('innerMainBar');
const video = document.createElement('div');
const viewTitle = document.createElement('div');
const channel = document.createElement('div');
const date = document.createElement('div');
const views = document.cre... | true |
bee38bff0545f983ed029c280cefa94b5a3224bd | JavaScript | vit-s/js-hw-07 | /task-03.js | UTF-8 | 1,536 | 3.3125 | 3 | [] | no_license | // Задание 3
// Напиши скрипт для создания галлереи изображений по массиву данных.
// В HTML есть список ul#gallery.
// <ul id="gallery"></ul>
// Используй массив объектов images для создания тегов img вложенных в li. Для создания разметки используй шаблонные строки и insertAdjacentHTML().
// Все элементы галереи должн... | true |
f7c10bb4d791fe9f4b91f408d46faa03e4f87eb0 | JavaScript | WhoisBsa/amporal | /AMPORAL/src/reducers/userReducer.js | UTF-8 | 1,216 | 2.546875 | 3 | [] | no_license | const initialState = {
token: '',
username: '',
password: '',
email: '',
first_name: '',
last_name: '',
bio: '',
instituicao: '',
data_nascimento: '',
foto_url: '',
};
export default (state = initialState, action) => {
switch (action.type) {
case 'SET_TOKEN':
return { ...state, token: a... | true |
00393725e4240a9ca39f88743e71ba36c4979359 | JavaScript | aprin418/bird-flow-frontend | /src/components/States.js | UTF-8 | 1,099 | 2.78125 | 3 | [] | no_license | import React, { useEffect, useState } from "react";
import axios from "axios";
const REACT_APP_SERVER_URL = process.env.REACT_APP_SERVER_URL;
const Birds = () => {
const [birds, setBirds] = useState([]);
useEffect(() => {
let url = `${REACT_APP_SERVER_URL}/api/search/states`;
axios
.get(url)
... | true |
e84b9e3612d4539df4db88e640ef1e1ff2ed6866 | JavaScript | abhinavgautam07/codial | /mailers/comments_mailer.js | UTF-8 | 631 | 2.515625 | 3 | [] | no_license | const nodemailer=require('../config/nodemailer');
// newComment=function...
// module.exports=newComment
// instead of this we can write as this also
exports.newComment=(comment)=>{
let htmlString=nodemailer.renderTemplate({comment:comment},'/comments/new_comment');
console.log("inside new Comment mailer",comment);
/... | true |
de9bf66c58fe74fab6eadcf8c41668aade8fb23a | JavaScript | heifade/WebSocket | /src/utils/WebSocketHelper.js | UTF-8 | 653 | 2.9375 | 3 | [] | no_license | export class WebSocketHelper {
socket = null;
isCloseManual = false;
open(url) {
this.socket = new WebSocket(url);
this.socket.onopen = function() {
console.log('建立连接');
};
this.socket.onmessage = (evt) => {
this.onMessage(evt.data);
};
this.socket.onclose = () => {
// se... | true |
5b2f8e19fd7fc9609ffb1c7919b7aecbdfffe821 | JavaScript | IamBeltran/vpn-manager | /test/specs/spec.calculator.js | UTF-8 | 2,631 | 2.90625 | 3 | [
"DOC",
"MIT"
] | permissive | // ┌───────────────────────────────────────────────────────────────────────────────────┐
// │ REQUIRE THIRDPARTY-MODULES DEPENDENCY. │
// └───────────────────────────────────────────────────────────────────────────────────┘
const chai = require('chai');
// ┌──────────────... | true |
12f0c66b23e5e87bf69ab9e1c1db5c69506aa652 | JavaScript | andrewrjohn/food-tray | /public/electron.js | UTF-8 | 1,583 | 2.859375 | 3 | [] | no_license | // Modules to control application life and create native browser window
const { app, BrowserWindow, Tray } = require("electron");
let tray, window;
app.dock.hide();
const createWindow = () => {
// Create the browser window.
window = new BrowserWindow({
show: false,
frame: false,
width: 900,
heigh... | true |
34a0b523953ce0a5365e7a06c75b898b8be6ba08 | JavaScript | oussamaghrib/fullstackOpen-part5 | /src/App.js | UTF-8 | 3,026 | 2.546875 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import Blog from "./components/Blog";
import CreateNewBlog from "./components/CreateNewBlog";
import blogService from "./services/blogs";
import userService from "./services/user";
const App = () => {
const [blogs, setBlogs] = useState([]);
const [username, setUs... | true |
4118f3d1b95b58ae97efadfa576199162fbff0fe | JavaScript | simplonve/demo-javascript-reddit-gifs | /app.js | UTF-8 | 552 | 2.984375 | 3 | [
"MIT"
] | permissive | var url = "https://www.reddit.com/r/perfectLoops.json"
var callback = function(response){
// récupérer les urls des images
var images = response.data.children.map(function(obj){
return obj.data.url
});
var html = "";
// construire le html pour afficher les images dans des balises <img>
images.forEach... | true |
795558da8339c628dd5c4ea077adfe6c4a38a5f7 | JavaScript | huynonstop/burger-build | /src/utils/localStorage.js | UTF-8 | 2,279 | 2.609375 | 3 | [] | no_license | import { TYPES } from '../config/naming';
import { debounced } from './performance';
export const defaultIngredientsStoreData = {
ingredients: {
[TYPES.meat]: 0,
[TYPES.cheese]: 0,
[TYPES.salad]: 0,
[TYPES.bacon]: 0,
},
price: 0,
};
export const getIngredientsStoreData = () => {
try {
cons... | true |
a4165512ea8e17e69a828035f272fe5e37d98491 | JavaScript | msqart/Projects | /qdynex/dist/js/mapGoogleWhite.js | UTF-8 | 3,084 | 2.5625 | 3 | [] | no_license | var map;
var mapBlock = document.getElementById('map');
var initMap = function () {
map = new google.maps.Map(mapBlock, {
zoom: 15,
center: new google.maps.LatLng(50.458233, 30.525519),
mapTypeId: 'roadmap',
styles: [
{
"featureType": "administrative",
... | true |
6e37b7f37d1a5e9fcb3b6289cf79b39de152b6ab | JavaScript | Zfsmith/UserRolesApp | /app/components/Login.js | UTF-8 | 2,934 | 2.546875 | 3 | [] | no_license | import React from "react";
import Helpers from '../utils/helpers'
import Header from './Header'
const helpers = new Helpers();
export default class Login extends React.Component {
constructor(props){
super(props);
this.state = {
userName: "",
password: "",
error: null
};
this.han... | true |
f496a0675f6f36b3e2ef8b8ff1012f2c9dfb2e62 | JavaScript | jackenl/rollup | /example/prepos/magic-string.js | UTF-8 | 403 | 2.5625 | 3 | [] | no_license | const MagicString = require('magic-string')
const s = new MagicString(`export var name = 'careteen'`)
console.log(s.snip(0, 6).toString(), s.toString())
console.log(s.remove(0, 7).toString(), s.toString())
const b = new MagicString.Bundle()
b.addSource({
content: `var name = 'careteen'`,
separator: '\n',
})
b.add... | true |
a38e7e4df43192a65d41c9fcf5bb2d58b7d0805e | JavaScript | motibarshazky1/Dice-Game | /src/UI.js | UTF-8 | 4,450 | 2.90625 | 3 | [] | no_license | import React from 'react';
import Button from 'react-bootstrap/Button';
import YourScore from './YourScore';
import ComputerScore from './ComputerScore';
import './UI.css';
class UI extends React.Component {
state = {
yourScore: {
//your dice
score: 0,
},
computerSco... | true |
251aeb911187b46307601e72653fe0f7702a777e | JavaScript | jsxtools/apimd | /endpoint.js | UTF-8 | 3,408 | 2.796875 | 3 | [
"CC0-1.0"
] | permissive | const { assign, create, has, is, isArray, isNullish, asNumber, isRegExp, asString } = require('./util');
class Endpoints extends Array {
add(opts) {
const endpoint = opts instanceof Endpoint ? opts : new Endpoint(opts);
this.push(endpoint);
return endpoint;
}
clone(endpoint) {
return this.add(endpoint.cl... | true |
b775ca89d5f3464b0b80ce987e82933129bf6f3e | JavaScript | CraigOliver97/Craig1P02Oliver | /BasicJava11lab2.js | UTF-8 | 402 | 3.515625 | 4 | [] | no_license | var adjArray = new Array();
adjArray = ["Ugly", "Stupid", "Sheepish", "Cute", "Gleeful"];
var nounArray = new Array();
nounArray = ["Idiot", "Creature", "Moron", "Puppy", "Craig"];
function getSent(){
var adjNum = Math.round(Math.random()*4);
var nounNum = Math.round(Math.random()*4);
document.getEleme... | true |
e3c30e8212b50b3cc5fbdce47a679efeb5a059ad | JavaScript | alaahamed1990/TD-MATRIX | /test/spec/DocumentVectorDistance.js | UTF-8 | 2,015 | 2.9375 | 3 | [] | no_license | describe("Documents vector distance",function()
{
var tdMatrix;
beforeEach(function()
{
tdMatrix=new TDMATRIX();
});
it("should return 0 if passed arguments both or one the passed arguments is undefined",function()
{
var sourceDocument=undefined;
var destDocument=undefined;
var distance=tdMatrix.GetDistanc... | true |
5becf0ff832f80c984d6b33c1f5515d4a4e89b47 | JavaScript | Martin-Myan/to_do-_-redux | /src/App.jsx | UTF-8 | 1,724 | 2.609375 | 3 | [] | no_license | import React, { useState } from "react";
import { useSelector, useDispatch } from "react-redux";
import shortid from "shortid";
import { returnNewItem, deleteItem, editItem } from "./store/actions";
import { Input, NewItem } from "./components";
import styles from "./App.module.scss";
const App = () => {
const de... | true |
30b55d7b90c41874a7ab9826ea874492f895b541 | JavaScript | shivampip/FrontEnd | /JSDemo/Hitesh/WebBasics/jsonhandle.js | UTF-8 | 609 | 3.921875 | 4 | [
"MIT"
] | permissive | //alert("connetectd")
function print(msg) {
console.log(msg);
}
const student = {
name: "Shivam",
age: 23,
isActive: true,
}
//convert obj into string to be stored in local storage
const student_str = JSON.stringify(student)
print(student_str)
//localStorage.setItem("student", student_str)
//conv... | true |
c9e236e521151394d0e220a5df3819c26eb2dd9c | JavaScript | kostakis88/simple-contacts | /src/components/ContactsList.js | UTF-8 | 1,637 | 2.59375 | 3 | [] | no_license | import React from 'react';
import { connect } from 'react-redux';
import { createContact, deleteContact } from '../actions';
class ContactsList extends React.Component {
state = {
name: ''
};
handleChange = (e) => {
this.setState({
name: e.target.value
});
}
h... | true |
422e07c9452fdce48b8798e9de891b7c012f2d07 | JavaScript | xiaotanit/Tan_HtmlDemo | /JS/js/redux/reduxDemo4.js | UTF-8 | 2,131 | 3.9375 | 4 | [] | no_license | /**
* 代码和demo3的代码差不多的,但是我们这里现在变化一下名字:
* 原plan方法改名为reducer, 原changeState改名为dispatch .
* 不管你同不同意,反正我要改名字, 因为新名字比较酷(哈哈,其实是redux就是这么叫的)
* */
const createStore = function(reducer, initState){
let state = initState; //初始目标对象
let listeners = []; //记录订阅者
//获取state对象的对外公开接口
function getState(){
ret... | true |
fb091058cdc5f7d6f1289836204a2cdac46dd642 | JavaScript | trulyronak/FullStackTemplate | /backend/models/user.js | UTF-8 | 1,034 | 3.03125 | 3 | [] | no_license | const bcrypt = require('bcrypt');
// local, in memory db — easy to swap this out with your DB system
const db = {};
class User {
constructor(email, password, data) {
this.email = email;
this.password = bcrypt.hashSync(password, 10);
this.data = data || {}; // default map
}
async validatePassword(pass) {
c... | true |
b460300f944c50fce05e129df4b7567e34702685 | JavaScript | walmello/jungle-xp33-quiz | /Quiz.js | UTF-8 | 2,684 | 3.390625 | 3 | [] | no_license | class Quiz{
select = (index) => this.update(() => {
this.selected = index
})
Choices = (choices,questionNum) => choices.map((choice, alt) => {
return /*html*/`
<button
class="center-things button-choice text-center text-button-choices"
on... | true |
b71679551ec469fb8f652758abf9150ca37a5da5 | JavaScript | AlfonsoCifuentes/upgrade-dom | /iteracion2.js | UTF-8 | 2,785 | 4 | 4 | [] | no_license | //2.1 Inserta dinamicamente en un html un div vacio con javascript.
let divContainer = document.createElement("div");
divContainer.style.cssText = "background:tomato";
document.body.appendChild(divContainer);
//2.2 Inserta dinamicamente en un html un div que contenga una p con javascript.
let parrafo22 = document.cr... | true |
a7b14470f2403a692f9002c2374bfdc752b6d69d | JavaScript | surenaus/react_todo_beeje | /src/_services/todo.service.js | UTF-8 | 2,129 | 2.5625 | 3 | [] | no_license | import axios from 'axios'
const url = 'https://uxcandy.com/~shapoval/test-task-backend/'
export const todoService = {
getAll,
addTodo,
searchBy,
editTodo
};
function searchBy(page, param, direction)
{
const requestOptions = {
method: 'GET',
};
const data = {
page: page,
... | true |
85e83ad97412d6f206489b2c855560d7c45e4b98 | JavaScript | viceduoc/entrega_4 | /entrega3/static/entrega3/js/formulariojs.js | UTF-8 | 1,353 | 2.5625 | 3 | [] | no_license | console.log('prueba')
$().ready(function () {
$("form[name='formulario']").validate({
rules:{
nombre: "required",
apellido: "required",
email: {
required: true,
email: true
},
password: {
required:... | true |
aa10bb632238415fba66266e09b47029b3c40431 | JavaScript | Dukat-Gul/device-type-library | /types/astraled/airQualityLuminary_V0_02/uplink.js | UTF-8 | 7,449 | 2.546875 | 3 | [
"MIT"
] | permissive | // Decoder Gateway Protocol Version 0.02
function swap16(val) {
return ((val & 0xFF) << 8) |
((val >> 8) & 0xFF);
}
function swap32(val) {
return (((val << 24) & 0xff000000) |
((val << 8) & 0x00ff0000) |
((val >> 8) & 0x0000ff00) |
((val >> 24) & 0x000000ff));
}
function bytesToFloat(bytes) {
va... | true |
bf47efc29982878d094fda5a853122be3635bb7c | JavaScript | ashokadhikari92/MWA_LABS | /lab4/exercise1/child.js | UTF-8 | 330 | 2.78125 | 3 | [] | no_license |
const fs = require('fs');
const path = require('path');
const loadFile = (filePath) =>{
fs.readFile(path.join(__dirname,filePath),'utf8',function(error,fileData){
process.send(fileData);
});
}
process.on("message", (filePath) => {
console.log("Filepath on chiild: "+filePath);
loadFile(fileP... | true |
a1f5189f55b55962bd9c639c9e759ac81d2e8176 | JavaScript | taddes/js-bootcamp | /functions/arguments.js | UTF-8 | 685 | 4.25 | 4 | [] | no_license | // Multiple Arguments
let add = function(a, b, c) {
return a + b + c
}
let result = add(5, 10, 15)
console.log(`Addition result: ${result}`)
// Default Arguments
let getScoreText = function(name ='Anonymous', score = 0) {
return 'Name: ' + name + ' Score: ' + score
}
let scoreText = getScoreText('Taddes', 77)
co... | true |
a2e2b2d7d338629efe9973be13cd54c6b5c89a8d | JavaScript | R3dH00d1988/cv | /cvedit.js | UTF-8 | 866 | 2.875 | 3 | [] | no_license | function documentEvent(e)
{
var ele = e.target;
var c = ele.getAttribute("class");
if (c === null)
return true;
if (['qualtype', 'qualcontent', 'qualestablishment', 'jobtitle', 'jobdescription', 'jobachievementlist', 'jobachievementitem'].indexOf(c) >= 0)
{
while (ele.hasChildNodes())
{
ele.removeCh... | true |
996167148d7f79352316f413c9dfb2a1c6446f28 | JavaScript | mjimeg85/questionados | /src/main/resources/static/js/app.js | UTF-8 | 3,894 | 2.640625 | 3 | [] | no_license | function getNewGameData() {
return JSON.parse(JSON.stringify(juegoDefaultData));;
}
$(document).ready(function () {
$('#siguientePregunta').click(function () {
cargarProximaPregunta();
});
$('#volverAJugar').click(function () {
juegoData = getNewGameData();
});
$('#comenzar')... | true |
5c8e4385cbe732dfa76893a7b0e13fa2fa48bb00 | JavaScript | zmart202/currencyConverter | /async.js | UTF-8 | 74 | 2.765625 | 3 | [] | no_license | const cool = async () => {
return await "Man";
};
console.log(cool());
| true |
76c179c83ba50d92c8beac978673b0221512e223 | JavaScript | vukiman1/Javascript-Home-Work-lean-from-CoderX | /bai 30/bai1.js | UTF-8 | 418 | 3.03125 | 3 | [] | no_license | /**
* 1. Require module `path` (built-in sẵn trong node)
* 2. Sử dụng method extname để tìm extension (đuôi) của một đường dẫn (path) tới file nào đó.
* Tra cứu: https://nodejs.org/dist/latest-v8.x/docs/api/path.html#path_path_extname_path
*/
// require module here!
let path = require('path');
function getExtensio... | true |
c10b397c0d16b3f6c2c74910306b879d42c84a77 | JavaScript | wizzardo/example-websocket-downloader | /src/main/resources/public/js/app.js | UTF-8 | 2,282 | 2.84375 | 3 | [] | no_license | var handlers = {}
handlers.updateProgress = function (data) {
if (data.progress < 100) {
lib.animate(lib('#job_' + data.id + ' .progress .value')[0], {width: data.progress + '%'}, 100);
} else {
lib('#job_' + data.id + ' .progress')[0].style.display = 'none';
lib('#job_' + data.id + ' .d... | true |
4dc5791c61c8dc98b84e7bf8e7c1a3a2e9e3f03b | JavaScript | mrgr4yhat/Vulnerable-Web-App | /Resources/script.js | UTF-8 | 1,590 | 3.296875 | 3 | [] | no_license | const columnCount = Math.floor(window.innerWidth / 30);
const rowCount = Math.floor(window.innerHeight / 30);
for(let i=0; i<columnCount; i++) {
const p = document.createElement('p');
setupColumn(p);
document.body.append(p);
}
function setupColumn(p) {
const delay = random(100, 300);
co... | true |
bfac0c12c0adc448247477606d248a9bceca649c | JavaScript | rpeys/patient-viz | /js/cluster.js | UTF-8 | 3,336 | 2.671875 | 3 | [
"MIT"
] | permissive | /**
* Created by krause on 2014-03-05.
*/
function EventClusterer() {
var that = this;
var distance = function(vecA, vecB) {
return jkjs.stat.edit_distances.hamming(vecA, vecB);
};
var threshold = 5;
var minCluster = 3;
var clusterTypes = [];
this.distance = function(_) {
if(!arguments.length)... | true |
e21d92b3e7ee00c8aec8be68e8b64621be013073 | JavaScript | timschmidtdev/understand-nodejs | /lecture_47/app.js | UTF-8 | 252 | 3.609375 | 4 | [] | no_license | // buffers - it's unusual that you would interact directly with the buffer
const buf = new Buffer('Hello', 'utf8')
console.log(buf)
console.log(buf.toString())
console.log(buf.toJSON())
console.log(buf[2])
buf.write('wo')
console.log(buf.toString())
| true |
25511710447db0e11ec85ca66c753ce9189c8221 | JavaScript | alexandresaiz/serverless | /lib/ServerlessFunction.js | UTF-8 | 9,965 | 2.53125 | 3 | [
"MIT"
] | permissive | 'use strict';
/**
* Serverless Function Class
* - options.path format is: "moduleFolder/functionFolder#functionName"
*/
const SError = require('./ServerlessError'),
SUtils = require('./utils/index'),
BbPromise = require('bluebird'),
async = require('async'),
path = require('path')... | true |
fd078e5dc92a5de3a80a42fbb43b05a7fb0e53c9 | JavaScript | terrasa/Bowling-Game-Score | /bowlingScorePOO.js | UTF-8 | 3,478 | 3.828125 | 4 | [] | no_license | // If all pins (10) drop in the first roll = strike, 10 points + the next 2 rolls score
// If all pins drop in the second roll = spare, 10 points + the next roll score
// if no 10 pins drop, frist roll + second roll
const allFrames = [
[1,2],
[10,false],
[5,4],
[7,3],
[10,false],
[10,false],
... | true |
bca9dddb852b168220142dd506f5147b46ddba60 | JavaScript | gabrielsilva71/javascript-basic | /script.js | UTF-8 | 1,302 | 4.59375 | 5 | [] | no_license | /*
---- exercici 1:
console.log("Hola Mundo");
---- exercici 2:
alert("¡Me llamo Gabriel!");
---- exercici 3:
var a = "Gabriel";
var b = "Silva";
console.log(a + " " + b);
---- exercici 4:
var a = 22;
var b = 15;
var c = a + b;
console.log("La suma entre " + a + " i " + b + " es " + c);
---- exercici 5:
... | true |
629c2a028bc404c952b3886682b251c3f118dee5 | JavaScript | dani0678/TrackingSystem-1 | /webapp/src/Whereabouts/CompareSchedule/CompareSchedule.js | UTF-8 | 1,079 | 2.53125 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import List from './List/List';
export default function CompareSchedule() {
const [roomList, setRoomList] = useState([]);
const [trackerList, setTrackerList] = useState([]);
const [scheduleList, setScheduleList] = useState([]);
const scheduleURL = new URL(`$... | true |
435fecce3bc18f88e0f1990c9dc6f9a8b71b3b7e | JavaScript | Akshit-Accolite/AUSpring19 | /JS/Akshit_Arora.js | UTF-8 | 1,672 | 3.21875 | 3 | [] | no_license |
function employee(name,id){
this.name=name;
this.id=id;
this.idFun=function(){
console.log("Ths id is "+this.id);
}
}
//using prototype
employee.prototype.hometown;
function printNameId(){
console.log(this.x+";"+this.y)
}
//using call
function hr(ename,id) {
employee.call(this,ename,id);
this.lastName =... | true |
65aae64a2fab09da0459f053c1b5fe700d63bd84 | JavaScript | ljxlijiaxin/myDemo | /蓝莓派demo/蓝莓派PC端demo/js/login.js | UTF-8 | 4,717 | 2.5625 | 3 | [] | no_license | /* 判断之前是否登陆过 */
if (localStorage.getItem("username")) {
$(".right .login").addClass("hidden");
$("#username").text(localStorage.getItem("username"));
$(".right .user").removeClass("hidden");
}
/* 切换tap */
function changeTap(onTap,offTap) {
$("#login input").val("");
$(`.${onTap}-tap`).addClass("sel... | true |
daba8477b151ac8083bb0307533df64052e2e2da | JavaScript | beatriztc56/Control-Javascript-y-DOM | /2.ejercicio-js/ejercicio 2.js | UTF-8 | 678 | 4.1875 | 4 | [] | no_license | //Crea un programa que imprima cada 5 segundos el tiempo desde la ejecución del mismo.
//Formatea el tiempo para que se muestren los segundos, los minutos, las horas y los días desde la ejecución.
'use strict';
let time = new Date(2021, 3, 25, 16, 14, 20);
let hours= time.getHours();
let minutes = time.getMinutes()... | true |
91e1b0188e6045693c94ac0985c5a1ef47454331 | JavaScript | judychern/Breakout | /box.js | UTF-8 | 504 | 2.71875 | 3 | [] | no_license | var boundingBox = function(x,y,width,height,disappears){
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.planeLeft = new Vector(0, canvas_height*-1);
this.planeRight = new Vector(0, canvas_height);
this.planeTop = new Vector(canvas_width*-1,0);
this.planeBottom = new Vector(canvas_width, ... | true |
313fb7ece69952cc08f5ef7240eeafd8d1a4b028 | JavaScript | Justintcollins/FlooringCalculator | /view/frontend/web/js/calc-math.js | UTF-8 | 5,069 | 3.15625 | 3 | [
"MIT"
] | permissive | /*
,-.-. | |
| | |,---.|--- |---.
| | |,---|| | |
| ' '`---^`---'` |
*/
function casesCover()
{
var covers = getCasesNeeded() * preData.sqftInBox;
return covers;
}
function casesCover10Percent()
{
var covers = getCasesNeeded10Percent() * preData.sqftInBox;
return covers;
... | true |
94bb43518ae6029115ae644f86ab37cf3303edf9 | JavaScript | vinegreet/react-redux-graph | /src/helpers/calculateWalls.js | UTF-8 | 963 | 2.96875 | 3 | [] | no_license | const calculateWalls = (barsArray) => {
const result = barsArray.reduce((biggestA, numberA, idxA) => {
const output = barsArray.reduce((biggestB, numberB, idxB) => {
if (idxB < idxA) return biggestB;
const area = (idxB - idxA) * (numberA > numberB ? numberB : numberA);
return area > (biggestB.a... | true |
f4723bd4b2e095c55ef9fdd5814c5cc1cb3ffbc6 | JavaScript | Wayne-Bai/AST-normalize | /data/mcarella/wormhole/app/templates/__example/js/plugins/jquery.airport.js | UTF-8 | 4,483 | 3.078125 | 3 | [] | no_license | /*global jQuery */
/*!
* @author Sean Coker <sean@seancoker.com>
* @author Jan Järfalk <jan.jarfalk@unwrongest.com>
* @Version 1.0.2
* @url http://sean.is/building/jquery-airport
* @description Airport is a rather simple text effect plugin for Jquery. It emulates the style of those flickering information boards y... | true |
3852cd1892597553ebd43b4f691008af534d8931 | JavaScript | thomasgwatson/es6_prac | /promisesBlueBird.js | UTF-8 | 640 | 2.8125 | 3 | [] | no_license | import Promise from 'bluebird'
global.Promise = Promise
import fs from 'fs'
Promise.promisifyAll(fs)
// const readFileAsync = Promise.promisify(fs.readFile)
const getContentsThru = (fileName) =>
fs.readFileAsync(fileName, 'utf8')
.then((fileNameContents) =>
fs.readFileAsync(fileNameContents.trim(), 'utf8'))
/... | true |
9d55d02bbd938ce71c7471cb41f40568a22c5309 | JavaScript | brandon123774/burger | /public/assets/js/script.js | UTF-8 | 787 | 2.71875 | 3 | [] | no_license | $(function () {
//devour function
$(".devour").on("click", function(event){
event.preventDefault();
var id = $(this).data("id");
var newDevoured = {
devoured: 1
}
// burgers
$.ajax("/api/burgers/" + id, {
type: "PUT",
data: newDevoured
}).then(
... | true |
258681e6fa3525c5edb38ea29d606531031a7650 | JavaScript | Harin23/resume | /resumej.js | UTF-8 | 684 | 3.03125 | 3 | [] | no_license |
function search_skill(){
var user_i, user_if, l, table, tr, td, i, j, total_col, skill;
user_i = document.getElementById("skillInput").value;
l=user_i.length;
table = document.getElementById("skills-table");
tr = table.getElementsByTagName("tr");
total_col = document.getElementById("skills-table").ro... | true |
70a8c1ad47dad90206240bb7b727a3dbf27a32b2 | JavaScript | haytherecharlie/js-masterclass | /questions/uber/maps.js | UTF-8 | 131 | 2.796875 | 3 | [] | no_license | let map = new Map()
map.set('j', 2)
map.set('x', 9)
const x = [...map.entries()].sort(([, av], [, bv]) => av - bv)
console.log(x)
| true |
e0685c5137781ea7e87c87d4189cd64c3332dba2 | JavaScript | lintuming/leetcode | /solutions/215.数组中的第k个最大元素.js | UTF-8 | 1,040 | 3.65625 | 4 | [] | no_license | /*
* @lc app=leetcode.cn id=215 lang=javascript
*
* [215] 数组中的第K个最大元素
*/
// @lc code=start
/**
* @param {number[]} nums
* @param {number} k
* @return {number}
*/
var findKthLargest = function (nums, k) {
function quickSort(nums, left, right, nthIdx) {
const p = pivot(nums, left, right);
if (nthIdx =... | true |
1955a7bfd351a530408f0750966dd700122b22a7 | JavaScript | Bharanij27/Advnace-Todo-List | /src/index.js | UTF-8 | 1,791 | 2.8125 | 3 | [] | no_license | import React, { Fragment, useState } from 'react';
import ReactDom from 'react-dom';
import './styles.css'
import Title from './Components/Title';
import TaskLists from './Components/TaskLists';
import InputField from './Components/InputField';
import Status from './Components/Status'
const App = ()=> {
const [ta... | true |
e6e65d7d9558e478a7e47f139fc6d0cd9662131b | JavaScript | whaonub/hack | /weatherForecast/weather.js | UTF-8 | 3,256 | 2.96875 | 3 | [] | no_license | //用百度地图API获得当前所在城市
var map = new BMap.Map('map');
var myCity = new BMap.LocalCity();
var cityName;
myCity.get(myFun); //异步获得当前城市
function myFun(result){
cityName = result.name.replace('市', '');
}
//动态创建script标签
function jsonp(url){
var script = document.createElement('script');
script.src = url;
... | true |
3748edc7470edf9f001c24a052a4304e041dfada | JavaScript | leafoflegend/1805-BCP | /8/index.js | UTF-8 | 3,260 | 4.34375 | 4 | [] | no_license | const chalk = require('chalk');
const returnRandomColor = () => {
const colors = ['red', 'cyan', 'magenta', 'green', 'yellow'];
const randomIndex = Math.floor(Math.random() * colors.length);
return colors[randomIndex];
};
console.log(chalk[returnRandomColor()]('------------------------------'));
const c = (.... | true |
dabe3ca990dbc9a91a36ee54bab3be0fbf0373b2 | JavaScript | JortVincenti/JortVincenti | /OneDrive/Bureau/TuDelft/2 Quartal/Web and Database Technology/Web/My Game/reversi/app.js | UTF-8 | 7,633 | 2.671875 | 3 | [] | no_license | var gameboard = new Array(8);
for (var i = 0; i < gameboard.length; i++) {
gameboard[i] = new Array(8);
}
for(var i = 0; i < gameboard.length; i++){
for(var j = 0; j < 8; j++){
gameboard[i][j] = 0;
}
}
var turn = 0;
var finished = false;
var winner;
const express = require('express')
const websoc... | true |
6fdf1043d6115f471287d912af19fb6a2f8254c3 | JavaScript | wzcwmc/cloud_note | /WebRoot/scripts/login.js | UTF-8 | 1,294 | 2.6875 | 3 | [] | no_license |
$(function(){
$("#login").click(function(){
//获取请求提交的数据
var ok=true;
var name=$("#count").val().trim();
var password=$("#password").val().trim();
//检测一下数据格式
//清空文本框后的span内容
$("#count_span").html("");
$("#password_span").html();
if(name==""){
ok=false;
$("#count_span"... | true |
3abcc5f8400f5e5ab83c38ce9f847beae346bd31 | JavaScript | eleanablandin/Random-Card-Generator | /src/app.js | UTF-8 | 830 | 3.28125 | 3 | [
"MIT"
] | permissive | /* eslint-disable */
import "bootstrap";
import "./style.css";
import "./assets/img/rigo-baby.jpg";
import "./assets/img/4geeks.ico";
let randomSymbol = () => {
let symbol = ["♦", "♥", "♠", "♣"];
let azarSymbol = symbol[Math.round(Math.random() * (symbol.length - 1))];
return azarSymbol;
};
let randomNumber = ... | true |
a9d0d1adba5b371d386e4d1412c6a4c6c1d3fe27 | JavaScript | PedroMarianoAlmeida/calendar-challenge | /components/NewEventForm/NewEventFormSubmitButton.js | UTF-8 | 3,209 | 2.921875 | 3 | [] | no_license | //React and Next components and Functions
import { useContext, useState, useEffect } from 'react';
//Third part components
import { Button } from 'reactstrap';
import { v4 } from 'uuid';
//My components
import { EventContext } from './../../contexts/EventContext';
import convertHourToDecimal from '../../functions/con... | true |
00718734428923578aedf3dff1ec96c5572f38fa | JavaScript | Darn0/Immersive-Web-VR-AR | /src/scripts/scenes/planets/ui.js | UTF-8 | 551 | 2.9375 | 3 | [
"Apache-2.0"
] | permissive | import { createTextPlane } from './text';
export function createPlanetText(info) {
const earthGravities = Number(info.gravity / 9.8).toPrecision(2)
const text = `
---${info.name}---
Radius: ${Number(info.realRadius).toString()} km
Mass: ${Number(info.mass).toPrecision(4)} kg
Distance from sun: ${Number(info.orbit... | true |
c4ad3eeb45dc1144f89bcebc2b35c3e062e1d38c | JavaScript | issyrivas17/React0_experto | /02-intro-javascript/src/Bases/01-const_let.js | UTF-8 | 209 | 3.78125 | 4 | [] | no_license | // VARIABLES Y CONSTANTES
const nombre = 'Ismenia';
const apellido= 'Rivas';
let valorDado = 5;
console.log(nombre,apellido,valorDado)
if (true){
let valorDado= 12;
console.log(valorDado)
}
| true |