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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d9bd4c42dfe3ae682ab6eb973f02a3db1851c616 | JavaScript | louvang/todo | /src/DisplayCategory.js | UTF-8 | 3,892 | 2.765625 | 3 | [] | no_license | import editCategory from './EditCategory';
import saveDisplayedCategory from './SaveDisplayedCategory';
import addTask from './AddTask';
import displayTask from './DisplayTask';
const displayCategory = (catName, catId) => {
let displayedCategories = JSON.parse(localStorage.getItem('displayedCategories'));
const c... | true |
99a9da27acf7948d75383aad7769e4f29a7425c2 | JavaScript | School-platforme/school-field | /School/client/src/pages/Teacher/AddExercice.js | UTF-8 | 2,515 | 2.625 | 3 | [
"MIT"
] | permissive | import React, { useState, useEffect } from "react";
import Sidebar from "./components/Sidebar";
import { TextField, Button } from "@material-ui/core";
import axios from "axios";
import { Redirect } from "react-router";
function Exercice() {
const [Exercice, setExercice] = useState("");
const [Exercices, setExercic... | true |
b9f24644c0682a80a3f2627947c2c25cdcc9254a | JavaScript | billfienberg/advanced-react-rerecord | /frontend/__tests__/Item.test.js | UTF-8 | 1,428 | 2.5625 | 3 | [] | no_license | import { render } from '@testing-library/react';
import ItemComponent from '../components/Item';
const fakeItem = {
id: 'ABC123',
title: 'A Cool Item',
price: 4000,
description: 'This item is really cool!',
image: 'dog.jpg',
largeImage: 'largedog.jpg',
};
describe('<Item/>', () => {
fit('renders and mat... | true |
c33511ea566479cc681834306274f74bf2c0f02d | JavaScript | abbijamal/align | /src/js/partial/selection.js | UTF-8 | 1,121 | 2.640625 | 3 | [
"MIT"
] | permissive | export default class Selection {
/* eslint-disable */
static _current = null;
static textRange = null;
static range = null;
/* eslint-enable */
static get current () {
return Selection._current || window.getSelection();
}
static selectRange (range = Selection.textRange) {
if (!range) return;
... | true |
bf52b08a52efda7c52786e18bcf8719f1c2abc49 | JavaScript | singhgur8/subclass-dance-party | /src/nemoDancer.js | UTF-8 | 1,208 | 2.765625 | 3 | [] | no_license | var nemoDancer = function (top, left, timeBetweenSteps) {
makeDancer.call(this, top, left, timeBetweenSteps);
this.$node = $('<span class="nemoDancer"></span>');
this.setPosition(top, left);
$(document).ready(function() {
$('.nemoDancer').mouseover(function() {
$(this).fadeOut();
});
})
};
ne... | true |
db0123408d016c246b0c76e1b0964f8d77c09985 | JavaScript | andrewminai24/JavaScript-learn | /jsondata/async.js | UTF-8 | 363 | 2.71875 | 3 | [] | no_license | var spaceData;
function setup(){
createCanvas(200,200);
loadJSON("http://api.open-notify.org/astros.json",gotData,'jsonp');
}
function gotData(data){
spaceData = data;
}
function draw(){
if(spaceData){
randomSeed(4);
background(0);
stroke(255);
line(x,0,x,height);
x = x + 1;
... | true |
36931641544d1ffb46e2bd8d1aef4f646ed28f89 | JavaScript | diegob08/bernalgomez_d_videoApp | /public/javascripts/main.js | UTF-8 | 2,318 | 3.109375 | 3 | [] | no_license | (() => {
// variables always get declared at the top of the JS file
let getButtons = document.querySelectorAll('.getButton'),
postButton = document.querySelector('.postButton'),
deleteButton = document.querySelector('.deleteButton');
function fetchData() {
let url = "api/" + this.id;
fetch(url)
... | true |
ee3e759cc99de82acd81a445941573186c4d1e12 | JavaScript | ljianxiong/sa2016 | /sa2016-dev/src/main/webapp/assets/characters/canvas.js | UTF-8 | 986 | 2.578125 | 3 | [] | no_license | APP.controller('CharacterCanvasCtrl', function($scope, $state) {
$scope.pixi = {};
$scope.character = null;
$scope.setAction = setAction;
$scope.setDirection = setDirection;
$scope.$watch('pixi.renderer', function(renderer) {
render(renderer);
});
function render(renderer) {
var stage = new P... | true |
2aead54177506d32940cea46b5bda0417faf3c54 | JavaScript | rllzrc/algosbb | /leet/putYourRepsIn/validParentheses.js | UTF-8 | 3,748 | 5.09375 | 5 | [] | no_license | // * Put Your Reps In!
// *** Valid Parentheses -> #20
// T A S K !!
// Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
// An input string is valid if:
// Open brackets must be closed by the same type of brackets.
// Open brackets must be closed... | true |
cf8a324875273e175a9e5cc61bee3b0148afa5a1 | JavaScript | mbcsm/FEUP_LAIG | /projecto_3/javascript/main/animations/LinearAnimation.js | UTF-8 | 2,230 | 2.859375 | 3 | [] | no_license | class LinearAnimation extends Animation{
constructor(scene, controlPoints, time, startTime) {
super(scene);
this.scene = scene;
this.time = time;
this.endTime = time + startTime;
this.startTime = startTime;
this.controlPoints = controlPoints;
this.distance =... | true |
8f9260cebd68742ff09ebc5adb51469e52e19dd8 | JavaScript | Ningthangom/carpartpro3 | /client/src/components/pages/PostsFromFollowing.js | UTF-8 | 6,718 | 2.625 | 3 | [
"MIT"
] | permissive | import React, {useState,useEffect,useContext} from 'react'
// to acces the user for hiding interested button
import {UserContext} from '../../App'
// import link for making view profile of the account that posted that post
import {Link} from 'react-router-dom'
const Home = () => {
const [data,setData] = useStat... | true |
dafac6c378ba27b0973fe600959688c55b8e5f97 | JavaScript | gugulu98/MERN-web-mobile-app | /mobile/src/Exercise.js | UTF-8 | 2,781 | 2.515625 | 3 | [] | no_license | import * as React from "react";
import { useState } from "react";
import {
Button,
Text,
View,
StyleSheet,
SafeAreaView,
Alert,
TouchableWithoutFeedback,
Keyboard,
} from "react-native";
import { TextInput } from "react-native-gesture-handler";
import { addExercise } from "../api/exercise";
import Color... | true |
0ca4eb8f8733a43dedc6d8deb8cbe9b535869faf | JavaScript | tangfan0322/bigevent | /assets/js/login.js | UTF-8 | 2,072 | 2.546875 | 3 | [] | no_license | $(function () {
// 点击“去注册账号”的链接
$('#link_reg').on('click', function() {
$('.login-box').hide()
$('.reg-box').show()
})
// 点击“去登录”的链接
$('#link_login').on('click', function() {
$('.login-box').show()
$('.reg-box').hide()
})
// 表单元素的验证
var form=layui.form;//获取layui中的表单元素
var layer=layui.... | true |
873369aa9089fa002c584a6823f6900017ba9266 | JavaScript | Gurgen8/reactjs-datatime-show | /src/App.js | UTF-8 | 1,321 | 2.71875 | 3 | [] | no_license | import './App.css';
import { Component } from 'react';
import {stopTime,startTime,clearTime} from "./Style.js"
class App extends Component {
constructor(props){
super(props)
this.state={
data:new Date(),
num:0,
timerId:null,
}
}
startStop = () => {
if (this... | true |
01065db9ac7e96ec89201c5cd8f8b716a4edc701 | JavaScript | Johnssther/Thor-Mobile | /Thor Mobile 7.3/src/public/js/TraerProductos.js | UTF-8 | 7,226 | 2.515625 | 3 | [] | no_license | function MostrarElementos(){
let contenedorTotal = document.getElementById("ContenedorTotal");
storage = localStorage.length;
if (storage > 0){
for (let i = 1; i < storage + 10; i ++){
let idProducto = "InfoProducto_" + i;
let producto = localStorage.g... | true |
90b37bb0ab2a528a9ba5a4e9c2034930ba095615 | JavaScript | antgod/class-framework | /design-patterns/结构型模式(包装模式)/3.代理模式/3.移交代理.js | UTF-8 | 886 | 3.421875 | 3 | [] | no_license | // 比如我们公司的补打卡是最后是要交给大boss来审批的,但是公司那么多人,每天都那么多补打卡,那大boss岂不是被这些琐事累死。所以大boss下会有一个助理,来帮忙做这个审批,最后再将每个月的补打卡统一交给大boss看看就行。
// 补打卡事件
const fillOut = function (lateDate) {
this.lateDate = lateDate
}
// 这是bigBoss
const bigBoss = function (fillOut) {
this.state = function (isSuccess) {
console.log("忘记打卡的日期为:" + fillOut.late... | true |
04f18b6f106e547dc69fd9b21307ecb9290fbd73 | JavaScript | TactileVision/TactJam-server | /src/helper/mapMotorPositionForDatabase.js | UTF-8 | 437 | 2.859375 | 3 | [
"MIT"
] | permissive | export default function mapForDatabase(positions) {
const x = [];
const y = [];
const z = [];
// change the schema to xyz
for (let i = 0; i < positions.length; i++) {
if (
positions[i].x != null &&
positions[i].y != null &&
positions[i].z != null
) {
x.push(positions[i].x);
... | true |
4c1f9d974f24c3c2ebcf31d0c4bc8330f0533880 | JavaScript | zuopf769/rollup-project | /doc/scope.js | UTF-8 | 750 | 2.953125 | 3 | [] | no_license | class Scope{
constructor(options={}){
this.name = options.name;
this.parent = options.parent;//这个作用域的父作用域
this.names = options.params||[];//存放着这个作用域内的声明的变量
}
//向当前的作用域内添加变量
add(name){
this.names.push(name);
}
//找到定义这个变量的作用域
findDefiningScope(name){
if(... | true |
c298f2e7155be9a9c7c0668fc2f2b8f9df67b6cb | JavaScript | pediaxu/test_react_app | /src/history/index04.js | UTF-8 | 1,933 | 2.625 | 3 | [] | no_license | /*
* @Descripttion:
* @version:
* @Author: Pedia.Xu
* @Date: 2021-04-29 11:39:35
* @LastEditors: Pedia.Xu
* @LastEditTime: 2021-07-29 14:09:57
*/
/**
* 05-发表评论
*/
//1. 引入核心包
import { Divider } from 'antd'
import React from 'react'
import ReactDOM from 'react-dom'
// //2. 类组件
// class Chil... | true |
590251e07bcc745106b97bcdcff858581efef361 | JavaScript | justlep/knockout-esnext | /spec/defaultBindings/attrBehaviors.js | UTF-8 | 4,989 | 2.890625 | 3 | [
"MIT"
] | permissive | describe('Binding: Attr', function() {
beforeEach(jasmine.prepareTestNode);
it('Should be able to set arbitrary attribute values', function() {
var model = { myValue: "first value" };
testNode.innerHTML = "<div data-bind='attr: {firstAttribute: myValue, \"second-attribute\": true}'></div>";
... | true |
7a9aa4749fe371ba8fc6d2f69e2b256336144b96 | JavaScript | lastlink/ds-tutorial-tanks | /browser/src/js/objects/tank.js | UTF-8 | 3,016 | 2.984375 | 3 | [
"MIT"
] | permissive | define(function( require ){
var PIXI = require( 'pixi' );
var Smoke = require( './smoke' );
var COLORS = [
'Beige',
'Black',
'Blue',
'Green'
];
function Tank( tankName, data, isPlayer ) {
this.tankName = tankName;
this._container = new PIXI.Container();
... | true |
53016f9fd32128c97b73d788f7fff4effa21310b | JavaScript | kamakiri01/A.I.Q | /lib_iq/player(Group化前).js | UTF-8 | 2,340 | 2.96875 | 3 | [] | no_license | //Playerクラス
//var player = enchant.Class.create(enchant.gl.primitive.Cylinder, {
var Player = enchant.Class.create(enchant.gl.primitive.Billboard, {
initialize: function(){
// enchant.gl.primitive.Cylinder.call(this, 0.2,2,10);
enchant.gl.primitive.Billboard.call(this, 1);
//テクスチャ
v... | true |
7b5632d0a9b54c79184a239c080c4bd68fc6c832 | JavaScript | fmchawki/peerweb | /index.js | UTF-8 | 4,688 | 2.515625 | 3 | [] | no_license | var dragDrop = require('drag-drop/buffer')
var WebTorrent = require('webtorrent')
var es = require("event-stream")
var client = new WebTorrent()
var magnetUri = window.location.hash.split('#')[1];
if(magnetUri) {
client.add(magnetUri, function (torrent) {
// Got torrent metadata!
console.log('Torrent info ... | true |
ea3f8b57a99e6e82e8f14957ae6eaf659ad9d86f | JavaScript | hurrymaplelad/ctci | /leetcode/17-letter-combinations-of-a-phone-number/dfs.js | UTF-8 | 565 | 3.171875 | 3 | [] | no_license | /**
* @param {string} digits
* @return {string[]}
*/
const LETTERS_BY_DIGIT = {
"1": "*",
"2": "abc",
"3": "def",
"4": "ghi",
"5": "jkl",
"6": "mno",
"7": "pqrs",
"8": "tuv",
"9": "wxyz"
};
var letterCombinations = function(digits) {
let results = [];
function walk(i, str) {
if(i ... | true |
3babdc8e3018ae686825f4722eb3a4885e105d1a | JavaScript | jakehasler/sum | /js/Sum.js | UTF-8 | 2,045 | 2.984375 | 3 | [] | no_license | import React, { Component } from 'react';
import { get, last } from 'lodash';
import { Text, View } from 'react-native';
import { Container } from './styles';
import Display from './components/Display/Display';
import Button from './components/Button/Button';
import NumberPad from './components/NumberPad/NumberPad';
... | true |
eac132d7a40e426f7ab443a54a1243292fe18461 | JavaScript | Vanvansama/-Implement-A-Multiplication-Table-2019-6-13-6-57-40-397 | /__tests__/createMultiplicationTable-spec.js | UTF-8 | 381 | 2.953125 | 3 | [] | no_license | const createMultiplication = require('../createMultiplicationTable');
it('should return a multiplication table given two number',()=>{
//given
const startNumber = 2;
const endNumber = 4;
//when
const result = createMultiplication(startNumber,endNumber);
//then
expect(result).toBe("... | true |
6cff6905c38c37abab7b9f12e010e73f0253c8af | JavaScript | OliverEros/TicketingSystem | /server/routes/getChartData.js | UTF-8 | 2,248 | 3.046875 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
const ticketSchema = require('../schemas/ticketSchema')
/**
* Function that sends sorted data to the front-end to be displayed using Graph.js
* Data must be sorted here
*/
router.get('/', function (req, res) {
//unreturned values that will ... | true |
3f328ecb3fc7f478d3168ffc539a43aa856cf605 | JavaScript | Quivun/Hackathon-Taggies | /BackEnd/fetching.js | UTF-8 | 1,525 | 2.984375 | 3 | [] | no_license | var mysqpl = require('mysql'); //some variables
var express = require('express');
var app = express();
// To get localhost:8000/
app.get('/', function(request,response){
fetchData(response);
console.log('Done! Data Displayed!');
});
//To connect with the DataBase
var db = mysql.createConnection({
host: '... | true |
1df1df9347855659b57819d46d27d5123278506d | JavaScript | jonsigurd/crown-clothing | /v7_DEPLOYED/src/redux/shop/shop.selectors.js | UTF-8 | 1,703 | 3.203125 | 3 | [] | no_license | // Two types of selectors
// 1. input selector - doesn't use createSelector
// 2. output selector - does use input selectors and createSelector
import { createSelector } from 'reselect';
// Input selector that is a function that gets the state and just returns the state.shop
const selectShop = state => state.shop;
//... | true |
efefb64ffd852e2e0851c4331b2c2eef92efe3ec | JavaScript | Khor-K/test-task-5b | /js/main.js | UTF-8 | 1,418 | 3.0625 | 3 | [] | no_license | // анимация заголовка
var textWrapper = document.querySelector('.navbar-header'); // получаем текст с определенным классом
textWrapper.innerHTML = textWrapper.textContent.replace(/\S/g, "<span class='letter'>$&</span>"); // делим текст по буквам на отдельные спаны
anime.timeline().add({
targets: '.navbar-head... | true |
69e20779c90a5c9ea7e036decc1bdc66b03a5d4e | JavaScript | waittinginhell/redux-practice | /myRedux/combineReducer.js | UTF-8 | 515 | 2.984375 | 3 | [] | no_license | function combineReducer(reducers) {
const reducerKeys = Object.keys(reducers);
return function combination(state={},action) {
let nextState = {};
for (let i = 0 ; i < reducerKeys.length; i++){
const key = reducerKeys[i];
const reducer = reducers[key];
const pr... | true |
145d1280fa5891827bbf55f4044a796fdb71536c | JavaScript | Jonnay101/mg-api-test | /routes/fxRoutes.js | UTF-8 | 2,572 | 2.578125 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
const Comp = require('../models/Comp');
const EQ = require('../models/EQ');
const Val = require('../presetValidation');
// get all presets
router.get('/user1234/:fx', function (req, res, next) {
// get all comp or eq presets depending on fx
... | true |
71ec0d0580110e008a6e50c3111d49db622c2d43 | JavaScript | Septian7/home-test | /server/controllers/userController.js | UTF-8 | 1,133 | 2.546875 | 3 | [] | no_license | const { User } = require("../models");
const { decrypt} = require("../helpers/encdec");
const { tokenGenerator} = require("../helpers/jwt");
class userController {
static async show(req, res) {
try {
let users = await User.findAll({
order: [["id", "ASC"]],
});
res.status(200).json(user... | true |
e8eaa5bc701185f8d9981530b8b5eeba4139cc7f | JavaScript | JajulaUdaySai/tic-tac-toe | /App.js | UTF-8 | 9,188 | 2.75 | 3 | [] | no_license | import React, {Component } from 'react';
import { Text, View, StyleSheet, TouchableHighlight } from 'react-native';
export default class Tic_Tac_Toe extends Component {
constructor(props) {
super(props);
this.DefaultValues = {
playerTurn: 1,
mapArray: [
[0, 0, 0],
[0, 0, 0],
... | true |
257e6a32dd5728362b6b659e487a31a0ae21279f | JavaScript | zorianak/magic-deck-builder | /public/javascripts/global.js | UTF-8 | 6,012 | 3.53125 | 4 | [] | no_license | // DOM Ready =============================================================
$(document).ready(function() {
// initialize our Card script
Card.init();
// Populate the user table on initial page load
populateTable('all');
// Cardname link click
$('#cardList table tbody').on('click', 'td ... | true |
dc548c51a2c2a22b3b9c9f8f13edaa5e0fbb1934 | JavaScript | OmarShokeir/Udacity-FEND-Weather-Journal-App | /website/app.js | UTF-8 | 2,051 | 3.4375 | 3 | [] | no_license | /* Global Variables */
const key = ',us&appid=a500bd39dac94198e42623a3eb722af3&units=metric';
const url = 'http://api.openweathermap.org/data/2.5/weather?zip=';
// Create a new date instance dynamically with JS
let d = new Date();
let newDate = d.getMonth()+'.'+ d.getDate()+'.'+ d.getFullYear();
// Event listener fo... | true |
40addeaa945eed3c159afe679217383d9e1f849e | JavaScript | Vshnv/game-of-life | /js/gradient.js | UTF-8 | 1,475 | 3.234375 | 3 | [] | no_license |
const colors = [[62,35,255],
[60,255,60],
[255,35,98],
[45,175,230],
[255,0,255],
[255,128,0]];
let step = 0;
let colorIndices = [0,1,2,3];
let gradientSpeed = 0.002;
function updateGradient(ctx) {
let c0_0 = colors[colorIndices[0]];
let c0_1 = colors[colorIndices[1]];
let c1_0 = co... | true |
a7b1c3a1db79c1b9437cf0f44d23d01d8fc4b24b | JavaScript | codebuddy969/VladRepository | /react-firebase-dashboard/src/store/reducers/logout.js | UTF-8 | 292 | 2.703125 | 3 | [] | no_license | const initialState = {
status: 'loggedin'
}
function logReducer (state = initialState, action) {
switch (action.type) {
case "ACTION_LOGOUT":
return {...state, status: action.payload};
default:
return state
}
}
export default logReducer; | true |
18c5c633d1d067a8cbcb1ec184031038607f8530 | JavaScript | qlba/mo1 | /method/canonical_task.js | UTF-8 | 2,093 | 2.734375 | 3 | [] | no_license | var {IAryth} = require('../mx/iaryth'),
{is} = require('../utils/is'),
{N} = require('../utils/number_types');
class CanonicalTask
{
constructor(varsCount, equationsCount, coefficients, freeMembers,
targetFunctionCoefficients, targetFunctionFreeMember,
varNames)
{
if(!varNames)
varNames = new Array(varsCo... | true |
d929dd77b02c00da444f46ce2b8d523c8fb877e5 | JavaScript | MichaelPhilippone/Web-Development-Projects-and-Samples | /ControliTunes/js/itunesCtrl.js | UTF-8 | 2,621 | 2.609375 | 3 | [] | no_license | /* ************************************************************************************
* OBJECT:
* AUTHOR: Michael Philippone
* DATE: 05 JAN 2011
* UPDATED: 11 JAN 2011
* PURPOSE:
************************************************************************************ */
/* ** ** ** ** ** ** ** ** ** *... | true |
b000f3561d32e7c9143e33b28fb90f9d648ee834 | JavaScript | acme-cts/blockchain_simulator | /classes/MTreeNode.js | UTF-8 | 973 | 3.109375 | 3 | [
"MIT"
] | permissive | const sha256 = require("crypto-js/sha256");
class MTreeNode {
constructor(hash, left = undefined, right = undefined) {
if (
(left === undefined && right !== undefined) ||
(left !== undefined && right === undefined)
) {
throw new TypeError(
"A Node can be constructed with 0 or 2 chil... | true |
59a31b68db724cf60bb502fa1129edc117535c93 | JavaScript | gonnavis/three.js | /examples/jsm/nodes/accessors/CubeTextureNode.js | UTF-8 | 1,496 | 2.5625 | 3 | [
"MIT"
] | permissive | import TextureNode from './TextureNode.js';
import UniformNode from '../core/UniformNode.js';
import ReflectNode from './ReflectNode.js';
class CubeTextureNode extends TextureNode {
constructor( value, uvNode = new ReflectNode(), biasNode = null ) {
super( value, uvNode, biasNode );
}
getInputType( /*builder*... | true |
153e928a05ca25005cee3d32fa354a5dc5452ca5 | JavaScript | seungjinhan/dev_sources | /nodejs/rest_server_sample/utils/sort.js | UTF-8 | 594 | 3.046875 | 3 | [] | no_license |
/**
* Array.sort( ) 함수의 파라메터로 사용되어 배열내의 json항목(field)을 기준으로 정렬
* - 내림차순
*/
module.exports.ArraySortByDesc = function( field){
return function( a,b){
return ((a[field] === b[field])?0:((a[field]<b[field])?1 : -1) )
}
}
/**
* Array.sort( ) 함수의 파라메터로 사용되어 배열내의 json항목(field)을 기준으로 정렬
* - 오름차순
*/
m... | true |
0bb318f02ab14047a9e02e8324f9398f4eeac3d7 | JavaScript | laureanray/ipna-api | /src/core/data-sources.js | UTF-8 | 1,570 | 2.65625 | 3 | [
"MIT"
] | permissive | const { githubAPI, npmAPI } = require('./http-clients')
const searchGithub = async query => {
try {
const response = await githubAPI(`search/repositories?q=${query}`)
return response.body
} catch (error) {
return error.response.body
}
}
const searchNPM = async query => {
// This doesn't throw an e... | true |
a9c33837c027b4a8c39d3ee026b2245287c1a2ba | JavaScript | chris-yi/js-prep | /equalVsStrictEquals.js | UTF-8 | 779 | 4.40625 | 4 | [] | no_license | // What is the difference between the comparison operators == and === ?
console.log(7 == '7'); // true
console.log(7 === '7'); // false
/* Notes:
== (equals) vs === (strict equals)
1. == tests for abstract equality while === tests for strict equality
2. == does not test for data types
3. === does test for da... | true |
2e5a69a1d7b0e2fc886adc9eed9a2bc338c359a0 | JavaScript | D23FED/TWC | /src/core/js/sticky.js | UTF-8 | 3,117 | 2.734375 | 3 | [] | no_license | /* ==========================================================================
Sticky -- Version: 2.1 - Updated: 6/8/2015
========================================================================== */
if (!!$('.sticky').offset()) {
$(function(){
var stickyTop = $('.sticky').offset().top;
var stickyNav = func... | true |
f4d9d3adb35dcedd8d074f573dc24df3b2128b2d | JavaScript | ElijahSeigel/Gladiator | /src/character.js | UTF-8 | 10,669 | 3.15625 | 3 | [] | no_license | //character.js
import CollisionController from './collision-controller';
import Sprite from './sprite';
export default class Character{
constructor(xpos, ypos, collisionClass){
//initialize character variables
this.height = 20; //subject to change based on sprite
this.width = 20; //subject to change based on sp... | true |
539176b94dedeb80e6e67e38b03a426f85e8b49d | JavaScript | aoneill01/obs-overlay | /static/scripts/transform-utils.js | UTF-8 | 422 | 2.53125 | 3 | [] | no_license | import { easeLinear } from "./easing.js";
export function transformDomain(
value,
sourceStart,
sourceEnd,
destinationStart,
destinationEnd,
easing = easeLinear
) {
const t = clamp((value - sourceStart) / (sourceEnd - sourceStart), 0, 1);
return destinationStart + (destinationEnd - destinationStart) * e... | true |
6dea51989ba03f93e72f6f8cead3a277a363dc08 | JavaScript | Gusscar/ProyectosReact | /src/02-Presupuesto/components/Formulario.js | UTF-8 | 2,114 | 2.609375 | 3 | [] | no_license | import { Button, TextField, Typography } from '@material-ui/core'
import React, { useState } from 'react'
import { Error } from './Error';
import { v4 as uuidv4 } from 'uuid';
export const Formulario = ({setGasto, setcrearGasto}) => {
const [nombre, setNombre] = useState('');
const[cantidad, setCantidad]= use... | true |
117800821e84d697fb878925cff4194b62a8d303 | JavaScript | susmithagadde/git_issues | /src/list.jsx | UTF-8 | 3,395 | 2.84375 | 3 | [] | no_license | import React, { Component } from "react";
import { PostData } from "./postdata";
class List extends Component {
constructor(props) {
super(props);
this.state = {
test: [],
headers: [
"Total Issues",
"In 24Hrs",
"Lessthan SevenDays",
"Morethan SevenDays"
],
... | true |
4c93a5e14bd6cc359814adcbf390aead03feb02e | JavaScript | marky7/GlobalGameJam_2017 | /client/lib/THREExWR.js | UTF-8 | 1,999 | 3.015625 | 3 | [
"MIT"
] | permissive | // This THREEx helper makes it easy to handle window resize.
// It will update renderer and camera when window is resized.
//
// # Usage
//
// **Step 1**: Start updating renderer and camera
//
// ```var windowResize = THREEx.WindowResize(aRenderer, aCamera)```
//
// **Step 2**: Start updating renderer and camera
//... | true |
f73bfa0543bb9901416a1306b23cdf18a19eaa25 | JavaScript | SararAseer/engame | /03_Canvas/dotconn.js | UTF-8 | 958 | 3.09375 | 3 | [] | no_license | // SoftDev2 pd6
// K#02: Connecting the Dots
// 2019-02-03
// getting variables in order
var c=document.getElementById('playground');
var ctx = c.getContext("2d");
var go = document.getElementById("circle");
var stop = document.getElementById("stop");
var rad=0;
var gro=true;
var stops=true;
var requestID;
// clear t... | true |
54ce96b08c9dfe1b06421047a4b4d329472aed83 | JavaScript | zizi-busy/react-todo-app | /src/components/AddTodo.js | UTF-8 | 858 | 2.546875 | 3 | [] | no_license | import React,{Component} from 'react'
class AddTodo extends Component{
state = { content:''}
handleChange = (e) =>{
this.setState({
content: e.target.value
})
}
handleSubmit = (e) =>{
e.preventDefault();
this.props.addTodo(this.state); //prop from App
... | true |
d21e92bb85dd21f41bbae5a82313d3aa8bce6ab0 | JavaScript | knightjdr/youn-lab | /src/components/layout/navbar/get-menu-state.test.js | UTF-8 | 962 | 2.53125 | 3 | [
"MIT"
] | permissive | import getMenuState from './get-menu-state';
describe('Get menu state', () => {
it('should return closed state when there is no current state', () => {
const expected = {
isOpen: false,
transform: 'translateX(0)',
};
expect(getMenuState()).toEqual(expected);
});
it('should return closed ... | true |
4d0b347453d3f7a77a07f29f4c62c2603eddaf0b | JavaScript | qwop/userscript | /monolith/62/181511.user.js | UTF-8 | 1,071 | 2.53125 | 3 | [] | no_license | // ==UserScript==
// @name fqjy_dh
// @namespace zdtb
// @include ----------
// @version 1
// @grant none
// ==/UserScript==
test();
//window.addEventListener('load', function(){test() } , true);
function test()
{
//alert("hollow");
window.setTimeout(function(){getlink("http://www.fqj... | true |
8b610a7ec3afef99a4e7f0ff6c35449ee4b71c7c | JavaScript | eraqcode/reactjs-tutorial | /15.-form-handling/src/components/NewTravelForm/NewTravelForm.jsx | UTF-8 | 3,984 | 2.53125 | 3 | [] | no_license | import React, { useState } from 'react'
import { v4 as uuidV4 } from 'uuid'
export const NewTravelForm = ( { addTravel } ) => {
const [travel, setTravel] = useState({
continent: '',
country: '',
city: '',
imgURL: ''
})
const {continent, country, city, imgURL} = travel;
... | true |
15c39dd2f5b91ac9d35b128c76bbda716728cdf0 | JavaScript | SwitchbladeBot/switchblade | /src/controllers/EconomyController.js | UTF-8 | 2,545 | 2.53125 | 3 | [
"BSD-2-Clause"
] | permissive | const { Controller } = require('../')
const moment = require('moment')
// Bonus
class BonusCooldownError extends Error {
constructor (lastClaim, formattedCooldown) {
super('ALREADY_CLAIMED')
this.lastClaim = lastClaim
this.formattedCooldown = formattedCooldown
}
}
const BONUS_INTERVAL = 24 * 60 * 60 ... | true |
f38214816a612c94f8853150af3d728862384591 | JavaScript | KhelladiSidali/Aprendre-JS-From-Scratch | /Cour/apprendreJS2P.js | UTF-8 | 11,865 | 2.84375 | 3 | [] | no_license | // SELECTEURS
// document.querySelector('h4').style.background="red";
// const baliseHTML = document.querySelector("h4");
// console.log(baliseHTML);
// baliseHTML.style.background = "yellow";
// click event
// questionContainer.style.borderRadius = "150px";
const questionContainer = document.querySelector(".click-even... | true |
b6c3142ed2244cef868d560048e9df2f9918e0ec | JavaScript | WGL878420/node-self-blog | /node-back/timingtask/jjData.js | UTF-8 | 919 | 2.953125 | 3 | [] | no_license | let read = require('../crawler/read');
let write = require('../crawler/write');
let tagsUrl = 'http://juejin.im/subscribe/all';//所有的标签的列表
(async function () {
try {
let tags = await read.tags(tagsUrl);
console.log('这是往数据库填充之前')
await write.tags(tags);
console.log('读完去填充到数据库')
... | true |
dd37d7f509f7f716e1b35907c24286d644c738d1 | JavaScript | ynonp/exeriser11 | /exercise5/src/main.js | UTF-8 | 639 | 2.59375 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
import { useState } from 'react'
const input = () => {
const [text, setContent] = useState('');
function changeText(e) {
setContent(e.target.value)
}
// Did you mean to use a loop here?
return (
<div style={{ display: "flex", flexDirectio... | true |
476f9e5e86366b43ab903bd0a5c40d629939ab0b | JavaScript | Krishna7852/competitive-programming | /src/algorithms/bit-utils/get-lowest-set-bit-value/get-lowest-set-bit-value.js | UTF-8 | 245 | 3.078125 | 3 | [] | no_license | /**
* Returns the value of least significant bit that is on(bit from right that
* is on).
*
* @param {*} number
* @returns
*/
const getLowestSetBitValue = (number) => {
return number & -number;
};
module.exports = getLowestSetBitValue;
| true |
24761ee7a99ea602c92051aa2eaa32ea42059d6f | JavaScript | fijiaaron/redmine-tcm | /public/javascripts/calendar/lang/calendar-sv.js | UTF-8 | 2,552 | 2.671875 | 3 | [] | no_license | // ** I18N
// full day names
Calendar._DN = new Array
("Söndag",
"Måndag",
"Tisdag",
"Onsdag",
"Torsdag",
"Fredag",
"Lördag",
"Söndag");
Calendar._SDN_len = 3; // short day name length
Calendar._SMN_len = 3; // short month name length
// First day of the week. "0" means display Sunday first,... | true |
23046f07ad48137cc31deea02df1080f0d794f62 | JavaScript | dapplets/dapplet-registry | /scripts/deploy.js | UTF-8 | 1,983 | 2.546875 | 3 | [
"MIT"
] | permissive | async function main() {
const [deployer] = await ethers.getSigners();
let contracts = [];
let dappletNFT;
let libRegistryRead;
let dappletRegistry;
dappletNFT = await deploy("DappletNFT", []);
contracts.push(dappletNFT);
libRegistryRead = await deploy("LibDappletRegistryRead");
contracts.push(libR... | true |
98175b46ad7b216042f2c769c5c67b3fa3290ea0 | JavaScript | jaaqo/botkit-storage-dynamodb | /src/index.js | UTF-8 | 1,968 | 2.71875 | 3 | [
"MIT"
] | permissive | /**
* botkit-storage-dynamodb - DynamoDB driver for Botkit
*
* @param {Object} config Must contain region, accessKeyId,
* secretAccessKey properties, optionally dynamoTable (defaults to botkit)
* @return {Object} A storage object conforming to the Botkit storage interface
*/
module.exports = function(con... | true |
97c93c71367d2413abecf79688ba1f14be201ffc | JavaScript | stevencschoi/battlesnake | /index.js | UTF-8 | 5,980 | 3.09375 | 3 | [
"MIT"
] | permissive | const bodyParser = require('body-parser')
const express = require('express')
const PORT = process.env.PORT || 3000
const app = express()
app.use(bodyParser.json())
app.get('/', handleIndex)
app.post('/start', handleStart)
app.post('/move', handleMove)
app.post('/end', handleEnd)
app.listen(PORT, () => console.log(`... | true |
7df6165325463708199dcc49ac63f49938df10d8 | JavaScript | ivan-vilches/ecommercevilches | /src/components/getItems.js | UTF-8 | 501 | 2.65625 | 3 | [] | no_license |
export async function getData(a) {
const response = await fetch('api.json')
let data = await response.json()
if(a === undefined){
return data;
} else{
data = data.filter((i) => i.categoria === a)
return data;
}
}
export async function getDataID(a) {
... | true |
0933922047a319e74654de78bc27bbd5f4f4b0a4 | JavaScript | raphman100/todo-backend-app | /app/controllers/todo.controller.js | UTF-8 | 3,115 | 2.65625 | 3 | [] | no_license | // Database
import dbConfig from '../config/db.config.js';
import pg from 'pg';
const { Client } = pg;
import { v4 as uuidv4 } from 'uuid';
export default class TodoController {
// Connection to db
static client;
static async connectToDB() {
this.client = new Client( dbConfig );
await this.client.connect();
}... | true |
598161c8cff7e1411fc6f249b4c256b100b2b002 | JavaScript | TobyThomson/T2 | /js/app.js | UTF-8 | 9,451 | 2.71875 | 3 | [] | no_license | var notie = require('notie');
var io = require('socket.io-client');
var Game = require('./game.js');
var _socket;
var isOnline;
var isHost;
var gameStarted = false;
var _game;
var title = document.getElementById("title");
var main = document.getElementById("main");
var startPage = document.getElementById("start-pa... | true |
e6ca1886b0962d9a6f6f72288e862b109225f785 | JavaScript | DeadEnd819/57563-cinemaddict-12 | /src/view/filter-menu.js | UTF-8 | 1,505 | 2.609375 | 3 | [] | no_license | import {filter} from "../utils/filter.js";
import AbstractView from "./abstract.js";
const createFilterMenuTemplate = (films) => {
return (
`<nav class="main-navigation">
<div class="main-navigation__items">
<a href="#all" class="main-navigation__item main-navigation__item--active">All movies</a>... | true |
603b75c6d2591ddc01b89d3147827cd41461517d | JavaScript | IAmNotHacking/bonkonauts | /client/js/pages/friends.js | UTF-8 | 4,008 | 3.171875 | 3 | [] | no_license | function init() {
var FRIENDS = window.user.friends;
var LEGACY_FRIENDS = window.user.legacyFriends.split('#');
var friendsContainer = document.querySelector('section.content');
const sortFriends = (friends) => friends.sort((a, b) => { if(a.roomid == null && b.roomid != null) return 1; else if(a.roomid != null &&... | true |
5a961f3d88eb891a42d1f33eef79aba37830d599 | JavaScript | Deven-14/Research_APP | /data_collectors/1_get_courseID.js | UTF-8 | 1,774 | 2.90625 | 3 | [] | no_license | //This file gets the course names, sections, course ids, classroom drive ids of the required courses
const fs = require("fs");
const readline = require("readline");
const { google } = require("googleapis");
const get_auth = require('./0_get_auth');
function listCourses(auth) {
return new Promise((resolve, reject)... | true |
e43b703d062e1330811064afabb8ac33499e9b61 | JavaScript | Giancarlo-Zuliani/js-mail-dadi | /email-check/js/script.js | UTF-8 | 614 | 3.390625 | 3 | [] | no_license |
// array full of accepted mails
var mailList = ["ciao@gmail.com" , "ciao@libero.it" , "ciao@hotmail.com" , "pippo@gmail.com" , "helloworld@gmail.com" , "pippo@hotmail.com" , "helloworld@hotmail.com" , "boolean@gmail.com" , "boolean@libero.it" , "boolean@hotmail.com" , "booleancareers@gmail.com" , "booleancareers@hotma... | true |
0eb217d9e969463bb73f94ffe570a2335f3927ac | JavaScript | BoMeeYoon/algorithmStudy | /20200804-basic/12_quickSort.js | UTF-8 | 440 | 3.578125 | 4 | [] | no_license | function quickSort(input) {
if (input.length <= 1) return input;
const arr = input.slice();
const pivot = arr.splice(Math.floor(arr.length / 2), 1);
const left = [];
const right = [];
for (let i = 0; i < arr.length; i++) {
arr[i] < pivot ? left.push(arr[i]) : right.push(arr[i]);
}
return quickSort(l... | true |
edb2457117e013889d8927bdcc12cc0ec5a7a403 | JavaScript | DraciVik/freeCodeCamp-challenges | /Front-End-Libraries-Certification/React-And-Redux/07-MapDispatchToProps.js | UTF-8 | 1,775 | 4 | 4 | [
"MIT"
] | permissive | // The mapDispatchToProps() function is used to provide specific action creators to your React components so they can dispatch actions against the Redux store. It's similar in structure to the mapStateToProps() function you wrote in the last challenge. It returns an object that maps dispatch actions to property names, ... | true |
361988d0ebb3ada4f88d4432d2eb085087c115ab | JavaScript | imarrsh/node_weather | /src/fetch.js | UTF-8 | 874 | 2.75 | 3 | [] | no_license | // in progress...
const https = require('https');
const http = require('http');
const zlib = require('zlib');
module.exports = function fetch(url){
return new Promise(function(resolve, reject){
try {
// request some data
const req = https.request(url, response => {
const status = respsone.st... | true |
cfdce197055f8ded41247eaa5f6448d0c8fbb55c | JavaScript | greene-matthew/web-calculator | /division.js | UTF-8 | 406 | 3.296875 | 3 | [] | no_license |
function divide(numerator, denominator) {
var numerator = new BigNumber(numerator);
var denominator = new BigNumber(denominator);
if (denominator != 0) {
return parseFloat(a.div(b).toString()).toFixed(32);
}
else {
alert("That operation is not permitted");
}
}
console.log... | true |
6ed0003660c6da61d5c1e75335215691e8e4b5f7 | JavaScript | NordicCodingRob/TriviaGame | /assets/JavaScript/script.js | UTF-8 | 3,326 | 3.203125 | 3 | [] | no_license | (function() {
function buildQuiz() {
const output = [];
myQuestions.forEach((currentQuestion, questionNumber) => {
const answers = [];
for (letter in currentQuestion.answers) {
answers.push(
`<label>
<input type="radio" name="question${questionNumber}" value="${le... | true |
03dd39f9e0ba87277782b33b2136759a1f53d9a2 | JavaScript | ohminimarie/UdemyColtWDB | /lecture108/scopeQuiz.js | UTF-8 | 274 | 3.90625 | 4 | [] | no_license | var num = 8;
function doMath() {
num += 1;
if(num % 5 == 0) {
return true
} else {
return false
}
}
num += 1;
doMath()
//returns true
function hi() {
var name = "Rusty";
console.log(name);
}
function bye(){
console.log(name);
}
// returns undefined | true |
a19c7d58eb48670958d6c28aabd134ab844121b4 | JavaScript | iamcristos/slack-node-chat-app | /public/joinRoom.js | UTF-8 | 1,224 | 3.09375 | 3 | [] | no_license | function joinRoom(roomName) {
// send room name to the server
socket2.emit('joinRoom', roomName,(numberOfpeople) =>{
// console.log(roomName);
document.querySelector('.curr-room-num-users').innerHTML = `${numberOfpeople} <span class="glyphicon glyphicon-user"></span>`
});
socket2.on('cha... | true |
36f67ead49c046c87d97d144bf931a170ea418a3 | JavaScript | ada7matm/dom | /00_clases/clase_xx_0624/01_objetos/main.js | UTF-8 | 4,257 | 3.734375 | 4 | [] | no_license | const imprimirNombresEstudiantes = () => {
for(const estudiante of estudiantes) {
console.log(`${estudiante.nombreCompleto.nombre} ${estudiante.nombreCompleto.apellido}`);
}
}
const obtenerEstudiantesDeCasa = casa =>{
const esDeCasa = estudiante =>
estudiante.casa === casa;
const estu... | true |
ae6af2da786f1fa637ebf3e4a2ef0464affb81ef | JavaScript | sharpbunny/BeachCampNode | /connection.js | UTF-8 | 908 | 2.984375 | 3 | [] | no_license | /**
* FR : Module permettant de se connecter à la base de données
* EN : Module to connect to mysql database
*/
var mysql = require('mysql');
/**
* Méthode permettant d'ouvrir une connection à la base de données
*/
function Connection() {
this.pool = null;
this.init = function() {
this.pool = my... | true |
53ed9cf6f2b3d99a5f8e9c21714f3bd3b2796b81 | JavaScript | 596787334/git1 | /9.13.js | UTF-8 | 1,445 | 3.484375 | 3 | [] | no_license | /*
* @Author: shuangshuang
* @Date: 2017-09-13 13:53:06
* @Last Modified by: shuangshuang
* @Last Modified time: 2017-09-13 18:29:34
*/
// let str = 'sjoejo';
// console.log(str.length);
// let a=str.charAt(2);
// console.log(a);
// let c=str.charCodeAt(1);
// console.log(c);
// let b = String.fromCharC... | true |
9b0cb850e5407cf47f07b86d5550a8d8bba991ba | JavaScript | kenhoff/quasar-tournament | /Assets/Ships/ShieldControl.js | UTF-8 | 497 | 2.515625 | 3 | [] | no_license | #pragma strict
private var fade_rate : float = .05;
public var max_shield_alpha : float;
function Start () {
}
function Update () {
if (renderer.material.color.a > max_shield_alpha) {
renderer.material.color.a = max_shield_alpha;
}
if (renderer.material.color.a > 0) {
renderer.material.color.a -= fade_rate;... | true |
a1bd116f98e520f57f289bde4eac20a705701845 | JavaScript | seanmcquaid/promises | /moviePromise/routes/index.js | UTF-8 | 951 | 3.125 | 3 | [] | no_license | // make a function called "getNowPlaying"
// it should return a promise
// at / call that function
// use await and async
// at / res.json() the movieData
var express = require('express');
var router = express.Router();
const request = require('request');
const apiBaseUrl = 'http://api.themoviedb.org/3';
const apiK... | true |
98d3e9e476f9c0dcf675f54ae7b820fef9eebafe | JavaScript | johnngo10/to-do-app | /src/modules/task/addTask.js | UTF-8 | 3,315 | 2.609375 | 3 | [] | no_license | import task from './task';
import displayController from '../displayController';
import storage from '../storage';
import project from '../project/project';
const format = require('date-fns/format');
const addTask = e => {
e.preventDefault();
const createTaskTitle = document.getElementById('create-task-title').val... | true |
81b7484478d18143fc569fe5da8b1d978cabd87c | JavaScript | sheikhuzumaki/Web-JS | /main2.js | UTF-8 | 562 | 2.734375 | 3 | [] | no_license | const mail1 = document.getElementById('email1');
const pass1 = document.getElementById('password1');
const button1 = document.getElementById('log');
button1.addEventListener('click' , onsubmit);
function onsubmit (e) {
e.preventDefault();
if (mail1.value === '' || pass1.value === '') {
alert('Poora lik... | true |
997f2a99fcb3043c3fb5ec4632095c38eccb4038 | JavaScript | zjlyyq/Frontend-02-Template | /week04/stateMachine2.js | UTF-8 | 1,150 | 4.1875 | 4 | [] | no_license | // abcabx
function isMatch(str) {
let state = start;
for(let c of str) {
state = state(c);
// console.log(c, state);
}
return state === end;
}
let cases = [
'abcabx',
'abcbababc',
'ababcdef',
'abababcabxa'
];
for(let str of cases) {
console.log(isMatch(str));
}
//初始状态... | true |
f8695b692fd27f28896c055e58ba863991960088 | JavaScript | qurbanzadefidan/myportfolio | /portfolio/src/app/test.js | UTF-8 | 244 | 2.71875 | 3 | [] | no_license | var Elma = /** @class */ (function () {
function Elma(name, price) {
this.name = name;
this.price = price;
}
Elma.prototype.getValue = function () {
return this.price;
};
return Elma;
}());
| true |
90e21ffe2226715d6e6778d30db7797239dd8a52 | JavaScript | igorp1/igor.commute | /app.js | UTF-8 | 4,354 | 2.703125 | 3 | [] | no_license | /******** CONSTANTS **********/
var _colors = {
"Orange": "#FF9728",
"Green": "#3BE889",
"Blue": "#439DFF",
"Red": "#E84E42",
"Purple": "#B458FF"
}
var _favoritePlace = "place-forhl"
var _favoritePlaceName = "Forest Hills"
var _favoriteDirection = "Northbound"
// here's the possibilities:
/*
route... | true |
f0634099bd8da89e3364bb9728d3b44e54beca9b | JavaScript | Anchovy0901/frontendKnowledgeStructure | /money-react-play-sound/index.js | UTF-8 | 3,429 | 2.6875 | 3 | [] | no_license | // 一百零一元 101
// 一百一十元点零二元 110.2
const path = require('path');
class AmountPlaySound{
constructor({playText = null,preSound}){
this.playText = playText;
this._init();
this.preSound = preSound;
}
_init(){
this.preSound = 'pay_success.mp3'
this.amountSound = '$.mp3'
this.dotSound... | true |
77d0caa02feae61e2f5a196b7f3769adae04b538 | JavaScript | Danver97/jwt-secure | /jwt/jwt-test.class.js | UTF-8 | 2,248 | 2.640625 | 3 | [] | no_license | const JWTSecure = require('./jwt-secure.class');
const NodeRSA = require('node-rsa');
const uuid = require('uuid').v4;
const jwt = require('jsonwebtoken');
class JWTTest extends JWTSecure {
/**
*
* @param {Object} options
* @param {number} [options.rsabit] RSA key bits
* @param {string} [opti... | true |
7f2083bb0b3cdb3ecb34b0e304dc432052628f50 | JavaScript | uaaeu/js-algorithms-exercises | /Basic Algorithm Scripring/largest_number.js | UTF-8 | 776 | 4.40625 | 4 | [] | no_license | //Return Largest Numbers in Arrays with for loop.
function largestOfFour(arr) {
let result = [-1000, -1000, -1000, -1000];
for (let i = 0; i < arr.length; i++) {
for (let j = 0; j < arr[i].length; j++) {
if (arr[i][j] > result[i]) {
result[i] = arr[i][j];
}
}
}
return result;
}
// ... | true |
39fb06749d44185eefc601e1fd847d09b8d1696e | JavaScript | 7kms/design-pattern | /decorator/test1.js | UTF-8 | 909 | 3.515625 | 4 | [] | no_license | /**
* 传统面向对象实现装饰着模式
*/
var Plane = function(){
console.log('普通飞机')
}
Plane.prototype.fire = function(){
console.log('发射普通子弹')
}
//接下来增加两个装饰类,分别是导弹和原子弹
var MissileDecoractor = function(plane){
console.log('======升级导弹飞机=====')
this.plane = plane;
}
MissileDecoractor.prototype.fire = functio... | true |
1e7a06ecab78887aa312253938b3b8f8e37c95a1 | JavaScript | BrandonM25/DayCareApp | /server.js | UTF-8 | 2,284 | 2.640625 | 3 | [] | no_license | var express = require("express");
var bodyParser = require("body-parser");
var PORT = process.env.PORT || 3000;
var app = express();
var path = require("path");
var exphbs = require("express-handlebars");
var htmlRoute = require("./routes/html-routes.js");
var apiRoute = require("./routes/api-routes.js");
// Se... | true |
63ae32eef4c564f32654cbce02c4973d08e7d02b | JavaScript | PJ81/RockPaperScissors | /src/index.js | UTF-8 | 1,917 | 2.890625 | 3 | [] | no_license | import * as Const from "./const.js";
import Gui from "./gui.js";
class Stats {
constructor() {
this.moves = [
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0]
];
this.results = [0, 0, 0];
}
getMoveCount(p, m) {
return this.moves[p][m];
... | true |
c315e706a6d38021278064e2109640ecb60f3f6c | JavaScript | helenascholl/clean-code-adventure | /src/vanilla-js/array/array.js | UTF-8 | 2,909 | 3.125 | 3 | [
"MIT"
] | permissive | import { array } from "prop-types";
export const fncs = {
calculateSumOfNumbers: numbers => {
let sum = 0;
for (let number of numbers) {
sum += number;
}
return sum;
},
getBiggestNumber: numbers => {
let biggestNumber = numbers[0];
for (let number of numbers) {
if (number ... | true |
e752f7ef7f4c1e660469396bbedb7bf021bf6823 | JavaScript | khanhhuy288/Codewars-Javascript | /toLoverCase.js | UTF-8 | 210 | 3.5625 | 4 | [] | no_license | String.prototype.toLoverCase = function(){
var love = 'LOVE';
return this.replace(/[a-z]/gi, c => love[(c.toLowerCase().charCodeAt() - 97) % 4]);
};
console.log('Hello World!'.toLoverCase()); // ELEEV VVOEE! | true |
97c7b93b8e54e92ec99e541a34e06adc82917174 | JavaScript | ashishtigga80/top-shop | /src/api/controllers/auth.js | UTF-8 | 2,040 | 2.703125 | 3 | [] | no_license | const User = require('../../models/user');
const bcrypt = require("bcrypt");
const jwt = require("jsonwebtoken");
const config = require("../../config/index")
module.exports.login = async (req, res) => {
const email = req.body.email;
const password = req.body.password;
try{
const user = await User.findOne({... | true |
2da4200179c54407a93cac018f1e935d98cb8ed6 | JavaScript | inknsharps/banneton | /client/src/components/SourdoughCalculator/StarterCalculatorOutput/StarterCalculatorOutput.jsx | UTF-8 | 1,190 | 2.515625 | 3 | [
"MIT"
] | permissive | import React, { useContext } from "react";
import { toDecimal } from "../../../utils/toDecimal";
import SourdoughContext from "../../../contexts/SourdoughContext";
const StarterCalculatorOutput = () => {
const { sourdoughState } = useContext(SourdoughContext);
const { targetStarterWeight, waterRatio, flourRa... | true |
22de49fd1466fdfb616f778f498e26fabbc56065 | JavaScript | stonefarmer9/Whats-on- | /spec/testingFrame.js | UTF-8 | 1,404 | 3.03125 | 3 | [] | no_license |
var spec = function(message, testFunc) {
try {
testFunc();
console.log('%c Success ' + message, 'color: #3CB371' )
} catch(err) {
console.error("%c Failure " + message + err, 'color: #B22222')
console.trace('The Trace');
}
}
var expectEquality = function (returnValue, expected) {
if(returnVal... | true |