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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
5151a9f568a30e4da3c9ebaf718f9b393f136f18 | JavaScript | moezbj/react-app | /src/MovieCreator.js | UTF-8 | 1,761 | 2.5625 | 3 | [] | no_license | import React from 'react';
import CreateUpdateForm from './CreateUpdateForm'
class MovieCreator extends React.Component {
constructor (props) {
super(props)
this.state ={
isModalOpen: false,
movieTitle:'',
movieRating:0,
movieImage:''
}
}
onChangeTitle(event){
let newvalue=event... | true |
be41466ba2d2bf352d0ade2826248616e2e37740 | JavaScript | cameronjacoby/apartment_lab | /test/property_types/property_test.js | UTF-8 | 2,416 | 2.921875 | 3 | [] | no_license | var expect = require('chai').expect,
Property = require('../../src/property_types/property'),
Unit = require('../../src/unit'),
Manager = require('../../src/people/manager'),
Tenant = require('../../src/people/tenant'),
Person = require('../../src/people/person');
describe('Property', function(){
var avalon... | true |
1de303537d79c81ff9c25467ade9ebdb4ea4c920 | JavaScript | rjmpham/whatspass | /src/components/DisplayBox.js | UTF-8 | 7,696 | 2.859375 | 3 | [] | no_license | // eslint-disable-next-line no-unused-vars
import React, { useState, useEffect } from 'react';
//material ui for buttons
// eslint-disable-next-line no-unused-vars
import { makeStyles, MuiThemeProvider} from '@material-ui/core/styles';
import red from '@material-ui/core/colors/red';
import green from '@material-ui/core... | true |
a4364e8a37b73a9ba5af3026001cf73f9151717d | JavaScript | BrianLevin/React-Github-Finder | /src/components/users/Search.js | UTF-8 | 1,401 | 2.765625 | 3 | [] | no_license | import React, {useState} from 'react';
import PropTypes from 'prop-types'
const Search = ({searchUsers, showClear, clearUsers, setAlert})=> {
const[text,setText] = useState('');
// onsubmit subts data
const onSubmit = (e) => {
e.preventDefault();
// alert if user doesnt enter any user names
... | true |
7ace955b0a64f784a725665ca5a4cde2eb7eef55 | JavaScript | google/flatbuffers | /tests/ts/JavaScriptTestv1.cjs | UTF-8 | 13,921 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | // Run this using JavaScriptTest.sh
var assert = require('assert');
var fs = require('fs');
var flatbuffers = require('../../js/flatbuffers');
var MyGame = require(process.argv[2]).MyGame;
function main() {
// First, let's test reading a FlatBuffer generated by C++ code:
// This file was generated from monsterda... | true |
441defde64841042793a5202e7f3b736e75593c2 | JavaScript | CodeAstra/citizenMate | /www/js/services/currentUser.js | UTF-8 | 1,855 | 2.65625 | 3 | [] | no_license | angular.module('starter')
.factory('CurrentUser', function() {
var user = {
followingOfficials: [],
followingCategories: [],
upVotes: [],
downVotes: []
};
function removeElementFromArray(array, ele) {
var index = array.indexOf(ele);
if (index != -1) {
array.sp... | true |
fb129cd391beb1d7504742b03e7ba77259bbc432 | JavaScript | eduard4ck/kodAndMagic | /js/dialog.js | UTF-8 | 5,481 | 2.8125 | 3 | [] | no_license | (function () {
let dialogHandle = window.setup.setup.querySelector(`.upload`);
dialogHandle.addEventListener(`mousedown`, function (evt) { // перетаскивание окна setup по экрану
let setup = window.setup.setup;
let setupCoords = setup.getBoundingClientRect();
let dragged = false;
let shift = {
... | true |
9671cf3acbc3f1a200f78bd0c187c22f70eaaac4 | JavaScript | basv1996/CMD_Jaar2_blok1_FED | /scripts/video.js | UTF-8 | 1,957 | 2.578125 | 3 | [] | no_license | var arrowShowMore = document.querySelector("main section:nth-of-type(1) article > header > p");
var divShowMetadata = document.querySelector("main section:nth-of-type(1) article > div");
var sectionPublished = document.querySelector("main section:first-of-type > section");
var lastSection = document.querySelector("m... | true |
1d26aa4e6bca47c73a63285a839d5beb0ef8ad75 | JavaScript | pietow/spielwiese | /create_obj.js | UTF-8 | 519 | 3.953125 | 4 | [] | no_license | let player1 = {
score: 7
};
let player2 = Object.create(player1);
let player3 = Object.create(player1); // player2 --> score: 7
player2.score = 2;
player1.score = player3.score * 2; //player1 ---> score: 14 ---> player3 ---> score: 14
// console.log(player3.score); //score: 7
let marty = { location: 'Chicago... | true |
c302cdae08878a40db87fcb28f402504512317bb | JavaScript | DatKami/words-without-limits | /server/store.js | UTF-8 | 1,119 | 2.96875 | 3 | [] | no_license | import randomstring from 'randomstring'
let instance = null
export default class store {
constructor () {
if (!instance) {
instance = this
}
this.rooms = []
return instance
}
createRoom () {
let roomCode = ''
do {
roomCode = randomstring.generate({
length: 4,
... | true |
b8589922b48655daef73e65f14a9100150df9ccf | JavaScript | calbertts/treader | /handlers/pwd.js | UTF-8 | 686 | 2.59375 | 3 | [
"MIT"
] | permissive | (function() {
let lastDir = fullOutput.split('/')
lastDir = lastDir[lastDir.length - 1].trim()
let absDir = fullOutput
.replace(/\//gm, '[[slnc 200]]/')
.replace(/-/gm, '[[slnc 200]]-')
.replace(/_/gm, '[[slnc 200]]-').trim()
say({
text: {
es_ES: {
0: `Estás en el directorio: ${l... | true |
c6e0c12403430dbe326e06cb3ec3e41c8016870d | JavaScript | SagnjeevieN/Game-Project | /done.js | UTF-8 | 4,959 | 3.03125 | 3 | [] | no_license | var currentScene;
var getGrass;
var getHeart;
var getStar;
function setup(){
createCanvas(400, 400);
getGrass = loadImage("grass.png");
getStar = loadImage("star.png");
getHeart = loadImage("HEART-01.png");
drawScene1();
};
//star
var StarPic = function(x, y, size) {
image(getStar, x, y, size,... | true |
dd39c4c871f5eadf8f8f836638c2d31a4e2bff5a | JavaScript | ArtiomIV/moduleE2_homework | /E2.5/E2.5.js | UTF-8 | 163 | 3.171875 | 3 | [] | no_license | const ARRAY = [4, 5, 6, 12, 56, 3];
console.log('Length: ' + ARRAY.length)
for (let i = 0; i < ARRAY.length; i++) {
console.log('index: ' + ARRAY[i])
} | true |
b5d52a9dd2b8ca42a4daced3f160d37822f84d27 | JavaScript | cuishoulong/2020 | /封装/哔哩哔哩侧边栏/20200823基于原生JS精准还原B站“炫酷”楼层导航/js/index.js | UTF-8 | 13,906 | 2.984375 | 3 | [] | no_license | /*
* debounce:实现函数的防抖(目的是频繁触发中只执行一次)
* @params
* func:需要执行的函数
* wait:检测防抖的间隔频率
* immediate:是否是立即执行(如果为TRUE是控制第一次触发的时候就执行函数,默认FALSE是以最后一次触发为准)
* @return
* 可被调用执行的函数
*/
function debounce(func, wait = 100, immediate = false) {
let timer = null;
return function anonymous(...params) {
... | true |
0e3b76912e915d703e25183d6967302785a8fc47 | JavaScript | baihuibo/training-plan | /javascript 基础/data-type.js | UTF-8 | 1,010 | 3.796875 | 4 | [] | no_license | //Created by baihuibo on 2017/2/17.
// 基础类型数据
var str = "asdfasdfa";
var bool = true;
var num = 1;
var n = null;
var undef = undefined;
if ("a" == "a") {
console.log('true');
}
// 复杂类型对象
var reg = /adsfa/;
var obj = {id: 1};
/**
* 因为每一个复杂类型的对象,都是独立的,唯一的
*/
var a = /a/;
var b = /a/;
if (a == b) {
}
if (/a/ =... | true |
63d3d7276e35194d622661adbdff4c850f1d41c7 | JavaScript | javier-cloud/node-restserver | /server/models/usuario.js | UTF-8 | 1,701 | 2.90625 | 3 | [] | no_license | const uniqueValidator = require('mongoose-unique-validator');
const {Schema, model} = require('mongoose');
let rolesValidos = {
values: ['ADMIN_ROLE', 'USER_ROLE'],
message: '{VALUE} no es un role válido'
};
let usuarioSchema = new Schema ({
nombre: {
type: String,
// Es requerido (true), ... | true |
57db48b54a485e7d6c899a64b13de6247774339d | JavaScript | ersati/clickLogger | /index.js | UTF-8 | 435 | 3.125 | 3 | [] | no_license | function clickerLogger (event) {
event.preventDefault()
const atr = event.target
if(atr.getAttribute('src') || atr.getAttribute('href') || atr.tagName == 'BUTTON' ){
atr.getAttribute('class') != null ? console.log(`Class :${atr.getAttribute('class')}`) : null
atr.getAttribute('id') != nu... | true |
b7494f3017b91304802d3a44e4556dabc1c349e8 | JavaScript | kelseytobin/Bamazon | /bamazonManager.js | UTF-8 | 5,364 | 3.3125 | 3 | [] | no_license | //grab packages
var mysql = require("mysql");
var inquirer = require("inquirer");
var cTable = require("console.table");
//create connection information
var connection = mysql.createConnection({
host: "localhost",
port: 3306,
user: "root",
password: "Ktoby091589!",
database: "bamazonDB"
});
//... | true |
977b5e258284d1c797d4edd65bb3e29bd7f257bd | JavaScript | karthickram286/rest-api-to-pg | /resources/posts.js | UTF-8 | 1,230 | 2.8125 | 3 | [] | no_license | "use strict";
const axios = require('axios');
const { client } = require('../connection/postgres.connection');
let executePosts = async function() {
// Truncating the table first
truncateposts();
console.log('Started storing posts...');
try {
let postsResponse = await axios.get('https://jsonp... | true |
e9a896d61c32ad2eb754ad71b0117580c21e354b | JavaScript | FreddyProject/FreddyProject.github.io | /Machine_Learning_Simulator/js/Model/world/simulation/simulation.js | UTF-8 | 9,229 | 3 | 3 | [] | no_license | //Represents the Simulation scene
class Simulation extends World
{
/*----------CONSTANTS-----------*/
#minPopulation = 4;
#maxPopulation = 100;
#minGenerations = 2;
#maxGenerations = 100;
#purgePercentage = 0.8;
#mutateChance = 0.05;
/*----------END OF CONSTANTS-----------*/
#maxJu... | true |
898d078104d2c59c6f4a72dfdc5935fd573ca475 | JavaScript | cls720/projects | /zhc-cloud-vue/src/components/ZhcGpTable/mixin/title-cell-merge-mixin.js | UTF-8 | 2,603 | 2.734375 | 3 | [
"MIT"
] | permissive | export default {
computed: {
// 获取表头行合并的数量
getTitleRowspanTotalCount() {
let titleRowspanTotalCount1 = 0,
titleRowspanTotalCount2 = 0,
rowspanCountArr, minVal;
// 不能用noFrozenTitleCols 要用原始数据处理
this.noFrozenTitleCols.forEach(row => {
rowspanCountArr = this.getTit... | true |
cb970ae780056c5edd0edcc1002b3a3eb53c3d1a | JavaScript | irmen/Pyro4 | /examples/http/client.js | UTF-8 | 2,590 | 2.90625 | 3 | [
"MIT"
] | permissive | /**
Client side javascript example that talks to Pyro's http gateway.
You can run this with node.js.
**/
var http = require('http');
function obtainCharset (headers) {
// Find the charset, if specified.
var charset;
var contentType = headers['content-type'] || '';
var matches = contentType.match(/charset=([^;,... | true |
3f6736d49658c87b5214e18a431ead006fbb07c3 | JavaScript | seda-karadeniz/flappy-bird | /src/js/main.js | UTF-8 | 2,176 | 2.78125 | 3 | [] | no_license | import background from "./background";
import ground from "./ground";
import TubesPair from "./TubesPair";
import birdie from "./birdie";
import gameController from "./gameController";
const game = {
canvas: document.getElementById('game'),
context: null,
spriteSheetSrc: './resources/sprite.png',
sprite: new ... | true |
773d00f0858bcf733f9fcdea547cd0efdeed17a2 | JavaScript | martinmartinchan/fleader | /src/fleader.js | UTF-8 | 1,259 | 2.546875 | 3 | [
"MIT"
] | permissive | const { Future, pap, map, chain, resolve, parallel } = require('fluture')
const curryAssoc = (key) => (value) => (obj) => {
obj[key] = value
return obj
}
const futureAssoc = (key, value, obj) => {
return pap(obj)(pap(value)(pap(key)(resolve(curryAssoc))))
}
function transform (M) {
class ReaderT {
constr... | true |
a449cd90475d7b666246f66f7539016e061234c5 | JavaScript | m2mathew/unit-testing-functions | /tests/absVal.test.js | UTF-8 | 1,084 | 3.015625 | 3 | [] | no_license | "use strict";
var expect = require("chai").expect; // make assertions about the code
var absVal = require("../scripts/main.js").absVal;
describe("absVal", function() {
it("should exist", function() {
expect(absVal).not.to.be.undefined;
});
it("should throw an error if string input is specified", f... | true |
91e4965e240264b5efa29c62cd6d6c8b11806c55 | JavaScript | whichxjy/torrent-client | /test/bitfield.test.js | UTF-8 | 2,218 | 2.703125 | 3 | [] | no_license | const assert = require('assert').strict
const { describe, it } = require('mocha')
const bitfield = require('../lib/core/bitfield')
describe('bitfield', () => {
describe('#hasPiece()', () => {
const tests = [
{
result: bitfield.hasPiece(Buffer.from([]), 123),
expect: false
},
{
... | true |
5ad293e20ed348f1690b8b26cedabc7470272d81 | JavaScript | alexsoin/baSlider | /build/js/ba-slider.js | UTF-8 | 4,488 | 2.84375 | 3 | [] | no_license | function baSlider(id_slider) {
// Если на странице присутствует ползунок сравнения, можно его инициализировать, это хороший способ, чтобы предотвратить запуск кода, когда он не нужен
if ($(id_slider)[0]) {
let compSlider = $(id_slider);
// пройдемся по ползункам и инициализируем каждый из них
... | true |
10f3e25579a80ab017e373ac56183e2c0d690213 | JavaScript | Wilk-Wojnowicz-Kopczynska/Prostokaty | /Pseudokody/CzyMoze - wstępny szkic.js | UTF-8 | 773 | 2.96875 | 3 | [] | no_license | CzyMoze - wstępny szkic
Co funkcja dostanie:
- objekt Klocek
- PlanszaMain[][] // w zasadzie trzeba w ogóle by to imporotować do funkcji?
boollean CzyMoze(Klocek,PlanszaMain[][])
{
funkcja0=> czyJestWZasieguMapy() // -> w zasadzie ta funkcja może być użyta przy systemie ruchu, a nie tu
funckja1=> czy... | true |
4691d874fdf62e6fa2f7b7213d96f14d9a9abc2e | JavaScript | karinapichardo/websites-project | /scripts/coffee.js | UTF-8 | 853 | 3.671875 | 4 | [] | no_license | var i = 0;
var text = 'IF IT\'S FREE, IT\'S FOR ME!';
var speed = 40;
function typeWriter() {
if (i < text.length) {
document.getElementById("text-effect").innerHTML += text.charAt(i);
i++;
setTimeout(typeWriter, speed);
}
}
typeWriter();
function totalCups(numberOfCoffees) {
var ... | true |
8157adf1fabbc087ba113447651d8c1aef17d6b8 | JavaScript | Kr0na/input-filter | /src/validator/InArray.js | UTF-8 | 470 | 3.0625 | 3 | [] | no_license |
class InArray {
constructor(options) {
if (Array.isArray(options)) {
this.haystack = options
} else {
this.haystack = options.haystack
}
this.message = options.message || 'value is not in haystack'
}
isValid(value) {
if (this.haystack.indexO... | true |
b35425ca97f48a069fcd104a66a244277f95fbb9 | JavaScript | punisher89/Flame | /src/commands/settings/ResetEconomyCommand.js | UTF-8 | 2,210 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | const FlameCommand = require('../../structures/FlameCommand');
class ResetEconomyCommand extends FlameCommand {
constructor() {
super('reset-economy', {
description: 'Полностью сбрасывает экономику и прогрессы всех участников на сервере.',
category: 'settings',
usage: 'reset-economy',
ali... | true |
cfef34c8d469b2b183d09d65d74d6a28eecc43bb | JavaScript | thomasbabuj/learning-node-js | /second/app.js | UTF-8 | 876 | 2.8125 | 3 | [] | no_license |
// creating a simple blog engine and also refactoring the helloworld.js file
var http = require('http');
var url = require('url');
var fs = require('fs');
var newPostFormHTML = fs.readFileSync('views/post/new.html', 'UTF-8');
function renderNewPostForm(request, response){
response.writeHead('200', {'Content-typ... | true |
2921d406cd7cf4669e360a8a1a389736810cb8be | JavaScript | ertprs/LD-Meteor | /public/initialConsoleMessages.js | UTF-8 | 3,834 | 2.609375 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | function styledConsoleLog () {
var argArray = []
if (arguments.length) {
var startTagRe = /<span\s+style=(['"])([^'"]*)\1\s*>/gi
var endTagRe = /<\/span>/gi
var reResultArray
argArray.push(arguments[0].replace(startTagRe, '%c').replace(endTagRe, '%c'))
reResultArray = startTagRe.exec(arguments... | true |
e43705c450d5029dc3e0ba352b8b248393be28c0 | JavaScript | candycandy2/Cat | /APP/component/function/cleanHTML.js | UTF-8 | 1,243 | 2.6875 | 3 | [
"MIT"
] | permissive | function cleanHTML(input) {
// 1. remove line breaks / Mso classes
var stringStripper = /(\n|\r| class=(")?Mso[a-zA-Z]+(")?)/g;
var outputstringStripper = input.replace(stringStripper, ' ');
// 2. strip Word generated HTML comments
var commentSripper = new RegExp('<!--(.*?)-->', 'g');
var output... | true |
001396f41dabfa893bd8d9205d587f01ab39e65d | JavaScript | Vin4er/simple-office | /dev/js/bbapp/view/main-view.js | UTF-8 | 6,104 | 2.515625 | 3 | [] | no_license | "use strict";
(function() {
/**
* main field
*/
app.View.Main = Backbone.View.extend({
settings: {},
Views: {
Toolbar: {},
Editable: {}
},
Models: {},
iwindow: {},
idoc: {},
events: {
// клик по ссылке, действие которой надо отменить
// "click .texteditabler-bar-button": "preventDe... | true |
896bfb6a82b98c141473e8f05a2c09b7750fa289 | JavaScript | kaist-plrg/jiset | /lib/esparse/src/es2021/ForStatement.js | UTF-8 | 1,689 | 2.59375 | 3 | [] | no_license | const Node = require('../Node');
// ForStatement[Yield, Await, Return] :
// for ( [lookahead ≠ let [] Expression[~In, ?Yield, ?Await]_opt ; Expression[+In, ?Yield, ?Await]_opt ; Expression[+In, ?Yield, ?Await]_opt ) Statement[?Yield, ?Await, ?Return]
// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Ex... | true |
17368d81e52749fe8b8930edc3efd0adcda94065 | JavaScript | xdd970706/study | /6月/0608/DW/Adobe Dreamweaver CS6/Adobe Dreamweaver CS6/configuration/Commands/InsertRepeatEntry.js | UTF-8 | 2,096 | 2.765625 | 3 | [] | no_license | // Copyright 2001, 2002, 2003, 2004, 2005 Macromedia, Inc. All rights reserved.
//--------------- GLOBAL VARIABLES ---------------
var targetDom = null;
var insertLocation = "";
var insertNode=null;
//--------------- API FUNCTIONS ---------------
function isDomRequired() {
return true;
}
function get... | true |
14211f0ee7514b45721cd8dfa06946a1f8376c4b | JavaScript | bryant1410/react-metaform | /src/lib/metadataEvaluatorPropertyFilters/conditionMessagePropertyFilter.js | UTF-8 | 958 | 2.609375 | 3 | [
"MIT"
] | permissive | import expressionEvaluator from '../ExpressionEvaluator.js';
class ConditionMessagePropertyFilter {
filter(propertyName, propertyValue, model) {
if(propertyValue === undefined) {
return undefined;
}
if(!model) {
throw new Error('model is required');
}
... | true |
c29c6db3c38e4ec980be230bf64740c167189fd8 | JavaScript | jermaine007/yclakesh | /src/yclake/public/javascripts/user.add.js | UTF-8 | 2,290 | 2.609375 | 3 | [] | no_license | $(document).ready(function () {
// update value
$('#addButton').click(function () {
$('#errorHolder').html('');
var userName = $('#userName').val();
var password = $('#password').val();
if (!userName || !password) {
$('#errorHolder').html('<div style="text-align:center" class="alert alert-dan... | true |
ba83cba33398b71b6f9865480d189c7e845b19ff | JavaScript | vickzil/mobotmovies | /src/store/getters.js | UTF-8 | 1,052 | 2.578125 | 3 | [] | no_license | // SHOW NAVIGATION MENU
export const showNavMenu = (state) => {
return state.showNavMenu;
};
// PAGE LOADING STATUS
export const pageLoading = (state) => {
return state.pageloading;
};
// PAGE LOADING STATUS
export const getCurrentdate = () => {
var d = new Date();
var month = new Array();
var da... | true |
ea48f5ff378d63e603cb502bb9937659b557f045 | JavaScript | galinagumenyuk/goit-js-hw-07 | /js/task-02.js | UTF-8 | 391 | 2.765625 | 3 | [] | no_license | const ingredients = [
'Картошка',
'Грибы',
'Чеснок',
'Помидоры',
'Зелень',
'Приправы',
];
const listEl = document.querySelector('#ingredients');
const elements = ingredients.map(ingredient => {
const liElement = document.createElement('li');
liElement.textContent = ingredient;
return liElement;
});
l... | true |
064e99a367f27a4a397c27ff59b2894ea325b251 | JavaScript | VivianeBusch-Wallace/ExercisesAndClassDocs | /Jul/05-07/react-class-components/src/App.js | UTF-8 | 1,297 | 3.484375 | 3 | [] | no_license | import React from "react";
import { add, display } from "./helpers";
// you can also export the element directly >>
// export default class App extends React.Component {}
class App extends React.Component {
constructor(props) {
// super makes it functional, without nothing in browser
super(props);
this.s... | true |
e08c7ac8409fab49065d98ebe84e85a950533f3a | JavaScript | iamanoopmk/todoApp | /src/utils.js | UTF-8 | 648 | 2.671875 | 3 | [] | no_license | import { HOST } from "./host.js"
export async function apiAction(url, method, data)
{
console.log("JSON.stringify(data)",JSON.stringify(data))
let options = {
method : method,
body : JSON.stringify(data),
headers:{
"Content-Type": "application/json"
}
}
if... | true |
77c89c55dca473706557da105918b985e63d16eb | JavaScript | reprograma/On8-javascript-i | /entrega/darlene/exercicioParaCasa/1/script/script.js | UTF-8 | 3,295 | 4.0625 | 4 | [] | no_license | // Calculadora de média de provas
// Você irá construir uma aplicação web com os seguintes requisitos:
// Calcula o valor médio entre duas notas e informa ao aluno seu resultado quando o botão é acionado
// Resultados: APROVADO > 70%
// Resultados: REPROVADO < 70%
// Exibir na mensagem a média atual do aluno.
// Ex: ... | true |
67f6f6c555138cac409dc78beafa0c872dc6d6ee | JavaScript | thinkswell/react-calculator | /src/App.js | UTF-8 | 3,120 | 2.96875 | 3 | [] | no_license | import React from 'react';
import Button from "./components/Button"
import Input from "./components/Input"
import './App.css';
import ClearButton from './components/ClearButton';
import Math from "../node_modules/mathjs/dist/math";
class App extends React.Component {
constructor(props){
super(props);
this.s... | true |
c2ba2aac3be5ff8f68d871da94d8a48d53708f8d | JavaScript | rsolci/smcts_web | /src/entities/Behaviour.js | UTF-8 | 748 | 3.15625 | 3 | [] | no_license | class MovementRepeatBehaviour {
constructor({ xSpeed = 0, ySpeed = 0, loopMovement = true, resetX = 0, screenWidth = 0 }) {
this.xSpeed = xSpeed;
this.ySpeed = ySpeed;
this.loopMovement = loopMovement;
this.resetX = resetX;
this.screenWidth = screenWidth;
}
xMovement() {
return this.xSpee... | true |
0e7d72703e5e9cd9ad2782058ba5ed8baa6f9c09 | JavaScript | io86/Contact-Form | /js/script.js | UTF-8 | 1,591 | 3.546875 | 4 | [] | no_license | //Validation of the form
function validateForm() {
var mail = document.getElementById('mail').value,
vorname = document.getElementById('vorname').value,
nachname = document.getElementById('nachname').value,
strasse = document.getElementById('strasse').value,
nummer = doc... | true |
71bbe3a356f879a3af461049a95b39e495adf6ed | JavaScript | GateMent1/gt | /index.js | UTF-8 | 2,085 | 3.328125 | 3 | [] | no_license | // FORM
let currentSlide = 0;
let slide = document.querySelectorAll('.form__slide');
let steps = document.querySelectorAll(".form__step--number");
const showSlide = (n) => {
slide[n].style.display = "block";
//Button hidding
if (n == 0) {
document.getElementById("prevBtn").style.display = "none";
... | true |
0b422f2323d4618610aa13f14f26eaabe245f807 | JavaScript | daivdkpfe/PHMALL | /components/gxc/alert/alert.js | UTF-8 | 1,972 | 2.5625 | 3 | [] | no_license |
import galert from './alert.vue'
function instance(title,value,btn,okcallback,cancelcakkback){
var vueObj = new Vue({
template:`<galert :alert_show="alert_show" title="`+title+`" value="`+value+`" :btn="btn" v-on:clickok="clickok" v-on:clickcancel="clickcancel"></galert>`,
components:{galert... | true |
acec1612ccf2078373534217842df53a69e7db12 | JavaScript | vasilkovski/Project | /Javascript Bike store/js/main.js | UTF-8 | 3,104 | 2.828125 | 3 | [] | no_license |
let bikesCard = $("#bikes-cards");
let showAll = $("#showAll");
let male = $("#aMale");
let female = $("#aFemale");
let leGrand = $("#aLeGrand");
let explorer = $("#aExplorer");
let kross = $("#aKross");
let eBikes = $("#aEbikes");
let force = $("#aForce");
let ideal = $("#aIdeal");
let pony = $("#aPony");
... | true |
6f3c8ed0ff320bea9d018133b2af5a0551162775 | JavaScript | l33tdaima/l33tdaima | /p724e/pivot_index.js | UTF-8 | 609 | 3.40625 | 3 | [
"MIT"
] | permissive | /**
* @param {number[]} nums
* @return {number}
*/
var pivotIndex = function(nums) {
let sum = nums.reduce((prev, curr) => prev + curr, 0);
let leftSum = 0;
for (let i = 0; i < nums.length; ++i) {
if (leftSum * 2 === sum - nums[i]) return i;
leftSum += nums[i];
}
return -1;
};
// TESTS
[
[[], -1]... | true |
a0ae9720c7771d62a9ac2156003849b47cc7823b | JavaScript | lubuger/obsy_plugin | /src/test.js | UTF-8 | 1,912 | 2.75 | 3 | [
"MIT"
] | permissive | const ObsyPlugin = require('./ObsyPlugin');
//import ObsyPlugin from './ObsyPlugin';
class Test extends ObsyPlugin {
constructor() {
super({
debug: true
});
this.initialize({
name: 'Demo plugin',
description: 'Demo obsy plugin example',
place... | true |
9059c273ac9c51f1eb739c4b496a88ba8323368e | JavaScript | gpolavaram0/leaflet-challenge | /docs/static/js/logic.js | UTF-8 | 3,445 | 2.890625 | 3 | [] | no_license | var mymap = L.map('mapid').setView([0, 0], 2);
// ---------------------------------------------------------------------------------------
var legend = L.control({position: 'bottomright'});
function getColor(d) {
return d > 5 ? '#E31A1C' :
d > 4 ? '#FC4E2A' :
d > 3 ? '#FD8D3C' :
... | true |
98449253f6465acd89673273f3c123408efc6471 | JavaScript | yxCarla/TemperatureConverter | /script.js | UTF-8 | 2,938 | 3.015625 | 3 | [] | no_license | var outputs = document.getElementById('outputs');
function hideAll() {
chosen_f.style.display = 'none';
chosen_c.style.display = 'none';
chosen_k.style.display = 'none';
outputs.style.display = 'none';
}
var chosen_f = document.getElementById('f_starting');
var chosen_c = document.getElement... | true |
be08b20f76b54a97d78ff87489a78f6238f75bd7 | JavaScript | AlvertosFIorantis/draggable_div_react_connected_lines | /src/components/draggable_element/draw_line_helper.js | UTF-8 | 1,119 | 2.828125 | 3 | [] | no_license | function adjustLine(from, to, line){
var fT = from.offsetTop + from.offsetHeight/2 ;
var tT = to.offsetTop + to.offsetHeight/2;
var fL = from.offsetLeft + from.offsetWidth/2;
var tL = to.offsetLeft + to.offsetWidth/2;
var CA = Math.abs(tT - fT);
var CO = Math.abs(tL - fL);
var H = Math.sq... | true |
76c5a9b813be6b36e82b2d72d6650f68f1c49113 | JavaScript | warealm/footballSimulationEngine | /lib/action.js | UTF-8 | 24,220 | 2.515625 | 3 | [
"MIT"
] | permissive | var async = require("async");
var common = require("../lib/common");
var setPositions = require("../lib/setPositions");
function selectAction(possibleActions) {
return new Promise(function (resolve, reject) {
goodActions = [];
async.eachSeries(possibleActions, function eachPlayer(thisAction, thisActionCallback) {... | true |
7a2df97a287b9b69b156d7ec7260bad8adbb1a9a | JavaScript | Dreamer-z/HNYM | /zhms/js/planning.js | UTF-8 | 797 | 2.828125 | 3 | [] | no_license | var open1 = 1;
$(".step1-ob").click(function() {
open1++;
if (open1 % 2 == 0) {
$(".step1-box").animate({ "height": $(".step1-cont").height() }, 100);
$(".step1-op").fadeOut(100);
$(".step1-cl").fadeIn(100);
} else {
$(".step1-box").animate({ "height": "3.6rem" }, 100);
... | true |
e0b5ca74f2475362a26fd50edf0aba15c87f927c | JavaScript | reyou/Ggg.DataStructures | /apps/app-web/leetcode.com/problems/decode-ways/intro1-javascript/intro2.js | UTF-8 | 1,227 | 3.8125 | 4 | [] | no_license | /**
* @param {string} s
* @return {number}
*/
var numDecodings = function(s) {
if (s === null || s.length === 0) {
return 0;
}
let builder = "";
let result = resolve(s, builder);
return result;
};
function numToChar(str) {
let minCharCode = "a".charCodeAt(0) - 96;
let maxCharCode = "z".charCodeAt(... | true |
db894c47a4d4f864f65c94347c34ae0158838ddb | JavaScript | ChrisGhenea/Rocket-Agenda | /Stores/Store.js | UTF-8 | 5,428 | 2.890625 | 3 | [] | no_license | import { observable, computed, action } from "mobx";
import { AsyncStorage } from "react-native";
export default class Store {
constructor() {
this.initFromStore();
}
// Sorted array of dates
@observable dates = [];
// Dictionary of tasks. content[date] returns an array of tasks
@observable content = ... | true |
13b4e5b1e5ee4e78fc835814491572f9441f21ff | JavaScript | doxas/min-svg | /test/script.js | UTF-8 | 1,889 | 2.71875 | 3 | [
"MIT"
] | permissive |
import util from '../index.js';
window.addEventListener('load', () => {
// create PathData instance and generate data string for path
let d = util.createPathData()
.moveTo(50, 50)
.lineTo(100, 100, 150, 75)
.moveTo(250, 50)
.lineTo(175, 50, 200, ... | true |
20ce6abe178ac67d0125fbc883dd3e42858c7438 | JavaScript | Arunkmr98/Saylani-Assignment-05-JavaScript | /app.js | UTF-8 | 23,160 | 3.625 | 4 | [] | no_license | //Assignment 01 JavaScript:| t1,t2,t3,.....tn referes to task numbers
function assignment1_t1() {
alert("Hello User This is my Website");
}
function assignment1_t2() {
alert("Error! Please Enter a valid Password");
}
function assignment1_t3() {
alert("Welcome to JS Land...\nHappy Coding!");
... | true |
f142c98055370592150c7fae356786ff5ccf67f6 | JavaScript | TxSSC/Dispense | /lib/utils.js | UTF-8 | 877 | 2.765625 | 3 | [
"MIT"
] | permissive | /**
* Expose `utils`
*/
var utils = module.exports = exports;
/**
* Helper function for building script arguments
* - Returns argument values sorted in key order, with any type key ignored
* Ex: `copy`: `build` would come before `directory`: `build`
*
* @param {Object} config
* @return {Array}
*/
utils.mak... | true |
2b23936f05d61a6e04bd047a005403010f216425 | JavaScript | sharondsza26/python-Technology | /JavaScript/Iteration/ArrayWithLoops.js | UTF-8 | 831 | 4.03125 | 4 | [] | no_license | var a = [10,20,30,40,50,60];
console.log(a[0]);
console.log(a[1]);
console.log(a[2]);
console.log(a[3]);
console.log(a[4]);
console.log(a[5]);
// do-while loop
var a = [10,20,30,40,50,60];
var i = 0;
do
{
console.log(a[i]);
i++;
}while(i<6);
// while
var a = [10,20,30,40,50,60];
var i = 0;
while(i<a.l... | true |
287926fa8aee977248bf58459932804e4817f185 | JavaScript | peto813/remesas_f | /remesas_f/src/services/api.js | UTF-8 | 2,302 | 2.734375 | 3 | [] | no_license | import 'whatwg-fetch';
const baseUrl = "http://localhost:8000";
class API {
constructor({ url }){
this.url = `${baseUrl}/${url}`
this.endpoints = {}
}
checkStatus(response) {
if (response.status >= 200 && response.status < 300) {
return response
} else {
// console.log(response)
... | true |
ff03a8be43a7f415a0ea5d840b54ceac0bea4ade | JavaScript | twils0/styled-inline-additions | /src/inlineAdditions.js | UTF-8 | 1,272 | 3 | 3 | [
"Apache-2.0"
] | permissive | import inlineConvert from './inlineConvert';
// inlineAdditions should be placed inside a styled-component string;
// it looks for the addString or addObject props and returns a css string
const inlineAdditions = ({ addString, addObject }) => {
let finalStyleString = '';
if (addString) {
if (typeof addString ... | true |
b9362b4736794a1075944f5db8ee09989da55150 | JavaScript | gustavocardoso/animals | /src/js/modules/animals.js | UTF-8 | 707 | 2.703125 | 3 | [
"MIT"
] | permissive | import animalsData from '../animals.json'
let animalsFiles = {}
const files = new Map()
const importAll = requireContext =>
requireContext.keys().forEach(key => {
animalsFiles[key.replace('./', '').replace('.svg', '')] = requireContext(
key
)
})
importAll(require.context('../../../images/animals', ... | true |
dbeb186549858584eb0db97d294917aa082f164e | JavaScript | joseca1791/ProyectoAerolinea | /Proyecto al 17 Agosto/ProyectoAerolinea/build/web/js/Vuelo.js | UTF-8 | 946 | 2.765625 | 3 | [] | no_license | function Vuelo (codigo,origen,destino,precio,tiempo,promo){
this.Vuelo(codigo,origen,destino,precio,tiempo,promo);
}
Vuelo.prototype={
codigo:"",
origen:"",
destino:"",
precio:0,
tiempo:"",
promo:0,
Vuelo:function(codigo,origen,destino,precio,tiempo,promo){
this.codigo=codi... | true |
948c947b04e6b8ef42e287792f4ff792c2adfe0c | JavaScript | gavinmcdermott/ohm-test | /semantics.js | UTF-8 | 4,546 | 2.921875 | 3 | [
"MIT"
] | permissive | 'use strict'
const AST = require('./ast')
// Now we can add semantics.
// This creates a set of semantics called sem with the operation toJS. The semantics
// are essentially a bunch of functions matching up to each rule in the grammar.
// Each function will be called when the corresponding rule in the grammar is pa... | true |
90a8a4c66a50cee68527ffdf27760895cc55f036 | JavaScript | flow-typed/flow-typed | /definitions/npm/js-cookie_v2.x.x/flow_v0.25.x-v0.37.x/test_js-cookie-v2.x.x.js | UTF-8 | 829 | 2.53125 | 3 | [
"MIT"
] | permissive | // @flow
import Cookie from 'js-cookie';
Cookie.set('version', 20, {
path: '/'
});
// $FlowExpectedError
const v: string = Cookie.get('version');
const all: Object = Cookie.get();
// $FlowExpectedError
Cookie.set(12, 'should fail');
Cookie.remove('version', {
path: '/'
});
// $FlowExpectedError
Cookie.rem... | true |
17cf19859d63eec51d4cc379fb8cd74a55c11b61 | JavaScript | varghs/JS-Neural-Networks-Course | /js/RNN.js | UTF-8 | 327 | 2.859375 | 3 | [
"MIT"
] | permissive | const trainingData = [
{ input: '1', output: '2' }
];
const net = new brain.recurrent.LSTM();
const inputMap = ["1", "NEW IDEA", "2"];
[1, 0, 0]
[0, 1, 0]
[0, 0, 1]
// bonus: training data look like, if we start with input of '2', and end with output of '1'
// { input: '2', output: '1'}
[0, 0, 1]
[0, 1, 0]
[1,... | true |
cf6ae3ca34dd489387bd3c6dee5aad2d7aa070b6 | JavaScript | xggaxlc/more-fish-miniapp | /scripts/get-entry.js | UTF-8 | 1,230 | 2.609375 | 3 | [] | no_license | const _ = require('lodash');
const { join, isAbsolute, dirname } = require('path');
const { readJsonFile } = require('./utils');
async function getEntry(appRoot) {
const readJson = readJsonFile(appRoot);
const { pages } = await readJson('/app');
let entry = [
'/app',
...pages.map(page => page.startsWith(... | true |
74f3564774161f1195b1e7b40486cb0f5c6854f0 | JavaScript | sow4063/toyprob | /Documents/dev/javascript/toyprob/js/reverseOrRotate.js | UTF-8 | 2,014 | 4.09375 | 4 | [] | no_license | // https://www.codewars.com/kata/reverse-or-rotate/train/javascript
/*
The input is a string str of digits.
Cut the string into chunks of size sz (ignore the last chunk if its size is less than sz).
If a chunk represents an integer such as the sum of the cubes of its digits is divisible by 2,
reverse it; otherwise ro... | true |
91c26016bd7986e5bcb7b1989d6de9082c6813de | JavaScript | Alberthor47/escuelajs-reto-03 | /src/index.js | UTF-8 | 3,525 | 3.546875 | 4 | [
"MIT"
] | permissive | // TERCERA PARTE
const API = "https://rickandmortyapi.com/api/character/";
function fetchData(url_api) {
return new Promise((resolve, reject) => {
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
var xhttp = new XMLHttpRequest();
xhttp.open("GET", url_api, true);
xhttp.send();... | true |
b4d4fbd7bcf66f77f75ce04c97d092d45432fdf8 | JavaScript | djboulia/tourdata | /common/lib/pgascores/utils/cache.js | UTF-8 | 1,982 | 3.21875 | 3 | [] | no_license | /**
*
* implement a simple caching mechanism for web content
*
* @param ttl : cache time in seconds
*
**/
var cachedItems = 0;
var memStats = function () {
var used = process.memoryUsage();
var now = new Date();
console.log("cached items: " + cachedItems);
console.log("mem stats ==> " + now.toL... | true |
7ec9d9d20ffc8f9e0d7baafe30a8f4a77be306ac | JavaScript | bmurali31/dataservice | /lib/consumer.js | UTF-8 | 1,455 | 2.640625 | 3 | [] | no_license | var request = require('request'),
q = require('q');
var consume = module.exports = function (uri, entityName) {
this.uri = uri;
this.entityName = entityName;
}
consume.prototype.execute = function (req) {
var defered = q.defer();
request(req, function (err, res, body) {
if (err) {
... | true |
6892b74da3462815d8828e589c3ee292434b4b6b | JavaScript | TedChenNZ/ffbe-awakening-calculator | /src/components/unitcard/__tests__/CharacterEnhancementsStore-test.js | UTF-8 | 2,808 | 2.53125 | 3 | [] | no_license | import { expect } from 'chai';
import CharacterEnhancementsStore from '../CharacterEnhancementsStore';
const enhancements = {
202980001: {
name: 'Tri-beam Laser',
skill_id_old: 202980,
skill_id_new: 701170,
cost: {
gil: 500000,
materials: {
270002600: 15,
270002700: 10,
... | true |
7bde21ee5ba099aef1a437de1bab1c1baa901f05 | JavaScript | asakusuma/stirrup | /source/static.js | UTF-8 | 968 | 2.734375 | 3 | [
"MIT"
] | permissive |
Stirrup.prototype.buildStaticFunctions = function(constructor) {
var staticFuncs = this.getConfig().staticFuncs;
for(var i = 0, len = staticFuncs.length; i < len; i++) {
var def = staticFuncs[i];
var staticFunc = null;
//If using native promises, and native promises implements
//the given function... | true |
7493d9ca244e61ee7e009fe8f3c4751b7ccb6001 | JavaScript | Laura-Stitt/wargame-project | /index_test.js | UTF-8 | 755 | 3.15625 | 3 | [] | no_license | var expect = chai.expect;
describe("ThisFunction", function() {
describe('#sayHello', function() {
it('should contcatenate the 2 parameters', function() {
var x = sayHello('Shabbat Shalom, ', 'Tzipporah!');
expect(x).to.equal('Shabbat Shalom, Tzipporah!');
});
... | true |
3dbf584b9e31ccf37aaf155673ded5aac14a1da8 | JavaScript | phetsims/perennial | /js/scripts/push-all.js | UTF-8 | 2,132 | 2.546875 | 3 | [
"MIT"
] | permissive | // Copyright 2021, University of Colorado Boulder
const execute = require( '../common/execute' );
const _ = require( 'lodash' ); // eslint-disable-line no-unused-vars
const fs = require( 'fs' );
// constants
// Don't use getActiveRepos() since it cannot be run from the root
const contents = fs.readFileSync( 'perennia... | true |
4ededa1fd6800b444f5b902535275d4148f65e08 | JavaScript | markni/node-bangumi | /lib/bangumi.js | UTF-8 | 15,217 | 2.53125 | 3 | [] | no_license | /**
* Bangumi API client library for node.js.
* @module bangumi
* @version 1.2.0
*/
const VERSION = '1.2.0';
const protocols = {
http: require('http'),
https: require('https'),
};
const querystring = require('querystring');
const utils = require('./utils');
const PromiseProvider = require('./promise_provider');... | true |
f7f80075ea77d23acde84e2ae39b8a913d7721a7 | JavaScript | Twinlife9/MDK | /w7-Special/main.js | UTF-8 | 1,905 | 2.90625 | 3 | [] | no_license | let boxes=[]
let BakePos = () => {
document.querySelectorAll('.box').forEach((el) => {
// el = el.getBoundingClientRect();
//console.log(el, el.offsetLeft, el.offsetTop);
el.style.top = el.offsetTop + 'px';
el.style.left = el.offsetLeft + 'px';
setTimeout(() => {
el.style.position = 'absolut... | true |
21a7108403d89fb924c7346139c4c74b3fa85176 | JavaScript | stacy6v6/node-training | /scope-chains-closures/5.js | UTF-8 | 251 | 3.59375 | 4 | [] | no_license | function foo() {
let outer = 1;
setTimeout(() => {
outer = 2;
}, 10);
return boo;
function boo() {
return outer + 1;
}
}
const result = foo();
setTimeout(() => {
console.log(result());
}, 100); | true |
89ac7493d8c2a79238a21eee875543be345568ca | JavaScript | Rob-Marshall87/week7_day4_lab | /src/views/select_region_view.js | UTF-8 | 1,358 | 2.828125 | 3 | [] | no_license | const PubSub = require('../helpers/pub_sub.js');
const SelectRegionView = function (){
this.regionNames = [];
};
SelectRegionView.prototype.bindEvents = function (){
PubSub.subscribe('Munros:drop-data-ready', (data) => {
this.destroy();
this.extractNames(data.detail.munros);
this.render();
documen... | true |
ca093fde5018b00ec4c399551b44900fb3f691b1 | JavaScript | mdm106/week-09--first-react-app | /src/components/preBuilt/TempConverterPB.js | UTF-8 | 1,817 | 3.015625 | 3 | [] | no_license | import React, { Component } from "react";
import Form from 'react-bootstrap/Form';
class TempConverterPB extends Component {
constructor(props) {
super(props);
this.state = { fahrenheit: "", celsius: ""};
this.convertToCelsius = this.convertToCelsius.bind(this);
this.convertToFah... | true |
c631908276190a73cb726ddeb368481a94239afd | JavaScript | jirengu-inc/jrg-renwu3 | /homework/王龙/task-37+dialog/dialog/dialog.js | UTF-8 | 4,103 | 2.5625 | 3 | [] | no_license |
function Dialog(options) {
//options=$.extend
this.render(options).bindEvent();
}
Dialog.prototype={
defaultOption:{
width:'350',
model:false,
title:'hunger',
content:'hello boys~',
isClose:true,
isSure:true,
onClose:function () {},
onSure:fu... | true |
48872664b0f3864b6c90c63edd2683f796a6b1f9 | JavaScript | l337haxor/WEBD6201-LAB4 | /public/Scripts/app.js | UTF-8 | 5,029 | 3.09375 | 3 | [] | no_license | /*
Student Name : Sterling Wenzelbach
StudentID : 100299329
Date Completed: 2020-04-17
*/
//Used to collect form information from the contact page
class Contact
{
constructor(contactName = "", emailAddress = "", contactNumber = "", contactMessage = "")
{
this.contactName = contactName;... | true |
4b5aa085c8e653ce90bd2e3b8a0f7e20edfcdf82 | JavaScript | rv-jhester/r2h-todo-app | /src/TodoItem.js | UTF-8 | 897 | 2.59375 | 3 | [] | no_license | import React, { Component } from 'react';
import PropTypes from 'prop-types';
class TodoItem extends Component {
handleChangeTodoStatus = (event) => {
const { onChangeTodoStatus, index } = this.props;
const isComplete = event.target.checked;
onChangeTodoStatus(index, isComplete);
}
render() {
... | true |
2bd5d30e09bf58a03d8ff4ee72094650fd982d36 | JavaScript | shajahan786/World-War-Project- | /Project/letters/McCoyJavaScriptToggleButtons.js | UTF-8 | 772 | 3.109375 | 3 | [] | no_license | function init() {
var fieldset = document.getElementsByTagName('input');
for (var i = 0; i < fieldset.length; i++) {
fieldset[i].addEventListener('click', toggle, false);
}
}
function toggle() {
var id = this.id;
switch (id) {
case "high": {
var high = documen... | true |
305454073787000f09abb800af8e3ed8369b55a0 | JavaScript | tsoftlatam/idc | /front-end/src/PanelResumen.jsx | UTF-8 | 2,866 | 2.609375 | 3 | [] | no_license | import React from 'react';
class PanelResumen extends React.Component {
constructor(props) {
super(props);
this.state = {
aplicativo: "",
modulo: "",
fecha: null,
resultado: null,
loc: null,
defectos: null,
calidad: null,
portabilidad: null
};
}
componentWillReceiveProps(props) {
... | true |
5d37404d07d09b055030f8b70696cc18ce7d8dcb | JavaScript | swc-project/swc | /crates/jsdoc/tests/fixtures/numericpropertytag.js | UTF-8 | 204 | 2.578125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | /**
* @namespace
* @property {String} 1 The number one.
* @property {String} 2 The number two.
* @property {String} 3 The number three.
*/
var numericObject = {
1: 'a',
2: 'b',
3: 'c'
};
| true |
a5911fb7d4896bbb206368bcf8f1aa15b701a8f5 | JavaScript | TimonSotiropoulos/lonestarstudio | /client/src/actions/_utilities.js | UTF-8 | 4,397 | 2.890625 | 3 | [
"MIT"
] | permissive | // *******************************************************
// Action Utiltiies File
// -------------------------------------------------------
// *******************************************
// Imports
// -------------------------------------------
import respack from 'respack';
import { push } from 'react-router-redux... | true |
bbbf1626e70593bf9cf3f49c0212f1707ddf4c7e | JavaScript | Cohort-2016-Session-2/RegistrationFormS2 | /js/utilities.js | UTF-8 | 746 | 3.3125 | 3 | [] | no_license | // Script 8.1 - utilities.js
// This script defines an object that has some utilitarian functions.
var U = {
//Think of an object as a multipart or
//complex variable
//It can contain multiple pieces, elements
$: function(id) {
//get the document element for id
if (typeof id == 'string'... | true |
413bf98a56fdc48b6615c4103e1ac1f9f460365a | JavaScript | baysao/octopus | /sites/common/core/src/js/widget.js | UTF-8 | 5,289 | 2.53125 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | Widget = {id: '#widgets'} // namespace
Widget.setHtmlToPage = function (html) {
$(Widget.id).html(html)
}
Widget.guid = function () {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
return v.toString(16);
});... | true |
f62bcaf13cee6962f3155f5c8c87612a7469bf16 | JavaScript | over58/tech-guide | /16.js/算法/bubble_sort.js | UTF-8 | 744 | 3.515625 | 4 | [] | no_license | /**
*
* 最佳情况:T(n) = O(n)
当输入的数据已经是正序时(都已经是正序了,为毛何必还排序呢....)
最差情况:T(n) = O(n2)
当输入的数据是反序时(卧槽,我直接反序不就完了....)
平均情况:T(n) = O(n2)
https://juejin.cn/post/6844903444365443080#heading-5
*/
function bubbleSort(nums) {
for (var i = 0; i < nums.length; i++) {
// 标识此次循环有没有进行交换
let flag = false
for (var j = 0; j... | true |
6960b1051c3f523477f5d082be3b93c4c85ba59d | JavaScript | masiuk-l/music-organizer | /api/sortFiles.js | UTF-8 | 1,522 | 2.578125 | 3 | [] | no_license | const fs = require('fs');
const path = require('path');
const mm = require('music-metadata');
const inputDir = 'source';
const outputDir = 'output';
module.exports = function (app) {
app.get('/sortFiles', (req, res) => {
try {
fs.accessSync(outputDir);
} catch (e) {
fs.mkdir... | true |
b5c0e3462a27ad085cd8f5cdefe8fc847787d555 | JavaScript | Cz277690572/vendor-wechat-app | /pages/category/category.js | UTF-8 | 1,635 | 2.59375 | 3 | [] | no_license | // category.js
import {Category} from "category-model.js";
var category = new Category();
Page({
/**
* 页面的初始数据
*/
data: {
currentTabsIndex:0,
title:''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this._loadData();
},
_loadData: function (){
category.getCategoryType... | true |
15552850ec1d4d5e03ad644231ad64214dcaa56a | JavaScript | Camila237/pruebaFrontEnd | /public/js/main.js | UTF-8 | 2,011 | 2.953125 | 3 | [
"MIT"
] | permissive | console.log("corecto");
window.onload = function() {
var boton = document.getElementById('botonVerMas');
boton. addEventListener("click", traerDatos);
function traerDatos(){
const xhttp = new XMLHttpRequest();
xhttp.open('GET', '/js/cars.json', true);
xhttp.send();
xhttp.on... | true |
89145b4d5196bc7e9e4b7ddf05f4387aebcbed28 | JavaScript | eyedea-io/syncano-validate | /src/validators.js | UTF-8 | 3,947 | 2.671875 | 3 | [] | no_license | import { is } from './helpers'
export function validateRequired(attribute, value) {
return is.existy(value) && is.not.empty(value)
}
export function validateMin(attribute, value, parameters) {
this.requireParameterCount(1, parameters, 'min')
if (is.not.number(parameters[0])) {
throw new Error('Validation r... | true |
888c3e2e5fe19abcc91ee00f853a94ac05a7e721 | JavaScript | DontJar/js-basics-functions-lab-dc-web-071618 | /index.js | UTF-8 | 1,849 | 3.90625 | 4 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | // // Code your solution in this file!
// * `distanceFromHqInBlocks`: Returns the number of blocks from Scuber's headquarters to the pickup location.
function distanceFromHqInBlocks(destBlock) {
if (destBlock > 42) {
return destBlock - 42
}
else {return 42 - destBlock
}
}
function distanceFromHqInFeet(d... | true |
d7a67c1014d5aa15cd6850b9b16e378fa86c48db | JavaScript | xunuo/seeds | /node-dgram/dgram.js | UTF-8 | 1,034 | 2.75 | 3 | [
"MIT"
] | permissive | var os = require('os');
var dgram = require("dgram");
const DNSADDRESS = "202.101.224.68";
const DNSPORT = "53";
console.log("DNS Server: " + DNSADDRESS + ":" + DNSPORT);
dgram.createSocket("udp4", function(msg, rinfo) {
console.log(rinfo);
var server = this;
var client = dgram.createSocket("udp4");
var address = r... | true |