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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
404db1917723e9d1cdaba8d6d5cdaffefe5b4d93 | JavaScript | sadakchap/best-shoe | /backend/controllers/category.js | UTF-8 | 2,345 | 2.640625 | 3 | [] | no_license | const Category = require('../models/category');
exports.getCategoryById = (req, res, next, id) => {
Category.findById(id).exec((err, category) => {
if(err || !category){
return res.status(400).json({
error: 'Sorry, something went wrong!'
});
}
req.cat... | true |
418b6888c4024522cf7d70c2bd579418c411d407 | JavaScript | nyz123/leetcode-js | /leetcode/面试题/--17.08.bestSeqAtIndex.js | UTF-8 | 142 | 2.5625 | 3 | [] | no_license | var bestSeqAtIndex = function(height, weight) {
// sort
};
console.log(bestSeqAtIndex([65,70,56,75,60,68],[100,150,90,190,95,110])); | true |
d98547253e1d40d2112b2376c4cc4197603b5a3a | JavaScript | iam-Mai/AgodaNote | /functions/index.js | UTF-8 | 3,207 | 2.984375 | 3 | [] | no_license | // Developed by Sasithorn Hannarong
// Home Test for Graduate BE Engineer
// https://firebase.google.com/docs/functions/write-firebase-functions
// Ref: https://firebase.google.com/docs/reference/node/
const functions = require("firebase-functions");
const cors = require('cors')({ origin: true });
const admin = requir... | true |
9a79c1793f16db184e83533e0400b7f8eb6fcbcd | JavaScript | sabasharat-ali/Advanced-JS | /every.js | UTF-8 | 249 | 2.59375 | 3 | [] | no_license | const items=[
{name: "monitor", price:10},
{name: "mouse ", price:5},
{name: "speaker", price:7},
{name: "camera", price:11}
]
const everyBool=items.every(item=>
{
return item.price >100
})
console.log(everyBool) | true |
549058ed8e7af95a0e5e73d2de4b78d096a9b860 | JavaScript | AdrianSerranoRojas/ReduxToolkit-RTKQuery-Showcase | /src/App.js | UTF-8 | 2,018 | 3.375 | 3 | [] | no_license | /*
Instructions:
- Make this HTML template functional pretending there is a working backend.
- Add react state and redux sagas (or thunk if you prefer).
- Add two unit tests, one success case and one failure case.
- You may change the file structure and code in any way you see fit.
- Save your changes from the menu i... | true |
85fe2937fc56c5b506e1083ea203765201bc2bd0 | JavaScript | maurerit/lmeve-ci | /wwwroot/js/ajax.js | UTF-8 | 1,249 | 2.78125 | 3 | [] | no_license | function ajax_get(URL,hookID) {
if(typeof(hookID)==='undefined') hookID = 'NULL';
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatecha... | true |
01b51ce9b4219d06a38eda3eba697a2f85ef0f71 | JavaScript | AzaelContramaestre01/STARWARS | /src/js/store/flux.js | UTF-8 | 1,301 | 2.765625 | 3 | [] | no_license | const getState = ({ getStore, getActions, setStore }) => {
return {
store: {
characters: [],
planets: [],
starships: [],
favorites: []
},
actions: {
getcharacters: () => {
fetch("https://swapi.dev/api/people/")
.then(respuesta => respuesta.json())
.then(data => {
setStore({
... | true |
402bf59f8bff05cb4eb86dbf110c249fdf1e2b75 | JavaScript | backstopmedia/pizza-app | /src/scripts/models/pizza-configuration.js | UTF-8 | 2,060 | 2.90625 | 3 | [] | no_license | 'use strict';
var $ = require('jquery');
var PizzaConfiguration = function(attrs) {
this.size = 'medium';
this.cheese = 'normal';
this.extras = [];
this.toppings = [];
$.extend(this, attrs);
};
PizzaConfiguration.prototype = {
availableSizes: {
'small': { label: 'Small (25cm)', price: 400 },
'me... | true |
581105c7a7001835873159098f0929980e4dd844 | JavaScript | Raymond427/firebase-pwa-template | /public/firebase-messaging-sw.js | UTF-8 | 2,011 | 2.53125 | 3 | [] | no_license | // Import and configure the Firebase SDK
// These scripts are made available when the app is served or deployed on Firebase Hosting
// If you do not serve/host your project using Firebase Hosting see https://firebase.google.com/docs/web/setup
importScripts('https://www.gstatic.com/firebasejs/7.5.2/firebase-app.js')
... | true |
4519084a4a7ab4119a90e70edb60eef0f615ae3d | JavaScript | GerryMG2/Portafolio_PW0219_00032515 | /Laboratorios/labo6/ejercicios.js | UTF-8 | 2,834 | 3.828125 | 4 | [] | no_license | // ejercico 1
function listDataType(lista) {
let resturnLista = new Array();
lista.forEach(element => {
resturnLista.push(typeof(element))
});
// console.log(resturnLista)
let LastList = new Array();
while (resturnLista.length != 0) {
// console.log(resturnLista);
let ele... | true |
121d35ec1c84c4661f06474d385ebf40161541a4 | JavaScript | fvdm/nodejs-readcsv | /readcsv.js | UTF-8 | 2,890 | 3.1875 | 3 | [
"Unlicense"
] | permissive | /*
Name: readcsv.js
Description: Parse CSV file with automatic format detection
Author: Franklin van de Meent (https://frankl.in)
Source code: https://github.com/fvdm/nodejs-readcsv
Feedback: https://github.com/fvdm/nodejs-readcsv/issues
License: Unlicense (Public Domain)
(... | true |
30df4c721d8bb6981d8777ff94534091ad7d71b2 | JavaScript | NCIOCPL/clinical-trials-search-app | /support/src/mock-clinical-trials/is-valid-trial-status-list.js | UTF-8 | 690 | 2.984375 | 3 | [] | no_license | /**
* These are the statuses that are valid.
*/
const VALID_STATUSES = [
'Active',
'Approved',
'Enrolling by Invitation',
'In Review',
'Temporarily Closed to Accrual',
'Temporarily Closed to Accrual and Intervention'
];
/**
*
* @param {*} trial_status
*/
const isValidTrialStatusList = (currentTrial... | true |
8ecea9e02331129304b0ed10dfcda4922055730a | JavaScript | shubhamkar-suryawanshi/calculator | /main.js | UTF-8 | 424 | 3.53125 | 4 | [] | no_license | function display(element) {
var value = document.getElementById("input").value;
document.getElementById("input").value = value + element;
console.log(document.getElementById("input").value);
}
function showAns() {
var exp = document.getElementById("input").value;
var answer = eval(exp);
document.getElement... | true |
d8b84fcc3d173420e06c48667d0063179ee8fc77 | JavaScript | liubolightning/mytunes | /client/models/SongModel.js | UTF-8 | 414 | 2.59375 | 3 | [] | no_license | // SongModel.js - Defines a backbone model class for songs.
var SongModel = Backbone.Model.extend({
// when play is invoke, it emits a play event
// When we click on song title in playlist, song is going to
// be played.
play: function(){
this.trigger('play', this);
},
enqueue: function(){
this.trig... | true |
998d79c2d21b2d810bfd30aa4ce7c6c2419c716b | JavaScript | aidansean/mandelbrot | /html/algorithms.js | UTF-8 | 3,222 | 3.140625 | 3 | [] | no_license | function algorithm_object(){
this.bailout = 0 ;
this.isJulia = false ;
this.Jx = 0 ;
this.Jy = 0 ;
this.update_parameters = function(VIn){
this.bailout = VIn['bailout'].value ;
}
this.update_JxJy = function(Jx,Jy){
this.Jx = Jx ;
this.Jy = Jy ;
}
this.begin_iteration = function(pixel){
... | true |
05e41fc7fb6fcebd476a61043acf00a1f54cab9c | JavaScript | TianmiFang/artMovement | /js/impressionism.js | UTF-8 | 6,232 | 2.578125 | 3 | [] | no_license | read_csv();
var row1 = document.querySelector('.row1');
var row2 = document.querySelector('.row2');
var row3 = document.querySelector('.row3');
var urls1 = ["201", "204", "207", "210", "213", "216", "219"];
var urls2 = ["202", "205", "208", "211", "214", "217", "217"];
var urls3 = ["203", "206", "209", "212", "215",... | true |
fae6f8962ee529efe5a7c6e0b9f973697a938ade | JavaScript | paomoca/the-watcher-launcher | /launch.js | UTF-8 | 4,285 | 2.96875 | 3 | [] | no_license | var ObjectId = require('mongodb').ObjectID
var statistics = require('./calculate-statistics-launcher.js')
var moment = require('moment-timezone')
/*Inicia en launch(), por cada variable en la db realiza las siguientes acciones:
1. Loop desde el anio inicial (2016) hasta el anio actual
2. Para cada anio que existe gen... | true |
66ce292c2bb89b9afa55785476303390900cf0fe | JavaScript | chivenice/TWDB | /12_Boolean_Logic/Conditionals/app.js | UTF-8 | 1,798 | 3.921875 | 4 | [] | no_license | // =====================
// BASIC IF/ELSE
// =====================
let random = Math.random();
if (random < 0.5) {
console.log("YOUR NUMBER IS LESS THAN 0.5!!!")
} else {
console.log("YOUR NUMBER IS GREATER (OR EQUAL) THAN 0.5!!!")
}
console.log(random);
// =====================
// DAYs QUOTEs
// =============... | true |
c857c4341c37bdd11870b4c1d734c66923c1e572 | JavaScript | Nishank13/Bootstrap-Website | /website.js | UTF-8 | 462 | 3.15625 | 3 | [] | no_license | var arr = ['Media/1.jpg','Media/2.jpg','Media/3.jpg','Media/9.jpg'];
var counter = 0;
function move(a) {
counter = counter + a ;
if(counter == -1) {
counter = 3;
}
if (counter == 4) {
counter = 0;
}
var x = arr[counter];
changeimg(x);
}
function changeimg(v){
console.log(counter);
if(counter == ... | true |
bd7d5ed066f28487c5612136e26b3848cc31dbf9 | JavaScript | hayabalasmeh/book-app-back-end | /server.js | UTF-8 | 7,745 | 2.765625 | 3 | [] | no_license | 'use strict'
require('dotenv').config;
const express = require('express');
const cors = require('cors');
const bookSchema = require('./BookSchema');
const userSchema = require('./UserSchema');
const userModel = require('./userModel')
const app = express();
app.use(cors());
app.use(express.json());
const PORT = proce... | true |
17d223db1a0f818bde3736a1cd78ea127d4a4bd0 | JavaScript | Krantik2005/Proba-js | /scripts/index.js | UTF-8 | 6,014 | 2.953125 | 3 | [] | no_license | //Массив cards
const initialCards = [
{
name: 'Гора Бештау',
link: './images/cards/Beshtau.jpg'
},
{
name: 'Парк Железноводска',
link: './images/cards/Zheleznovodsk.jpg'
},
{
name: 'Зима в горах',
link: './images/cards/winter.jpg'
},
{
name: 'Гора Змейка',
l... | true |
cc44a31d5c673363c08027d30de7a60338fad373 | JavaScript | rahulotwani/freemex | /core/static/js/landing.js | UTF-8 | 1,313 | 2.546875 | 3 | [
"MIT"
] | permissive | $(document).ready(function() {
// Call the function to get the usernames of all the players, for username validation
get_usernames();
// Handles the submission of registration form
$('.registration-form').on('submit', function(e) {
e.preventDefault();
$('#loader').fadeIn();
var... | true |
e00002930dfb9d5d84402ae868e780c2bc2fbadc | JavaScript | kyu21/Hunter-CS-Assignments | /39548/Todo/controllers/auth.js | UTF-8 | 1,505 | 2.625 | 3 | [] | no_license | const axios = require("axios");
const API_BASE_URL = process.env.API_BASE_URL;
const authController = {
signup: signup,
login: login,
logout: logout
};
// POST /api/auth/signup
async function signup(req, res, next) {
try {
await axios.post(`${API_BASE_URL}/user`, {
username: req.body.username
});
const r... | true |
f2878cf291b523efd82eea64e6beaf06a9cc32ea | JavaScript | chilblane/inspect | /app/components/GearList.js | UTF-8 | 3,492 | 2.5625 | 3 | [
"ISC"
] | permissive | var React = require("react");
var PropTypes = React.PropTypes;
function wowheadLink(item) {
var url = "//www.wowhead.com/item="+item.id
var bonusIds;
if (item.bonusLists.length > 0) {
bonusIds = "&bonus=" + item.bonusLists.join(':');
url += bonusIds;
}
return url;
}
function wowheadRel(item) {
var... | true |
e4a2cd230b9b864ead3ffdbd03967f2022a7f01d | JavaScript | PrakharSrivastav/projectTindli | /public/js/app.validate.js | UTF-8 | 2,425 | 2.546875 | 3 | [
"MIT"
] | permissive | // This file contains the validations for the front end applicatiion
var validator_0 = $('#login_form').validate({
rules: {
password: {
required: true,
minlength: 3
},
email: {
required: true,
email: true
}
},
messages: {
... | true |
dc30170b3d6cf741700f8bb9e74f8f458eb67e32 | JavaScript | Zhangdragonfly/demo | /wom/web/src/js/plupload.js | UTF-8 | 20,769 | 2.53125 | 3 | [] | no_license | $(function(){
/**
* 上传单个封面图片
* ①:给父级盒子加id(upload-single-img-container)
* ②:必须要在上传文件的那个按钮选项中加入id(upload-single-img-btn)
* ③:要在这个按钮的兄弟级ul加id(upload-single-img-file-list);
* 例:
<div id="upload-single-img-container" class="plupload-container">
<button id="upload-single-img-btn" c... | true |
4580e75be641731ca56b98201fd72042de3dfc03 | JavaScript | sabnitkaur01/drumkit_kaur_sabnit | /js/main.js | UTF-8 | 1,081 | 3.515625 | 4 | [] | no_license | (() => {
let keys = Array.from(document.querySelectorAll('.Key'));
keys.forEach(key => key.addEventListener('transitioned', resetKey));
function resetKey() {
this.classList.remove('playing');
}
function playSound(event) {
// debugger;
let audioElement = document.querySelector(`audio[data-key="... | true |
f2837762e37fc844722f3a6aacca90ca832b3973 | JavaScript | Jay-WKJun/ninjaRun | /src/store/store.js | UTF-8 | 509 | 2.953125 | 3 | [] | no_license | const state = {
player: "",
score: 0,
};
export default new Proxy(state, {
set: function(obj, prop, value) {
switch (prop) {
case "player":
if (typeof value !== "string") return false;
obj.player = value;
break;
case "score":
if (!Number.isInteger(value)) return f... | true |
cc7a57fa6311903f3e713c36fcb96f4f29b6dd8f | JavaScript | Irina-vn/react | /goit-react-hw-05-phonebook/src/components/App.js | UTF-8 | 2,632 | 2.53125 | 3 | [
"MIT"
] | permissive | import React, { Component } from "react";
import { CSSTransition } from "react-transition-group";
import Form from "./Form/Form";
import ContactList from "./ContactList/ContactList";
import Filter from "./Filter/Filter";
import Header from "./Header/Header";
import Alert from "./Alert/Alert";
export default class exte... | true |
97700a15d08b0c4eedcea68d6ede6623e8ae6fdf | JavaScript | liyikun/LeetCode_Practice_js | /src/3/example1.js | UTF-8 | 442 | 3.390625 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=3 lang=javascript
*
* [3] 无重复字符的最长子串
*/
/**
* @param {string} s
* @return {number}
*/
var lengthOfLongestSubstring = function(s) {
let i = 0, j = 0
let n = s.length
if(n === 0) return 0
let max = 0
while(i < n || j < n) {
while(s[i] === s[j] && i < j) {
... | true |
2945def3c1599126af8948601ee9ea98215b5f3c | JavaScript | RaynorFisher/liri-node-app | /liri.js | UTF-8 | 1,320 | 3.4375 | 3 | [] | no_license | js
require("dotenv").config();
/* Pseudo-code
Essentially this little app is a command line application for pulling info from spotify, omdb and twitter.
We need to get and establish our API keys from our desired locations like spotify, omdb and twitter if needed and make them usable in the app
with variables.
With... | true |
04a6b79e56fe16c087c68b04963845e4b766a8e8 | JavaScript | google/jsinterop-generator | /javatests/jsinterop/generator/externs/structuraltypes/structuraltypes.js | UTF-8 | 2,536 | 3.15625 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /**
* @fileoverview Test conversion of closure structural type
* @externs
*/
/**
* @typedef {(string|number)}
*/
var NumberLike;
/**
* @typedef {{
* foo: number,
* bar: string
* }}
*/
var FooBar;
// As Closure inlines typedefs, we test that when several typedefs have the same
// structure, w... | true |
c669e96017f2bd031c595212aaec1bb85100fbaf | JavaScript | Yojith189/C84 | /main.js | UTF-8 | 661 | 2.828125 | 3 | [] | no_license | canvas= document.getElementById("myCanvas");
ctx= canvas.getContext("2d");
var back_img="mars.jpg";
rover_img="rover.png";
Rv_X = 10;
Rv_Y = 10;
Rv_width = 90;
Rv_height = 89;
function add(){
background_img= new Image();
background_img.src= back_img;
background_img.onload=uploadBackground... | true |
d91a1a168908fbebd4b79eb8fcbbbfeb7f88450e | JavaScript | Pari-Dhanakoti/react | /stopwatch/src/Components/DisplayComponent.js | UTF-8 | 701 | 2.515625 | 3 | [] | no_license | import React from 'react'
function DisplayComponent(props) {
var hr = () => {
if(props.time.h === 0){
return '';
}
else {
return <label><span>{(props.time.h >= 10) ? props.time.h : "0" + props.time.h}
</span><label> : </label></label>
}
}
... | true |
258fae026e3c8624f0b4433653c3d7526f8c0b98 | JavaScript | volderette/python-tips-chrome-extension | /js/main.js | UTF-8 | 6,696 | 3.671875 | 4 | [] | no_license | // List of JavaScript tips
var tipsList = [
"Python provides an intuitive way to do assignments and swapping in one line. <span class='code-block'>x, y = 10, 20<br/>print(x, y)</span><span class='output'>>> (10, 20)</span><span class='code-block'>x, y = y, x<br/>print(x, y)</span><span class='output'>>> (2... | true |
25dacdc2e8fe835f8a4cbef6a8fa927f083f8954 | JavaScript | puncoviy/CodeWars-7-kyu-Soluitions-part-2 | /Makes the Sentence.js | UTF-8 | 1,388 | 4.5 | 4 | [
"MIT"
] | permissive | /*
Makes the Sentence:
You are to write a function that is passed 2 arguments and should return a boolean true or false.
The first argument is an array of characters, where each index will contain either a lowercase character from a-z, an uppercase characters from A-Z, or one of the charcters '.', '?', or '!'.
An ex... | true |
99acad591ff999fd533494c0c0fdb6b1431dcab1 | JavaScript | fxlv/node_testing | /nunjucks_testing.js | UTF-8 | 557 | 2.734375 | 3 | [] | no_license | var nunjucks = require("nunjucks");
//simplest form of nunjacks usage
nunjucks.configure({autoescape:true});
var hi = nunjucks.renderString("Hello {{username}}",{username:"testuser"});
console.log(hi);
//now lets use templates
nunjucks.configure("templates",{autoescape:true});
var content = nunjucks.render("index.html... | true |
b08aaf2a09670c912efab568c1d1ccc1cd718aa3 | JavaScript | paul-sr/js-basics-online-shopping-lab-bootcamp-prep-000 | /index.js | UTF-8 | 1,549 | 3.515625 | 4 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | var cart = [];
function getCart() {
return cart;
}
function setCart(c) {
cart = c;
return cart;
}
function addToCart(item) {
// write your code here
let obj = {
itemName: item,
itemPrice: Math.ceil(Math.random()*100)
}
cart[cart.length] = obj
return `${item} has been added to your cart.`
}
function ... | true |
55daf27f5f4109199fda646ee25a6d9cef631f37 | JavaScript | dijahdeen/node-api1-project | /index.js | UTF-8 | 1,774 | 3.0625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | // implement your API here
const express = require ('express');
const Database = require ('./data/db.js')
const server = express();
server.use(express.json());
server.get('/', function (request, res){
res.send({ hello: 'dijah'})
})
const port = 9000;
server.listen(port, ()=> console.log (`\n ** api is showing... | true |
20ed1880eb704b10eefcef676b7da57452c1345c | JavaScript | joshsmith01/dicenews2018 | /assets/d3/2015/BubbleChart2/Libs/strings.js | UTF-8 | 2,530 | 3.15625 | 3 | [
"MIT"
] | permissive | function join(delim, arr)
{
if(arr.length == 0){
return "";
}
var s = "";
for(var i = 0; i < arr.length -1;i++)
{
var item = arr[i];
if(item){
item = item.trim();
if(item.length > 0){
s += item + delim;
}
}
}
s += arr[arr.l... | true |
6ab9f77108ec1ef5aaf0229f8559fd0e7b0ffc3b | JavaScript | lac617a/Rick-Morty-Vanilla | /static/js/app.js | UTF-8 | 609 | 2.9375 | 3 | [] | no_license | import API from './api.js';
import Character from './character.js'
const URL = 'https://rickandmortyapi.com/api/'
// const URL = 'https://apionepiece.herokuapp.com/api/'
const api = new API(URL);
let currentCharacter = 1
const $loadNext = document.querySelector('#load-next')
$loadNext.addEventListener('click',async()... | true |
e183d517308590b5c3592a501a58e6a1fd8d0eca | JavaScript | josarive/Practical | /app.js | UTF-8 | 1,286 | 4 | 4 | [] | no_license | var stringers=[3, "Jerry", "Sandy", 4, "Pepper", 15, "Jocastah", 12];
var eles = [];
function box(itm){
const that=this;
that.loop(itm);
this.ele.addEventListener("click", function (){
that.changeColor1();
})
}
box.prototype.loop = function(itm){
const that=this
if (itm ... | true |
c5ddd45ed5bfc332c2ccc4904734293684e0fea3 | JavaScript | JStein92/vacationSuggester | /js/scripts.js | UTF-8 | 4,329 | 3.421875 | 3 | [
"LicenseRef-scancode-other-permissive"
] | permissive | //backend logic
var hawaiiPoints = {
score: 0,
name:'hawaii'
}
var egyptPoints = {
score: 0,
name:'egypt'
}
var texasPoints = {
score: 0,
name:'texas'
}
var disneyworldPoints = {
score: 0,
name:'disneyworld'
}
var antarcticaPoints = {
score:0,
name:'antarctica'
}
var homePoints = {
score: 0,
nam... | true |
9e8192886c9894e169f480fb556b76acc1445733 | JavaScript | kfurness-tiy/wk-05-mondrian | /src/scripts/main.js | UTF-8 | 1,699 | 3.5625 | 4 | [] | no_license | function newColor () {
document.getElementsByClassName("color")[0].style.backgroundColor = color();
document.getElementsByClassName("color")[1].style.backgroundColor = color();
document.getElementsByClassName("color")[2].style.backgroundColor = color();
}
function color() {
red = Math.floor(Math.random() * 255... | true |
1dc33057de1544674fc637092971d5f93203a299 | JavaScript | alexbarg3000/Coding-Dojo | /4- MERN/2- React/3- Functional Components/5- Tabs/tabs/src/App.js | UTF-8 | 1,429 | 2.609375 | 3 | [] | no_license | import logo from './logo.svg';
import React,{useState} from 'react';
import './App.css';
import 'bootstrap/dist/css/bootstrap.min.css';
import DisplayTabs from "./components/DisplayTabs";
function App() {
const [tabs, setTabs] = useState([
{
name: "Tab 1",
isSelected: true
},
{
name: ... | true |
45375cbb5f12c91c015cce08d68ee0a7d67c39f8 | JavaScript | kinyaying/algorithm-train | /promise.for循环和await.js | UTF-8 | 1,010 | 3.6875 | 4 | [] | no_license | // var getNumbers = () => {
// return Promise.resolve([1, 2, 3])
// }
// var multi = (num) => {
// return new Promise((resolve, reject) => {
// setTimeout(() => {
// if (num) {
// resolve(num * num)
// } else {
// reject(new Error('num not specified'))
// }
// }, 1000)
// ... | true |
e358814324d47b9ebe8f002dcb4ee26ec3c5bf69 | JavaScript | ginny315/JFunnyPicture | /shadow.js | UTF-8 | 767 | 2.625 | 3 | [] | no_license | /*(function($){
$.fn.swapClass = function(class1,class2){
return this.each(function(){
var $element = $(this);
if($element.hasClass(class1)){
$element.removeClass(class1).addClass(class2);
}else if($element.hasClass(class2)){
$element.removeClass(class2).addClass(class1);
}
})
}
})(jQuery);
*/... | true |
bbc992af80b0d8773e6a7ad435a314aa9f4919c1 | JavaScript | madole/fireworks-UI | /src/components/DatePicker/YearPicker.js | UTF-8 | 690 | 2.515625 | 3 | [] | no_license | import { h } from 'preact';
import styled from 'styled-components';
const YEARS = Array.from(Array(5)).map((_, i) => 2017 + i);
const Container = styled.div`
display: flex;
flex-direction: column;
overflow: scroll;
`;
const ActiveYear = styled.div`
font-size: 20px;
border: 1px solid #ccc;
cur... | true |
caa468e1c504978351681d4805ca0c8eb3ed34fe | JavaScript | ahmedashin999/puzzle | /src/components/QuizOne.js | UTF-8 | 4,890 | 2.828125 | 3 | [] | no_license | import React, {useState, useEffect} from 'react'
import './quiz.css'
import {BsFillForwardFill} from 'react-icons/bs';
import ProgressBar from './ProgressBar'
// import db from '../Fire'
function QuizOne({quizData}) {
// const[quizData,setQuizData]=useState([])
let sound = new Audio("../../assets/sounds/countdo... | true |
275b37f994b0d5f11f5932146744aded428ac2a7 | JavaScript | LilJack118/slitherio-like-game | /static/js/game.js | UTF-8 | 4,694 | 2.78125 | 3 | [] | no_license | let Snake_player;
let Snake_oponent;
let running = false
let vx = 0;
let vy = 0;
let speed = 3;
let mass_losing_speed = 100;
let score_box = document.querySelector('.score')
let raf;
let starting = true
let winner_score = 0
let nickname = localStorage.getItem('nickname') ? localStorage.getItem('nickname') : ''
const r... | true |
0b4f33777d132c41e9af9afb6b3226e200332d41 | JavaScript | RamyaPayyavula/LeetCode | /LeetCode_Easy/Intersection_of_Two_Arrays_II.js | UTF-8 | 509 | 3.015625 | 3 | [] | no_license | /**
* @param {number[]} nums1
* @param {number[]} nums2
* @return {number[]}
*/
var intersect = function (nums1, nums2) {
let res = []
let obj={}
for (num in nums1) {
obj[nums1[num]] = (obj[nums1[num]] || 0) + 1
}
for (num in nums2) {
if (obj[nums2[num]]) {
res.push(n... | true |
92736cf970cf8c832665809eb3bfdca97f240592 | JavaScript | kristophjunge/vortex-connector | /demo/tree/demo.js | UTF-8 | 1,984 | 2.6875 | 3 | [
"MIT"
] | permissive | (function(){
var canvas=document.getElementById('vortex_canvas'),
context=canvas.getContext('2d');
//var randomizer='0323b543c1be29ce6f0d1d2aa2408342';
var randomizer='969b6ccf564374417fb268257aa1ae87';
//var randomizer='aa582d2980b8e5ea42826006f686f563';
//var randomizer='c447dee3904f622717264c8960b035bf';
... | true |
646ac93c30a6fd2d9add48f3fb51e84dbdc4d527 | JavaScript | Runningfish13/altair-8800 | /script.js | UTF-8 | 930 | 3.359375 | 3 | [] | no_license | var question = "Which one of these is Roberts freind";
var answers = ['forrest M.','Bill gates','elon musk','lary page'];
var answerButtons = document.getElementsByClassName('quizButton');
var correct = 0;
for(var spot=0; spot<answers.length; spot++)
{
answerButtons[spot].innerHTML = answers[spot];
answerButt... | true |
7aa20d1c1449730f4ba55741e2016f5ce5870eca | JavaScript | Xiaoping-Li/Data-Structure-and-Algorithm | /Cracking Interview/Chapter 2/2.2 Return Kth to Last.js | UTF-8 | 1,189 | 4.40625 | 4 | [] | no_license | /*
2.2 Return Kth to Last
Implement an algorithm to find the kth to last element of a singly linked list.
Ask questions:
1. kth is 0 base or 1 base?
*/
// Node constructor function
function Node(val) {
this.value = val;
this.next = null;
};
// LinkedList function
class LinkedList {
constructor() {
this.hea... | true |
f51040b50d86569b00b8272d279e9e60456b869a | JavaScript | WearyWanderer/wearywanderer.github.io | /assets/js/wanderlustmap.js | UTF-8 | 1,388 | 2.859375 | 3 | [
"MIT"
] | permissive | function addNewMarker(locationString, map, geocoder) {
if(locationString)
{
geocoder.geocode({'address': locationString}, function(results, status)
{
if (status === google.maps.GeocoderStatus.OK)
{
marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location,
animatio... | true |
1d3edb1a3f0a4e8ade6d792eef7b96b1aa8f9876 | JavaScript | kerou/rawbeenpdf | /tags/script.js | UTF-8 | 4,966 | 2.578125 | 3 | [] | no_license | function rawbeenpdf_trim(str) {
return str.replace (/^\s+/, '').replace (/\s+$/, '');
}
function rawbeenpdf_hasClassName(classNameStr, className) {
var classNames = classNameStr.split(" ");
for(var i=0; i<classNames.length; i++) {
if(classNames[i] == className) {
return true;
}
}
return false;
... | true |
cca3c4365436b8b5e12a69ff876f890d4e896c48 | JavaScript | cosyer/react-ticket | /src/http_service/http.js | UTF-8 | 1,557 | 2.609375 | 3 | [
"MIT"
] | permissive | //封装axios 接口服务
import axios from 'axios';
//全局配置
// `withCredentials` 表示跨域请求时是否需要使用凭证
axios.defaults.withCredentials = true;
function obj2Form(data){
var formData = new FormData();
for(var key in data){
formData.append(key, data[key]);
}
return formData
}
//get 请求
function httpGet(url){
... | true |
3fdaac91fc716aa34b0d7a9fe2d225d8905354fe | JavaScript | ilyasvos/Magiscord | /lib/checkAuth.js | UTF-8 | 1,472 | 2.515625 | 3 | [
"MIT"
] | permissive | const {
default: magister,
getSchools
} = require('magister.js');
const getAuthCode = require('@magisterjs/dynamic-authcode');
module.exports = async function (msg, data) {
getAuthCode()
.then((code => {
magister({
school: data.school,
username: d... | true |
02041a17e21dac952fb6e1926824a67b0072e1ce | JavaScript | JustinTulloss/harmonize.fm | /masterapp/masterapp/public/javascripts/lib/helpers.js | UTF-8 | 1,893 | 2.5625 | 3 | [
"MIT"
] | permissive | function get_browser_data()
{
var new_screen = {};
for (var key in screen) {
new_screen[key]=screen[key];
}
var data = {
browser: {
appCodeName: navigator.appCodeName,
appName: navigator.appName,
appVersion: navigator.appVersion,
buildID: ... | true |
0ef790c885ed48f7e7970cbcda119dd92c26c8dc | JavaScript | jwkovell/Rogue | /rogue/js/statistics.js | UTF-8 | 2,073 | 3.328125 | 3 | [] | no_license | // Define statistics.
var statistics = {
'gamesPlayed': 0,
'players': [
{
'name': 'Adam',
'wins': 0,
'totalStacks': 0,
'fullCourts': 0,
'totalScore': 0
},
{
'name': 'Brian',
'wins': 0,
'totalStacks': 0,
'fullCourts': 0,
'totalScore': 0
},
{
'name': 'Cassie',
'wins': 0,
'totalStacks... | true |
801453c8ee1789da4e8a649d6584cab0051b2358 | JavaScript | SobolJa/Chess-desk | /script.js | UTF-8 | 476 | 2.90625 | 3 | [] | no_license | let num = +prompt('How much?');
for (let i=0; i < num-1; i++){
document.write(` <div class="row1">
<div class='black'></div>
<div class='white'></div>
<div class='black'></div>
<div class='white'></div>
<div class='black'></div>
</div>
<div class="row2">
<div class='wh... | true |
2e36e0e6000e6581f30b55f7ac129350156e6ce2 | JavaScript | gucchisk/node-samples | /crypto/rsa.js | UTF-8 | 1,343 | 3 | 3 | [] | no_license | const crypto = require('crypto')
const fs = require('fs')
console.log('--- RSA ---')
{
const { publicKey, privateKey } = crypto.generateKeyPairSync('rsa', {
modulusLength: 2048,
})
const publicKeyStr = publicKey.export({
type: 'pkcs1',
format: 'pem',
})
const privateKeyStr = privateKey.export(... | true |
92ad61b0788f7dcbb62c6b5dbe9ae43a7610ac58 | JavaScript | destan/plugin-client | /palmda-call-client.js | UTF-8 | 4,971 | 2.765625 | 3 | [] | no_license | {// ================= Call Plugin Library =================
const CALL_VERSION = "0.2.1";
if (typeof PalmdaClient !== "function") {
throw new Error('E6 PalmdaClient is not defined. Call Plugin Library should be added to the page after PalmdaClient is defined.');
}
if (typeof PalmdaClient.prototype.incoming... | true |
92518255ce81961f0494be747670ce94e28eaf55 | JavaScript | hamiltonkibbe/is42 | /is42.js | UTF-8 | 1,328 | 2.75 | 3 | [] | no_license | // Copyright (c) 2016, Hamilton Kibbe <ham@hamiltonkib.be>
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
// THE SOFTWARE IS PROVIDED "AS IS" AN... | true |
8d2c230eb5584107b10c1da3ae1377530ac09e94 | JavaScript | laurieowens/TriviaGame | /assets/javascript/app.js | UTF-8 | 787 | 2.6875 | 3 | [] | no_license | var count=20;
choices=["Which one of these fruits has its seeds on the outside?","Which rule is the best way to solve a limit that gives an indeterminate form?","In the original 'Wizard of Oz Book' and the movie 'Wicked' these slippers are not “ruby” but this metallic color:","Which law states that we are constantly h... | true |
82c58baffd1dfad553169885d4a7e4238d68ea35 | JavaScript | Jatematik/for_work | /target_30sek.js | UTF-8 | 772 | 2.75 | 3 | [] | no_license | // Цель будет срабатывать раз в 30 минут за один сеанс
jQuery(document).ready(function(){
let limit = 1800000; // 30 минут
let localStorageInitTime = localStorage.getItem('localStorageInitTime');
if (localStorageInitTime === null) {
localStorage.setItem('localStorageInitTime', +new Date());
} else if(+new Date... | true |
9d0996edbae7bbd9df134b6cb50dbfd23b2ab2ca | JavaScript | greatabel/JsRepository | /02effective-JavaScript-sourcecode/ch6Liburary_APIDesign/56Avoid Unnecessary State.js | UTF-8 | 310 | 3.3125 | 3 | [] | no_license | var c ={
textAlign:'test',
fillStyle:'test1',
fillText:function(a,b,c){
console.log( a+b+c);
return a+b+c;
}
}
console.dir(c);
c.fillText("hello, world!", 75, 25);
c.fillStyle = "blue";
c.font = "24pt serif";
c.textAlign = "center";
c.fillText("hello, world!!", 75, 25);
console.dir(c);
| true |
ffd93021fa0b3c7176917b9b1adfbfebc1e32270 | JavaScript | mluque1/curso-closure-scope | /src/scope/local.js | UTF-8 | 557 | 4.46875 | 4 | [] | no_license | //Establecido el loque de código
const fun1 = () => {
const hello = 'Hello World!';
//Permite el acceso a la constante 'hello'
console.log(hello);
};
fun1();
console.log(hello) //ReferenceError: hello is not defined
//Al no estár declarada de forma global, no podremos
//acceder a ella por fuera del bloque ... | true |
47168357c1d2e8f1775405ba4f5539c2278f10f2 | JavaScript | digitalpublishingplatform/win8.reader.sample | /Cook/js/util.js | UTF-8 | 1,280 | 2.5625 | 3 | [] | no_license | (function () {
'use strict';
var alert = new Windows.UI.Popups.MessageDialog('');
var currentAlert = null;
var que = [];
var showNext = function() {
if (currentAlert !== null) return;
if (que.length > 0) {
currentAlert = que.shift();
alert.content = currentA... | true |
e89c46b3a7d983db00a49bb560c9baa79876f0ae | JavaScript | upczhihu/zhihu | /js/register.js | UTF-8 | 1,259 | 2.84375 | 3 | [
"MIT"
] | permissive | function register() {
var tel,name,pass;
tel=document.getElementById("register_telphone").value;
name=document.getElementById("register_fullname").value;
pass=document.getElementById("register_password").value;
// var mytelreg = /^1[3|4|5|8][0-9]\d{4,8}$/;
var rgx = /^1\d{10,10}$/;
if(tel=="... | true |
6473d8be72f683520c6bfed0e618d6bc59180684 | JavaScript | SantiagoBocanegra/Aplicacion-en-la-wed-y-redes-inalambricas | /BACKEND/modulos/moduloEmpleado.js | UTF-8 | 3,379 | 2.546875 | 3 | [] | no_license | const conection = require('./confiMysql');
let user_model = {};
user_model.getEmpleados = (callback) => {
if(conection){
let sql = 'SELECT * FROM empleados';
conection.query(sql,(err,rows) => {
if(err){
console.log("(conexionMysql) ERROR AL BUSCAR TODOS LOS EMPL... | true |
209aa935f5d6ea7d13e006e3720719420ee15ecd | JavaScript | moligart/AWS-Lex-React | /lambda/AskNadia_AnimalQuery.js | UTF-8 | 1,151 | 2.703125 | 3 | [] | no_license | function close(sessionAttributes, fulfillmentState, message) {
return {
sessionAttributes,
dialogAction: {
type: 'Close',
fulfillmentState,
message,
},
};
}
function dispatch(intentRequest, callback) {
const sessionAttributes = intentRequest.sess... | true |
60b10ab2c4d8e2ae46c3e92412127e250ea3c405 | JavaScript | TaraMathur/PartnerProject | /js/smoothiechart.js | UTF-8 | 437 | 3.34375 | 3 | [] | no_license | var smoothie = new SmoothieChart();
smoothie.streamTo(document.getElementById("mycanvas"));
// Data
var line1 = new TimeSeries();
var line2 = new TimeSeries();
// Add a random value to each line every second
setInterval(function() {
line1.append(new Date().getTime(), Math.random());
line2.append(new Date().getTim... | true |
2914ec3963d38f9401e7506617175707a866f488 | JavaScript | umaralfaruqdev/banana_first | /dist/js/collapse.js | UTF-8 | 1,573 | 2.9375 | 3 | [
"MIT"
] | permissive | /**
* Selector
*/
var Selector = {
find: function (selector) {
let result = document.querySelectorAll(selector);
return result;
},
findOne: function (selector) {
let result = document.querySelector(selector);
return result;
},
prop: function (elem, property) {
let result = elem.getAttribute(property);... | true |
354a9564fbebfd0c167e2dda4a71b81f0b3fb88e | JavaScript | DeanRae/ReactNativePlanner | /src/components/utils/textTransformations.js | UTF-8 | 471 | 3.265625 | 3 | [] | no_license | /**
* Capitalizes first letter.
*/
export const firstLetterToUpperCase = (word) => {
return word.replace(/^./, (str) => { return str.toUpperCase() });
};
/**
* Splits camel casing.
*/
export const removeCamelCasing = (word) => {
return word.replace(/([A-Z])/g, ' $1');
};
/**
* Splits camel casing and cap... | true |
1f0d1694ffe3a87b2f8095af891501908741de97 | JavaScript | dancinturtle/javaScriptFunOne | /Uma/numbersOnly.js | UTF-8 | 546 | 3.875 | 4 | [] | no_license | function numbersOnly(arr)
{
var newArr = [], j=0;
for(var i=0; i<arr.length; i++){
if(typeof(arr[i])==="number")
{
newArr[j]=arr[i];
j++;
}
}
return newArr;
}
function notNumbers(arr){
var undefinedCnt = 0;
for(var i=0; i<arr.length; i++){
if(typeof(arr[i])==="number"){
{
undefinedCnt++;
... | true |
e872452da8d1a55b83e26e0f8e190ccda7f62441 | JavaScript | declanw91/msal-testsite | /js/msaltest.js | UTF-8 | 2,753 | 2.65625 | 3 | [
"MIT"
] | permissive | const myMsal = new Msal.UserAgentApplication(config);
const accessTokenRequest = {
scopes: ["user.read"]
};
function RequestToken() {
myMsal.acquireTokenSilent(accessTokenRequest).then(function(accessTokenResponse) {
// Acquire token silent success
// Call API with token
let accessToke... | true |
ddebff6938a9ecc14bd6d5f95683c7cf81aaf18d | JavaScript | FDP202/Clase3_Semana12 | /sketch.js | UTF-8 | 2,208 | 3.34375 | 3 | [] | no_license | /**
* 1. Descargar... VSCODE
* 2. Descargar Plugin Live Server
* 3. Descargar Plugin p5.vscode
* 4. rebote...
* 5. preguntas.
* 6. Foto!
*/
class Rectangulo{
constructor(){
this.x = Math.random()*500; // 0-1
this.y = 300;
this.alto = 50; // 0-1
this.ancho = 50; // 0-1
this.dir = true;
... | true |
6c600cff7e17a6216ae09c8d6acf334c3e04f24b | JavaScript | vapapitha/fullstack_web | /practice problem solve 65/script.js | UTF-8 | 193 | 2.875 | 3 | [] | no_license | function script(str) {
if (str.substring(str.length - 6, str.length) == 'Script')
{
return true;
}
else
{
return false;
}
}
console.log(script("JavaScript"));
| true |
014cb2858c70408316c07de0a6249b795690598d | JavaScript | PAMIN/PaminTeste | /WebContent/js/validaCadastroEventos.js | UTF-8 | 2,601 | 3.109375 | 3 | [] | no_license |
/**
* @author Claudio Djohnnatha Duarte Lourenco
* since 07/2013
*/
function validaForm()
{
/*
* Variaveis de acesso ao formulario
*
*/
var nomeEvento=form['form:nomeEvento'];
var localEvento=form['form:localEvento'];
var endereco=form['form:end'];
var bairro=form['form:bairro'];
var cida... | true |
484291c25d16dab5f4b62a4a06a687f2c4028eff | JavaScript | bosscheng/javascript-utils | /src/file/utils-downloadFile.js | UTF-8 | 259 | 2.8125 | 3 | [] | no_license | function utilsDownloadFile(file,fileName){
if (file instanceof Blob || file instanceof File) {
file = new Blob([file]);
}
const aLink = document.createElement("a");
aLink.download = fileName;
aLink.href = file;
aLink.click();
} | true |
d7885f02ee73907a3ac289d902d68f874597f89f | JavaScript | slavcoc/pf | /arrayDestructuring.js | UTF-8 | 383 | 3.375 | 3 | [] | no_license | // we try to fetch user and reletaed frends
// we are using async / await so the function returns result in an array
async function getUserAndFriends() {
return await Promise.all([
fetch('/user'),
fetch('/friends')
])
}
//using array destructuring we are assigning the results directly into cor... | true |
829e80f35434343f3df5c68fb647ba04a5b88cc4 | JavaScript | vFaribeault/exercise-js-openclassrooms | /exercise-3/exercise-3.js | UTF-8 | 1,108 | 3.421875 | 3 | [] | no_license | // Get weather asking element from DOM
let clickAskWeather = document.getElementById('ask-weather');
// Get weather result element from DOM
let resultWeather = document.getElementById('weather-result');
// Create a new AJAX object
let askWeather = new XMLHttpRequest();
// Listen the event
clickAskWeather.addEventLi... | true |
51b51046856625c34b4fe387f78b469233c9c2d6 | JavaScript | radrex/SoftuniCourses | /Programming Fundamentals/JS/06.Objects and Classes/Lab/p04_ConvertToJSON.js | UTF-8 | 284 | 3.53125 | 4 | [
"MIT"
] | permissive | function solve(name, lastName, hairColor) {
let person = {
name,
lastName,
hairColor,
};
console.log(JSON.stringify(person));
}
// Don't copy the calling of the function in judge, you won't get any points, just the code above
solve('George', 'Jones', 'Brown');
| true |
2a7a0bbe5bd2aa259640b4ad74af30b66f24f3f2 | JavaScript | synoraeusebio/JS100NewSmallProblems | /Variable_Scope/five.js | UTF-8 | 480 | 4.5 | 4 | [] | no_license | /*
JS100 - JavaScript Basics > Variable Scope
5. What's my value? (Part 5)
What will the following code log to the console and why? Don't run it until you have tried to answer.
function myFunction() {
let a = 1;
if (true) {
console.log(a);
let a = 2;
console.log(a);
}
}
myFunction();
*/
// ... | true |
c0f808c35ccdb21f6896e2315a697f3baeb0a7f6 | JavaScript | olehhe/FPL-Champion | /Controllers/userController.js | UTF-8 | 2,008 | 2.65625 | 3 | [] | no_license | var userController = (User) => {
var get = (req, res) => {
var query = { };
User.find(query, (err, users) => {
if (err) {
res.status(500);
res.send(err);
}
else {
res.status(200);
res.json(users);
... | true |
5af1c2529fcd07425b7c62ca38b26b63b2fe55ac | JavaScript | bhoomika08/React_Exercise_1 | /src/formMessage.js | UTF-8 | 894 | 2.84375 | 3 | [] | no_license | import React from 'react';
class FormMessage extends React.Component {
constructor(props) {
super(props);
this.state = {
message: '',
};
this.handleChange = this.handleChange.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
}
handleChange(event) {
const target = event... | true |
1645f39d075a3fe83dff14da05b1e6c8987f5f3d | JavaScript | DiegoSt23/Countries-app | /src/components/CountriesGrid.jsx | UTF-8 | 2,496 | 2.5625 | 3 | [] | no_license | import "../styles/CountriesGrid.css";
import { useState, useEffect } from "react";
import { getAllCountries } from "../services/petitions";
import CountryBox from "./CountryBox";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faChevronLeft, faChevronRight } from "@fortawesome/free-solid-svg-... | true |
e0e86e37bb5c24567a97cacf74872be9cae26e7b | JavaScript | marlorebaza/fundamentos-javascript | /function-prototype.js | UTF-8 | 3,934 | 4.1875 | 4 | [] | no_license | // fun.call(thisArg, ...arg):
// llama a una función con un valor this asignado y argumentos provistos de forma individual.
// Con call, puedes escribir un método una vez y entonces heredarlo en otro objeto,
// sin tener que reescribir el método para el nuevo objeto.
// FUENTE: https://developer.mozilla.org/es/docs/We... | true |
50b86179c703afe2482ed2b1f70dc5bc759a62a0 | JavaScript | sam-lb/AlphaBeta | /ttt.js | UTF-8 | 6,021 | 3.734375 | 4 | [
"MIT"
] | permissive |
class Board {
constructor() {
this.tileStartX = width * 0.25;
this.tileStartY = height * 0.25;
this.tileWidth = width / 6;
this.tileHeight = height / 6;
// ^^^ 0: nothing, 1: x, 2: o
this.xColor = color(255, 0, 0);
this.oColor = color(0, 0, 255);
this.winningGameStates = [
[0, 1, 2], [3... | true |
5aa0c4a818e4bdb30f2dbd6f68305af1202ac7de | JavaScript | teegh/src-gp | /coffee/node-script/File/_DropFile.js | UTF-8 | 3,515 | 2.9375 | 3 | [] | no_license | //指定のエリアに対して、ファイルのドロップを受け付ける。
//またドロップされたら、指定された関数で処理を行う。
//[使い方]
// init(inFunc_onDropFile) //ドロップされた時の処理関数を指定
// cancelDropEvent(inTargetName) //デフォルトのドラッグファイルのイベントをキャンセル
// addDropUploadEvent(inTargetName) //ドラッグイベントを登録
//cancelDefaultDragEventの代替をつなぐ。
//例
//index.slimに追加
// _DropFile.cancelDropEven... | true |
1a93c9387da22510e058ddefa9bdc21845fb0138 | JavaScript | Dashkent/clear-news | /clear-news-app/logic/news-for-page.js | UTF-8 | 282 | 3.109375 | 3 | [] | no_license | function newsForPage(news, currentPage){
const NEWS_FOR_PAGE = 20
const indexOfLastItem = currentPage*NEWS_FOR_PAGE
const indexOfFirstItem = indexOfLastItem - NEWS_FOR_PAGE
const currentNews = news.slice(indexOfFirstItem, indexOfLastItem)
return currentNews
} | true |
8ed0556ce9d00ebd12f09e384b506783c3c2506a | JavaScript | NetRevolutions/universityApp | /server/models/teacher.js | UTF-8 | 839 | 2.53125 | 3 | [] | no_license | var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var Teacher = new Schema({
name : {
type : String,
require : true
},
age : {
type : Number,
require : true
},
course : {
id: {
type : String,
require : true
},
name: {
type : String,
require : true
}
},
bio : {
... | true |
811050be391bd8dc3a92ccb1d3ce4709fb137caf | JavaScript | bangil0/Kasir-Kita | /src/store/reducer/purchaseReducer.js | UTF-8 | 4,666 | 2.515625 | 3 | [] | no_license | const initState = {
fetching: false,
fetched: false,
message: null,
data: null,
error: null,
success: null,
type: null,
purchase: null,
}
const purchaseReducer = (state = initState, action) => {
switch (action.type) {
case 'FETCH_PURCHASE_PENDING':
return {
... | true |
b604bf29793dc6a69296de3ac035aeb01174d91b | JavaScript | EVEfromLV/beeHive | /js/main.js | UTF-8 | 4,694 | 2.859375 | 3 | [] | no_license | /**
* Created by IevaSilina on 19/05/16.
*/
var stage;
var score = 0;
var scoreText;
var hero;
var keys = {
rkd: false,
lkd: false,
ukd: false,
dkd: false
};
var obsticles = [];
var numOfObsticles = 4;
var queue;
var preLoadText;
var gameIsRunning = false;
function preLoad(){
stage = new creat... | true |
5b62616a776d2bb9c66a290a90e45b769d41facb | JavaScript | KankanalaShashank/deltatask1-tilegameshashank | /tiles.js | UTF-8 | 16,377 | 2.65625 | 3 | [] | no_license | let size = 0
let normalbutton = document.getElementById("normal")
normalbutton.classList.add("buttonstyles")
let mediumbutton = document.getElementById("medium")
mediumbutton.classList.add("buttonstyles")
normalbutton.addEventListener("click", function(event) {
let username = document.getElementById("userde... | true |
60830a875ec6d895ce5f8f9f58e788a65e827150 | JavaScript | sizigia/lighthouseLabs-21D | /specs/challenge7.spec.js | UTF-8 | 880 | 2.71875 | 3 | [] | no_license | const termTopics = require('../challenges/challenge7')
describe('Challenge 7:', () => {
const interviews = [
'smart city',
'rebuild the lighthouse',
'arts funding',
'transportation',
'arts funding',
'rebuild the lighthouse',
'sports funding',
'tax cut... | true |
0970f77257189ce8488d72092f46d1ab9593ad28 | JavaScript | wdikai/fbgram | /services/logger.js | UTF-8 | 851 | 3.171875 | 3 | [] | no_license | class Logger {
constructor(name) {
this.name = name || '';
}
info(...args) {
console.info(`INFO [${this.name.toUpperCase()}]~~~~~~~~~`);
args.forEach(arg => console.info(format(arg)));
console.info(`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`);
}
error(...args) {
... | true |
c657df2b5e64dd62b4133e3c9ef53a0e91cda24e | JavaScript | leol15/react-pages | /Schedule Viewer/src/Task.js | UTF-8 | 1,801 | 2.984375 | 3 | [] | no_license | import React, {Component} from 'react';
// props:
// task: []
// - element: ["CSE 312 A", "9:30-10:20", "Zoom -> https", "adwwadawd"]
class Task extends Component {
constructTask() {
// console.log(this.props.task);
let taskDetails = [];
taskDetails.push(
<div className="t_time">{this.props.task[1]}</d... | true |
e6b73c09da3a7e4a3aa9f715057ea7cb0de246e0 | JavaScript | ccs-winter-2019/9.2-full_stack_review | /frontend/static/src/containers/TodoCreate.js | UTF-8 | 3,592 | 2.875 | 3 | [] | no_license | import React, { Component } from 'react';
class TodoForm extends Component {
constructor(props){
super(props);
this.state = {
title: '',
todos: [{title: ''}, {title: ''}, {title: ''}]
};
}
handleInput = (e) => {
this.setState({[e.target.name]: e.target.value});
};
handleAddTo... | true |