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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
73dbba30ea5a9d0d836e2357317156ddffaf70b9 | JavaScript | joaquimnet/Bloo-Bot | /src/models/logs.js | UTF-8 | 941 | 2.609375 | 3 | [] | no_license | const mongoose = require('mongoose');
const { Schema } = mongoose;
const logSchema = new Schema({
eventType: {
type: String,
minlength: 3,
required: true,
},
info: {
type: String,
minlength: 3,
required: true,
},
createdAt: {
type: Date,
required: true,
default: Date.now,... | true |
e1309041f95d3588976f544af2d17c604e61a37d | JavaScript | bibakroy/Text-Editor | /src/components/Rough.js | UTF-8 | 1,741 | 2.953125 | 3 | [] | no_license | import { convertToRaw, EditorState } from "draft-js";
import draftToHtml from "draftjs-to-html";
import React, { useState } from "react";
import { Editor } from "react-draft-wysiwyg";
import "react-draft-wysiwyg/dist/react-draft-wysiwyg.css";
import classes from "../style/Editor.module.css";
import ConvertToPlainText f... | true |
0d183c01d54e88a0d11e653f3775551782c46269 | JavaScript | merrazquin/AoC2018 | /5.js | UTF-8 | 1,677 | 3.5625 | 4 | [] | no_license | const fs = require('fs')
let input = fs.readFileSync('5.txt').toString().trim();
console.log(input.length)
function areReactive(a, b) {
if (a === b || [a, b].every(isUpperCase)) {
return false;
}
return (a.toLowerCase() === b.toLowerCase() && !(isUpperCase(a) & isUpperCase(b)))
}
function isUpperCase(letter... | true |
0c9469b65ff7a54e0caf7b76b908121137198937 | JavaScript | Julia47/music-shop | /WEB2(4)/app/static/js/admin.js | UTF-8 | 4,375 | 2.578125 | 3 | [] | no_license |
function render_admin(){
url = "http://127.0.0.1:5000/users_logins";
fetch(url)
.then(function (response){
return response.text();
}).then(function (text){
var list_logins = JSON.parse(text);
var html = "<div><label><p>ALL USERS<p/></label><div>";
html += "<u... | true |
9ace600c81c52570b59fa4b05819a7a186afb121 | JavaScript | AppStateESS/stories | /javascript/TagBar/TagBar.jsx | UTF-8 | 3,002 | 2.609375 | 3 | [
"MIT"
] | permissive | 'use strict'
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import TagOverlay from '../AddOn/TagOverlay'
/* global $ */
export default class TagBar extends Component {
constructor(props) {
super(props)
this.state = {
title: '',
entryId: 0,
tagOverlay: false,
... | true |
4b613ae9098f105e3cf1d2f8a05ac7e6ca2eb248 | JavaScript | jharte5/cripples-bastards-and-broken-things | /string-theory.js | UTF-8 | 2,571 | 3.15625 | 3 | [] | no_license | function crazyCase(str) {
let crazyCased = '';
for (let i = 0; i < str.length; i++) {
if (i % 2 === 1) {
crazyCased += str[i].toUpperCase()
} else {
crazyCased += str[i].toLowerCase()
}
}
return crazyCased;
}
function ciEmailify(str) {
let newStr= ''
str = str.toLowerCase()
for (i=... | true |
96186b3bc9b913088d1e5563d24b5fb95511b06e | JavaScript | manojvarmarudraraju/IBM-React-Nov-2020 | /Assignment-1/Solution.js | UTF-8 | 98 | 2.953125 | 3 | [] | no_license | function sumFunc(...x){
var sum =0;
for(i=0;i< x.length;i++){
sum += x[i]
}
return sum;
} | true |
1651ba92c78290863298bdbef37a8d7b386f1214 | JavaScript | euhidaman/react_task_tracker | /src/App.js | UTF-8 | 3,829 | 3.28125 | 3 | [] | no_license | import { useState, useEffect } from "react"
import AddTask from "./components/AddTask";
import Header from './components/Header';
import Tasks from './components/Tasks';
//Toggle reminder on server 1:35:15
function App() {
//state to show green ADD button, when form is completely filled
const [showAddTask, setsho... | true |
176013d098f0c4559066dc82e677f2a09f8f82fe | JavaScript | grishbar/quiz | /client/src/components/AdminPage.js | UTF-8 | 5,231 | 2.6875 | 3 | [] | no_license | import React from 'react';
export default class AdminPage extends React.Component {
constructor(props) {
super(props);
this.checkInputPassword = this.checkInputPassword.bind(this);
this.handleChange = this.handleChange.bind(this);
this.getQuestionInformaton = this.getQuestionInforma... | true |
4cf4eff79f9e0f9a4218f453df1734dba0129171 | JavaScript | castellarmartinez/My-Persistent-APP | /src/models/address.js | UTF-8 | 973 | 2.546875 | 3 | [] | no_license | const mongoose = require('mongoose')
const User = require('./user')
const addressSchema = mongoose.Schema(
{
address:
{
type: String,
required: true
},
option:
{
type: Number,
},
owner:
{
type: mongoose.Schema.Types.ObjectId,
required: true,
... | true |
192b8ceed15dc8d20ecaa1c06eb767e29508e015 | JavaScript | VerzhiniaP/SoftUni | /FundamentalsJS/exercise mid/3memoryGame.js | UTF-8 | 1,452 | 3.640625 | 4 | [] | no_license | function memory(arr){
let element = arr.shift()
let arrEl = element.split(' ')
let counter = 0
isFinish = false
index = 0
let command = arr[index]
while(command !== 'end'){
counter++
let [num1, num2] = command.split(' ')
num1 = Number(num1)
num2 = N... | true |
00f6b97a4c85697fc5e895167d3ca2754290132a | JavaScript | AndrewJJT/ninjaman | /ninjaman.js | UTF-8 | 861 | 3.34375 | 3 | [] | no_license | var world = new Array(10);
for (var i=0; i<world.length; i++){
world[i] = Array.from({length: 9}, () => Math.floor(Math.random() * 4))
}
/*
var world =[
[0,0,1,0,0,2,0,0,0],
[0,1,1,0,0,2,1,0,1],
[2,1,3,0,1,0,1,2,1],
[3,1,0,2,1,0,0,0,1],
[0,0,0,1,1,0,0,0,0],
[0,0,0,0,0,2,0,0,0],
[0,0,1,2,... | true |
84e80b20601dbe922894d7c084243b658cf45150 | JavaScript | chadananda/ocean-site-content | /src/collection.js | UTF-8 | 2,334 | 2.90625 | 3 | [] | no_license | const fs = require('fs')
const sh = require('shelljs')
const mkdirp = require('mkdirp')
/**
* Initialize collections with the following configuration settings:
* name: machine name of the collection (required)
* url: url on which to begin crawling (required)
* title: human readable name of the collection (default:... | true |
8c25f70cb45c0d15f9b9b75a34eecf466d1dbb10 | JavaScript | gitkamrul/javascript-practice | /03.data-type.js | UTF-8 | 1,566 | 4.25 | 4 | [] | no_license |
// The String Data Type
var a = "Let's have a cup of coffee."; // single quote inside double quotes
var b = 'He said "Hello" and left.'; // double quotes inside single quotes
var c = 'We\'ll never give up.'; // escaping single quote with backslash
// The Number Data Type
var a = 25; // integer
var b = 80... | true |
ee0e0885c836e5624bb375766f0f52494923f999 | JavaScript | se2unal-miacastroco/react-homework | /library/src/components/Dog.js | UTF-8 | 1,338 | 2.6875 | 3 | [] | no_license | import React, { Component } from 'react';
import '../styles/App.css';
import axios from 'axios';
const API = 'https://dog.ceo/api/breeds/list/all';
class Dog extends React.Component{
constructor(props){
super(props);
this.state = {
authors : [],
dogs: [],
};
}
... | true |
f183e4ac19cc23f7fc1f973140fe54360331315a | JavaScript | robert0609/Evoque | /src_v2.0.0/js/Evoque.ScrollBar.js | UTF-8 | 12,017 | 2.578125 | 3 | [] | no_license | //Dependency: Evoque.js, Evoque.Cache.js
Evoque.extend('scrollBar', (function (self) {
var defaultOption = {
//滚动方向,horizontal/vertical, default:'vertical'
direction: 'vertical'
};
self.init = function (option) {
option = option || {};
option = lexus(option);
var cal... | true |
97f5371c63cafab19f21ec76cf3a25c4c5476ab3 | JavaScript | zhangrunhao/myThreeProject | /src/demo02/index.js | UTF-8 | 1,441 | 2.53125 | 3 | [] | no_license | import * as THREE from 'three'
import {
OrbitControls
} from 'three/examples/jsm/controls/OrbitControls'
import vrJpgArr from './vr/vr'
var camera, scene, renderer, controls;
function init() {
var container = document.getElementById('container');
renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio(w... | true |
30b31af0b737e58eddcbcd4834f46cbd32975a77 | JavaScript | kennyosc/book_world_ecom_front_end | /src/reducers/index.js | UTF-8 | 2,513 | 2.65625 | 3 | [] | no_license | import { combineReducers } from "redux";
const user_init ={
id: '',
first_name : '',
last_name : '',
username: '',
email: '',
gender: '',
phone_number: '',
avatar:'',
verified: 0
}
const admin_init = {
id: '',
username: '',
email: ''
}
const userReducer = (state = user... | true |
0cc23403de3c4987323eb02960fbe5431c9c979a | JavaScript | RomainBoudet/MJC | /BACK/app/schemas/userLoginSchema.js | UTF-8 | 1,740 | 2.671875 | 3 | [] | no_license | const Joi = require('joi');
// doc JOI => https://joi.dev/api/?v=17.4.0
/**
* Valide les informations reçu dans le body et envoyé par les utilisateurs
* @name userLoginSchema
* @group Joi - Vérifie les informations du body
* @property {string} pseudo - le pseudo qu'un utilisateur utilise pour se connecter, ne do... | true |
941a2fb5dc511b2ec7b3f66a794e33f47d043730 | JavaScript | kabbi/botfor.me | /src/components/form/Form.js | UTF-8 | 2,801 | 2.5625 | 3 | [
"MIT"
] | permissive | const { Component, PropTypes, Children } = React;
export const FORM_CONTROL_TOKEN = Symbol('FORM_CONTROL_TOKEN');
export const FormControl = (clazz) => {
clazz[FORM_CONTROL_TOKEN] = true;
return clazz;
};
export default class Form extends Component {
static propTypes = {
children: PropTypes.node,
onSub... | true |
eab7f009bc5fd6f83fc2ad52c43d2cd4e519b342 | JavaScript | KrisAphalon/nerthusaddon | /NN_maps.js | UTF-8 | 1,222 | 2.609375 | 3 | [] | no_license | /**
Name: NerthusMaps
Zawiera zmiane map na specjalne czy też sezonowe.
**/
nerthus.maps = {}
nerthus.maps.customMaps = function ()
{
let season = nerthus.season()
for (const i in nerthus.mapsArr)
if (nerthus.mapsArr[i][1] === map.id && (nerthus.mapsArr[i][0] === 0 || nerthus.mapsArr[i][0] ===... | true |
5a2e8b37c8293ec242a6c4a48a8a3403fd173c36 | JavaScript | gyofeel/interaction-and-animation-archive | /example/html5-canvas/wave/js/wave.js | UTF-8 | 2,228 | 3.203125 | 3 | [] | no_license | import {
Point
} from './point.js';
export class Wave {
constructor(index, totalPoints, color){
this.index = index;
this.totalPoints = totalPoints;
this.color = color;
this.points = [];
}
resize(stageWidth, stageHeight) {
this.stageWidth = stageWidth;
th... | true |
304824e5cae63b39760d375a82f719458ba61269 | JavaScript | NoahTV/workspace-firebase-demo-zao9eo | /js/SaveDisplay.js | UTF-8 | 1,811 | 2.640625 | 3 | [] | no_license | // Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
var firebaseConfig = {
apiKey: "AIzaSyCjRCnl-0ohz1MahXwZ7pnYNU0oaUWqgaA",
authDomain: "grocerylist-290a6.firebaseapp.com",
databaseURL: "https://grocerylist-290a6.firebaseio.com",
projectId: "grocerylist... | true |
99a0210737a39dbe7c5394e8f340df6824374803 | JavaScript | deilan-htmlacademy-projects/js-1-code-and-magick | /js/wizards.js | UTF-8 | 695 | 3.03125 | 3 | [] | no_license | 'use strict';
(function () {
var WIZARDS_COUNT = 4;
window.getWizards = function (count, options) {
count = count || WIZARDS_COUNT;
options = options || window.wizardsOptions;
var result = [];
for (var i = 0; i < count; i++) {
result[i] = generateWizard(options);
}
return result;
}... | true |
105006bab644553c9b5d677c66f73a52e36180a8 | JavaScript | reekee94/JSCore | /Practice3/1.js | UTF-8 | 277 | 3.703125 | 4 | [] | no_license | // let myArr = [2, 3, 4, 5];
// let product = 1;
// let i;
// for (i of myArr) {
// product = i * product
// console.log(product);
// }
let myArr = [2, 3, 4, 5];
let i = 0;
let product = 1;
while ( i < myArr.length) {
console.log(product *= myArr[i]);
i ++;
} | true |
3900c0d359d9494b2968e3e5f4e69dd495ea016a | JavaScript | cdimoulis/cjd-flights | /app/assets/javascripts/libs/view.js | UTF-8 | 3,890 | 2.5625 | 3 | [] | no_license | Backbone.View = Backbone.View.extend({
initialize: function(options){
_.bindAll(this, '_processDependencies', '_processData', '_processInitFunctions',
'_processAttributes', '_addChildView', 'render', 'appendTo');
var _this = this;
options = options || {}
this.template = App.Templates[... | true |
a64037f7ba86d082152a1f219d916715bc4360a0 | JavaScript | PopThosePringles/ProBoards-Yootil | /src/page.category.js | UTF-8 | 789 | 2.921875 | 3 | [
"MIT"
] | permissive | /**
* @class yootil.page.category
* @static
* Various methods to help get category information.
*/
yootil.page.category = (function(){
return {
/**
* This is an internal method.
*
* @param {String} key The key on the category object to check and get.
* @return {String}
* @ignore
*/
__ge... | true |
ba07e13536086cebc687a7b3f68639bc15cc2bff | JavaScript | StevegSiegel/Team-Profile-Generator | /tests/Intern.test.js | UTF-8 | 582 | 3.15625 | 3 | [
"MIT"
] | permissive | const Intern = require("../lib/Intern");
test('can set school', function(){
const school = 'U of M';
const test = new Intern('name', 8, 'email@email.com', school);
expect(test.school).toBe(school);
});
test('role() should return Intern', function() {
const role = 'Intern';
const test = new Intern ... | true |
f009b613b264d10db617eae6a0518b7d4103ddbf | JavaScript | Speljohan/poe-api-chrome | /src/poe_service.js | UTF-8 | 866 | 2.53125 | 3 | [] | no_license | chrome.runtime.onMessageExternal.addListener(
function(request, sender, sendResponse) {
var xhr = new XMLHttpRequest();
if (request.type == 'stash') {
var league = request.league;
var tabIndex = request.tabIndex;
var tabs = request.tabs;
xhr.open("... | true |
7ae2b26d8f1a66f386bca9bf30f90b4e1579e4b5 | JavaScript | Durdi/GameBook | /GameBook/js/model/warriorClass.js | UTF-8 | 774 | 3.296875 | 3 | [] | no_license | var WarriorClass = function(){
this.hp = 20;
this.ap = 2;
this.crit = .15;
this.speed = 3;
this.damage = 35;
this.dodge = 20;
this.bash = function(){
return this.damage;
}
this.sheildBash = function(){
return this.damage * 1.5;
}
//Debuffing skills to implement later
// this.stun = function(){
// }
... | true |
1ac955aa380940d11fbe2b7ea73a5b9e790c0ae6 | JavaScript | lirobinxc/fullstack-helsinki | /part-03-express/phonebook-project/src/modules/express.js | UTF-8 | 2,406 | 2.703125 | 3 | [
"MIT"
] | permissive | const express = require('express');
const app = express();
const morgan = require('morgan')
const cors = require('cors')
const mongoose = require('mongoose')
// MONGOOSE
// const URL = `mongodb+srv://lirobinxc:${password}@cluster0.zpzjs.mongodb.net/${dbName}?retryWrites=true&w=majority`
// mongoose.connect(URL, { useN... | true |
87c9896c2a7a2fe55ebef0fc8402fc859cee9963 | JavaScript | ricciardi13/national-parks-services-app | /index.js | UTF-8 | 1,354 | 3.109375 | 3 | [] | no_license | 'use strict';
const API_key = "rvBOo36IQaVxFFaewQM48yiSC9LYJGAj6eFyBZE8";
function getInputs() {
let entryString = $(".stateEntry").val().toLowerCase().split(",");
for (let i = 0; i < entryString.length; i++){
entryString[i] = entryString[i].trim();
}
entryString = entryString.toString();
console.log(en... | true |
ba444a2de3df99aef8aef0ac78d42da98864628c | JavaScript | wsw/WeChatHeadlines | /app/utils/Http.js | UTF-8 | 1,062 | 2.671875 | 3 | [] | no_license |
const HOST = 'http://apis.baidu.com/';
export default class Http {
static get(url, body) {
return this.request(url, 'get', body);
}
static post(url, body) {
return this.request(url, 'post', body);
}
static request(url, method, body) {
return new Promise((resolve, reject)... | true |
c39776e902509d04a5c250ba2016c25b82d2dc9f | JavaScript | Forzoom/touch | /dist/touch.cjs.js | UTF-8 | 10,449 | 2.53125 | 3 | [] | no_license | 'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length... | true |
5955f70eaadb512a5e9a415387c6ad47e0f317d6 | JavaScript | UditHariMehta/ENGG411_T | /javascript/web_google_speech_mic.js | UTF-8 | 4,631 | 2.65625 | 3 | [] | no_license |
var final_transcript = '';
var recognizing = false;
var ignore_onend;
var start_timestamp;
var recognition;
var init = function() {
if (!('webkitSpeechRecognition' in window)) {
alert('In order to use the speech interface, you must use Google Chrome')
upgrade();
} else {
recognit... | true |
c8c0b267668dc86f8c3c7946c624d0e75d521c79 | JavaScript | onlookerliu/leetcode-multilingual | /034/find-first-and-last-position-of-element-in-sorted-array.js | UTF-8 | 1,039 | 3.796875 | 4 | [] | no_license | /**
* @param {number[]} nums
* @param {number} target
* @return {number[]}
*/
var search = function (nums, target) {
let [low, high] = [0, nums.length - 1];
let mid;
while (low <= high) {
mid = (low + high) >> 1;
if (nums[mid] < target) {
low = mid + 1;
} else if (num... | true |
2b32eae001bc234152c1b28d394301a7af52af42 | JavaScript | vdekov/jscourse-beginners | /03. Conditional operators and loops/homework.js | UTF-8 | 374 | 3.09375 | 3 | [] | no_license | var shopping_cart = [
{ product : 'T-shirt', price : 10 },
{ product : 'Jeans', price : 69.9 },
{ product : 'Jacket', price : 119.99 }
];
shopping_cart.forEach( function ( item ) {
item.price = item.price.toFixed( 2 );
var char = 65 - item.product.length - item.price.length;
console.log( item.pro... | true |
da42ee0d5651378a76d73c578d6c8adcf5a8c02b | JavaScript | SLIITGroupWork/ProgressiveCareUnit-Y3S1-AF | /Backend/NodeServices/configurations/database.configurations.js | UTF-8 | 5,393 | 2.65625 | 3 | [] | no_license | const bcrypt = require('bcryptjs');
const appConfigs = require('../appConfig');
const applicationUserConsts = require('../src/consts/application-user.consts');
const userConsts = require('../src/consts/user.consts');
const tableNames = require('../src/consts/table-names.consts');
//Sleep method for waitings
const sle... | true |
35e14eb082b6c4a1c49967d432882e7a47eee47f | JavaScript | kristiperez/react-redux-day2 | /counter-app/src/DecCounter.js | UTF-8 | 722 | 2.5625 | 3 | [] | no_license | import React, {useState} from 'react'
import './App.css';
import { connect } from 'react-redux';
function DecrementCounter(props) {
const [counter, setCounter] = useState(0)
const onDecButtonClicked = () => {
props.onDecrement()
}
return (
<div>
<button onClick={() => onDecBut... | true |
d08a79917d845ee299e8ddcb63cf96ddc051a043 | JavaScript | izexleshJS/V12-AnimeBot | /komutlar/(diğer)avatar.js | UTF-8 | 1,916 | 2.640625 | 3 | [
"MIT"
] | permissive | const Discord = require('discord.js');
exports.run = async (client, message, args)=> {
//let us = message.guild.members.cache.find(u => args.slice(0).join(' ').includes(u.username))
let muser = message.mentions.users.first();
let userid;
if(isNaN(args[0])){
if(!muser){
userid = message.author.id;
}else{
us... | true |
49bbe198a5b203bc9344e744011c2d4fb6733c95 | JavaScript | Duwelzdorian/JQuery-Partie-3 | /JQuery-exo-1/assets/js/script.js | UTF-8 | 297 | 2.640625 | 3 | [
"MIT"
] | permissive | //Pour que les scripts ne se lancent pas avant que la page ait finit de charger.
$(document).ready(function() {
// Raccourci :
// $(function() {
// });
var howMany = 0;
$('#clickMe').click(function() {
howMany++;
console.log(howMany);
$('#result').text(howMany);
})
});
| true |
ac39349990118f476f8fe65769b3732cdb9a168c | JavaScript | ksren576/mundo-verde | /src/api/index.js | UTF-8 | 4,154 | 2.640625 | 3 | [] | no_license |
import axios from 'axios';
import db, { firebaseApp, getFromCollection, getDocument, updateDocument, createDocument } from '../firebase';
const baseURL = 'https://mundoverde.azurewebsites.net/api/v1'
const httpClient = axios.create({
baseURL,
timeout: 20000
});
export const getCategories = async () => getFr... | true |
909c760146041ca77eb8252ddf61c0933112088f | JavaScript | jumpingFinger/Node-ALL | /正式课/week six/one day/js/subscribel -back.js | UTF-8 | 1,730 | 3.171875 | 3 | [] | no_license | ~function anonymous(window) {
class Subscribe {
constructor() {
//=>创建一个容器,每个容器都有一个自己独有的容器,管理自己需要执行的方法即可
this.pond = [];
}
//=>向计划表中添加增加方法:去重
//=>fn : 我们需要增加的方法
add (fn){
let pond=this.pond,
isExist=false;
pond.f... | true |
35bb78654b556fb257dcb5d88db5e942ed2d0dbb | JavaScript | ridwan85/tribeswagger-backend | /models/Users.js | UTF-8 | 887 | 2.65625 | 3 | [] | no_license | const mongoose = require("mongoose");
const { Schema } = mongoose;
const crypto = require("crypto");
const UserSchema = new Schema({
email: {
type: String,
required: true,
trim: true,
unique: true,
match: /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/
},
name: { type: String },
hash: String,... | true |
e0a89948cfc1341266132c6cbdcd5331d1aedd51 | JavaScript | amaxwell01/experiments | /javascript/destructuring/dist/destructuring.js | UTF-8 | 135 | 2.65625 | 3 | [] | no_license | "use strict";
var foo = {
bar: 1,
baz: 2,
banana: 44
};
var banana = foo.banana;
var baz = foo.baz;
console.log(banana); | true |
a23d4648708a5bc79ef872451420c45eeb6d6b44 | JavaScript | Buzonxxxx/js-algorithms | /Algorithm/Patterns/Sliding_Window/53.maximumSubArray.js | UTF-8 | 856 | 4.21875 | 4 | [] | no_license | // Given an integer array nums, find the contiguous subarray (containing at least one number)
// which has the largest sum and return its sum.
// Example:
// Input: [-2,1,-3,4,-1,2,1,-5,4],
// Output: 6
// Explanation: [4,-1,2,1] has the largest sum = 6.
// Follow up:
// If you have figured out the O(n) solution, try... | true |
bba6af226629dbdcc632ab76bbfaa5d7dc389a4f | JavaScript | SirAglovale/Utilities | /password/index.js | UTF-8 | 3,277 | 3.140625 | 3 | [
"BSD-3-Clause"
] | permissive | let { createHmac } = require("crypto");
let bcrypt = require("bcryptjs");
/**
* Hash a password with sha256
* @param {String} password
* @param {String} secret
*/
const hashPassword = (password, secret) => {
let hmac = createHmac("sha256", secret || "");
let hmac_salt = salt();
hmac.update(hmac_salt + "#" + ... | true |
688af6df9eac15d0a37f65785547d911adb73e68 | JavaScript | YannickBochatay/JSYG.modules | /src/Ajax.js | UTF-8 | 10,244 | 2.984375 | 3 | [
"MIT"
] | permissive | define("Ajax",["JSYG","StdConstruct","Promise"],function(JSYG) {
"use strict";
/**
* Requetes ajax.<br/><br/>
* Dans tous les évènements ("onload","onabort","onend"), this fait référence à l'objet XMLHttpRequest.<br/>
* @param options optionnel, objet définissant les options.<br/>
* Si options est une cha... | true |
6c922404723867f12110344d2322b3e75ca95678 | JavaScript | Jinsil-Kelly/algorithm_challenges | /src/07/day_21/red/1480_runningSumOf1dArray.js | UTF-8 | 213 | 3.03125 | 3 | [] | no_license | // https://leetcode.com/problems/running-sum-of-1d-array/
const runningSum = (nums) =>
nums.reduce((acc, num, i) => {
const prevSum = acc[i - 1] || 0;
acc.push(num + prevSum);
return acc;
}, []);
| true |
badfc01c098635751538cb1584d7726bb19ed560 | JavaScript | ZloyGremlinJE/JSLesson | /Lesson_8_task_1/myscript.js | UTF-8 | 2,947 | 3.8125 | 4 | [] | no_license | //1)
let x = 5;
console.log( x++ );// 5 - т.к. постфикс - сначала вывод старого потом инкремент
//2)
console.log([] + false - null + true ); //NaN -ибо нехрен вычитать из строки [] преобразуется в пустую строку ,
// а вот если 'false-null' в скобки поместить, то будет 0true
... | true |
b1b69fc7243669702c180bcfb93bc7152a0446a2 | JavaScript | zymarev/dyplom | /src/main/webapp/js/getCardName.js | UTF-8 | 778 | 2.671875 | 3 | [
"MIT"
] | permissive | //function modal(url, cardId) {
//// $('#myModal').on('hidden.bs.modal', function (e) {
// console.log('qweqwe');
// cardId = {"cardId":cardId}
// var request = url + "&cardId=" + cardId;
// $.ajax({
// type: "POST",
// url: request,
// // The key needs to match your method's input p... | true |
72c4710ed45d86d99faeb2303704a0ef1ce8b726 | JavaScript | NickDamiano/radiobase | /scrapers/backup2.js | UTF-8 | 965 | 2.640625 | 3 | [] | no_license | var scraperjs = require('scraperjs');
var http = require('http');
var artistCall = require('./echonestArtistCall');
var callbacks = require('./callbacks.js');
// date = new Date(2007,9,13);
// endDate = new Date(2007,9,30);
// while(date < endDate){
// var day = date.getDate();//returns day number
// var month = dat... | true |
4d694d2321242cd3470d52092e7ca393961497e2 | JavaScript | krainboltgreene/recordType.js | /source/index.js | UTF-8 | 3,162 | 2.953125 | 3 | [
"ISC"
] | permissive | import {all} from "ramda"
import {any} from "ramda"
import {call} from "ramda"
import {contains} from "ramda"
import {equals} from "ramda"
import {filter} from "ramda"
import {flip} from "ramda"
import {head} from "ramda"
import {isArrayLike} from "ramda"
import {length} from "ramda"
import {map} from "ramda"
import {n... | true |
c425353219c80ba25b24fe628e7c589de59ba8b9 | JavaScript | NarasimhaVelpula/makeanote-backend | /Controllers/ContributedNotes.js | UTF-8 | 11,265 | 2.546875 | 3 | [] | no_license | const User=require('../Models/User')
const ContributedNotes=require('../Models/ContributedNotes')
const jwt=require('jsonwebtoken')
const createContributionNotes=async(req,res)=>{
const email=req.email
const {id}=req.body
if(email){
const findUser=await User.findOne({email:email})
const not... | true |
927a9174c28d1efaad2cb09591d5dc74684328b1 | JavaScript | carigonz/testPrograms | /eloquentjs/oddnumber.js | UTF-8 | 247 | 3.5 | 4 | [] | no_license | function isEven(num) {
if (num % 2 === 0) {
return "the number is even";
} else if (num % 2 === 1) {
return "the number is odd";
} else if (num < 0) {
return "the number is negative";
} else {
return isEven(num - 2);
}
}
| true |
411177a4ceaf0b5c4d762a354afba15bfd280d43 | JavaScript | roboxue/MyPage | /static/js/friends/friends_chord.js | UTF-8 | 14,909 | 3.015625 | 3 | [] | no_license | var characters = ["Monica", "Ross", "Rachel", "Joey", "Chandler", "Phoebe"];
var charactersColor = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b"];
var seasonsAvailable = 8;
var chordWidth = 500, chordHeight = 400, innerRadius = Math.min(chordWidth, chordHeight) * 0.35,
outerRadius = innerRadiu... | true |
0a8c1f2f93ffff74be4e03e8d0c37a741bd9b19d | JavaScript | shallinris/Memory-Game | /js/memory_game1.js | UTF-8 | 3,913 | 3.375 | 3 | [] | no_license | /**
* Created by itc_user1 on 12/28/2016.
*/
var MemoryCardGame = {};
MemoryCardGame.imageArray = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6];
MemoryCardGame.cards_flipped = "";
MemoryCardGame.num_cards_flipped = 0;
MemoryCardGame.cards_flipped_counter = 0;
MemoryCardGame.card1=null;
MemoryCardGame.card2 = null;
MemoryCard... | true |
78b044d6e83940c410337b3e50bbeae8f0cf31e2 | JavaScript | JGH153/jsWeird- | /main.js | UTF-8 | 338 | 2.921875 | 3 | [] | no_license | //https://stackoverflow.com/questions/2421911/what-is-the-purpose-of-wrapping-whole-javascript-files-in-anonymous-functions-li
(function(){
//https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode
"use strict"
document.addEventListener("DOMContentLoaded", function(event) {
console.log("... | true |
3d1fc7547e6a5f8c4ad351e1c4996ccb634b3551 | JavaScript | digohbt/nodejs-treinamento | /node/06-page-server/app.js | UTF-8 | 2,180 | 2.765625 | 3 | [] | no_license | const http = require("http");
const server = http.createServer(
(request , response ) => {
request.url; // tnho stringo da url da requesicção
response.writeHead(200, {'Content-Type':'text/html'})// retorna no cabeçalho
response.write('<head><meta charset="UTF-8"></head>')
if(... | true |
a6e14a9487690ca047255ffc0eca27fa292b4b5a | JavaScript | sea-d401d1-javascript/express_middleware | /jessethach/test/server_test.js | UTF-8 | 1,400 | 2.5625 | 3 | [] | no_license | const chai = require('chai');
const expect = require('chai').expect;
const chaiHttp = require('chai-http');
chai.use(chaiHttp);
const fs = require('fs');//eslint-disable-line
const request = chai.request;
describe('HTTP server', () => {
before(function(done) {
this.server = require(__dirname + '/../lib/server')... | true |
527797849f673ff8e376440006a2692cdae98082 | JavaScript | sagaciousacademy/javascript-basico | /htdocs/Loops/script2.js | UTF-8 | 176 | 3.40625 | 3 | [] | no_license | var x = 0;
document.write("Iniciando o loop...<br/>");
while(x < 10) {
document.write("Número: "+x+"<br/>");
x++;
}
document.write("Finalizando o loop...<br/>");
| true |
14cf8edacc63c8e03cc729e851c2b1eec8c95030 | JavaScript | SZTankWang/EHR | /EHR/static/js/function/util.js | UTF-8 | 3,829 | 2.765625 | 3 | [] | no_license | /**
* @author Jingyi Zhu
* @desc utilities
*/
function jsonify(data) {
var obj = {};
for(var i=0;i<data.length;i++){
obj[data[i].name]=data[i].value;
}
return obj;
}
function goToPage(route, delay) {
setTimeout("window.location.replace('http://localhost:5000/" + route + "')", delay);
}
function goBackH... | true |
37658085d95df3f8c1015231b733eb1fb4580a5b | JavaScript | Suray54/mytodo | /src/redux/projects/project.reducer.js | UTF-8 | 813 | 2.53125 | 3 | [] | no_license | import { ProjectActionTypes } from "./project.types";
const INITIAL_STATE = {
projects: [],
showAddProjects: false,
showListProjects: true,
};
const projectReducer = (state = INITIAL_STATE, action) => {
switch (action.type) {
case ProjectActionTypes.SET_SHOW_PROJECT:
return {
...state,
... | true |
9dc681c7d4ac57b55f0215a38b74f6f5fde28305 | JavaScript | wokamoto/slack-webhook-integration-sample | /lib/controllers/webhooks.js | UTF-8 | 1,536 | 2.84375 | 3 | [] | no_license | /**
* Controller: Webhooks
* - Webhooks exist outside of Slack Apps. But here is some boilerplate for them anyway.
* - event.body includes: token, team_id, team_domain, channel_id, channel_name, timestamp, user_id, user_name, text, trigger_word
* - Receives an outgoing webhook from Slack (A trigger word was used).... | true |
cf01aa15a0dea7d03047e691c6900b5f2e3b83ef | JavaScript | roywakumelojr/webdb-i-guided | /posts/post-router.js | UTF-8 | 1,436 | 2.609375 | 3 | [
"MIT"
] | permissive | const express = require('express');
// database access using knex
const knex = require('../data/db-config.js');
const router = express.Router();
router.get('/', (req, res) => {
knex.select('*')
.from('posts')
.then(posts => {
res.status(200).json(posts);
})
.catch ( error => {
res... | true |
536efe064cf4a81c5942c431cbd170b88a9f88bb | JavaScript | kuchsweet786/TriviaGame | /assets/javascript/app.js | UTF-8 | 1,692 | 3.015625 | 3 | [] | no_license | //
// function timesUp(){
// numberWrong++;
// resetTimer();
// showResult("Time's Up! The correct answer was " + currentQuestion.answers[currentQuestion.correctAnswer], "timesUp");
// }
// function resetTimer(){
// clearInterval(timer);
// timeToGuess = questionLength;
// $("#timer").empty();
/... | true |
5158a7dee2d69e3321d3612c9698747231e72c54 | JavaScript | apsdehal/Cluster | /src/listener.js | UTF-8 | 1,916 | 2.703125 | 3 | [] | no_license | var $ = require('jquery');
var Allocator = require('./allocator.js')
var Designer = require('./designer.js')
module.exports = Listener;
function Listener(designer) {
this.allocator = new Allocator();
this.designer = designer;
this.listen();
};
Listener.prototype.listen = function() {
this.listenToClickEvents();
}... | true |
daf6e2c9660c50d38e874db847b92d9cb7a27d22 | JavaScript | kino156/feExercise | /javascript/5/js.js | UTF-8 | 5,169 | 3.109375 | 3 | [] | no_license | window.onload = function () {
// 原始数据包含几个城市的空气质量指数数据
// 用户可以选择查看不同的时间粒度,以选择要查看的空气质量指数是以天为粒度还是以周或月为粒度
// 天:显示每天的空气质量指数
// 周:以自然周(周一到周日)为粒度,统计一周7天的平均数为这一周的空气质量数值,如果数据中缺少一个自然周的几天,则按剩余天进行计算
// 月:以自然月为粒度,统一一个月所有天的平均数为这一个月的空气质量数值
// 用户可以通过select切换城市
// 通过在"aqi-chart-wrap"里添加DOM,来模拟一个柱状图图表... | true |
c4725dda9a67009ad95178e841b842859154e39f | JavaScript | tkirankumar-dev/basicstypescript | /dist/11.DivingIntoInterfaces.js | UTF-8 | 1,526 | 3.078125 | 3 | [] | no_license | "use strict";
;
var pizzaInfo;
function createPizza(name, sizes) {
return {
name: name,
sizes: sizes
};
}
pizzaInfo = createPizza('Peperroni', ['small', 'medium']);
console.log(pizzaInfo);
var pizzaExt;
function createPizzaExt(name, sizes) {
return {
name: name,
... | true |
e0ae8740b0b35ecdc9319b86511e5ad608be4aaa | JavaScript | gjgd/RPSEthereumSmartContract | /test/RPS.js | UTF-8 | 4,107 | 2.765625 | 3 | [] | no_license | const RPS = artifacts.require("./RPS.sol");
contract('RPS', accounts => {
// Create shared variables accros tests.
// Mainly used to avoid deploying the contract everytime
let rps, playerOne, playerTwo;
it('should set shared variable', async () => {
playerOne = accounts[0];
playerTwo = accounts[1];
... | true |
f3283348d0f9848611940439073eceaa50e25ec2 | JavaScript | 2lipe/vanillaJS-projects | /vanillaJS-returnAddress/src/app.js | UTF-8 | 2,899 | 2.875 | 3 | [] | no_license | (function( DOM ) {
'use strict';
function app() {
const ajax = new XMLHttpRequest();
const $formCep = new DOM( '[data-js="form-search"]' );
const $inputCep = new DOM( '[data-js="getInput"]' );
var $status = new DOM( '[data-js="status"]' );
let $cep = new DOM ( '[data-js... | true |
09fba26cb8886d7d1bacb0f792a9ab6a1104db24 | JavaScript | dvxiaofan/feedreader-spec | /jasmine/spec/feedreader.js | UTF-8 | 3,775 | 3.25 | 3 | [] | no_license | /* feedreader.js
*
* This is the spec file that Jasmine will read and contains
* all of the tests that will be run against your application.
*/
/* We're placing all of our tests within the $() function,
* since some of these tests may require DOM elements. We want
* to ensure they don't run until the DOM is read... | true |
950c35a82dd99d4228fe6d00b7cd93afd735f79f | JavaScript | razorabhu1995/reactWeatherApp | /src/App.js | UTF-8 | 2,037 | 2.78125 | 3 | [] | no_license | import './App.css';
import React, { useEffect, useState } from "react";
import LoadingScreen from './components/LoadingScreen';
import WeatherInfo from './components/WeatherInfo';
import moment from 'moment';
const App = () => {
const [data, setData] = useState([]);
const [temperatureType, setTemperatureType] = ... | true |
25465c877f5323d952c52bfea5232d3dd2c3e058 | JavaScript | Malaxor/Bamazon | /BamazonManager/replenishInventory.js | UTF-8 | 1,521 | 2.796875 | 3 | [] | no_license | const colors = require("colors");
const inquirer = require('inquirer');
const { checkID, insertTable} = require('../utils');
module.exports = (connection, start) => {
connection.query("SELECT * FROM products", async (err, res) => {
if(err) throw err;
insertTable(res, colors.white);
const { id, stock } = aw... | true |
fe42f1ab5f26a655c5fa7072f2c255c0a25ad89c | JavaScript | JoseGallardoCasanova/cachipun | /assets/js/script.js | UTF-8 | 1,444 | 3.65625 | 4 | [] | no_license | var jugadas = prompt("¿Cuantas veces quieres jugar?: ")
var pipati
var compu
jugadas = parseInt(jugadas)
for (var i = 0; i < jugadas; i++) {
pipati = prompt("Escribe tu opcion, Piedra, Papel o Tijera: ");
var aleatorio = function() {
var numero = Math.floor((Math.random()*3));
var resPc;
if (numero ... | true |
e133a98d67de5ac989f57c21f54f89e37e26e999 | JavaScript | jwkuchta/woof-woof-js-practice-atlanta-web-82619 | /src/index.js | UTF-8 | 2,020 | 3.15625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | const pupsURL = "http://localhost:3000/pups";
const dogBar = document.querySelector("#dog-bar");
const dogInfo = document.querySelector("#dog-info")
const filterBtn = document.querySelector("#good-dog-filter")
filterBtn.addEventListener("click", filterDogs)
let allDogs
fetchDogs()
function fetchDogs() {
fetch(pup... | true |
22995d09fb0689b8594863b12edca8e9e5cd1cbd | JavaScript | TapanChoudhary/JS-Interview | /DataStructure/ProgrammingQuestions/ArrayChunk/ArrayChunk_Two.js | UTF-8 | 230 | 3.375 | 3 | [] | no_license | const arrChunk = (arr, size) => {
let chunkedArr = [];
for (let i = 0; i < arr.length; i = i + size) {
chunkedArr.push(arr.slice(i, i + size));
}
return chunkedArr;
};
console.log(arrChunk([1, 2, 3, 4, 5, 6, 6], 3));
| true |
f24943ddc237569b45f694048e92ad1b34b03aa0 | JavaScript | yuyuyzl/BetterASS2LRC | /index.js | UTF-8 | 1,723 | 2.765625 | 3 | [] | no_license | function parseASS(){
var assStr=$("#ass").val();
var assLines=assStr.substr(assStr.match(/\n\[Events\]/).index+10).split("\n");
console.log(assLines);
var keys=assLines[0].substr(7).replace(/ /g,"").split(",");
console.log(keys);
var lineObjs=[];
for(var i=1;i<assLines.length;i++){
i... | true |
51015af8d2cd132f10fbef7cc1a341373caa7273 | JavaScript | shengwenlin/flyingstudio.github.io | /js/index.js | UTF-8 | 14,214 | 2.84375 | 3 | [] | no_license | //=====================全局变量及其意思=============================
//window.onOff 标志右侧导航栏是否出现的变量,没出现为false;
//window.onOff2 标志鼠标滚轮滚动时是否能进行翻屏的变量,不能为false;
//window.iNow 标志当前界面显示的是第几个屏幕的变量,从0开始;
//window.bHavaMask 标志当前页面有没有因为屏幕尺寸太小出现了弹出层的变量
//=====================全局变量及其意思=============================
//开场动画
advanc... | true |
f9a24e817d642a2392c02e287b1b2800f7bb50ad | JavaScript | PriyankaWagh1/root | /Nodejs/Assignment1/ass12.js | UTF-8 | 175 | 2.875 | 3 | [] | no_license | var date= new Date();
console.log(date.toDateString());
console.log(date.toTimeString());
console.log(date.toLocaleDateString());
console.log(date.toLocaleTimeString()); | true |
bddd282cf13b2a3e522b13b38bcac5fcf9f8c052 | JavaScript | SSJ3Bane/ssj3bane.github.io | /AnnePL/js/main.js | UTF-8 | 1,003 | 2.875 | 3 | [] | no_license | (function(){
window.addEventListener('load', function() {
document.querySelectorAll(".enableImageBtn").forEach((el) => {
el.addEventListener('click', function() {
if(!this.classList.contains('active') && this.classList.contains('trigger')) {
if(confirm("This m... | true |
a47f1f73f51ff97aa34497ed45fe059fea001303 | JavaScript | Tickolas/apoteket | /src/client/util/MockCartUtil.js | UTF-8 | 598 | 2.625 | 3 | [] | no_license | const updateMockCart = (product, quantity, cart) => {
const i = cart.Items.findIndex(cartItem => {
return cartItem.Id === product.Id
})
if (i >= 0) {
let newQuantity = cart.Items[i].Quantity + quantity
if (newQuantity < 0) {
newQuantity = 0
} else {
cart.Total = cart.Total + (product.P... | true |
06aa88a24531e5c4d64857d20447e194901cfcb9 | JavaScript | awesomething/DS-Arrays | /ArrayParts/Array.js | UTF-8 | 3,600 | 3.65625 | 4 | [] | no_license | import './Memory'
import Memory from './Memory'
class Array {
constructor() {
this.length = 0
this.ptr = memory.allocate(this.length) // array starts with a length of 0 and a pointer to 0 blocks of memory
}
// push method re... | true |
53d082e333b5388c2366bfcf17a90c94565b0b4a | JavaScript | SunnyTuZi/koa2-story | /controller/story/storyController.js | UTF-8 | 8,314 | 2.625 | 3 | [] | no_license | /**
* Create by Zwl on 2019/4/28
* @Description: 故事控制器
*/
'use strict';
import StoryModel from '../../model/story/storyModel';
import SupportModel from '../../model/story/supportModel';
import LikeModel from '../../model/story/likeModel';
import CommentModel from '../../model/story/commentModel';
class Story {
... | true |
53ecab06b9b2430704894886e6b65348f2654050 | JavaScript | hank7444/ember1.81_pratice | /tmp/transpiled/app/views/radio-button.js | UTF-8 | 1,820 | 2.578125 | 3 | [
"MIT"
] | permissive | define("appkit/views/radio-button",
["exports"],
function(__exports__) {
"use strict";
/**
# radio-button(radio button模組)[view]
## 更新訊息
原始來源: http://thoughts.z-dev.org/2013/07/04/radio-buttons-in-ember-js/
最後編輯者: Hank Kuo
最後修改日期: 2014/12/06
更新資訊:
時間 | 版本 | ... | true |
f616aa9674ea55b148e83931bdbf2f8dc2aec724 | JavaScript | AlanWong-1992/node-chat-app | /server/utils/users.test.js | UTF-8 | 2,148 | 3.03125 | 3 | [] | no_license | const expect = require('expect');
var {Users} = require('./users');
describe('Users', () => {
// var users;
beforeEach(() => {
var user1 = {id: 123, name: 'John', room: 'Maths'};
var user2 = {id: 124, name: 'Jack', room: 'Maths'};
var user3 = {id: 125, name: 'Beth', room: 'Biology'};
var user4 = ... | true |
60c7c634a92ec4a2fe8e90af8d6ca650939a0f12 | JavaScript | simongawlik/recruit_API | /app/controller/bear.js | UTF-8 | 1,777 | 3.140625 | 3 | [] | no_license | // Load required packages
var Bear = require('../models/bear');
// Create endpoint /api/bears for POSTS
exports.postBears = function(req, res) {
// Create a new instance of the Bear model
var bear = new Bear();
// Set the bear properties that came from the POST data
bear.name = req.body.name;
bear.type = re... | true |
839cb51eebe83bf7a87efac1206d59788ea61844 | JavaScript | davinASC4/davin | /grou-ping/tag/script.js | UTF-8 | 845 | 3.28125 | 3 | [] | no_license | var refTag = firebase.database().ref('tags');
function errData(err) {
console.log(err);
}
var num = 1;
var tagArray = [];
refTag.on('value', gotDataTags, errData);
function gotDataTags(data) {
var tags = data.val();
var keys = Object.keys(tags);
for (var i = 0; i < keys.length; i++) {
var k... | true |
ff4848247e201571f06e898d4c61019c9805aa4f | JavaScript | HeShiLin1996/MyStudent | /work-js/work1/js/index.js | UTF-8 | 3,016 | 3.359375 | 3 | [] | no_license | (function () {
//买手机
var salary=0;
if(salary > 10000){
console.log("买个苹果吧");
}else if(salary <= 10000&&salary > 6000){
console.log("买个三星吧");
}else if(salary <= 6000&&salary>3000){
console.log("买个蓝绿吧");
}else if(salary <=3000&&salary>1000){
console.log("买个红米吧");
... | true |
d2888c4db0469ea2b797e95e92dcc46f88b55811 | JavaScript | msurgihalli/TrainRoutesInfo | /js/test/AlgorithmSpec.js | UTF-8 | 4,741 | 3 | 3 | [] | no_license | describe('Given the Algorithm', function() {
var sp = new Algorithm();
var NO_ROUTE = 9999;
it('Then it contains an shortestPathPair method', function() {
expect(sp.shortestPathPair).toBeDefined();
});
describe('edges for stations of size 3', function() {
var dataset = {
edges:[{source:0,ta... | true |
1e462edfe71be3f109bbc42c27c24dedef5ad595 | JavaScript | palaa159/playNote | /server/public/js/display.js | UTF-8 | 5,268 | 2.859375 | 3 | [] | no_license | // playNote 0.1 by Noa, Elizabeth, and Apon
// for Screen
console.log('loading main.js');
var app = {
w: window.innerWidth,
h: window.innerHeight,
players: [],
prevPlayers: [],
playable: false,
init: function() {
// setup the display
//
socket.emit('displayStart'); // display is started
socket.on('displa... | true |
eede216d66e35a74668042717f148f70cc044503 | JavaScript | snoobism/roguelite-game | /Functions/intersection.js | UTF-8 | 286 | 2.859375 | 3 | [] | no_license | function intersection(x1,y1,w1,h1,x2,y2,w2,h2)
{
w2=w2+x2;
w1=w1+x1;
if(x2>w1 || x1>w2)
{
return false;
}
h2=h2+y2;
h1=h1+y1;
if(y2>h1 || y1>h2)
{
return false;
}
return true;
} | true |
3922f80a1eb0fb596637defd04018d164d10627f | JavaScript | jsberlanga/taming-state-REACT-REDUX | /src/components/Counter.js | UTF-8 | 958 | 2.859375 | 3 | [] | no_license | import React, { useReducer } from "react";
const countReducer = (state, action) => {
switch (action.type) {
case "INCREMENT":
return {
...state,
count: state.count + 1
};
case "DECREMENT":
return {
...state,
count: state.count - 1
};
case "RESET":... | true |
af72fbafe2a76a8e0cb4407f7386ecb024b7aac5 | JavaScript | jimenezmejiaalex/progra_4_project | /Proyecto/js/StorageUsuario.js | UTF-8 | 683 | 2.765625 | 3 | [
"MIT"
] | permissive | StorageUsuario = {
store : function (id, object){
return localStorage.setItem(id, JSON.stringify(object,this.replacer));
},
retrieve: function (id){
var jsonObject = localStorage.getItem(id);
if(jsonObject === null){
return null;
}
else{
var javaScriptObject = JSON.parse(jsonObject,t... | true |
d0abf6a1680814d931a399be026397dca3a11569 | JavaScript | guilhermealbm/FlappyBirdJS | /js/flappy.js | UTF-8 | 2,756 | 2.921875 | 3 | [] | no_license | var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
var bd = new Image();
var bg = new Image();
var fg = new Image();
var pipeNorth = new Image();
var pipeSouth = new Image();
bd.src = "assets/images/bird.png";
bg.src = "assets/images/bg.png";
fg.src = "assets/images/fg.png";
pipeNorth.... | true |
21361ccb7ef9a1af6d987ca8755dfc4abdc4d2db | JavaScript | kctrlv/m4final | /app/assets/javascripts/mark-top-hot.js.es6 | UTF-8 | 412 | 2.875 | 3 | [] | no_license | $(document).ready(function(){
$.get("http://dd-hotreads.herokuapp.com/api/v1/hotreads").then(markHotReads)
});
function markHotReads(hotReads) {
$("#links-list").children().each(function() {
var url = $(this).find('.link-url').text().split(": ")[1]
if (url == hotReads[0]) {
$(this).addClass('top-read... | true |
c9bf75213801ccfb89e54460bc34082589d9f85f | JavaScript | BrunoSan123/Sw | /src/mods/userData.js | UTF-8 | 939 | 2.515625 | 3 | [
"MIT"
] | permissive | const restify = require('restify');
const builder = require('botbuilder');
const server = restify.createServer();
server.listen(process.env.port || process.env.PORT || 3978, () => {
console.log("%s Aplicação rodando na porta %s", server.name, server.url);
});
const connector = new builder.ChatConnector({
... | true |
54b85b7bc88e16c799afca7c816d29f4e425152f | JavaScript | DavidFainstein/CursoIngresoJS | /2-InstruccionIf/jsInstruccionIF (8).js | UTF-8 | 415 | 3.09375 | 3 | [] | no_license | function mostrar()
{
//tomo la edad
var edad1;
var mensaje;
var estadocivil;
estadocivil=estadoCivil.value;
edad1=edad.value;
edad1=parseInt(edad1);
if(edad1<18 && estadocivil!="Soltero")
{
mensaje=("");
}
else
{
if(estadocivil=="Soltero" && edad1>17)
{
mensaje=("Es soltero y no es menor"... | true |
a74d7bc47764b71683a3d451c03848e48c941e60 | JavaScript | NickSondrup/pokedex-api | /app/Models/CurrentPokemon.js | UTF-8 | 778 | 2.796875 | 3 | [] | no_license | export class CurrentPokemon{
constructor(pokeData){
this.id = pokeData.id
this.name = pokeData.species.name
this.imgUrl = pokeData.sprites.front_default
this.weight = pokeData.weight
}
get Template(){
return /*html*/ `
<div class="card elevation-2">
<div class="card-header">
... | true |
6bebbf512d7f9c50a31830fc3c5ee13598da7f06 | JavaScript | CourtneyD2/Blog | /src/pages/colors/index.js | UTF-8 | 3,422 | 2.515625 | 3 | [] | no_license | import React from "react";
import styled from 'styled-components';
import { ThemeProvider } from 'styled-components';
import { Layout } from "../../components/Layout";
import { CSSNormalization } from '../../styles/normalize'
import { Colors } from '../../... | true |