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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
4ee5d0c43f99a455585e0f58821668a9fcba90ff | JavaScript | Robbie-Bridgwater/Team-Profile-Generator | /app/__tests__/employee.test.js | UTF-8 | 711 | 3.890625 | 4 | [
"MIT"
] | permissive | const Employee = require('../lib/employee.js');
const employee = new Employee('Mr T.E.S.T Employee', '0000', 'Test@Testmail.com')
// Checks that the class being tested is an object.
test('Checks that the data within employee class is an object', () => {
expect(typeof(employee)).toBe('object');
});
// Checks the v... | true |
2b4ad6b02b9ded54c65b2e3bbf3d66e15122a34a | JavaScript | swusj/Calendar | /calendar-module/scripts/main.js | UTF-8 | 4,128 | 2.65625 | 3 | [] | no_license | import { getDayNum, getDayOfOne, createCss } from "./utils.js";
import { TRANS_TIME } from "./config.js";
import { showToday, showClock, drag } from "./display.js";
import { CalendarstateMachine } from "./statemachine.js";
let clocks = {};
// 页面初始化要调用的函数
function calendarOnload(showDate, todayDate, content, content_... | true |
099d46a783db2f171577df81115afedae6bccb54 | JavaScript | tomgobich/tiy_week8_day1_node_api_intro | /dist/js/controllers/CUsers.js | UTF-8 | 819 | 2.6875 | 3 | [] | no_license | 'use strict';
(function () {
'use strict';
angular.module('app').controller('CUsers', function (FApi) {
var vm = this;
// Get all users from API
var userListPromise = FApi.getAllUsers();
// Once returned...
userListPromise.then(function (response) {
// Target needed data
vm.userList = response.d... | true |
610651ebd845603e56062885f1f0ded427662a63 | JavaScript | chou0827/hw5 | /re-musical-instrument.js | UTF-8 | 2,985 | 3.03125 | 3 | [] | no_license | var drops = [];
var slider;
var playingA = false;
var playingS = false;
var playingD = false;
var playingF = false;
var pressedA = false;
var pressedS = false;
var pressedD = false;
var pressedF = false;
var freq = [250,280,310,340];
function setup() {
createCanvas (400,400);
background (0);
textAlign(CENTER);... | true |
77cf446dd0d4083a7064e24bbbe6eed9281d7612 | JavaScript | zoyron/perlin-noise | /aurora.js | UTF-8 | 1,367 | 2.9375 | 3 | [] | no_license | let sketch = function (p) {
let xoff = 0;
let ox = p.random(10000);
let oy = p.random(10000);
let oz = p.random(10000);
p.setup = function () {
p.createCanvas(p.windowWidth, p.windowHeight);
p.strokeWeight(2);
p.stroke(119, 183, 255, 30);
p.smooth();
p.noFill();
};
p.draw = function (... | true |
3c79b50895741106fe7d9a4e81a636bd6b0f1840 | JavaScript | sihyu-lai/JS-W6 | /JS-W6-0615-LV2 /js/all.js | UTF-8 | 4,348 | 3.21875 | 3 | [] | no_license | // 地區用 change 監聽-->通常用於表單
// 上方新增的地區跟下方篩選的地區都寫死選項(依照目前提供的 JSON data area 欄位)
// 地區的篩選下拉需要加上『全部地區』option
// 不需要有「清除資料」的按鈕
// 預設資料為 3 筆(內容需依照目前提供的 JSON data)
// 篩選後會顯示『搜尋資料為 ? 筆』
// 描述欄位使用 textarea 這
// 星級區間是 1-10 分
// 金額、組數、星級的 type 為 Number
let data=[];
axios.get('https://raw.githubusercontent.com/hexschool/js-t... | true |
21e89cb7f95e24da71a8d23ba6da5e2b67e2d4ca | JavaScript | jeffyuan/silver-bullet | /silverbullet-web/amain/src/main/resources/static/jquery/jquery-bootstrap-treeview-build/jquery.bootstrapTreeview.build.js | UTF-8 | 8,602 | 2.515625 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | /**
*@Auther: OFG
*@Despriction:
*@Data: Created in 16:07 2018/11/6
*@Modify By:
**/
(function ($) {
var TreeView = {
uid: 'NONE',
url: undefined,
node: undefined,
selectedBackColor: '#454849',
loadingIcon: 'fa fa-hourglass',
levels: 1,
showBorder: false... | true |
66592b60cdf7026dcae8122be68cd26600b4b75f | JavaScript | asanctor/asanctor.github.io | /js/timePoker.js | UTF-8 | 1,547 | 3.25 | 3 | [
"MIT"
] | permissive | /*Poker Active Component
* Requirements from UI:
* none
* Parameters (Requirements from user):
* ac that needs to be poked
* time => every how many miliseconds should it be poked?
*/
var TimePoker = class TimePoker {
constructor(acPara) {
// search for right parameter in parameter array
for (var l... | true |
5a774079f59804808ebbaa3acf74c98161e46a00 | JavaScript | RohitChattopadhyay/gamesArena | /assets/js/history.js | UTF-8 | 9,449 | 2.6875 | 3 | [] | no_license | var maxGenre;
var results = new Array();
//Global Variables
function h_addDB(d) {
//checking indexedDB
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;
if(!indexedDB) { alert('Unsupported browser, please update or use some other browser... | true |
9a49299374218d23d4177e957aedd16465869c23 | JavaScript | garciaeury26/react-gyphyApp | /src/hooks/useFechGifs.js | UTF-8 | 954 | 2.859375 | 3 | [] | no_license | //!cuando pongo el nombre (use) en un archivo significa que es un hook (pero no es nesesarip\o)
import { useState, useEffect,useRef} from 'react'
import { getGifs } from '../helpers/getGifs'
//los hook no son mas que funciones
export const useFechGifs = (category) => {
const ref = useRef(true);
const [state,... | true |
c3c08ce774b6983e62f3ffb1efb22673c2188d77 | JavaScript | qq897425998/slashshare | /app/fetch/get.js | UTF-8 | 644 | 2.578125 | 3 | [] | no_license | /**
* Author: Michael
* Version V1.0
* Date: 2017-12-10 02:07
* Description: fetch get请求简单封装
*
* Modification History:
* Date Author Version Description
* ------------------------------------------------------------------------
* 2017-12-10 Michael ... | true |
d231e2de5f6e3a2127394f5c47909c52404d0502 | JavaScript | tuansacca/facebook | /tagAll.js | UTF-8 | 687 | 2.578125 | 3 | [] | no_license | // tagggggggggg
let token = "";
let id_post = "";
fetch('https://graph.facebook.com/v2.11/me/friends?limit=5000&access_token='+token,{
method : 'GET',
})
.then(res => res.json())
.then(res => {
let data = res.data;
let comment_text ="";
for (var i = 0; i < data.length; i++) {
comment_text += "@["+data[i].id+":0]"... | true |
a99e26c37db76c1eb905cb972f8266901a4ad147 | JavaScript | dabagirevalens/backend_development_apis | /routes/urlShortener.js | UTF-8 | 1,698 | 2.71875 | 3 | [
"MIT"
] | permissive | const router = require("express").Router();
const dns = require("dns");
let links = [];
let id = 0;
app.post('', function (req, res) {
const url = req.body.url;
// return console.log(req.body);
var regex = /^https?:\/\//;
if (regex.test(url)) {
var tempDnsUrl = url.slice(url.indexOf("//") + 2)... | true |
8f4ae7938fc356ff0742392d6bccff70b23831cf | JavaScript | ramenhut/js-path-tracer | /Source/geInput.js | UTF-8 | 6,794 | 2.984375 | 3 | [
"BSD-2-Clause"
] | permissive |
const GE_INPUT_MOUSE_LEFTBUTTON = 0x1;
const GE_INPUT_MOUSE_MIDDLEBUTTON = 0x2;
const GE_INPUT_MOUSE_RIGHTBUTTON = 0x4;
const GE_INPUT_MOUSEMODE_DEFAULT = 0;
const GE_INPUT_MOUSEMODE_CLAMP = 1;
function KeyState()
{
var keyCode = 0;
var keyAscii = 0;
var keyDown = 0;
}
function MouseSt... | true |
b22c51ba50141fbb9098aae3a8470383503d9487 | JavaScript | pr222/b2-the-quiz | /src/components/user-nickname/user-nickname.js | UTF-8 | 2,702 | 3.34375 | 3 | [] | no_license | /**
* The user-nickname web component module which handles a form
* element and saves the submitted name as a new user.
*
* @author Pauliina Raitaniemi <pr222ja@student.lnu.se>
* @version 1.0.0
*/
/**
* Define the template.
*/
const template = document.createElement('template')
template.innerHTML = `
<style>
... | true |
29d962c6af279f6149eafc4d8afca556f33c4c01 | JavaScript | bfly2001/100DaysofCode_Day11 | /connect.js | UTF-8 | 850 | 2.640625 | 3 | [] | no_license | const { MongoClient } = require('mongodb');
async function main() {
/**
* Connection URI. Update <username>, <password>, and <your-cluster-url> to reflect your cluster.
* See https://docs.mongodb.com/ecosystem/drivers/node/
*/
const uri = "mongodb+srv://<username:<password>@<your-cluster-url>/test... | true |
6ebabdcebcfee4486b092f073417061c3d48a6fe | JavaScript | mjapanwala/incomeexpense | /src/components/AddNewTransaction.js | UTF-8 | 1,428 | 2.625 | 3 | [] | no_license | import React, { useContext, useEffect, useState } from "react"
import { GlobalContext } from "../context/GlobalState"
function AddNewTransaction() {
const [text, setText] = useState('')
const [amount, setAmount] = useState(0)
const {addTransaction} = useContext(GlobalContext)
const handleSubmit = (e) => {
e.pre... | true |
56464c84c4dff60e56dcfb68cbd73f9af311feac | JavaScript | Andrew-Sheremet/layout | /script.js | UTF-8 | 1,618 | 2.734375 | 3 | [] | no_license | var tab = document.getElementsByClassName('info-header-tab');
var tabContent= document.getElementsByClassName('info-tabcontent');
var info= document.getElementsByClassName('info-header')[0];
function hideTabCOntent(a){
for(var i = a;i<tabContent.length;i++){
tabContent[i... | true |
feaadea8fdafc4b3c8ccfbd9c2748e3b0aeadb57 | JavaScript | Eric-Canas/TrainerBot | /src/js/Helpers/PosePainter.js | UTF-8 | 4,512 | 2.609375 | 3 | [] | no_license | import {INVERT_Y_AXIS, DRAWN_POINTS_RADIUS, SKELETON_CONNECTIONS,
SHOW_STD_DIRECTION, POINTS_TO_LINE_THRESHOLD, PLOT_BASE_POSE,
TRANSPARENT_RED, TRANSPARENT_WHITE, TRANSPARENT_BLUE} from "../Model/Constants.js";
class PosePainter{
constructor(webcamCanvas, movementStateController){
this.we... | true |
87c9a167618920eae56e1ba46f622cb754c5a581 | JavaScript | joochanshin/JavaScript-practice | /palind/index.js | UTF-8 | 243 | 3.859375 | 4 | [] | no_license | function palind(word){
this.word = word.toLowerCase().split("").reverse().join("");
console.log(this.word);
if(this.word === word.toLowerCase()){
return console.log("true");
} else {
return console.log("false");
}
}
palind("hello"); | true |
a402699a64a52a7546a50824b7e6c289f6078848 | JavaScript | diegofigs/finance-factors | /test/finance-factors.spec.js | UTF-8 | 2,352 | 2.78125 | 3 | [
"MIT"
] | permissive | /* global describe, context, it */
import chai from 'chai'
import * as lib from '../src/index'
const expect = chai.expect
describe('finance-factors', () => {
describe('#singleFW()', () => {
context('with 5% interest', () => {
it('should return 1.05 over 1 period', () => {
expect(lib.singleFW(5, 1))... | true |
2379d653261d137d48923c6f741054cbe1dc1f80 | JavaScript | nihalkumar000/driver_backend | /controllers/driver.js | UTF-8 | 8,424 | 2.515625 | 3 | [] | no_license | 'use strict';
var logging = require("../logging");
var Promise = require("bluebird");
var async = require("async");
var redis = require("../redis");
var constants = require("../constants");
exports.rideRequest = rideRequest;
exports.acceptRequest = acceptRequest;
function rideRequest(r... | true |
c9099d59ba364a0eb78beb65c56959a908bfc0ee | JavaScript | ironhackorgdeveloper/Ironhack | /Week3/javascript/app.js | UTF-8 | 1,079 | 3.859375 | 4 | [] | no_license | // var countColors = require("./lib/count-colors.js");
// var colorArray = ["baby blue", "red", "indigo", "teal", "black", "black","teal"];
// console.log(countColors("indigo", colorArray) === 1);
// console.log(countColors("red", colorArray) === 1);
// console.log(countColors("teal", colorArray) === 2);
// console.... | true |
a9cf170536586bdd6c7c2a933758ef7886390014 | JavaScript | MagicalGhost/ifpi-ads-algoritmos2021-Ian-Fonseca | /QuestõesLista2/q25.js | UTF-8 | 289 | 3.125 | 3 | [] | no_license | const input = require('prompt-sync')();
function validador(s) {
if (senha == '1234') {
console.log('Senha correta, acesso aprovado!');
} else {
console.log('Senha incorreta, acesso negado');
}
}
var senha = String(input('Password: '));
validador(senha); | true |
cf4f04070c4a076f775537fc7fdf93db2c4b3eb3 | JavaScript | laffed/HelpfulHuman-Challenge | /application/helpers/getHues.js | UTF-8 | 839 | 3.421875 | 3 | [] | no_license | //outputs array of 5 hues. Index 2 is the original color
const hexStringArr = require('../Data/colorData');
function getHues(hexStr) {
const output = [];
const index = hexStringArr.indexOf(hexStr);
// if the hexStr is not a color in the database, return without hues
if (index === -1) {
output.push(hexStr);... | true |
79f72e0d1559996162e3cba4f44d6271d500765e | JavaScript | mateheww/EncurtaPix | /server.js | UTF-8 | 1,130 | 3.171875 | 3 | [] | no_license | const http = require("http");
const app = require("express")();
const port = process.env.PORT || 3000;
const server = http.createServer(app);
server.listen(port);
app.use("/", (req, res) => {
// Obtém a data/hora atual
var data = new Date();
// Guarda cada pedaço em uma variável
data.setHours(data.getHo... | true |
c439324ddff02443b53be4a6690af2b2da5356bf | JavaScript | lmh0506/vant-vee-validate | /src/common/js/utils.js | UTF-8 | 3,611 | 2.734375 | 3 | [] | no_license | export function isJSON (val) {
if (typeof val !== 'string') {
return false
}
try {
const obj = JSON.parse(val)
if (Object.prototype.toString.call(obj) === '[object Object]') {
return true
} else {
return false
}
} catch (e) {
return false
}
}
export function isEmptyObject ... | true |
de98617a328ff8e651dd4148007be699e4f2827f | JavaScript | Bibek-Karki/Advance-JS---Manipal- | /Advance JavaScript/Form Validation.js | UTF-8 | 884 | 3.3125 | 3 | [] | no_license | function validateform(){
var name = document.userRegistrationForm.name.value;
var password = document.userRegistrationForm.password.value;
var age = document.userRegistrationForm.age.value;
var email = document.userRegistrationForm.email.value;
if (name == null || name == ""){
alert("Name c... | true |
90b23acce00a861efd56d86e34b2ffa0b865ee20 | JavaScript | inertiabeer/leetcode | /code/804.js | UTF-8 | 781 | 3.3125 | 3 | [
"MIT"
] | permissive | /**
* @param {string[]} words
* @return {number}
*/
var uniqueMorseRepresentations = function (words) {
let count=0;
let hash={};
let morseArr= [".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-", "-... | true |
bfd6b423cb2e92cc812e86c1619d175a6de68507 | JavaScript | sf-solutionfactory/PortalProveedores_SJ | /Code/Proveedores/obj/Release/AspnetCompileMerge/TempBuildDir/js/ValidarCaracteresEntrada.js | UTF-8 | 1,868 | 2.875 | 3 | [] | no_license | function soloNumeros2(e) {
key = e.keyCode || e.which;
tecla = String.fromCharCode(key).toLowerCase();
letras = " 1234567890";
especiales = [8, 37, 39, 46];
tecla_especial = false
for (var i in especiales) {
if (key == especiales[i]) {
tecla_especial = true;
brea... | true |
4381c837a334e65f6e13b14a0f019b13f3ffc1f7 | JavaScript | JordanGabay/m2-5-js--more-fundamentals-P1 | /workshop/exercises-P3_problems/exercise-3-1/app.js | UTF-8 | 842 | 3.328125 | 3 | [] | no_license | // Exercise 3-1
// ------------
// NO MODIFICATIONS OUTSIDE OF THE EXERCISE FOLDER (i.e. the css is read-only)
// Guidelines
// - write only one event listener
// - use a switch statement
const buttons = document.querySelector('.buttons');
let animations = function (event) {
const btnId = event.target.id;
c... | true |
000aa219428b6237f662a903634e7d9855138c00 | JavaScript | danilotros/Pruebas | /basico/elseif.js | UTF-8 | 1,371 | 3.375 | 3 | [] | no_license | const hora=20;
if(hora<=12){
console.log("BUENOS DIAS!");
}
//Si no se cumple verifica esta condicion y has esto si se cumple esa condicion
else if(hora>12 && hora<=18){
console.log("BUENAS TARDES!");
}else{
console.log("BUENAS NOCHES!");
}
//AGREGAR CONDICIONES PARA RESTRINGIR VALORES
if(hora>0&&hora<=12){... | true |
9b7810cc532a19ef430848d8a02e3b0889619c64 | JavaScript | zhangyuedmail/phaser3-examples | /public/src/input/mouse/pointer lock 3d rotate.js | UTF-8 | 2,793 | 2.921875 | 3 | [] | no_license | var config = {
type: Phaser.AUTO,
parent: 'phaser-example',
width: 800,
height: 600,
scene: {
preload: preload,
create: create
}
};
var game = new Phaser.Game(config);
var text;
var mesh;
var graphics;
var cursor;
function preload ()
{
// Source: https://www.youmagine.com/d... | true |
e23f20cab52bed73552493be205ced61ad6116f0 | JavaScript | newgaming/such-project-much-fun | /Conditional Statements/Ex1.js | UTF-8 | 477 | 3.5625 | 4 | [] | no_license | function exchangeNums() {
var firstNum = parseInt(document.getElementById('firstNumber').value);
var secondNum = parseInt(document.getElementById('secondNumber').value);
if (firstNum > secondNum) {
firstNum = firstNum + secondNum;
secondNum = firstNum - secondNum;
firstNum = firstNu... | true |
ccc00619ab1630d529f8af1acd7d576d5157303a | JavaScript | joshboyan/burrito-masala | /src/assets/js/map.js | UTF-8 | 639 | 2.59375 | 3 | [] | no_license | //Google Map API
function initialize() {
var mapProp = {
center: new google.maps.LatLng(45.520412, -122.680802),
zoom: 14,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("googleMap"), mapProp);
var image = 'assets/img/letter-mar... | true |
9fac3ad3fad4767a4c38e52ae962519fc30ed469 | JavaScript | Ser-Gen/ser-gen.github.com | /sandbox/clocks/cifra/gears.js | UTF-8 | 9,153 | 2.625 | 3 | [] | no_license | /*!
* Gears of CIFRA
* Vasiliev SerGen, 2012
* You can see this without punishment
*/
var oldTimeHM = 0,
oldTimeHm = 0,
oldTimeMM = 0,
oldTimeMm = 0,
check = 0,
time;
var clock = body.getElementsByTagName('clock')[0],
hours = clock.getElementsByTagName('hours')[0],
minutes = clock.g... | true |
b3dea77854f337dd44716d32d9ee889142b52147 | JavaScript | Lnmix/lnmx-utils | /lib/string.js | UTF-8 | 2,302 | 3.484375 | 3 | [] | no_license | /**
* @module String
* @copyright (c)2011-2013 Leadnomics Inc.
*/
module.exports = {
/**
* Pads a string with a certain number of a certain character until an
* allotment is reached.
*
* @param {String} subject The string to be padded.
* @param {Number} length The length to which the string should be pa... | true |
a563ac6b2f886b9e0780bb73b1b30b12e153cb96 | JavaScript | kamina04/Hackathon2021-browser-extension | /popup.js | UTF-8 | 3,004 | 2.71875 | 3 | [] | no_license | let simplifiedEng = document.getElementById("Words");
let idioms = document.getElementById("Idioms");
let transcript = document.getElementById("Transcript");
transcript.addEventListener("change", async () => {
let [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
chrome.scripting.executeS... | true |
5fb2077d39ab1c47aeb25de540a6515177ebadf8 | JavaScript | nhattruongniit/learn-javascripts | /event-loop.js | UTF-8 | 1,702 | 4.125 | 4 | [] | no_license | // synchchronous
// [1, 2, 3, 4].forEach(function(i) {
// console.log(i)
// })
// asynchronous
// function asyncForEach(array, cb) {
// array.forEach(function() {
// setTimeout(cb, 2000);
// })
// }
//
// asyncForEach([1, 2, 3, 4], function(i){
// console.log(i);
// });
// Cach 1:
let array = [1, 2, 3];
l... | true |
be985e68a589aa812870baec6c7c16be21bc1ad1 | JavaScript | edornelas/javascript-algorithms | /Sort/quickSort-pivot.js | UTF-8 | 700 | 3.546875 | 4 | [
"MIT"
] | permissive | function pivot(arr, start=0, end=arr.length+1){
var pivot = arr[start];
var swapIdx = start;
const swap = (arr, idx1,idx2) => {
return [arr[idx1],arr[idx2]] = [arr[idx2],arr[idx1]];
};
for(let i = start+1; i < arr.length; i++){
if(pivot > arr[i]){
swapIdx++;
... | true |
3b74f53ad23f9f82bc949e4b6dffdb844e482b80 | JavaScript | nordon-wang/public-node | /baas/server/index.1.js | UTF-8 | 1,503 | 2.84375 | 3 | [] | no_license | // 1. 导入相关的依赖包
const express = require('express');
const { ApolloServer, gql } = require('apollo-server-express');
// 2. 定义数据类型
// Query 类型是默认客户端查询的类型、并且该类型在服务端必须存在并且是唯一的
const typeDefs = gql`
# 课程类型
type Course {
cname: String
score: Float
}
# 学生类型
type Student{
name: String
age: Int
sc... | true |
6745794b4eec216dbca077b956ce58102a92ac72 | JavaScript | MViniciusrg/areaTeca | /biblioteca.js | UTF-8 | 429 | 3.078125 | 3 | [] | no_license | function areaLosango(DiagonalMaior, DiagonalMenor) {
return (DiagonalMaior * DiagonalMenor) / 2
}
function areaCirculo(Raio) {
return Math.PI * Raio**2
}
function areaQuadrado(lado) {
return lado*lado
}
function areaTriangulo (h, b) {
return h*b/2
}
function areaRetangulo... | true |
d6b72a7355c00b70ede925209d3ffaa29eba0aaf | JavaScript | maxdiazdev/theblaze-doa-generator | /build/js/generator.js | UTF-8 | 31,950 | 2.59375 | 3 | [] | no_license | // Grab the canvas
var canvas = document.getElementById("jsGeneratorCanvas");
// Begin generator module
var generate = (function() {
// Store canvas attributes
var settings = {
width: canvas.width,
height: canvas.height,
context: canvas.getContext("2d"),
template: canvas.dataset.template,
font: {
// Id... | true |
71c5facb750867287c8009e6381afd287f5eb4e0 | JavaScript | MishaVentura/sal-rab-homeworks | /lib/task_1.js | UTF-8 | 3,093 | 3.1875 | 3 | [] | no_license | describe('Задание №1.1. Оповещение о добавлении в корзину', () => {
it('Тест 1.1.1. Тест переменной message', () => {
const funcToThrow = () => addInCartMessage('0', 0);
expect(funcToThrow).not.toThrowError(ReferenceError, 'message is not defined');
});
it('Тест 1.1.2. Тест правильности опов... | true |
76c5b6e806ed2c9bceedb81a5ee89c069a72179c | JavaScript | godemilind/reactjs | /reduxexample/src/reducers/user-reducer.js | UTF-8 | 256 | 2.546875 | 3 | [] | no_license | import {UPDATE_USER} from '../actions/actionTypes';
export default function userReducer(state='',
{type, payload}){
console.log(payload);
switch(type){
case UPDATE_USER:
return payload.user;
default: return state
}
} | true |
f6168c732936fb956c85e901fcc717366c6b0ae1 | JavaScript | rwheagle/dadjokes | /script.js | UTF-8 | 1,091 | 2.9375 | 3 | [] | no_license | let app = new Vue({
el: '#app',
data: {
max: 10,
min: 0,
num: 0,
generate: "Generate Joke",
jokes: []
},
created() {
this.startapp();
},
computed: {
number() {
if (this.num > this.max) {
return this.max;
}
if (this.num < this.min) {
return this.m... | true |
23bc5ba329ab6b57fa00965e3df78e6258dba594 | JavaScript | Tuzosdaniel12/algorithms- | /DataStructures/DeapthFirstSearch.js | UTF-8 | 2,543 | 3.890625 | 4 | [] | no_license | class Node {
constructor(val) {
this.val = val;
this.left = null;
this.right = null;
}
}
class Tree {
constructor() {
this.root = null;
}
insert(val) {
const newNode = new Node(val);
if (!this.root) {
this.root = newNode;
return this;
}
//=======INSERTION BY LOOPING==========/
let current ... | true |
5695ebe1fba7cd9be229a9d66269bbeec3c691a0 | JavaScript | thisthat/Master-Thesis | /Application/nodeTestGraphs/routes/api/behaviour.js | UTF-8 | 2,780 | 2.515625 | 3 | [] | no_license | var express = require('express');
var router = express.Router();
var request = require('request');
//Get the lists of rules
router.get('/', function(req, res){
res.setHeader('Content-Type', 'application/json');
var db = req.db;
db.collection('Behaviour').find().toArray(function (err, items) {
res.json(items... | true |
ddd81706b6200f14991f4a95dcc8a775fdd3cb4e | JavaScript | ezkemboi/PhoneGen | /src/__tests__/App.test.js | UTF-8 | 2,221 | 2.796875 | 3 | [] | no_license | import React from 'react';
import { shallow } from 'enzyme';
import App from '../App';
describe('APP', () => {
const component = shallow(<App />);
const contacts = [
"024776563",
"046455020",
"0943165218"
]
const event = { target: { value: 3 } }
const option = { target: { value: 'Descending' } }
... | true |
186f43d2b34870c8a78942cc4abcb68624cbae95 | JavaScript | tejas77/codechef-nodejs | /Beginner/FLOW001/index.js | UTF-8 | 385 | 3.125 | 3 | [] | no_license | process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (data) {
main(data)
});
function main(data) {
let inputArr=data.split('\n');
let n=parseInt(inputArr.shift());
for(let i=0;i<n;i++){
let nosToAdd=inputArr[i].split(' ');
let sum=parseInt(nosTo... | true |
0ce2795c2cbad0925e26d15654062d47c4e48130 | JavaScript | batcodegen/MovieListDisplay | /js/components/Home/actions.js | UTF-8 | 1,287 | 2.546875 | 3 | [] | no_license | import Axios from 'axios';
import {
REQUEST_MOVIE_LIST,
MOVIE_LIST_SUCCESS,
MOVIE_LIST_FAILURE,
REQUEST_NEXT_PAGE,
} from '../../shared/constants';
const apiUrl = pageOffset => {
return `http://www.omdbapi.com/?s=Batman&apikey=eeefc96f&page=${pageOffset}`;
};
const requestMovieList = () => {
... | true |
9ce14a27314d4f99a3b0f05d4661d0e81a5745ba | JavaScript | redoCehT/post-ui-base | /js/post-detail.mjs | UTF-8 | 2,232 | 2.765625 | 3 | [
"MIT"
] | permissive | import postApi from "./api/postApi.js";
import utils from "./utils.js";
import queryString from "../libs/querystring/querystring.js";
const wrapImageWithAnchorTag = (imageElement, anchorTag) => {
imageElement.parentNode.insertBefore(anchorTag, imageElement);
anchorTag.appendChild(imageElement);
};
const createAnc... | true |
2d85902805e50acdb1db9c246ffafec53ea8b082 | JavaScript | sslowik/FrontEnd | /lab9/reactserver/index.js | UTF-8 | 1,483 | 3.0625 | 3 | [] | no_license | const express = require('express');
const bodyParser = require('body-parser');
const cors = require('cors');
const app = express();
const port = 4000;
const numbers = [];
// parse requests of content-type - application/json
app.use(bodyParser.json());
// define a simple route
app.get('/', (req, res) => {
res.json... | true |
124cb40635ce77eab0f175e5d6c1023ae1eb7258 | JavaScript | jasonasav/MoviePractice | /App.js | UTF-8 | 989 | 2.90625 | 3 | [] | no_license | import React from 'react';
class TodoApp extends React.Component {
constructor(props) {
super(props)
this.state = {
movies: [
{ title: 'Mean Girls', done: false },
{ title: 'Hackers', done: false },
{ title: 'The Grey', done: false },
{ title: 'Sunshi... | true |
40627460b3bd8f2e140ac5b361a4c213a6ba02df | JavaScript | alexandremhm/trybe-exercises | /exercises/Bloco_8/8.5/conteudo5.js | UTF-8 | 317 | 3.640625 | 4 | [] | no_license | // Muito legal, não é mesmo? Este é mais um recurso que te permite escrever códigos mais concisos! Agora é hora de praticar: altere a função getPosition utilizando a property shorthand .
const getPosition = (latitude, longitude) => ({
latitude,
longitude,});
console.log(getPosition(-19.8157, -43.9542)); | true |
f1635e7564fa064bbce7deefdf702fbfe6df5c4c | JavaScript | ivaylo91/JavaScript-Fundamentals | /03.ExpressionAndStatements/14.LastMonth/getDay.js | UTF-8 | 298 | 3.40625 | 3 | [] | no_license | /**
* @author Ivaylo Penev
*/
const getDay = function (input) {
let day, month, year;
day = input[0];
month = input[1];
year = input[2]
let lastDayPrevMonth = new Date(year, month - 1, 0).getDate();
return lastDayPrevMonth;
};
console.log(getDay([17, 3, 2002])); // 28
| true |
0e02e7717b75626c6b1cafc5899c9c40d402e488 | JavaScript | iksz1/number-comparison | /index.js | UTF-8 | 1,522 | 4.3125 | 4 | [] | no_license | // This is a NodeJS console app which uses user input to generate and compare numeric values
/**
* Validates user input
* @param {string} input
*/
const validateInput = input => {
return /^\d+[^\S\t\r\n]\d+\s*$/.test(input);
};
/**
* First value generator
* @param {number} initialValue
*/
const numberGenerato... | true |
965708dcf455fe26b430120dddbed6991b9c78fc | JavaScript | IT2810/it2810-webutvikling-h18-prosjekt-3-53 | /src/reducers/tasks.js | UTF-8 | 953 | 2.78125 | 3 | [] | no_license | const tasks = (state = [], action) => {
switch (action.type) {
case 'ADD_TASK':
let task = {
...action.task,
status: 'ACTIVE'
}
return [
...state,
task
];
case 'COMPLETE_TASK':
... | true |
351875ed699b2e1065860bf85cf8b1944141b40a | JavaScript | Ankush7012/demo-mongo | /db/queries.js | UTF-8 | 2,247 | 2.625 | 3 | [] | no_license |
function saveData(model,data) {
return new Promise((resolve, reject) => {
try {
let saveData = model.create(data);
return resolve(saveData);
} catch (err) {
return reject(err);
}
});
}
function getData(model, query, projection, options) {
return... | true |
d84ead17ee7d1dec48ba187810e5f72ce351528d | JavaScript | ekremyilmaz/goldenBall | /test/spec/controllers/main.spec.js | UTF-8 | 2,093 | 2.515625 | 3 | [] | no_license | describe('component: weighing', function() {
var $componentController;
beforeEach(module('weighingApp'));
beforeEach(inject(function(_$componentController_) {
$componentController = _$componentController_;
}));
it('On verifie que le nombre de boule passe en parametre est bien initialise dans le composan... | true |
af6f285a6858fab017b643fc0268cf0bdf0d0509 | JavaScript | KamilWasilonek/GD-UI-internship | /tasks/39_unique-in-order/unique-in-order.js | UTF-8 | 286 | 2.890625 | 3 | [] | no_license | export function uniqueInOrder(arg) {
if (arg === undefined || arg.length === 0) {
return [];
}
// eslint-disable-next-line no-param-reassign
arg = [...arg];
let result = arg.filter((val, index, arr) => {
return arr[index] !== arr[index + 1];
});
return result;
}
| true |
ab2b6dd8a00cabc6ac0ed1ecf63264133365ae82 | JavaScript | AAI-USZ/FixJS | /input/100+/after/868431e1b7cf5a13ecc273292c643109fb771bd1_3_2.js | UTF-8 | 809 | 3.125 | 3 | [
"MIT"
] | permissive | function(e, t) {
//I apologize in advance for the lack of readability here... :/
var r = e.previousSibling, //refers to the comment element
i = {}, //refers to the event Object map
h, //array holding each event type in the Object map
n; //index into h. h[n] refers to a event type
eval(r.textContent); //popula... | true |
e1e2c415d9aa0c265f6c92a4df0e4e184c3d2a03 | JavaScript | shaozecai/PAMDS | /app/utils/index.js | UTF-8 | 1,472 | 2.59375 | 3 | [] | no_license | /**
* 描述: 连接mysql模块
* 作者: shaozecai
* 日期: 2020-11-12
*/
const mysql = require('mysql');
const config = require('../db/dbConfig');
const moment = require('moment')
// 连接mysql
function connect() {
const { host, user, password, database } = config;
return mysql.createConnection({
host,
user,
password,... | true |
a48309718811dc3fa602af2fdb1e1a011e21e94a | JavaScript | LadyFromMars/JS-Tests | /factorial-Unit-test/factorial.js | UTF-8 | 394 | 3.203125 | 3 | [] | no_license | const Calculate = {
factorial(inputNumber) {
// If input is 0
if (inputNumber === 0) {
return 1;
}
//Checks If input is a number
else if (typeof inputNumber == 'number')
{
for (let i = inputNumber - 1; i > 0; i--) {
inputNumber *= i; }
return inputNumber;
}
// in input is NOT a nu... | true |
19f1e3e165575e50183734a9706c58a0fc19844f | JavaScript | jpcastanoweb/lab-dom-ironhack-cart | /js/index.js | UTF-8 | 2,762 | 3.5625 | 4 | [] | no_license | // ITERATION 1
function updateSubtotal(product) {
const price = product.querySelector('.price span');
const quantity = product.querySelector('.quantity input');
const subTotal = price.innerHTML * quantity.value;
const subTotalField = product.querySelector('.subtotal span');
return (subTotalField.innerHTML ... | true |
89c8d1c3df445fdac297878fb7f482891c593699 | JavaScript | gesaodin/azarel-admin | /js/side-server.js | UTF-8 | 3,940 | 2.765625 | 3 | [
"Apache-2.0",
"MIT"
] | permissive |
function ViewGames(){
var table = '';
console.log('Entrando en ver jugadas');
return table;
}
function writePlayingDay() {
var d = $("#txtDate").val();
if (d == "")return false;
var f = d.split("/");
var dateplay = f[2] + f[1] + f[0];
Materialize.toast('Enviando actualización...', 2000, 'r... | true |
5dcd5ae36d15c99214a1f3c3cdcec8e8394e6c1d | JavaScript | nishanj/shoe-rent | /js/rent.js | UTF-8 | 2,087 | 2.859375 | 3 | [
"MIT"
] | permissive | //backend
function Product( name, description, size, color, price, location ) {
this.name = name;
this.description = description;
this.size = Size;
this.color= color;
this.price= price;
this.location= location;
};
function showMyImage(fileInput) {
var files = fileInput.files;
for (var i ... | true |
6f844bfd0b591313ce9429ee338dbcf2e7563b43 | JavaScript | rjvandoesburg/connect-it | /resources/js/classes/Module.js | UTF-8 | 529 | 3.046875 | 3 | [] | no_license | export default class Module {
constructor(x, y, fill) {
this.x = x;
this.y = y;
this.width = 30;
this.height = 30;
this.isDragging = false;
this.fill = fill
}
isWithin(x, y) {
return (x > this.x && x < this.x + this.width)
&& (y > this.y &... | true |
8cd1acd916f19b5980853816ed4382c3f5b15f6f | JavaScript | clarenceccn/react-chat | /src/Components/MainView/MainView.js | UTF-8 | 1,305 | 2.53125 | 3 | [] | no_license | import React, { Component } from "react";
import Conversation from "../../Containers/Conversation/Conversation";
import MessageInput from "../../Containers/MessageInput/MessageInput";
import "./MainStyle.css";
class MainView extends Component {
state = {
messages: []
};
getMessages = () => {
fetch("loca... | true |
dee42d528e731c59b577c655af5f5305c795762b | JavaScript | nitram509/preZENtations | /animationszauber/js/SlideChangeController.js | UTF-8 | 555 | 2.578125 | 3 | [
"MIT"
] | permissive | // require Reveal.js
function registerSlideChangeHandler(slideId, slideChangeHandler) {
var listener = function (event) {
var e = {};
if (slideId === event.currentSlide.id) {
e.isVisible = false;
e.slideId = slideId;
slideChangeHandler.onEnter(e);
}
if (event.previousSlide && slideI... | true |
f9c668a5182d1e339865886cd5285680d9492d1a | JavaScript | IvanMladenov/AdvancedJS | /JSExamPreparation/Amazon/Skeleton/models/shoppingCart.js | UTF-8 | 520 | 2.75 | 3 | [] | no_license | var models = models || {};
(function(scope){
function ShoppingCart(){
this._items = [];
}
ShoppingCart.prototype.addItem = function addItem(item){
this._items.push(item);
};
ShoppingCart.prototype.getTotalPrice = function getTotalPrice(){
var sum = 0;
this._items.f... | true |
080e6888d12082fbbbc80d53ea488a0811d49374 | JavaScript | rizwanishaq/react-hooks | /src/contexts/BookContext.js | UTF-8 | 856 | 2.609375 | 3 | [] | no_license | import React, { createContext, useState } from "react";
import { nanoid } from "nanoid";
export const BookContext = createContext();
const BookContextProvider = ({ children }) => {
const [books, setBooks] = useState([
{ title: "name of 1", author: "rizwan", id: 1 },
{ title: "name of 2", author: "rizwan", i... | true |
8d4620cc6ed8bff7d8db480030bd86bc0726608f | JavaScript | pipe2705/Intermediate-Javascript- | /closure.js | UTF-8 | 383 | 3.34375 | 3 | [] | no_license | let encipher = shift => string =>
String.fromCharCode(...string.split("").map(l => l.charCodeAt(0) + shift));
let shiftBy5 = encipher(5);
let message = shiftBy5("Secret message");
console.log(message);
let decipher = shift => string =>
String.fromCharCode(...string.split("").map(l => l.charCodeAt(0) + shift));
le... | true |
536d938e3d3e2c36fdccbc38ff0dc2c500030711 | JavaScript | azizx018/Restaurant---Bearded-Goat | /Restaurant/restaurant.js | UTF-8 | 604 | 3.078125 | 3 | [] | no_license |
(function formValidation() {
'use strict';
window.addEventListener('load', function() {
var forms = document.getElementsByClassName('needs-validation');
var validation = Array.prototype.filter.call(forms, function(form) {
form.addEventListener('submit', function(event) {
if (form.checkVali... | true |
0d3471b5b0da2776c553c3b6ca39bc14744045c6 | JavaScript | SoleSurvivor111/Todo-list | /src/scripts/modules/filters/__active.js | UTF-8 | 882 | 2.953125 | 3 | [] | no_license | /* ########################### filter activeBtn ########################### */
const todoApp = document.querySelector('.js-todoapp');
const filterActive = () => {
const elements = document.getElementsByClassName('js-toggle');
for (let i = 0; i < elements.length; i += 1) {
const element = elements[i];
... | true |
04b723fe0c89a41e62804f4c11487adeab907741 | JavaScript | zhagan/SQL-bamazon | /bamazonCustomer.js | UTF-8 | 6,284 | 2.671875 | 3 | [] | no_license | var mysql = require("mysql");
var inquirer = require('inquirer');
var json_tb = require('json-table');
var connection = {}; //global variable so I don't have to pass it around
getCredentials();
// prompts user for localhost credentials instead
// of saving in this file and revealing passwords
function getCredentials... | true |
25db3b9922f51c87873fe9f66d576e3a5c5589ac | JavaScript | rahomohamed/lotide | /findKey.js | UTF-8 | 980 | 3.703125 | 4 | [] | no_license | const eqArrays = function (arr1, arr2) {
if (arr1.length !== arr2.length) {
return false;
} else {
for (let i = 0; i < arr1.length; i++) {
if (arr1[i] !== arr2[i]) {
return false;
}
}
return true;
}
}
const assertArraysEqual = function(arr1, arr2) {
if (eqArrays(arr1, arr2... | true |
06917e6c01641a318497c5422a7347914859e3f4 | JavaScript | KamranMoazim/Code-with-Mosh-Node-Practice | /Module-System/logger.js | UTF-8 | 586 | 2.625 | 3 | [] | no_license |
// console.log(__dirname)
// console.log(__filename)
var url = "https://localhost:3000";
// function logger(message) {
// console.log(message)
// }
// module.exports.loggingService = logger;
// module.exports.endpoint = url;
// // exports.loggingService = logger;
// // exports.endpoint = url;
// // module.expo... | true |
45d7b54e9bfe92a63a68d1224e68ba0e5826ec88 | JavaScript | FrankM1/example | /app/sections/utils/log.js | UTF-8 | 3,656 | 2.734375 | 3 | [
"MIT"
] | permissive | 'use strict';
exports.__esModule = true;
exports.logByType = undefined;
var _window = require('global/window');
var _window2 = _interopRequireDefault(_window);
var _browser = require('./browser');
var _obj = require('./obj');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default':... | true |
bf152ae03d17b73486605f418e45c8c54afc0234 | JavaScript | taylteller/job_bank | /script/jobBank.js | UTF-8 | 4,646 | 2.609375 | 3 | [] | no_license | const axios = require('axios');
const parseString = require('xml2js').parseString;
const simplify = require('./simplifyData.js');
const baseUrl = 'https://www.jobbank.gc.ca/xmlfeed/';
const english = 'en/';
const french = 'fr/';
const mainEndpoint = 'on';
const jobBank = {
_endpointCall: function(url, count=0) {
... | true |
b5e1fa7a2ec0ce7ff156160911701efd6a3f5a19 | JavaScript | divyanshcoder331/virtual-pet-1 | /Virtual-Pet-main/sketch.js | UTF-8 | 881 | 3.3125 | 3 | [] | no_license | var dog
var happyDog
var database
var foodS
var foodStock
var database
var x = 20;
function preload(){
dogImage = loadImage("Dog.png");
happyDogImage = loadImage("happydog.png");
}
function setup(){
createCanvas(500,500);
database = firebase.database();
dog = createSprite(250,250,50,50);
dog.addImage(dogImage);
foo... | true |
60813085925c616b863cb7df13c971f424522c7b | JavaScript | kks2139/Tetris | /src/component/SearchBar.js | UTF-8 | 702 | 2.71875 | 3 | [] | no_license | import React, { useState } from 'react';
function SearchBar({onSearch, style = {}}){
const [text, setText] = useState("");
const onChange = (e)=>{
setText(e.target.value);
}
const onKeyDown = (e)=>{
if(e.keyCode === 13) onSearch(text);
}
const onClick = ()=>{
onSearch(t... | true |
f46277e31a59f15beb6cb037ecdc4527898a7d3d | JavaScript | pianairco/rayan-dynamic | /src/main/webapp/scripts/NumberFormat.js | UTF-8 | 5,478 | 3.609375 | 4 | [] | no_license | /*
Author: Robert Hashemian
http://www.hashemian.com/
You can use this code in any manner so long as the author's
name, Web address and this disclaimer is kept intact.
********************************************************
Usage Sample:
<script language="JavaScript" src="http://www.hashemian.com/js/NumberFormat.js"... | true |
f1dfbf686a311a17c8cd7d26f58c2fb2e14eae3f | JavaScript | jordanSu/nodeLearning | /count-to-6/rest.js | UTF-8 | 144 | 2.859375 | 3 | [] | no_license | module.exports = function (...numbers) {
var total = 0;
numbers.forEach(function (val) {
total += val;
});
return total/numbers.length;
}
| true |
6b28989fb24bb22876eeb24c6c1cf831421e80c3 | JavaScript | tysseng/RPpresenter | /opt/presentation/content/js/counter.js | UTF-8 | 2,639 | 3.1875 | 3 | [] | no_license | /**
* Module that controls a counter. Loads and reloads config on request
*/
function Counter(options) {
var configUrl = options.configUrl;
var counter = options.counterDiv
// Function to initialize counter, adds counter to counterDiv
this.init = function(){
counter.countDown({
targetDate: {
... | true |
4cfe8ddbbc792565c9e3d2c119332b585ce6820d | JavaScript | Mikescher/AdventOfCode2019 | /js/24_solution-1.js | UTF-8 | 2,579 | 2.96875 | 3 | [] | no_license | "use strict";
var AdventOfCode2019_24_1;
(function (AdventOfCode2019_24_1) {
const DAY = 24;
const PROBLEM = 1;
async function run() {
let input = await AdventOfCode.getInput(DAY);
if (input == null)
return;
AdventOfCode.setIntermedOutputSize("5.00vw");
let grid =... | true |
30292309c3e6ae103197c19f97d20fba6cce8058 | JavaScript | mitaka00/SoftUni | /JS Core/JS Fundamentals/Strings and Regex-Exercises/06.Capture the Numbers.js | UTF-8 | 348 | 3.28125 | 3 | [
"MIT"
] | permissive | function solve(input) {
let numbers=[],match;
let pattern=/\d+/g;
for (let string of input) {
while(match=pattern.exec(string)){
numbers.push(match);
}
}
console.log(numbers.join(' '))
}
solve(['The300',
'What is that?',
'I think it’s the 3rd movie.',
'... | true |
9420f37d742c538038afcf5c969e87dcd68dddd4 | JavaScript | nodejs/readable-stream | /src/util.js | UTF-8 | 3,343 | 2.59375 | 3 | [
"MIT"
] | permissive | 'use strict'
const bufferModule = require('buffer')
const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor
const Blob = globalThis.Blob || bufferModule.Blob
/* eslint-disable indent */
const isBlob =
typeof Blob !== 'undefined'
? function isBlob(b) {
// eslint-disable-next-line in... | true |
6cd7b35f4a6bb57b487d006a316b1cc1293c7d95 | JavaScript | mikestaub/wascally | /demo/pubsub/subscriber.js | UTF-8 | 1,853 | 2.6875 | 3 | [
"MIT"
] | permissive | var rabbit = require( '../../src/index.js' );
// variable to hold the timeout
var timeout;
// variable to hold starting time
var started;
// variable to hold received count
var received = 0;
// expected message count
var expected = 10000;
// always setup your message handlers first
// this handler will handle mes... | true |
1949b5d29b40598cd2e5595ef942aff191cd68e3 | JavaScript | NataliaPlatova/toxin | /src/components/rate-button/rate-button.js | UTF-8 | 777 | 3.296875 | 3 | [] | no_license | import './rate-button.scss';
let stars = document.querySelectorAll('.rate-button__star');
const addRateHandler = function(star, id) {
star.addEventListener('click', function() {
let achievedStars = document.querySelectorAll('.rate-button__star_achieved');
for(let achievedId=0; achievedId<ac... | true |
5f4cb744c6ecee5c6915db7caf5670bdd996713f | JavaScript | linyuebin2016/93home | /js/filters/Moment.js | UTF-8 | 2,216 | 2.71875 | 3 | [] | no_license | define(['app',
"services/DateService"
], function (app) {
var deps = ["$filter", "DateService"];
/**
* 1分钟内更新的动态显示为: “刚刚”, 如果isAlwaysShowTime 为true, 则不显示这个值
* 1小时内更新的动态显示为: “n分钟前”, 如果isAlwaysShowTime 为true, 则不显示这个值
* 1小时(含)前显示: 具体更新的时间, HH:mm
* 1天以上(含)显示: X月X日+时间,
* 跨年显示: X年X月X日 +... | true |
90c096bda17d8679ad1c5b4b3c7ac553d8d20266 | JavaScript | annaimpson/backbone-likes | /app/scripts/models/like.js | UTF-8 | 361 | 2.625 | 3 | [] | no_license | var Backbone = require('backbone');
var $ = require('jquery');
var increment = 0;
var LikesModel = Backbone.Model.extend({
defaults: {
likes: 0
},
countingNumbers: function(){
increment = this.get('likes') + 1;
this.set('likes', increment);
$('.likes-button').html(this.get('likes') + ' likes');... | true |
3ee6b44d684e035df55cb4f3983704951e19f10e | JavaScript | nbstsh/cinecon-client | /src/modules/movie-manager.js | UTF-8 | 3,678 | 2.640625 | 3 | [] | no_license | import EventEmitter from 'events'
import { getRequest, postRequest, putRequest, deleteRequest, handleResponse } from './request'
import createIdbKeyval from './idb-keyval'
import config from '../config/index'
import { setFilter, needInFilteredMovies } from './movie-filter'
import firebase from './firebase-init'
const {... | true |
cf8e0ea97ecd8a1e684e4d581b96d84aa42fa27d | JavaScript | sazzer/nagademo-webmud | /lib/controllers/templates.js | UTF-8 | 1,549 | 2.734375 | 3 | [] | no_license | var templates = require("../characters/templates"),
winston = require("winston"),
util = require("util");
/**
* Get all of the templates that are defined
*/
function getAllTemplates(ignored, callback) {
winston.debug("Callback: " + util.inspect(arguments));
templates.retrieveAllTemplates(function(err... | true |
f2ac09ad8a1f1b81aea13dd10313e5ad7b4f44d3 | JavaScript | hirababu89/LeetCode | /nonDecreasingArr.js | UTF-8 | 882 | 4.125 | 4 | [] | no_license | /*
Given an array nums with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element.
We define an array is non-decreasing if nums[i] <= nums[i + 1] holds for every i (0-based) such that (0 <= i <= n - 2).
Example 1:
Input: nums = [4,2,3]
Output: true
Explanation: You cou... | true |
c7d517c3fd38cca47484e78ae6a70ddecbf857ae | JavaScript | thesilentist/EPAM | /dz3/public/javascripts/1.js | UTF-8 | 2,807 | 3.453125 | 3 | [] | no_license | // console.log("Task 1 connected");
let childrenNum = [1,2,3,4,5,6];
let husbandName = ["Patrick","Wayne","Bob","Harry","James","Daniel","Serge"];
let wifeName = ["Sendy","Perl","Lilly","Keira","Reese","Kate","Lisa"];
let cities = ["New York","Kropyvnyts'kyi","Chortkiv","Kyiv","Romashivka","Lviv","Krakiw","Praha"... | true |
1b22acb8b7d84ba75d85c08108f1a326e7590aee | JavaScript | tonyjiang88215/TJLab | /JavaScript/platform/js/util/Dom.js | UTF-8 | 2,620 | 2.703125 | 3 | [] | no_license | /**
* Created By WanXing 15/7/9 上午11:56
* Summary:
*/
define(
[],
function(){
var DomUtil={
//创建Dom
create:function(tagName){
return document.createElement(tagName);
},
//显示DOM
show:function(dom,params){
dom.s... | true |
a31bebf457c0cf1ec32556c7c451f7d04148ec2d | JavaScript | initbiz/money-plugin | /assets/js/money-helpers.js | UTF-8 | 285 | 2.8125 | 3 | [
"MIT"
] | permissive | (function ($) {
"use strict";
//right pad string for a specified length with a padString
String.prototype.rpad = function(padString, length) {
var str = this;
while (str.length < length)
str = str + padString;
return str;
}
}(jQuery));
| true |
d982b8a2869fd2ed4988b8bda6a44483ed8c6a50 | JavaScript | Archit74/project_89 | /index_2.js | UTF-8 | 530 | 2.84375 | 3 | [] | no_license | user_1 = localStorage.getItem("player1");
user_2 = localStorage.getItem("player2");
user_1_score=0;
user_2_score=0;
document.getElementById("player1_name").innerHTML=user_1+":";
document.getElementById("player2_name").innerHTML=user_2+":";
document.getElementById("player1_score").innerHTML=user_1_score;
document... | true |
7206e89e677fd69188a1c3efb88d37f2e219ed57 | JavaScript | alpnaP/NodeJS-3 | /nextTick.js | UTF-8 | 185 | 2.71875 | 3 | [] | no_license | function apiCall(arg, callback) {
if (typeof arg !== 'string')
return process.nextTick(callback,
new TypeError('argument should be string'));
} | true |