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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
00c2965f9150e94cdd77f4fe6f0ea26bf23bb101 | JavaScript | duncantl/AutoClose | /SaveToSignedDocs/background.js | UTF-8 | 4,923 | 2.578125 | 3 | [] | no_license | browser.contextMenus.create({
id: "OGS Signed Docs",
title: "Save to Signed Docs",
contexts: ["link"]
});
browser.contextMenus.onClicked.addListener(saveToSignedDocs);//XXX change back to saveToSignedDocs
// checking what ?
function saveToSignedDocs2(info, tab)
{
console.log("info " + JSON.stringify... | true |
165f9b4ddc770a4a4dedb05802e90671a09c42c6 | JavaScript | damienaicheh/azure-devops-mobile-versioning | /tasks/UpdateAndroidVersionGradleTask/update-android-version-gradle.js | UTF-8 | 2,830 | 2.578125 | 3 | [
"MIT"
] | permissive | "use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { t... | true |
2277b5081fb45f7c94a65714bcc88fa5f0b8ff57 | JavaScript | dnewbie25/dnewbie25.github.io | /Udemy-Courses/Net Ninja Javascript/Objects/objects.js | UTF-8 | 772 | 3.921875 | 4 | [] | no_license | //object literal. You can even add functions as values
let user = {
name: 'Crystal',
age: 30,
email: 'crystal3@netninja.com',
location: 'Berlin',
/* blogs: ['history of america but not US', 'how to grow kids'], */
blogs: [
//An array of objects
{title: 'history of america but not US', likes: 30,},
... | true |
29cefb4465ffae106981a7d58ca3b2d9d3673458 | JavaScript | codelife101/preciousClues | /script.js | UTF-8 | 1,042 | 2.765625 | 3 | [] | no_license | function submit(){
var x = document.forms["rapCode"]["rapAnswer"].value;
if (x.length < 1) {
alert("gum on ya need to complete the rap");
}
else if (x.toLowerCase() =="jakecode"){
$(".rapContainer").css("display","none");
$(".treeContainer").css("display","flex");
} else{
alert("gum on ya need to ... | true |
0beda9ec85d0e1c3de2aa325fa40d1d7627062a2 | JavaScript | RodGW13/Agenda-Asistencia-Social | /Scripts/Capredena.Scripts/validaciones.js | UTF-8 | 17,612 | 2.859375 | 3 | [] | no_license | ////////FUNCIONES GLOBALES
//formatea RUT
function checkFields(objTextoStrRut, objTextoRut) {
// Validacion de todos los elementos del formulario
rut = rut;
if( rut == 0 ){
}
else {
var rut = objTextoStrRut.value;
var tmpstr = "";
for ( i=0; i < rut.length ; i++ )
if ( rut.charAt(i) != ' ' && rut.c... | true |
0b85eb33c0ae4ea8fc277ae043cf045ed1a992fb | JavaScript | Cristopher-Martinez/alejandro-magno.github.io | /js/script.js | UTF-8 | 2,218 | 3.515625 | 4 | [] | no_license | let computadoraEleccion;
let usuarioEleccion;
let mensaje = document.getElementById('mensaje');
//Variables enteras -- Se manejan como numeros.
let ganadas = 0;
let perdidas = 0;
let empate = 0;
opcion = ({id})=> {
ComputadoraOpcion();
QuienGano(computadoraEleccion,id);
estadisticas()
}
Comput... | true |
78f467af50ac382efafa54b026f8b02ea900324d | JavaScript | enstem/crm | /NEW CRM FILES (1)/Backup/javascripts/xeditable-test.js | UTF-8 | 4,422 | 2.640625 | 3 | [] | no_license | $(function () {
// $(".editable-form #name").editable();
$(".editable-form #number2").editable({
type: 'text',
validate: function(value) {
if ($.isNumeric(value) == '') {
return 'Only numbers are allowed';
}
}
});
$(".editable-form #number... | true |
141b79b70c58dfd82d9a83884cec7103eccbd90c | JavaScript | Rajalakshmi001/DS_Algo | /src/Leetcode/isPalindrome.js | UTF-8 | 531 | 3.671875 | 4 | [] | no_license | var isPalindrome = function(s) {
if (s === "") return true;
let regex = /\w+/gi;
let matches = s.match(regex);
if (matches.length) {
matches = matches
.join("")
.toLowerCase()
.split("");
} else return false;
console.log(matches);
let start = 0,
end = matches.length - 1;
while ... | true |
d73ac8d9cff7e2007735593e5b75eb87d9e66ccb | JavaScript | sophiaorlando/hourlyWeatherApp | /src/components/PieDay2/index.js | UTF-8 | 1,469 | 2.609375 | 3 | [
"MIT"
] | permissive | import React, { useEffect, useState } from 'react';
import {Pie} from 'react-chartjs-2';
import moment from 'moment'
export default function Pies (props){
const [pieData, setPieData] = useState({})
useEffect(() => {
let pieChart= {
labels: ['sunlight (hrs)', "nighttime (hrs)", "twilight (hrs)", "dawn ... | true |
973c3bf3811ccc89de371e6c313808cc614f330c | JavaScript | gauravsoni1/easy-react-datepicker | /src/datepicker/datepicker.js | UTF-8 | 3,100 | 2.796875 | 3 | [] | no_license | import React, { Component } from "react";
import moment from "moment";
import './datepicker.css';
import Days from "./days";
import DatepickerHeader from "./datepickerHeader";
class DatePicker extends Component {
componentDidMount(){
if (this.props.selectedDate){
this.setState({selectedDate:this.props.sel... | true |
6d77eb5eb6ae9f53f6fe3b219aad9def2745ddf1 | JavaScript | yanglichuan/IOSWebViewNew | /01-JS的DOM操作(了解)/js/index.js | UTF-8 | 1,245 | 3.625 | 4 | [] | no_license | // 把内容塞到body中
//document.write('hahahahha');
//document.write('<div style="color:red;">123</div>');
//alert(document.body.childNodes.length);
var list = document.body.childNodes;
var len = document.body.childNodes.length;
//alert(len);
//for(var i = 0; i<len; i++) {
// var ele = list[i];
// alert(ele.tagName);... | true |
04ceb373c75ec07911b6db0cc18142fd07002dc3 | JavaScript | edwinKR/computer-science | /Problems/intersection_of_two_arrays_II.js | UTF-8 | 482 | 3.6875 | 4 | [] | no_license | // Time complexity: O(n + m)
var intersect = function(nums1, nums2) {
const map = new Map();
for (const num of nums1) {
if (map.has(num)) {
map.set(num, map.get(num) + 1);
} else {
map.set(num, 1);
}
}
const result = [];
for (const num of nums2) {
if (map.has(num) && map.get(num) ... | true |
7a978475e51fd65553380692e30e629ee984dbef | JavaScript | sjshank/My-Awesome-DAPP | /DAPP-5/test/sampleContractTest.js | UTF-8 | 689 | 2.640625 | 3 | [] | no_license | const SampleContract = artifacts.require("SampleContract");
contract('SampleContract', () => {
it('Should deploy sample contract', async () => {
const sContract = await SampleContract.deployed();
assert(sContract.address != '');
});
it('Should add 2 numbers', async () => {
const sC... | true |
aef35a4720772af321e30680ea012ad9b479f028 | JavaScript | Ceyh4n/reduxCounter | /javascript/01-Length Counter - Project/script.js | UTF-8 | 625 | 4.15625 | 4 | [] | no_license |
const calculateCharacter = () =>{
//most retweeted tweet - tweeted by Obama.
let tweet = "No one is born hating another person because of the color of his skin or background or religion.";
//number of character assigned to tweetcount variable
let tweetcount = tweet.length;
//number of character allowance assigned... | true |
aef7fa2231d393255bbc6abc381cd89da0d5100e | JavaScript | Cesarla/CursoHtml5 | /DnD 1/js/site.js | UTF-8 | 926 | 2.8125 | 3 | [] | no_license | $().ready(function() {
var monster = document.getElementById("monster");
var manzana = document.getElementById("manzana").src;
var pera= document.getElementById("pera").src;
var platano = document.getElementById("platano").src;
var galleta = document.getElementById("galleta").src;
monster.addEventListener("drag... | true |
e0b3023b38618b3e39bdfbe2de92e397c34e057b | JavaScript | MrIronManFe/Daily_Question | /20210104_to_20210110/day44_20210104.js | UTF-8 | 1,347 | 4.21875 | 4 | [] | no_license | [1, 2, 3, 4].reduce((x, y) => console.log(x, y));
/*
1,2
2,3
3,4
4,null
// 答案
1 2 undefined 3 undefined 4
// 解析
`reducer` 的callback函数接收4个参数:
1. Accumulator (acc) (累计器)
2. Current Value (cur) (当前值)
3. Current Index (idx) (当前索引)
4. Source Array (src) (源数组)
`reducer` 的callback函数的返回值将会分配给累计器,该返回值在数组的每个迭代中被记住,并最后成为最终... | true |
9e786f1c45b0effd21826e241d3103bb90bbaf77 | JavaScript | pratham1002/bluff-2 | /server/game/users.js | UTF-8 | 1,907 | 3.015625 | 3 | [] | no_license | /* eslint-disable no-unused-vars */
const Player = require('./Player')
const Game = require('./Game')
const games = []
const users = []
/**
* @param {string} name
* @returns {Game}
*/
const getGame = (name) => {
return games.find(game => game.name === name)
}
/**
* @param {string} id
* @param {string} usernam... | true |
ef90353e4e573d76f59f600ac723c9373f92480e | JavaScript | partyck/SoundToolKit | /src/public/javascripts/midiSettings/settings.js | UTF-8 | 217 | 2.515625 | 3 | [] | no_license | let socket = io.connect();
let accOn = false;
let ax = 0;
let ay = 0;
let az = 0;
socket.on('graphic', function (data) {
console.log('llega!', data);
accOn = true;
ax = data.x;
ay = data.y;
az = data.z;
}); | true |
3a4639c6c2bfc445e602fa51d44d3d75490839fe | JavaScript | abhishekdu-tagline/exam_demo | /src/redux/actions/studentAction.js | UTF-8 | 3,804 | 2.609375 | 3 | [] | no_license | import axios from "axios";
import {
EXAMS,
ONCHANGE,
STUDENT_PROFILE,
UPDATE_PROFILE,
VIEW_EXAM_PAPER,
} from "../constaints/constaint";
const token = localStorage.getItem("jwt");
console.log(token);
const examHeaders = {
"Content-Type": "application/json",
"access-token": token,
};
/// View Student Ex... | true |
4ac7b27856a139ddf950b0726f7a00829b40943a | JavaScript | liut2/d3-data-visualizations | /randomPoints.js | UTF-8 | 2,348 | 3.609375 | 4 | [] | no_license | // Part of a brief D3 tutorial
// Upon completion, will draw random circles of different colors to an SVG.
// CS 314, Spring 2017
// Eric Alexander
// Define some variables that will control the image being drawn.
var svgWidth = 400;
var svgHeight = 400;
var buffer = 10;
var numPoints = 20;
var minRadius = 5... | true |
a3e097dffdd096f303f536d6dd51f347d4553f48 | JavaScript | Institute-FVV/streetmix | /assets/scripts/segments/__tests__/resizing.test.js | UTF-8 | 1,868 | 2.65625 | 3 | [
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /* eslint-env jest */
import { normalizeSegmentWidth, normalizeAllSegmentWidths, resolutionForResizeType } from '../resizing'
describe('normalizeSegmentWidth', () => {
it('constrains to minimum segment width', () => {
expect(normalizeSegmentWidth(0.1, 0.25)).toBe(0.75)
})
it('constrains to maximum segment w... | true |
2ee53713c35f171f1e55105b26e0e1014891b6d8 | JavaScript | ChaoticWyrme/subscription-tracker | /combine/frontend/js/homescript.js | UTF-8 | 3,525 | 2.96875 | 3 | [] | no_license |
let subs = [];
//make the subscription boxes
//async function makesubboxes(){
const makesubboxes = async () => {
console.log("before");
let storage = await browser.storage.local.get(["subList"]);
let subList = storage["subList"] || [];
console.log(subList);
document.getElementById("subscriptions... | true |
65de9dee4572885a23b8587f23bf88ee5df65ae2 | JavaScript | wakoliVotes/Alarm-Clock-Web-App | /alarm.js | UTF-8 | 2,590 | 3.296875 | 3 | [] | no_license | /*jslint es6:true*/
// Alarm Clock Initialization
function init() {
// Getting current hours, minutes and seconds
ac.currenthr = document.getElementById("current-hr");
ac.currentmin = document.getElementById("current-min");
ac.currentsec = document.getElementById("current-sec");
// Creat... | true |
08583fbce630b3b85b7adb96e3e6409321f124d8 | JavaScript | DmytroZhigulin/JS-Practice | /HW4/JS/Second1.js | UTF-8 | 725 | 3.375 | 3 | [] | no_license | let Arr = [16,-37,54,-4,72,-56,47,4,-16,25,-37,46,4,-51,27,-63,4,-54,76,-4,12,-35,4,47];
document.write('</p>' + Arr + '</p>');
document.write('</p>' + Arr.sort() + '</p>')
let posArr = [],
negArr = [];
let indexN;
for (indexN = 0; indexN < Arr.length; indexN++) {
console.log(Arr[indexN]);
if (Arr[in... | true |
1c6514461cbcc97882aff1e774efae1097293a7a | JavaScript | hossameldeen/gpa-fcicu | /backend/GPACalculator.js | UTF-8 | 1,173 | 2.890625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | // Assumes it's correct
function calculateGPAFromResult(result) {
var points = {'A+': 4.0, 'A': 3.7, 'B+': 3.3, 'B': 3.0, 'C+': 2.7, 'C': 2.4,
'D+': 2.2, 'D': 2.0, 'F': 0.0};
var grades = {}; // You could fail a course, then take it again.
for (var key in result.gradeTables) {
var arr = result... | true |
6d75c89b5ca45a19c93fa414e130007b950a2ffc | JavaScript | Thinker-ljn/red-black-tree-js | /test/data-generate.js | UTF-8 | 278 | 3.140625 | 3 | [] | no_license | export default function generate (len, random = true) {
let arr = Array.from(Array(len).keys()).map(k => k + 1)
while (random && 0 != len) {
let random = Math.floor(Math.random() * len)
len--
[arr[random], arr[len]] = [arr[len], arr[random]]
}
return arr
}
| true |
6da1375ebd34d8d21f6db34734ca8d259c9e9467 | JavaScript | brunosuarez/js_funcional | /funcional/funcao_pura_1.js | UTF-8 | 423 | 4.03125 | 4 | [] | no_license | const PI = 3.14
//impura pois PI é um valor externo(mas nesse caso é algo estável)
function areaCirc(raio){
return raio * raio * PI
}
console.log(areaCirc(10))
console.log(areaCirc(10))
console.log(areaCirc(10))
//transformando a função em pura
function areaCircPura(raio, pi){
return raio * raio * PI
}
cons... | true |
5eebd14807dd562527b0b259ad0fd2120746046a | JavaScript | KaziAkibRayhan/javascript-es6 | /class.js | UTF-8 | 260 | 3.15625 | 3 | [] | no_license | class Student {
constructor(sTd,sName){
this.id = sTd;
this.name = sName;
this.college = "Dhaka College"
}
}
const student1 = new Student(15, "korim");
const student2 = new Student(20, "Johir");
console.log(student1,student2);
| true |
2589d7226afa85d27835abff854001759417c4ec | JavaScript | smrq/advent-of-code | /2018/01a.mjs | UTF-8 | 191 | 2.828125 | 3 | [] | no_license | import fs from 'fs';
const freqs = fs.readFileSync('01.txt', 'utf-8')
.trim()
.split('\n')
.map(x => parseInt(x, 10));
const result = freqs.reduce((a, b) => a + b, 0);
console.log(result); | true |
ecedcfaaba77d8356ce21bc972e2876094e0416e | JavaScript | glalev/projectEuler | /js/problems/Problem69.js | UTF-8 | 861 | 3.921875 | 4 | [] | no_license | /*
Euler's Totient function, φ(n) [sometimes called the phi function], is used to determine the number
of numbers less than n which are relatively prime to n. For example, as 1, 2, 4, 5, 7, and 8,
are all less than nine and relatively prime to nine, φ(9)=6.
It can be seen that n=6 produces a maximum n/φ(n) for n ≤ 10.... | true |
3b43872d43db50fe08e26012f7ceeb7d3df99fc5 | JavaScript | parth-p5/WeatherApp | /App.js | UTF-8 | 1,796 | 2.65625 | 3 | [] | no_license | import React from 'react';
import { StyleSheet, Text, View, ActivityIndicator } from 'react-native';
import Weather from './components/Weather';
const KEY = require('./utils/weatherAPIKey');
export default class App extends React.Component {
state = {
isLoading: true,
temperature: 20,
weatherCondition: ... | true |
1712780b00275e773af7b6b3e9e1ae3eaa673207 | JavaScript | cemolo/Gif_Tasic | /GifTastic/assets/javascript/js.js | UTF-8 | 3,301 | 3.125 | 3 | [
"MIT"
] | permissive | $(document).ready(function(){
// TOPIC/CATAGORY BUTTONS
var gifs = ['cars', 'trucks', 'boats', 'motorcycle', 'jet-ski'];
// DISPLAY BUTTONS FUNCTION=========================================================================
function displayButtons(){
$('.buttons').empty();
// $('#gifDiv').empty();
//CREATE BUTT... | true |
02db6ee790721ed7168c1d7ce3321fb96c718c1c | JavaScript | LikeLionSMU/TeamDailyWeather_Server | /daily_weather/api/contents.js | UTF-8 | 2,200 | 2.515625 | 3 | [
"MIT"
] | permissive | var Board = require('../models/board');
var express = require('express');
var router = express.Router();
var util = require('../util');
var User = require('../models/user');
var mongoose=require('mongoose');
//전체보기.
router.get('/',util.isLoggedin,function(req,res,next){
Board.find({})
.sort({created_at:-1}... | true |
817556c983d2334ab8e596b657f23f2e77aae0f1 | JavaScript | karthika768/MEARN-_Stack | /javascriptpgms/operators/operators.js | UTF-8 | 659 | 3.625 | 4 | [] | no_license | //arithmetic operators
var num=100;
var num2=200;
console.log("addition:"+(num+num2));
console.log("modulus:"+(num2%num));
//relational operators
if(num>num2)
{
console.log(num+"greater");
}
else{
console.log(num2+"greater");
}
console.log(10<20<30);
//== for content comparing "10"=10 is true
console.log("10"==... | true |
a314ee2f9d3c863e4a15856452aa481c46d26eb9 | JavaScript | kegomei/school-appraisal-system | /Route/test/initTeacher.js | UTF-8 | 1,839 | 2.515625 | 3 | [] | no_license | const { Action } = require('express-route-auto')
const Excel = require('excel-class')
const path = require('path')
const keyMap = {
'name': '姓名',
'jobNumber': '工号',
'titleLevel': '职称级别',
'department': '部门',
'jobTitle': '职称',
'teacherType': '教师类型',
'remarksLevel': '备注等级',
'jobSeries': '岗位系列',
'job': '岗... | true |
ec8d2d23ce1c0f598e7c1e4b3fe41df508499ce1 | JavaScript | rustyautoparts/bonfire-solutions | /drop-it-like-its-hot.js | UTF-8 | 357 | 3.984375 | 4 | [] | no_license | //Drop it like it's hot
//Drop the elements of an array (first argument), starting from the front, until the predicate (second argument) returns true.
function drop(arr, func) {
// Drop them elements.
while (!func(arr[0])) {
arr.shift();
if (!arr[0]) {
return arr;
}
}
return arr;
}
drop([1, 2... | true |
0ccd0b340a102642f94cc63c888031aab4915810 | JavaScript | ryan-b-writin/sonnet | /sonnet.js | UTF-8 | 852 | 4.09375 | 4 | [] | no_license | // Take the contents of the sonnet div and place it in a variable
var sonnet = document.getElementById("sonnet").innerHTML;
// Find and output the starting position of the word "orphans"
var orphans = sonnet.indexOf("orphans");
console.log("orphan index is a good metal band name", orphans);
// Output the number of c... | true |
3dfada3aee7fc777b34e2b02dc06c573a3219367 | JavaScript | MrWr1t3r/Spam-Ham | /spam.js | UTF-8 | 475 | 3.078125 | 3 | [] | no_license | let fs = require('fs');
let getCategory = (line) => line.startsWith('ham') ? 'ham' : 'spam';
fs.readFileSync('spam.csv')
.toString()
.split(/\r?\n/)
.forEach(function(line){
let category = getCategory(line);
console.log(category);
line = line.substring(category.length + 1)
... | true |
ee6441624cfba463af5ca2351033f7d53220e376 | JavaScript | NevilDabre/star-wars | /src/components/Characters.js | UTF-8 | 2,957 | 2.578125 | 3 | [] | no_license |
import React, { useEffect, useState } from 'react';
import { connect } from 'react-redux';
import { FormControl, InputLabel, Select, MenuItem, FormHelperText } from '@material-ui/core'
import { makeStyles } from '@material-ui/core/styles';
const useStyles = makeStyles((theme) => ({
formControl: {
margin: ... | true |
4217d05ca12229cccf33fa4dd8842ca761d03b25 | JavaScript | deprecated-hongbiii/algorithm | /codility/binaryGap.js | UTF-8 | 687 | 3.90625 | 4 | [] | no_license | // you can write to stdout for debugging purposes, e.g.
// console.log('this is a debug message');
function solution(N) {
// write your code in JavaScript (Node.js 8.9.4)
// 정수 N을 이진수로 바꾼다.
const bin = N.toString(2);
const oneIdxs = bin
.split('')
.map((bit, i) => {
if (bit === '1') {
ret... | true |
a9cafbaa55cad27b6a64d071177abe3970676672 | JavaScript | NLanese/Project-05-StickFigureBattler | /src/helpers/oppMoveSelection.js | UTF-8 | 594 | 2.78125 | 3 | [] | no_license | export default function makeOppMoveSelection(opp){
let cooled = opp.moves.map( (move) => {
if (move.tillCooldown == 0){
return move
}
})
if (opp.hp < 50 ){
cooled.forEach(element => {
if (element.dmg < 0){
return element
}
}... | true |
04521ee65a2feac6d8ca07c0ecab0d2d2bcd818c | JavaScript | TaylorWilton/structure-visualiser | /js/app.js | UTF-8 | 13,467 | 2.96875 | 3 | [] | no_license | // global variables for ThreeJS
var scene, camera, light, renderer, controls, MAXANISO;
var canvasOnScreen = false;
var progressAmount = 0;
var spinnerText = document.getElementById("spinner-text");
/**
* Init will create all the required elements for this project to work
*/
function init() {
// new scene, camera... | true |
6a2726409788465360859ed681ab27dc57d169f4 | JavaScript | cliffano/health | /lib/result.js | UTF-8 | 3,402 | 2.84375 | 3 | [
"MIT"
] | permissive | const SUCCESS = 'success',
FAIL = 'fail',
ERROR = 'error',
WARNING = 'warning',
COLORS = {
success: 'green',
fail: 'red',
error: 'red',
warning: 'yellow'
};
function Result() {
this.status = undefined;
this.desc = undefined;
this.uri = undefined;
this.timestamp = undefined;
this.d... | true |
4b2cfa9db4c1d71bf4339118149150c97b0fe375 | JavaScript | diogoX451/javaScript | /modulo1/secondProgram.js | UTF-8 | 184 | 3.0625 | 3 | [] | no_license | //Console.log("Trabalhando com variáveis");
console.log("Trabalhando com variáveis");
//JS é case sensitive
const idade = 17;
const nome = "Diogo";
//não fazer
//mes = "Janeiro"; | true |
8348631038653e75f937e14226b524e20e5ea8f5 | JavaScript | ttgiang/central | /core/js/crscat.js | UTF-8 | 2,510 | 2.75 | 3 | [] | no_license | <!--
function cancelForm(){
aseForm.action = "index.jsp";
aseForm.submit();
}
function checkForm(action){
var aseList = document.aseForm.aseList.value;
var alpha = document.aseForm.alpha2.value;
var num = document.aseForm.num.value;
if (aseList == "" && alpha == "" && num == ""){
if (!... | true |
5a098140616e3979f327fe4fa9bce5ea3ca5ce22 | JavaScript | FrederikOlsen/Jokeservice2 | /app.js | UTF-8 | 2,307 | 2.515625 | 3 | [] | no_license | const express = require('express');
const hbs = require('hbs');
const jokeRouter = require('./Routers/jokeRouter');
const cors = require('cors');
const mongoose = require('mongoose');
const bodyParser = require('body-parser');
const handlebars = require('hbs');
const jokeController = require('./Controllers/jokeControll... | true |
fbfd8297dbe028bb200d1b7762d70fbb92c55991 | JavaScript | chuksnwoeke/Photogallery | /js/index.js | UTF-8 | 578 | 2.625 | 3 | [] | no_license |
// var audio = document.getElementById("audio");
// audio.src = URL.createObjectURL("../audio/song.mp3");
// audio.load();
// audio.play();
$("document").ready(function () {
var audio = document.getElementById("audio");
audio.src = URL.createObjectURL("../audio/song.mp3");
audio.load();
audio.play();... | true |
c0763e3dc2cf5e418f13ef9d51a0f102e2fedc08 | JavaScript | chrisdhunt/jamming | /src/util/Spotify.js | UTF-8 | 4,291 | 2.53125 | 3 | [] | no_license | let accessToken = '';
let expireIn = '';
const authEndpoint = 'https://accounts.spotify.com/authorize?';
const clientID = '84c9c6b2b727472fa57d92af0fc8ee34';
const redirectURI = "http://chrisdhunt.surge.sh";
// const redirectURI = "http://localhost:3000";
const Spotify = {
// getAccessToken
// Dsecription:
// R... | true |
e24f26abd77eb6a36bf05155a31cd336a97c5914 | JavaScript | FbW-E01/pb-data-structures-destructuring-ronniejuan | /dstr.js | UTF-8 | 1,923 | 4.25 | 4 | [] | no_license | // # Destructuring
// **Instructions**
// #### 1. Array Destructuring
// * Declare the variables `fruit`, `vegetable`, `food`.
// Assign the following values to the variables respectively: "banana", "cucumber", "bread", "cakes", "pizza" (assign the "bread", "cakes" and "pizza" to `food`)
// . Use array destructuring ... | true |
887c409e6d5a393229137306c0edb0b3c235c516 | JavaScript | Nerina108/WeatherApp | /src/Components/weather.js | UTF-8 | 1,592 | 3.125 | 3 | [] | no_license | //loads the weather details specific to the area entered into the input field.
import React from 'react';
//loads weather specific conditions specific to the city and country entered in by user.
//temperature loads in kelvin, it is then converted to celcius.
class Weather extends React.Component{
render(){... | true |
edb17dde6f27286a41b0f81774d14847bb18e6ac | JavaScript | Anzzhhela98/JS | /07.Unit Testing and Error Handling/Unit Testing and Error Handling - Exercise/04/test.test.js | UTF-8 | 1,762 | 3.296875 | 3 | [
"MIT"
] | permissive | const { assert } = require('chai');
const mathEnforcer = require('./04.MathEnforcer');
describe('mathEnforcer object', () => {
it('AddFive should add correct', () => {
assert.equal(mathEnforcer.addFive(10), 15);
assert.equal(mathEnforcer.addFive(-10), -5);
assert.equal(mathEnforcer.addFive(... | true |
53250e30f995b7b9ad6ae66a51f36e7e9c850cf6 | JavaScript | Keped/ziv-test | /frontend/scripts/services/gui.js | UTF-8 | 4,939 | 2.625 | 3 | [] | no_license | // the gui service deals with rendering App.templates and suplying callbacks for them
// moved inside a factory function for minimal (yet explicit) reliance on global scope
// All DOM manipulation happens here (except setting listener for "DOMReady")
const GuiServiceMaker = (App) => {
const { LIST_MAP_TOKEN } = App.S... | true |
ee986e82a6596d6b9f01e0913c1eb69c32c103ec | JavaScript | NinjaHawkZero/second-app | /src/helpers.js | UTF-8 | 232 | 2.640625 | 3 | [] | no_license | function choice(items) {
let idx = Math.floor(Math.random() * items.length);
return items[idx];
}
function remove(item, items) {
return items.filter(function(foods) {return foods !== item})
}
export {choice, remove};
| true |
6e30d595606bb1f6dbe95a68cc827048f8565fd3 | JavaScript | houyining/zhihu-reader-1.0 | /popup.js | UTF-8 | 4,657 | 2.6875 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded", function(){
var status = chrome.extension.getBackgroundPage().status;
if(status == "pause"){
buildPauseView();
}else if(status == "resume"){
buildResumeView();
}else{
buildPlayView();
}
});
function buildPlayView(){
var wrapper_html = "<h1>知乎朗读</h1... | true |
d33df434bdaa8c0aa5b2c6bfbc2225616d2d8d75 | JavaScript | HwDhyeon/vanillajs-todo | /src/location.js | UTF-8 | 1,777 | 3.234375 | 3 | [] | no_license | const weatherInfo = document.querySelector(".weather");
const saveCoords = (coordsObject) => {
localStorage.setItem("coords", JSON.stringify(coordsObject));
};
const readCoords = () => {
return JSON.parse(localStorage.getItem("coords"));
};
const handleGeoSuccess = async (position) => {
const {
coords: { l... | true |
96b6232ce423e9e4452bdc505e8863d673b3423e | JavaScript | Limitlessmatrix/assignments | /exercises/hello-class/app.js | UTF-8 | 263 | 3.625 | 4 | [] | no_license | /* let name = "Jere"
let age = 26
let Hello = function(){
console.log("hello " + name + " do you like being "+ age + "?")
}
Hello() */
function sayHello(age , name){
console.log("hi " + name + " do you like being " + age + "?");
}
sayHello(23, "jane") | true |
27390484852e78f01d073e65afc359ccd5c71522 | JavaScript | amplia-iiot/opengate-js | /src/iot/datamodels/Datamodels.js | UTF-8 | 5,964 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | 'use strict';
import BaseProvision from '../../provision/BaseProvision';
import Category from '../catalog/Category';
import Datastream from '../catalog/Datastream';
export const PRE_RESOURCE = '/organizations';
export const DATAMODELS_RESOURCE = '/datamodels';
/**
* This is a base object for create a IoT Data... | true |
f2158beef236b37161c7bfed34a1ce04325727db | JavaScript | lgandecki/modifyjs | /bundle.js | UTF-8 | 29,819 | 3.296875 | 3 | [
"MIT"
] | permissive | 'use strict';
var underscore = require('underscore');
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @sin... | true |
ec16b33ccca29b1ab51462caad289a5475d5d007 | JavaScript | Baelyk/programmings | /project-euler/js/017.js | UTF-8 | 2,096 | 3.9375 | 4 | [
"MIT"
] | permissive | /* Problem 17: Number letter counts
https://projecteuler.net/problem=17
Answer: 21124
*/
/* Note
This could also be done without actually changing the numbers to words.
Instead it would probably make more sense to just use the number of letters in
each word, and summing them that way. Just determine what pla... | true |
a5f27f723483b647234e9023686efaf6a16bd379 | JavaScript | cande04/wine-about-it | /src/wine/Wines.js | UTF-8 | 993 | 2.640625 | 3 | [] | no_license | import React, { Component } from 'react'
import axios from 'axios'
class Wines extends Component {
constructor (props) {
super(props)
this.state = {
wines: [],
pairingText: null,
loaded: false
}
}
componentDidMount () {
axios('https://api.spoonacular.com/food/wine/pairing?food... | true |
4c1915fe7e8273cf79b60c820f21fd3748465709 | JavaScript | aamzahid/grading | /grading.js | UTF-8 | 749 | 3.03125 | 3 | [] | no_license | var msg = 'Enter The Mark (1 to 100):';
var a = prompt(msg);
if(a>=80)
{
document.write('Grade - A+');}
else if(a<80 && a>=75)
{
document.write('Grade - A');}
else if(a<75 && a>=70)
{
document.write('Grade - A-');}
else if(a<70 && a>=65)
{
document.write('Gra... | true |
05514eeb1ddf75217c0919537572ad5ce67e55e5 | JavaScript | jusbrasil/node-finagle | /src/__tests__/hedgeRequest.js | UTF-8 | 2,805 | 2.53125 | 3 | [] | no_license | // @flow
import Promise from 'bluebird';
import hedgeRequestFilter from '../hedge-request';
jest.mock('../utils/hdr-histogram', () => jest.fn());
jest.useRealTimers();
describe('hedgeRequest filter', () => {
const expectRecordedTime = (call, expectedTime, threshold = 10) => {
expect(call[0] - expectedTime).toB... | true |
d10c1fa3109ddfe12fe36ac5341d16401c667458 | JavaScript | kuali/rice | /rice-middleware/web/src/test/js/krad/scripts/krad.utility.test.js | UTF-8 | 2,365 | 2.53125 | 3 | [
"Artistic-1.0",
"MIT",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"EPL-1.0",
"CPL-1.0",
"LGPL-2.1-or-later",
"BSD-3-Clause",
"LGPL-3.0-only",
"ECL-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-jdom",
"LicenseRef-scancode-freemarker",
"LicenseRef-scancode-unk... | permissive | /*
* Copyright 2005-2015 The Kuali Foundation
*
* Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
*
* Unless requi... | true |
afad5ec292c26fdcec7b2610b6410144f67ecff2 | JavaScript | dr3am3r/live-coding-webinar | /src/js/scripts.js | UTF-8 | 867 | 2.71875 | 3 | [] | no_license | (function ($, window, document, undefined) {
'use strict';
var prizeFund = 0;
var _updatePrizeFund = function() {
$('#sum').text(prizeFund + 'грн');
};
$(function () {
$('.club-container').click(function() {
var sum = window.prompt('Введите сумму ставки', 100);
var clubName = $(this).d... | true |
4df0fa98d1e64666585f773f0315d7727a84c872 | JavaScript | cddbysj/my-console | /src/pages/work/memo/index.js | UTF-8 | 2,986 | 2.515625 | 3 | [] | no_license | /* 备忘录页面 */
import React, { useState, useEffect } from "react";
import { Row, Button, Drawer, Divider, message } from "antd";
import firebase from "api/firebase";
import { PlusOutlined } from "@ant-design/icons";
import CreateMemoForm from "./createMemoForm";
import EditMemoForm from "./editMemoForm";
import MemoList f... | true |
7d1420a70eb5c7c47db95cc7d1090271b9b12a89 | JavaScript | markdrago/retroscope-old | /src/scoreboard.js | UTF-8 | 1,516 | 3.671875 | 4 | [
"MIT"
] | permissive | /* the goal of this score board is to keep track of statistics
* related to the functioning of different parts of the system
* and make it easy to get that information on to the screen */
function ScoreBoard() {
this.items = {};
}
ScoreBoard.prototype.create_count_item = function(name) {
this.items[name] = ... | true |
db6132d26087c669d752aada9c5e85bad6d46c2a | JavaScript | gabrielonline/gabrielonline.github.io | /jsgab/jsgab.js | UTF-8 | 2,350 | 2.8125 | 3 | [] | no_license | $(function () {
let link = "https://rafaelescalfoni.github.io/desenv_web/filmes.json";
$.get(link, function (data) {
console.log(data);
$.each(data, function (index, filme) {
let $divCatalogo = $("<div>").addClass("catalogo");
let $figura = $("<img>").attr("src", filme.figura).addClass("figura");
let $ti... | true |
352d8df795b66f5ad47a0ed5f63c4a40545dd0b6 | JavaScript | Dybovsky/JS-tasks-IQ | /Medium/whereIsWaldo.js | UTF-8 | 671 | 3.828125 | 4 | [] | no_license | /*
Return the coordinates ([row, col]) of the element that differs from the rest.
Examples
whereIsWaldo([
["A", "A", "A"],
["A", "A", "A"],
["A", "B", "A"]
]) ➞ [ 2, 1]
whereIsWaldo([
["c", "c", "c", "c"],
["c", "c", "c", "d"]
]) ➞ [1, 3]
whereIsWaldo([
["O", "O", "O", "O"],
["O", "O", "O", "O"],
["O", "O", ... | true |
6227567b874d92babda82aedac87db6ecfc4dc15 | JavaScript | Nithack/Minhas-Praticas | /AulasResilia/qualify/provaSemana9 /exe02.js | UTF-8 | 536 | 3.375 | 3 | [] | no_license | class Fantasma {
constructor(element) {
this.cor = element != undefined || element.length > 0 ? this.defineColor(element) : 'Cor inválida!'
}
defineColor(value) {
switch (value) {
case 'v':
return 'vermelho'
case 'a':
return 'amarelo'
... | true |
aed644e0c404f7df4fc05b0dd3b8870a5e10ff4a | JavaScript | dnakhla/shopping_cart | /src/components/basket.js | UTF-8 | 2,672 | 2.78125 | 3 | [] | no_license | import React from "react";
import {connect} from 'react-redux';
import Discount from './discount'; // Discount Compoenent
import Total from './total' // Displays total
import Clear from './clear' // Clear button component with methods
/**
* Importing methods to be used within component
*/
import {removeProduct, ca... | true |
67fed725b137f6337c9858a4a2814df8fe0c485c | JavaScript | yldio/medium-export-rss | /post-demo.js | UTF-8 | 3,370 | 2.546875 | 3 | [] | no_license | /* eslint-disable */
const fs = require('fs');
const path = require('path');
const fetch = require('node-fetch');
const Export = require('./src/export-rss-json');
const downloader = require('./downloader');
const generatePost = require('./src/contentful');
const stripMarkdown = str => str.substring(1, str.length - 1);... | true |
6ebf1e0f0b8ffa9e472f0df28008d39fefe681c2 | JavaScript | oussematn/Covid19 | /js/global.js | UTF-8 | 2,494 | 2.890625 | 3 | [] | no_license | fetch("https://covid-19-data.p.rapidapi.com/totals?format=json", {
"method": "GET",
"headers": {
"x-rapidapi-host": "covid-19-data.p.rapidapi.com",
"x-rapidapi-key": "c1c9ac5c6bmsh1b282839ac12b47p181d16jsnc5c49e75afb0"
}
}).then(response => response.json()).then(res => {
var ctx = docume... | true |
7cf80ce56119b70254c6ed3e747d8a3abbe135b5 | JavaScript | dariocravero/react-stuff | /add.js | UTF-8 | 1,131 | 2.5625 | 3 | [] | no_license | import React, { Component, PropTypes } from 'react';
export default class Add extends Component {
constructor(props) {
super(props);
this.state = {
error: false
};
}
onSubmit(event) {
event.preventDefault();
const author = this.refs.author.value;
const text = this.refs.text.value... | true |
a341a5a5e3bf3269cbd556e4c13ce5c59daf36e1 | JavaScript | sdymj84/project-mkb | /routes/recipes.js | UTF-8 | 524 | 2.609375 | 3 | [
"MIT"
] | permissive | const router = require('express').Router();
let Recipe = require('../models/recipe.model');
router.route('/').get((req, res) => {
Recipe.find()
.then(recipes => res.json(recipes))
.catch(err => res.status(400).json('Error: ' + err));
});
router.route('/add').post((req, res) => {
const title = req.body.tit... | true |
12cd6403f30be20f24bf8e8480c0006463b1be3c | JavaScript | Reese-Sanders/WordCounter | /index.js | UTF-8 | 751 | 3.953125 | 4 | [] | no_license | // Tasks:
// - write the JS so that the word count appears on the screen
// - update the count as the user types
const textBox = document.getElementById("txtid")
const count = document.getElementById("count")
textBox.addEventListener('keyup', (event) =>{
countWords(Object.assign([], textBox.value))
})... | true |
00786679717edc491d58f24e2672decd02654975 | JavaScript | yarynka97/twitter_timeline | /src/client/components/App.jsx | UTF-8 | 2,659 | 2.53125 | 3 | [] | no_license | import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import axios from 'axios'
import Timeline from './Timeline';
const config = require('../../config');
class App extends Component {
state = {
tweets: [],
class: '',
buttonDisabled: false
}
render() {
... | true |
1572d95747df59bf7491bbedceb51faae6b86118 | JavaScript | skyplaying/js-Data-Structures-and-Algorithms | /greedy/minNumber.js | UTF-8 | 886 | 3.859375 | 4 | [] | no_license |
/**
* 在一个非负整数 a 中,我们希望从中移除 k 个数字,让剩下的数字值最小,
* 如何选择移除哪 k 个数字呢?
*/
/**
* 首先,要最终的数字最小。首先我们知道,高位越小越好。
*
*
* 其他人的回答:由最高位开始,比较低一位数字,如高位大,移除,若高位小,
* 则向右移一位继续比较两个数字,直到高位大于低位则移除,循环k次
*
* 另一个朋友的回答(说出了本质):
* 第一个题,可以反着来想。给定另一个数组,怎么从中原本的中挑出n-k个,使其值最小。
* 首先第一位必须要是最小的一个,但是因为有顺序,所以只能是从0到n-1-k个中挑一个最小的,
* 下标为m。以后依次类推,从... | true |
26dff8955fadfe24d3c889e6f4c49224f5dfdbcf | JavaScript | hhh920406/Typewriter | /Web/Shopping/scripts/util/cookie.js | UTF-8 | 1,457 | 3.25 | 3 | [] | no_license | /**
* 对于cookie的操作,都是全局的。
*/
function setCookie(name, value) {
var date = new Date();
date.setMonth(date.getMonth() + 1);
document.cookie = name + "=" + escape(value) + ";expires=" + date.toGMTString() + ";path=/;";
}
function getCookie(name) {
var cookies = document.cookie.split("; ");
for(var i =... | true |
93ae3e78a51fe06e7f42c63b07ebd3bfd2b2621c | JavaScript | VovaMelnyk/FE16 | /JS/DOM practice/Crazy buttons/index.js | UTF-8 | 458 | 3.390625 | 3 | [] | no_license | let container = document.querySelector('.container');
function changeCoord(e) {
let btnHeight = e.target.clientHeight;
let btnWidth = e.target.clientWidth;
let newTop = Math.floor(Math.random() * (window.innerHeight - btnHeight));
let newLeft = Math.floor(Math.random() * (window.innerWidth - btnWidth));... | true |
b1de83b4a0f7e75d5b101e9e2ee0fb534ddea25e | JavaScript | LucieCicvarkova/presentation-website | /scripts.js | UTF-8 | 1,473 | 3.375 | 3 | [] | no_license | /* Animate logo elements on scroll */
const scrolledElement = document.querySelector(".about-me");
const animatedElement = document.querySelector(".my-work");
const scrolledElementHeight = scrolledElement.offsetHeight;
let scrollPos = window.scrollY;
const addClassOnScrollNoDelay = () =>
animatedElement.classList.ad... | true |
52a3345afac23b3ed6cb4ddd55bce5c9036449d6 | JavaScript | andrey-shostik/js-tasks | /es6/Spread/1/spreadOut.js | UTF-8 | 578 | 3.40625 | 3 | [] | no_license | function replace(array, from, to, ...elements) {
array.splice.apply(array, [from, to - from].concat(elements))
}
let testArray = [1, 2, 100, 100, 6]
replace(testArray, 2, 4, 3, 4, 5)
console.log(testArray)
function copyReplace(array, from, to, elements) {
return array.slice(0, from).concat(elements).concat(array.... | true |
3a41720eb5e128524e5b69f35b24a429a3bdc4fe | JavaScript | Kinderhaus-Langenau/kinderhaus | /user/themes/kinderhaus/js/kinderhaus.js | UTF-8 | 1,438 | 2.65625 | 3 | [] | no_license | $(document).ready(function() {
// Größerer Abstand zwischen Hauptmenü und Content, wenn Submenü offen ist
if($('.page-navigation__sub-list:visible').length > 0)
$('.content__wrapper').addClass('margin-top__large');
// Mobile Menu setup
var $inactiveSubLists = $('.mobile-menu li:not(.active) .page-navigatio... | true |
221d410391711c8cf36f3bfb82e820e97b4d12a6 | JavaScript | cspt5-buildweek/CS-Buildweek-1-client | /src/pages/GamePage.js | UTF-8 | 2,807 | 2.59375 | 3 | [] | no_license | import React, { useContext, useState } from 'react';
import { UserContext } from '../hooks/useUserContext';
import { buildMap_1 } from '../mockData/fakeMap';
import { useLogOnChange } from '../hooks/misc';
import GameMap from '../components/GameMap';
const GamePage = () => {
const userData = useContext(UserContext... | true |
4c1444df4929131d5ed99ddac294d6d13da33ed4 | JavaScript | sadOskar/chapter_1 | /homework/task_1/js/main_02.js | UTF-8 | 81 | 2.609375 | 3 | [] | no_license | var firstName = 'Hello ';
var secondName = 'World';
alert(firstName + secondName) | true |
12b8668cf0778cc4cdedea48fc319cd063f38b48 | JavaScript | pincha63/restapi | /express/client.js | UTF-8 | 3,027 | 2.890625 | 3 | [] | no_license | function pad(n, w = 2, z = 0) {
return ((n += '').length >= w) ? n : new Array(w - n.length + 1).join(z) + n;
}
function drawElement(eName, u, bcolor, luma) {
let msgString = "" + pad(u,3,0) + ` :: color ${bcolor} :: luma ${luma}`
document.getElementById(eName).innerHTML = msgString
document.getElement... | true |
ea6b6e8bd44e63275588c1f39d0eb7dba8cc32c8 | JavaScript | MaeBerris/m2-7-js--oop | /workshop/1-Cat/exercise-1.4.js | UTF-8 | 1,556 | 4.625 | 5 | [] | no_license | // Exercise 1.4
// ------------
// Creating a Cat class - Part 4
// A) So far so good.
// In real life, we naturally get more tired/hungry/lonely as time passes.
// Let's add a new method, `wait`. It accepts a number of minutes as the
// parameter. The cat's tiredness, hunger, and loneliness should increase
/... | true |
c68481116c64c224c5b51619bb7128497941d271 | JavaScript | lev-tovmasyan/turbo-keno | /src/components/mobile/Popup/Slides.js | UTF-8 | 2,546 | 2.53125 | 3 | [] | no_license | import React, {useState} from 'react';
import images from "../../assets/images";
import {connect} from 'react-redux';
import {hidePopup} from "../../redux/actions/popupActions";
const {step_1, step_2, step_3, step_4, step_5, step_6, step_7} = images;
const gameInfo = {
'1. Choose your ticket numbers(up to 10) from ... | true |
0ec009a1c922f8658e13735549b10a4fa4acf760 | JavaScript | devisrael/Github-Profile-Viewer | /ui.js | UTF-8 | 1,951 | 2.53125 | 3 | [] | no_license | class UI {
constructor() {
this.profile = document.querySelector(".info__container");
this.title = `<header>
<h1 class="title">
<b>Github</b> Profile Viewer
<span class="author">
by
<b
><a href="https://github.com/devisrael" target="_blank"
>devisrael</a
... | true |
907e24db7130b5418ffe43f3d91ea390a0180501 | JavaScript | DreadJaw/infinitris | /main.js | UTF-8 | 10,271 | 3.1875 | 3 | [
"BSD-3-Clause"
] | permissive | // Immediate Variables
const canvas = document.getElementById('canvas'); // Game Canvas
const context = canvas.getContext('2d'); // Set Context
const thisGrid = 32; // Grid Cell Dimension 32x32
const thisSequence = []; // Game Sequence
const thisField = []; // Every cell in game with 2D Array; 10x20;
// Get ... | true |
1814ac70025fb3dcb3d019fd1956f5a34490cff7 | JavaScript | haihoang1993/api_demo | /index.js | UTF-8 | 1,298 | 2.6875 | 3 | [] | no_license | // khởi chạy nodejs bằng cmd
// node index
var express = require('express');
var database = require("./database/Database");
var app = express();
// demo trả về json
// http://localhost:3000/DemoJson
app.get('/DemoJson', function (req, res) {
var sinhvVien = { id: "sv1", hoTen: "Hoang Hai" }
res.json({ sinhvVie... | true |
055a3bf78e63800fcc73d9de96526021630c1f8f | JavaScript | drummer0417/node-todo-api | /playground/mongodb-connect.js | UTF-8 | 1,481 | 2.8125 | 3 | [] | no_license | // const MongoClient = require('mongodb').MongoClient;
// the line below does the same as the one above, it uses 'destructuring'
//const {MongoClient} = require('mongodb')
// now you can easily get more vars from mongodb like so:
const {
MongoClient,
ObjectID
} = require('mongodb');
// // now create a new ObjectI... | true |
7efb34b99549cc0df678216f0fffb2ecea648897 | JavaScript | kimx4131/nordlid | /main.js | UTF-8 | 2,076 | 2.734375 | 3 | [] | no_license | let name = document.querySelector('#name');
let email = document.querySelector('#email');
let tlf = document.querySelector('#tlf');
let errorname = document.querySelector('#errorname');
let erroremail = document.querySelector('#erroremail');
let errortlf = document.querySelector('#errortlf');
let flagName = false;
le... | true |
47bd2c2ada76c5b8b6669a55cc5f39d5411d2ebd | JavaScript | kartik2406/product-world | /server/scripts/parseData.js | UTF-8 | 849 | 2.671875 | 3 | [] | no_license | // require("dotenv").config();
// require("./db");
const axios = require("axios");
const fs = require("fs");
axios(
"https://s3-ap-southeast-1.amazonaws.com/he-public-data/books8f8fe52.json"
)
.then(({ data: books }) => {
let booksData = books.map((book) => {
book.name = book.title;
book.average_r... | true |
abec2ed329f455ae72e339bc1eff4aa9a0c0a517 | JavaScript | vlaaaaaad/notes | /src/App.js | UTF-8 | 2,817 | 3.03125 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import NotesList from './NotesList';
import NoteDetails from './NoteDetails';
import Sorting from './Sorting';
import Search from './Search';
import './App.css';
import uuid from "react-uuid";
export default function App() {
const [notes, setNotes] = useState([{id:... | true |
5b27a58ad91281652d29ec85a39210aaad0dbdb3 | JavaScript | eric-to/algorithms | /javascript/intro_js_problems.js | UTF-8 | 5,464 | 3.859375 | 4 | [] | no_license | // Notorious bubble sort
Array.prototype.bubbleSort = function (func) {
let copy = this.slice();
if (!func) {
func = (x, y) => {
if (x <= y) return -1;
return 1;
};
}
let sorted = false;
while (!sorted) {
sorted = true;
for (let i = 0; i < copy.length; i++) {
if (i === copy... | true |
2d80baf9ba60ddb8f810b3faad6b426fefe775d1 | JavaScript | ricardorosa-dev/Curso-Trybe | /10-1_Jest/ex4.test.js | UTF-8 | 587 | 3.109375 | 3 | [] | no_license | const assert = require('assert');
const { hasUncaughtExceptionCaptureCallback } = require('process');
function myFizzBuzz(num) {
if (typeof num !== 'number') return false;
if (num % 3 === 0 && num % 5 === 0) return 'fizzbuzz';
if (num % 3 === 0) return 'fizz';
if (num % 5 === 0) return 'buzz';
return num;
}
... | true |
8d506c3270e09bb23c370033d2606f979daa7e21 | JavaScript | hjjinnie/hh-solutions | /reverse-ll.js | UTF-8 | 1,402 | 4.28125 | 4 | [] | no_license | // not in place solution, O(n) time, O(n) space
const reverseLinkedList = head => {
// create a stack with all the values in the linked list
const stack = [];
// traverse linked list and push values into stack
while(head){
stack.push(head.value);
head = head.next;
}
// create a new head wit... | true |
7393f440644949d001de8cefe66a09488f38a57c | JavaScript | Gokul-Cloud/task-5 | /4.totpop.js | UTF-8 | 329 | 2.953125 | 3 | [] | no_license | var request = new XMLHttpRequest();
request.open('Get','https://restcountries.eu/rest/v2/all', true);
request.send();
request.onload=function()
{
var data = JSON.parse(this.response);
const population = data.reduce((totalpopulation, b) => totalpopulation + Number(b.population), 0);
console.log(popula... | true |
88809d06ca50e05e177a6aa9ff8e352ac1063894 | JavaScript | sou-gabriel/curso-javascript-roger-melo | /Etapa 01 - Primeiros passos/Aula 04/03. Comparações com igualdade estrita/app.js | UTF-8 | 320 | 4.40625 | 4 | [] | no_license | const age = 31
// 'igual a' e 'diferente de'
// console.log(age == 31)
// console.log(age == '31')
// console.log(age != 31)
// console.log(age != '31')
// 'igual a, e do mesmo tipo' e 'diferente de, e do mesmo tipo'
console.log(age === 31)
console.log(age === '31')
console.log(age !== 31)
console.log(age !== '31') | true |
5635b2aa0207bd50f96908229a4afd2686efa8b6 | JavaScript | suevip/qq-mall | /qq-mall-admin/src/main/webapp/static/js/order/auditing-detail.js | UTF-8 | 6,047 | 2.59375 | 3 | [] | no_license | /**
* Created by Dayong on 16/3/11.
*/
function saveItem(ele, type) {
var curEle = $(ele);
var id = curEle.prev().val();
var val = curEle.val();
if (type == 1) {
if (val < 0) {
curEle.attr("data-content", "数量不能小于0");
curEle.popover("show");
}
} else {
... | true |