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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
5df154ba617344561ff46f796bb3c1ff7c65d612 | JavaScript | aalzehla/Netcool | /netcool/omnibus/platform/linux2x86/isadc/dojo_extensions/widget/fieldTask/EditableSelectListFieldTask.js | UTF-8 | 3,399 | 2.515625 | 3 | [] | no_license | /*
(C) COPYRIGHT International Business Machines Corp., 2011.
All Rights Reserved * Licensed Materials - Property of IBM
*/
// dojo.provide allows pages to use all of the types declared in this resource.
dojo.provide("widgets.fieldTask.EditableSelectListFieldTask");
// dojo.require the necessary dijit hierarc... | true |
06ab217a7c6f9c2c4883730742020a85a1f44934 | JavaScript | august-grace-bopper/Persephone-Archive | /client/store/products.js | UTF-8 | 2,137 | 2.8125 | 3 | [
"MIT"
] | permissive | import axios from 'axios'
// Action Types
const ALL_PRODUCTS = 'ALL_PRODUCTS'
const ADD_PRODUCT = 'ADD_PRODUCT'
const DELETE_PRODUCT = 'DELETE_PRODUCT'
const EDIT_PRODUCT = 'EDIT_PRODUCT'
// Action Creators
export const allProducts = products => ({
type: ALL_PRODUCTS,
products
})
export const deleteProduct = pro... | true |
acc29d06763a95a6bf1a148f4e948854ee22bc24 | JavaScript | rlefebvre/timeout-aws | /index.js | UTF-8 | 1,126 | 2.9375 | 3 | [] | no_license | const { memoize } = require ("@aws-sdk/property-provider");
process.on('unhandledRejection', (error) => {
console.log('unhandledRejection', error);
});
const provider = (init) => {
let i = init;
return async () => {
i++;
console.log("init",init,"i",i, i%2);
if (i % 2 === 1) {
... | true |
c141ebe607f24319c989f603d935bafbd89bb3ab | JavaScript | rkarabanov/examples | /String/task43/script.js | UTF-8 | 198 | 2.90625 | 3 | [] | no_license | console.log(isUpperCaseAt('Js STRING EXERCISES', 1));
console.log(isUpperCaseAt('Js STRING EXERCISES', 5));
function isUpperCaseAt(str,num) {
return str.charAt(num).toUpperCase()==str.charAt(num);
} | true |
fd41dd5d836e01098d4621e228cccafa79e8a217 | JavaScript | nis24jit/code-wars-solutions | /chain-evaluation.js | UTF-8 | 402 | 3.703125 | 4 | [] | no_license | Number.prototype.add = function(num) {
return this.valueOf() + num;
};
Number.prototype.subtract = function(num) {
return this.valueOf() - num;
};
Number.prototype.multiply = function(num) {
return this.valueOf() * num;
};
Number.prototype.divide = function(num) {
return this.valueOf() / num;
};
Num... | true |
6b1f8e530c75f70b48eca4ce9cf55dfbbcc3182f | JavaScript | loen/SpringReact | /SpringReactFrontend/src/client/app/commentBox.js | UTF-8 | 3,330 | 2.703125 | 3 | [] | no_license | import React from 'react';
import jQuery from 'jquery';
import Comment from './comment.js';
import CommentForm from './commentForm.js';
import config from './config/config.js';
class CommentBox extends React.Component {
_getComments(){
return this.state.comments.map((comment)=>{
return(
... | true |
8b5b3f57ae68a3ba67d03bebee816035f99325dc | JavaScript | one0212/2019_iii_note | /FrontEnd_Folder/JavaScript/廢棄檔案/---03.js | UTF-8 | 1,170 | 3.53125 | 4 | [] | no_license | /*
var box;
alert(typeof box);// box是Undefined的類型,因為沒有初始化,值是undefined,類型返回的字符串是undefined
var box = true;
alert(typeof box);// box是Boolean的類型,值是true,類型返回的字符串是boolean
var box = '江宛婷';
alert(typeof box);// box是String的類型,值是'江宛婷',類型返回的字符串是string
var box = 250;
alert(typeof box);// box是Number的類型,值是250,類型返回的字符串是number
//... | true |
83638ce7733000eecbf1c14b146bcc9cfb687e8e | JavaScript | haze9greg/gardenForm | /scripts/country.js | UTF-8 | 2,343 | 3.734375 | 4 | [] | no_license | window.onload = countries;
var formy;
function countries(){
alert("hey");
//get the form and put it in the global variable
formy = document.querySelector("form");
//put an onchange on the dropdown menu (when the value becomes something else)
//does not work on text fields, will not trigger until the user cli... | true |
ad14e7bb6f6089f201bdf2a0d6dd1fbb54674cb1 | JavaScript | mingjianjzhang/algorithms | /app/scripts/controllers/algo.js | UTF-8 | 6,302 | 3.375 | 3 | [] | no_license | 'use strict';
/**
* @ngdoc function
* @name algorithmsApp.controller:AlgoCtrl
* @description
* # AlgoCtrl
* Controller of the algorithmsApp
*/
angular.module('algorithmsApp')
.controller('AlgoCtrl', function ($scope) {
this.awesomeThings = [
'HTML5 Boilerplate',
'AngularJS',
'Karma'
]... | true |
f1f8ff0293443fa8744941710ba05a56365d4928 | JavaScript | adrianpdm/MDSS-Webpack | /src/store/modules/dataRepo.js | UTF-8 | 9,200 | 2.53125 | 3 | [] | no_license | import _ from "lodash"
import {_titleCase} from "../../filters"
let store = {
state: {
filename: "",
entryDate: 0,
computationTime: 0,
dataOfMachines: [],
isDataExist: false,
isCostDataExist: false,
machineTreeNodes: [],
maintenanceCostPerInterval: [... | true |
fa54743f24247a4f524a7e52de9e42a10acf3e75 | JavaScript | KokoChris/NightlifeFCC | /routes/bars/index.js | UTF-8 | 3,943 | 2.53125 | 3 | [
"MIT"
] | permissive | const express = require('express');
const router = express.Router();
const config = require('../../config')
const request = require('request');
const rp = require('request-promise')
const requestOptions = require('./config');
const client_id = config.foursquare.clientID;
const client_secret = config.foursquare.clientS... | true |
dc121838a5055a93e02a16d7420e2cb7d5088fa8 | JavaScript | jmiln/EdelweissUtils | /scripts/tagView.js | UTF-8 | 781 | 3.046875 | 3 | [] | no_license | // Use this to just replace the tags section with a textarea with the list copyable
if (!document.getElementById("conContent")) {
alert("You need to have the tags, notes, or reviews open to use this.");
} else {
var replacement = [...document.getElementById("conTable").rows]
.filter(r => r.cells[0].text... | true |
e0328bbf766966e9abf4d101f7ea8ecf39d9f305 | JavaScript | zcher82/task_app-weekend-4-challenge | /server/public/scripts/clientapp.js | UTF-8 | 4,378 | 3.375 | 3 | [] | no_license | $(document).ready(function () {
getTasks();
$('#submit').on('click', createTask);
$('#taskContainer').on('click', '.updateNotes', putNotes);
$('#taskContainer').on('click', '.completed', completeTask);
$('#taskContainer').on('click', '.delete', deleteTask);
});
//**-----------UTILITY FUNCTIONS-----------... | true |
6dde851a79b93dc8159f9cd94e2749256736557c | JavaScript | Oliive33/Projet-Orinoco | /js/pages/products.js | UTF-8 | 1,568 | 3.125 | 3 | [] | no_license | // Main function, auto executed at load time
(async () => {
const productId = getProductId();
const productData = await getProductData(productId);
hydratePage(productData);
})();
function getProductId() {
return new URL(window.location.href).searchParams.get("id");
}
function getProductData(productId) {
ret... | true |
c98128a19598e775e7fac77052588c4c9b453853 | JavaScript | DanielMIlario/Ball | /sketch.js | UTF-8 | 2,319 | 3.375 | 3 | [] | no_license | var x = 1800;
var y = 0;
var w = 1500;
var z = 450;
var B1x = 300;
var B1y = 300;
var B2x = 300;
var B2y = 300;
var height = 1000;
var width = 2000;
var speed = {
x:5,
y:5,
};
var speed2 = {
w:7,
z:7,
};
var value = 0;
function setup () {
createCanvas(2000, 1000);
}
function isInWidth(ballX) {
if (ballX > ... | true |
5eda03a204be2524181079c1d25c6996997ec36d | JavaScript | mhpjay422/D3-Github-Jobs-Visualizations | /index.js | UTF-8 | 10,400 | 2.53125 | 3 | [] | no_license | import {
select,
scaleLinear,
scaleBand,
axisLeft,
axisBottom,
event
} from 'd3';
document.addEventListener('DOMContentLoaded', () => {
getData();
async function getData() {
const response = await fetch('/api');
const json = await response.json();
let months = {
'J... | true |
2f544e9d93f8d1732332a14972b680835a3e10a8 | JavaScript | ampproject/amp-toolbox | /packages/optimizer-docker/utils.js | UTF-8 | 1,894 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | const {profiler} = require('./metrics');
const url = require('url');
const defaultConfiguration = {profile: true};
function objectFromEntries(arr) {
return Object.assign({}, ...Array.from(arr, ([k, v]) => ({[k]: v})));
}
function maybeParseBool(value) {
return value === 'true' ? true : value === 'false' ? false ... | true |
7a28f228a3e5d1fc4fe1faf221996cc7c75f215d | JavaScript | geotiffjs/geotiff.js | /src/resample.js | UTF-8 | 8,080 | 3.5 | 4 | [
"MIT"
] | permissive | /**
* @module resample
*/
function copyNewSize(array, width, height, samplesPerPixel = 1) {
return new (Object.getPrototypeOf(array).constructor)(width * height * samplesPerPixel);
}
/**
* Resample the input arrays using nearest neighbor value selection.
* @param {TypedArray[]} valueArrays The input arrays to r... | true |
75c67133b4a98615063197fa31800bc0720de155 | JavaScript | edgar-moran/reed-solomon-aztec | /lib/GaloisFieldPolynomial.js | UTF-8 | 5,751 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | /*
Copyright 2020 Alexander Stokes
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in ... | true |
fd70e611f74f898682d2599661be78593de3263d | JavaScript | SandraAlbrecht/LearningWebDevelopment | /pluralsight_notes/beginner/practice8.js | UTF-8 | 403 | 3.75 | 4 | [] | no_license | function sayHello(name) {
console.log("Oh hi " + name);
}
sayHello("Noris");
sayHello("Munsi");
sayHello("Mama");
function calculateArea(side) {
console.log(side * side);
}
calculateArea(5);
calculateArea(8747491);
function calculateArea(width, height) {
console.log(width * height);
}
calculateArea(2, 8);
ca... | true |
f43af239f907904e4c2f634454ec6d5f200cdecd | JavaScript | tinytot1/leetcode | /src/leetcode/1. Two Sum.js | UTF-8 | 1,786 | 4.40625 | 4 | [] | no_license | /**
* Given an array of integers, return indices of the two numbers such that they add up to a specific target.
* 给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。
* You may assume that each input would have exactly one solution, and you may not use the same element twice.
* 你可以假设每种输入只会对应一个答案。但是,你不能重复利... | true |
d8885b7cd05b250e534e09f8a068a9a37425231e | JavaScript | minafrajr/WebModerno | /exercicios-js/funcao/cidadaoPrimeiraClasse.js | UTF-8 | 830 | 4.75 | 5 | [] | no_license | //Função em JS é First-Class Object (Citizens)
//Higher-order function
//Pode tratar a função como objeto (pode passar a função como parametro)
//criar de forma literal
function fun1(){}
//Armazenar em uma variável
const fun2 = function(){}
//Armazerar em um array
const array = [function (a, b){return a+b... | true |
d595066e596c81a504091d6e7f4d70d79d65ee8b | JavaScript | bnuhenry/MiniProgram | /component/scheduleeditor/scheduleeditor.js | UTF-8 | 7,504 | 2.640625 | 3 | [] | no_license | // component/scheduleeditor/scheduleeditor.js
Component({
// 组件的属性列表
properties: {
editType:{
type:Number
},
canEdit:{
type:Boolean,
value:false
},
year:{
type:Number
},
month:{
type:Number
},
day:{
type:Number
},
userId:{
type:St... | true |
61ec34e13a22d267e1d9ad37d7051d8319ef0e5a | JavaScript | hoelshen/leetcode-918 | /20200705/191. 位1的个数.js | UTF-8 | 1,702 | 4.15625 | 4 | [] | no_license | /**
* @param {number} n - a positive integer
* @return {number}
*/
var hammingWeight = function(n) {
console.log('n: ', n);
var count = 0;
for(let i of Object.keys(n)){
console.log('i: ', n[i]);
if(n[i] == 1){
count ++;
}
}
return count
};
//任何数字跟掩码1进行逻辑与运算,都可以获得这个数字都最低位
// 检查下一位时,将掩码... | true |
7cf0b04894d9dc45f6d913e84052d7080c7d32fa | JavaScript | cjh1/geoweb | /web/lib/vgl/freezeObject.js | UTF-8 | 543 | 2.84375 | 3 | [] | no_license | /**
* @module ogs.vgl
*/
vglModule.freezeObject = function(obj) {
"use strict";
/**
* Freezes an object, using Object.freeze if available, otherwise returns
* the object unchanged. This function should be used in setup code to prevent
* errors from completely halting JavaScript execution in legacy br... | true |
4a1f26e50c2a3e5fd18dbf7d3bf1215fe7015824 | JavaScript | guileen/node-levelmail | /lib/util.js | UTF-8 | 595 | 2.609375 | 3 | [
"MIT"
] | permissive | exports.pad = function(num, size) {
return ('000000000000000000' + num).slice(-size)
}
exports.makeUInt32Key = function makeUInt32Key(prefix, v) {
var buff = new Buffer(Buffer.byteLength(prefix) + 4)
buff.write(prefix, 0, 'utf8')
buff.writeUInt32BE(v, Buffer.byteLength(prefix))
return buff
}
// ke... | true |
265a48fd33ced6c9cacad693209f626f67a762b1 | JavaScript | sadeks/task-manager | /ui/src/components/TaskDetails.js | UTF-8 | 1,466 | 2.609375 | 3 | [] | no_license | import React, { Component } from 'react';
import { Button, Jumbotron } from 'react-bootstrap';
import request from 'superagent';
import Moment from 'react-moment';
class TaskDetails extends Component {
constructor(props) {
super(props);
this.state = {
task: null
}
// console.log('inside Tas... | true |
c9a6b61c1d1985921574e6ef95903f53cc4f5c9a | JavaScript | tobyking3/airbnb-analytics | /src/js/panel.js | UTF-8 | 1,139 | 2.609375 | 3 | [] | no_license | var typePanels = document.querySelectorAll(".average-prices_type");
var typeMenuContainer = document.querySelector(".average-prices_menu");
var typeButtons = document.querySelectorAll(".average-prices_type-btn");
var typeHome = document.querySelector("#average-prices_type-btn--home");
var typePrivate = document.querySe... | true |
610007afb50ed434ed2f80cf7918fc76133ee61c | JavaScript | torresga/launch-school-code | /lessons/225_lessons/lesson_5/constructorFunctionsPrototypes1.js | UTF-8 | 5,094 | 4.8125 | 5 | [] | no_license | // 1. What does the following code log to the console?
var a = 1;
var foo;
var obj;
function Foo() {
this.a = 2;
this.bar = function() {
console.log(this.a);
};
this.bar();
}
foo = new Foo(); // outputs 2 because `this` refers to the object created by 'new'
foo.bar(); // outputs 2 because `this` refers ... | true |
225213694bbfd0fcd9804d5336c42fda2baf0996 | JavaScript | ViktorAleksandrov/SoftUni--JS-Core | /JS Fundamentals/02. Document Object Model/Exercise/06_SoftUni-Quizz/solution.js | UTF-8 | 961 | 3.1875 | 3 | [
"MIT"
] | permissive | function solve() {
Array.from(document.getElementsByTagName('button')).forEach(button =>
button.addEventListener('click', clickFunc)
);
let sections = document.getElementsByTagName('section');
let correntAnswers = ['2013', 'Pesho', 'Nakov'];
let answersCount = 0;
let correctAnswersCount = 0;
function clic... | true |
47c7037323f0d4cc57538c2a19bc9697bee9287e | JavaScript | lzbrady/GrindStone | /public/jobs-page/jobs.js | UTF-8 | 5,804 | 2.71875 | 3 | [] | no_license | (function () {
"use strict";
const apiUrl = "https://grindstone-app-api-username.herokuapp.com/jobs";
// const apiUrl = "http://localhost:3000/jobs/";
let allJobs;
function getAllJobs() {
$(".wrapper").empty();
$.ajax({
url: apiUrl,
dataType: 'JSON',
... | true |
3f02dce9021e1823871de19fa274006eb3e1bd09 | JavaScript | alibstrd/Live-Coding | /soal3.js | UTF-8 | 528 | 3.65625 | 4 | [] | no_license | function digitsGrouper(numbers){
let hasil = [];
for(let x = 0; x < 4; x++){
hasil.push([]);
for(var y = 0; y < numbers.length; y++){
if(numbers[y].toString().length === x+1){
hasil[x].push(numbers[y]);
}
}
}
return hasil;
}
console.log(digitsGrouper([1,12,13,0,88,123,456]));
console.l... | true |
543a902a0db7b2dff53cb62fc35eb6d876e19832 | JavaScript | Rengaht/youngvoice | /js/sound.js | UTF-8 | 1,634 | 2.53125 | 3 | [] | no_license | var _sound_back,_sound_eat,_sound_dead,_sound_pop,_sound_button;
var _play_sound=true;
function loadMusic(){
_sound_back=new Howl({
src:['sound/back.wav','sound/back.ogg'],
loop:true,
onend: function(){
// console.log('Finished!');
},
onplayerror: function() {
_sound_back.once('unlo... | true |
4c7ce6e055dce9c1d9f0f3bfdf9d00c2160290e2 | JavaScript | dspina79/JSCheatSheet | /algorithms/99bottlesofbeer.js | UTF-8 | 998 | 3.640625 | 4 | [] | no_license | // 99 Bottles of Beer Song
function sing() {
let beersOnWall = 99;
while(beersOnWall > 2) {
console.log(`${beersOnWall} bottles of beer on the wall.`)
console.log(`${beersOnWall} bottles of beer!`)
console.log('Take one down, pass it around');
console.log(`${--beersOnWall} bottles o... | true |
b92f9eb50fb95e2cd7a589780e4bea764b60288a | JavaScript | Juckjick/ScholarWeb | /packages/reports/server/controllers/application/reports.application.loan.controller.js | UTF-8 | 1,076 | 2.765625 | 3 | [] | no_license | /**
* Getting contact information
* @param {Object} data from DB based of UserID and Version
* @return {Array} of generated contents
*/
exports.getLoan = function(data) {
var contents = [],
header, i;
header = {
text: '10. การกู้ยืมเงินรัฐบาล\n',
style: 'header'
};
... | true |
6242633f152a75db7d7084ec284fe21f2069ad6d | JavaScript | aiqinhaian/jsTest | /framework/koa.js | UTF-8 | 656 | 2.75 | 3 | [] | no_license | const compose = (middleware = []) => {
return (context, next) => {
let index
const dispatch = i => {
index = i
let fn = middleware[i]
if (i === middleware.length) {
fn = next
}
if (!fn) {
return
}
return fn(context, () => {
return dispatch(i + ... | true |
5ee84ddb8e7a92d7de1048ae0aea54f33b7b2de4 | JavaScript | conganhhcmus/Codelearn.io | /practice/bingoGame.js | UTF-8 | 968 | 3.0625 | 3 | [
"MIT"
] | permissive | function bingoGame(a, b) {
var ans = -1;
for (var i of b) {
for (var j = 0; j < a.length; j++) {
for (var k = 0; k < a.length; k++) {
if (a[j][k] === i) a[j][k] = 0;
}
}
// check winlose
//check duong cheo
var cheo_chinh = 0;
... | true |
c925c0b6e35976789806d5df6e2f2b6c52ce15c4 | JavaScript | sitecues/sitecues-js | /source/js/page/positioner/util/element-map.js | UTF-8 | 2,488 | 2.875 | 3 | [] | no_license | /**
* element-map
*
* Stores any meta data you want with an element
* TODO perhaps traitcache should use this -- in some ways they are very similar (note that traitcache uses $.data);
* TODO can we just set properties directly in the same way $.data() does? E.g. element.scdata.computedStyle = {}
*/
define([], fun... | true |
c05ffecad31d174a3effae9324dc06dc208a7cba | JavaScript | gsmith77/js-dom-and-events-acting-on-events-lab-online-web-pt-102218 | /index.js | UTF-8 | 893 | 3.453125 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | function preventRefreshOnSubmit(){
document.querySelector('form').addEventListener('submit', function(event){
event.preventDefault()
})
}
function retrieveEmployeeInformation() {
return document.querySelector('input').value
}
function addNewElementAsLi() {
const li = document.createElement('li')
... | true |
71d2b9e177a0da79c57f3a40dd8c8116fe80f68d | JavaScript | W-Mills/weekly_code_challenges | /week_7/wk7_maxhawk.js | UTF-8 | 581 | 3.84375 | 4 | [] | no_license | // Starting with a frequency of zero, what is the resulting frequency after all of the changes in frequency have been applied?
// input: text file
// output: number
// approach:
// break data into array of strings
// map strings to nums
// reduce add
const fs = require('fs');
let data = fs.readFileSync('wk7... | true |
085264371c99fe1fe544f35799b58f7f9996c4f2 | JavaScript | harrio/vrBIM | /src/Keyboard.js | UTF-8 | 1,729 | 2.59375 | 3 | [] | no_license | /* global THREE */
/* global THREEx */
import * as Menu from './Menu';
const keyboard = new THREEx.KeyboardState();
const lbounds = new THREE.Vector3(-1000, 0.5, -1000);
const ubounds = new THREE.Vector3(1000, 200, 1000);
const hspeed = 100;
const vspeed = 100;
const vstep = 0.3;
const hstep = 0.3;
const rot = 3.14/... | true |
95d08f85ed866f3f1444567da17df99cbfc2ac11 | JavaScript | Rishabh034/Web_PP_10 | /DOM/To-doApp/app.js | UTF-8 | 483 | 3.21875 | 3 | [] | no_license | let input=document.querySelector("input");
let buttontag=document.querySelector("button");
let ul =document.querySelector("ul");
//let text = inputtag.value;
buttontag.addEventListener("click", function(){
let task = input.value;
// input.value="";
if(input.value=="")
return;
input.value="";
... | true |
7d4a42af3cc783a3fe7c28b427da1bc8e242582c | JavaScript | Digit4-Hungary/bodyhoney | /js/product-page-head-js.js | UTF-8 | 1,947 | 3.015625 | 3 | [] | no_license | // userID check és mentés cookie-ba
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
var expires = "expires="+d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires;
setTimeout(function(){
dataLayer.push({
... | true |
f5e7b805a04471d7da37c36ff7e0e6cb72ba2a8d | JavaScript | 7287vencent/every-day | /leetcode/1018. 可被 5 整除的二进制前缀/index.js | UTF-8 | 245 | 3.046875 | 3 | [] | no_license | /**
* @param {number[]} nums
* @return {boolean[]}
*/
var prefixesDivBy5 = function (nums) {
let prefix = 0;
let res = [];
for (let num of nums) {
prefix = ((prefix << 1) + num) % 5;
res.push(prefix === 0);
}
return res;
};
| true |
abc8328b12fdefc333917ada5805de6870135437 | JavaScript | zhaosaisai/node-api-demos | /child_process/kill.js | UTF-8 | 574 | 2.953125 | 3 | [] | no_license | /**
* subprocess.kill([SIGHUB])
* 这个方法主要是给子进程发送信号
*
* 已发送信号给子进程后
* subprocess.killed会被设置为true
*/
const assert = require('assert')
const spawn = require('child_process').spawn
const cat = spawn('cat')
cat.stdout.on('end', () => {})
cat.stderr.on('data', () => {})
cat.stderr.on('end', () => {})
cat.on('exit', (... | true |
9ad66fd0c9282cdde82403a2a57e46c407f4af15 | JavaScript | llfly/es6 | /test/error.js | UTF-8 | 2,179 | 3.96875 | 4 | [] | no_license | //错误处理
// 1.最自然的就是使用try,catch,但它只能是同步的,无法用于异步代码模式
/*
function foo(){
setTimeout(function(){
baz.bar();
},100);
}
try{
foo();
//后面从`baz.bar()`抛出全局错误
}
catch(err){
//永远不会到达这里
console.log('get error:',err);
}
*/
// 2. error-first 回调风格
function foo(cb){
setTimeout(function(){
... | true |
2f0170b806570bd91db8d46a6e09a5f79ee3a4ed | JavaScript | zephyrJS/leetcode-js | /036-Valid-Sudoku.js | UTF-8 | 2,035 | 3.484375 | 3 | [] | no_license | /**
* @param {character[][]} board
* @return {boolean}
*/
var isValidSudoku = function(board) {
this._bit = 0;
function isValid(num){
var tmp = Math.pow(2, num - 1);
if((this._bit & tmp) !== 0){
return false;
}else{
this._bit = this._bit | tmp;
retu... | true |
6c308c0669a931a4c93260c0d4b42a76ccfd897f | JavaScript | marcelorbc/volanty | /volanty-services/services/JobScheduled.js | UTF-8 | 348 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | var cron = require("node-cron");
const TODO_SEGUNDO = '* * * * * *'
var started = false;
var start = function(){
if(started) console.log("Já iniciado")
else{
cron.schedule(TODO_SEGUNDO, function() {
console.log(new Date())
}, null, true, 'America/Los_Angeles');
started = true;
}
}
module... | true |
14e3f44bc3e74d0dc9e73d529a029f8a700f7058 | JavaScript | EmilyNecciai/team-builder-9000 | /src/page-template.js | UTF-8 | 3,513 | 2.75 | 3 | [] | no_license | // SUB FUNCTIONS
// EMPLOYEE TITLE AND ICON
const genTitle = empTitle => {
// TO DO: PASS IN EMPLOYEE TITLE FROM INQUIRER
if (empTitle === "Manager") {
return `
<i class="fas fa-mug-hot">Manager</i>
`;
} else if (empTitle === "Engineer") {
return `... | true |
affd470693532e574bc3ca3adc8b6d8fa0b47f59 | JavaScript | Nitesh-Nandan/React-Fundamental | /src/playground/counter.js | UTF-8 | 693 | 3.34375 | 3 | [] | no_license | // Couter App
const appRoot = document.getElementById('app');
let Count = 0;
const addOne = () => {
Count++;
console.log("addOne");
render();
}
const minusOne = () => {
Count--;
console.log("minusOne");
render();
}
const reset = () => {
Count = 0;
console.log("Reset th... | true |
c952ad0044fdb4f4f95647bd684348df3615cdee | JavaScript | jackiecookie/leetcode | /24.两两交换链表中的节点.js | UTF-8 | 846 | 3.546875 | 4 | [] | no_license | /*
* @lc app=leetcode.cn id=24 lang=javascript
*
* [24] 两两交换链表中的节点
*/
// @lc code=start
/**
* Definition for singly-linked list.
* function ListNode(val) {
* this.val = val;
* this.next = null;
* }
*/
/**
* @param {ListNode} head
* @return {ListNode}
*/
var swapPairs = function (head) {
let next... | true |
a8a754934f13f2408ff347d1a941f1b263a6c97e | JavaScript | lukajovic/javascript-php | /Task.02/js.js | UTF-8 | 1,205 | 3.359375 | 3 | [] | no_license | function duzinaNiza() {
var brojNiza = document.getElementById("brojClanovaNiza").value;
var niz = [];
niz.length = parseInt(brojNiza);
var div = document.getElementById("niz");
for (let index = 0; index < niz.length; index++) {
div.innerHTML += "<input type='text' class='elementNiza'/><br>... | true |
02185ebc933e190416c6ad1d9a72c266d398caa7 | JavaScript | Jeet009/contact-manager | /src/components/HomeComponent.js | UTF-8 | 2,577 | 2.625 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import { Col, Jumbotron, ListGroup, Row } from "react-bootstrap";
import { fetchContacts } from "../apis/ContactApi";
function HomeComponent() {
const [contacts, setContacts] = useState([]);
useEffect(() => {
fetchContacts().then((data) => {
setContact... | true |
3e6e805a3c178fb21f78cbb97cf66ba0b5d6154e | JavaScript | WMichael/Etch-A-Pad | /js/main.js | UTF-8 | 2,140 | 3.265625 | 3 | [] | no_license | var sizeOfPad = 500;
var colour = "black" //Default colour of Pixel
var random = false
var erase = false
var recentSize = 16 // Used so addCells function knows previous size of grid.
$(document).ready(function() {
addCells(recentSize) // Default grid of pixels.
$("#clear").click(function(){
$('#ou... | true |
e2f9ce5631ff465131259907d2ba82aa7d13ecff | JavaScript | rharley-dev/bug-tracker | /src/View/BugCreate/Edit/bugForm.jsx | UTF-8 | 2,480 | 2.65625 | 3 | [] | no_license | import React, { useState } from 'react';
import BugModel from '../../../Models/bugModel';
import './bugForm.css';
export default props => {
// the bug will be passed over from props:
// when editing the bug this will save the inputs rather than reinputing the data
// if props.bug is null then this will create a... | true |
6ca4bf290ea50baef6355680bbc4036d8c3fe154 | JavaScript | ThatoSiphosethu/bmi | /code.js | UTF-8 | 2,479 | 3.109375 | 3 | [] | no_license | $(document).ready(function () {
$("button").click(bmiCalculator);
var myRules = {
firstName: {
required: true
},
lastName: {
required: true
},
sex: {
required: true
},
weigh... | true |
491a5176d0af34394790f00c07f58b59448fe32e | JavaScript | richardtdavid/weatherjs | /weather.js | UTF-8 | 580 | 3.328125 | 3 | [
"MIT"
] | permissive | class Weather{
constructor(city, state){
this.apiKey = 'insert api key here';
this.city = city;
this.state = state;
}
// Fetch weather from api
async getWeather(){
const reponse = await fetch(`http://api.wunderground.com/api/${this.apiKey}/conditions/q/${this.state}/${t... | true |
3103968a0a5405ea6475893c3622845832666854 | JavaScript | ShlokD/promise-it-wont-hurt-solutions | /throw-error.js | UTF-8 | 265 | 2.875 | 3 | [] | no_license | function parsePromised(path) {
return new Promise(function(resolve,reject) {
try {
var contents = JSON.parse(path);
resolve(contents);
} catch(e) {
reject(e.message);
}
})
};
parsePromised(process.argv[2]).then(null, console.log); | true |
c85d59e89a800f7723f8f36a955d097de442ca6f | JavaScript | ibulavsky/examples-javascript-ES6 | /src/4_template_strings.js | UTF-8 | 789 | 4.15625 | 4 | [] | no_license | // {
// const name = 'Igor';
// const template = `Hello, ${name}`;
// console.log(template);
// }
//
// {
// const isVisible = true;
// const template = ` ${isVisible ? "I'm Igor" : ''}`;
// console.log(template);
// }
//
// // Methods
// const str = 'Hello';
// console.log(str.startsWith('He'))... | true |
16ae18cc2a1c696e3b95c280ee3f6a4e537623a4 | JavaScript | green-fox-academy/Adamman48 | /Orientation Phase/week-08/day-01/candy-game/game.js | UTF-8 | 1,072 | 3.453125 | 3 | [] | no_license | 'use strict';
/* Gather 10.000 candies!
Clicking the ‘Create candies’ button gives you 1 candy.
You can buy a lollipop for 100 candies by clicking the ‘Buy lollipop’ button.
10 lollipops generate 1 candy per second.
Use the lollipop emoji to display the lollipops you have
Display the candy producton rate in the Candies... | true |
554b67ecba2486a52a8990a8ac0d0289e7d3c7e2 | JavaScript | spalberg/AdventOfCode | /2019/06/index.js | UTF-8 | 1,289 | 3.59375 | 4 | [] | no_license | function getParsedInput() {
return require('fs')
.readFileSync('./input.txt')
.toString()
.split('\n')
.map(n => n.split(')'));
}
const input = getParsedInput();
const objects = new Set(input.flat());
const orbits = new Map(
input.map(([isOrbitted, isOrbittedBy]) => [isOrbittedBy, isOrbitted]),
);
... | true |
af0f2094e1411e3c80bdadba21056e7c2781345a | JavaScript | AyyoubeChabih/Javascript-SPA-Training | /js/dao/DAO.js | UTF-8 | 301 | 2.75 | 3 | [] | no_license | function DAO(biblio) {
this.biblio = biblio;
}
DAO.prototype.insertBook = function(book) {
this.biblio.addBook(book);
return true;
};
DAO.prototype.books = function() {
return this.biblio.allBooks();
};
DAO.prototype.search = function(keyword) {
return this.biblio.searchByKeyword(keyword);
}; | true |
67d23d35549c660b579bce0689682b2006cea293 | JavaScript | immune-js/immune | /src/types/array/__tests__/array--get-in.test.js | UTF-8 | 1,529 | 2.59375 | 3 | [
"MIT"
] | permissive | import
{ Maybe
, getIn
, equals
} from "../../.."
test("it should return the original collection wrapped in a Some when given an empty path", () => {
expect(equals(getIn([ 1, { y: { z: 1 } } ], []), Maybe.Some([ 1, { y: { z: 1 } } ]))).toBe(true)
})
test("it should return the value wrapped in a Some if on... | true |
a38c983a3057b83f1a6b933ae51b46f1ad023040 | JavaScript | chrisli4/project_fideligard_spa | /client/src/helpers/trade.js | UTF-8 | 722 | 2.84375 | 3 | [] | no_license | const toNum = (str) => {
return parseInt(str, 10);
}
const toFloat = (str) => {
return parseFloat(str);
}
const computeCost = (quantity, price) => {
return (toNum(quantity) * toNum(price)).toFixed(2)
}
const verifyBuy = (balance, cost) => {
return buyBalance(balance, cost) >= 0;
}
const verifySell = (portfolio,... | true |
0dbb5ee12d23400109d5f375991fe20cc9c8abcd | JavaScript | Pedro98nt/Pixel-Platformer-Engine | /main.js | UTF-8 | 10,154 | 2.6875 | 3 | [] | no_license | /*
This engine is still really scuffed!
Stuff that I will add eventually (maybe)...
- Asset loading instead of hard-coding
- Cleaning up the 'level' object format
- Cleaning up the 'animations' object format
- Implementing CLIPPING (this one is super important)
- Other dynamic objects
- Actually readabl... | true |
5f4cb43ae00eef90c8291bf8772c6ca6ee786bce | JavaScript | EmadIbrahimm/konexio_js | /day08/map6.js | UTF-8 | 245 | 3.515625 | 4 | [] | no_license | var arr = [{
firstName: 'Daniel',
surname: 'Beckham'
},
{
firstName: 'David',
surname: 'Craig'
}]
console.log(arr)
arr2 = arr
arr2 = arr2.map(function(arr2) {
return arr2.firstName +" "+ arr2.surname
})
console.log(arr2) | true |
f3b89aeefc52bc2ccf5c15feb85c4f337403a157 | JavaScript | yarishb/Algorithms_and_Data_Structures | /4. searchingAlgorithms/KMPsearch.js | UTF-8 | 1,945 | 3.53125 | 4 | [] | no_license | // Time Complexity - O(n + m)
// Space complexity - O(n)
function arrayPatternUtil(pattern){
const arrayPattern = [];
let prefix = 0;
let sufix = 1;
while(arrayPattern.length < pattern.length){
if(pattern[prefix] === pattern[sufix]){
arrayPattern.push(prefix + 1)
... | true |
0fa980a36d06f5adf0be5db4ed963c8a0a10e0cb | JavaScript | yotammos/mep-fe | /src/containers/EntryContainer.jsx | UTF-8 | 2,696 | 2.53125 | 3 | [] | no_license | import React from 'react'
import '../App.css'
import logo from '../logo.svg'
import Dropdown from 'react-dropdown'
import 'react-dropdown/style.css'
const primaryHeatingSources = [
'Natural Gas', 'Electricity', 'Fuel Oil', 'Propane'
]
class EntryContainer extends React.Component {
constructor(props... | true |
2952b7a83df288361545ef16638e805365ced4e7 | JavaScript | Luryy/NodeJs | /module-http/making-requests.js | UTF-8 | 1,227 | 2.625 | 3 | [
"MIT"
] | permissive | import https from 'https'
import { setTimeout } from 'timers/promises'
console.log('Making a GET request:\n');
const options = {
hostname: 'api.github.com',
port: 443,
path: '/users/luryy',
method: 'GET',
headers: {'user-agent': 'node.js'}
}
const req = https.request(options, res => {
console.log(`status... | true |
ec3a33a1724a7bf1c14c6cf5106c042cc190dfba | JavaScript | karem-mohamed/weather-app | /src/utils/forcast.js | UTF-8 | 628 | 2.609375 | 3 | [] | no_license | const request =require("request");
const forcast=(latitude,longitude,callback)=>{
const url=`https://api.darksky.net/forecast/b3dcf2e5da682cab70160acca2c7b9e9/${latitude},${longitude}`
request({url:url,json:true},(err,res)=>{
if(err){
callback(err+"unable connect to server",undefined)
}... | true |
8fb6f1047ab72aaa5ec8255c70215e546f4f21d1 | JavaScript | abhishekDeshmukh74/code-signal-challenges | /arcade/intro/level9/growing-plant/index.js | UTF-8 | 530 | 3.34375 | 3 | [] | no_license | function growingPlant(upSpeed, downSpeed, desiredHeight) {
let currentHeight = 0
let day = 0
while (currentHeight < desiredHeight) {
day++
currentHeight += upSpeed
if (currentHeight >= desiredHeight) break;
currentHeight -= downSpeed
}
return day
}
// Best Solution
... | true |
615dc601500deb88ab84c896df4134a8cf1fbbdc | JavaScript | Flandre/lifeCheater | /src/property.js | UTF-8 | 7,803 | 2.734375 | 3 | [
"MIT"
] | permissive | import { clone } from './functions/util.js';
class Property {
constructor() {}
TYPES = {
AGE: "AGE",
CHR: "CHR",
INT: "INT",
STR: "STR",
MNY: "MNY",
SPR: "SPR",
LIF: "LIF",
TLT: "TLT",
EVT: "EVT",
};
#ageData;
#data;
#rec... | true |
4668513948019df820cd0d16375d682f0ce27bb5 | JavaScript | kartuliny/tekton-lab-music-studio | /public/js/rooms.js | UTF-8 | 5,283 | 2.625 | 3 | [
"MIT"
] | permissive | $(function(){
var url = location.protocol + "//" + location.host+"/sala/room";
//EDITAR CLIENTE
$(document).on('click','.editRoom',function(){
var id_room = $(this).val();
$.get(url+ '/' + id_room+'/edit', function (data){
console.log(data);
$('#room_id').val(data.id);
... | true |
13e30c1088ba001ab78e9dd031960ffa8d5e469c | JavaScript | mauricionero/misticalia-rpg | /public/models/adventure.js | UTF-8 | 2,582 | 2.65625 | 3 | [] | no_license | class Adventure extends RModel {
static get EMOJI_MAIN () { return '🌎' };
static get EMOJI_ADD () { return '➕' };
static get EMOJI_OPEN () { return '📂' };
static get ROLE_UNDEFINED () { return 0 };
static get ROLE_PLAYER () { return 1 };
static get ROLE_MASTER () { return 2 };
static get EMOJI_ROLE_PLAYE... | true |
d9c7419b8e3cf50c49e01bf2aa166b1b79b5ff00 | JavaScript | hansenjl/110419FT-quarantine-app-pt2 | /src/ItemForm.js | UTF-8 | 1,402 | 2.671875 | 3 | [] | no_license | import React from 'react'
// import {withRouter} from 'react-router-dom'
class ItemForm extends React.Component{
state={
name: "",
price: "",
image1: "",
image2: ""
}
handleChange = (e) => {
this.setState({
[e.target.name]: e.target.value
})
}
handleSubmit = (e) => {
e.pre... | true |
8d89ac5cb7b660ca158712c2e7bcb87e1ee24e49 | JavaScript | terencelimsayjian/bullseye | /script.js | UTF-8 | 4,365 | 3.046875 | 3 | [] | no_license | $(document).ready(function () {
var canvas = document.getElementById('canvas')
var context = canvas.getContext('2d')
var raf
var moving = false
var ball = {
aim: {
centerX: 50,
centerY: 550,
noOfSlices: 44,
sliceIndex: 22,
speed: 33,
circX: function () {
return... | true |
24e66ae210d57fd136c53234ec6812cc7860baf1 | JavaScript | rebeccamanzi/arrays | /iterar/foreach.js | UTF-8 | 717 | 4.375 | 4 | [] | no_license | const arr = [1,2,3,4,5];
arr.forEach((value, index) => {
console.log(`Elemento # ${index}: ${value}`);
});
/*
Elemento # 0: 1
Elemento # 1: 2
Elemento # 2: 3
Elemento # 3: 4
Elemento # 4: 5
*/
//value -> cada valor do arr
//index -> posição
const frutas = ['morango', 'uva', 'banana', 'abacaxi'];
frutas.forEac... | true |
ec64802d304e64a6cb42365d44d6c672e3cc7942 | JavaScript | Jagtap-Shantanu/Leave-Application | /services/auth.js | UTF-8 | 9,540 | 2.609375 | 3 | [] | no_license | const jwt = require("jsonwebtoken")
const LeaveModel = require("../leaves/leave.model")
const UserModel = require("../users/user.model")
const mailer = require("./mailer")
const isAuthorised = (req, res, next) => {
const loginToken = req.headers["logintoken"]
console.log("<<<<<<<<<<<<<<<<<<<<<<<<<<<", loginTok... | true |
d5bbdefc8f21874e5b023c42a8fd763e12422667 | JavaScript | daveonhols/advent2016 | /d11/tests/test.js | UTF-8 | 2,354 | 2.71875 | 3 | [] | no_license | var expect = require("chai").expect;
var d11 = require("../d11.js");
it("d11 scores", function() {
expect(d11.score([ [], [], [], [] ])).to.equal(0);
expect(d11.score([ [], [1, 1], [], [] ])).to.equal(2);
expect(d11.score([ [], [], [2, 3], [] ])).to.equal(4);
expect(d11.score([ [], [1, 2], [3], [4, 5] ]... | true |
c7efc415c9c4dd9f0ca0db5cda3f8a2452b8884b | JavaScript | dkeeghan/dk-offscreen | /src/dk-offscreen-toggle.js | UTF-8 | 2,909 | 2.6875 | 3 | [
"BSD-3-Clause"
] | permissive | /**
* @license
* Copyright (c) 2020 Deloitte Digital AU. All rights reserved.
* This code may only be used under the BSD style license found at /LICENSE
*/
import { LitElement } from 'lit-element';
import { CLASSES, EVENTS } from './_options.js';
/**
* Toggle Button that controls the <dk-offscreen> container and ... | true |
4177a13bc8f61c9fdc267123d0bf6a86d5df5917 | JavaScript | ZupIT/charlescd | /samples/circles/app/app.js | UTF-8 | 2,235 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | function getHeaders() {
return new Headers({
'Content-Type': 'application/json',
'Authorization': document.querySelector('#auth-url').value,
'x-workspace-id': document.querySelector('#workspace-id').value
});
}
function getBody() {
try {
errorMessage('');
const body = document.querySelector('... | true |
abde038d6e681ee275fe9402bf142cac5e9be3d6 | JavaScript | TRIPTYK/nfw-cli | /scripts/buildDoc.js | UTF-8 | 2,631 | 2.5625 | 3 | [] | no_license | const { readdirSync, writeFileSync } = require("fs");
const { join } = require("path");
const { CommandsRegistry } = require("../dist/application/CommandsRegistry");
const md = require("md-writer");
const chalk = require("chalk");
const { execSync } = require("child_process");
try {
const docPath = join(process.cw... | true |
a37dbe7bea94f4c3f0744a0c2f44b5594ee18f70 | JavaScript | jonocastleton/WorldRunners1.0 | /js/prefabs/world/MonsterSpawner.js | UTF-8 | 1,228 | 2.53125 | 3 | [] | no_license | var WR = WR || {};
WR.MonsterSpawner = function (game_state, name, position, properties) {
"use strict";
WR.Prefab.call(this, game_state, name, position, properties);
this.anchor.setTo(0.5);
// We need to enable physics on the monster
this.game_state.game.physics.arcade.enable(this);
this.bo... | true |
20c927d56aa71ec40ba4c51c0a952f2901c1cfff | JavaScript | maxine-ellah/my-first-react | /index.js | UTF-8 | 616 | 2.578125 | 3 | [] | no_license | import React from 'react'
import { render } from 'react-dom'
import App from './components/app'
class HellosNumbers extends React.Component {
constructor(props) {
super(props)
this.state = { count: 0 }
}
render() {
return (
<div>
<h1> hey {this.props.name} </h1>
<h3 onClick = ... | true |
614c86cb7830fc952250cb2977356db624549f6b | JavaScript | Ruth-zon/Calendar-of-Events | /project/classes.js | UTF-8 | 4,800 | 2.890625 | 3 | [] | no_license | class Book {
constructor(id, name, auther, yearCreate, numLoansPossible) {
this.id = id;
this.name = name;
this.auther = auther;
this.loanDate = null;
this.isFree = true;
this.yearCreate = yearCreate;
this.isAvailable = true;
this.numLoansPossible = n... | true |
ec123edb075655ac495d2edcfe27d7d46190818b | JavaScript | octocato/atom | /spec/syntax-scope-map-spec.js | UTF-8 | 2,884 | 2.734375 | 3 | [
"MIT"
] | permissive | const SyntaxScopeMap = require('../src/syntax-scope-map');
describe('SyntaxScopeMap', () => {
it('can match immediate child selectors', () => {
const map = new SyntaxScopeMap({
'a > b > c': 'x',
'b > c': 'y',
c: 'z'
});
expect(map.get(['a', 'b', 'c'], [0, 0, 0])).toBe('x');
expect(... | true |
0a48491a4c1d58bae02bdb6e16ace275fb6743bf | JavaScript | Edu-Kobus/Introducao-a-programacao-WEB | /aulajs/operadores.js | UTF-8 | 991 | 4 | 4 | [
"MIT"
] | permissive | /* =================================
OPERADORES DE COMPARAÇÃO
=== Igual e do mesmo tipo
!= Diferente de
!== Diferente, inclusive do tipo
====================================
*/
console.log(4 =="4") //true
console.log(4 === "4") //false
console.log(4 !== "4") //true
console.log(4 != "4") //false
//OBS: MESMO T... | true |
b97b9ad950440a6475b35ac3e3058a6145c6b8f5 | JavaScript | influentialpublishers/pimp-my-sql | /test/lib/json-parse.spec.js | UTF-8 | 768 | 2.546875 | 3 | [
"MIT"
] | permissive | /*eslint-env node, mocha*/
const { expect } = require('chai');
const parser = require('../../lib/json-parse');
describe('lib/json-parse.js', function() {
describe('::transform', function() {
it('should transform a JSON: key value to an parsed JSON object',
() => {
const test_json_object = {
... | true |
0a25d041e617f05b1321b647d0d9c7661a7eef6c | JavaScript | d9nny/thermostat | /public/js/interface.js | UTF-8 | 1,754 | 2.8125 | 3 | [
"MIT"
] | permissive |
$(document).ready(function() {
var thermostat = new Thermostat();
updateTemp();
var country;
var city;
var temperature;
var url;
$.getJSON('http://api.wunderground.com/api/831aa92990911190/geolookup/q/autoip.json', function(data) {
country = data.location.country;
city = data.location.city;
url =... | true |
b98e1d933a19f3d086d8b60655701d68f984b69c | JavaScript | xingkong15920/webproject | /Projectpage/shanghu-old/js/biao/jiucan.js | UTF-8 | 1,104 | 2.546875 | 3 | [] | no_license | // 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('jiucan'));
// 指定图表的配置项和数据
var option = {
title: {
text: '今日交易金额'
},
tooltip: {
trigger: 'item',
formatter: "{b}: {c} 元"
},
legend: {
orient: 'vertical',
x: 'right',
data: ['微信', '支付宝']
},
series: [{
name: '交易金额',
type... | true |
4c9908326008b4ac814420efce9f2cec8f9f6aef | JavaScript | gufranco/pegasus | /source/helpers/S3Helper.js | UTF-8 | 2,340 | 2.765625 | 3 | [
"MIT"
] | permissive | const AWS = require('aws-sdk');
const fs = require('fs');
module.exports = (() => {
let s3Instance = null;
return class S3Helper {
/**
* @static getInstance - Singleton que retorna o objeto de acesso ao S3
* configurado com as necessidades da aplicação.
*
* @returns {object} Instância
... | true |
db65483794b645b2867eb8cfcd696c8bc39a6268 | JavaScript | Arguggi/HyperMedia-Applications | /WEBSITE/js/getRoom.js | UTF-8 | 1,365 | 2.8125 | 3 | [] | no_license | $( document ).ready(function() {
getDBTable("room", 2, function(room) {
if (typeof room == 'string' || room instanceof String) {
console.log("Error while getting database data");
} else {
var roomList="";
for(var i=0;i<room.length;i++){
$("#roomLi... | true |
b632cfb5e2e73fc286001173e8221bd7794ff4d1 | JavaScript | buqieryu/FirstAddress | /4.8/5.31/lufylegend-api (1)/zh_CN/display/LBitmap.js | UTF-8 | 7,032 | 2.96875 | 3 | [] | no_license | /** @language chinese
* 初始化 LBitmap 对象以引用指定的 LBitmapData 对象。
* LBitmap 类表示用于表示位图图像的显示对象。这些图像可以是使用 LLoader 类加载的图像,也可以是使用 LBitmap() 构造函数创建的图像。
* 利用 LBitmap() 构造函数,可以创建包含对 LBitmapData 对象的引用的 LBitmap 对象。创建了 LBitmap 对象后,使用父实例的 addChild() 或 addChildAt() 方法将位图放在显示列表中。
* 一个 LBitmap 对象可在若干 LBitmap 对象之中共享其 LBitmapData 引用... | true |
216f8f3088f3c1d1d8271a468f64f08162e63021 | JavaScript | nehanisarkhan/js-learning | /basic data structures/index5.js | UTF-8 | 520 | 3.015625 | 3 | [] | no_license | let userActivity = {
id: 23894201352,
date: "January 1, 2017",
data: {
totalUsers: 51,
online: 42,
},
};
userActivity.data.online = 45;
console.log(userActivity);
function sequentialSizes(val) {
var answer = "";
switch (val) {
case 1:
case 2:
case 3:
answer = "Low";
break;
... | true |
ccd8a2e61ac6589652f5df72c6976e06df3efc7a | JavaScript | ysq931025/shihudong | /h5用户调查表/wenjuan/js/index.js | UTF-8 | 1,034 | 3.015625 | 3 | [] | no_license |
document.getElementsByTagName('html')[0].style.fontSize = window.innerWidth / 12 + "px";
function checboxNum(name, num) {
var checboxs = document.getElementsByName(name);
var a = 0;
for (var index = 0; index < checboxs.length; index++) {
if (checboxs[index].checked) {
a = a + 1;
}
}
if (a == num)... | true |
a0da27f7882bf17d326e76b58586a50bd9eb9b88 | JavaScript | livash/AppAcademy_work | /w6d6/two_sum.js | UTF-8 | 359 | 3.6875 | 4 | [] | no_license | function twoSum(array) {
var resArray = [];
for(var i = 0; i < array.length - 1; i++) {
for(var j = i + 1; j < array.length; j++) {
if ((array[i] + array[j]) === 0) {
var pair = [i, j];
resArray.push(pair);
}
}
}
return resArray;
}
console.log(twoSum([5,1,-7,-5]));
console.log(twoSum([5,-1,-5,1... | true |
d8240704983e70fc47a3214f974e16984304f591 | JavaScript | CelineChow/fyp-frontend | /src/components/usersidecomponents/ProductSidebar.jsx | UTF-8 | 4,414 | 2.75 | 3 | [] | no_license | import React, {useState,useEffect} from 'react'
import {Accordion} from 'react-bootstrap';
import { Link } from "react-router-dom";
import '../css/sidebar.css'
function ProductSidebar({pcat,psubcat}) {
const [catArray,setCatArray]=useState(pcat);
const [subcatArray,setSubcatArray]=useState(psubcat);
c... | true |
b7d17503c0ec99130efe1e0e36df201ab53e1492 | JavaScript | Felipe91v/jogo-da-velha | /jogodavelha.js | UTF-8 | 2,898 | 3.609375 | 4 | [] | no_license | //criando tabuleiro com 9 casas
let tabuleiro = document.querySelector("div#tabuleiro")
for(let contador = 0; contador <= 8; contador++){
let casa = document.createElement("div")
casa.className = "casa"
casa.setAttribute ("jogada", "")
casa.id = `casa${contador}`
tabuleiro.appendChild(casa)
cas... | true |
6fc7a599bd6ee3c19d07acde5658979b6bfaaa69 | JavaScript | avolotovskii/1129619-cinemaddict-12 | /src/presenter/movie-controller.js | UTF-8 | 5,011 | 2.59375 | 3 | [] | no_license | import FilmCard from "../view/film-card.js";
import FilmDetails from "../view/popup-film-details.js";
import {render, remove, replace, RenderPosition} from "../utils/render.js";
const Mode = {
DEFAULT: `default`,
DETAILS: `details`,
};
const body = document.querySelector(`body`);
export default class MovieContro... | true |
629ed6a01134408fc92c0769bd070e7c7d4fe43d | JavaScript | livelybone/gobang | /js/component/computer.js | UTF-8 | 3,105 | 3.1875 | 3 | [] | no_license | /**
* Created by Livelybone on 2017-12-17.
*/
define(['component/player', 'component/chessboard', 'utils/win-dictionary', 'component/role'], function (Player, chessboard, winDictionary, Role) {
function Computer(name, role) {
// opponent: Player实例化对象
// 继承 Player 对象
Player.apply(this, [name, role]);
... | true |