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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
f26b797ef141ac19faf9606a8f43addd26d17028 | JavaScript | mlizchap/flex-box-guide | /src/components/ChildPropSection/ItemInfoCardContainer.js | UTF-8 | 1,711 | 2.6875 | 3 | [] | no_license | import React, { Component } from 'react';
import ItemInfoCard from './ItemInfoCard';
import styled from 'styled-components'
const items = ["a", "b", "c"]
class ItemInfoCardContainer extends Component {
constructor(props) {
super(props);
this.state = {
isMobile: true
};
}
... | true |
671a98586f94ebaf7e19b5b4ee80ab46ec942929 | JavaScript | ntorguud/IT121 | /HW/js/functionToFunctionArgument.js | UTF-8 | 1,490 | 3.78125 | 4 | [] | no_license | var birthYears = [1981, 2005, 1978, 1986, 2010];
var ages = processArray(birthYears, findAges);
console.log(ages);
console.log(processArray(ages, isAdult));
console.log(processArray(ages, findMaxHeartRates));
console.log(processArray([2016, 1965, 1945], findAges));
console.log(processArray([1965, 2001, 1998], findMaxH... | true |
e0c4f777f188a474ff6156d885a0dace95d8307c | JavaScript | jsygo/c0821-code-solutions | /object-manipulation-1/src/get-value.js | UTF-8 | 420 | 3.59375 | 4 | [] | no_license | /* exported getValue */
// input: an object, a key which will be a string
// output: the value of the property of the object who's name matches key
// NOT NEEDED: check through each property of the object
// NOT NEEDED: if property matches key, return the value of that property
// revision: return the value of the prop... | true |
50a2b9e3d627389d973c03843d49beae3cbca979 | JavaScript | nayeem98746/mac-book-air-webside | /js/script.js | UTF-8 | 2,713 | 2.859375 | 3 | [] | no_license | // Memory
function selectMemory (memorygb ){
const memoryCost1 = document.getElementById('memory-cost')
if(memorygb == true){
let memoryCostText1 = memoryCost1.innerText = '0'
const memoryCost8 = parseFloat(memoryCostText1)
}
else if (memorygb == false){
... | true |
2c6bc721ce5bc4cf762648287a20d1003ff4c4dd | JavaScript | windldream/leetcode | /array/badSensor.js | UTF-8 | 630 | 3.359375 | 3 | [] | no_license | /**
* @param {number[]} sensor1
* @param {number[]} sensor2
* @return {number}
*/
var badSensor = function (sensor1, sensor2) {
const n = sensor1.length
for (let i = 0; i < n; i++) {
if (sensor1[i] !== sensor2[i]) {
if (i === n - 1) return -1
// 第一个不真确
let j = i
let k = i + 1
w... | true |
331ff494f20d5eb549b565dfc2c0a7fe80a00974 | JavaScript | nielsrobin/cdcph2012 | /Servers/05.expressjs.js | UTF-8 | 1,022 | 2.53125 | 3 | [] | no_license | var express = require('express');
var _ = require('underscore');
var app = express.createServer();
app.use(express.bodyParser());
var products = [];
app.get('/', function(req, res){
res.send('try /products');
});
app.get('/products', function(req, res){
res.json(products);
});
app.get('/products/:id', function(re... | true |
54e8584c826f2ba704930511d7a737fc8237a2b5 | JavaScript | thejatmik/todo-server | /controllers/TodoController.js | UTF-8 | 3,604 | 2.546875 | 3 | [] | no_license | const { Todo, Sequelize } = require("../models/index");
const AppError = require('../helper/myCustomError');
const { getHoliday, holidayBetween } = require('../helper/nextHoliday');
class TodoController {
static findAllTodo(req, res, next) {
Todo.findAll({
where: {
UserId: req.t... | true |
6a40b9d800dd3cd86d75dbc14b11c89995f1c1e4 | JavaScript | freedommen/test1 | /Public/static/daterangepicker/js/getprovincetop.js | UTF-8 | 17,688 | 2.671875 | 3 | [] | no_license |
//日历js
$(document).ready(function() {
$('#adddate').daterangepicker({
startDate: moment().startOf('day'),
endDate: moment(),
minDate: '2016-01-01', //最小时间 =====>>格式要跟格式化的样式一致
endDate : moment(), //最大时间
//dateLimit : {days : 30}, //起止时间的最大间隔
... | true |
6077f3ef44a249a8fc11c0453f130f8d2625724a | JavaScript | yugrinkov/flowers | /app/js/script.js | UTF-8 | 853 | 2.65625 | 3 | [] | no_license | console.log("Load script.js");
function getMoreButtonPopupElement () {
return document.getElementsByClassName('jsMoreButtonPopup')[0];
}
function getMoreButtonElement () {
return document.getElementsByClassName('jsMoreButton')[0];
}
document.getElementsByClassName('jsMoreButton')[0].addEventListener('click',... | true |
e59d2ac2da248ce1af11ba8031e39bc61b945620 | JavaScript | garyranson/expression-compiler | /lib/compiler-visitor.js | UTF-8 | 7,409 | 2.609375 | 3 | [] | no_license | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Instructions = require("./instructions");
const rootScope = new Map([
[
"Math", {
eval: () => Math, toString: () => 'Math', isConstant: () => false, toFunction: () => () => Math
}
],
["Round", {
... | true |
278fc73cc2aee2472b4bac6bbbc79de79bfbff1b | JavaScript | rajarajankamban/form-validate | /jsbasics/factorial.js | UTF-8 | 500 | 4.75 | 5 | [
"MIT"
] | permissive | /*1) Find the factorial of a given number. If the given number is 5, factorial is computed as 5*4*3*2*1 which equates to 120. Please write a program which would find the factorial for any number.
Input: 5
Output: 120 */
function fact(num){
var sum = 1;
for(var i = 1; i<=num; i++){
sum *= i;
... | true |
eb38093c0556fa7ca8c5b68440f0be0b896b2920 | JavaScript | razzanm/Data_Structure_visualisation | /scritps/binarysearchtree.js | UTF-8 | 4,058 | 2.921875 | 3 | [] | no_license | const binarySearchTreeSvg = d3.select("#binarysearchtreesvg");
const insertnodebtn = document.getElementById("insertintree");
const binrect = binarySearchTreeSvg
.append("rect")
.attr("width", 700)
.attr("height", 400)
.attr("fill", "yellow");
// binarySearchTreeSvg.append('rect').attr('width',60).attr('height'... | true |
fdebc228ea9e7b994bef7c1da50e8d742cb29f2a | JavaScript | nicolasperuch/cloud-native-studies | /JavaScript-land/basics/constructor-vs-factory.js | UTF-8 | 416 | 4.15625 | 4 | [] | no_license | //Factory
var createPerson = function (name, age) {
return {
name: name,
age: age
}
}
console.log(createPerson("Saul", 42))
console.log(createPerson("Annie", 23))
//Constructor
var OtherWayToCreatePerson = function (name, age){
this.name = name;
this.age = age;
}
console.log(n... | true |
c2ebf93eb59986dfceb360d796b883c5610fbb43 | JavaScript | YoungKyoChoi/study | /javascript/ch07/index.js | UTF-8 | 768 | 4.125 | 4 | [] | no_license | // 오브젝트 - 배열 비교
// number, str, array(object) , boolean, object, null
let soccer = {
name:"축구",
count:11,
need:"공"
}
let people = {
name: "cos",
phone: "01022227777",
address: "busan",
age: 50,
hobby:["농구",soccer,"음악"]
}
console.log(people);
console.log(people.hobby[2]);
console.lo... | true |
17dde83e8564d750ad9aa073ed298caaf7581ca5 | JavaScript | jiangshanmeta/meta | /src/1041.robot-bounded-in-circle.1119/solution.js | UTF-8 | 912 | 3.296875 | 3 | [
"MIT"
] | permissive | /**
* @param {string} instructions
* @return {boolean}
*/
// 走一遍 如果最终在原点或者方向改变了的 满足
var isRobotBounded = function (instructions) {
let direction = 0;
let x = 0;
let y = 0;
for (let i = 0; i < instructions.length; i++) {
if (instructions[i] === 'G') {
if (direction === 0) {
... | true |
8149cefc18e5845358292c3fbf912a2f70df4d0c | JavaScript | shirlySchwartz-coder/coins-onepage16 | /scripts/modal.js | UTF-8 | 2,462 | 2.640625 | 3 | [] | no_license | function createModal(array, checkbox) {
//let content="";
let temp = "";
var cancel_arr = [];
$(checkbox).prop("checked", !$(checkbox).prop("checked"));
let div_modal = $(
`<div class="modal" tabindex="-1" role="dialog" id="modalwindow"></div>`
);
let modal_dialog = $(`<div class="modal-dialog" role="... | true |
5dbae125729e28a60f81de1d3b43ac535a33c8e1 | JavaScript | zorino93/FormationPierrefitte | /html-css/javascript/jquery/js/jquery1.js | UTF-8 | 831 | 2.625 | 3 | [] | no_license | // $(document).ready(function () {
// $('.maDivSelect').addClass('highlighted');
// });
$(document).ready(function () {
$('#selected-div > li').addClass('horizontal');
// selectionne uniquement les enfants directs de l'élément.
$('#selected-div li:not(.horizontal)').addClass('sub-level');
// Ajout... | true |
86abb004ba97a5ba9267fcdcc40e3120c62a273f | JavaScript | andmeek/sudoku | /src/database.js | UTF-8 | 1,470 | 2.546875 | 3 | [] | no_license | export default class Database {
static async setup () {
return new Promise((resolve, reject) => {
if (!indexedDB) {
reject(new Error('Indexed DB is not supported'))
return
}
const request = indexedDB.open('sudoku', 1)
request.onupgradeneeded = function () {
const ... | true |
76cb6d172c8119b5c62d1aff03fc61219e71c861 | JavaScript | ZhangJinshan2233/vaucal-test | /client/src/components/users/NewUserForm.js | UTF-8 | 3,115 | 2.578125 | 3 | [] | no_license | import Card from '../card/Card'
import classes from './NewUserForm.module.css';
import Axios from "axios";
import React, { useRef, useState } from 'react';
import { useHistory, useRouteMatch } from 'react-router-dom';
const NewUserForm = (props) => {
const history = useHistory();
const match = useRouteMatch();
... | true |
53748184ec94932ee1cab1183350cc14fe333bda | JavaScript | pingchongqing/weshop | /src/assets/js/config/saveHistory.js | UTF-8 | 537 | 2.6875 | 3 | [] | no_license | export default function saveBrowseHistory(historyData) {
if(localStorage.CabBrowseHistory) {
let BrowseHistory = JSON.parse(localStorage.CabBrowseHistory)
BrowseHistory = BrowseHistory.filter(data=>JSON.stringify(data) !== JSON.stringify(historyData))
if (BrowseHistory.length>=5) {
BrowseHistory.pop... | true |
56640a340b39ff360a50b8aeadb23dc7595000ab | JavaScript | pestobaimon/a-or-b | /src/components/elements/Input/Input.js | UTF-8 | 1,227 | 2.6875 | 3 | [] | no_license | import React, { useState } from "react";
import styles from "./Input.module.css";
const Input = ({ input, setInput, submitAction, placeholder }) => {
const [rowCount, setRowCount] = useState(1);
const minRows = 1;
const handleInputChange = (event) => {
const textareaLineHeight = 18;
const p... | true |
0533dca13158e1ac207dd4764ed2f700492be118 | JavaScript | shinglunwong/Canvas | /assets/js/drawing-line.js | UTF-8 | 1,712 | 2.890625 | 3 | [] | no_license | class DrawingLine extends PaintFunction {
constructor(contextReal, contextDraft) {
super();
this.contextReal = contextReal;
this.contextDraft = contextDraft;
this.x = [];
this.y = [];
this.drawingX = '';
this.drawingY = '';
}
onClick(coord, e... | true |
e3e5ff47a9f441c1e5b140b0bf6c77591261b160 | JavaScript | samssi/mysite-ui | /src/components/cv/PersonalInformation.jsx | UTF-8 | 2,079 | 2.609375 | 3 | [] | no_license | import React from "react";
import * as axiosFactory from "../factory/axiosFactory";
const axios = axiosFactory.createAxiosContentRestClient();
const personalInformation = {
color: "white",
paddingTop: "10px",
paddingBottom: "10px"
};
const personalInfoField = {
display: "block"
};
class PersonalInfor... | true |
3274b345e1f57cde1e556a93fb233d9044e8755c | JavaScript | bbhye1/daily-coding-dojo | /Level1/add-divisor.js | UTF-8 | 611 | 3.921875 | 4 | [] | no_license | // 입력받은 정수의 약수의 합을 구해라
// 내 풀이 : while문을 이용한 풀이
function solution(n) {
var answer = 0;
var i = 1;
while(i <= n ){
if (n%i === 0){
answer += i;
}
i++;
}
return answer;
}
// 많은 추천을 받은 풀이 : 재귀를 통한 결과도출
// , 약수는 최대 그 수의 1/2를 넘지 않는 다는 점을 활용해 거기까지만 반복하고
// 다음은 재귀... | true |
26d26b8c87d0bb950557d6de8c10c58430da5777 | JavaScript | psalaets/pie-slice | /lib/slice.js | UTF-8 | 296 | 2.828125 | 3 | [
"MIT"
] | permissive | module.exports = createSlice
var sliceMethods = {
contains: function(angle) {
return this.min <= angle && angle < this.max
}
}
function createSlice(number, min, max) {
var slice = Object.create(sliceMethods)
slice.min = min
slice.max = max
slice.number = number
return slice
} | true |
702b0bbc68606e767ed0cbd5813a08ac600ab1f5 | JavaScript | IDMNYU/DM-UY1133-A_CreativeCodingFA15 | /Class3/03drunk2/sketch.js | UTF-8 | 1,553 | 3.375 | 3 | [] | no_license | // groovy
// at the top of the sketch
var r, g, b, x1, y1, x2, y2; // GLOBAL variables
function setup() {
createCanvas(800, 600); // sets up the size of the canvas
background(0, 0, 0);
x1 = width/2;
y1 = height/2;
}
function draw() {
// this fades out the previous stuff
noStroke();
fill(0, 0, 0,... | true |
490f961d96f68305e4f8cd3e4f7da54043b4d2c5 | JavaScript | ericrius1/Hifi-Scripts | /eric/scripts/turnAnimation.js | UTF-8 | 1,808 | 2.640625 | 3 | [] | no_license | var rightTurnAnimation = "https://hifi-public.s3.amazonaws.com/ozan/support/FightClubBotTest1/Animations/right_turn.fbx"
var leftTurnAnimation = "https://hifi-public.s3.amazonaws.com/ozan/support/FightClubBotTest1/Animations/left_turn.fbx"
var idleAnimation = "https://hifi-public.s3.amazonaws.com/ozan/support/FightClub... | true |
e6fcd596afd3a1073eff284c11e4f17f5a91157d | JavaScript | nevehallon/mws-restaurant-stage-1 | /sw.js | UTF-8 | 2,275 | 2.8125 | 3 | [] | no_license | let cacheWhitelist = ['cache-and-update-v1'];
let CACHE = cacheWhitelist[0];
/* Cache static assets on install */
self.addEventListener('install', function(evt) {
console.log('The service worker is being installed.');
evt.waitUntil(precache());
});
/* On activation, delete any deprecated caches */
self.addEventLi... | true |
f2dbfc16b448ac327ecdb0a4fc6a11aa64f38280 | JavaScript | kevin-rph-lee/Tourney-Watch | /public/scripts/tournament_setup.js | UTF-8 | 3,204 | 2.53125 | 3 | [] | no_license |
$(document).ready(function () {
console.log('JS is running')
// Will function for when a tournament has not started, or
// if a person drops out after a tournament has started
function renderPlayerCount(playerRoster) {
// console.log('Roster: ',playerRoster);
const playerNames = playerRoster.undefined;... | true |
163c581f83461c7fdc614e369e9659585eef0e69 | JavaScript | IntiDev/sprint1 | /js/app.js | UTF-8 | 5,171 | 3.859375 | 4 | [] | no_license | var estudiantes = [];
function obtenerListaEstudiantes() {
// TO CHECK: Retornar la lista de estudiantes
return estudiantes;// regresa el arreglo que contiene los estudiantes
}
function agregarEstudiante() {
// TO CHECK: Preguntar al usuario por el nombre, puntos técnicos y puntos de HSE de un estudiante... | true |
74e42094bce994537252574ff550b039620b66ba | JavaScript | ankerpeet/RockPaperScissors | /app.js | UTF-8 | 2,424 | 4.0625 | 4 | [] | no_license | function play(userInput) {
//Variables
var playerChoice = userInput;
var computerChoice = '';
var output = ''
var userScore = document.getElementById("you").innerHTML;
var compScore = document.getElementById("comp").innerHTML;
userScore = parseFloat(userScore);
compScore = parseFloat(com... | true |
9da28b969cc9c774486dee82133a752f27717509 | JavaScript | mkytkajr65/roommate-finder | /js/editButton.js | UTF-8 | 5,887 | 2.75 | 3 | [] | no_license | $(document).on('click', '.editButton' ,function(){
var qTextNode = $(this).parent().parent().find(".questionText > p");
var qText = $.trim(qTextNode.text());
qTextNode.empty();
qTextNode.append("<textarea rows='3'>"+ qText +"</textarea>");
var qType = $(this).parent().parent().find(".questionType small");
var qTy... | true |
14398eb5c50ab848416a4e1850c953c1532c579d | JavaScript | Acetinko/SoftUni-1 | /JS-Advanced/09.ADVANCED_FUNCTIONS_EXERCISE/03.FunctionalSum.js | UTF-8 | 257 | 3.28125 | 3 | [] | no_license | let add = (function () {
let sum = 0;
return function addValue(number) {
sum += number;
addValue.toString = () => sum;
return addValue;
}
})();
console.log(add(1).toString());
console.log(add(1)(6)(-3).toString());
| true |
f7bf3c952e6ed8fc79390a4098200d6ecb2cc88b | JavaScript | lpmi-13/study-lenses-1 | /static/ask/component/ask-me.js | UTF-8 | 5,842 | 2.53125 | 3 | [
"MIT"
] | permissive | import { ask } from "../ask.js";
import { askMeGuide } from "../ask-me-guide.js";
window.Array.prototype.poop = window.Array.prototype.pop;
window.addEventListener("DOMContentLoaded", () => {
class TraceIt extends HTMLElement {
connectedCallback() {
const shadow = this.attachShadow({ mode: "open" });
... | true |
4cbb57f1a1afb30c2de94abb52e7e6626f2fae0f | JavaScript | buggyj/tw5-other | /xplugins/bj/smarkdown/wrapper.js | UTF-8 | 2,983 | 2.703125 | 3 | [] | no_license | /*\
title: $:/plugins/tiddlywiki/smarkdown/wrapper.js
type: application/javascript
module-type: parser
Wraps up the markdown-js parser for use in TiddlyWiki5
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
var SimpleMarkdown = require("$:/plugins/tiddlywiki/smarkdown/simp... | true |
62cbf568ab912005bdd5d6588d369acd358b2445 | JavaScript | Dawnabelle/Galactic-Slide | /src/earthling.js | UTF-8 | 2,318 | 3.703125 | 4 | [
"MIT"
] | permissive | class Earthling {
// creates birthdate constructor
constructor(birthdate, lifeExpectancy){
this.birthdate = birthdate;
this.lifeExpectancy = lifeExpectancy;
}
// calculates age in seconds
ageInSeconds(){
// date.now() calls the current date to the millasecond
let now = Date.now();
// getTime(... | true |
970a2515a3236a463354b13f8c3fbf0e4f34f315 | JavaScript | yuriolive/crisp-diana | /dist/crisp-diana.js | UTF-8 | 3,329 | 2.5625 | 3 | [] | no_license | // This callback gets executed once $crisp is fully loaded and all methods (not only $crisp.push()) are available
window.CRISP_READY_TRIGGER = function() {
var lsActive = false;
var audio = new Howl({
src: ['https://client.crisp.chat/static/sounds/events/chat-message-receive.oga?be3c3d3']
});
Bounceback.init(); ... | true |
60c2b788f00c6efd1fb867663c6e6c2cc2b5410d | JavaScript | martintembo1/sketch | /admin/auth.js | UTF-8 | 5,021 | 2.6875 | 3 | [] | no_license | const Admin = require('./models');
const Crypto = require('./utils');
const verify = require('./setup')[1];
const db = require('./setup')[0];
let keys = {
"key": "f6dc105326e037a4e1c4f7da6b7752594b99ac6647ccff4154f2abffdfc5f206"
}
let crypto = new Crypto(keys.key);
//console.log(crypto.encrypt('myemail@example.com'))... | true |
4000a163ce6f8820279385c11a5db036d6fb6e31 | JavaScript | byrgazov/nevow | /nevow/js/Divmod/UnitTest.js | UTF-8 | 16,761 | 2.71875 | 3 | [
"MIT"
] | permissive | // -*- test-case-name: nevow.test.test_javascript -*-
/**
* JavaScript unit testing framework, modeled on xUnit.
*/
// import Divmod
// import Divmod.Inspect
// import Divmod.Runtime
/**
* Return a suite which contains every test defined in C{testClass}. Assumes
* that if a method name starts with C{test_}, th... | true |
36b543aac8ea1995133607b9f9a9da866b493a24 | JavaScript | polio14bmw/Teclado-Pablo-Carrascal | /Assets/js/Teclado.js | UTF-8 | 8,940 | 3.09375 | 3 | [] | no_license |
let casillaLet = document.getElementById("casillaLet")
/* Numeros */
let btnNum1 = document.getElementById("btnNum1")
let btnNum2 = document.getElementById("btnNum2");
let btnNum3 = document.getElementById("btnNum3");
let btnNum4 = document.getElementById("btnNum4");
let btnNum5 = document.getElementById("btnNum5");
l... | true |
88d868425cebef4035b3a225e3611d4f86b095e1 | JavaScript | AtomicLlama/Aeolus | /util/getMethods.js | UTF-8 | 1,274 | 2.5625 | 3 | [
"MIT"
] | permissive | var fs = require('fs');
var path = require('path');
function resourcesForDir(dir,pathToMethods) {
var directoryPath = path.join(process.cwd(), pathToMethods + "/" + dir);
var items = fs.readdirSync(directoryPath).filter(function(file) {
var fileComponents = file.split(".");
var extension = fileComponents[f... | true |
5b64a33a86170553c5903ec931eb97c69d45fe5c | JavaScript | rice-apps/scheduleplanner | /src/main/resources/org/riceapps/scheduleplanner/assets/frontend/org/riceapps/views/view.js | UTF-8 | 5,483 | 2.578125 | 3 | [] | no_license | /**
* Provides a generic implementation of a View.
* All other views should inherit from this class.
*/
goog.provide('org.riceapps.views.View');
goog.require('goog.events.BrowserEvent');
goog.require('goog.events.EventHandler');
goog.require('goog.events.EventType');
goog.require('goog.style');
goog.require('goog.... | true |
e00b4096a1fae288550bf1c1f0268e20f969d650 | JavaScript | xpandion/opentok.js-text-chat | /src/ChatUI.js | UTF-8 | 11,340 | 2.640625 | 3 | [
"MIT"
] | permissive | define(['ChatMessage'], function (ChatMessage) {
'use strict';
var uiLayout = [
'<div class="ot-bubbles">',
'</div>',
'<div class="ot-input">',
' <div>',
' <p class="ot-error-zone" hidden>Error sending the message!</p>',
' <p class="ot-new-messages" hidden>▾ New messages</p>',
... | true |
e1997ed2355ca55ea0765ae1d3575378d75a44c4 | JavaScript | Mango-111/Form-Validation- | /validation.js | UTF-8 | 3,562 | 3.375 | 3 | [] | no_license | function seterror(id, error)
{
element = document.getElementById(id);
element.getElementsByClassName('formerror').innerHTML = error;
}
function validate()
{
/* validation for phone number*/
var returnval= true;
var Mobile = document.getElementById("mobno").value;
var regx = /^([0-9\.-]){10}$/... | true |
5ecaaf4af4cadbeb5acf963bd8b32017747cb848 | JavaScript | navsingh29/cs319team4 | /log.js | UTF-8 | 1,735 | 2.625 | 3 | [] | no_license | var http = require('http');
var client = 'ios';
var user = process.argv[2] || 'admin';
var domain = process.argv[3] || 'testDomainT4';
var url = 'http://btdemo.plurilock.com:8090/api/users/' + client + '_' + user + '_' + domain;
console.log("Querying url:", url);
var packetCount = 0;
var RESET = "\033[0m";
var RE... | true |
2dedac142407003d667ba7e3f3911f26c66d4420 | JavaScript | DSM12/funnymoney | /client/src/components/Modal/index.js | UTF-8 | 4,301 | 2.546875 | 3 | [] | no_license | import React, { Component } from "react";
import API from "../../utils/API";
class Modal extends Component {
state = {
FullName: "",
UserName: "",
Phone: "",
Email: "",
Password: ""
};
handleInputChange = event => {
const { name, value } = event.target;
this.setState({
[name]... | true |
f7180b1c5e8af8959483e97ff9a86fb4013d70e1 | JavaScript | GiantPandaZoo/PandaWeb | /src/utils/baseUtil.js | UTF-8 | 1,174 | 2.84375 | 3 | [] | no_license | import {upperFirst} from 'lodash-es';
export function getCookie(name) {
const reg = new RegExp(`(^| )${name}=([^;]*)(;|$)`);
const arr = document.cookie.match(reg);
if (arr) {
return unescape(arr[2]);
}
return null;
}
export function addPrefix(str, prefix = 'btn') {
const arr = upperFi... | true |
d79acef13ed5b5ae9af1aee3981f12ac5bf591f1 | JavaScript | DashYang/CollabrativeItineraryPlanningPlatform | /WebContent/js/calendar.js | UTF-8 | 3,891 | 2.75 | 3 | [] | no_license | function getUrlParam(name){
//构造一个含有目标参数的正则表达式对象
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
//匹配目标参数
var r = window.location.search.substr(1).match(reg);
//返回参数值
if (r!=null) return unescape(r[2]);
return null;
}
var username = "";
var groupId = "";
var groupName = "";
//验证用户身份
function checkUserIden... | true |
8e39e2a36f9f4a5fcbca10b15474ea8b5d0239c9 | JavaScript | rubossq/cordova-angularjs-electronjs | /js/main/common/Response.js | UTF-8 | 894 | 2.75 | 3 | [] | no_license | var Response = Base.extend({
action: null,
status: null,
message: null,
object: null,
constructor: function(action, status, message, object){
this.action = action;
this.status = status;
this.message = message;
this.object = object;
},
/* get and set Response.action */
setAction: functi... | true |
f6ad1e0f9237abf2be42272823ee382cc4bb7d96 | JavaScript | iarmankhan/Zypac-News | /store/News/News.action.js | UTF-8 | 961 | 2.65625 | 3 | [] | no_license | import News from "../../models/News";
export const SET_NEWS = 'SET_NEWS';
export const fetchNews = (id) => {
if(id === undefined) id = 1;
return async dispatch => {
try {
const response = await fetch(`https://zypacinfotech.com/app/wp-json/wp/v2/posts?embed&categories=${id}`);
... | true |
a8e99921a249630f907fce40b1efb8c9e9a5b724 | JavaScript | proximax-storage/tsjs-xpx-stream-sdk | /examples/chat/client/index.js | UTF-8 | 3,244 | 2.9375 | 3 | [
"Apache-2.0"
] | permissive |
let socket = io.connect('http://localhost:3000/');
let logged_in = false;
let chat_mate = null;
function appendToMessage(message) {
var node = document.createElement("p");
var textnode = document.createTextNode(message);
node.appendChild(textnode);
let chatroom = document.getElementById("chatroom");
... | true |
4f727963eb0408d0f84c49abf36461f730912ada | JavaScript | GargPrince/authentication-passport | /app/models/user.js | UTF-8 | 1,400 | 2.59375 | 3 | [] | no_license | var mongoose=require('mongoose');
var bcrypt= require('bcrypt-nodejs');
var schema=mongoose.Schema;
//Make schema
var userSchema= new schema({
local : {
fname: String,
dob: String,
email: String,
country: String,
contact: {
phone: String,
alter... | true |
434f4ec01e4b8729e11cc7cd5b9f9b6010960109 | JavaScript | sandrusmb/Clock | /main.js | UTF-8 | 832 | 3.609375 | 4 | [] | no_license | "use strict";
const secondsHand = document.querySelector(".seconds");
const minutesHand = document.querySelector(".minutes");
const hoursHand = document.querySelector(".hours");
//segundos
function setDate() {
const now = new Date();
const seconds = now.getSeconds();
const secondsDegrees = (seconds / 60) * 36... | true |
2469834bb90e0b88aad29354156f8faf4f3cfe10 | JavaScript | cesar-rodriguez92/PHPSistemasUNIClass | /PHP1/Clase4/js/script2.js | UTF-8 | 762 | 2.75 | 3 | [] | no_license | $(document).ready(function(){
$("#formulario").submit(function(){
error= false
mensaje=''
nombre=$("#c1").val()
if(nombre==''){
error=true
mensaje="Debe agregar su nombre"
}else{
mensaje=''
}
$("#e1").html(mensaje)
nombre=$("#c2").val()
if(nombre==''){
error=true
mensaje="Debe agrega... | true |
0e106158daf186dc1cf04bbfe532ae0eea280485 | JavaScript | clickwithclark/hipstapas | /modules/wordlistLarge.js | UTF-8 | 326,706 | 2.71875 | 3 | [
"MIT"
] | permissive | /**
* EFF large wordlist https://www.eff.org/de/deeplinks/2016/07/new-wordlists-random-passphrases
*/
let wordlistLargeMap = new Map();
wordlistLargeMap.set('11111', 'abacus');
wordlistLargeMap.set('11112', 'abdomen');
wordlistLargeMap.set('11113', 'abdominal');
wordlistLargeMap.set('11114', 'abide');
wordlistLargeM... | true |
e32889ebe71f7b2f4aae820c0a26fc1f6fffaaae | JavaScript | DrewKnorr/capstone | /src/components/auth/sign-up/sign-up-form.js | UTF-8 | 3,609 | 2.5625 | 3 | [
"MIT"
] | permissive | import React, { Component } from "react";
import { Redirect } from 'react-router-dom'
export default class SignUp extends Component {
constructor(props) {
super(props);
this.state = {
username: "",
password: "",
password_verify: "",
fname:"",
lname:"",
email:"",
er... | true |
1efd4bf4e96b10e7500999a1f944e910d3c84231 | JavaScript | Aaryadeva/pro36 | /Virtual-Pet--1-master/sketch.js | UTF-8 | 2,667 | 3.375 | 3 | [] | no_license | //Create variables here
var dog,happyDog,database,foodS,foodStock,dogImg,happyDogImg
var feedButton,addButton
var foodObj
var feedTime
var lastFed
var bedroomImg,washroomImg,gardenImg
var bedroom,washroom,garden
var readState
var currentTime
var gameState="Hungry"
function preload()
{
//load images here
dogImg=load... | true |
bae68136eb0b62baccf9ff7db2376b92da78db0c | JavaScript | AnnieKuoChia/JS_w2_api | /w2HW.js | UTF-8 | 2,813 | 2.71875 | 3 | [] | no_license |
document.querySelector('#get').addEventListener('click', getData);
document.querySelector('#post').addEventListener('click', postData);
document.querySelector('#patch').addEventListener('click', patchData);
document.querySelector('#delete').addEventListener('click', deleteData);
var uuid = '903b70bd-963b-4a81-9421-23... | true |
8d24ce4bcc61072957853a82ec3d9e9fcb0f6acb | JavaScript | leportlabs/maxharris9-datepicker | /simple-date.js | UTF-8 | 2,359 | 3.109375 | 3 | [
"MIT"
] | permissive | // TODO: write unit tests
SimpleDate = (function () {
"use strict";
return function (day, month, year, guid) {
var _clamp = function (number, min, max) {
return Math.min(Math.max(number, min), max);
};
var _clampDay = function (day) {
return _clamp(day, 1, 365);
};
var _clampMonth = function (month) ... | true |
f6054382cc2a763d1a53e2fb865ded002d8637f5 | JavaScript | goldenbelle/nomfilx | /REACTPRACTICE/e6_useBeforeLeave.js | UTF-8 | 1,357 | 3.28125 | 3 | [] | no_license | import React, { useEffect, useState } from "react";
import ReactDOM from "react-dom";
// useBeforeLeave : window 떠나기 전에 실행됨. 예를들어 마우스가 윈도우 벗어나면 실행.
const useBeforeLeave = (onBefore) => {
if (typeof onBefore !== "function") {
return;
}
const handle = (event) => {
// 마우스가 위로 갔을때만 함수 실행
const { cl... | true |
b5e30c79a377ddc210b20c2b006d826255036b5c | JavaScript | pash0107/sysdes-voting-system | /js/user.js | UTF-8 | 1,721 | 2.734375 | 3 | [] | no_license | function logout()
{
localStorage.removeItem("logged");
localStorage.removeItem("candid");
localStorage.removeItem("em");
localStorage.removeItem("fn");
localStorage.removeItem("ln");
localStorage.removeItem("mn");
localStorage.removeItem("sex");
localStorage.removeItem("age");
localStorage.removeItem("stat");
... | true |
fac078c45903022e4481e0d1dc4ba739ba0325b6 | JavaScript | Ad-mob-dev/javaScript38-67 | /chp 38-42/task4/app.js | UTF-8 | 616 | 3.453125 | 3 | [] | no_license | function main() {
var sub1 = +prompt("Enter Marks for Subject 1");
var sub2 = +prompt("Enter Marks for Subject 2");
var sub3 = +prompt("Enter Marks for Subject 3");
document.write("<h1>Student Marks</h1>");
document.write("---Subject 1: "+sub1+"<br>");
document.write("---Subject 2: "+sub2+"<br>");
docu... | true |
b5d7a9a6579e73c667028f8fda3a4d2d7798ed48 | JavaScript | nergalyang/freelog-auth-provider | /app/contract-service/contract-fsm.js | UTF-8 | 2,275 | 2.65625 | 3 | [] | no_license | /**
* Created by yuliang on 2017/9/1.
*/
'use strict'
const StateMachine = require('javascript-state-machine')
/**
* 自动根据合同信息生成合同状态机
*/
module.exports.getContractFsm = (contractInfo, events) => {
return new StateMachine({
/**
* 初始化合同当前状态
*/
init: contractInfo.fsmState,
... | true |
acb382b25105bb9e71ebad9e66dbcfbd1c64f165 | JavaScript | kubilayzdemir/JavaScriptApps | /QuizApp/app.js | UTF-8 | 2,301 | 3.984375 | 4 | [] | no_license | // create question prototype
function Question(text,choices,answer) {
this.text = text;
this.choices = choices;
this.answer = answer;
}
// question prototype
// check answer
Question.prototype.checkAnswer = function(reply){
return this.answer === reply;
}
// create quiz constructor
function Quiz(quest... | true |
4bab662270bf92db3661d795710828828b485812 | JavaScript | shraddhahinge/Hunger-bounce1 | /src/Pages/SearchPage/SearchPage.js | UTF-8 | 2,573 | 2.515625 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import "./SearchPage.css";
import SearchIcon from "@material-ui/icons/Search";
import RestaurantItems from "./../RestaurantItems/RestaurantItems";
function SearchPage(props) {
const [inputSearch, setInputSearch] = useState("");
const [searchedRestaurantArray, set... | true |
4e40dbccafad5510e35f31406e9169fe12f28839 | JavaScript | Tasheem/bankingapp-client | /scripts/update-user/password.js | UTF-8 | 2,196 | 2.890625 | 3 | [] | no_license | document.getElementById('button-sub').addEventListener(
'click', sendPUT
)
document.addEventListener('keydown', catchEnter)
function catchEnter(event) {
if(event.key === 'Enter')
sendPUT();
}
function sendPUT() {
let username = document.getElementById('username').value;
let password = documen... | true |
9ad9c721062697038fc4417a7728123857411be6 | JavaScript | oierbravo/now-mongo-tools | /maps/ClassNumberMaps.js | UTF-8 | 1,537 | 3.046875 | 3 | [] | no_license |
export const Directions = {
OPEN: 'Open',
CLOSE: 'Close'
}
class NumberMaps {
constructor(map) {
this.map = map;
}
getAlternative(note){
if(note === undefined ){
return false;
}
var current = this.map.find((el)=>el.Number === note.data.number);
var currentNote = cu... | true |
2a98cb1f67ae46d8521dbb59cb4e91c3ce72cc6d | JavaScript | amklose/clickawiki | /app/scripts/factories/method.factory.js | UTF-8 | 825 | 2.640625 | 3 | [] | no_license | (function() {
angular.module("clickawiki").factory("methodFactory", methodFactory);
methodFactory.$inject = [];
function methodFactory() {
return {
addMethod: addMethod,
removeMethod: removeMethod,
updateMethod: updateMethod
};
function addMethod... | true |
af69eadca7159b59cfb9249a87a3e1ec30702d70 | JavaScript | oscarpolanco/react-testing | /section_1_to_xx/section_1_introduction/__tests__/item-list.todo.js | UTF-8 | 1,648 | 4.03125 | 4 | [] | no_license | // Your job:
// Test the case where the items provided is empty:
// <ItemList items={[]} />
// Test the case where there are items in the list:
// <ItemList items={['apple', 'orange', 'pear']} />
//
// Don't overthink it. This is just a practice run to warm you up
// to testing react components.
// So you can use ... | true |
3788fb349e964e238a38eb18f5de971f0e3c69d1 | JavaScript | alehap664/angularjs | /Components/indexComponent/movieController.js | UTF-8 | 873 | 2.609375 | 3 | [] | no_license | App.component("movie",{
templateUrl: "./Components/indexComponent/movieComponent.html",
controller: function () {
// Add JavaScripts
MovieController()
// console.log("Movie Rendered!");
}
})
function MovieController() {
// Tab-active-phim
let tabsMovie = $$(".tab__wrapper[role='tab-movies']>butto... | true |
26d49fd08d1681a4f5c5a8c63d672afcd576e189 | JavaScript | kimdaeki-project/2020_1_M_Doomfist | /src/main/webapp/resources/boardForm2.js | UTF-8 | 3,227 | 2.71875 | 3 | [] | no_license | /**
*
*/
var count = 1;
function setCount(c) {
count = count + c;
}
$("#file").on("click", ".remove", function() {
$(this).parent().remove();
count--;
});
$("#add")
.click(
function() {
if (count < 6) {
$("#file")
.append(
'<div class="form-group"> <label for="file"> File :<... | true |
d3ae904a220ba829fc088ba4faed2d2b107faa56 | JavaScript | bambamayo/github-repo-page-clone | /src/scripts/helpers.js | UTF-8 | 208 | 2.671875 | 3 | [] | no_license | export function setRepoUpdateTime(isoString) {
let date = new Date(isoString);
let dateToDateStringArr = date.toDateString().split(" ");
return `${dateToDateStringArr[1]} ${dateToDateStringArr[2]}`;
}
| true |
4908e06a70d8ca7088d44669cf231152dd9830c6 | JavaScript | harishviru/ReactJS | /react_hook/src/customHook/HCounterOne.js | UTF-8 | 675 | 2.65625 | 3 | [] | no_license | import React,{useState} from 'react'
import useCounter from './useCounter'
function HCounterOne() {
// const [count, setCount] = useState(0)
// const increment =()=>{
// setCount(prevState=>prevState+1)
// }
// const decrement=()=>{
// setCount(prevState=>prevState-1)
// }
// const reset=()=>{
// ... | true |
a92940a494b977dce0304a0203f6eafe9beaa00f | JavaScript | xzp-git/JS | /md/1.js | UTF-8 | 2,335 | 3.375 | 3 | [] | no_license | let submit = document.querySelector("#submit")
//模拟从服务器获取数据(需要1000ms)
const queryData = callback => {
setTimeout(function(){
// callback('OK')
console.log('ok')
},1000)
}
/*
debounce:函数防抖
@params
func:自己最终要执行的任务
wait:多久操作一次算是频繁触发[默认值:500ms]
immediate:控制触发的边界[默认值:false结束边界 true开始边界]
@re... | true |
b13f8b9075f94bced2f1929c3f6761db1318f2bd | JavaScript | JoaoMosmann/mospa | /specs/js/EventHandlerSpec.js | UTF-8 | 5,643 | 3.234375 | 3 | [] | no_license | describe("A mospa.EventHandler", function() {
var object;
beforeEach(function () {
object = new mospa.EventHandler();
});
it("should be able to BIND a function to a event", function() {
object.bind('some_event', function () {
});
});
it("should be able to TRIGGER a event", function() ... | true |
94c93c2ddbe4d0429b9e4fd8d7edb0b44b0d692a | JavaScript | djamey87/will-do-client | /src/reducers/tasks.js | UTF-8 | 1,115 | 2.921875 | 3 | [] | no_license | // import _ from 'lodash';
import { CREATE_TASK, FETCH_TASKS, DELETE_TASK } from '../constants/task';
import { LOGOUT } from '../constants/auth';
const defaultState = {
allTasks: [],
};
export default (state = defaultState, action) => {
switch (action.type) {
case LOGOUT:
return defaultState;
case FETCH_TAS... | true |
9a0f7420b4953caca2c7cb06973bdf3943cee8b8 | JavaScript | Actonate/lokka | /lib/__tests__/cache.js | UTF-8 | 8,010 | 2.515625 | 3 | [
"MIT"
] | permissive | import {describe, it} from 'mocha';
import {expect} from 'chai';
import Cache from '../cache';
describe('GraphQL Cache', () => {
describe('.clone()', () => {
it('should clone a given payload', () => {
const c = new Cache();
const data = {aa: 10, bb: [ 10 ]};
const clonedData = c._clone(data);
... | true |
0b3e2864783695370681e48b0778b5a76d86cbeb | JavaScript | ahmadaussaili/PortalOS | /labchecker.js | UTF-8 | 3,064 | 3.09375 | 3 | [] | no_license | const db = require("./db.js");
module.exports.checkLab = (date, lab, time) => {
return new Promise((resolve, reject) => {
dateFormat = new Date(date);
week = getWeek(dateFormat);
day = dateFormat.getDay(); // Returns the day of the week from 0 to 6.
console.log("From backend checkLab");
console.log(week, day,... | true |
c9487c3951447fb3c3a12df5978e717c3e0f3b9e | JavaScript | pumzy/GrabJS | /lib/dom_node_collection.js | UTF-8 | 3,265 | 3.09375 | 3 | [] | no_license | class DOMNodeCollection{
constructor(elements){
debugger
this.elements = elements;
}
each(callback){
this.elements.forEach(callback)
}
html(str){
if(!str){
return this.elements[0].innerHTML;
} else {
for (let i = 0; i < this.elements.length; i++) {
this.elements[i].i... | true |
79c61916dd5152ac1217a61a2c5dfbfa6ba1dcaa | JavaScript | silverjyri/laevaduputamine | /laevadepommitamine/war/ui/FieldView.js | UTF-8 | 7,900 | 2.75 | 3 | [] | no_license | // View component for the Field model
function FieldView(field, options) {
this.field = field;
if (options) {
this.id = options.id;
this.onMouseDown = options.onMouseDown;
this.onDrop = options.onDrop;
this.scope = options.scope;
this.status = options.status;
this.playerName = options.playerName;... | true |
20535f1e9456b10868b6f060824e9353ffdc6e2c | JavaScript | Parvfect/Express | /database.js | UTF-8 | 2,148 | 2.6875 | 3 | [] | no_license |
const http = require('http');
const url = 'mongodb+srv://parvfect:raingryph456@cluster0.xzipi.mongodb.net/Berd?retryWrites=true&w=majority';
//Import the mongoose module
var mongoose = require('mongoose');
var MongoClient = require('mongodb').MongoClient;
var str = "";
function main(){
mongoose.connect(... | true |
1624a77797e859400ea6f91fdc77e2c973e4632e | JavaScript | eiancarter/React-Github-User-Card | /github-usercard-a/src/App.js | UTF-8 | 1,295 | 2.640625 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
import GitList from './components/GitList';
import GitCard from './components/GitCard';
import axios from 'axios';
class App extends Component {
constructor() {
super();
this.state = {
cards: [],
followers: []
}
console.log('c... | true |
05ced3d23f5597f55bf4c43085b47813d6d0311f | JavaScript | MrSociety404/cardealer-API | /controllers/carController.js | UTF-8 | 1,302 | 2.734375 | 3 | [] | no_license | const Car = require('../models/car')
// Getting all cars
exports.getAllCars = async (req, res) => {
try {
let car
if(req.user === null) {
car = await Car.find({},['_id','label','category','resell','speed','image'], {
sort: {resell: 'asc'}
})
} else {
car = await Car.find({}, [],... | true |
862006b4164d1e71ae0d1373f1cf64cb0ff9f980 | JavaScript | 27bslash/rubiks-cube | /algorithms/oll.js | UTF-8 | 3,739 | 2.75 | 3 | [] | no_license | let patterns = {
dot: [0, 0, 0, 0, "yellow", 0, 0, 0, 0],
line: [0, 0, 0, "yellow", "yellow", "yellow", 0, 0, 0],
L_shape: [0, 0, 0, 0, "yellow", "yellow", 0, "yellow", 0],
};
const check_yellow_pieces = (start) => {
cubelets = [];
for (let i = start; i < 9; i += 2) {
if (cube[0][i].includes("yellow") &&... | true |
d5f2f1dfd10a6ccf1ddc4792de582bb5fdf18bf2 | JavaScript | rafaelcastrobr/CourseFullStack | /JavaScript/regexp-master/aula10.js | UTF-8 | 1,278 | 2.921875 | 3 | [] | no_license | // Encontra todas as palavras
const palavrasRegEx = /([\wÀ-ú]+)/g
// Não números
const naoNumerosRegEx = /\D/g
// Valida IP
const ipRegExp = /((25[0-5]|2[0-4][0-9]|1\d{2}|[1-9]\d|\d)(\.)){3}(25[0-5]|2[0-4][0-9]|1\d{2}|[1-9]\d|\d)/g;
// Valida CPF
const cpfRegExp = /(?:\d{3}\.){2}\d{3}-\d{2}/g
// Valida telefones
co... | true |
4562144e48bbbf40b55ead0b307b1e17f3c5df26 | JavaScript | ErikaDebelis/celebrity-quiz | /js/scripts.js | UTF-8 | 347 | 2.734375 | 3 | [] | no_license | $(document).ready(function() {
$("form#quiz").submit(function(event) {
const option = $("input:radio[name=celebrity]:checked").val();
if (option === "ladies") {
$('#women').show();
} else if (option === "men") {
$('#guys').show();
} else {
$('#women').show();
$('#guys').show();
}
event.... | true |
25a8958eb6ef3e2585061bc49c4dc395f7b2bfd2 | JavaScript | The-Atul-Sharma/Javascript-functions-implementation | /Array/Find.js | UTF-8 | 254 | 3.96875 | 4 | [] | no_license | const arr = [1, 2, 3, 4, 5];
Array.prototype.myFind = function(callback) {
for (let i = 0; i < this.length; i++) {
if (callback(this[i])) {
return this[i];
}
}
}
const output = arr.myFind(a => a > 2)
console.log('Output: ', output);
| true |
fd5c6321b1bb2fe610f324d999a5c30c5bebe0b9 | JavaScript | organizer2012/TypeScript | /Seminar ECMA6/seminar_2018_12_12/typescript/dist/functions2.js | UTF-8 | 1,726 | 3.734375 | 4 | [] | no_license | "use strict";
// Mittels <T> sind weitere Parameter möglich,
// jedoch in diesem Fall ohne genauen Typ
function holIrgendwas(url) {
return fetch(url).then(function (resp) { return resp.json(); });
}
// Nun kann auf die Members des Interfaces zugegriffen werden
var datenObj = holIrgendwas('/test');
datenObj.then(fu... | true |
0e67ffd746f3ade038a00d791ca27e202d14af37 | JavaScript | teeeeeeemo/web-crawling-techniques | /HostTeemo/download_webpages/src/ch05/04-correct/correct.js | UTF-8 | 1,605 | 2.75 | 3 | [] | no_license | var MAX_WORD = 40;
var Mecab = require('/Users/Lucia/Documents/WebCrawlingTechniques/HostTeemo/download_webpages/src/ch05/02-mecab/mecab-mod.js');
var mecab = new Mecab();
var fs = require('fs');
var lineByLine = require('n-readlines');
var args = process.argv;
args.shift();
args.shift();
if(args.length <= 0 ) {
c... | true |
e7825f1322c66b8c9899248b9bb7d8ae22cd51e7 | JavaScript | joaopmsalvador/adventureTicket | /public/js/controller.js | UTF-8 | 7,285 | 2.59375 | 3 | [
"MIT"
] | permissive | // Contact Form Scripts
console.log('Inside adventureSeaker');
$(function() {
console.log('Inside function before adventureSeakerForm');
$("#adventureSeakerForm input").jqBootstrapValidation({
preventSubmit: true,
submitError: function($form, event, errors) {
// additional error mess... | true |
90cb266dc7f0f7ea57c162606220882ef6a815dd | JavaScript | edupinhata/disease-simulator | /src/person.js | UTF-8 | 3,599 | 3.578125 | 4 | [] | no_license | class Person {
constructor(position, speed, is_sick=false) {
this.position = position; // [x, y]
this.speed = speed; // [x, y]
this.health = HEALTHY;
this.time_to_recover = 0;
if (is_sick) {
this.get_sick();
}
}
// Make sure the person will be w... | true |
4cb6f7fce18a02c06835b191a0bb3fc9e35394a4 | JavaScript | CredCoder/ten-faced-die-game | /app.js | UTF-8 | 3,678 | 3.1875 | 3 | [] | no_license | var activePlayer = 0;
var die;
var gamePlaying = true;
var current = document.querySelector("#current-" + activePlayer);
var score = document.querySelector("#score-" + activePlayer);
var dieDisplay = document.querySelector(".die");
var rollBtn = document.querySelector(".btn-roll");
var saveBtn = document.querySelector(... | true |
c746eb5d25e37d34a68c10fa4948c13e3dba40bf | JavaScript | Jontyy/arch.js | /src/mediator.js | UTF-8 | 2,677 | 2.578125 | 3 | [] | no_license | (function(arch){
"use strict";
var channels = {},
validation = {},
//shortcut for throwng an error
error = function(message){
throw new Error(message);
},
subscribe = function(channel,func,context){
channels[channel] = channels[channel] || [];
channels[channel].push({
callback : func,
co... | true |
695fa0c2c576c979d7e857b78668a0e996f8d9d6 | JavaScript | natsuonna/heygirl | /heygirl.js | UTF-8 | 2,760 | 3.1875 | 3 | [] | no_license | function Gosling(ratio, imageurl) {
this.ratio = ratio;
this.imageurl = imageurl;
}
var getGosling = {
init: function(myGosling) {
this.myGosling = myGosling;
},
horizontal: function() {
return this.myGosling.filter(function(myGosling) {
return myGosling.ratio === "hori... | true |
257aa53094571e7b1dbbd15648e4a98da06f5bd4 | JavaScript | shrejal99/Web-Development-Submissions | /Arshia/Milestone-13/task1 - clock/app.js | UTF-8 | 1,205 | 3.46875 | 3 | [] | no_license |
const secondsArm = document.querySelector('.seconds-arm');
const minutesArm = document.querySelector('.minutes-arm');
const hoursArm = document.querySelector('.hours-arm');
const hand = document.querySelector('.hand');
function clockTime(){
const myTime = new Date();
const seconds = myTime.getSeconds();
... | true |
04cdb3de534e66664e933980f3cb8319a5bbb47e | JavaScript | sergeybalyoshenko/SergeyBalyoshenko.github.io | /GoIT/javascript/home/lesson7/codewars2.js | UTF-8 | 340 | 3.453125 | 3 | [] | no_license | function createSecretHolder(secret) {
return {
getSecret: function() {
return secret;
},
setSecret: function(i) {
secret = i;
}
};
}
var obj = createSecretHolder(5);
console.log( obj.getSecret() ); // returns 5
obj.setSecret(2);
console.log( obj.getSecr... | true |
cf4f6c5c8284e9da98454c1811797a601bb897a5 | JavaScript | Shadow-supreme22/MERN | /Project-6/nutritionapp/frontend/behealthy/src/components/dashboard/Foods.js | UTF-8 | 8,724 | 2.625 | 3 | [] | no_license | import React, { Component } from "react";
import url from "../../Url";
import { Link } from "react-router-dom";
export default class Foods extends Component {
constructor(props) {
super(props);
this.state = {
foods: [],
updateModal: false,
};
this.token = localStorage.getItem("authToken"... | true |
5744864c5c8a60d99d4fa2ee0c7aaf729cf84d50 | JavaScript | viclm/mgate | /ratelimiter.js | UTF-8 | 1,242 | 2.640625 | 3 | [
"MIT"
] | permissive | const debug = require('debug')('mgate:ratelimiter')
class RateLimiter {
constructor(permitsPerSecond, maxBurstSeconds = 1) {
this.permitsPerSecond = permitsPerSecond
this.stableIntervalMicros = 1000 / permitsPerSecond
this.maxPermits = permitsPerSecond * maxBurstSeconds
this.storedPermits = 0
thi... | true |
c5f164bf27989840610454186f97dfc6718bc9b5 | JavaScript | khanhhuy288/Codewars-Javascript | /makeParts.js | UTF-8 | 351 | 3.796875 | 4 | [] | no_license | function makeParts(arr, chunkSize) {
var res = [];
for (var i = 0; i < arr.length; i += chunkSize) {
res.push(arr.slice(i, i + chunkSize));
}
return res;
}
console.log(makeParts([1,2,3,4,5], 2) ); // [[1,2],[3,4],[5]]
console.log(makeParts([1,2,3], 1) ); // [[1],[2],[3]]
console.log(makeParts([1,2,3,4... | true |
6f26bd71be073ba71ded75e43b38905cd33f03c7 | JavaScript | stonecrafter/advent-of-code | /2020/5/index.js | UTF-8 | 1,622 | 3.421875 | 3 | [] | no_license | const fs = require('fs');
const inputList = fs.readFileSync(`${__dirname}/input.txt`, 'utf8').split('\n');
const seatIds = inputList.map((seat) => {
// Min and max should be equal at the end so we only need one of them
const { minRow, minCol } = seat.split('').reduce((acc, code) => {
const rowIncrement = Math... | true |