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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
9ecb903e64f949915420d0eafd638d41cf129e74 | JavaScript | maciejbik/Frontendowe-wino | /hamburger.js | UTF-8 | 211 | 2.703125 | 3 | [] | no_license | var button = document.querySelector(".web-header__image--js")
button.addEventListener('click',()=>
{
var link = document.querySelector(".web-navigation");
link.classList.toggle('web-navigation--js')
}) | true |
9230384a1691b88f07c5df77897fa7481c13554c | JavaScript | IanMWinter/DOEGame | /Assets/Scripts/Camera Scripts/CameraControl.js | UTF-8 | 12,018 | 3.03125 | 3 | [] | no_license | /*
CameraControl.js
By Katharine Uvick
This script allows for panning the camera via click and drag, zooming in
with the mouse wheel (will be changed for mobile version), and double-
clicking to center the mouse on that location (a feature not in the
design document, but mentioned during the programming ... | true |
94b4912827efb66f9063b46f517130deb8c48b92 | JavaScript | pgm-jandeschacht/Webshop | /server/static/js/index.js | UTF-8 | 6,313 | 2.546875 | 3 | [] | no_license | (() => {
const app = {
initialize() {
this.cacheElement();
this.icons();
this.registerListeners();
this.setActiveNavigationHeader();
this.setActiveNavigationFooter();
this.setActiveNavigationMobile();
this.scrollToTop();
this.openingsHours();
},
cacheEleme... | true |
b65cd1fb1c3ef466a950f9af6ea63fcbf3fab0e2 | JavaScript | ksullivan-dev/ksullivan-dev.github.io | /js/addNode.js | UTF-8 | 450 | 2.859375 | 3 | [] | no_license | async function addNode(name) {
const converter = new showdown.Converter();
let resp;
let useMarkdown = false;
resp = await fetch(`./partials/${name}.md`);
if (resp.ok) {
useMarkdown = true;
} else {
resp = await fetch(`./partials/${name}.html`);
}
const text = await resp.text();
const html = ... | true |
39b87479b22d2aba74f66fb7cf4f75c9b2804b4a | JavaScript | ZackDavis97/ZDTeamProfileGenerator | /_tests_/manager.test.js | UTF-8 | 512 | 3.109375 | 3 | [
"MIT"
] | permissive | const Manager = require('../lib/Manager.js');
test('create manager object', () => {
const manager = new Manager('Ashley Busnuk', '021', 'ashley@email.com', 'Z6');
expect(manager.name).toBe('Ashley Busnuk');
expect(manager.id).toBe('021');
expect(manager.email).toBe('ashley@email.com');
expect(... | true |
7b6369475d69195ce10476976ee83fd089ebe618 | JavaScript | medfiras/checkbox-on-off | /js/main.js | UTF-8 | 1,717 | 3.15625 | 3 | [] | no_license | (function() {
var $$ = function(selector) {
return Array.prototype.slice.call(document.querySelectorAll(selector));
}
document.addEventListener("DOMContentLoaded", function() {
var checkbox;
var result = document.querySelector("#result");... | true |
af9b06eea2b77ac53fe3f210b436f61eebb1ba84 | JavaScript | Ryan104/vue-d3 | /simple-bar/app.js | UTF-8 | 982 | 3.125 | 3 | [
"MIT"
] | permissive | const chartHeight = 400;
const chartWidth = 600;
const axisSpace = 30;
const chartData = [10, 4, 15, 22];
/* SVG chart area */
const chart1 = d3.select('.bar-1')
.attr('height', chartHeight)
.attr('width', chartWidth);
/** Add a group for each data point */
const groups = chart1.selectAll('g')
.data(chartData)... | true |
e052d3521508b6d523ee275cff9fdf4b592cc0fe | JavaScript | adiati98/practical-javascript | /05 - Loops of Logic/todos-loops-steps.js | UTF-8 | 2,720 | 4.15625 | 4 | [] | no_license | // NOTE
// .displayTodos should show .todoText (property)
// for (var i = 0; i < this.todos.length; i++) {
// console.log(this.todos[i].todoText);
// }
// -------------------------------------------------------------------------------------------------------------- //
// .displayTodos should tell you if .todos is ... | true |
bfd985ef3ac62ef83ebf7f4cb19ef0f11101a7c3 | JavaScript | hammad2506/fancy-cars | /src/actions/cars.js | UTF-8 | 566 | 2.5625 | 3 | [] | no_license | const handleCarAdd = ({id, image, make, model, year, availability} = {}) => (
{
type: 'ADD_CAR',
car: {
id, image, make, model, year, availability
}
}
);
const getCarsActionGenerator = () => {
return (dispatch) => {
return fetch('http://localhost:3000/cars')
... | true |
b93d448251fcfb3dcafa062f891d0740fb08da24 | JavaScript | ohmiler/react-coding-interview | /src/App.js | UTF-8 | 1,712 | 2.921875 | 3 | [] | no_license | import React, { useState, useEffect } from 'react'
import axios from 'axios'
function fetchData() {
return axios.get('https://randomuser.me/api')
.then(({data}) => {
// handle success
console.log(data);
return data;
})
.catch((error) => {
// handle error
console.log(error);
})
}
const ge... | true |
21528909d93a932648d529f490ed0cad0d673311 | JavaScript | ErnestoCaceresA/CURSO_REACT__05-hook-app | /src/components/02-useEffect/SimpleForm.js | UTF-8 | 3,350 | 3.4375 | 3 | [] | no_license | import React, { useEffect, useState } from 'react';
import "./effects.css"
import Message from './Message';
const SimpleForm = () => {
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
... | true |
5880799a39c7b2a8c1ce9fc63acf5f493cb21446 | JavaScript | luandph/color-picker | /src/color-picker/temperature-brightness-picker.js | UTF-8 | 2,867 | 2.53125 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
import './color-picker.scss';
import {applyColor, applyBrightness, applyTemperature, toHex, applyColorModel} from "../common/color";
import {observeMouseDrag} from "../common/observeMouseDrag";
class TemperatureBrightnessPicker extends React.Component {
... | true |
f8a7f0e5d0b497bebd3f947153ca1593b9032b23 | JavaScript | cintiamh/Reversi | /test/Board.spec.js | UTF-8 | 1,463 | 2.828125 | 3 | [] | no_license | var Board = require('../src/js/Board');
var expect = chai.expect;
describe('Board', function() {
describe('constructor', function() {
it ('should have access to a Board', function() {
expect(Board).to.exist;
});
it ('should be able to instantiate a new Board', function() {
... | true |
f12db3a94d17a6c56b39737a36cef2b3f748ae12 | JavaScript | tinganho/CSS-Selector-Specificity | /src/cssSpecificity.js | UTF-8 | 2,011 | 3.046875 | 3 | [] | no_license | var Specificity = (function() {
var C = {};
function numMatches(selector, regex) {
return (selector.match(regex) || []).length;
}
function is(selector, element) {
var div = document.createElement("div"),
matchesSelector = div.webkitMatchesSelector;
return typeof se... | true |
2464fe18f814e8f83643e64c3b87d3d198c27846 | JavaScript | filipesilva/playlist-matcher | /playlist-matcher.js | UTF-8 | 2,756 | 2.609375 | 3 | [
"MIT"
] | permissive | var fs = require('fs');
var makeObj = function(array) {
var hash = {};
for (var i = array.length - 1; i >= 0; i--) {
hash[array[i]] = true;
}
return hash;
};
var objDiff = function(obj1, obj2) {
var diff = {};
for (var prop in obj1) {
if (!obj2.hasOwnProperty(prop)) {
diff[prop] = true;
... | true |
b7bf54d06709b0c7a166f9dd6422f2f4a1cc3903 | JavaScript | Simkhotech/react-chat | /src/components/AppAvatar.js | UTF-8 | 478 | 2.578125 | 3 | [] | no_license | import React from "react";
import Avatar from "material-ui/Avatar";
export default class AppAvatar extends React.Component {
getInitials(text, count) {
const words = text.split(/[\s.,;\-_]/);
const ret =
words.reduce((initials, word) => {
return initials + word.charAt(0);
}, "") || "😎";
... | true |
c8c62c2d78d91de8c243de26f539eaa13a2243c8 | JavaScript | nilproject/NiL.JS | /TestSets/tests/sputnik/ch15/15.2/15.2.3/15.2.3.5/15.2.3.5-3-1.js | UTF-8 | 573 | 3.53125 | 4 | [
"BSD-3-Clause"
] | permissive | /// Copyright (c) 2012 Ecma International. All rights reserved.
/**
* create sets the [[Prototype]] of the created object to first parameter.
* This can be checked using isPrototypeOf, or getPrototypeOf.
*
* @path ch15/15.2/15.2.3/15.2.3.5/15.2.3.5-3-1.js
* @description Object.create sets the prototype of the pa... | true |
20b66449418754d7629ea0ac6cad8d7893da41e3 | JavaScript | te68/react-pokemon-searcher-nyc-web-060319 | /src/components/PokemonCollection.js | UTF-8 | 792 | 2.640625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | import React from 'react'
import PokemonCard from './PokemonCard'
import { Card } from 'semantic-ui-react'
class PokemonCollection extends React.Component {
state = {
pokemon: []
}
componentDidMount() {
fetch('http://localhost:3000/pokemon')
.then(res => res.json())
.then(pokemon => {
thi... | true |
727b4064787c315c27fa5152f05293f8d2f26c14 | JavaScript | up730418/AIBot | /index.js | UTF-8 | 2,028 | 2.53125 | 3 | [] | no_license | const express = require('express')
const app = express()
const port = 8080
const path = require('path')
const MongoClient = require('mongodb').MongoClient
const botServices = require('./services')
// Connection url
const url = 'mongodb://bot-database:27017'
// Database Name
const dbName = 'Bot'
// create Client
const ... | true |
620baa6b8c5f84dcfb9445366cf0c7c3a24ac34d | JavaScript | fosterv2/react-async-fetch-lab-seattle-web-030920 | /src/App.js | UTF-8 | 627 | 3.03125 | 3 | [] | no_license | // create your App component here
import React, { Component } from "react";
class App extends Component {
state = {
people: []
}
componentDidMount() {
fetch("http://api.open-notify.org/astros.json")
.then(resp => resp.json())
.then(people => this.setState({people: people}))... | true |
1c83bc2ab5adaf2ee68b11ac1c685b5e64ee71c1 | JavaScript | DionMS8/Weather-Application | /Weather/script.js | UTF-8 | 2,316 | 3.53125 | 4 | [] | no_license |
const container = document.getElementById("container");
window.onload = function () {
document.querySelector('.input-search').value = '';
}
// API
const api_details = {
url: "http://api.openweathermap.org/data/2.5/",
api_key: "60bbd59ec7556e88c0f6b5a2080aebaa"
}
// search city on keypress
const input = document... | true |
4686d3318029d244dbada4da0b54bebbcd6c1633 | JavaScript | Baotluong/playground | /algoSnippets/quickSort copy.js | UTF-8 | 1,596 | 4.09375 | 4 | [] | no_license |
function pivot1(arr, start = 0, end = arr.length - 1) {
const swap = (arr, idx1, idx2) => {
[arr[idx1], arr[idx2]] = [arr[idx2], arr[idx1]];
};
// We are assuming the pivot is always the first element
let pivot = arr[start];
let swapIdx = start;
for (let i = start + 1; i <= end; i++) {
if (pivot ... | true |
060b95bf6d0a50180b0bbf7a73cfa656bdc038fb | JavaScript | beatrizpenalva/burgerlicious-api | /server/controller/UserController.js | UTF-8 | 2,766 | 2.59375 | 3 | [] | no_license | const database = require("../db/models");
class UserController {
static userExist(id) {
const searchById = database.Users.findByPk(id);
return searchById;
}
static getAllUsers(req, res, next) {
const users = database.Users.findAll({
order: [["id", "ASC"]],
attributes: { exclude: ["passwo... | true |
8eafc381f4edcadc8affd4bf912bd98753f4e7ea | JavaScript | Submitty/Submitty | /site/public/js/email-status.js | UTF-8 | 1,882 | 2.609375 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | /* exported loadPage */
const page_window = 5;
function loadPage(page, load_page_url) {
$(`#${page}`).addClass('selected');
$(`#${page}`).attr('disabled', 'disabled');
$('.page-btn').each(function() {
const id = parseInt($(this).attr('id'));
// To avoid race condition of what gets displayed ... | true |
def6762386faf1829be6602b887b7092ae85168a | JavaScript | shiowwj/tictactoe | /script.js | UTF-8 | 5,361 | 3.640625 | 4 | [] | no_license | var playerOne = "X"; //set string for playerOne
var playerTwo = "O"; //set string for playerTwo
var counterTurn = 0; //counter to determine whose turn it is
var playerOneScore = 0;
var playerTwoScore = 0;
var restart = document.getElementsByClassName("restart-board")[0];
var stopcheck = document.getElementsByClassName... | true |
14a58757fa1e54465a6bce1c2795fc6b49a6aff8 | JavaScript | unow30/algorism | /2104/2021 Dev_Matching_back_q1.js | UTF-8 | 3,164 | 4.46875 | 4 | [] | no_license | /*
어려운 문제는 아니였으나 경우의 수를 고려하다가 시간을 많이 허비했다.
- 당첨번호 개수에 따라 1등부터 6등까지를 표시하는 객체를 만들어 당첨 숫자에 따른 최대, 최저 등수를 배열로 리턴했다.
- 0을 제외한 당첨번호를 배열로 담고, 0의 개수를 변수에 담았다.
- 당첨번호 개수 + 0의 개수가 가장 높은 등수를 나타내고, 당첨번호 개수만으로 가장 낮은 등수를 나타낸다.
*/
function solution(lottos, win_nums) {
var answer = [];
//최고순위와 최저 순위를 배열로 나타내야 한다.
//0은 ... | true |
ec51d5679cef1707bc05a421eab8faba42d5920c | JavaScript | IshitaD/ModBot | /commands/Random Image/bird.js | UTF-8 | 654 | 2.765625 | 3 | [
"MIT"
] | permissive | const Command = require("../../base/Command.js");
const request = require('node-superfetch');
class Bird extends Command {
constructor(client) {
super(client, {
name: "bird",
description: "Sends a random image of a bird.",
category: "Random Image",
usage: "bird"
});
}
async run(message) {... | true |
2d9dfdd40757d83f3f6f23d9eda7a43fcb30f7ee | JavaScript | Armastus/JavaScriptAlgorithms | /PrimaryDiagonal/pirmaryDiagonal.js | UTF-8 | 653 | 3.3125 | 3 | [] | no_license | function primaryDiagonal(num, arrayMatrix) {
// var arrayMatrix = [
// [11, 2, 4],
// [4, 5, 6],
// [10, 8, -12]
// ];
var newArrA = [];
var newArrB = [];
var totalA = 0;
var totalB = 0;
var diff;
for(var ii = 0; ii < num; ii++){
newArrA.push(arrayMa... | true |
52b66c658b2979b078a551ae854628e9b094c426 | JavaScript | gabrielseco/potterapi | /routes/characters/renderForm.js | UTF-8 | 5,776 | 2.515625 | 3 | [
"MIT"
] | permissive | import React, { Component, PropTypes } from 'react';
import { Button, Form, FormGroup, Row } from '../../components/UI';
import { giveIDFromForm, toObject, getURL, extractDate, formatForGraphQL} from '../../functions';
import CharactersModel from '../../transport/index';
export default class RenderForm extends Compon... | true |
9666875934a2a21024bfc5e4b4de002516bb0162 | JavaScript | GrayBurford/6.4GitHubExercise | /app.js | UTF-8 | 460 | 2.90625 | 3 | [] | no_license | const child = document.getElementById('child');
const parent = document.getElementById('parent');
const grandparent = document.getElementById('grandparent');
const change = function changeBackground (e) {
console.log(e.srcElement.id)
}
child.addEventListener('click', change);
parent.addEventListener('click', cha... | true |
88352e2114b72e612cd7654b3313cf031941a839 | JavaScript | JLLQA/React | /src/Components/Disney/display/Grid.jsx | UTF-8 | 1,318 | 2.65625 | 3 | [] | no_license | import { useEffect, useState } from "react";
import TableRow from "./TableRow";
const Grid = ({ data }) => {
const [ready, setReady] = useState(false);
const [objArray, setObjArray] = useState([]);
useEffect(() => {
let array = [];
while (data.length) {
array.push(data.splice... | true |
36102f1908b3eaed57da15fe945000b4cc6ef632 | JavaScript | guscanales/CalculoCalificaciones | /www/js/services.js | UTF-8 | 3,271 | 2.5625 | 3 | [] | no_license | angular.module('starter.services', [])
.factory('oAuth',function($cordovaOauth)
{
return {
facebookAuth: function(){
$cordovaOauth.facebook("942918379127837", ["email"]).then(function(result)
{
// $state.go('asignaturas');
console.log("Response Object -> " + JSON.stringi... | true |
b842ee0bf8747ab27f39edf81b29f2c33599a083 | JavaScript | maiquochauabc/applab-hau.github.io | /js/default.js | UTF-8 | 5,776 | 2.53125 | 3 | [] | no_license | function toggleState(item) {
// alert(item.checked)
if (item.checked === true) {
document.getElementById("annually").classList.toggle("checked");
document.getElementById("monthly").classList.toggle("checked");
//document.getElementById("monthly").classList.remove("checked");
} else {
document.get... | true |
e507b4ed10cf407136805a0ffa3d01ef3942c4ff | JavaScript | NicoleRauch/BeyondCDCT | /sources/model/src/modelApp.js | UTF-8 | 2,592 | 2.8125 | 3 | [] | no_license | // This code is based on https://scotch.io/tutorials/build-a-restful-api-using-node-and-express-4
//
// modelApp.js
// BASE SETUP
// =============================================================================
// load the packages we need
const express = require('express');
const bodyParser = require('body-parser');... | true |
4734a7ae069397ddcd28cc92a9b1bd2d6123c242 | JavaScript | Boogydown/dilo | /public/javascripts/views/TimerView.js | UTF-8 | 1,624 | 3.03125 | 3 | [] | no_license | /**
* A View for controlling the timer
* constructor( options )
* options.el - div element containing tiner
* options.interval - ms between update
* start( time )
* start the timer for "time" ms; when done it dispatches a "complete" event
* stop ()
* stops timer and returns remaining time
* extend and... | true |
157f863afbc814d9a2dcaa4df2ad1f281409a0bb | JavaScript | huphupclub/FullStackOpen | /part2/phonebook/src/App.js | UTF-8 | 2,466 | 3.1875 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import axios from 'axios';
const Person = ({ person }) => {
return(
<p>{person.name} {person.number}</p>
)
}
const Filter = (props) => {
return(
<div>
<p>Search:</p>
<input
value={props.text}
onChange={props.handler}
/>... | true |
4a735be2d0fae2109c983a9f159c600fdba32d86 | JavaScript | yuyangzi/functionalProgramming | /test/currying.test.js | UTF-8 | 489 | 3.15625 | 3 | [
"MIT"
] | permissive | const currying = require('../src/currying');
testFn = function () {
let totalCost = 0;
return function () {
for (let i = 0; i < arguments.length; i++) {
totalCost += arguments[i]
}
console.log(`共消费:${totalCost}`);
return totalCost
}
}
test('计算3天的花费', () => {
... | true |
14dacb6182bed64fde12657b5588569bb2d4129b | JavaScript | lusifer2644A/Sorting-Visualizer | /src/Sorting Visualiser/Sorting-Algorithms/QuickSort.js | UTF-8 | 2,219 | 2.890625 | 3 | [] | no_license | import * as helpers from "./helpers";
const PRIMARY_COLOR = "#508991"; //steel green
const SECONDARY_COLOR = "#ffb703"; //yellow
const SWAP_COLOR = "#6A4C93"; //purple
const EQUALITY_COLOR = "rgb(138, 201, 38)"; //green
const UNEQUALITY_COLOR = "#ff595e"; // red
const PIVOT_COLOR = "#fff"; //white
let SPEED;
async f... | true |
f55cc57e5ce86bacd1c7c7bd55567e3dd7e1f095 | JavaScript | alanjeanpierre/UTSA-prereqs | /js/site.js | UTF-8 | 4,966 | 2.734375 | 3 | [
"MIT"
] | permissive | // Delay loading any function until the html dom has loaded. All functions are
// defined in this top level function to ensure private scope.
jQuery(document).ready(function () {
// Installs error handling.
jQuery.ajaxSetup({
error: function(resp, e) {
if (resp.status == 0){
alert('You are offline!!\n ... | true |
ab050f4054838690a7f5ece6bf33e883ad0cafe7 | JavaScript | yashh2110/react | /src/comp/todo.js | UTF-8 | 660 | 2.546875 | 3 | [] | no_license | import React,{useState} from 'react'
import Todocomp from './Todocomp'
function Todo() {
const [items,setItems]=useState([]);
const [text,setText]=useState("");
const clickHandler=(e)=>{
e.preventDefault();
const newitem={
text,
id:Date.now()
};
setIte... | true |
aea50a5586269aa7a2778f3591134958f0cd960c | JavaScript | ahmedbendebba1/Alphanumeric-Recognition-webapp | /app/static/index.js | UTF-8 | 3,438 | 2.953125 | 3 | [
"MIT"
] | permissive | let cvsIn = document.getElementById("inputimg");
let ctxIn = cvsIn.getContext('2d');
let divOut = document.getElementById("predictdigit");
let svgGraph = null;
let mouselbtn = false;
// initilize
window.onload = function(){
ctxIn.fillStyle = "white";
ctxIn.fillRect(0, 0, cvsIn.width, cvsIn.height);
ctxIn... | true |
d7261c313cd213dbe19b32c9e4369a7b266e6321 | JavaScript | sullenor/under-the-wave | /tests/t-script-evaluate-conditionals.test.js | UTF-8 | 2,366 | 2.515625 | 3 | [] | no_license | 'use strict'
const assert = require('uvu/assert')
const { test } = require('uvu')
const evaluateConditionalsScriptPlugin = require('../plugins/t-script-evaluate-conditionals')
const { createTestContext, transformScript } = require('./_utils')
test('evaluate unary and binary operators', async () => {
const code = `... | true |
d0f1687acead4814ca5d8e53fa659178a57acde2 | JavaScript | uo237133/PruebaReact | /src/App.js | UTF-8 | 1,772 | 2.53125 | 3 | [] | no_license | import React from "react";
import { BrowserRouter as Router, Route, Link } from "react-router-dom";
import "./App.css";
import archivoTareas from "./archivos/archivoTareas.json";
// Componentes
import Tasks from "./components/Tasks";
import TaskForm from "./components/TaskForm";
import Posts from "./components/Posts";... | true |
b344abc4b5662f116199e0c2fdeac6f91b0f1329 | JavaScript | aoxinxing/WishingWall | /WebContent/js/add.js | UTF-8 | 8,952 | 2.796875 | 3 | [] | no_license | //关闭贴字条窗口
function close_window(){
showCheckCodeClear()
initialization();
}
//打开贴字条窗口
function loadScripAdd_window(){
/**********显示其他内容不允许点击的图层(用于锁定许愿墙中的内容)*****************/
document.getElementById("notClickDiv").style.display = "block";
var w =document.body.clientWidth;
var h= document.body.clientHeight;
doc... | true |
c4801d133181e9f378d10aafa536efdee1ce8405 | JavaScript | KalmykovAnatoly/processing | /noise/noiseBall.js | UTF-8 | 459 | 3.234375 | 3 | [] | no_license | class noiseBall{
constructor() {
this.x = width / 2;
this.y = height / 2;
this.x=0;
this.tX=0;
this.tY=10000;
}
display() {
stroke(0);
// point(this.x, this.y)
ellipse(this.x, this.y, 16, 16)
}
step() {
let step = noise(this.... | true |
92f2e7b78290a94c13041f47c67ec586e3e80baf | JavaScript | JasonYan2015/leetcode | /38. Count and Say.js | UTF-8 | 1,096 | 4.5 | 4 | [] | no_license | /**
* The count-and-say sequence is the sequence of integers with the first five terms as following:
*
* 1. 1
* 2. 11
* 3. 21
* 4. 1211
* 5. 111221
*
* 1 is read off as "one 1" or 11.
* 11 is read off as "two 1s" or 21.
* 21 is read off as "one 2, then one 1" or 1211.
* Given an intege... | true |
7314b3fa581bee83c23b7808c62bf5d76ebcfdcd | JavaScript | vapaee/jwebkit | /www/js/test-observable.js | UTF-8 | 7,730 | 3.15625 | 3 | [] | no_license | QUnit.test("observable basics", function( assert ) {
var obs = new jwk.Observable();
var myContext = "a";
var callbacks = [];
var args = [];
function onChangeCoso() {
callbacks.push(onChangeCoso);
args.push(arguments);
}
obs.on ("change", function () { callb... | true |
0cc559610edf181a6c95f789aedc541be3d2e0eb | JavaScript | jrtapsell/personal | /src/js/service_worker.js | UTF-8 | 1,057 | 2.578125 | 3 | [] | no_license | function stateChange(newState) {
switch (newState) {
case "installed":
if (navigator.serviceWorker.controller) {
// console.log("New or updated content is available.");
} else {
// console.log("Content is now available offline!");
}
break;
case "redundant":
// co... | true |
a9de09aac0224ddab5df39c6082783fce03ba43f | JavaScript | DanHefrman/test | /Resource-Hub-Mark_II/_Stable/Overflow/TOOLS/js/join-lines1d9a.js | UTF-8 | 423 | 2.6875 | 3 | [
"MIT"
] | permissive | $(function () {
mkTool('join-lines', function (text) {
text = text.replace(/\r\n/g, '\n');
var lines = text.split('\n');
var retLines = [];
var symbol = $('#join-lines-symbol').val();
for (var i = 0; i < lines.length; i++) {
if (/\w/.test(lines[i])) {
... | true |
fec349d9a5bc32ba89b97730167d7ed714ca8a43 | JavaScript | green-fox-academy/MichaelCTH | /week-05/day-03/my-chat-client/src/redux/reducer.jsx | UTF-8 | 1,154 | 2.578125 | 3 | [] | no_license | import {
HIS_CHAT_MESSAGE_LOAD_STARTED,
HIS_CHAT_MESSAGE_LOAD_SUCCESS,
HIS_CHAT_MESSAGE_LOAD_FAILED,
UPDATE_INPUT_MESSAGE,
INPUT_MESSAGE_UPLOAD_STARTED,
INPUT_MESSAGE_UPLOAD_SUCCESS,
INPUT_MESSAGE_UPLOAD_FAILED,
} from './actionCreater';
const initial = {
user: 'Michael',
message: [],
inputMessage:... | true |
3b5c6fd88a7f52eaebde5532bc72a52b63e87f0f | JavaScript | ViniciusLimaDeOliveira/WEB_2020_1 | /atividade_8/services/DisciplinaService.js | UTF-8 | 1,676 | 2.515625 | 3 | [] | no_license | const DisciplinaModel = require('../models/DisciplinaModel')
class DisciplinaService{
static register (req,res){
DisciplinaModel.create(req.body).then(
(disiciplina)=>{
res.status(201).json(disiciplina)
}
)
.catch(
(error)=>{
... | true |
6f562c27877fdf8cc4a8a34f4c5e9be3cc5887b9 | JavaScript | Inchill/codelab | /bs-demo/src/utils/dom.js | UTF-8 | 783 | 2.765625 | 3 | [] | no_license | export function addEvent(el, type, fn, capture) {
el.addEventListener(type, fn, {passive: false, capture: !!capture})
}
const TOUCH_EVENT = 1,
MOUSE_EVENT = 2;
export const eventType = {
touchstart: TOUCH_EVENT,
touchmove: TOUCH_EVENT,
touchend: TOUCH_EVENT,
touchcancel: TOUCH_EVENT,
mousedown: MOU... | true |
81c86840492b080d39246758894972081ce13146 | JavaScript | Sod-Sherman/wapProject | /src/main/webapp/weather/script.js | UTF-8 | 4,019 | 3.09375 | 3 | [
"MIT"
] | permissive | let appId = 'd0752d62343d10e5a5feb80ddc04f18c';
let units = 'imperial';
let searchMethod;
function getSearchMethod(searchTerm) {
if (searchTerm.length === 5 && Number.parseInt(searchTerm) + '' === searchTerm)
searchMethod = 'zip';
else
searchMethod = 'q';
}
function searchWeather(searchTerm) {... | true |
3e96c7912cb488d051009fbcf8caebbb203f7b57 | JavaScript | tishan89/siddhi-lb | /cep/org.wso2.carbon.cep.ui/4.0.2/src/main/resources/web/CEP/js/cep_buckets.js | UTF-8 | 40,707 | 2.65625 | 3 | [] | no_license | /**
* Input name space
*/
function addNSPrefix() {
var propName = document.getElementById("NSPrefix");
var propValue = document.getElementById("NSValue");
var propertyTable = document.getElementById("xpathNamespacesTable");
var noXpathDiv = document.getElementById("noXpathDiv");
var erro... | true |
8df075a6afbd934ab1de63580f175993e4c43d6c | JavaScript | Kenzie-Academy-Brasil-Developers/entrega-new-oregon-trail-heranca-sprint-6-aldenivan | /features/step_definitions/DoctorSteps.js | UTF-8 | 1,482 | 2.828125 | 3 | [] | no_license | const { Given, When, Then } = require("@cucumber/cucumber");
const assert = require("assert");
const Traveler = require("./../../models/Traveler")
const { doutor } = require("./../../app");
const { networkInterfaces } = require("os");
/** GIVEN */
Given('um Doctor de nome {string}', function (string) {
... | true |
d005d2ed95dd2a09ebd46a161199d9a972a27fc4 | JavaScript | JuanC2017/curso_javascript | /ejercicios2.js | UTF-8 | 485 | 4.0625 | 4 | [] | no_license | 'use strict'
var num1 = parseInt(prompt("Digita el primer número: "));
var num2 = parseInt(prompt("Digita el segundo número: "));
while(isNaN(num1) && isNaN(num2)){
num1 = parseInt(prompt("Digita el primer número: "));
num2 = parseInt(prompt("Digita el segundo número: "));
}
if (num1 > num2) {
document.write("El ... | true |
643697a66afe32b41bb3c7945f0915f5f8eb3ab2 | JavaScript | MarcoTampieri/Training---First-serie | /Esercizio 3/script.js | UTF-8 | 72 | 2.8125 | 3 | [] | no_license | let name = prompt("Please enter your name.");
alert("Welcome " + name); | true |
ba24f84234487d666c819c2bb5ac44274bc0ecab | JavaScript | SamuelNorbury/norbury-lifts | /src/utils/weights.js | UTF-8 | 4,261 | 2.859375 | 3 | [
"MIT"
] | permissive | import schedule from '../constants/schedule-opts';
import { saveToLimitedLengthArray, getTheDamnIndex, getNextLoopedArrayItem } from './arrays';
export function calculateGoalWeight(exerciseInfo, variant, history) {
const possibleRepGroups = exerciseInfo.sets[variant];
const { weight: previousWeight, sets: previous... | true |
3c05354b018421e5b6cf9518d1bc13a26a6a01a3 | JavaScript | camilahernandez16/practica_POO | /Programacion_estructura.js | UTF-8 | 322 | 4.0625 | 4 | [] | no_license | //definir variables
let nombre = 'Camila';
let apellido = 'Hernandez';
let edad = 16;
console.log (`hola mi nombre es: ${nombre} ${apellido} y tengo ${edad} años`) ;
//function
let num = 20 ;
function multiplicar (valor) {
return valor * valor ;
}
let resultado= multiplicar(5)*num;
console.log(resultado)
... | true |
a7a2f76d8c48153d3759d5959d757ef562f9d26d | JavaScript | quynhnn-vn/redux-RedditMinimal | /src/features/posts/postsSlice.js | UTF-8 | 1,888 | 2.75 | 3 | [] | no_license | /*
Handle API fetching and Redux logic of Posts
*/
import { createAsyncThunk, createSlice } from "@reduxjs/toolkit";
import { selectSearchTerm } from "../search/searchSlice";
// Fetch posts data by subreddit
export const fetchPosts = async (subreddit) => {
try {
const response = await fetch(`https://www.reddit... | true |
47c2ed7ca4e946a97663d54076ca51335972316c | JavaScript | mathavan18/pwj-module-8-blog-api | /exercise/api/models/posts.js | UTF-8 | 729 | 2.90625 | 3 | [] | no_license | import { raw } from "express";
import fs from "fs";
const PATH = "./data.json";
class posts {
get() {
/* Return a list of posts*/
return this.readData();
}
getIndividualPosts(post_id) {
// Return an Individual post
let posts = this.readData();
return posts.find((post) => post.id === post_i... | true |
71891aaac444a2558795ea58307e14284e17c49b | JavaScript | willylikestokayak/feeeffect.com-form-with-data-viz | /app.js | UTF-8 | 1,058 | 2.953125 | 3 | [] | no_license | let buttonElement = document.getElementById("btn");
buttonElement.addEventListener('click', function(event){
//form input elements
let userInputPV = parseInt(document.getElementById("portfolioValue").value, 10);
let userInputPR = parseInt(document.getElementById("portfolioReturn").value, 10);
let userInputReturn =... | true |
67298074398c65134209209fb7f666ee18beb586 | JavaScript | jose-uilton-ferreira/tetris-game | /src/modules/helpers.js | UTF-8 | 626 | 2.765625 | 3 | [] | no_license | import { NUM_COLUMNS, NUM_ROWS } from "./constants";
import Piece from "./Piece";
import { PIECES } from './pieces';
export function rand(min, max) {
return Math.floor(min + Math.random() * (max - min));
}
export function generatePiece(ctx) {
return new Piece(ctx, rand(0, PIECES.length));
}
export function isEmp... | true |
2c65e96b8d98f5857deae073c7b9705ba12abf1b | JavaScript | mimv7/2beefit | /10/js/console-assert.js | UTF-8 | 809 | 3.453125 | 3 | [] | no_license | var $form, width, height, area;
$form = $('#calculator');
$('form input[type="text"]').on('blur', function() {
// Сообщение выводится, только если введенное значение меньше 10
console.assert(this.value > 10, 'Пользователь ввел число меньше 10');
});
$('#calculator').on('submit', function(e) {
e.preventDefault... | true |
54e2ffb495394223615211689aad8251cbb11110 | JavaScript | learn-academy-2021-charlie/week-5-assessment-celoazevedo | /code-challenges.test.js | UTF-8 | 6,829 | 4.59375 | 5 | [] | no_license | // ASSESSMENT 5: JavaScript Coding Practical Questions with Jest
// Please read all questions thoroughly
// Pseudo coding is REQUIRED
// If you get stuck, please leave comments to help us understand your thought process
// Add appropriate dependencies to the repository:
// $ yarn add jest
// Use test driven developm... | true |
9bc4085509f608aedaa39b3cea84a07a204a61ce | JavaScript | millingen16/Word-Guess-Game | /assets/javascript/game.js | UTF-8 | 3,697 | 3.515625 | 4 | [] | no_license | var guessedAnswer = [
"Tron",
"Alien",
"Footloose",
"Highlander",
"Spaceballs",
"Willow",
"Topgun",
"Caddyshack",
"Beetlejuice",
"Commando",
"Akira"
]
var numGuessed;
var lettersGuessed = [];
var answerGuessed = [];
var numOfGuess = 10;
var gameWins = 0;
var gameLo... | true |
ddc1cfa0608a8eb0ed5f1b486f622771d60a3f8b | JavaScript | stefferd/Plainmodal | /assets/source/script/modal.js | UTF-8 | 5,164 | 2.671875 | 3 | [] | no_license | /**
* Created by s.van.den.berg on 17-10-14.
*/
'use strict';
(function (window) {
function setTrigger(instance) {
var trigger = util.search(instance.options.trigger);
trigger.addEventListener('click', function () {
instance.openByTrigger();
});
}
// Ut... | true |
334700b0b4fa0f5007b93e00b973d754b19b70fc | JavaScript | DDXY1230/MY-STUDY | /算法/index.js | UTF-8 | 876 | 3.796875 | 4 | [] | no_license | // set求交集的方法
let set1 = new Set([1, 2, 3, 4, 5])
let set2 = new Set([4, 5, 6, 7, 8])
let set3 = new Set([...set1].filter(i => set2.has(i))) //求两个set的交集
let set3 = new Set([...set1].filter(i => !set2.has(i))) //求两个set的非交集/差集
console.log('=====-===========')
for (let item of set1) console.log(item)
for (let item of set1.... | true |
4a3c380f2695016a580a158c1ee74d0f88d07a3b | JavaScript | samuelrey/software-engineering-daily-api | /server/controllers/favorite.controller.js | UTF-8 | 3,910 | 2.75 | 3 | [
"MIT"
] | permissive | import Bluebird from 'bluebird';
import Favorite from '../models/favorite.model';
/**
* Load favorite and append to req.
*/
function load(req, res, next, id) {
Favorite.get(id, req.user._id)
.then((favoriteFound) => {
req.favorite = favoriteFound; // eslint-disable-line no-param-reassign
return ne... | true |
f981af47ab416072f68919db9b072b9ac2a0981c | JavaScript | wangtao67/account-book | /src/filter/index.js | UTF-8 | 1,223 | 3.171875 | 3 | [] | no_license | /**
* 日期格式化
* @param timeSpan
* @param format
* @returns {*}
*/
export function dateFormat (timeSpan, format) {
if (!timeSpan) return;
let date = new Date(timeSpan);
let o = {
"M+": date.getMonth() + 1, //month
"d+": date.getDate(), //day
"h+": date.getHours(), //hour
"m+": date.getMinutes()... | true |
8c38341821cf8fa174ba2c5a1016734c709d8816 | JavaScript | Lyxcious/h8-p0-w4 | /Object Latihan 2.js | UTF-8 | 2,511 | 3.453125 | 3 | [] | no_license | var characters =
[
{ id: 720, name: 'Liebert, Anna', role: 'Main', anime: 'Monster' },
{ id: 721, name: 'Liebert, Johan', role: 'Main', anime: 'Monster' },
{ id: 722, name: 'Tenma, Kenzou', role: 'Main', anime: 'Monster' },
{ id: 723, name: 'Bernhardt, Hugo', role: 'Supporting', anime: 'Monster' },
... | true |
f31a0d8f8764e36eeffcbb2a188f0e242f5d0e6a | JavaScript | harut0111/ACA | /Homework/more tasks/valid parentheses.js | UTF-8 | 408 | 4.09375 | 4 | [] | no_license | /* check if parentheses layout is valid */
function isValidParentheses(s) {
while (
s.length &&
(s.includes("[]") || s.includes("()") || s.includes("{}"))
) {
s = s.replace("()", "");
s = s.replace("[]", "");
s = s.replace("{}", "");
}
return s.length < 1;
}
// console.log(isValidParenthes... | true |
87aac24fbc3724f26e5cadb3e73068259dc9e0f7 | JavaScript | Chase16Rogers/curb-side | /curb-side.server/server/services/BusinessService.js | UTF-8 | 2,091 | 2.515625 | 3 | [] | no_license | import { dbContext } from '../db/DbContext'
import { BadRequest } from '../utils/Errors'
import { latApi } from "./AxiosService"
const GoogleKey = process.env.Google_Key
class BusinessService {
async getAll(query) {
const res = await dbContext.Businesses.find(query)
if (!res) {
throw new BadRequest('Inv... | true |
8d2ea6c1a0fb674480fda1a85d7b985871e30e99 | JavaScript | exilednick/Logs | /comp.js | UTF-8 | 706 | 3.390625 | 3 | [] | no_license | function lt(date1, date2) {
//returns whether date1<=date2
if(date1['year']<date2['year'])
return true;
else if(date1['year'] == date2['year']) {
if(date1['month']<date2['month'])
return true;
else if(date1['month']==date2['month']) {
return date1['day']<=date2['day'];
}
}
return f... | true |
9a019d3a64124f824706dfc7ebcb9c92a0f61cef | JavaScript | johnhckuo/Gomoku | /src/script/div_render.js | UTF-8 | 1,499 | 2.71875 | 3 | [
"MIT"
] | permissive | var Div = {
init: function(horizontal_segment, horizon_interval, vertical_segment, vertical_interval){
$("#stone").empty();
this.horizontal_segment = horizontal_segment;
this.horizon_interval = horizon_interval;
this.vertical_segment = vertical_segment;
this.vertical_interval = vertical_interval;... | true |
d3f09c02bb5ea819e571fbb92332c38d3441f4c6 | JavaScript | Aderex0/techopolyFrontEnd | /lib/interaction.js | UTF-8 | 3,031 | 2.8125 | 3 | [] | no_license | const interactionsContainer = document.querySelector("#interactions-container")
const buttonContainer = document.querySelector("#button-container")
const createInteractiveButtons = () => {
buttonContainer.innerText = ""
const endTurnBtn = document.createElement("button")
endTurnBtn.id = "end-btn"
endT... | true |
9d64f4d59b86f8e26cff423cf2614866a57623e3 | JavaScript | Justinborzi/script-snippets | /binary-converter.js | UTF-8 | 90 | 2.734375 | 3 | [] | no_license | function toBinary(dec){
return (dec >>> 0).toString(2);
}
console.log(toBinary(-1));
| true |
ccc7c4c4e5e4b3969eae52ea8248371cadf2ff73 | JavaScript | milay-na/Exercice-1-livresco | /main.js | UTF-8 | 1,642 | 4.375 | 4 | [] | no_license | //First and second element for the next Fibonacci sequence
var first = BigInt(0);
var second = BigInt(1);
//Number of the element on the current Fibonacci sequence
var num = 0;
//Returns the next hundred elements of the Fibonacci sequence
function fib() {
var a = first;
var b = second;
var fiblist = [];
... | true |
76fe387e28ac1506d6ffdea9816fbabafb0f2524 | JavaScript | alaq/algorithms | /longestIncreasingSubsequence.js | UTF-8 | 949 | 4.15625 | 4 | [] | no_license | const seq = [1, 2, 5, 4]
// Brute force, recursive way
function longestIncreasingSubsequence(sequence, index = 0, base = -Infinity) {
if (index === sequence.length) return 0
const num = sequence[index]
const excluding = longestIncreasingSubsequence(sequence, index + 1, base)
if (base >= num) return ex... | true |
71d2a7df9e5c931ade6be90d26d6fa5a218fa352 | JavaScript | ioetbc/typeformCopy | /src/App.js | UTF-8 | 799 | 2.53125 | 3 | [] | no_license | import React from 'react';
import './App.css';
class App extends React.Component {
constructor() {
super();
this.nextField = this.nextField.bind(this);
}
componentDidMount() {
console.log('this.refs', this.refs)
for (let x in this.refs) {
console.log('x', x)
this.refs[x].onblur = () => this.... | true |
a30cef09e5a45dfe37dcf8bd81b326ee3c99aa77 | JavaScript | Maximiliano-zm/Curso-JS | /JS/05-tipos-datos.js | UTF-8 | 319 | 3.953125 | 4 | [] | no_license | //operadores
var numero1 = 7;
var numero2 = 12;
var operacion = numero1 * numero2;
alert("El Resultado es :" +operacion);
//tipos de datos
var numero_entero = 44;
var cadena_textto = "hola que tal";
var True_or_false = true;
//funcion
var numero_falso = "33";
Number(numero_falso);
console.log(numero_falso); | true |
5536f25a1eccf6ba7399ed681b305c2e14406ca0 | JavaScript | aolabNeuro/brain-python-interface | /db/html/static/resources/js/parameters.js | UTF-8 | 18,353 | 2.640625 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | // Use "require" only if run from command line
if (typeof(require) !== 'undefined') {
var jsdom = require('jsdom');
const { JSDOM } = jsdom;
const dom = new JSDOM(``);
var document = dom.window.document;
var $ = jQuery = require('jquery')(dom.window);
}
function Parameters(editable=false) {
thi... | true |
3a5c0c92ee9ece9d2c75411fa06f32f0cbb0e949 | JavaScript | hiddentao/lzw-async | /variants/lzw-async-btree.js | UTF-8 | 19,827 | 3 | 3 | [
"MIT"
] | permissive | /**
* Copyright (c) 2011 Ramesh Nair (www.hiddentao.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, m... | true |
f5cc8b1d3509e4cbbb457a9ec55c2f782aa1720c | JavaScript | harshitbhat/FreeCodeCamp---JavaScript-Algorithms-and-Data-Structures | /Basic Algorithm Scripting/011.title-case-a-sentence.js | UTF-8 | 243 | 3.109375 | 3 | [] | no_license | function titleCase(str) {
return str
.split(' ')
.map((el) => {
const temp = el.toLowerCase().split('');
return temp[0].toUpperCase() + temp.slice(1).join('');
})
.join(' ');
}
titleCase("I'm a little tea pot");
| true |
ad5f107c1191b5e3319bddf28c16948811a7ca7b | JavaScript | yuri-andrade97/Exercicios-CubosAcademy-Backend | /exercicios-modulo1/classe-02/index.js | UTF-8 | 173 | 3.328125 | 3 | [] | no_license | const jogada1 = 5;
const jogada2 = 4;
//seu código aqui
const total = jogada1 + jogada2;
if(total % 2 == 0) {
console.log("par");
} else {
console.log("impar")
} | true |
6b21441319b682eb2aa9ffecff38c81ad79ee0ee | JavaScript | santhoshkumar-27/javascriptyoutube | /jsfilework/ifelse.js | UTF-8 | 451 | 3.609375 | 4 | [] | no_license | // Program execution flow
//sequence is default line by line
//selection
//repition
function getGrade(marks){
if(marks>90){
console.log('Hey, you got A rank');
}
else if(marks > 80){
console.log('Hey, you got just kidding B')
}else if(marks >70){
console.log('Hey, Happy man ... | true |
40c96c791b76bdb8030ccb4858e0c7a84eea1ca6 | JavaScript | tldav/team-generator | /lib/Engineer.js | UTF-8 | 472 | 2.96875 | 3 | [] | no_license | // Allows use of code in Emmployee.js
const Employee = require("./Employee");
// Constructor class extends from Employee class to create an object containing the main data, as well as data exclusive to engineers.
class Engineer extends Employee {
constructor(name, id, email, github) {
super(name, id, email, "Engine... | true |
ef68b76312c7299693f05cc83de55784e52f5394 | JavaScript | ciarabrown/eventGo | /server/api/event.js | UTF-8 | 949 | 2.671875 | 3 | [] | no_license | const router = require('express').Router();
const isAuthenticated = require('../middlewares/isAuthenticated');
const Event = require('../models/event');
module.exports = function (app) {
// TODO: Check to see if user is authenticated
// STUB
router.use(isAuthenticated(app));
// ENDSTUB
router.post('/event'... | true |
e37335abc2cdebe8836aa8e9392810635d5d1f44 | JavaScript | JoaoNSE/Multicores | /MulticoresForm/src/main/resources/static/js/contrato.js | UTF-8 | 1,452 | 2.640625 | 3 | [] | no_license |
var data1 = {
message: "deu certo",
result: "",
btnAcao: "Simular Contrato",
user: {
id:"",
nome:"",
sobrenome:"",
email:"",
cpf:"",
endereco:"",
nomePai:"",
nomeMae:"",
instituicaoEnsino:"",
validade:""
},
produtos: [],
produtosSel: [],
pSel: {
nome:"Produtos"
},
v... | true |
2afd1ff870afedeb2f25193170bdb66ca9d077db | JavaScript | peterphenow/react_covid_tracker | /src/api/index.js | UTF-8 | 1,733 | 2.96875 | 3 | [
"MIT"
] | permissive | import axios from 'axios';
const url = 'https://covid19.mathdro.id/api';
export const fetchData = async (country) => {
let changeableUrl = url;
if (country) {
changeableUrl = `${url}/countries/${country}`;
}
try {
//destructure the data from res. Can just use data instead of res.data
// then fur... | true |
c1c955fa7360f67e4c3eabdd6fe6d24ae116a5d0 | JavaScript | SteveWSmith/DailyRindMealPlanningApp | /client/mealClient/Calendar/WeekCalendar.js | UTF-8 | 2,272 | 2.625 | 3 | [] | no_license | //@ts-check
import React from 'react';
import { StyleSheet, ScrollView, View, Dimensions, InteractionManager } from 'react-native';
import Week from './Week';
import { Constants } from '../constants';
export default class WeekCalendar extends React.Component {
// specialized render week view with days
constructor(... | true |
c3c1042668388f91358dfd8520fcb32596d48423 | JavaScript | hyj1351824201/yxswy | /Vue/vue3/src/hooks/useList.js | UTF-8 | 551 | 2.71875 | 3 | [] | no_license | export function useList() {
// 列表数据
const state = reactive({
loading: true, // 加载状态
list: [], // 列表数据
});
// 获取列表
function getList() {
state.loading = true;
return request({
url: "/getUsers",
method: "get",
}).then(({ data, total }) => {
// 设置... | true |
00fecbd9ba5175b573d768395f9ec7f3e3b33467 | JavaScript | cjrfan/FEToolsDemo | /Gulp/demo1/gulpfile.js | UTF-8 | 1,267 | 3.25 | 3 | [] | no_license | var gulp = require('gulp');
// gulp.task('default', function() {
// console.log('hello world');
// });
// gulp.task('one',function(){
// // one 是一个异步执行任务
// setTimeout(function(){
// console.log('one is done');
// },5000);
// });
// //two任务虽然依赖于one任务,但并不会等到one任务中的异步操作完成后再执行
// gulp.task('two',['one'],function(... | true |
70549e203090842f9a9440607eb0a45dc8d75baf | JavaScript | ArysAung/JQuery-JS-Basics | /main.js | UTF-8 | 685 | 4.21875 | 4 | [] | no_license | var x = 5
if(x>5){
console.log("Booyah!")
};
if(x<5){
console.log("Close but no Cigar")
};
if (x === 5){
console.log("Yoooo!")
};
var y = 10
var z = 11
console.log(y + z);
var n1 = "Jack"
var n2 = "Dough"
console.log(n1 + " " + n2);
var hobby = [["walking","skiing","eating"],["swimming", "biking", "diving"]]... | true |
08ae7abc57ea5f270c7c45e957fb758de4dd5de7 | JavaScript | Lylichen/testproject | /3.js | UTF-8 | 1,098 | 3.328125 | 3 | [] | no_license | //通过闭包实现类的静态变量
var Book = (function(){
//静态私有变量
var booknum = 0;
function checkName(name){
console.log(name);
};
//返回构造函数
return function(newId,newName,newPrice){
//私有变量
var name,price;
//私有方法
function checkID(id){
return this.id===id ? true : ... | true |
1f9705190d05a08b18f28bfc310e61032861509e | JavaScript | CvaKumarBoga/React-Work | /react-frontend-curd/src/components/GetAllStudents.jsx | UTF-8 | 2,198 | 2.640625 | 3 | [] | no_license | import React, { Component } from 'react'
import StudentService from '../service/StudentService';
class GetAllStudents extends Component {
constructor(props) {
super(props);
this.state = {
students: [],
message: null
}
this.deleteStudent = this.deleteStudent.... | true |
832c8b23e79221830928187e6a4853f32593d88c | JavaScript | willtonnsilva/portal | /src/main/resources/static/js/extrato.js | UTF-8 | 2,155 | 3.125 | 3 | [] | no_license | var Extrato = (function(){
'use strict';
var getExtratos = function () {
$.ajax({
type: 'GET',
url: "/v1/api/extratos",
dataType: "json",
success: function(data, textStatus, jqXHR) {
return montaGridExtratos(data);
},
... | true |
261e76a06b52cb580bed3e5045f9e470477b6d79 | JavaScript | jaakjuu1/fullstackopen | /osa2/maiden-tiedot/src/App.js | UTF-8 | 788 | 2.71875 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import axios from "axios";
import Tulokset from './components/Tulokset'
import Haku from './components/Haku'
const App = () => {
const [maat, setMaat] = useState([]);
const [haku, setHaku] = useState("");
useEffect(() => {
axios.get("https://restcountries.... | true |
a514d1f4e9829c99c0e557701fdd9fc099f0cbeb | JavaScript | ManuuMT/js-exercices-model-4geeks | /assets/scripts/index.js | UTF-8 | 3,982 | 3.921875 | 4 | [] | no_license | // declaración de datos iniciales
let undefined;
const sequence = [10, 4, 8, 27.4, 500, null, undefined, 100, 25, 40, 31, 20, 17, 1890, 13, 42];
// Funcion que limpia los arrays
function cleanArray(myArray) {
let arrayFixed = [];
for (let i in myArray) {
// Si el elemento del array cumple con la condi... | true |
ceb62003b813bd7f00a82abfa779c5977486c3a2 | JavaScript | qianxuehuanyu/qianxuehuanyu.github.io | /lovefish/js/bigfish.js | UTF-8 | 2,895 | 2.890625 | 3 | [] | no_license | /**
* Created by Administrator on 2016/10/13 0013.
*/
var bfObj= function () {
//大鱼对象
this.x;
this.y;
this.angle;
//this.bfEye=new Image();
//this.bfBody=new Image();
//this.bfTail=new Image();
};
bfObj.prototype.init= function () {
//大鱼对象初始化
this.x=canWidth/2;
this.y... | true |