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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
c273a529d84dbe5d45ca1603e3f316931dc072e0 | JavaScript | jvalen/pixel-art-react | /test/utils/color.test.js | UTF-8 | 1,882 | 2.84375 | 3 | [
"MIT"
] | permissive | import formatPixelColorOutput from '../../src/utils/color';
describe('formatPixelColorOutput', () => {
describe('When the params are empty or not valid', () => {
it('should return the rgba format of black color', () => {
const blackRgba = 'rgba(0,0,0,1)';
expect(formatPixelColorOutput(null, null)).to... | true |
1815b8abac7ad9a384ec86a7c1226cbd71ca2c2b | JavaScript | grand-wexford/skyeng | /translate.js | UTF-8 | 3,901 | 2.90625 | 3 | [] | no_license | "use strict";
window.addEventListener( "mouseup", translate );
function translate() {
var self = this;
clear();
self.selection = window.getSelection();
self.word = self.selection.toString();
if ( self.word && self.word !== '' ) {
getJSON( 'http://dictionary.skyeng.ru/api/v2/search-word-translation?text=' ... | true |
48a34f3b43f20d8ea6e3fe94aedf48e0b10f3021 | JavaScript | jeanyves-yang/Formation_JS_2019_Orsys | /Langage/exo-plusminus-object.js | UTF-8 | 1,638 | 3.984375 | 4 | [] | no_license | function getRandomIntInclusive(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min)) + min;
}
function getRandomArbit... | true |
67ebc1c0043949b907f8b7d7a04e4b0b49e37058 | JavaScript | Team-RAD/Naruto_Run_Server | /controllers/posts_controller.js | UTF-8 | 3,409 | 3.03125 | 3 | [] | no_license | const { getAllPosts, getPostById, addPost, deletePost, updatePost } = require("../utils/posts_utilities")
const post = require("../models/post")
//creates object getPosts with function taking in requests and responds by sending getAllPosts
const getPosts = function(req, res) {
//executes promise using the getAllPosts ... | true |
8395f0db44ff328695910c39cb3273e2660dd275 | JavaScript | reelyactive/starling | /lib/routes/emulations.js | UTF-8 | 3,680 | 2.53125 | 3 | [
"MIT"
] | permissive | /**
* Copyright reelyActive 2015-2019
* We believe in an open Internet of Things
*/
const express = require('express');
const path = require('path');
const responseHandler = require('./responsehandler');
let router = express.Router();
router.route('/')
.post(function(req, res) {
createEmulation(req, res);
... | true |
48dbdd6ec4bdbfb4bf8698d3f637deff50e3bb3c | JavaScript | TonyMarc7/practicas-js | /Runball/user.js | UTF-8 | 821 | 3.0625 | 3 | [] | no_license | document.getElementById('player').addEventListener('click', sumarP);
score = 0;
tiempo = 40;
meta = 30;
function sumarP() {
score++;
document.querySelector('#score').innerHTML = "Puntos: " + score + "/" + meta;
mover = Math.round(Math.random()*460);
mover2 = Math.round(Math.random()*460);
document.... | true |
9343fc69263556ee0d79378fef3124d2156f7d1e | JavaScript | AbanoubIbrahim98/socialApp | /js/Market.js | UTF-8 | 1,091 | 2.71875 | 3 | [] | no_license | var jason, result, d, img, element, h1;
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.status == 200)
if (xhr.readyState == 4) {
jason = xhr.responseText;
result = JSON.parse(jason);
jasonElemnt();
}
};
function jasonElemnt() {
for (var i in result) {
d... | true |
868c9faa5118622fbd1432350b750e8168f4ad6b | JavaScript | Study-CCC/mystudy | /js/经典面试题/1.js | UTF-8 | 174 | 2.703125 | 3 | [] | no_license | var a = {n: 1};
var b = a;
a.x = a = {n: 2};
console.log(a);
console.log(b);
console.log(a.x);
console.log(b.x);
//https://www.cnblogs.com/qiujianmei/p/7135428.html
| true |
8cde2d9b9f04315d066c8e6b3267a00f220a22bf | JavaScript | sdoering/til | /web_development/js/findInArray.js | UTF-8 | 214 | 3.078125 | 3 | [] | no_license | function findPropertyInArray (haystack, needle) {
for (var i = 0; i < haystack.length; i++) {
var item = haystack[i];
if (item[needle] !== undefined) {
return item[needle];
}
}
return false;
}
| true |
77651c9aa2e707918001cbf344b9f80c199bdae4 | JavaScript | shawpr/RemoteMathService | /tests/mathTest.js | UTF-8 | 1,604 | 2.578125 | 3 | [] | no_license | var assert = require('assert');
var mathFuntion = require('../correctedMathService.js');
var callOneService = require('../tests/callOneService.js').CallOneService;
var callTwoService = require('../tests/callTwoService.js').CallTwoService;
describe('mathFuntion', function () {
it('should return correct', function ... | true |
7a7b7f855162b32c063c0b24a8c7b0cb0e133e79 | JavaScript | CCMeta/nagajamu | /src/assets/js/fallings.js | UTF-8 | 753 | 2.765625 | 3 | [] | no_license | var c = document.getElementById("c");
var ctx = c.getContext("2d");
c.height = window.innerHeight;
c.width = window.innerWidth;
var txts = "{{site.bgtext}}";
txts = txts.split("");
var font_size = 12;
var columns = c.width / font_size;
var drops = [];
for (var x = 0; x < columns; x++) drops[x] = 1;
function draw() {
... | true |
150e532fd627932d37b654449ff8bec873d8d4d3 | JavaScript | MuhammadSaidulislam/emergency | /src/Component/getServiceData.js | UTF-8 | 2,941 | 2.546875 | 3 | [] | no_license | import React, { useState } from 'react';
import { Button, Col, Container, Row } from 'react-bootstrap';
import './getServiceData.css';
import Loading from './Loading';
const GetServiceData = (props) => {
const [isLoading, setIsLoading] = useState();
const [msg, setMsg] = useState();
const data = props.dat... | true |
dbea3af9939ee7f19a646143d3b82c1520405930 | JavaScript | watkinsgljr/tuesdays-tacos | /controllers/tacos_controllers.js | UTF-8 | 3,754 | 2.6875 | 3 | [] | no_license |
const express = require("express");
const router = express.Router();
const itemOrdered = require("../models/itemOrdered.js");
const order = require("../models/order.js");
const ordersUtil = require("../models/utilities.js");
// Create all our routes and set up logic within those routes where required.
router.get(... | true |
dc99e4ad9797b0577c6a1264e614feb7dd68fd14 | JavaScript | vji-axelor/axelor-react-app | /component/FieldList.js | UTF-8 | 2,560 | 2.53125 | 3 | [] | no_license | import React from "react";
import axios from "axios";
class FieldList extends React.Component {
constructor(props) {
super(props);
this.onChangeHendler = this.onChangeHendler.bind(this);
this.submitHandler = this.submitHandler.bind(this);
this.state = {
fieldData: [],
model: ""
}... | true |
044f94fbed5314801772826354202a8952cd0a03 | JavaScript | FrendEr/gitlab-hooks-service | /libs/data-parser.js | UTF-8 | 789 | 2.65625 | 3 | [] | no_license | /**
* gitlab 接口数据解析器
* 输出:tag 信息、分支信息、版本号信息
*/
module.exports = (data) => {
const type = data.event_name; // 'push' | 'tag_push'
const ref = data.ref; // 'refs/heads/daily/0.0.1' | 'refs/heads/master' | 'refs/tags/publish/0.0.1'
const after = data.after;
const userEmail = data.user_email;
cons... | true |
d1ffa31f2e588babccc90af52672a02670a69fcc | JavaScript | radswiat/game-vanillajs-shaders | /bin/app/comp/userInputSettings.comp.js | UTF-8 | 1,295 | 2.640625 | 3 | [] | no_license | define(['app'], function(app){
var UserInputSettings = new Class({
initialize : function(){
this.$element = $('#canvas-tools');
},
register : function(name, type, value, range){
var tpl = '';
switch(type){
case 'checkbox':
tpl = $('<div class="toolitem slideThree"><input id="slideThree" type=... | true |
468e6460dd300d54d6d89a109a53669ba908fd62 | JavaScript | AgataLi/CityOfLodz | /src/App.js | UTF-8 | 5,513 | 2.625 | 3 | [] | no_license | import React from "react";
import ListOfPlaces from "./ListOfPlaces";
import Header from "./Header"
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
//properties of my places
places: [{
"name": "Cinematography Museum",
"type": "museum",
"la... | true |
e538b4b5449aa4971a4f0e7bf83bf0b742fcc5e3 | JavaScript | FranciscoBarafani/barberTurns | /screens/Turn.js | UTF-8 | 3,486 | 2.734375 | 3 | [] | no_license | import React, { useState } from "react";
import { View, StyleSheet, Linking } from "react-native";
//Components
import { Button, Input, Image } from "react-native-elements";
import TurnPicker from "../components/TurnPicker";
import image from "../assets/3388270.png";
export default function Turn() {
const [name, set... | true |
96a23c280b06b669452fa577e1279adb64a28455 | JavaScript | cionman/base-javascript | /012_프로퍼티_어트리뷰트/003_데이터_프로퍼티와_접근자_프로퍼티.js | UTF-8 | 821 | 3.828125 | 4 | [] | no_license | //003 데이터 프로퍼티와 접근자 프로퍼티
/*
- 프로퍼티는 데이터 프로퍼티와 접근자 프로퍼티로 구분할 수 있다.
데이터 프로퍼티
- 키와 값으로 구성된 일반적인 프로퍼티, 지금까지 살펴본 모든 프로퍼티는 데이터 프로퍼티다.
접근자 프로퍼티
- 자체적으로 값을 갖지 않고 다른 데이터 프로퍼티의 값을 읽거나 저장할 때 호출되는 접근자 함수로 구성된 프로퍼티다.
*/
const person = {
name: 'Lee'
};
console.log(Object.getOwnPropertyDescriptor(person, ... | true |
6f712b858445da46ec1eb58514448e36ef34e007 | JavaScript | zhang1pr/AdventOfCode.js | /2015/3A.js | UTF-8 | 638 | 3 | 3 | [
"MIT"
] | permissive | const fs = require('fs');
const input = fs.readFileSync(0, 'utf8').trim();
const dmap = new Map([['v', [1, 0]],['>', [0,1]],['^', [-1, 0]],['<', [0,-1]]]);
const readnum = (a) => (a.match(/\d+/g) || []).map(a => Number(a));
const readnum2d = (a) => a.split('\n').map(a => readnum(a));
const readword = (a) => a.split('\n... | true |
eea7d78b8e25afba70b3f263148e7dcf5ce7adc4 | JavaScript | rayzlui/l33t_code | /longestNiceSubstring.js | UTF-8 | 1,057 | 3.640625 | 4 | [] | no_license | //From 1763 in LeetCode
/**
* @param {string} s
* @return {string}
*/
function longestNiceSubstring(s) {
let dp = new Array(s.length).fill(1).map(x => [new Set(), new Set()]);
//dp[i][0] = needs to be empty, dp[i][1] will be matched
let result = '';
for (let i = 0; i < s.length; i++) {
let letter = s[i]... | true |
334c7073deab7365122882a9adf168f111d88170 | JavaScript | utrecht-discord/ttcraft-algemeen | /commands/ban.js | UTF-8 | 1,182 | 2.609375 | 3 | [] | no_license | const discord = require("discord.js");
module.exports.run = async (bot, message, arguments) => {
var banUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(arguments[0]));
if (!banUser) return message.channel.send("Speler niet gevonden.");
var reason = arguments.join(... | true |
5249fa35e6cc9ccf61bf0a18d6611b6fb8830c7e | JavaScript | zhangqian1014/mayi | /libs/js/font-size.js | UTF-8 | 372 | 2.625 | 3 | [] | no_license |
(function(window){
var winW = document.documentElement.clientWidth || document.body.clientWidth;
document.documentElement.style.fontSize = winW / 10 + "px";
window.onresize = function(){
var winW = document.documentElement.clientWidth || document.body.clientWidth;
document.documentElement.s... | true |
aec17fcb2310c92e0a0ee604defec701f9b54128 | JavaScript | CassieBoyd/pro-plan | /src/components/Projects/ProjectForm.js | UTF-8 | 3,458 | 2.65625 | 3 | [] | no_license | import React, { Component } from "react";
import ProjectManager from "../modules/ProjectManager";
import ActionBar from "../Nav/ActionBar";
// import './ProjectForm.css'
class ProjectForm extends Component {
state = {
ProjectName: "",
dueDate: "",
startDate: "",
userId: Number(localStorage["userId"])... | true |
e7434c3ca7d27687160206f26490be24fdbb0037 | JavaScript | LeydiVelazco/testing-backend-project | /controllers/3_calidadAtencion/contactos/enviarCredenciales.js | UTF-8 | 2,155 | 2.546875 | 3 | [] | no_license | 'use strict'
const axios = require('axios')
const bcrypt = require('bcrypt')
module.exports = async (db, req, res) => {
const { idContacto } = req.params
const { correoClient, contraseniaDefault } = req.body
const encriptContrasenia = await bcrypt.hash(contraseniaDefault, 10)
// registrar al usuario maestro(... | true |
719045f82c63b94dfb0d797eaa1b5dafddddccbf | JavaScript | surya-trv-13/React-KT | /src/App.js | UTF-8 | 863 | 2.8125 | 3 | [] | no_license | import "./styles.css";
// import { ClassComponent } from "./component/ClassComponent";
// import StateExample from "./component/StateExample";
// import LifeCycleExample from "./component/LifeCycleMethods";
// import Functional from "./component/Functional";
import Component1 from "./component/Component1";
import Compo... | true |
8ba756bfa713cf05aa8d92e58e6f8754501392a3 | JavaScript | sree-bh/sample | /sample1.js | UTF-8 | 414 | 3.765625 | 4 | [] | no_license | function Shape(width, height) {
this.width = width;
this.height = height;
}
Shape.prototype.display = function () {
return this.width * this.height;
}
let shape = new Shape(34, 45);
console.log(shape.display());
function Rectangle(width, height) {
Shape.call(this, width, height);
}
Rectangle.prototype = O... | true |
d10ba7d984576c4e85bbe1ca9f2e4de51b6c5420 | JavaScript | DIYgod/RSSHub | /lib/routes/pediy/utils.js | UTF-8 | 1,131 | 2.765625 | 3 | [
"MIT"
] | permissive | const pediyUtils = {
dateParser: (html, timeZone) => {
let math;
let date = new Date();
if (/(\d+)分钟前/.exec(html)) {
math = /(\d+)分钟前/.exec(html);
date.setMinutes(date.getMinutes() - math[1]);
return date.toUTCString();
} else if (/(\d+)小时前/.exec(h... | true |
45fb46007d400abee9c757914a66fac7debcbc61 | JavaScript | zubbkova/zubbkova.github.io | /jscharts/script/Holidays.js | UTF-8 | 3,803 | 2.71875 | 3 | [] | no_license | /* global Calendar */
/**
* --------
* Holidays
* --------
*/
var Holidays = new Object();
/** @static */
Holidays.holidayList = new Object();
/** @static */
Holidays.holidayListWeekend = new Object();
/** @static */
Holidays.advfnUrl = 'https://rpc.advfn.com/latest/holiday/history/getData.json?';
/**
* @param {st... | true |
a43b5c1a0df83b7214ddd14fc21cc9d0fa001879 | JavaScript | andrewbraunsdorf/nodejs | /app.js | UTF-8 | 4,582 | 2.625 | 3 | [] | no_license | var express = require("express");
var todocontroller = require("./controllers/todocontroller");
var app =express();
//set up template engine
app.set("view engine", "ejs");
//static files
////Didn't work as NN listed
// app.use(express.static("./public"));
app.use('/public', express.static('public'));
//fire control... | true |
a03de103d20998adf41b75d5f7b526ccee9cb197 | JavaScript | kaixinrenweb/promise-generator-async-await | /test/test_2.js | UTF-8 | 592 | 2.75 | 3 | [] | no_license | let Promise = require("../2. MyPromise_v2");
const promise = new Promise((resolve, reject)=>{
resolve(123);
});
let promise2 = promise.then(data=>{
console.log(data, 'success-1111');
// return {dd:111};
// return new Promise((resolve,reject)=>{
// setTimeout(_=>{
// resolve(222);
... | true |
01705094ef29c5b40aae11710eecf1cccacce27c | JavaScript | jshockness/jsdom-task-lister-lite-nyc-clarke-web-071519 | /src/index.js | UTF-8 | 1,487 | 3.53125 | 4 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | document.addEventListener("DOMContentLoaded", () => {
// your code here
// As a user, I should be able to type a task into the input field.
// As a user, I should be able to click some form of a submit button.
// As a user, the task string that I provided should appear on the DOM after the submit button h... | true |
5d885b74b47eb5584ff182195900f8f7943c7e92 | JavaScript | ceciliachung/algoDiary | /173_Binary_Search_Tree_Iterator.js | UTF-8 | 1,222 | 3.875 | 4 | [] | no_license | class Iterator {
constructor(root) {
this.stack = [[root, 0]];
}
hasNext() {
return this.stack.length !== 0;
}
next() {
let returnedVal;
// While the top of the stack has visited !== 1
while (this.stack.length !== 0 && this.stack[this.stack.length - 1][1] !== 1) {
let [node, visit... | true |
36f9728c2989b4fc4039463bc1aced668f3896e9 | JavaScript | casvil/educare | /client/src/QuestionContainer/index.js | UTF-8 | 2,557 | 2.546875 | 3 | [] | no_license | import React, { Component } from 'react'
import './style.css'
const styles = {
question: {
backgroundColor: 'rgba(255, 255, 255, 0.2)',
width: '100%',
display: 'flex',
flexDirection: 'row',
marginTop: 50,
marginRight: 50,
marginLeft: 50,
borderRadius: 40,
border: 'none',
borde... | true |
9e72d779f53e78d3530764f7efd1388f8f25a6f9 | JavaScript | andreykishtov/WebProjects | /React/reactTasklist/tutorialnewcomponent/src/components/NewTask/index.js | UTF-8 | 807 | 2.75 | 3 | [] | no_license | import React, { Component } from 'react';
export default class newTask extends React.Component {
constructor(props) {
super(props);
this.state = { taskName: '' };
this.handleAddClick = this.handleAddClick.bind(this);
}
handleTaskChange(e) {
this.setState({ taskName: e.targe... | true |
a965afe7c5ed308b747577ec2cc429a6a54ec2e4 | JavaScript | TedkoTs/100-Algorithms | /circleOfNumbers.js | UTF-8 | 675 | 4.34375 | 4 | [] | no_license | // Consider integer numbers from 0 to n - 1 written down along the circle in
// such a way that the distance between any two neighbouring numbers is equal
// (note that 0 and n - 1 are neighbouring, too).
// Given n and firstNumber, find the number which is written in the radially opposite position to firstNumber.
//... | true |
d89e15bb0305b265d4ddf39661c487fa19313229 | JavaScript | ultimatecrispy/js-advanced-scope-closures-lab-v-000 | /index.js | UTF-8 | 357 | 2.859375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | function produceDrivingRange(blockRange){
return function(start, finish){
let distance = parseInt(finish) - parseInt(start);
return distance <= blockRange ? `within range by ${blockRange - distance}` : `${distance - blockRange} blocks out of range`;
}
}
function produceTipCalculator(tip){
return function... | true |
3da9727ac0c9e2f18a08cbf06147ed999641ee0c | JavaScript | YitingCai1005/D3_Force_Plot | /plot.js | UTF-8 | 3,299 | 2.71875 | 3 | [] | no_license |
var width = 500,
height = 500;
var simulation = d3.forceSimulation()
.force("link", d3.forceLink().id(function(d) { return d.id; }).distance(100))
.force("charge", d3.forceManyBody())
.force("center", d3.forceCenter(width / 2, height / 2));
var buttonNames=['Red','Green']
function plotV... | true |
1f821d728025ca16c746314fe60aa3b548b5293f | JavaScript | hyunsu0224/NodeJs | /day4/web2-nodejs/syntax/object2.js | UTF-8 | 451 | 4.4375 | 4 | [] | no_license | //객체지향형
//데이터, 데이터를 처리하는 방식이 프로그래밍
//배열, 객체를 이용해서 데이터를 처리한다.
//여기서 데이터가 많아지면 함수를 이용한다.
var f = function(){
console.log(1+1);
console.log(1+2);
}
console.log(f);
f();
var a = [f];
a[0]();
var o = {
func:f
}
o.func();
// var i = if(true){
// console.log(1)
// }
// var w = while(true){
// consol... | true |
3cf03899945767f6116d80c13ae3733073af88f8 | JavaScript | jasontrip/word-counter | /controllers/text.controller.js | UTF-8 | 822 | 2.78125 | 3 | [] | no_license | const User = require('../models/users.model')
const google = require('../external-apis/google-api')
const oxford = require('../external-apis/oxford-api')
exports.lookupWord = (req, res) => {
const {searchWord} = req.body
let user, oxfordResults
oxford(searchWord)
.then(results => {
res.status(200).json(resu... | true |
3daf69754e2f222c225386a08a0eb28ed04c3178 | JavaScript | csandlin-CI/Bayesian-Calculator | /src/components/TableRow.jsx | UTF-8 | 3,689 | 2.65625 | 3 | [] | no_license | import React, { useContext, useEffect, useState } from "react";
import { APIContext } from "./API";
import { Link } from "react-router-dom";
export const TableRow = ({ metricData, outerLoopKey, iteration }) => {
const { bayCalc, getBayCalc } = useContext(APIContext);
const [bayesianNums, setBayesianNums] = useStat... | true |
80b55e96244b3a964b37418f56f30ac759c4542a | JavaScript | sakibcc/todolist | /js/data.js | UTF-8 | 845 | 3.1875 | 3 | [] | no_license | //负责数据操作
var Data = function (list){
//保存todolist的数据
this.datalist = list;
};
Data.prototype = {
getItem : function (newItem) {
this.datalist.push(newItem);
this.saveData(this.datalist);
},
//index:数据的data-index
delItem : function (index) {
if(!index || !this.datalist[index]) return;
this.datalist.spli... | true |
bd48a08682fbe762c6c05964f39ea30f0b15f22f | JavaScript | QinBrother163/FtenlogCenter | /pages/VoucherMain/voucherMain.js | UTF-8 | 2,926 | 2.515625 | 3 | [] | no_license | // pages/VoucherMain/voucherMain.js
let volumeDatas = require('../../logic/data/volumeDatas.js');
var network = require("../../http/netUrl.js");
Page({
/**
* 页面的初始数据
*/
data: {
currentTab: 0,
validList:[],//有效期的list
notValidList:[],//已过期
usedList:[],//已使用,
notValidStart:0,//已过期起点
used... | true |
b7f8cf4b3d9fb49b66dc3acc8e440760505395bf | JavaScript | ecsalunga/ExpressJS | /server.js | UTF-8 | 1,746 | 2.625 | 3 | [] | no_license | // DB
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost:27017/sample');
var db = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error:'));
db.once('open', function() {
console.log("Connected to MongoDB");
});
// models
var userSchema = mongoose.Schema({
nam... | true |
992cd3bee6805293a608fc0cb348d5acfe26977c | JavaScript | angeliglesias7/blog | /React/src/components/authentication/index.js | UTF-8 | 2,694 | 2.671875 | 3 | [] | no_license | import React, { Component } from "react"
import PropTypes from 'prop-types'
const AuthContext = React.createContext()
export class AuthenticatedApp extends Component {
constructor(){
super()
this.state = {
authenticated: false,
user : {},
error: {}
}... | true |
0b16a7b9a48ec1ede2eba4d81ba89f2aed60b26d | JavaScript | wangtao0101/leetcode-problem-types | /template/581.js | UTF-8 | 287 | 2.78125 | 3 | [
"MIT"
] | permissive | /*
* @lc app=leetcode.cn id=581 lang=javascript
*
* [581] 最短无序连续子数组
*/
// @lc code=start
/**
* @param {number[]} nums
* @return {number}
*/
var findUnsortedSubarray = function(nums) {
};
// @lc code=end
//* Testcase Example: '[2,6,4,8,10,9,15]' | true |
f390b4b5f89cd7a74a7dd7996164d23fdf9cc0d7 | JavaScript | Boilesen/Project-Ironhacker | /game.js | UTF-8 | 7,573 | 2.734375 | 3 | [] | no_license | const titles = [
"Noob",
"Gamer",
"Computer-Vampire",
"Pull stacker",
"Front-ender",
"Back-ender",
"Magician",
"Full-Stacker",
"Obnoxious ",
"Little Know All Bastard",
];
const intro =
"You want to became a full-stack developer and own the next Unicorn StartUp. With that in mind you choose tho in... | true |
6438cbe1067f0381fe7bb06f93eb638d1381c1cb | JavaScript | JonathanLiu25/technical-interview-prep | /algorithms/8-extra/YDKJS/whatIsThis/nameTheTypes.js | UTF-8 | 1,262 | 4.65625 | 5 | [] | no_license | /*
During Foundations, you learned the four ways that 'THIS' is bound
1 - default binding
2 - implict binding
3 - explicit binding
4 - new binding
Come up with examples for each type of binding and even better, for how they
interact/override each other
*/
// DEFAULT binding
function foo(){
console.log(this.... | true |
d4136a295f9846f0b898f1de50fdc0b984303687 | JavaScript | shibuwilson36/TestYantra-ELF-13-Dec-Shibu-Wilson | /TestYantraReact/JavaScriptAssignment/Assignments2/Factorial/factorial2.js | UTF-8 | 115 | 3.484375 | 3 | [] | no_license | var fact=function (x) {
if(x==0){
return 1;
}
return x*fact(x-1);
}
console.log(fact(5));
| true |
b4e08dacd07db70420f388fc84f36a2e18e57b9f | JavaScript | alexhawkins/JavaScript-DataStructures | /searching/binarySearchIt.js | UTF-8 | 1,107 | 4 | 4 | [] | no_license | var binarySearch = function(needle, haystack) {
var low = 0,
high = haystack.length - 1;
haystack.sort(function(x, y) {
return x - y;
});
while (low <= high) {
//set middle point
var middle = Math.floor((low + high) / 2);
if (needle === haystack[middle])
... | true |
7147853aa5a90e0b5cdaf2217b73fba2a30b5b58 | JavaScript | codedoll/flatpress | /app/assets/javascripts/app.js | UTF-8 | 252 | 2.640625 | 3 | [
"MIT"
] | permissive | $(document).ready(function() {
var now = moment();
$( ".hr12" ).each(function( index ) {
console.log( $( this ).text() );
var dt = $(this).text()
console.log(moment(dt).format('DD-MM-YY'));
});
// console.log($( ".hr12" ).html());
}); | true |
f6652cd260e93a927b296f02268c750748a2c212 | JavaScript | KadenN2019/Function-Practice | /arrays.js | UTF-8 | 2,532 | 4.3125 | 4 | [] | no_license | // ---------------------------
// The Arrays You Will Work With
// ---------------------------
var numbers = [1,12,4,18,9,7,11,3,101,5,6];
var strings = ['this','is','a','collection','of','words'];
var instructors = [
{ firstname : 'JD', teaches : 'JavaScript'},
{ firstname : 'Tim', teaches : 'JavaScript'},
... | true |
da41d5a529e8c89167768c4d013675bd8f52be61 | JavaScript | courtamos/spinner | /spinner2.js | UTF-8 | 456 | 3 | 3 | [] | no_license | const spinner2 = function(write, time) {
setTimeout(() => {
process.stdout.write(write);
}, time);
};
spinner2('\r| ', 100);
spinner2('\r/ ', 300);
spinner2('\r- ', 500);
spinner2('\r\\ ', 700);
spinner2('\r| ', 900);
spinner2('\r/ ', 1100);
spinner2('\r- ', 1300);
spinner2('\r\\ ', 1500);
spin... | true |
49f29c61ab6ab370e72fb9c6e4b797fbfa1fcf54 | JavaScript | rotimi-babalola/sliding-puzzle-game | /client/src/utils/swap.js | UTF-8 | 866 | 2.96875 | 3 | [] | no_license | import { EMPTY_TILE, NUM_OF_COLS } from '../constants';
export const getMatrixPosition = (index, cols) => ({
row: Math.floor(index / cols) + 1,
col: (index % cols) + 1,
});
const canSwap = (gridIndex, emptyTileIndex) => {
const { row: srcRow, col: srcCol } = getMatrixPosition(
gridIndex,
NUM_OF_COLS,
... | true |
56f86996a0ef3499a260a3bcdc4a4a7e64e2a3a7 | JavaScript | ecae11/GestCamp | /src/utils.js | UTF-8 | 321 | 3.15625 | 3 | [
"MIT"
] | permissive | function columnToLetter(column) {
let temp = '';
let letter = '';
while (column > 0) {
temp = (column - 1) % 26;
letter = String.fromCharCode(temp + 65) + letter;
// eslint-disable-next-line no-param-reassign
column = (column - temp - 1) / 26;
}
return letter;
}
export default columnToLetter;... | true |
dcd576fde716d77b02cdd189a5494d67002ac4d0 | JavaScript | octoccoper/task-groupWeeks | /solution.js | UTF-8 | 483 | 3.265625 | 3 | [] | no_license | function groupWeeks(data) {
let groupedDate = [];
data.forEach(element => {
let currentArrDate = new Date(element.date);
if (currentArrDate.getDay() === 1) {
console.log("day of the week: Monday!", currentArrDate.getDay());
groupedDate.push(element.date);
}
console.log("date", current... | true |
94254b6265f56c951651ce3fe9fe8f68ffabb322 | JavaScript | mehakghous/assignment17-25 | /app.js | UTF-8 | 43,724 | 4.15625 | 4 | [] | no_license | // CH :1 ALERTS
// 1. Write a script to greet your website visitor using JS alert box.
// alert("Welcome");
// 2. Write a script to display following message on your web page:
// alert("Error! please enter valid password");
// 3. Write a script to display following message on your web page: (Hint : Use line break)
/... | true |
f28885fc37c0e30e61e4b81a16749c4deb5edb43 | JavaScript | vukanmrvaljevic/Barc-Shelter | /client/src/components/adoptionProcess/AdoptionProcessApt/TimeButton/TimeButton.jsx | UTF-8 | 1,061 | 2.59375 | 3 | [] | no_license | import React, { useState, useEffect } from 'react'
import "./TimeButton.css"
const TimeButton = ({ date, time, datetime, buttonStatus, timesClicked, updateTimesClicked, updateApplicant, applicant }) => {
const [buttonState, setButtonState] = useState();
useEffect(() => {
setButtonState(buttonStatus);
}, [b... | true |
774aaadc44884f9f10b8b027b9a90a731e0e8a85 | JavaScript | hussain-bk/rmsProject | /src/components/GroupItem.js | UTF-8 | 1,932 | 2.625 | 3 | [] | no_license | // Created by Hussain Bk
// (hussain.bk@outlook.com)
// 17 March 2020
import React from 'react';
import firebase from "../firebase";
import Typography from '@material-ui/core/Typography';
import IconButton from '@material-ui/core/IconButton';
import DeleteIcon from '@material-ui/icons/Delete';
import Snackbar from '@m... | true |
77be704fbc358621801140d779fc1aebf0ad27cc | JavaScript | Sangiv/To-Do-List-Web-App | /src/main/resources/static/JS/main.js | UTF-8 | 2,588 | 3.109375 | 3 | [
"MIT"
] | permissive | fetch('http://localhost:8901/tasklist/readAll/')
.then(
function(response) {
if (response.status !== 200) {
console.log('Looks like there was a problem. Status Code: ' +
response.status);
return;
}
// Examine the text in the response
response.json().then(function... | true |
656737ede65341be82fa66a216bb69d7e0dfb019 | JavaScript | WoozChucky/ZastBeacon | /node-ble/Sockets/client.js | UTF-8 | 4,408 | 2.765625 | 3 | [] | no_license | /**
* Zast Beacon
*
* Filename: client.js
* Author: Nuno Silva (NB22477)
* Date: 2017/09/26
* Copyright (c) 2017 CityPulse
*/
/* jshint esversion: 6 */
var net = require('net');
var EventEmitter = require('events').EventEmitter;
var utils = require('util');
var SocketConfiguration = require('./..... | true |
1b78fc0bb18a4725d3e537aafdecd37a49cc83b0 | JavaScript | kanglitch/PRO-C-41 | /sketch.js | UTF-8 | 670 | 2.53125 | 3 | [] | no_license | var umbrella,bruce,bruceimg,th1,th2,th3,th4,th;
function preload(){
bruceimg.loadAnimation("walking_1.png","walking_2.png","walking_3.png","walking_4.png","walking_5.png","walking_6.png","walking_7.png","walking_8.png")
th1.loadImage("1.png")
th2.loadImage("2.png")
th3.loadImage("3.png")
th4... | true |
4770b78644140a28ef841f425d62a53ed8aeca00 | JavaScript | marina-rovchenya/Hometasks | /ht12/dz121/script.js | UTF-8 | 5,970 | 2.75 | 3 | [] | no_license | const Routes={
"#home":{
path:"home.html"
},
"#converter":{
path: "converter.html",
handler: function(){
var div = document.getElementById('text');
const xhr = new XMLHttpRequest();
xhr.open('GET', 'data.txt', true);
xhr.onload = function(){
div.innerHTML=this.responseText;
const list1=docu... | true |
d590e17b877ce89c56154b6c2f049a751d9761e0 | JavaScript | 13uilding/Act-5-20-Calculator | /javascript.js | UTF-8 | 1,861 | 3.828125 | 4 | [] | no_license | var firstNumberFill = true;
var operatorField = $("#operator");
const math_it_up = {
'+': function (x, y) { return x + y },
'-': function (x, y) { return x - y },
'*': function (x, y) { return x * y },
'/': function (x, y) { return x / y },
'**': function (x, y) { return x ** y },
};
$(document).ready(functi... | true |
9faa8585cbb754fdba4a03d330c754e9e91f6090 | JavaScript | Vasil-Hadzhiev/JS-Core | /JS Fundamentals/Objects and JSON/Lab/04.SumByTown.js | UTF-8 | 348 | 3.640625 | 4 | [] | no_license | function getSum(array) {
let towns = {}
for (let i = 0; i < array.length; i += 2) {
let town = array[i]
let income = Number(array[i + 1])
if (towns.hasOwnProperty(town)) {
towns[town] += income;
} else {
towns[town] = income;
}
}
console.... | true |
8db0f8dfb30aeaa44ae25873738e1dd27cbcde54 | JavaScript | ishrataraamin09/online-course | /src/Components/Cart/Cart.js | UTF-8 | 674 | 2.546875 | 3 | [] | no_license | import React from 'react';
import './Cart.css'
const Cart = (props) => {
const cart = props.cart ;
const totalPrice = cart.reduce((total, crse) => total+crse.price , 0) ;
const tax = (totalPrice / 10).toFixed(2) ;
const grandTotal = (totalPrice + Number(tax)).toFixed(2) ;
return (
<div>
... | true |
ae4e29c374b786cbf9966d22b2ac39329476d559 | JavaScript | anubhavcu/pathfinding-visualizer | /src/PathfindingVisualizer/NavBar.jsx | UTF-8 | 4,148 | 2.609375 | 3 | [] | no_license | import React, { Component } from "react";
class NavBar extends Component {
render() {
return (
<React.Fragment>
<nav className="navbar navbar-dark bg-dark mb-3 mw-100">
<a href=".">
<h3 className="text-white">PathFinding Visualizer </h3>
</a>
<div
... | true |
9eb0b1bc98f5b9a66b456fbebb558055fcfcfd0e | JavaScript | Bivis-s/EDU-WEB-NobodyLikesScorpius-Web-Api | /WebApiSite/wwwroot/scripts/get_params_from_url.js | UTF-8 | 392 | 2.734375 | 3 | [] | no_license | function getParamFromUrl(param) {
let params = window
.location
.search
.replace('?', '')
.split('&')
.reduce(
function (p, e) {
let a = e.split('=');
p[decodeURIComponent(a[0])] = decodeURIComponent(a[1]);
return p... | true |
2c3cb7491b8c177395fbdeb3e291f627700f849a | JavaScript | Cebulinho/WAR_FRO_W_07_JavaScript_prework-master | /3_Operatory/script.js | UTF-8 | 818 | 4.1875 | 4 | [] | no_license | // Zadanie 1.
var nieprawda = false
console.log (nieprawda);
var prawda = true
console.log (prawda);
// po porównaniu prawda == nieprawda konsola pokazala "false"//
//Zadanie 2.
var liczba_1 = 8;
var liczba_2 = 7;
var resultModulo = 0
resultModulo = liczba_1 % liczba_2
console.log(resultModulo);
//Zadanie 3.
v... | true |
a733374e3427f72b0e9fb26a5c03ec76551b9941 | JavaScript | WardLIN/busCity | /js/global.js | UTF-8 | 7,708 | 2.515625 | 3 | [] | no_license | function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
}
}
}
//右边窗口商品数量按钮加减事件
function buyNumChangeBtn(){
//右边窗口数量加减组件
var oBtnPlus=$("button.g... | true |
05ef171f05865013eaa3aaee304706f34cc1f3c7 | JavaScript | OutsourcedGuru/octo-client | /index.js | UTF-8 | 10,437 | 2.640625 | 3 | [
"MIT"
] | permissive | var config = require('./config');
const dns = require('dns');
var http = require('http');
// --------------------------------------------------------------------------
// This is the section for helper function(s).
// --------------------------------------------------------------------... | true |
baa3d061ac8aa935b030f8c6e5b551193f3cd73f | JavaScript | cognitivehacker/js-cool-math | /src/helper/graph-line.js | UTF-8 | 473 | 2.625 | 3 | [
"MIT"
] | permissive | export default {
color:'white',
draw(context, lineArray, maxLineArray, graphLineX, pY ){
lineArray.unshift(pY)
if( lineArray.length > maxLineArray )
lineArray.pop()
let groupIndex = 0
for ( let index = 0 ; index < lineArray.length; index++ ){
context.fillStyle = this.color
conte... | true |
0723725c4e2dcbf9274b8fc022e3b5fa7c0d713e | JavaScript | tehTerminator/ngBilling | /core/js/controllers/PaginationController.js | UTF-8 | 2,639 | 2.671875 | 3 | [] | no_license | app.controller('PaginationController', function($scope){
$scope.currentPage = 0;
$scope.pageLength = 5;
$scope.totalPages = 0;
$scope.pageSizes = [5, 10, 15, 20, 25, 50];
$scope.pageArray = [];
$scope.lastActivePage = 0;
$scope.totalItems = 0;
$scope.searchText = "";
... | true |
8a888447a0eb91cc0fc5c612c09daaa255b36b7a | JavaScript | riyazgithub/recursion | /src/getElementsByClassName.js | UTF-8 | 657 | 3.828125 | 4 | [] | no_license | // If life was easy, we could just do things the easy way:
// var getElementsByClassName = function (className) {
// return document.getElementsByClassName(className);
// };
// But instead we're going to implement it from scratch:
var getElementsByClassName = function(className) {
var retArray = parse(document.b... | true |
22dc59eac97fd93a2bfe4d4f20adfa783b8c592d | JavaScript | vitorsch/webmoderno-js2020 | /exercicios-js/fundamentos/funcao1.js | UTF-8 | 360 | 4.09375 | 4 | [] | no_license | // Funcao sem retorno
function imprimirSoma(a, b){
console.log(a+b)
}
imprimirSoma(2,3)
imprimirSoma(2)// imprime NaN, pois b fica undefined
imprimirSoma(2, 3, 4, 5, 6, 7, 8)//pega apenas os dois primeiros
imprimirSoma()
// Funcao com retorno
function soma(a, b = 1){
return a + b;
}
console.log(soma(2, 3))
... | true |
359b80835713f6e16a635449f59ed58d88f22bd0 | JavaScript | lshafir/mud | /mudmaker/aux.js | UTF-8 | 5,530 | 2.75 | 3 | [
"BSD-2-Clause"
] | permissive | // This code adopted from Allen Liu on Random Snippets
// http://www.randomsnippets.com/2008/02/21/how-to-dynamically-add-form-elements-via-javascript/
var counter = [ 1 , 1 , 1, 1, 1, 1, 1, 1];
var nref = [ 0, 0, 0, 0 ];
var limit = 10;
function removeIt(elemId) {
var elem=document.getElementById(elemId);
... | true |
c5e5f06b86f5aefe8c64912f9726d4564e1fd220 | JavaScript | DanilaBeseda/workout_diary | /src/store/actions/muscleGroups.js | UTF-8 | 1,944 | 2.53125 | 3 | [] | no_license | import {
BIND_GROUPS_DATA,
CHANGE_CHACKED
} from '../constants/actionTypes'
import firebase from 'firebase/app'
import 'firebase/database'
export const bindGroupsDataToState = (data) => ({
type: BIND_GROUPS_DATA,
payload: data
})
export const changeChacked = (group) => ({
type: CHANGE_CHACKED,
payl... | true |
c9afd61b8602c275eb80bb0fc1a7adbc5d92a07e | JavaScript | RixonC/Genetic-Algorithm | /brain.js | UTF-8 | 1,222 | 3.453125 | 3 | [
"MIT"
] | permissive | class Brain {
constructor() {
this.mutationRate = mutationRate;
this.path = [];
this.randomizePath(initialPathSize);
this.step = 0;
}
getRandomDirection() {
return createVector(2*random()-1, 2*random()-1).normalize();
}
randomizePath(pathSize) {
... | true |
2ef8f9b5d67197820ab522d3471e3add6540ce23 | JavaScript | mickaelfsantos/webApp | /app.js | UTF-8 | 12,522 | 2.53125 | 3 | [] | no_license | //Módulos
const express = require('express')
const handlebars = require('express-handlebars')
const bodyParser = require('body-parser')
const app = express()
const user = require('./routes/user')
const userResponsavel = require('./routes/userResponsavel')
const path = require('path')
con... | true |
fb87b12e4e54e03995846abc21349fc22bcb1556 | JavaScript | ajgasca/Bamazon-App | /bamazonCustomer.js | UTF-8 | 3,794 | 3 | 3 | [] | no_license | const mysql = require("mysql");
const inquirer = require("inquirer");
var connection = mysql.createConnection({
host: "localhost",
port: 3306,
user: "root",
password: "Jack@Ryan92$",
database: "bamazon_db"
});
connection.connect(function (err) {
if (err) throw err;
displayMarketplace()... | true |
16436ea5684da4645462dd076e13a8b8d5154d2a | JavaScript | PerceptumNL/KhanLatest | /javascript/socrates-package/socrates.js | UTF-8 | 29,618 | 2.578125 | 3 | [] | no_license | Socrates = {};
// this should work with a QuestionView
Socrates.ControlPanel = Backbone.View.extend({
el: ".interactive-video-controls",
controls: [],
events: {
"click button#label": "addLabel",
"click button#inputtext": "addInputText"
},
addLabel: function() {
this.addVi... | true |
18596dd9d637d8384570995c54a70a1bb9b55a30 | JavaScript | shenyong2016/yueju | /assets/js/houseDetail.js | UTF-8 | 6,158 | 2.5625 | 3 | [] | no_license | $(function(){
// 房屋图片切换
$imgs = $('.house-imgs img');
$tabs = $('.house-tab li');
console.log($imgs.length);
var iNow = 0;
$('.house-container').hover(function(){
$('.left-btn, .right-btn').show();
}, function(){
$('.left-btn, .right-btn').hide();
});
$imgs.eq(0).addClass('selected');
$t... | true |
d8298115e1e7a99117467a3548b894bff6e79584 | JavaScript | adamjaks/brief-exchange | /js/main.js | UTF-8 | 5,553 | 2.671875 | 3 | [] | no_license | $(function() {
//js/currencies.js => currencyData || generating tiles to .currenncy-tiles
currencyData.forEach(function(tile) {
main.tileGenerator(tile)
});
//changing currency (.convert-form)
$('.currency-list-item').click(main.changeCurrency);
//currency list handling
$('.open-list... | true |
a975c753151c684d2ae7a33bade91243c531f543 | JavaScript | aksatyam/jwt-node-api | /index.js | UTF-8 | 1,262 | 2.53125 | 3 | [] | no_license | const express = require('express');
const app = express();
const jwt = require('jsonwebtoken');
const bodyParser = require('body-parser');
const { private_key } = require('./private_key')
app.use(bodyParser.json());
const authenticateJWT = async (req, res, next) => {
const { authorization, public_key } = req.head... | true |
72044afd344b785bfec741b06337757c276106dc | JavaScript | onuroztnc/erpSystem | /src/pages/Home.js | UTF-8 | 3,492 | 2.625 | 3 | [] | no_license | import React from 'react'
import { GridList, GridListTile, GridListTileBar, IconButton } from '@material-ui/core'
import "./Home.css"
import InfoIcon from '@material-ui/icons/Info'
import { makeStyles } from '@material-ui/core/styles';
import { useState, useEffect } from 'react';
import CocktailList from '../Component/... | true |
367ef426c95f280973595ea64eafa782960f03f1 | JavaScript | 278204/278204.github.io | /build.js | UTF-8 | 769 | 2.515625 | 3 | [] | no_license | var fs = require('fs')
const { build } = require('esbuild')
const src = './src'
const dest = './public'
handleDir('')
function handleDir(path) {
fs.readdirSync(src + path, { withFileTypes: true }).forEach(e => {
const filepath = path + '/' + e.name
if (e.isFile()) {
if (e.name.endsWith('.js')) {
... | true |
509ae8e9bc2c2b27caac76d89954e58194c1019b | JavaScript | abhijeet20h/JavaScript | /7.sortNumberArray.js | UTF-8 | 223 | 3.671875 | 4 | [] | no_license | var numbers = [2, 4, 10, 12, 1, 3]
// Sort in Ascending Order
numbers.sort(function(a,b){
return a -b;
})
console.log(numbers)
//sort in Decending Order
numbers.sort(function(a, b){
return b-a;
})
console.log(numbers) | true |
7cd815ce11aeced2c48c36e1612b4f3a6628f379 | JavaScript | jeremistadler/adventofcode | /13/index.js | UTF-8 | 1,104 | 3.1875 | 3 | [] | no_license | let [startStr, busesStr] = require('fs')
.readFileSync('./13/input', 'utf-8')
.split('\n')
.map(f => f.trim())
.filter(f => f.length > 0)
let busesRaw = busesStr.split(',')
let start = parseInt(startStr)
function part1() {
let buses = busesRaw
.map(timeStr => {
if (timeStr === 'x') return null
... | true |
03640dd51c99b5ae16213854270f23ca3d1963c9 | JavaScript | majda107/blaze-touch-issue | /WorkingJsExample/touch_test/script.js | UTF-8 | 1,228 | 3.359375 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded", e => {
setup()
})
var down = false
var lastx = 0
var lasty = 0
var movx = 0
var movy = 0
var rect = null
function mousedown(x, y) {
down = true
lastx = x
lasty = y
}
function mouseup() {
down = false
}
function mousemove(x, y) {
if (!down) retu... | true |
6d264daf6b3e837cf9eac71902b48bdb7b4c12e3 | JavaScript | anu-dam/TMC | /public/js/security.js | UTF-8 | 807 | 2.6875 | 3 | [
"MIT"
] | permissive | //******************************** */
// Checking user autherisation
//******************************** */
function isAdmin(cb) {
// call api to check user type
var validUser = false;
//******************************** */
// Getting user type
//******************************** */
$.ajax({
... | true |
c2a88e64c1723ea9ae6930f92ae21c86752a4f06 | JavaScript | jmartinez888/pric_otca | /modules/elearning/views/clase/js/pizarra/base.js | UTF-8 | 4,733 | 2.546875 | 3 | [] | no_license | var COLOR = $("#hiddenColor");
var HERRAMIENTA = $("#hiddenHerramienta");
var FUENTE = $("#hiddenFuente");
var TOOGLE = $("#hiddenClick");
var INOVER = $("#hiddenOver");
var CONTENEDOR_CONT = $("#leccion-contenido");
var CURSOR_HELPER = $("#cursor-helper"); var CV = $("#micanvas");
var COORD = { x1: CV.offse... | true |
5cd3c4983e31eb3e82deca32de61141ead276964 | JavaScript | andyhawks/comtncluborg | /web/themes/custom/em/_src/js/scroll-to-top-button.js | UTF-8 | 464 | 2.59375 | 3 | [
"MIT"
] | permissive | /**
* @file
* Scroll to top button.
*/
(($) => {
const scrollToTopButton = $('<a href="#top" class="scroll-to-top-button js-smooth-scroll" ' +
'onclick="return 0"><i class="fas fa-angle-up"></i></a>');
// Append button to <body>
$('body').append(scrollToTopButton);
$(window).scroll(() => {
$(win... | true |
944b997775b5ba76d7cf01f974b3badeee4a8289 | JavaScript | mefaba/Code-Particles | /Javascript/Modern_OOP.js | UTF-8 | 1,949 | 4.28125 | 4 | [] | no_license | //OOP-0
// factory function make/create
function createElf(name, weapon) {
//we can also have closures here to hide properties from being changed.
return {
name: name,
weapon: weapon,
atack() {
return 'atack with ' + weapon
}
}
}
const sam = createElf('Sam', 'bow');
const peter = createElf('... | true |
6778cdfcce61701f9523b2ff076f9cb84ff187a0 | JavaScript | FergusDevelopmentLLC/pies_fe | /src/components/LoginForm.js | UTF-8 | 1,611 | 2.515625 | 3 | [
"MIT",
"CC0-1.0"
] | permissive | import React, { useState, useEffect } from 'react'
import { login } from '../actions/userActions'
import { useSelector, useDispatch } from 'react-redux'
export const LoginForm = (props) => {
const [email, setEmail] = useState('')
const [password, setPassword] = useState('')
const [loginButtonDisabled, setLoginB... | true |
05b703c01878edf3d64a1dd04b8cf71c0a29762f | JavaScript | pdool/udacity-arcade-game-clone | /src/js/app.js | UTF-8 | 903 | 2.890625 | 3 | [] | no_license | import Enemy from "./Enemy.js";
import Player from "./Player.js";
import Prize from "./Prize.js";
import _ from "lodash";
//虫子大军
let allEnemies = [];
//构建虫子大军
_.times(3, function(n) {
//赛道1,2,3
let addY = n * 83;
_.times(2, function(n) {
let speedX = _.random(20, 200);
const enemy = new Enem... | true |
1ee429e0399d10385d70f6a501ea847118a65320 | JavaScript | koop212/prime-java-spike-petHotel | /src/redux/sagas/fetchAnimal.js | UTF-8 | 587 | 2.65625 | 3 | [] | no_license | // ===== FETCH ANIMALS SAGA ===== //
import {put, takeLatest} from 'redux-saga/effects';
import axios from 'axios';
// Adds new pet to the DB
function* fetchPet(action) {
try {
const response = yield axios.get(`/pets`);
console.log('addPet Response', response.data);
yield put({type: 'SET_PE... | true |
3e022bb214e038fa40ac9fd99ffc00b4ad941dae | JavaScript | sevkiyapici/DADU_DesignConcept_2021 | /studenti/sevkiyapici/dati.js | UTF-8 | 617 | 3.21875 | 3 | [
"CC0-1.0"
] | permissive | let w = 600;
let x = 120;
let y = 300;
let xx = [128,98,480,6,90];
let yy = [1,2,3,4,5];
function setup() {
createCanvas(w, w);
xx.push(550);
yy.push(550);
console.log(xx);
console.log(xx.length);
console.log(xx[2]);
}
function draw() {
background(200);
circle(x,y,24)
fill(8,32)
noStroke()
for(l... | true |
63df780324a384e77a851fa599eb7a853e522ea2 | JavaScript | AnyaSen/Products-app | /cypress/integration/examples/create_product_form.spec.js | UTF-8 | 2,065 | 2.703125 | 3 | [] | no_license | describe("CreateProductFormPage and ProductPage", () => {
const name = "Test";
const priceEuros = 2;
const priceCents = 99;
const pricePerKg = 13;
const description = "Some description.";
it("Creates a product", () => {
cy.visit("/create");
cy.get("[data-cy=submit-button]", { timeout: 20000 }).shou... | true |
d7e5685c46152acf69d865aeb24e5add0471b0db | JavaScript | michaeltamsil/learn-reactjs2 | /src/components/Timer.js | UTF-8 | 891 | 3.046875 | 3 | [] | no_license | import React, { Component } from 'react';
class Timer extends Component {
constructor(props){
super(props);
this.state = {
seconds: 0
}
}
componentDidMount() {
//console.log(`run componentDidMount`)
this.interval = setInterval( () => {
//onso... | true |
ddd42ea1aab4cc6bc60f0edcd97971c0e9aaea03 | JavaScript | ericamendez/Daily-Code-Challenges | /leetcode/easy/valid_palindrome.js | UTF-8 | 664 | 4.03125 | 4 | [] | no_license | /**
* A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers.
Given a string s, return true if it is a palindrome, or false otherwise.
*/
/**
... | true |