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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
3d79c95920f42211a8ceb6b3423f662a0ed33ecd | JavaScript | Bjerkut/bjerkut | /spel.js | UTF-8 | 11,148 | 2.859375 | 3 | [] | no_license | var spelBox;
var spelHinder = [];
var points;
var spelare = 2;
var speedX = 5;
var speedY = 5;
var go = false;
function players() {
p1 = document.createElement("button");
p1.setAttribute("id", "p1");
p1.setAttribute("class", "players");
p1.setAttribute("onclick", "enSpelare()");
p1.innerHTML = "En spela... | true |
2780190b1063d72be1c8c53e373f67f303c04abb | JavaScript | stbxzr/weatherapp | /javascript.js | UTF-8 | 235 | 2.765625 | 3 | [] | no_license | let city= "dallas"
let apiKey = "7d020fcb030d00eed3ed563fb2e04537"
fetch("https://api.openweathermap.org/data/2.5/forecast?q="+city+"&appid="+apiKey)
.then(response => response.json())
.then(function(data){
console.log(data);
})
| true |
d69cabd4f20a917506aff3ccac11a9aa957db4fe | JavaScript | DouglasSerena/SandBox | /Loja/javascript/registar.js | UTF-8 | 1,941 | 2.90625 | 3 | [] | no_license | var usuario = document.getElementById("usuario")
var email = document.getElementById("email")
var senha = document.getElementById("senha")
var verificarSenha = document.getElementById("verificarSenha")
var erro = document.getElementById("erro")
var aceito = document.getElementsByName("aceitarTermos")
function save() {... | true |
5b1587ab008de40c43b680f98541e83742e782e0 | JavaScript | kjs222/gametime | /test/segment-test.js | UTF-8 | 996 | 2.640625 | 3 | [
"MIT"
] | permissive | const chai = require('chai');
const assert = chai.assert;
const Segment = require('../lib/segment');
describe("Segment", function(){
context("with default attributes", function(){
it('should be instantiated', function(){
let seg = new Segment(10, 10);
assert.isObject(seg);
});
it('should h... | true |
fc3e61a3524143869d7e0b6748d6f941de398974 | JavaScript | mandyjia/mandyjia.github.com | /myWeb/js/myHonor.js | UTF-8 | 767 | 2.78125 | 3 | [
"MIT"
] | permissive | window.addEventListener('load',function(){
//移入导航中的li 使其变色
var aLi = document.querySelectorAll('.nav-ul li');
var aA = document.querySelectorAll('.nav-ul li a');
for(var i = 0; i < aLi.length; i++){
(function(index){
aLi[index].addEventListener('mouseover',function(){
aA[index].style.color = '#11e82b'... | true |
91a30858acce5503d870ee21a738633fa16d7038 | JavaScript | xuj2017/jsLeetcode | /235.lowest-common-ancestor-of-a-binary-search-tree.js | UTF-8 | 899 | 3.421875 | 3 | [] | no_license | /*
* @lc app=leetcode id=235 lang=javascript
*
* [235] Lowest Common Ancestor of a Binary Search Tree
*/
/**
* Definition for a binary tree node.
* function TreeNode(val) {
* this.val = val;
* this.left = this.right = null;
* }
*/
/**
* @param {TreeNode} root
* @param {TreeNode} p
* @param {TreeNod... | true |
fe4c8f3fa2a507545db414898491321d3ef6a968 | JavaScript | JonKrone/EQJS | /Ch1&2/setup&playtime.js | UTF-8 | 2,137 | 3.71875 | 4 | [] | no_license | console.log("HELLOOOO THUNAR");
var x = "island";
console.log(x, "pen", x, x);
var numbered = Number("52");
console.log(Math.max(x, numbered));
console.log(Math.max(51, numbered));
var parkedepiel = Number(function (){
if (19278346817346 % 3 == 0) {
return function() { return 0; };
} else {
return return -1;
... | true |
a3f2cc4c97d0f7419a42fabc25fdbd480f6064f2 | JavaScript | jonathasbsouza/webdeveloperbootcamp | /3_javascript/2ControlFlow/105 Annoy-o-matic/annoyomatic.js | UTF-8 | 708 | 4.84375 | 5 | [] | no_license | //v1
//Coletar resposta do usuario
/* var answer = prompt('Are you there?');
//verificar se a resposta é yes ou yeah
//a aplicação fica em loop até a resposta estar correta
while(answer !== "yes" && answer !== "yeah") {
var answer = prompt('Are you there?');
}
//alerta que a resposta é yes ou yeah
alert("Yaaaaaa... | true |
7d34bc58a7ec35e076c34028b1eaf2ad1fb6f9a1 | JavaScript | MichiganCliffy/Cliffy.Mono | /WebSites/CliffordCornerMvc/Scripts/mobile.js | UTF-8 | 3,866 | 2.515625 | 3 | [] | no_license | if (typeof String.prototype.toDate != 'function') {
// String.toDate() method.
String.prototype.toDate = function (str) {
return new Date(parseInt(this.substr(6)));
};
}
function GroupModel() {
var self = this;
self.PageNo = 0;
self.Thumbnails = ko.observableArray([]);
self.Photogr... | true |
61a4330d528e64dcb59fef06fef7a514243250ad | JavaScript | a7650/leetcode | /43.字符串相乘.js | UTF-8 | 1,184 | 3.71875 | 4 | [] | no_license | /*
* @lc app=leetcode.cn id=43 lang=javascript
*
* [43] 字符串相乘
*/
// @lc code=start
/**
* @param {string} num1
* @param {string} num2
* @return {string}
*/
var multiply = function (num1, num2) {
if (a === '0' || b === '0') return 0
if (a === '1') return b
if (b === '1') return a
let len = num2.length
... | true |
f5c149b40477f91b90c2c57aff77ee3f993a3936 | JavaScript | WDI-SEA/Dental-Spa | /src/pages/Services.js | UTF-8 | 1,105 | 2.75 | 3 | [] | no_license | import React, { Component } from 'react';
class Services extends Component {
constructor(){
super();
this.myTextbox = React.createRef();
}
componentDidMount(){
document.title = 'Our Services';
}
submitForm = (e) => {
console.log('Clicked Submit Form');
console.log('The whole node:', this.... | true |
5d351e440035f2f928ba6aecd104617e855d05d7 | JavaScript | cathey191/googleVisualisations | /timelineChart/js/script.js | UTF-8 | 716 | 2.65625 | 3 | [] | no_license | google.charts.load('current', { packages: ['timeline'] });
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
// creating data
const data = google.visualization.arrayToDataTable([
['Sections', 'Start', 'End'],
['Planning', new Date(2018, 7, 26), new Date(2018, 8, 1)],
['UX & UI', new Date(2018,... | true |
04e88a36d726cf977498cac50aec8d40fb1a3a3e | JavaScript | thiagolermen/covid-system | /public_html/js/amostra.js | UTF-8 | 12,061 | 3.03125 | 3 | [] | no_license | /*
* Author: Carine Bertagnolli Bathaglini
*/
function validaCEPAmostra(){
var strTipo = document.getElementById("idCEPAmostra");
//var tipoAmostra = '<?=$objTipoAmostra->getTipo() ?>';
var div_feedback = document.getElementById("feedback_cepAmostra");
var x = document.getElementById("id_d... | true |
1cfc678a318f9cb30dc5b783ebf34a46f2d6e6d3 | JavaScript | strawhatRick/Example_exploring | /examples/example_j7.js | UTF-8 | 257 | 3.296875 | 3 | [] | no_license | for(var a = -10; a <= 19; a++){
console.log(a);
}
for(var a = 10;a <= 40; a+= 2){
console.log(a);
}
for(var a = 301;a < 334; a+= 2){
console.log(a);
}
for(var a = 5; a < 51; a++){
if(a%5 ===0 && a%3 === 0){
console.log(a);
}
} | true |
67df0f486d8ca410f876c0936bcb0bcb74fa2b24 | JavaScript | uniOpifex/ChatBoardHBS | /db/seeds.js | UTF-8 | 2,218 | 3.0625 | 3 | [] | no_license |
require('dotenv').config();
// Database setup
var mongoose = require('mongoose');
mongoose.connect(process.env.MONGODB_URI)
const db = mongoose.connection;
// Will log an error if db can't connect to MongoDB
db.on('error', function (err) {
console.log(err);
});
// Will log "database has been connected" if it suc... | true |
eefe56a9e65afd793e3c9f0ffc7b577b70a93a8e | JavaScript | navsangeet99/Walkspan-test | /src/model/db.js | UTF-8 | 5,589 | 2.953125 | 3 | [] | no_license | /**
* @file db.js
*
* Helper functions to interface with the database
*/
const db = require("better-sqlite3")('./database/walkspan.sqlite', {readonly: true});
const db2 = require("sqlite3")('./database/walkability.sqlite', {readonly:true});
const distanceToLineSegment = require("distance-to-line-segment");... | true |
37f26488b56518cb69c61f9caafa7750e97ea4e9 | JavaScript | lovethy/botRestApi | /auth.js | UTF-8 | 1,049 | 2.625 | 3 | [] | no_license | 'use strict';
require('dotenv').config();
var jwt = require('jsonwebtoken');
var compose = require('composable-middleware');
var SECRET = process.env.SECRET;
var options = {expiresIn: '20m', subject: 'chatBotConnect'};
// JWT 토큰 생성 함수
let signToken = (id) => {
return jwt.sign({id: id}, SECRET, options);
}
// 토큰을 해... | true |
b7d28cbb2c49c38e339842c6dbc51eb6180b5951 | JavaScript | wangzemin2017/Node | /http.js | UTF-8 | 813 | 2.875 | 3 | [] | no_license | "use strict"
//引入http核心模块
const http = require('http');
//创建一个服务器
const server = http.createServer();
//监听用户的请求
server.on('request', function(req, res){
res.write('hello world');
//请求头信息(JSON对象形式)
console.log(req.headers);
//请求头信息(字符串数组形式)
console.log(req.rawHeaders);
//请求方式(在地址栏中输入进行请求的都是GET方式)
con... | true |
97a082f95a0ca34b87431447aec7cc151d31651a | JavaScript | hidyon/question | /backend/app/models/question.js | UTF-8 | 2,176 | 2.53125 | 3 | [] | no_license | const mongoose = require('mongoose')
require('dotenv').config()
const connectTo = 'mongodb://'
+ process.env.MONGO_DOMAIN + ':'
+ process.env.MONGO_PORT + '/'
+ process.env.MONGO_DB
mongoose.connect(
connectTo,
{
"useNewUrlParser" : true,
"useUnifiedTopology" : true,
"user" : process.env.MONGO_USER,... | true |
88221e5b0260e1ed1484d4fc58689b12d5cfa3a1 | JavaScript | PolkaJS/paper-wallet | /src/main.js | UTF-8 | 3,067 | 2.5625 | 3 | [
"ISC"
] | permissive | // @flow
const downloadsFolder = require('downloads-folder');
const PDFDocument = require('pdfkit');
const fs = require('fs');
const qr = require('qr-image');
const blobStream = require('blob-stream');
const FS_ADDRESS = fs.createWriteStream(__dirname + '/ADDRESS.png');
const FS_PRI... | true |
2904276ecd0431f06d12cc54ab657390b6f8eb63 | JavaScript | brainmentorspvtltd/brainapp | /js/custom/app.js | UTF-8 | 2,777 | 2.734375 | 3 | [
"MIT"
] | permissive | // this file is used to register the service worker
if(navigator.serviceWorker){
navigator.serviceWorker.register('./sw.js').then(()=>{
console.log("Service Worker is Registered SuccessFully - Brain Mentors...");
});
}
else{
alert("Your Browser is Outdated Not Support Service Worker");
}
window.addE... | true |
306fbc9e5f46a4e374179963830eed3f42d3b90a | JavaScript | raghav-dwivedi/language-translator | /middlewares/codes-generator.js | UTF-8 | 1,230 | 2.671875 | 3 | [
"MIT"
] | permissive | // This middleware populates the input and output language codes in the inputLanguages and outputLanguages tables
const { Translate } = require('@google-cloud/translate').v2;
const InputLanguage = require('../models/input-language');
const OutputLanguage = require('../models/output-language');
const translate = new ... | true |
b68fbb990cca2dc1e868a08d238ed3d609869d09 | JavaScript | PeterPimentel/react-fighters | /server/handlers/room.js | UTF-8 | 2,984 | 2.671875 | 3 | [
"MIT"
] | permissive | const Log = require('../util/Log')
const handleJoin = (socket, io) => (data) => {
Log.trace(`User - ${data.username} is logged`, 'handleJoin')
socket.username = data.username
socket.searching = true
socket.join('battle')
// socket.to('battle').emit('userJoin', {socketId:socket.id, username:data.use... | true |
7101ad781184726d3b79990afe5f3c6b61ac3c75 | JavaScript | nss-day-cohort-44/nutshell-whistling-wraiths | /src/scripts/articles/ArticleDataProvider.js | UTF-8 | 1,254 | 2.953125 | 3 | [] | no_license | let articles = []
const eventHub = document.querySelector(".container")
export const getArticles = () => {
return fetch("http://localhost:8088/articles")
.then(response => response.json())
.then(parsedData => articles = parsedData)
}
export const useArticles = () => articles.slice()
export const saveArti... | true |
e4dcd921c145e8ddfd989c348f4fded04fd9c173 | JavaScript | Minghanlin/calculator | /scripts/app.js | UTF-8 | 3,261 | 3.546875 | 4 | [] | no_license |
/*var calculator = {
numOne: 0,
numTwo: 0,
operator: "",
result: 0,
getValue1: function() {
},
getValue2: function() {
}
};
$(document).ready(function() {
$('#basic-calc').click.(function() {
});
});
});*/
function basicButton() {
var $numOne = $('#basic-num-1');
var $numTwo = $('#... | true |
723829ac80d78a71e3ae4ce77c6d6474b1f71df5 | JavaScript | craigmichaelmartin/weather-app--birch | /test/mocha/specs/integration/util/date.spec.js | UTF-8 | 1,271 | 2.609375 | 3 | [] | no_license | import {getDateSentence} from '../../../../../javascript/util/date.js';
// import { describe, it } from 'mocha';
import {expect} from 'chai';
describe('Date util', () => {
describe('get date sentence', () => {
it('should return an english date and time sentence', () => {
const sentence = getDat... | true |
0bae64b8ce21ef5cd9ba56b34dbe282a9fda46a5 | JavaScript | tonezone108/javascript-workbook | /01week/datatypes.js | UTF-8 | 1,350 | 3.765625 | 4 | [] | no_license | var now = new Date();
console.log("The time at the beep is", now);
var number = 7;
var numbertostring = number.toString();
console.log("The rings of Tartarus amount to", numbertostring);
var string = 25;
var stringtonumber = parseInt(string);
console.log("You want to know a number funnier than 24?... ", stringtonumber)... | true |
39a6fe7689c47675606bf18c63df8fd711fb0c38 | JavaScript | joy-john20/Beginner-Js-Projects-1 | /app.js | UTF-8 | 1,703 | 3.90625 | 4 | [] | no_license | //Noun Changer
const nouns = ['Robi', 'Simi', 'Max', 'Priti', 'Joe', 'Ross'];
const nbtn = document.getElementById('n-btn');
const noun = document.querySelector('.noun');
nbtn.addEventListener('click', function () {
const randomNoun = getRendomNoun();
noun.textContent = nouns[randomNoun];
});
functi... | true |
3642479ed0b0e226c68370065fd373c90542c095 | JavaScript | Suyash-Purwar/Shopify | /models/cart.model.js | UTF-8 | 2,166 | 2.765625 | 3 | [] | no_license | const fs = require('fs');
const path = require('path');
const p = path.join(
path.dirname(process.mainModule.filename),
'data',
'cart.json'
);
module.exports = class Cart {
static addProduct(id, productPrice) {
fs.readFile(p, (err, fileContent) => {
let cart = {
pro... | true |
50bda39ca9f05a1798bd692719492681804ccf19 | JavaScript | bendorshai/its-a-date | /model/tokens/english/ago&since.js | UTF-8 | 2,463 | 2.796875 | 3 | [] | no_license | var consts = require('../../consts.js');
var converter = require('words-to-numbers');
var patterns = require('../../patterns/english/numbers');
exports.tokens = [
{
// Examples: 5 years ago. 2 months ago, 1 day before __
example: '5 years ago',
category: 'ago since before & after',
... | true |
5d3009c7a34a9b1801b17e9b155fa2a36419473a | JavaScript | hyperonecom/h1-cli | /lib/text.js | UTF-8 | 426 | 2.65625 | 3 | [
"MIT"
] | permissive | 'use strict';
exports.toTitleCase = (str) => {
return str.charAt(0).toUpperCase() + str.substr(1);
};
exports.deCamelCase = (text) => String(text)
.replace(/([a-z])([A-Z])/, (m, a, b) => `${a}-${b}`)
.toLowerCase();
exports.rmRight = (text, rm) => text.endsWith(rm) ? text.slice(0, text.length - rm.length... | true |
adee1d3c0b52d08cd3225d00d7c866b58d75ec4d | JavaScript | archeni/temp_conv | /main.js | UTF-8 | 1,057 | 4.25 | 4 | [] | no_license | const printToDom = (divId, stringDom) => {
document.getElementById(divId).innerHTML = stringDom;
}
const toCelsius = (inputTemp) => {
let celciusNum = Math.round(10 * ((inputTemp - 32) * 5) / 9 ) / 10;
return celciusNum;
}
const toFahrenheit = (inputTemp) => {
let fahrenheitNum = Math.round(10 * ((i... | true |
0232e3fbbdc42df1b9d2c1212e27e5420aa13f7d | JavaScript | jing-chu/front-end | /javascript/Console-game/resources/js/script.js | UTF-8 | 6,193 | 3.390625 | 3 | [] | no_license | //**********Good luck************ */
let me = {
Race:"Human",
Type:"Female",
Moves:["heal","attack"],
Health:100,
Heal: function() {
let health= me.Health;
let random = getRndInteger(8,20); // returns a random integer from 8 to 20
console.log("me add (8 to 20): " + random);
... | true |
a52ecc70b9a59e67e608a4ed1c3aee1e102b4362 | JavaScript | Xavier-Pierre-dev/FreeCodeCamp-Certification_JavaScript-Algorithms-and-Data-Structures | /3_Regular-Expressions/33_Remove-Whitespace-from-Start-and-End/freecodecamps.js | UTF-8 | 247 | 3.375 | 3 | [] | no_license | let hello = " Hello, World! ";
let wsRegex = /Hello, World!/; // Change this line
let result = hello.match(wsRegex)[0]; // Change this line
console.log(result)
wsRegex = /^\s+|\s+$/g;
let test = hello.replace(wsRegex, "");
console.log(test); | true |
bc0ad257e2bd6225c3114c4e4649c156db1e6d29 | JavaScript | waffle-iron/Wantrepreneur | /app/reducers/products.js | UTF-8 | 394 | 2.515625 | 3 | [] | no_license | 'use strict';
const initialState = [];
const RECEIVE_ALL_PRODUCTS = 'RECEIVE_ALL_PRODUCTS';
export const receiveAllProducts = (products) => {
return {
type: RECEIVE_ALL_PRODUCTS,
payload: products
};
};
export default (state = initialState, action) => {
switch(action.type) {
case RECEIVE_ALL_PRODU... | true |
9771b12b08dd7cd22d2bf10915c3b13d9261b90c | JavaScript | Layzie/ava | /lib/test-collection.js | UTF-8 | 3,726 | 2.546875 | 3 | [
"MIT"
] | permissive | 'use strict';
module.exports = TestCollection;
function TestCollection() {
if (!(this instanceof TestCollection)) {
throw new TypeError('Class constructor TestCollection cannot be invoked without \'new\'');
}
this.serial = [];
this.concurrent = [];
this.tests = {
before: [],
beforeEach: [],
after: [],
... | true |
54ad88b5cdaae5d8e65b08198b019920d0a049a8 | JavaScript | maximopeoficiales/Universidad-React- | /src/Components/Formularios/SelectMultiple.js | UTF-8 | 1,781 | 2.8125 | 3 | [] | no_license | import React, { Component } from "react";
/* importando boostrap */
import "bootstrap/dist/css/bootstrap.min.css";
const Unicorn = () => (
<span role="img" aria-label="unicornio">
🦄
</span>
);
class App extends Component {
state = {
techs: ["Vue"],
};
handleChange = (event) => {
/* selectedOpt... | true |
908f341bde77a4a78b243afb6ffb025dc6392bde | JavaScript | amal-san/typerex-1.0 | /src/Pages/Start.js | UTF-8 | 4,891 | 2.515625 | 3 | [] | no_license | import React from 'react';
import auth from '../Components/auth';
import { IoMdRefresh } from "react-icons/io";
import { useState, useEffect } from 'react';
import { useHistory } from "react-router-dom";
import TextLoader from '../Components/TextLoader';
import cogoToast from 'cogo-toast';
export function Start (... | true |
d7ff5a542ec722be6ff56ac6a3361853bbfc7851 | JavaScript | Pashebor/sales_genetrator_react_test | /react_test_sgenerator/app/reducers/blog-reducer.js | UTF-8 | 1,050 | 2.546875 | 3 | [] | no_license | 'use strict';
import {filteredArticles} from '../controllers/getArticles.function';
import {editedState, deletedState} from '../controllers/blog.reducer.functions';
import {GET_ARTICLES_SUCCESS, ADD_ARTICLE_SUCCESS, EDIT_ARTICLE_SUCCESS, DELETE_ARTICLE_SUCCESS} from '../actions/index';
const initialState = [];
const ... | true |
6a30b29ddddb51d871fa12a21dda35eac239e928 | JavaScript | GabrielFrancaDev/niebot | /commands/branimais.js | UTF-8 | 1,242 | 3.21875 | 3 | [] | no_license | let animais = ['🐶','🐱','🐀','🐇','🐷','🐸','🐒']
let aniWin = 0;
let aniIndex = 1;
module.exports = async (client, msg) =>{
if (aniIndex<animais.length){
const message = await msg.reply('escolha um animal')
message.react(animais[aniIndex])
.then(() => message.react(animais[aniWin]))
const fi... | true |
327549a20d36250ece43208bb5bf28dd81eb706c | JavaScript | RenatMG/excel-app | /src/components/excel/Excel.js | UTF-8 | 1,892 | 2.53125 | 3 | [] | no_license | import {$} from '@core/dom';
import {Emitter} from '@core/Emitter';
import {StoreSubscriber} from '@core/StoreSubscriber';
export class Excel {
constructor(options) {
this.components = options.components || [];
this.store = options.store;
// подключение класса слушателя
this.emitter = new Emitter();
this.su... | true |
d18ef4f8ba885f9119358f7dcbb58b2cce5495a7 | JavaScript | Sahanastar/math-quiz | /quiz_game.js | UTF-8 | 312 | 2.640625 | 3 | [] | no_license | function addUser(){
player_1= document.getElementById("player1_name").value;
player_2= document.getElementById("player2_name").value;
localStorage.setItem("player1_name",player_1);
localStorage.setItem("player2_name",player_2);
window.location = "1_index.html";
}
| true |
8454209761ab2d4d2c53d81d3098b6afd3aa28e9 | JavaScript | juanmottesi/weather | /src/reducers/reducer.js | UTF-8 | 699 | 2.515625 | 3 | [] | no_license | import { CHANGE_CITY, SET_CURRENT_CITY_FULFILLED, UPDATE_WEATHER_FULFILLED } from './actions';
const initialState = { weathers: undefined, selectedCity: undefined, currentCity: undefined };
export default (state = { ...initialState }, { type, payload }) => {
let newState;
switch (type) {
case SET_CURRENT_CITY... | true |
14c260c488196889f36e071236ed1213efaa754d | JavaScript | bfrancd236/MyPet | /src/pages/register/index.js | UTF-8 | 2,459 | 2.546875 | 3 | [] | no_license | import React, { useState } from 'react'
import { Link, useHistory } from 'react-router-dom'
import { FiArrowLeft } from 'react-icons/fi'
import api from '../../services/api'
import './styles.css'
import logoImg from '../../assets/dog.png'
export default function Register() {
const [nome, setNome] = useState('')
... | true |
3ae05832344ef8b348885c356b8468922ab1f71a | JavaScript | hannahwilssens07/mesuemapp_heroku | /public/js/script1.js | UTF-8 | 185 | 2.59375 | 3 | [] | no_license | let mijnMenu = document.querySelector(".menu");
let mijnNav = document.querySelector("nav");
mijnMenu.addEventListener("click", function() {
mijnNav.classList.toggle("zichtbaar");
})
| true |
074f1dcba0a68264841639859111c4f787871470 | JavaScript | therealcmj/idm-samples | /idcs-authn-api-signin-app/helpers/idcsCrypto.js | UTF-8 | 5,887 | 2.875 | 3 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer",
"UPL-1.0"
] | permissive | var obfuscationKey = "";
const crypto = require('crypto');
var logger = require('./logging');
var tenantName = undefined;
var obfuscationKey = undefined;
var tenantCert = undefined;
exports.tenantCert = undefined;
// The loginCtx and errorCtx are both obfuscated by encrypting them with an
// key derived from the ... | true |
15ee87b7f85ff13fc443d983e1883c0e2cae2205 | JavaScript | agarzola/asmallbatch.co | /lib/contact/post_on_slack.js | UTF-8 | 2,233 | 2.65625 | 3 | [] | no_license | var https = require('https')
var url = require('url')
module.exports = post_on_slack
function post_on_slack (webhook, body) {
return new Promise((resolve, reject) => {
var data = process_body(body)
var options = define_options(webhook, data)
var request = https.request(options, res => {
var messa... | true |
d0c1a7b9559f4825303905de15c7b8d14bda4f5d | JavaScript | glennneiger/crypto-portfolio-builder | /client/src/redux/reducers/cryptoReducer.js | UTF-8 | 2,972 | 2.84375 | 3 | [] | no_license | const initialState = {
cryptoData: [],
loading: true,
filter: {
min: 0,
max: 9
},
sortByRank: true
};
const cryptoReducer = (state = initialState, action) => {
switch (action.type) {
case "INITIALIZE_CRYPTO_DATA":
return {
...state,
cryptoData: action.payload
};
... | true |
8c48b1d7e4b5fb886b5f24b6a202d35e94f12ac1 | JavaScript | qooleot/flyingmonkey-phone | /flyingMonkeyPhone/www/js/geo.js | UTF-8 | 2,947 | 2.625 | 3 | [
"MIT"
] | permissive |
// onSuccess Callback
// This method accepts a Position object, which contains the
// current GPS coordinates
var serialCounter = 0;
var userDirectionSet = false;
var onSuccess = function (position) {
var gpsInfo = '<table>' +
'<tr><td>Latitude: </td><td>' + position.coords.latitude + '</td></tr>' +
'<tr><td... | true |
b61f2a5713bdb7515cce7a07392c93b6d7b1c6fc | JavaScript | moisesfm67/fundamentos-js | /capitulo01/demo01-variaveis.js | UTF-8 | 188 | 3.4375 | 3 | [] | no_license | let nome = "Super man";
let idade = 100;
let poder = "Super força";
nome = "Batman";
poder = "Rico";
console.log(`Nome: ${nome}
Idade: ${idade}
Poder: ${poder}`); | true |
a8143f812efc830cb2f64e0ffda565aa9dd7cc88 | JavaScript | subhashkumar307/demo-repo | /React-Project/src/hello.js | UTF-8 | 2,750 | 3.3125 | 3 | [] | no_license | //var username = prompt("Enter User Name");
//var element = <h2>Hello! {username} Welcome to React</h2>;
//ReactDom.render(element, document.getElementById("container"));
// First Program
//var product = {
// Name: "JBL Speaker",
//Price: 4500.00,
//Photo: "../../Images/JBL Speaker.png"
//}
//var imageSty... | true |
bdf32e823dfda5499c88510ffeced430a40e312c | JavaScript | sannda/JSLesson | /u16/js/main.js | UTF-8 | 975 | 3.703125 | 4 | [] | no_license | // Unit 16. Перебор массивов: for, for in, for of
// Practic
"use struct"
let arr = [4, 7, 9]; // массив
// переборы
// 1 ###################
//for (let i = 0; i < arr.length; i++) {
// console.log(arr[i]);
// }
// document.querySelector('.out0').innerHTML = arr;
// 2 ###################
// for (let ke... | true |
d78ef0aced55a4333f695a104b7ef113cdb95cb4 | JavaScript | px29/leetcode | /topics/leetcode/array/lc1031.js | UTF-8 | 737 | 3.140625 | 3 | [] | no_license | var maxSumTwoNoOverlap = function(A, L, M) {
const presum = [0];
for (const a of A) {
presum.push(presum[presum.length - 1] + a);
}
console.log(presum);
let r = 0;
for (let i = 0; i < presum.length - L; i++) {
const c = presum[i + L] - presum[i];
let j = i - 1;
i... | true |
a67d7496820e439e187411e740df09b2aab46ca3 | JavaScript | bartonding/met | /scripts/modules/time.canvas/config.js | UTF-8 | 824 | 2.609375 | 3 | [
"MIT"
] | permissive | // 时间画布的参数值
define(function (require, exports, module) {
// 基准尺寸,单位 'px'。任何其它单位务必确保是它的整数倍
var BASIC_SIZE = 2;
return {
'BASIC_SIZE': BASIC_SIZE,
// 滚轮滚动一次变化的值
'SCROLL_SIZE': BASIC_SIZE,
// 时间画布的三种视图模式:0-日,1-周,2-月
// 通过鼠标滚轮切换
'LEVEL': ['DATE', 'WEEK', 'MONTH'],
// 每个 level 下,对应的 grid wid... | true |
865884e5c834e76307714e443c9047da4273e3b7 | JavaScript | fgetzkov/JavaScript | /roundingNumbers.js | UTF-8 | 120 | 3.15625 | 3 | [] | no_license | var num=22.7;
var numFloor;
numFloor=Math.floor(num);
num=Math.round(num);
console.log(numFloor);
console.log(num); | true |
7e1624f349b7b89bd633e739f610934bc625f2d2 | JavaScript | BorisovDmytro/IKS_PROJECT | /diffieHellman/Client/ClientDH.js | UTF-8 | 1,450 | 3.09375 | 3 | [] | no_license | /*
*/
class ClientDH {
constructor(isGenerate) {
if (isGenerate) {
this.gen = this._getGenerator(this._getRandomInt(0, 2));
this.mod = this._getRandomInt(111111111, 999999999);
}
this.private = this._getRandomInt(2, 8);
this.key = 0;
}
getPrivate() {
return Math.pow(this.gen, t... | true |
6db146edc724b05352702d22b4643858139c4676 | JavaScript | dothecode-ak/nodejs-learning | /event.js | UTF-8 | 191 | 2.6875 | 3 | [] | no_license | const events=require('events');
const eventEmmiter=new events.EventEmitter();
eventEmmiter.on('speak',(name)=>
{
console.log(name ,'is speking...');
});
eventEmmiter.emit('speak','Anil'); | true |
86b9769a869b5118cc73c39783d26dea7bed4b22 | JavaScript | farverio/js-looping-and-iteration-map-lab-houston-web-071618 | /index.js | UTF-8 | 475 | 3.46875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | // Code your solution in this file.
function lowerCaseDrivers(driversArray) {
return driversArray.map(driver => driver.toLowerCase())
}
function nameToAttributes(driversArray) {
return driversArray.map(driver => {
nameArray = driver.split(' ')
return {firstName: nameArray[0], lastName: nameArray[1]}
})
}... | true |
7750b5a7317ae4e17f0adfd04bdb99878734302d | JavaScript | efehrholz/n220spring2021 | /labs/lab2/js2/app.js | UTF-8 | 324 | 3.1875 | 3 | [] | no_license | //let xPos = 0;
//let yPos = 0;
function setup() {
createCanvas(600, 500);
}
function draw() {
background(50);
noStroke();
/*if (mouseX, mouseY < 299) {
fill(84, 192, 255) //blue
} else (mouseX, mouseY > 300) {
fill(186, 56, 56) //red
} */
ellipse(mouseX, mouseY, 25, 25... | true |
d93ea1069b9913f507c34f3c857efa5e9abfeb91 | JavaScript | Yar83Men/slider | /app.js | UTF-8 | 860 | 3.09375 | 3 | [] | no_license | const images = document.querySelectorAll('.slider-line img');
const sliderLine = document.querySelector('.slider-line');
let count = 0;
let width;
function init(){
width = document.querySelector('.slider').offsetWidth;
sliderLine.style.width = width*images.length+'px';
for(let i=0; i<images.length;... | true |
0385152c6c7346c9f54072c101727c6adb91809c | JavaScript | mattbrown124/Bored-Activity | /index.js | UTF-8 | 2,373 | 3.296875 | 3 | [] | no_license | const BASE_URL = "https://ghibliapi.herokuapp.com/films"
const SEARCH_FILM_URL = BASE_URL + "/?by_film="
const SEARCH_DIRECTOR_URL = BASE_URL + "/?by_director="
const SEARCH_GEN_URL = BASE_URL + "/search?query="
const navAll = document.getElementById("movies-all")
const navSearch = document.getElementById("search-name"... | true |
4c2a4abb30dc787223a99cd96e2a83655625381d | JavaScript | zzy1993/galler | /app/controllers/comment.server.controller.js | UTF-8 | 1,565 | 2.65625 | 3 | [] | no_license | var Comment = require('../models/comment.server.model');
var Reply = require('../models/reply.server.model');
module.exports = {
getCommentTree: getCommentTree, //commentId
postReply: postReply //username, body, parentId
};
function getCommentTree(req, res){
var commentId = req.params.commentId;
Comment.selectC... | true |
6e652cfab46b9ac64a407ef94d0efc113a820782 | JavaScript | iStoic/React_portfolio | /src/components/subcomponents/SubmitForm.js | UTF-8 | 3,621 | 2.984375 | 3 | [] | no_license | // import React, { Component } from "react";
import React from "react";
// import { homedir } from "os";
class SubmitForm extends React.Component {
constructor(props) {
super(props);
this.state = {
name: this.props.name,
age: this.props.age,
userName: this.props.userName,
};
// co... | true |
d2ce484cd57fa2e7800a6b022c8a147fadb2eae3 | JavaScript | msohaib308/VideoCalling | /public/script.js | UTF-8 | 8,420 | 2.59375 | 3 | [] | no_license | //showing video inside JS file, access video and audio
//const { create } = require("domain");
const socket = io('/')
const videoGrid = document.getElementById('video-grid'); //links to video grid in room.ejs
const myVideo = document.createElement('video'); //creates video element
myVideo.muted = true; //ensures you a... | true |
b539acf70449898ce434f2efac5dd35c36ffcf0e | JavaScript | gittieatlas/Lab.ExpressFirst | /app.js | UTF-8 | 687 | 2.640625 | 3 | [] | no_license | const express = require('express');
const PORT = 1337;
const app = express();
// /
app.get('/', (req, res) => {
res.send(`<html>
<head>
<title>Puppies and Kittens Galore!</title>
</head>
<body>
<h1>Puppies and Kittens Galore!</h1>
</body>
</html>`);
});
// /puppies
app.get('/puppies', (req, res) ... | true |
9e476e72be0802ec8e62adb04c65055513ff9e9d | JavaScript | Xereniak/tiltyCube | /platforms/browser/www/js/main.js | UTF-8 | 1,244 | 2.640625 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | //var app = new Framework7({
// // INITIALIZE APP
// root: '#app',
//
// routes: [
// {
// path: '/page2/',
// url: 'pages/page2.html'
// }
// ]
//});
//
//var mainView = app.views.create('.view-main');
var x, y, z, r, g, b
StatusBar.hide()
if (window.DeviceOrientat... | true |
d48cccd2098e690d717dada9c57fdb0ca25e4e42 | JavaScript | BlasToth/letscoder-bootcamp-202101 | /proyecto-3-own-project/client/src/components/Allverbs.js | UTF-8 | 3,615 | 2.578125 | 3 | [] | no_license | import { useEffect, useState } from "react";
import 'bootstrap/dist/css/bootstrap.min.css';
import { Container, Spinner } from "react-bootstrap";
import Pagination from './Pagination';
function Allverbs() {
useEffect(() => {
fetchItems();
}, []);
const [items, setItems] = useState([]);
const [isLoade... | true |
17c53d455d1ad2229a0efaba0487de7752ccf699 | JavaScript | waqil52/JSExercise | /1/1.js | UTF-8 | 276 | 3.40625 | 3 | [] | no_license | var arr = [2, 4, 9, 2, 0, 16, 24];
var sorted = arr.sort(function (a, b) {
return a - b;
});
var secondSmallest = sorted[1];
var secondLargest = sorted[sorted.length - 2];
console.log("Second Smallest: " + secondSmallest);
console.log("Second Largest: " + secondLargest); | true |
fe63ba3b0bb57d74b29e00c45eb791bf43cdbd76 | JavaScript | wicked-knife/electron-vue-music | /src/renderer/common/utils.js | UTF-8 | 567 | 2.921875 | 3 | [] | no_license | export const isObject = o => Object.prototype.toString.call(o) === '[object Object]'
export const throttle = (fn, delay = 100) => {
let timer = null
return function(...args){
if(timer) {
clearTimeout(timer)
}
timer = setTimeout(() => {
fn(...args)
timer = null
}, delay)
}
}
exp... | true |
c6229e74e5826b49094ccea91a09c4cf39b320b3 | JavaScript | paralamahtem/football | /createDB.js | UTF-8 | 1,740 | 2.734375 | 3 | [] | no_license | var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost:8080/all', {useNewUrlParser: true});
var async = require('async')
var Player = require('./models/player').Player;
// очистим бд
// вставим 5 героев
// закроем соединение с бд
function open(callback){
mongoose.connection.on('open', callback)
}
... | true |
d83b23e20e6ca3c3678b71b49dc45e5dfa17153a | JavaScript | EmmanuelA0428/json_project | /script.js | UTF-8 | 818 | 3.015625 | 3 | [] | no_license | //console log
console.dir(profiles);
//set up
let user = document.querySelector("#user");
for (let i = 0; i < 12; i++ ) {
let newDiv = document.createElement("div");
let text = document.createElement("p");
let newImg = document.createElement("img");
//call out
text.innerHTML = "Name... | true |
6c18901f07e258b5744d57e5f79d00400ea620f6 | JavaScript | reekoheek/docker-ngrok | /ui-src/services/ngrok.js | UTF-8 | 1,407 | 2.53125 | 3 | [
"MIT"
] | permissive | class Ngrok {
async fetch (uri, { method = 'GET', headers, body } = {}) {
const options = {
method: method,
headers: Object.assign({
'Content-Type': 'application/json',
'Authorization': `Bearer ${window.jwt.getToken()}`,
}, headers),
};
if (body) {
options.body = J... | true |
bec7b7dee0cdd0eb467b7ff0394ed9ff6522f8e9 | JavaScript | ryoichi-kishimoto/push-notify | /src/public/main.js | UTF-8 | 2,340 | 2.65625 | 3 | [] | no_license | const client = axios.create({
timeout: 5000,
headers: {'Accept': 'application/json',
'Content-type': 'application/json'}
})
new Vue({
el: '#app',
data: {
/**
* 登録済みサービスワーカー?
*/
registration: null,
},
created() {
/**
* サービスワーカー登録
*
* @see https://developer.mozilla.o... | true |
45d163d5280e3d35db0fd59e3cd0ae9c90c2850a | JavaScript | FredLackey/cleaner-node | /src/booleans.js | UTF-8 | 1,137 | 3.40625 | 3 | [
"Apache-2.0"
] | permissive | const TRUE_STRINGS = ['true', 'yes', 'on', '1'];
const FALSE_STRINGS = ['false', 'no', 'off', '0'];
const parse = (value, strict = true) => {
if ([true, false].includes(value)) { return value; }
if (strict) {
if (typeof value !== 'string') { return undefined; }
if (['TRUE', 'FALSE'].includes(`${value}`.tri... | true |
85fa2566ab609ca6d36f822dec8582f69beff342 | JavaScript | parksangkil/react-native-weather | /app/state/Reducers.js | UTF-8 | 1,835 | 2.875 | 3 | [] | no_license | // @flow
import type * as Types from './Types';
import * as actions from './Actions';
import {ToastAndroid} from 'react-native';
// todo define the empty startup state by creating a const for an empty user object
const EMPTY_USER: User = {
isAnon : true,
name : 'anonymous',
userid ... | true |
3a7f96d8c019ec93826c36ae781476fa400c1d91 | JavaScript | JensPauwels/DPT-compiler-intializer | /lib/installer_tool.js | UTF-8 | 914 | 2.671875 | 3 | [
"MIT"
] | permissive | 'use strict';
const mkdirp = require('mkdirp');
const inquirer = require('inquirer');
const fs = require('fs-extra');
const questions = [{
type: 'input',
name: 'project_path',
message: "Where do you want to install the compiler?",
default: `${process.cwd()}/`
}];
const installTheCompiler = function (path) {
... | true |
6badebf4e26d458464beea355f3ca243f4bb4690 | JavaScript | DylanKojiCheslin/linearSystemSolver | /rowReplacementRemover.js | UTF-8 | 541 | 2.609375 | 3 | [
"MIT"
] | permissive | import {rowReplacement} from "./rowReplacement";
// zeros out the entry using _rowReplacement and the _pivot
export function rowReplacementRemover(system, rowNumber){
let newSystem = {...system};
const rowValue = Number(newSystem.s[rowNumber][newSystem.pivot.column]);
const pivotValue = Number(newSystem.s[newSy... | true |
0cd42d802d13b3e4ade8fe4131f2382ae0e7728b | JavaScript | Team-Cerberus/Invoice | /public/models/InvoiceRow.js | UTF-8 | 1,252 | 2.5625 | 3 | [
"MIT"
] | permissive | class InvoiceRow {
constructor(
productNumber,
productName,
measuringUnit,
quantity,
unitPrice,
VATValue,
) {
this._productNumber = productNumber;
this._productName = productName;
this._measuringUnit = measuringUnit;
this._quantity... | true |
ecacd54ed243078b9bbd71ddd5a9c601602a1f31 | JavaScript | metalralf/webprogketto | /js/app/PlayTetris.js | UTF-8 | 4,833 | 2.9375 | 3 | [] | no_license | import Player from "../components/Player.js";
import { emptyElement, addElement } from "../utils/DOMUtils.js";
import Objects from "../components/Objects.js";
class PlayTetris {
constructor() {
this.appName = 'Game';
this.init();
}
init() {
this.playerContainer = document.getEleme... | true |
152e5aa3c417c1373c29d3fb3777e22446e25fa8 | JavaScript | gberzuela/Udemy-Big-Tech-Interviews | /Queues/queueWithStacks.js | UTF-8 | 1,802 | 4.6875 | 5 | [] | no_license | /*
Implement the class Queues using stacks. The queue methods you need to implement are enqueue, dequeue, peek, and empty
enqueue: append a value to the end of the queue
dequeue: remove and return the value at the start of the queue
peek: return the value at the start of the queue
empty: returns a boolean value of whe... | true |
cec20340ddc4ed51469d5cd1f0b9322c85af078d | JavaScript | jadedResearcher/JavascriptPlants | /scripts/Halloween/HalloweenBranch.js | UTF-8 | 5,910 | 3 | 3 | [
"MIT"
] | permissive | //a halloween branch is black,
//and larger
//has a start point (x and y)
//and an end point
//it randomly creates a mostly straight path from start to end
function HalloweenBranch(x,y,maxx,maxy, parent) {
//initial variables
this.x = x;
this.y = y;
this.seed = false;//not a seed
this.is_stasis = fa... | true |
1736cc64fa24cd41cf05a81fc3314bd8ad29c32e | JavaScript | zebriukas/futurism | /server/multi/chat.js | UTF-8 | 2,026 | 2.609375 | 3 | [
"MIT"
] | permissive | (function() {
'use strict';
var _ = require('lodash');
var broadcast = require('./broadcast');
var sanitize = require('validator').sanitize;
/**
*
* @param {string} roomName
* @constructor
*/
var Chat = function(roomName) {
var msgs = [];
var recentMsgs = [];
/**
*
* @param user
* @para... | true |
f30ea41eb64daf10a735a1aaa6dc311561e06a6f | JavaScript | satyasinha94/hogwarts-nyc-web-111918 | /src/components/App.js | UTF-8 | 1,481 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react';
import '../App.css';
import Nav from './Nav'
import hogs from '../porkers_data';
import HogContainer from './HogContainer'
import Hog from './Hog'
class App extends Component {
state = {
hogs: hogs,
filters: {
type: 'all'
}
}
onChangeType = (e) => {
... | true |
bb84973a478a7e6bf7ab49e38688dd5677ac3567 | JavaScript | cfrinka/exercicios_aulas | /ARROW_FUNCTIONS_RICHARD/E7.js | UTF-8 | 426 | 3.578125 | 4 | [] | no_license | const rs = require('readline-sync')
const inicio = rs.questionInt('Escolha uma opção: 1. Cadastrar 2.Listar 3.Sair: ')
while (inicio != 1 && inicio != 2 && inicio != 3) {
console.log('Opção inválida')
break;
if (inicio === 1) {
console.log('cadastrar')
}
else if (inicio === 2) {
... | true |
413b4b3be02806de9d1a8bc8bc78eec01c033396 | JavaScript | imouto1994/juna | /index.js | UTF-8 | 1,752 | 3.0625 | 3 | [] | no_license | const got = require("got");
const TOKEN =
"BQCam3mrQjJBCfhyWDD26iH-6wc7vEH8tixfruvztJgBnd7ifgf_2oscjGuovZo1A-jV7FKKzM_PicWgoPwRhJdPFjdcItiON_MteHL6Rmu4zECpbVVNw4NKM_J_gpC9K_V3wuahRC7Pc90FVdD7trlI9-sU2w-qsL6j2rkuuXztGIuYppicr-NU9Nz0OqcCmHfcsOcnFUtpZ0RY7VSuEALdHdHrldlJOS4DHMcgeRUE2I1R_Rcgh-OgayakW6MD33JFrndzqJdgsTXub_... | true |
3c82e62ce7532332b37a95bad7a26d3de1381e50 | JavaScript | JAndresOrozco/Calculadora | /sc.js | UTF-8 | 3,983 | 3.140625 | 3 | [] | no_license | var a;
var b;
var operacion;
function init(){
var result = document.getElementById("result");
var eici = document.getElementById("eici");
var plusminus = document.getElementById("plusminus");
var percent = document.getElementById("percent");
var division = docume... | true |
ab2a151083a8f547bfb8ac0cbe5c627c3537c78d | JavaScript | mary-caraveo/arrays-js | /server/includes.js | UTF-8 | 470 | 4.3125 | 4 | [] | no_license | const pets = ["cat", "dog", "bat"];
//Ejemplo con for
let includeInArray = false;
for (let index = 0; index < pets.length; index++) {
const element = pets[index];
if (element === "dog") {
includeInArray = true;
break;
}
}
console.log("for", includeInArray);
//Ejemplo con includes
const rta = pets.inclu... | true |
06d1fb254fd9ac6e9082289f6bbe7d2b827b3d13 | JavaScript | 28raining/28raining.github.io | /circuitSolver/modules/mna.js | UTF-8 | 13,033 | 2.5625 | 3 | [] | no_license | import simplify_algebra from "./simplify_algebra.js";
var debug = false;
function arrayContains(list1, item) {
return list1.findIndex((elem) => elem.el == item.el && elem.port == item.port);
}
function includesElement(list1, item) {
return list1.findIndex((elem) => elem.el == item);
}
function processCanvasStat... | true |
8d9cd8377f91e3d29cbbbb11b8ea64663bb88e11 | JavaScript | kanehara/patdoc | /server/test/integration/appointments.spec.js | UTF-8 | 10,081 | 2.515625 | 3 | [] | no_license | import chaiHttp from 'chai-http'
import chai from 'chai'
import prepareMockServer from '../prepare-mock-server'
import logger from '../../src/logger'
import config from '../../src/config'
chai.use(chaiHttp)
chai.use(require('chai-datetime'))
const request = chai.request
const expect = chai.expect
describe('Appointmen... | true |
84b50fe9130c26d41492244c3aa7142226cfd9e6 | JavaScript | wape30/ionic-firebase-shopping-cart-admin | /functions/index.js | UTF-8 | 1,510 | 2.640625 | 3 | [
"MIT"
] | permissive | const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
const messaging = admin.messaging();
/* Listens for new messages added to /messages/:pushId and sends a notification to subscribed users */
exports.pushNotification = functions... | true |
1161401c3827ae3f5e0d5ee00fe0a33637345b3b | JavaScript | aleksandar-babic/ChatExpress | /routes/index.js | UTF-8 | 739 | 2.578125 | 3 | [] | no_license | var express = require('express');
var router = express.Router();
//Handles homepage get requests
router.get('/', ensureAuthenticated,function(req, res, next) {
if(!req.query.username && req.isAuthenticated())
return res.redirect('/appendUname');
return res.render('index');
});
//Redirect when user se... | true |
8c4f1ada0578c0a4471d6c428f16bae66be45cae | JavaScript | gleydsonjose/mercafacil | /project/server/services/varejao/Contacts.js | UTF-8 | 1,567 | 2.703125 | 3 | [] | no_license | const db = require('../../databases/connections/postgresql.js')
function getAll() {
return new Promise(async (resolve, reject) => {
try {
const { rows: contacts } = await db.query('SELECT * FROM contacts ORDER BY id')
resolve(contacts)
} catch (error) {
reject(error)
}
})
}
function ... | true |
dec5f7dfae1146d12fa5d8f6d551050ff19992a7 | JavaScript | tomcoolnl2/node-grpc | /shared/RPCDeadline.js | UTF-8 | 619 | 2.875 | 3 | [] | no_license |
const RPC_TYPE = {
SHORT: 1,
MEDIUM: 2,
LONG: 3
}
const RPC_DEADLINE = {
SHORT: 1000,
MEDIUM: 5000,
LONG: 7000
}
function getRPCDeadline(rpcType) {
let t = null
switch(rpcType) {
case RPC_TYPE.SHORT:
t = RPC_DEADLINE.SHORT
break
case ... | true |
9fb4d8e0f905d331df2b321b3a8516ac2975783a | JavaScript | smart-calendar-javier-mariia/Smart-calendar | /js/main.js | UTF-8 | 5,658 | 2.90625 | 3 | [] | no_license | let event1 = {
date:{
year: 2019,
month: 02,
day: 06
},
title: `Class Session`,
class: `INTR2012 INTERFACE DEVELOPMENT II`,
startTime: `12:00`,
endTime: `15:00`,
repeats: true,
howOften: `Every Wednesday`,
reminder: `1 hour`,
completed: true,
eventCategory: `School`,
eventNotes: `Lab... | true |
e0c2bf6f7fd73355e9a86b4d9813910a6ccdb13b | JavaScript | cherkavi/java-code-example | /test.nmt/src/java/script.js | UTF-8 | 6,947 | 2.515625 | 3 | [] | no_license | function button_add_click(){
var table=document.getElementById(table_name);
var combobox=document.getElementById(combobox_name);
var delete_text;
var delete_index;
var counter=0;
// combobox exists ?
if(combobox!=null){
... | true |
6351410650037778dfe19b5eaa643ccb23343f41 | JavaScript | tomasz-paterka/salary_calculator | /src/js/view/mandateContractView.js | UTF-8 | 12,237 | 2.734375 | 3 | [] | no_license | /** @module mandateContractView */
import { elements, laborFundInfo } from './baseView';
/**
* Gets percentage of accident insurance value
* @function
* @returns {string}
*/
export const getAccidentInsInputMandate = () => elements.accidentInsInputMan.value;
/**
* Function that renders employee results
* @functi... | true |
7f93ecda173ce6f8f96d85537d264921ed5fa511 | JavaScript | renardete/workshop-api-testing-js | /test/github-api-gist.spec.js | UTF-8 | 2,510 | 2.53125 | 3 | [
"MIT"
] | permissive | const agent = require('superagent-promise')(require('superagent'), Promise);
const statusCode = require('http-status-codes');
const httpUtils = require('../utils/http-utils');
const urlBase = 'https://api.github.com';
describe(`Given ${urlBase} domain is up and gists resource is public`, () => {
let responsePost = ... | true |
a27f0d3c9c27ecf2b15f7bc818d090021fbe326c | JavaScript | jenkinsci/chosen-views-tabbar | /src/main/webapp/utils.js | UTF-8 | 2,833 | 2.578125 | 3 | [] | no_license | function getShortcutStringRepresentation(event) {
var modifiersArray = {
altGraphKey:event.altGraphKey,
altKey:event.altKey,
ctrlKey:event.ctrlKey,
metaKey:event.metaKey,
shiftKey:event.shiftKey
}
var modifiers="";
for(var prop in modifiersArray) {
if (modifiersArray.hasOwnProperty(prop)) {
if ... | true |
7cf5cd41fee250200e9abfa471ad1669643d40b8 | JavaScript | pikog/H2-P2021-Minecraft-experience | /assets/js/items/Steak.js | UTF-8 | 815 | 2.609375 | 3 | [] | no_license | class Steak extends CustomItem {
constructor(name, associatedObject) {
super(name, associatedObject)
this.currentCookTime = 0
this.neededCookTime = 5
this.boxCorrection = {
position: {x:0, y:-0.1, z:0}
}
this.alreadyCooked = false
}
/**
* Cha... | true |
3b57e6b86d0d92764e94cbac536d7b6a0540bf46 | JavaScript | Owen-Ng/HeadJS | /JS Library/head.js | UTF-8 | 20,990 | 2.96875 | 3 | [] | no_license | "use strict"
const log = console.log;
/*
* Resource used: https://www.w3schools.com/ - General JavaScript reference
* https://www.w3schools.com/jsref/obj_mouseevent.asp - Mouse Events.
* https://gomakethings.com/how-to-use-requestanimationframe-with-vanilla-js/ - For smoother effects.
* https://www.w3schools.com/jsref... | true |