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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
e6139ff5163de21f8757a33d1d644ae90c6c8877 | JavaScript | MusfiqueHasan/rental-website | /ServerSide/router/Auth.js | UTF-8 | 2,260 | 2.515625 | 3 | [] | no_license | const jwt = require('jsonwebtoken');
const express = require('express');
const router = express.Router();
const bcrypt = require('bcryptjs');
require('../DB/Connection');
const User = require('../model/UserSchema')
const authentication = require('../middleware/authentication')
router.get('/', (req, res) => {
res... | true |
51ec1571aa7df9b10c9d4a8a2fbbc5cb887b49ba | JavaScript | alastairotter/passmark | /6sonas/utilityfunctions.js | UTF-8 | 164 | 3.203125 | 3 | [
"MIT"
] | permissive | function randomInt(min,max)
{
return Math.floor(Math.random()*(max-min+1)+min);
}
Math.radians = function(degrees) {
return degrees * Math.PI / 180;
};
| true |
03c005c1e789b83e9e58ce8d6a99831cd4121f6d | JavaScript | manank163/Django-test | /mysite/static/validation.js | UTF-8 | 1,108 | 2.515625 | 3 | [] | no_license | function validateform()
{
var x=document.forms["myform"]["name"].value;
if (x==null || x=="")
{
alert("First name must be filled out");
document.myform.name.focus();
return false;
}
var y=document.forms["myform"]["email"].value;
if (y==null || y=="")
{
a... | true |
b798bf9ee7c8f8e7ecdcedf6e46153809d6f4a74 | JavaScript | andrewbaldwin44/JavaScript_Mastermind_Game | /bin/game.js | UTF-8 | 2,621 | 3.53125 | 4 | [
"MIT"
] | permissive | function createRandomCode() {
let masterColors = [];
for (i = 0; i < 4; i++) {
let codePeg = document.createElement('div');
let hiddenCode = document.createElement('p');
let pegObject = new Peg(codePeg);
let pegColor = pegObject.randomColor();
masterColors.push(pegColor);
hiddenCode.textC... | true |
2ed64740b05240d4cf5c360f418b886faf9d2540 | JavaScript | jre23/leetcode-algorithms | /script/isPalindromeNumber.js | UTF-8 | 1,389 | 4.40625 | 4 | [] | no_license | // 9. Palindrome Number
// Easy
// 3468
// 1770
// Add to List
// Share
// Given an integer x, return true if x is palindrome integer.
// An integer is a palindrome when it reads the same backward as forward. For example, 121 is palindrome while 123 is not.
// Example 1:
// Input: x = 121
// Output: true
// Exam... | true |
f83a1dd9c011eeb1c483210fa74a976e49d9ef35 | JavaScript | RulasBoy/HGBot | /index.js | UTF-8 | 2,076 | 2.71875 | 3 | [] | no_license | const Discord = require('discord.js')
const client = new Discord.Client()
const login = require('./login.js')
var prefix = 'h'
let exp = new RegExp("(?<=^" + prefix + "(?:(?!!)|!)).+", "gi")
client.on('ready', () => { // Mensaje para la consola avisando que ya se puede usar el bot.
console.log(`Bot is rea... | true |
a7e9073649d51810533f5e63c3a9a853b66f7605 | JavaScript | ybybybybybyb/DIYBoardGames | /js/photoClippingArea.js | UTF-8 | 867 | 2.5625 | 3 | [] | no_license | var photoClippingArea = {
preload : function() {
// 加载图片是必需的,这样以后我们可以创建基于他们的sprites。
// 第一个参数是图像的别名
// 第二个是文件的路径
game.load.image('main_return', './img/main_return.png');
},
create: function () {
// 添加一个精灵到你的游戏场景,这里的精灵将是游戏的标志
// 参数为: 坐标X , 坐标Y ,图像名... | true |
f38cc5232b7804c23e1b34ec4fa2fc4463571624 | JavaScript | bloggercms/bloggercms.github.io | /js/blog.js | UTF-8 | 998 | 2.5625 | 3 | [
"MIT"
] | permissive | /**
* Created by Sarfraz on 4/3/2015.
*/
$(function () {
// enable syntax highlighting
hljs.initHighlightingOnLoad();
// lowercase link hrefs
$('a.lowercase').each(function () {
this.href = this.href.toLowerCase();
});
// set nav link as selected if on the page
var pageArray = d... | true |
b6349ec9762fa8d2c221a98d1b7d5c86f704d5f1 | JavaScript | dewq27/Gra | /server.js | UTF-8 | 5,236 | 2.515625 | 3 | [] | no_license | var http = require('http'),
fs = require('fs'),
io = require('socket.io'),
databaseUrl = "localhost/test", // "username:password@example.com/mydb",
collections = ["users", "reports"],
db = require("mongojs").connect(databaseUrl, collections),
id = 0,
gracz = [];
var app = http.createServe... | true |
40dbe988efce0a073f05626d1f5d17fef2f2fe7e | JavaScript | daief/react-demo | /src/demo14/Bundle.js | UTF-8 | 1,448 | 2.78125 | 3 | [] | no_license | /*
* @Author: daief
* @Date: 2018-06-13 17:32:55
* @LastEditors: daief
* @LastEditTime: 2018-06-14 11:30:10
* @Description:
*/
import React from 'react';
export default class Bundle extends React.Component {
state = {
mod: null
}
componentWillMount() {
this.load(this.props);
}
componentWillRe... | true |
2697845aa8830a911272ce2a1a79344f5ce0065b | JavaScript | ChrisBews/ChrisBews.github.io | /media/labs/collisions/assets/js/syrup/common/BackgroundLines.js | UTF-8 | 27,809 | 2.90625 | 3 | [] | no_license | ////////////////////////////////////////////////////////////////////////////////
// Syrup Sounds Website
// Main Site Background Lines
////////////////////////////////////////////////////////////////////////////////
class BackgroundLines {
//------------------------------------------------
// Constructor
//-------... | true |
5112be178c1b83409c3476a42d1a8f7abe6ed686 | JavaScript | PhilSurgenor/milestone2 | /assets/js/game.js | UTF-8 | 6,342 | 3.53125 | 4 | [] | no_license | /* The modal that fires at the begining serves two purposes.
The first thing it does is show you the instructions, this is great for
user experience as it lets those with no experience with the game get up to speed with how it works
very quickly. There is a small amount of friction for those users who already know h... | true |
26757e3d84bd1e01d510f2146ee8dafbf52ff335 | JavaScript | Malagasy/Tengo | /app/game/Server/utils.js | UTF-8 | 1,184 | 2.53125 | 3 | [
"MIT"
] | permissive | const utils = {};
utils.distTwoPoints = (a,b)=>{
return Math.sqrt( Math.pow( b.x - a.x , 2 ) + Math.pow( b.y - a.y , 2 ) );
}
utils.capitalizeFirstLetter = str => {
return str.charAt(0).toUpperCase() + str.slice(1);
}
utils.dirname = path => {
return path.match(/([^\/]*)\/*$/)[1];
}
utils.getAllUsersNamespace... | true |
f2502533e84acf171c6ecf2017573848aedbbf14 | JavaScript | lucasvenske/my-react-app | /src/components/CreateQuestionForm/createform.jsx | UTF-8 | 841 | 2.546875 | 3 | [] | no_license | import React, { Component } from 'react';
import './createform.css';
class createform extends Component {
constructor(props){
super(props);
this.title = "";
}
_changeTitle(evento){
evento.stopPropagation();
this.title = evento.target.value;
}
_createSarch(evento){... | true |
3f2848e59fb6703a3716f7a62edf7b02f0ef3d9b | JavaScript | brunojustino/rock-paper-scissors | /script.js | UTF-8 | 4,911 | 3.53125 | 4 | [] | no_license | let userScore = 0
let computerScore = 0
let rock = document.querySelector('#rock');
let paper = document.querySelector('#paper');
let scissor = document.querySelector('#scissor');
let userScoreDisplay = document.querySelector("#userScore");
let computerScoreDisplay = document.querySelector("#computerScore");
let resu... | true |
dd612d22b7c8d82e5024d570495b940cc2ff8cc8 | JavaScript | prophys/prophys.github.io | /js/play_logic_breakrecord.js | UTF-8 | 1,445 | 2.5625 | 3 | [
"MIT"
] | permissive | var elapseTime = 0;
var finish = false;
function checkComplete() {
if (this.squiz == null) return;
if (this.correctCount != this.fillCount) return;
var answerStr = this.answer.join(',').replace(/2/g, '0');
var sanswer = md5(answerStr);
if (sanswer != this.squiz) return;
this.end = true;
if (!this.solved) {
... | true |
16dfece52ef3c4e255579305044b89990ad4fe87 | JavaScript | pierrelh/quizzpursuit | /scripts/result.js | UTF-8 | 2,017 | 2.859375 | 3 | [] | no_license | //Prevent form default action
document.getElementById("sendScore").addEventListener("click", function(event){
event.preventDefault();
});
//When form is send
document.getElementById("sendScoreButton").addEventListener("click", function(){
var username = document.getElementById('username').value;
//Check ... | true |
26fb7571ed8e8b21ba49c4d98466cbaa39ba1e30 | JavaScript | KrupaliVasant/MERN-STACK-Batch | /Node-JS/demoStream.js | UTF-8 | 812 | 3.484375 | 3 | [] | no_license | // Stream : Readable Streams, Writeable streams, Duplex stream (both read and write), tranform
// Streams are instance of Event Emitter, deals with 4 types of events
// data: event, if some data exists to read
// end: event,reached the end of the file
// error: event, errors while reading/writing
// finish: event, flus... | true |
cefebadfee4afd3a48d47d1bbe71825863a49868 | JavaScript | gitiklar/front-end-course | /my-front-end/5 JavaScript and the DOM/40 DOM תרגול - עבודה עם/תרגיל 2/index.js | UTF-8 | 333 | 3.203125 | 3 | [] | no_license | "use strict";
const words = ["1111111111" , "22222222222222" , "33333333333" , "44444444444444", "55555555555"];
const div = document.querySelector('div');
for(let input of div.children) {
input.value = "this is my sentence";
}
for(let input of div.children) {
input.value = words[Math.floor(Math.random()*word... | true |
c1137d2c49c3790b6b58d27fdff8e5ca4e4c570d | JavaScript | laij1/AnhoWeb | /target/m2e-wtp/web-resources/search.js | UTF-8 | 4,397 | 2.8125 | 3 | [] | no_license | /**
* Handle the data returned by LoginServlet
* @param resultDataString jsonObject
*/
function handleSearchResult(resultDataString) {
jQuery("#tablediv").show();
jQuery("#receiptdiv").show();
$("#tbodyid").empty();
$("#search_error_message").text("");
$("#patientIc").text("");
resultDataJson = JSON.par... | true |
ec54e11875a7137ebef698aaab012015de1fabf7 | JavaScript | K-You/threejs-react | /src/space/common/gameAudio.js | UTF-8 | 1,226 | 2.546875 | 3 | [] | no_license | import { AudioListener, AudioLoader } from 'three';
class GameAudio {
constructor(game) {
this.musicListener = new AudioListener();
this.explosionListener = new AudioListener();
this.blasterListener = new AudioListener();
game.graphics.camera.add(this.musicListener);
game.graphics.camera.add... | true |
baeaeabbed0ed28e9937b6a02ed9999f0ccf3a95 | JavaScript | br0000d/playground | /Project Euler/euler4.js | UTF-8 | 1,301 | 4.4375 | 4 | [] | no_license | // A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
// Find the largest palindrome made from the product of two 3-digit numbers.
// http://en.wikipedia.org/wiki/Palindromic_number
// 1800 possible numbers between 100*100 and 9... | true |
f922fe8032a1a55417128d8bcd450a07611ba8e6 | JavaScript | toadermonica/HAppBackend | /utils/AuthenticationUtil.js | UTF-8 | 447 | 2.53125 | 3 | [] | no_license | import bcrypt from "bcrypt";
import isEmail from 'validator/lib/isEmail';
const saltRounds = 12;
const salt = bcrypt.genSaltSync(saltRounds);
export function hashPassword(password){
return bcrypt.hashSync(password, salt);
}
export function comparePassword(plainPassword, hashedPassword){
const test = bcrypt.com... | true |
bab5df2886556bb9118c3e5dbc0477252762ad38 | JavaScript | wildone/vue-cutter | /src/lib/mixin.js | UTF-8 | 3,997 | 2.671875 | 3 | [
"MIT"
] | permissive | export default {
computed: {
isIE() {
var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
const isIE = !!window.ActiveXObject || 'ActiveXObject' in window; //判断是否IE浏览器
return isIE;
},
passive () {
return this.isIE ? null : {
passive: false
}
}
},
method... | true |
d74f2ce1480ab33e01f7186ff8c66765eff0abbf | JavaScript | DanielRussell19/WebTechAssignment_DanielRussell | /pt2/ScotsPolitec/scripts/RegionalMap.js | UTF-8 | 19,372 | 2.796875 | 3 | [] | no_license | //Daniel Russell
// external javascript used to load maps api and handle regional map operations
//global variable
var submitPostcode;
//clear function used to clear all constituencies loaded from selection box
function clearSelection(){
var selectionbox = document.getElementById("conListing");
for(i = selec... | true |
ba1740adf15f44c388d07a54714ca86c0cbf23fd | JavaScript | msmalinosterberg/interactive-story | /script.js | UTF-8 | 2,645 | 3.53125 | 4 | [] | no_license | //Define the state for our application
let currentScene = 0
const scenes = [
{ //Scene 0
description: "Det är en grå och trist måndag morgon, matlådan är packad och klar. Det är dags att åka till jobbet. Har du nycklarna till ytterdörren?",
choices:["Ja", "Nej"],
nextScene: [1, 7]
... | true |
e0c029b7bcea945d6e6a78030f0b101704bdf77d | JavaScript | nivethadoss/react-chartjs | /src/redux/GanttChart/ganttReducer.js | UTF-8 | 781 | 2.53125 | 3 | [] | no_license | import {FETCH_GANTT_START, FETCH_GANTT_SUCCESS, FETCH_GANTT_FAILURE} from './ganttTypes';
const initialState = {
loading: false,
data: {},
error: 'No error'
}
const ganttReducer = (state = initialState, action) => {
switch(action.type){
case FETCH_GANTT_START:
return {
... | true |
d6957734457243661e362a39025c7e5286d9d36b | JavaScript | diogomdo/FlyingFunctions | /lib/flying-functions.js | UTF-8 | 7,492 | 3.1875 | 3 | [] | no_license | /*jslint browser:true */
(function () {
'use strict';
// remember: This is a study, hand build everything, no dependencies
// use all the latest and greatest that you can out of JS
// Good luck! :-)
// Optimistic Sean.
... | true |
234c7b2f58d9a6e1cbadfb72a33c95d228478b1a | JavaScript | Fuasmattn/password-reuse-manager | /background/scripts/tools/history.js | UTF-8 | 344 | 2.515625 | 3 | [
"MIT"
] | permissive | define(["jquery"], function($){
return{
searchHistory : function(){
var historyList = $('#historyList');
var searching = browser.history.search({text: ""});
searching.then(onGot);
function onGot(historyItems) {
for (item of historyItems) {
historyList.append('<option>'+item.url+'</option>');
... | true |
e6e39b950c3d4248a43f3ee0ad0f2a6032669350 | JavaScript | NutKaewnak/ssl_state_console_e- | /src/renderer/components/LandingPage/include/model/Point2d.js | UTF-8 | 325 | 2.703125 | 3 | [] | no_license | 'use strict'
class Point2d {
constructor (x, y, w) {
this._x = x
this._y = y
this._w = w
}
static createPointFromJson (obj) {
if (obj._x !== null && obj._y !== null && obj._w !== null) {
return new Point2d(obj._x, obj._y, obj._w)
} else {
return null
}
}
}
export default Poi... | true |
ce1f5b7645bde7e92113ebac173c2ee70c072aac | JavaScript | esundahl/levelmeup-solutions | /10.js | UTF-8 | 583 | 2.765625 | 3 | [] | no_license | 'use strict'
module.exports.init = function (db, words, callback) {
words.forEach(function (word) {
db.put(word.length + '!' + word, word);
});
callback();
};
module.exports.query = function (db, word, callback) {
var length = word.length;
var q = word.split('*')[0];
var result = [];
db.createReadS... | true |
47162c252da596c142b5c1874e891222a3d33bfd | JavaScript | TatsuyaYamamoto/school-idol-game-project | /packages/maruten/src/js/engine/throwAction.js | UTF-8 | 438 | 3.234375 | 3 | [
"MIT"
] | permissive | /**
* ユーザーのドラッグ操作を表すクラス
* x軸は画面下方向、y軸は画面右方向
*/
export default class ThrowAction {
constructor() {
this.startX = null;
this.startY = null;
this.endX = null;
this.endY = null;
}
getAngle() {
let displacementY = this.endY - this.startY;
let displacementX = this.endX - this.startX;
ret... | true |
305b44463197a48a26888bbf56d929537e994e54 | JavaScript | jarenal/tiny-tasks-bundle | /Resources/public/js/app.js | UTF-8 | 5,195 | 2.8125 | 3 | [
"MIT"
] | permissive | // Function for to load tasks into the table
function loadTasks(){
// GET /api/tasks
$.ajax('/api/tasks', {
type: 'GET',
accepts: 'application/json',
dataType: 'json',
error: function(jqXHR,textStatus,error){},
success: function(data, textStatus, jqXHR){
$.Mu... | true |
b89855b9d8088c6d60ee9578c82e5ed24711653a | JavaScript | tranceWorld08/multiplicationGame | /js/main.js | UTF-8 | 3,235 | 3.453125 | 3 | [] | no_license | var isPlaying = false;
var score;
var action;
var timeremaining;
var correctAnsr;
document.getElementById('startreset').onclick=
function(){
if(isPlaying){
location.reload();//reload page
} else{
isPlaying = true;
score = 0;
timeremaining = 60;
document.getElementById('... | true |
c76ba6fecbc0807ee0948e51c9563e9c60159f4e | JavaScript | ToddKenzie/reviewsite-full-stack | /src/main/resources/static/js/comment.js | UTF-8 | 381 | 2.703125 | 3 | [] | no_license | var addUsername = document.getElementById("add-username");
var addText = document.getElementById("add-text");
var submitComment = document.getElementById("submit-comment");
document.addEventListener("keyup", function() {
if(addUsername.value !== "" && addText.value !== "") {
submitComment.disabled = false;... | true |
9169a6342efb9e52279e5017327e3c211d084396 | JavaScript | lisa1704/snipping-tool-init | /snip3/app.js | UTF-8 | 1,722 | 2.8125 | 3 | [] | no_license | //imports
const express = require('express');// for creating routes
const app = express(); //initialize express
const fs = require("fs"); //read/create files
const multer = require('multer'); //for uploading files to our server
const { createWorker } = require('tesseract.js'); //for reading images
const worke... | true |
6218b0c7d39985cf22abe5c2c8e477e45102f669 | JavaScript | AlbertoOsornio/clase12 | /server1.js | UTF-8 | 313 | 2.546875 | 3 | [] | no_license | const http = require('http')
const port = 9000
const url = require('url')
const server = http.createServer(function (req,res){
const myURL = url.parse(req.url)
res.writeHead(200,{'Content-Type': 'text/plain'})
res.write(myURL.pathname)
res.end()
//console.log(req.url)
})
server.listen(port) | true |
a1b328df777b5376cee816d631d7fcebf8f24b4e | JavaScript | AERM2018/curso-node-restserver | /controllers/productosCotroller.js | UTF-8 | 3,161 | 2.65625 | 3 | [] | no_license | const { response } = require("express")
const { Producto } = require("../models")
const getProductos = async(req, res = response) => {
const { limite = 5, desde = 0} = req.query;
const query = { estado: true }
try {
const [total, productos] = await Promise.all([
Producto.countDocuments... | true |
603bc3bd40761fd99ad24f65fb0c3cf5f0bd865e | JavaScript | Akroman/IBT | /src/mesh.js | UTF-8 | 7,564 | 2.765625 | 3 | [] | no_license | /**
* @author Matěj Hlávka
* @module Mesh
*/
import * as twgl from "twgl.js";
import {glMatrix, mat4, vec2, vec3} from "gl-matrix";
import SceneObject from "./sceneObject";
/**
* Class representing parsed object from objParser
* @extends SceneObject
*/
export default class Mesh extends SceneObject
{
/**
... | true |
c51347a3b57dcc7f989c7732df6346a030061b06 | JavaScript | mohanpierce99/teachifyproject | /js/homepage.js | UTF-8 | 7,999 | 2.546875 | 3 | [
"MIT"
] | permissive |
(function () {
var slideout = new Slideout({ ///slideout menu
'panel': document.getElementById('panel'),
'menu': document.getElementById('menu'),
'padding': 225,
'tolerance': 70
});
document.querySelector('#cool').addEventListener('click', function () {
this.classList.toggle("is-active");
s... | true |
880c2963a4ca16a0b1c4f332c508b1e82012ec53 | JavaScript | SaYmon161/FriendsFilter | /src/js/storage.js | UTF-8 | 253 | 2.65625 | 3 | [] | no_license | let readFromStorage = function(storage) {
this.friendsArray = JSON.parse(storage || '[]');
};
let saveToStorage = function() {
let storage = JSON.stringify(this.friendsArray);
return storage;
};
export { readFromStorage, saveToStorage };
| true |
e43731772db5c27ab318412587df4ad5e86a2c2f | JavaScript | ChanMo/tinyshop | /docs/js/_slide.js | UTF-8 | 3,143 | 2.859375 | 3 | [] | no_license | /**
* Slide
* http://github.com/ChanMo/juss.git
*
* @version 2.0.0
* @date 28/12/16 16:31:11
* @author chen
* @email chen.orange@aliyun.com
*
* Example useage:
* $("#slide").slide({
* auto: true,
* time: 2000
* });
*
*/
// plugin constructor
var Slide = function(elements, subjects, options){
this.... | true |
f1b781d64b262e0e1227051aef4f5e79d418f20b | JavaScript | gtht4242/co-opteering | /src/js/states/enter_seed.js | UTF-8 | 4,504 | 2.640625 | 3 | [] | no_license | class EnterSeed extends Menu {
create() {
// Reset world scale
this.game.world.scale.set(1);
// Create instruction text
this.instructionText = this.game.add.text(this.game.world.width / 2, this.game.world.height / 4, 'Enter map code');
this.instructionText.anchor.setTo(0.5, 0... | true |
291bd3dee616db2279899eac74605a0d731ffb32 | JavaScript | uppsalatech/uppsalatechmap | /gatsby-node.js | UTF-8 | 1,040 | 2.53125 | 3 | [] | no_license | /**
* Implement Gatsby's Node APIs in this file.
*
* See: https://www.gatsbyjs.org/docs/node-apis/
*/
// You can delete this file if you're not using it
var fs = require("fs");
exports.createPages = async ({ actions: { createPage } }) => {
// `getPokemonData` is a function that fetches our data
const com... | true |
37e265763569993736e957f5988a989c6a9295aa | JavaScript | teacherlyio/react-sketch | /src/polygon.js | UTF-8 | 3,376 | 2.875 | 3 | [
"MIT"
] | permissive | /*eslint no-unused-vars: 0*/
import FabricCanvasTool from './fabrictool'
const fabric = require('fabric').fabric;
var roof = null;
var roofPoints = [];
var lines = [];
var lineCounter = 0;
var drawingObject = {
type: "",
background: "",
border: ""
};
var x = 0;
var y = 0;
function Point(x, y) {
this... | true |
bd9887cfcc554ee80a8bcfc66119b818cc75c2fc | JavaScript | Park-KwonSoo/MathMatter | /Mathmatter_server/src/api/write/write.ctrl.js | UTF-8 | 4,338 | 2.59375 | 3 | [] | no_license | const Write = require('../../models/write');
const jwt = require('jsonwebtoken');
/**
* POST Writing
*/
exports.writing = async (ctx) => {
const token = ctx.cookies.get('access_token');
if(!token) {
return;
}
try {
//제목과 내용을 입력하면 그것으로 받아옴
const { title, body } = ctx.req... | true |
f292f761de566fc0d9c691397edee11d6490a06a | JavaScript | Vadim1010/js-school-tasks | /js/script.js | UTF-8 | 3,639 | 3 | 3 | [] | no_license | var games = {
pause: false,
points: 0,
time: 60,
users: [],
};
function User(name, pointer) {
this.name = name;
this.pointer = pointer
}
(function () {
var start = document.getElementsByClassName('start')[0],
field = document.getElementsByClassName('game__field')[0],
poi... | true |
ea26de0c73376f59beb2a8bde0a4ac78e5a05f63 | JavaScript | arraffi/nnlenne_sz | /js/main.js | UTF-8 | 3,688 | 3.140625 | 3 | [] | no_license | var dateNow = new Date();
var hstr = ["очень низкий", "низкий", "ниже среднего", "средний", "выше среднего", "высокий", "очень высокий"];
var heights=[heights_m,heights_g];
function loadDefaults()
{
document.forms[0].elements["date"].max = dateNow.toISOString().substring(0,10);
document.forms[0].elemen... | true |
3884b10f4f4374519a9833b8a2268495b40cf0e8 | JavaScript | MomsFriendlyDevCo/agents | /examples/session.agent.js | UTF-8 | 664 | 2.734375 | 3 | [
"MIT"
] | permissive | /**
* Example agent to test pm2 process status
*
* @param {Object} [settings] Settings
* @param {number} [settings.complete=true] Allow the agent to finish
*
* @example Retrieve a mock result
* agents.get('session', {complete: true}).then(result => { ... })
*/
var _ = require('lodash');
module.exports = {
id: 'sessio... | true |
97f894241b715982a3b5a1ab03d1cad6266abf5e | JavaScript | ANSIKUNJUMONPK/LuminarMeanStack2020 | /works/html works/objectorientedprogramming/functionalprogrmming.js/arrowfn.js | UTF-8 | 284 | 3.328125 | 3 | [] | no_license | f=(num1,num2)=> (num1+num2);
console.log(f(10,20));
f=(num1,num2)=>(num1-num2);
console.log(f(20,10));
f=(num1,num2)=>(num1*num2)
console.log(f(20,10));
f=(num1,num2)=>(num1/num2);
console.log(f(20,10));
f=(num1,num2)=>num1%num2
console.log(f(20,10))
f=(num)=>num**3
console.log(f(3)) | true |
bb0f216ced151e3c4687f3fa2573a59186485783 | JavaScript | jaydeepdholakia/30-Days-Of-Smart-Contract | /1-Hello-World-Project/client/src/App.js | UTF-8 | 3,489 | 2.671875 | 3 | [] | no_license | // import Web3 from "web3";
import React, { useState } from 'react'
import { Footer } from "./components/Footer";
import {ethers} from 'ethers'
import HelloWorldContract from './artifacts/contracts/HelloWorld.sol/HelloWorld.json'
const contractAddress = "0x5fab27465bf6927686c958c2d39a0fa890cdb5af"
function App() {
... | true |
86781c567f314fe1339c271ee879ef8f2d727e0a | JavaScript | Ch1pStar/verlet-mesh-cloth | /pixi/src/_old/main.js | UTF-8 | 2,514 | 3.015625 | 3 | [] | no_license | let width = window.innerWidth;
let height = window.innerHeight;
let renderer = PIXI.autoDetectRenderer({
// let renderer = new PIXI.CanvasRenderer({
width, height,
backgroundColor: 0,
clearBeforeRender: false,
antialias: true
}), view, stage = new PIXI.Container();
let points = [];
let sticks = [];
l... | true |
6d433afbc1731cde9b0c9641ceb8b136bd6fa2e2 | JavaScript | Ghost08/nodebattleapi | /models/utililty.js | UTF-8 | 1,693 | 3.0625 | 3 | [] | no_license | 'use strict';
function utility() {
utility.prototype.fnDistinct = function (sourceArray, parameter) {
let tempDistinct = [...new Set(sourceArray.map(obj => obj[parameter]))];
return tempDistinct.filter(obj => obj != null && obj != "");
}
utility.prototype.fnSortandCount = function (source... | true |
d5a3907ed1cdb3222ff3a26355eedbdcff66a260 | JavaScript | bparthu/event-driven-bar | /app/index.js | UTF-8 | 1,480 | 2.546875 | 3 | [] | no_license | const faker = require('faker')
const logUpdate = require('log-update')
const uuid = require('uuid').v4
const BarManager = require('./model/Domain/BarManager')
const CONSTANTS = require('./constants')
const template = require('./template')
const ConsoleObserver = require('./model/Observer/ConsoleObserver')
const Bouncer... | true |
183e690e52296bed183d83c79832bd9da205922f | JavaScript | amriksarang/amriksarang.github.io | /script.js | UTF-8 | 665 | 2.65625 | 3 | [] | no_license | $(document).ready(function(){
$(".menu-icon").click(function(){
$("nav div").css("display", "block");
$(".menu-icon").hide();
$(".menu-close-icon").show();
});
$(".menu-close-icon").click(function(){
$("nav div").hide();
$(".menu-close-icon").hide();
$(".men... | true |
398fa197f6550ef8bc5f2d45a1ba9f299ee4eb23 | JavaScript | pb25193/Mead-JS | /Section 3 - Objects/string-methods.js | UTF-8 | 368 | 3 | 3 | [] | no_license | let p = 'hello my fren!!';
// length
console.log(p.length);
console.log(p.toUpperCase());
let password = "6iuhioopasswjordgkfyu76";
let isValidPassword = function(password){
return !(password.includes('password') || password.length < 8);
}
console.log(isValidPassword('jgjh'));
console.log(isValidPassword('jgj... | true |
544864b37002b4d5c3ba2a42e5636be44bd632ed | JavaScript | daver54321/Web-Developer-Bootcamp-Course | /17 - Color Game Project/colorGame.js | UTF-8 | 6,384 | 3.84375 | 4 | [] | no_license | //Setup
var squareValues;
var squares = document.querySelectorAll(".square");
var winner;
var lowerLimitArray;
var upperLimitArray;
SetDifficulty("Easy");
var buttons = document.querySelectorAll(".difficulty");
buttons.forEach(element => {
element.addEventListener("click", function () {
SetDifficulty(elem... | true |
d3c0e9d2b663c15f7c0c6655b376d9a1cf60bd6f | JavaScript | bmiller18/SD1101 | /Lesson 8/8-3examples.js | UTF-8 | 613 | 3.984375 | 4 | [] | no_license | "use strict"
//methods
var myString = "The Cat In The Hat";
var newString = myString.replace("Hat", "Box");
console.log(myString);
console.log(newString);//changing words within string
var newString2 = myString.split("Cat");
console.log(newString2);
console.log(newString2[0]);
console.log(newString2[1]);//... | true |
f8b3f7e73dbc588b5e50ef2d9652061cc6e567f5 | JavaScript | googlermridul/open-weather | /script.js | UTF-8 | 1,122 | 3.328125 | 3 | [] | no_license | const searchBtn = document.getElementById("searchBtn");
searchBtn.addEventListener("click", showData)
function showData() {
const cityName = document.getElementById("inputField").value;
const api = `https://api.openweathermap.org/data/2.5/weather?q=${cityName}&appid=de9fca4c28fcfa367fb01b6cc7abd9d2`;
... | true |
8f57ba7f88a0104f8f2ddcdf8c3645dc61946f1d | JavaScript | Sarulathaanbu/hyf-homework | /javascript/javascript1/week2/student.js | UTF-8 | 963 | 3.984375 | 4 | [] | no_license | const class07Students = [];
function addStudentToClass(studentName) {
if (class07Students.length >= 6 && studentName !== "Queen Margrethe II") {
console.log("Cannot add more students to class 07");
return;
}
if (class07Students.includes(studentName)) {
console.log(`Student ${studentName} is already i... | true |
c1dab7b2538ce58822bc9b6d477aa628a850adf4 | JavaScript | revaturelabs/Salesforce-Community-Interview-Board | /JSStyleGuide.js | UTF-8 | 1,078 | 2.84375 | 3 | [] | no_license | //JS STYLE GUIDE
//If unsure, defer to the class style guide
({
//spaces around :
//component, event, and helper should only be renamed if
//their use is very unclear otherwise
//lists of Params should have a space after each ,
doInit : function(component, event, helper){
//use const first, then let. v... | true |
941cdf74915ace303b25443ce35335baca1ff582 | JavaScript | dbcosta/prayer-warriors-app | /public/js/script.js | UTF-8 | 291 | 3.046875 | 3 | [] | no_license | const setActive = () => {
let buttons = document.querySelectorAll("a");
console.log(buttons);
buttons.forEach((button) => {
button.addEventListener("click", () => {
button.forEach((btn) => btn.classList.remove("active"));
this.classList.add("active");
});
});
};
| true |
5ffb4804153a416bc88e5f9b9427c78e8fd9ae8d | JavaScript | KIET7UKE/HTML-CSS-JavaScrpt-Animation-Effects | /VIDEO_EFFECT/script.js | UTF-8 | 378 | 3 | 3 | [
"MIT"
] | permissive | const dot = document.querySelector('.dot');
const sec = document.querySelector('.sec');
dot.onclick = function(){
dot.classList.toggle('active');
sec.classList.toggle('active');
}
document.addEventListener("mousemove",function(e){
const dot = document.querySelector('.dot');
dot.style.left = e.... | true |
7af829c858a73ca04687b09ea2c9afe8888dfd7f | JavaScript | natalie-gorban/di-exercises-natalie | /react_week9/day4/xp/src/components/Counter.js | UTF-8 | 1,442 | 2.703125 | 3 | [] | no_license | import React from 'react';
import { connect } from 'react-redux';
import { store } from '../store';
import { increment, decrement, incrementOdd, incrementAsync } from '../actions'
const Counter = (props) => {
const handleSubmit = (event) => {
event.preventDefault();
console.log('handleSubmit', event)
con... | true |
d6d6a82f4c20806cf0b9bdb771ab2508a671a3d9 | JavaScript | Raghavkhakholia/CLASS-34 | /sketch.js | UTF-8 | 1,113 | 2.65625 | 3 | [] | no_license | const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Constraint = Matter.Constraint;
var engine,world;
function setup(){
createCanvas(3000,800);
engine = Engine.create();
world = engine.world;
ground = new Ground(1500,700,3000,20);
box1 = new Box(1000,100,70,70)... | true |
ca3ea62ec14f8cb4f71adf6dabae0839e79214fa | JavaScript | NooraYaqub44/react-hooks-redux-use-dispatch-lab | /src/__tests__/restaurantSlice.test.js | UTF-8 | 594 | 2.515625 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import { createStore } from "redux";
import restaurantsReducer, {
addRestaurant,
} from "../features/restaurant/restaurantsSlice";
describe("restaurantsReducer", () => {
test("updates the store on successful dispatch", () => {
let store = createStore(restaurantsReducer);
store.dispatch(
addRestauran... | true |
73a30de730b56c41fef8a490201c4de29a24a884 | JavaScript | MiguelPedrosa/LAIG_2019-2020 | /TP3/code/Parser/XMLscene.js | UTF-8 | 23,516 | 2.515625 | 3 | [] | no_license | var DEGREE_TO_RAD = Math.PI / 180;
/**
* XMLscene class, representing the scene that is to be rendered.
*/
class XMLscene extends CGFscene {
/**
* @constructor
* @param {MyInterface} myinterface
*/
constructor(myinterface) {
super();
// Altered by the interface. Used to check ... | true |
238d824ac66566fd31c8354448488f858d48d9a8 | JavaScript | 360macky/lyrics-machine | /src/components/App.js | UTF-8 | 6,386 | 2.6875 | 3 | [
"MIT"
] | permissive | import React from 'react';
class MainForm extends React.Component {
constructor(props) {
super(props);
this.state = {
artist: '',
title: '',
lyrics: '',
thereAreLyrics: null,
isLoading: false,
};
this.handleSubmit = this.ha... | true |
bb31c281661b18bb546de4f56c3a8def2d0073e7 | JavaScript | somsubhra1987/Vaishy-Vivah-Bandhan | /web/themes/backend/default/js/admin_order.js | UTF-8 | 832 | 2.84375 | 3 | [
"BSD-3-Clause"
] | permissive | function numberFormat(val, decimalPlaces)
{
var multiplier = Math.pow(10, decimalPlaces);
return (Math.round(val * multiplier) / multiplier).toFixed(decimalPlaces);
}
function updateVolumetricWeight(rowID)
{
var divID = 'weightRw'+rowID;
var widthList, lengthlist, heightlist, volWeight;
$('#'+divID+' input[... | true |
25bc49f7e5599e6ebd756272d4c3a2e518331890 | JavaScript | tania-shevtsova/goit-fe-course | /javascript/module-06/task3.js | UTF-8 | 285 | 2.984375 | 3 | [
"Unlicense"
] | permissive | import users from "./users.js"
const getUsersWithGender = (users, gender) => {
return (users.filter(gen => {
return (gen.gender === gender)
}).map(val => val.name));
}
console.log(getUsersWithGender(users, 'male')); // [ 'Moore Hensley', 'Ross Vazquez', 'Carey Barr', 'Blackburn Dotson' ]
| true |
2eb724db3b96467d41c2018f7789e1a9cd5fba59 | JavaScript | pescel/walker-texas-rangerBox | /app/components/Jokes/Jokes.js | UTF-8 | 1,407 | 2.703125 | 3 | [] | no_license | import React, { Component } from 'react';
import { Link } from 'react-dom';
import Input from '../Input/Input';
import JokeCards from './JokeCards';
export default class Jokes extends Component {
constructor(props) {
super(props);
this.state = {
jokes: [],
jokeNum: 0,
favorites: []
}
... | true |
dec73a3e79ffb259ceb815935883bbb6dcf621e8 | JavaScript | Moataz-Mahmoud/backbase_task | /backbase_task/CreatePage.js | UTF-8 | 3,675 | 2.75 | 3 | [] | no_license | var Page = function()
{
//home page elements
var addButton = element(by.id('add'));
//add page elements
var computerName = element(by.id('name'));
var introducedDate = element(by.id('introduced'));
var discontinuedDate = element(by.id('discontinued'));
var company = element(by.id('company')... | true |
669d5db60cd509c006b099072be5eebe7a241663 | JavaScript | johnkommas/JS | /main.js | UTF-8 | 13,535 | 3.75 | 4 | [] | no_license | // Μια μεταβλητή είναι ένα συμβολικό όνομα για μια τιμή.
// Οι μεταβλητές δηλώνονται με τη λέξη-κλειδί let:
let x; // Δηλώστε μια μεταβλητή με ... | true |
0bb44eaebd358a2d1894698c70480ce4eb707df4 | JavaScript | MisionTeam/MisionFrontend | /src/store/shared/serverRecord.js | UTF-8 | 863 | 2.59375 | 3 | [
"MIT"
] | permissive | import Immutable from 'immutable';
/**
* This factory will return an Immutable Record factory function that will have the props you specify as well
* as the loading props. Use this to make models that contain data from the server.
*/
const ServerRecord = (props) => {
const Record = Immutable.Record({
isLoadi... | true |
925b8b4bbe58de11ccd4fdd60e763e15f6f8aa88 | JavaScript | jest-community/jest-junit | /utils/buildJsonResults.js | UTF-8 | 10,863 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | 'use strict';
const stripAnsi = require('strip-ansi');
const constants = require('../constants/index');
const path = require('path');
const fs = require('fs');
const getTestSuitePropertiesPath = require('./getTestSuitePropertiesPath');
const replaceRootDirInOutput = require('./getOptions').replaceRootDirInOutput;
// ... | true |
b5267c483c885211c81aa5f30b41b095e2c999ac | JavaScript | taitulism/Bootstruct | /src/utils/for-in.js | UTF-8 | 189 | 2.8125 | 3 | [
"MIT"
] | permissive | const hasOwnProp = require('./has-own-prop');
module.exports = function forIn (obj, fn) {
for (const key in obj) {
if (hasOwnProp(obj, key)) {
fn.call(obj, key, obj[key]);
}
}
};
| true |
2796c57d2f322f0a50310dfd5ae5d096d5982202 | JavaScript | junnumohd/javascript | /jscode/others/object.js | UTF-8 | 879 | 3.046875 | 3 | [] | no_license | var arr = [
{
name: "Zubair",
age: 32,
jobType: "private"
},
{
name: "Junaid",
age: 29,
jobType: "gov"
},
{
name: "Rahul",
age: 23,
jobType: "private"
},
{
name: "Ravi",
age: 33,
jobType: "gov"
... | true |
c23e62de02a0b22d7de0366a32bc0664b8b2ea63 | JavaScript | marvizusd/You-Should-Know-DS | /Arrays/Rearrangement/easeTheArray.js | UTF-8 | 558 | 3.546875 | 4 | [] | no_license | // Input : arr[] = {2, 2, 0, 4, 0, 8}
// Output : 4 4 8 0 0 0
// Input : arr[] = {0, 2, 2, 2, 0, 6, 6, 0, 0, 8}
// Output : 4 2 12 8 0 0 0 0 0 0
function easeTheArr(arr){
for(let i = 0; i < arr.length - 1; i++){
if(arr[i+1] !== 0 && arr[i+1] == arr[i]){
arr[i] = arr[i] * 2;
arr[i+... | true |
93801aa1ec2640acc767f0397a369bf98c1c4bc9 | JavaScript | Hayden94/CatClicker | /js/script.js | UTF-8 | 7,074 | 2.8125 | 3 | [] | no_license | var model = {
currentCat: null,
showAdmin: false,
cats: [
{
clickCount: 0,
name: 'Cherry',
imgSrc: 'https://www.petfinder.com/wp-content/uploads/2012/11/91615172-find-a-lump-on-cats-skin-632x475.jpg'
},
{
clickCount: 0,
name... | true |
252c22b60f77a8edddccd0c3b32b50bd401a5e69 | JavaScript | roydaniels/SC-Example-ChatClient | /chat_server.js | UTF-8 | 973 | 2.578125 | 3 | [] | no_license | var express = require('express'),
app = express.createServer();
app.get('/', function (req, res) {
res.send('welcome to node.js via express!');
});
app.listen(8124, "127.0.0.1");
console.log('Server running at http://127.0.0.1:8124/');
//*****************************************************************
// ... | true |
6771b261f90b942232dedcb6a46ef693d3ef137a | JavaScript | bastienEichenberger/Novelty | /Transpose.jsx | UTF-8 | 2,034 | 3.296875 | 3 | [] | no_license | /*
Transpose.jsx
An InDesign CS5 Javascript
Bruno Herfst 2010
Transposes outer characters in selection
(or words in bigger selections)
EXAMPLE OUTPUT:
-------------------------------------------------------
selection | replacement
-------------------------------------------------------
e’ ... | true |
2645f9b765c12d444d6fbf4eaa13ea30ece5f4e7 | JavaScript | RoSkry/ReactRedux | /src/App.js | UTF-8 | 1,270 | 2.515625 | 3 | [] | no_license | import React from "react";
import logo from "./logo.svg";
import "./App.css";
import { connect } from "react-redux";
import { changeNameAction } from "./redux/actions/appActions";
import CounterControls from "./components/CounterControls";
import CounterView from "./components/CounterView";
class App extends React.Com... | true |
24f25e0d80debc4c94b83ae3e3af7db8cb7922e1 | JavaScript | Marod12/Cod_puppeteer | /index.js | UTF-8 | 3,196 | 2.875 | 3 | [] | no_license | require('dotenv').config();
const puppeteer = require('puppeteer');
// lib do puppeteer = https://github.com/puppeteer/puppeteer
async function robo() {
const browser = await puppeteer.launch({
headless: true,
});
const page = await browser.newPage();
// mudando a visualização da página
await page.s... | true |
6e8f3f74e632d71316a4fcb655a52b1665abf7b4 | JavaScript | ZHUPEIQI7/test-demo | /index.js | UTF-8 | 1,026 | 2.515625 | 3 | [] | no_license | console.log("index.js");
// import "./promise/promise-1";
import demo1 from "./demo-1";
import * as demo2 from "./demo-2";
import { obj, c } from "./demo-2";
// console.log(demo1);
// console.log(demo1.c(demo1.a, demo1.b));
let a = demo1.c(demo1.a, demo1.b)
a.then(data => {
console.log('111', data);
return demo... | true |
97f5168aff101aa2f65d9916cc404d022263597c | JavaScript | Kukkik42/trusted-types | /src/types/trustedscripturl.js | UTF-8 | 1,656 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | /*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... | true |
8f3c98cfcea2f149a8b76d5986d7e3fb5fc8acde | JavaScript | IPT-TI2-2020-2021/React-tA-tB-state | /src/App.js | UTF-8 | 3,442 | 3.578125 | 4 | [] | no_license | // App.js
// Esta classe será o ponto de partida da nossa aplicação
//************************************************************* */
// importar da pasta 'node_modules' a package do React
import React from 'react';
// importar os componentes 'Tabela' e 'Formulario'
import Tabela from './Tabela'
import Formulario f... | true |
f0d81b56a323d79719a4fe87efd9629469f230da | JavaScript | aggronerd/progressive-string-morpher | /integration.test.js | UTF-8 | 772 | 2.859375 | 3 | [
"MIT"
] | permissive | /**
* Test for compiled Javascript.
*/
describe('readme example', () => {
it('logs expected', () => {
const log = jest.fn();
// eslint-disable-next-line global-require
const { morph } = require('./dist');
const transition = morph('More', 'Rome!');
do {
log(transition.getCurrentString());
... | true |
01226b0e213b5596a71b13077283d4c2983ef887 | JavaScript | joannatko/FabFlix | /FabFlix/web/star.js | UTF-8 | 7,541 | 2.8125 | 3 | [] | no_license | const fetchGenres = async () => {
const data = await fetch(
`api/genres`,
{
method:"GET",
headers:{
'Content-Type': 'application/json'
}
}
)
const json = await data.json()
const ele = document.getElementById('genres')
const... | true |
f4df2b41d088a550cceec95fb51e4b633328e8ac | JavaScript | igor923/webS | /les7(ajax)/js/main.js | UTF-8 | 655 | 2.640625 | 3 | [
"MIT"
] | permissive |
$(document).ready(function(){
var resRates;
var urlCur = "http://api.fixer.io/latest";
$.ajax({url: urlCur}).then(function(res){
resRates = res.rates;
resRates['EUR']=1;
});
$('.calc').on("click",function(){
var cur1 = $("#cur1 option:selected" ).text();
var cur2 = $("#cur2 option:selected" ).text();
... | true |
0f6f2c85649c1797c2bfa00a6b0e53544c1bf40b | JavaScript | colesbj/bi6 | /init/public/js/controllers/inventory.controller.js | UTF-8 | 1,304 | 2.515625 | 3 | [] | no_license |
// Instantiate the controller
angular.module('autoMedic')
.controller('inventoryController', inventoryController);
// Load in our dependencies for this controller (we need _med!)
inventoryController.$inject = [
'$scope',
'_med',
// Resolves
'meds'
];
function inventoryController($scope, _med, meds) {
$s... | true |
e5ecefc9ad5713a8c42d7bec1c51b5420d418b11 | JavaScript | bebensiganteng/algorithm_challenge | /easy/validSubsequence/index.js | UTF-8 | 702 | 4.03125 | 4 | [] | no_license | const isValidSubsequence1 = (array, sequence) => {
let next = -1;
let i = 0;
while(i < sequence.length) {
const v = sequence[i];
const c = array.indexOf(v);
if(c > next) {
array[c] = "x";
next = c;
} else {
return false;
}
i++;
}
return true;
}
const isValidS... | true |
765bd224c947c30b01bbbbce6e9149e2a6cbfe83 | JavaScript | X-Nozi/Antiraid-bot-Oliver-v0.1 | /commands/locktime.js | UTF-8 | 2,894 | 2.59375 | 3 | [] | no_license | const Discord = require('discord.js');
const { RichEmbed } = require("discord.js");
const ms = require("ms")
exports.run = (client, message, args) => {
if (!message.member.hasPermission('MANAGE_MESSAGES')) return message.channel.send("Oops | Vous n'avez pas la permission d'utiliser cette commande")
... | true |
e1646135711feb22beec2c07e67b344a48220822 | JavaScript | jessLomo/project | /src/js/common.js | UTF-8 | 11,382 | 3.734375 | 4 | [
"MIT"
] | permissive | /*
* 封装常用方法
* 提取公共代码
*/
/**
* [生成一个范围内的随机整数]
* @param {Number} [min] [范围最小值]
* @param {Number} [max] [范围内最大值]
* @return{number} [返回随机整数]
*/
function randomNumber(min,max){
return parseInt(Math.random()*(max-min+1) + min);
}
/**
* [生成随机颜色]
* @return{String}[返回rgb颜色字符串]
*/
function randomCol... | true |
a3ea7d20fc9990f1535bd1130354c4d0ca4162ad | JavaScript | rkaw92/esdf | /utils/SagaQueueSubscriber.js | UTF-8 | 1,407 | 2.59375 | 3 | [
"MIT"
] | permissive | var esdf = require('esdf');
var when = require('when');
function SagaQueueSubscriber(sagaConstructor, subscriberObject, options){
if(!(sagaConstructor instanceof Saga)){
throw new Error('SagaQueueSubscriber requires a constructor derived from Saga');
}
if(options.queueName){
this._queueName = options.queueName;... | true |
fdefc9f456b7d51e3262c7463767fa4d27a41324 | JavaScript | SangeethaKannas/dsa | /javascript-dsa/algorithms/binary-search-tree.js | UTF-8 | 9,266 | 4.21875 | 4 | [] | no_license | Given a binary tree, return the list of node values in zigzag order traversal. Here's an example
# Input:
# 1
# / \
# 2 3
# / \ / \
# 4 5 6 7
#
# Output: [1, 3, 2, 4, 5, 6, 7]
Here's some starter code
class Node:
def __init__(self, value, left=None, right=None):
self.valu... | true |
f3a9ea8c0695a7132d6973a00a53fa4781317075 | JavaScript | MartinMtandi/MealieMealDistributionSys | /src/actions/householdActions.js | UTF-8 | 1,971 | 2.625 | 3 | [
"MIT"
] | permissive | import axios from 'axios'
import { FETCH_HOUSEHOLD, NEW_HOUSEHOLD, SET_SUCCESS, GET_ERRORS } from "./types";
export function fetchHouseholds() {
console.log("schedule");
return async function (dispatch) {
await axios.get("http://maize.ubhejanelabs.com/api/households")//http://maize.ubhej... | true |
c9d379c5c0f23d18fabb2da6017ff7c30ba8a418 | JavaScript | KahootCloneFox/quizzler-server | /app.js | UTF-8 | 3,411 | 2.5625 | 3 | [] | no_license | const express = require('express')
var cors = require('cors')
const fetchApi = require('./helpers/quiz-api')
const PORT = process.env.PORT || 3000
const app = express()
app.use(cors())
const server = require('http').createServer(app)
const io = require('socket.io')(server)
const publicData = {
userId: 1,
roomId: 1... | true |
1515129265346076ff3c3f6a7e1271479800c199 | JavaScript | xkeops/wpPlugins | /mississaugabikes/front-end-user-management/js/shadowdom.js | UTF-8 | 443 | 2.53125 | 3 | [] | no_license | jQuery(document).ready(function($){
function loadShadowDom(){
var div = document.querySelector( "#shadowDom" );
var template = document.querySelector( "template" );
var sh;
if ( 'attachShadow' in div )
sh = div.attachShadow( { mode: "closed" } ); //Shadow DOM v1
else
sh = div.createShadowRoot();... | true |
dd70831bc4f5f9749fc3e11c42a0fb048b3d1290 | JavaScript | fhel30/watersystemv2 | /public/assets/js/water_rates.js | UTF-8 | 2,940 | 2.734375 | 3 | [] | no_license | $(document).ready(async() => {
let water_rates_value = await fetch('/admin/water-rate');
water_rates_value = await water_rates_value.json();
async function setWaterRates(){
let water_types = document.getElementById('type');
let water_rates = await water_rates_value;
for(let i = 0 ;... | true |
268f09f32b8231e942f45d48f1693fa8ed6d5c90 | JavaScript | finalx75/w3_weather_test | /currentTemp.js | UTF-8 | 1,608 | 2.6875 | 3 | [] | no_license | var request = require('request')
var config = require('./config')
var device_id = "00e04c024b42"
// trigger the function inititally,
get_weather_values();
// then again every 30min
setInterval( get_weather_values, 1800000 );
// function for remapping temperature for servo output
function reMapTemp(tempValue, in_min... | true |