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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
e8933bb2d4fa9803e983d99e2ae97fa3377a8710 | JavaScript | NicolasFischetti/CursoIngresoJS | /9-Parciales/recuperatorio2/1-entradaSalida.js | UTF-8 | 330 | 3.0625 | 3 | [] | no_license | //Debemos lograr mostrar un mensaje al presionar el botón 'MOSTRAR'.
function Mostrar()
{
alert("Funciona 1-EntradaSalida");
var base;
var perimetro;
base= document.getElementById('lado').value;
base= parseInt(base);
perimetro= parseInt(perimetro);
perimetro= base * 3;
alert("El perimetro es: "+perimetro)... | true |
da43cd8f75d4461cdfc9e18dfbb69a8b8364ac54 | JavaScript | raggynl/screeps | /dist/CreepMedic.js | UTF-8 | 465 | 2.609375 | 3 | [] | no_license | function CreepMedic(creep, room, world){
this.creep = creep;
this.roomCtrl = room;
}
CreepMedic.prototype.act = function(){
var target = this.creep.pos.findClosestByRange(FIND_MY_CREEPS, {filter: function(object){
return object.needHealing()
}})
if(target) {
this.creep.say("healing")
this.cre... | true |
7e808b46bc863aba4019c9534bfbdf041cad5564 | JavaScript | charharhar/campfire-superseed | /public/js/index.js | UTF-8 | 22,047 | 2.765625 | 3 | [] | no_license |
import '../css/styles.css';
/**
* Utility Functions
*/
function removeAllChildren(parent) {
while (parent.hasChildNodes()) {
parent.removeChild(parent.lastChild);
}
}
function findParent(node, className) {
let tempNode = node;
while (!tempNode.classList.contains(className)) {
tempNode = tempNode.... | true |
2a5cdb4f16163cd37160df863b3ebe0ee1a6a7c9 | JavaScript | Nassua1024/clue-contract | /src/component/List.jsx | UTF-8 | 3,292 | 2.59375 | 3 | [] | no_license | import { Flex } from 'antd-mobile';
import './List.less';
//--- data 数组(必填)用于渲染liebiao----
//--- wrapHeight 数字(必填) 用于定义滚动区域的高度----
//--- isShowHeader 布尔值(默认false) 用于定义是否显示fixed顶部----
//--- headerDate 数组(渲染fixed顶部,如果isShowHeader为false也不会渲染----
//--- renderList 方法(data作为返回)渲染list----
//--- slideLast 方法( )监控组件是否滑动到底部-... | true |
a0345e334a0cfe5f6827190eb671f01a62fa11f0 | JavaScript | gabiperalta/gabiperalta.github.io | /main.js | UTF-8 | 5,015 | 2.515625 | 3 | [] | no_license |
var googleStreets = L.tileLayer('https://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}',{
maxZoom: 20,
subdomains:['mt0','mt1','mt2','mt3']
});
//var roads = L.gridLayer.googleMutant({
// type: 'roadmap' // valid values are 'roadmap', 'satellite', 'terrain' and 'hybrid'
//});
var osmStreets = L.tileLayer('https://{s}... | true |
8d49a16401d40575b070900b0edb08fccae84ef6 | JavaScript | AntonLantukh/423185-keksobooking-1 | /src/offers/route/stream.js | UTF-8 | 456 | 2.640625 | 3 | [] | no_license | "use strict";
const {Readable} = require(`stream`);
class FsGridStream extends Readable {
constructor(buffer) {
super();
this.buffer = buffer;
this.chunk = this.readableHighWaterMark;
}
_read() {
const len = this.buffer.length;
let start = 0;
while (start <= len) {
this.push(this... | true |
bf614455cfa6b2ef9f30b08b166cfc260a496d5b | JavaScript | TessSyrowik/w1d4 | /waldo/studentsNameAndAge.js | UTF-8 | 643 | 4.4375 | 4 | [] | no_license | //Exercise #1:
var array = [10, 2, 5, 1, 9];
array = array.sort(function(a, b){
return a - b;
});
console.log(array);
//Exercise #2:
var students = [
{ id: 1, name: "bruce", age: 40 },
{ id: 2, name: "zoidberg", age: 22 },
{ id: 3, name: "alex", age: 22 },
{ id: 4, name: "alex", age: 30 }
];
... | true |
bb2c101bb8e27c37e1008bc2e27c22e256a43e58 | JavaScript | AlxLebedev/Bowman-vs-Vampire | /src/js/mocks/GameStateServiceForMocks.js | UTF-8 | 360 | 2.59375 | 3 | [
"CC0-1.0"
] | permissive | import dataForMocks from './dataForMocks';
export default class GameStateService {
constructor(storage) {
this.storage = storage;
}
save(state) {
this.storage.setItem('state', JSON.stringify(state));
}
static load() {
try {
return JSON.parse(dataForMocks());
} catch (e) {
throw ... | true |
7e73708092631506ac4c1f5102e3b885fff4e671 | JavaScript | chatton/ProgrammingChallengeQuestions | /js/IQTest.js | UTF-8 | 1,409 | 4.46875 | 4 | [] | no_license | /*
Description:
Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob — to check his answers, he needs a program that among the given numbers finds o... | true |
4f57df0ce8781bca24ae6ac0ebb4dc8c8f28dbdc | JavaScript | MyScienceWork/PolarisOS | /scripts/csv-json.js | UTF-8 | 3,721 | 2.5625 | 3 | [
"MIT"
] | permissive | const _ = require('lodash');
const Parse = require('csv-parse');
const FS = require('fs');
const Transform = require('stream-transform');
const moment = require('moment');
function test_required(flag, argv) {
if (flag in argv) {
return;
}
console.error(`${flag} is required. Exited...`);
proces... | true |
b2cfc32ac8bfa50aebd48c3f98c260eb9285a586 | JavaScript | Ethos-lab/Valve | /trapeze-hello-retail/productCatalogApi/api/trapeze-product-catalog-api/trapeze-files/to-utils/to-utils.js | UTF-8 | 2,075 | 2.890625 | 3 | [] | no_license | class TotalOrder {
constructor(min, max, succ, lte) {
this.min = min;
this.max = max;
this.succ = succ;
if (lte !== undefined) {
this.lte = lte;
} else {
this.lte = (val1,val2) => {
return val1 <= val2;
}
}
}
... | true |
42eb55de23a0c619f329f7ecf88e24c551340fb5 | JavaScript | SantiagoJSdev/trenx-new | /src/hooks/useForm.js | UTF-8 | 648 | 2.71875 | 3 | [] | no_license |
import { useState } from 'react';
export const useForm = ( initialState = {} ) => {
const [values, setValues] = useState(initialState);
//nota: mi reset recibe un nuevo estado como para refrescar
//mi useForm y muestre la informacion del nuevo estado ya que como
//mantiene su propio estado d... | true |
1ecafd7f106ec431fada29d0a6833ced96c66969 | JavaScript | jc328/CodeWars-1 | /6kyu_StopgninnipSMysdroW.js | UTF-8 | 717 | 4.03125 | 4 | [] | no_license | // 6 kyu - Stop gninnipS My sdroW!
// Description:
// Write a function that takes in a string of one or more words, and returns the same
// string, but with all five or more letter words reversed (Just like the name of this
// Kata). Strings passed in will consist of only letters and spaces. Spaces will be
// incl... | true |
731b473ee6e3a523cb504f3db88ae30f83a9fe3d | JavaScript | golamambia/UI | /JS_all_Files/26_ES6_Collections/26_Script.js | UTF-8 | 3,275 | 4.78125 | 5 | [] | no_license | /* ES6 Collections */
/*
---------------------------------------------------------------------------------
Map Collection in ECMAScript
---------------------------------------------------------------------------------
*/
/*
Map is a collection of keyed data items,just like an Object.
... | true |
4669f5b78fa2c72e6f1d3b9eee852f5d35b3d515 | JavaScript | syedfaisalsaleeem/Project_Reactionic_Demo | /src/components/Step2/Step2.jsx | UTF-8 | 3,213 | 2.578125 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import { withRouter } from "react-router-dom";
import "./Step2.css";
import Keypad from "./Keypad/Keypad";
import backIcon from "../../assets/arrow.png";
const Step2 = (props) => {
const [number, setNumber] = useState([]);
const [error, setError] = useState(fals... | true |
ce23c57b4a23c050f12a92dcfe26c9bdedf4abc8 | JavaScript | murger/domster | /test/core.spec.js | UTF-8 | 4,296 | 2.9375 | 3 | [
"MIT"
] | permissive | const { expect } = require('chai');
describe('Core', function () {
it('should be an instance', async function () {
let result = await page.evaluate(() => $() instanceof $);
expect(result).to.be.true;
});
it('should return an empty set', async function () {
let result = await page.evaluate(() => $().set);
e... | true |
bf2ad2bf72094bb6c42ede0571fb93c5f3814ab8 | JavaScript | enderlabo/backendMern | /routes/event.js | UTF-8 | 899 | 2.609375 | 3 | [] | no_license | /*
Endpoint Aut - HOST + /api/auth/
*/
const { Router } = require("express");
const router = Router();
const { checkJWT } = require("../middlewares/validateJWT");
const { check } = require("express-validator");
const { fieldsValidate } = require("../middlewares/fieldsValidator");
const {
getEvents,
createEvents... | true |
1db49339bc0df440112ff3b9d52c294e14202f78 | JavaScript | ik373321/before | /app/javascript/map.js | UTF-8 | 948 | 2.71875 | 3 | [] | no_license | const mapEle = document.getElementById('googleMap');
function initialize() {
var location = { lat: 35.658746, lng: 139.745465 }//東京タワー
// 地図初期化
var map = new google.maps.Map(mapEle, {
zoom: 8,
center: location
});
};
//create map
var map = new google.maps.Map(document.getElementById("go... | true |
a135b24cbe9ca481011a6524682e706c15eb51c4 | JavaScript | azer8799/Flights_Booking | /Search.js | UTF-8 | 2,784 | 2.671875 | 3 | [] | no_license | import React,{useState} from 'react';
import { Text, View,TextInput, TouchableOpacity } from 'react-native';
import styles from './style.js';
import flightsdata from './Flights.json';
const Search = (props)=>{
const [Date, setDate] = useState('');
const [source, setSource] = useState('');
const [destin... | true |
3bf8c50e3dcc230977f38db6e5062f32a6e926b2 | JavaScript | ArtemyevFedor/pqsigRM-atack | /atack-tools.js | UTF-8 | 10,141 | 2.703125 | 3 | [] | no_license | const cluster = require('cluster');
const http = require('http');
const numCPUs = require('os').cpus().length;
function factorial(n){
let i =1;
for(let t=n; t>0; t--){
i*=t;
}
return i;
}
function minWeight(r,m) {
return Math.pow(2,m-r);
}
function binNewton(n,k){
return factorial(n)/factorial(n-k)/... | true |
edb103f853cf8de457c729563a5c84c41148c263 | JavaScript | Wayne-Bai/AST-normalize | /data/jbdemonte/gmap3/src/tools/geocoderCache.js | UTF-8 | 922 | 2.875 | 3 | [] | no_license | /**
* Class GeocoderCache
* @constructor
*/
function GeocoderCache() {
var cache = [];
this.get = function (request) {
if (cache.length) {
var i, j, k, item, eq,
keys = getKeys(request);
for (i = 0; i < cache.length; i++) {
item = cache[i];
eq = keys.length === item.keys.... | true |
0882788097c4daba7c2698b94a4a7a203dafd557 | JavaScript | Oceanswave/DuktapeSharpEdges | /DuktapeSharpEdges/app.js | UTF-8 | 916 | 3.328125 | 3 | [] | no_license | var duktape = require('duktape');
var edge = require('edge');
//Edge.js lifted .net code that concats a string.
var helloFunction = function (name) {
return edge.func(function () { /*
async (input) => {
return ".NET Welcomes " + input.ToString();
}
*/
})(name, true);
};
//Duktape script to ... | true |
f8ac9485102dc125e8f94cde102c8a3f08fe6e33 | JavaScript | javifm86/codefights | /arcade/intro/60 - sudoku.js | UTF-8 | 1,109 | 3.5 | 4 | [
"MIT"
] | permissive | function sudoku(grid) {
for (var i = 0; i < 9; i++) {
var colArr = [];
if (!correct(grid[i])) {
return false;
}
for (var x = 0; x < 9; x++) {
colArr.push(grid[x][i]);
if (i % 3 === 0 && x % 3 === 0) {
var row = i;
... | true |
2c3750a8d13c36c38a6989d7ba68eec8c027e66c | JavaScript | eva-lab/usainbots | /core/crawler/webscrap.js | UTF-8 | 2,720 | 2.5625 | 3 | [] | no_license | const request = require('sync-request'),
cheerio = require('cheerio'),
iconv = require('iconv-lite');
module.exports.wiki = function (data, done) {
let res = request('GET', data.url);
if(res.statusCode === 200) {
let body = res.getBody();
// let bodyEncoded = iconv.decode(body, data.ch... | true |
9d9611888ec333f15cae4913d3052bf568b245a4 | JavaScript | cmcmurrough/cse4316 | /REST example/server.js | UTF-8 | 1,869 | 2.953125 | 3 | [] | no_license | const express = require('express')
const app = express()
const port = 3000
app.use(express.json()) // for parsing application/json
app.use(express.urlencoded({ extended: true })) // for parsing application/x-www-form-urlencoded
// define the default error handler
app.use (function (error, request, response, next){
... | true |
16bb7d092746f5ed2bbcabb994745ae89f067305 | JavaScript | savitawadje/Typescript_Programs | /finding_primeno.js | UTF-8 | 525 | 3.984375 | 4 | [] | no_license | /* Q4.
Write a typescript program which contains one function named as ChkPrime. That function should
accept one number and it should return true if the given number is prime and otherwise return false.
Input : 11
Output : It is prime number
*/
function chkPrime(no) {
var no1 = 0;
for (var i = 2; i <= no; i++)... | true |
b75f2ebcfd6824530c72f1b0eb4478b2d73f0f27 | JavaScript | damnboy/scanner | /utils/import/txt.js | UTF-8 | 597 | 2.625 | 3 | [] | no_license | var util = require('util');
var events = require('events');
var fs = require('fs');
var _ = require('lodash');
//from txt file
function TxtFile(){
events.EventEmitter.call(this);
}
util.inherits(TxtFile, events.EventEmitter);//使这个类继承EventEmitter
TxtFile.prototype.parse = function(filename){
var _self = this;... | true |
6d785ccb09bc810982d4ea6fa47ebe1d4ef46ae5 | JavaScript | bprinty/jest-axios | /src/models.js | UTF-8 | 5,263 | 3.15625 | 3 | [
"MIT"
] | permissive | /**
* Data managers.
*/
// imports
// -------
import _ from 'lodash';
// helpers
// -------
function format(obj, id) {
const data = id ? { id } : {};
if (!_.isNaN(Number(data.id))) {
data.id = Number(data.id);
obj.id = data.id;
}
_.map(obj, (value, key) => {
if (_.isFunction(value)) {
da... | true |
5a72cfe858ebdd0a5e9a5f3abd35a0bc6e35dacf | JavaScript | qwop/userscript | /monolith/76/128923.user.js | UTF-8 | 2,446 | 2.875 | 3 | [] | no_license | // ==UserScript==
// @name mitx-grading-indicator
// @namespace thomasloch
// @version 0.14
// @description Add indicator which exercises and labs are graded
// @include https://6002x.mitx.mit.edu/*
// ==/UserScript==
/*
MITx Grading Indicator
----------------------
Add indicator whic... | true |
8b27638c697e27f08405f7b561142b49c9642386 | JavaScript | longnguyennhnd/Project3-.NET-MVC | /Do_An_3/Do_An_3/Content/js/Đăng nhập.js | UTF-8 | 1,616 | 2.9375 | 3 | [
"MIT"
] | permissive | document.addEventListener('DOMContentLoaded', function() {
var dangnhap = document.querySelector('.nut-dangnhap');
dangnhap.addEventListener('click', function() {
if(CheckInput()) {
alert("Đăng nhập thành công !");
}
})
})
function CheckInput() {
var taikhoan = document.getE... | true |
237bd348287ea996f8ee1489b6695490d5edf910 | JavaScript | pkBilalAhmad/express-15-2-17 | /server.js | UTF-8 | 1,683 | 2.5625 | 3 | [] | no_license | var express = require('express')
var mongoose = require('mongoose');
var bodyParser = require("body-parser");
var app = express()
var port = process.env.PORT || 5000
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: false })); // support encoded bodies
var SchemaOb = new mongoose.Schema({
use... | true |
d6407bbf5a0029d712cef62034637c40e7755317 | JavaScript | itinao/webrtc_test | /dataChannel/webroot/webrtc.js | UTF-8 | 5,059 | 2.796875 | 3 | [] | no_license | /**
* webrtcに関するクラスを実装
*/
var Webrtc = Class.extend({
/**
* 初期化
* @param {Object} option {
* videoElementId: "",
* iceCandidateCallback: function() {},
* dataChannels: [{
* label: 'test channel',
* option: {
* ordered: false, // 順序を保証しない
* maxRetransmitTime: 3000... | true |
6d5f7e8540439d759a184d1e53c8adce5b775a19 | JavaScript | YosmartHariandja/ThreeJS-Litle-Project | /Perlin Noise/lib/draw.js | UTF-8 | 700 | 2.796875 | 3 | [] | no_license | let inc = 0.01;
function draw() {
while(scene.children.length > 0){
scene.remove(scene.children[0]);
}
let yoff = 0;
for (let y = -20; y < 20; y += 0.25){
let xoff = 0;
for(let x = -20; x < 20; x += 0.25)
{
let dotGeometry = new THREE.Geometry();
... | true |
41f55ca21953d51d5c5108706cb7a4bf14ed368c | JavaScript | warnercarpenter/Nutshell | /src/scripts/taskedit.js | UTF-8 | 1,884 | 2.59375 | 3 | [] | no_license | import APIManager from "./APIManager";
import dashboardRefreshional from "./dashboardRefreshional";
import checkObjectError from "./checkObjectError"
const taskEdit = () => {
const taskDisplay = document.getElementById("taskDisplay")
taskDisplay.addEventListener("click", function (event) {
if (taskDisp... | true |
7209eba43dc9a081d07179bf0cc689031e7e1f04 | JavaScript | soparifly/Biz_08_Nodejs | /nodejs_0001/public/object_01.js | UTF-8 | 323 | 3.671875 | 4 | [] | no_license | const arr1 = [100, 200, 300, 400, 500];
const [백, 이백, 삼백, 사백, 오백] = arr1;
const obj = { name: "홍길동", tel: "010-222-2222" };
let 이름 = obj.name;
console.log(이름);
let 전화 = obj.tel;
전화 = obj["tel"];
console.log(전화);
const { name, tel } = obj;
console.log(name);
console.log(tel);
| true |
91aef06a93e13c14f4d5b1edb9cbfdebb93ad76c | JavaScript | justzyq/test1 | /this1.js | UTF-8 | 362 | 3.453125 | 3 | [] | no_license | var num = 10
var obj = {num:20}
obj.fn = (function (num){
console.log(this)
console.log(this.num ===num)
this.num = num*3
num++
return function(n){
console.log("this.num",this.num)
this.num+=n
num++
console.log(num)
}
})(obj.num)
var fn = obj.fn
fn(5)
console.log... | true |
fe299e2befccc4e4a7b2b36dfa2ad56457d26425 | JavaScript | lumiazdk/koa-admin | /libs/json_schema.js | UTF-8 | 1,592 | 2.609375 | 3 | [] | no_license | module.exports = function (body, schema) {
//错误结果数组
let errors = []
//现已支持的类型
const types = {
required: {
message: '此字段为必填'
},
string: {
name: String,
message: '此字段应为字符串类型'
},
number: {
name: Number,
mess... | true |
8d0e7a5e8097b9d13e020f048ebaf414c5404605 | JavaScript | kruvv/Arkanoid-on-javascript | /graph.js | UTF-8 | 1,142 | 3.546875 | 4 | [] | no_license | var canvas, ctx, width, height;
var init = function() {
canvas = document.getElementById('canvas');
width = canvas.width;
height = canvas.height;
ctx = canvas.getContext('2d');
};
//Закрашиваем все игровое поле каким-нибудь цветом
var fillAll = function(color) {
ctx.fillStyle = color;
ctx.fillRect(0, 0, w... | true |
763ac3a9f721cf48d0f88881c2ab50a005a5a04d | JavaScript | augustoaccorsi/nodejs | /tv-news-backend/src/controllers/news.js | UTF-8 | 1,145 | 2.515625 | 3 | [] | no_license | 'use strict';
const bodyParser = require('body-parser');
const express = require('express');
module.exports = function(options) {
const newsRepository = options.newsRepository;
const router = express.Router();
router.get('/', function getAllNews(req, res, next) {
newsRepository.getAll()
.then(news => ... | true |
f5206320a232c72131b2ffdc34f985fef9b8a2a2 | JavaScript | shuyuew/o_v2_web | /src/helpers/decode.js | UTF-8 | 384 | 2.59375 | 3 | [] | no_license | import Base64 from 'base-64';
import { aesDecrypt, aesEncrypt } from './aes';
export const keyDecode = (string) => {
const strDecoded = Base64.decode(string);
const strBytes = strToBytes(strDecoded);
return strBytes;
}
const strToBytes = (string) => {
let bytes = [];
for (var i = 0; i < string.length; i++... | true |
27ee6bf351f678cd8eb858ba2456e24ea2a35a0c | JavaScript | Arya1957/practice | /BarrelLayout/gallery/js/Barrel.js | UTF-8 | 5,347 | 2.96875 | 3 | [] | no_license |
class Barrel {
constructor(el, keyword,curPage,BaseHeight) {
this.el = el;
this.keyword = keyword || 'cat';
this.curPage = curPage || 1;
this.BaseHeight = BaseHeight || 200;
this.imgUrls = [];
this.loading = false;
this.lanuch();
window.onresize = th... | true |
7da1d46359d738579dd6b54b4741036145413c11 | JavaScript | Gergling/orbital-city | /src/public/modules/city/class/Facility.js | UTF-8 | 1,139 | 2.609375 | 3 | [] | no_license | angular.module("city").factory("city.class.Facility", [
// Resources
function () {
"use strict";
var Facility = function () {
var waste = [ ],
requiredResource = [ ];
this.waste = function (value) {
if (value) {
// T... | true |
271839d491029e22bb3f07f3a8319ee48aec8245 | JavaScript | rishit1905/React-Product-Inventory-System | /src/components/price.js | UTF-8 | 3,461 | 2.59375 | 3 | [] | no_license | import React from 'react';
import ProductDetail from './productdetail';
import "./headerfooter.css";
import axios from "axios";
class Price extends React.Component {
constructor(props) {
super(props)
this.state = {
products: [],
filteredProducts: [],
priced: [],
... | true |
e4449b6b8a766adbc25c76f69a80974a673db566 | JavaScript | bolajiadeyemi/bluebirdmotors | /api/hooks/utils/lib/fileWatcher.js | UTF-8 | 730 | 2.609375 | 3 | [] | no_license | 'use strict';
/**
* @class sails.hooks.utils.filewatcher
*
* Watch files for changes.
*/
var fileWatcher = require('file-watcher');
module.exports = {
/**
* Watch the specified directory and call the passed in function when a file changes
*
* @param {string} directory The directory to watch
... | true |
ddbc9042147ab107f4571cb3e720411ce4389d5d | JavaScript | Rian501/front-end-exercises | /superpowers/powers.js | UTF-8 | 2,290 | 3.9375 | 4 | [] | no_license | /*
In the following code, replace `event` with the correct string to handle
a click event on the button. Then write the function that has instructions
for activating the corresponding power. The function should...
1. Remove the `disabled` class
2. Add the `enabled` class
*/
const activateF... | true |
ac2827c17d358dd0ea3942804ace86071f97e66a | JavaScript | Meyjan/Engi-s-Cinema | /src/js/RegisterPage.js | UTF-8 | 2,391 | 2.734375 | 3 | [] | no_license | function fileNameUpdate() {
document.getElementById("InputFile").innerHTML = document.getElementById("file").value;
}
function formCheck(e) {
let form = new FormData(document.forms.form_registration);
let request = new XMLHttpRequest();
request.open("POST", "../php/RegisterPage.php");
request.send... | true |
96c8475e055ef0b6f69463d654d1d00ce593b72a | JavaScript | silvaadriel/shell-sort.js | /js/script.js | UTF-8 | 3,405 | 2.5625 | 3 | [] | no_license | import startSorting from './sort.js';
import { getNumbersToBeSorted, setNumbersToBeSorted } from './numbersToBeSorted.js'
import { Button, SlideControl } from './controls.js';
import arrayStructure from './arrayStructure.js';
import { clearInformations } from './userfulInformations.js'
import { hiddenDisplayInput } fro... | true |
b185e29b08e48bcadc0eb0c567a8d6142a4ab832 | JavaScript | SpazzingLicorice/gingko | /server/utils/formatHandler.js | UTF-8 | 1,110 | 2.859375 | 3 | [] | no_license |
/*****************************************
FORMAT UTILITY FUNCTIONS
******************************************/
// Note: 'o' represents the formatted object returned by the function.
exports.formatMeal = function(meal, attendeesData) {
var _meal = {
id: meal.id,
title: meal.dataValues.title,
dat... | true |
6f1f2a35fc1518d50e60c23fc2756e567149af26 | JavaScript | weihang-wang/weihang-wang.github.io | /cse705/project/lenovo/ori/Y40_80_files/AsyncBridge.js | UTF-8 | 2,732 | 2.65625 | 3 | [] | no_license | var xmlBridgeCallback = null;
var xmlBridgeErrorCallback = null;
var xmlBridgeCursorChange = true;
function setBridgeCallBack(cbx)
{
xmlBridgeCallback = cbx;
}
function setBridgeCursorChange(tggle)
{
xmlBridgeCursorChange = tggle;
}
function setBridgeErrorCallBack(cbx)
{
xmlBridgeErrorCallback = cbx;... | true |
301a3aa238e3c640535d6277442d63053b185f85 | JavaScript | FrancescoPalma/Final_Homework_Week6 | /record_collector.js | UTF-8 | 593 | 3.03125 | 3 | [] | no_license | var RecordCollector = function(name) {
this.name = name;
this.inventory = [];
this.money = 10;
}
RecordCollector.prototype = {
buyRecord: function(recordToBuy, store) {
this.inventory.push(recordToBuy);
this.money = this.money - recordToBuy.price;
store.sellRecord(recordToBuy);
},
sellRecord: f... | true |
777365577bccfd4f97305819cceeae5d6b29de66 | JavaScript | sethripman/products | /product/display-chonk.js | UTF-8 | 1,786 | 3.125 | 3 | [] | no_license | import { getCart, setCart, incrementInCartById, currentQuantityDisplay } from '../common/utils.js';
function displayChonk(chonk) {
const newChonk = document.createElement('li');
newChonk.className = chonk.category;
newChonk.title = chonk.description;
const h3 = document.createElement('h3');
h3.tex... | true |
c5f1d44398492a8a907e3b97300f2e5398e4ee9e | JavaScript | shailesh1001/Pluralsight-2 | /ThreeJS/exercise3/app.js | UTF-8 | 1,615 | 2.828125 | 3 | [] | no_license | var example = (function() {
"use strict"
var scene = new THREE.Scene(),
renderer = new THREE.WebGLRenderer(),
light = new THREE.AmbientLight(0xffffff),
camera,
manualGeometry
function initScene () {
renderer.setSize(window.innerWidth, window.innerHeight)
document.getElementById("webgl-container").appe... | true |
b773092c2165a5c01561df4299f9aabdd4e1e7ee | JavaScript | StephenJonker/freeCodeCamp2019 | /javascript-algorithms-and-data-structures-certification/oop/use-dot-notation-to-access-the-properties-of-an-object/index.js | UTF-8 | 815 | 3.984375 | 4 | [] | no_license | /*
Javascript file
Written by: Stephen Jonker
Written on: Tue 27 Apr 2021
Copyright (c) 2021 - Stephen Jonker - www.stephenjonker.com
Project: freeCodeCamp - Javascript and Algorithms - Object Oriented Programming
- This code is based on a template created by me to provide basic script structure
- Additiona... | true |
8cdf0b60160653a6c653dead6ba7cbef54e7e200 | JavaScript | sianokotoba/algorithms-in-javascript | /src/insertion-sort.js | UTF-8 | 594 | 3.765625 | 4 | [] | no_license | /**
* Sorts an array of integers using the InsertionSort algorithm.
* @param {Array.<number>} items Array of items to be sorted.
*/
aij.insertionSort = function(items) {
var sort = function(arr) {
var length = arr.length;
for (var i = 0; i < length; i++) {
var j = i,
item = arr[j... | true |
3923bbb4b3fffab8199325432d394aa9853e6d2b | JavaScript | thiscouldbebetter/DistributedShipping | /Source/Address.js | UTF-8 | 5,454 | 3.15625 | 3 | [
"MIT"
] | permissive |
// classes
function Address
(
id,
addresseeName,
streetNumber,
streetName,
cityName,
provinceCode,
countryCode,
zoneCode
)
{
this.id = id || ("_" + Math.random());
this.addresseeName = addresseeName || "";
this.streetNumber = streetNumber || "";
this.streetName = streetName || "";
this... | true |
dc4ad52d12b6e3c3f39c1a55375f01cef89718bd | JavaScript | made/blog-website | /asset/script/module/newsletter.js | UTF-8 | 6,526 | 2.65625 | 3 | [] | no_license | /*
* Made Blog
* Copyright (c) 2019-2020 Made
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This progr... | true |
b3b6a2c6b728c55c91d88d0cb9a2c9960660ed93 | JavaScript | Antony74/TransportManager | /sys/htdocs/Schema.js | UTF-8 | 1,593 | 2.65625 | 3 | [
"MIT"
] | permissive | //
// Most of what we want to know about the database schema we can get directly
// from the database itself. This file just contains a few simple extra
// facts which the database doesn't know - which tables this application
// is interested in (since a database may have other stuff hanging around
// in it, and occas... | true |
12cd9610c4f45a63d0d77a69212343c885ddf356 | JavaScript | park-jian/javascriptSource | /randomUserApiJavaScript/js/app1.js | UTF-8 | 1,385 | 2.828125 | 3 | [
"MIT"
] | permissive |
const btn = document.querySelector("#btn"),
email = document.querySelector("#email"),
phone = document.querySelector("#phone"),
street = document.querySelector("#street"),
last = document.querySelector("#last"),
first= document.querySelector("#first"),
photo = document.querySelector("#photo");
... | true |
2953c5b22f72d73ade218e1685e862ffcdc82e23 | JavaScript | Apheliont/MediaConverter | /server/clientUpdater.js | UTF-8 | 3,221 | 2.765625 | 3 | [] | no_license | const { fileModel, workerModel } = require("./models/fileWorkerFusion");
const { informClients } = require("./socket.io-server");
const sendFileInfo = informClients("FILEINFO");
const sendWorkerInfo = informClients("WORKERINFO");
// кэш для хранения данных файлов для дальнейшей отправки на фронтэнд
// key - fileID<int... | true |
fcae8bc1e12df3739eb9f593045c44b06120f739 | JavaScript | PierreLeBlond/Simu_stage_2015 | /js/Script.js | UTF-8 | 6,442 | 3.15625 | 3 | [] | no_license | /**
* Created by lespingal on 15/07/15.
* pierre.lespingal@gmail.com
*/
/**
* Global namespace
* @namespace
*/
SIMU = SIMU || {};
/**
* Represent a script used to load data from files
* @constructor
*
* @property {String} name - name of the script
* @property {function} script ... | true |
89462e6e296609dff683dc8ef7d07f031af675ca | JavaScript | kora9738/My-konstantin-js | /TicTacToe/tic-tac-toe-ai.js | UTF-8 | 2,612 | 3.109375 | 3 | [] | no_license | class TicTacToeAI{
constructor(ttt, player, active) {
this.ttt = ttt;
this.player = player;
this.waitTime = 0;
if (active == undefined) {
this.active = true;
} else {
this.active = active;
}
}
actionTaken (){}
updateCurrentPlayer(currentPlayer) {
if (th... | true |
60648d1fad1611714a86144716c4ffa0685abd40 | JavaScript | stepolimi/Computer-Graphics-Project | /Assignments/Assignment_05/A05 - Perspective projection and View Matrix/view.js | UTF-8 | 1,080 | 3.125 | 3 | [] | no_license |
function view(cx, cy, cz, alpha, beta, rho) {
// Create a view matrix for a camera in position cx, cy and cz, looking in the direction specified by
// alpha, beta and rho, as outlined in the course slides.
/*To solve this assignment part we used the following formula:
out = Rz(−ρ)⋅ Rx(−β)⋅ Ry(−α)⋅ T(−cx,−cy,−cz... | true |
971634da3b802192f55777300062f32b95712c95 | JavaScript | AllinolCP/Penguin-Oasis | /Oasis/Oasis/Web/cdn/css/c/js/slideshow.js | UTF-8 | 1,388 | 2.796875 | 3 | [
"MIT"
] | permissive | /**
* planetta slideshow
* version 1.01
* written by dorbens
* http://www.themeforest.net/user/dorbens
**/
$(function(){
/* Collect info about the li's and stuff
==============================================*/
var imgCount = $(".slideshow-wrapper li").length; // Get the number of the images
var imgCur... | true |
8594b9a53567aff022b780bd38a6fd45c1adca39 | JavaScript | milehighcoder/password-generator | /js/script.js | UTF-8 | 3,412 | 4 | 4 | [] | no_license | var generateBtn = document.querySelector("#generate");
// declares variables for 'function generatePassword()'
var numChar = "0123456789";
var lowerABC = "abcdefghizjklmnopqrstuvwxyz";
var upperABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var specChar = "!#$%&*@_";
var charArr = [];
// function starts
function generatePasswor... | true |
5f625b2feae94f104a2ce16030b39d224d6adcb7 | JavaScript | hielke16/blog | /assets/js/jquery.placeholder.js | UTF-8 | 1,203 | 2.859375 | 3 | [
"BSD-3-Clause"
] | permissive | jQuery(function($) {
/**
* Returns the Internet Explorer version currently used by the client,
* or -1 if the client is using a different browser.
*
* @return int the Internet Explorer version.
*/
function getInternetExplorerVersion() {
var ieVersion = -1;
if (navigator.... | true |
979831960ed35cbf55624dbc419f530cdd050d5d | JavaScript | Alok255/hackerrank | /practice/algorithms/implementation/counting_valleys/solution.js | UTF-8 | 630 | 3.375 | 3 | [
"MIT"
] | permissive | 'use strict';
const processData = input => {
const lines = input.split('\n');
const steps = lines[1];
let valleys = 0;
let seaLevel = 0;
for(let i = 0; i < steps.length; i++) {
let c = steps.charAt(i);
if(c == 'D') {
seaLevel -= 1;
} else {
seaLevel ... | true |
592e3220e53599a68613adc1793347a58b7c770e | JavaScript | 100LinesLater/Agorithm-Problems | /summary_ranges.js | UTF-8 | 686 | 3.3125 | 3 | [] | no_license | const summaryRanges = function (nums) {
if (!nums.length) return [];
let currNum = nums[0];
let currIteration = 0;
let res = [];
let rangeStarted = false;
res.push("" + nums[0]);
for (let i = 1; i < nums.length; i++) {
if (nums[i] === currNum + 1) {
rangeStarted = true;
currNum++;
} e... | true |
b06e2311b53d25997b053c8b90dfa7dc3b99f80b | JavaScript | FeljDelps/noteful-api | /test/folders-service.spec.js | UTF-8 | 3,556 | 2.65625 | 3 | [] | no_license | const FoldersService = require('../src/folders/folders-service');
const knex = require('knex');
const { makeFoldersArray } = require('../test/folders.fixtures');
const { expect } = require("chai");
describe(`Folders service object`, function(){
let db
const { testFolders, expectedFolders } = makeFoldersArray(... | true |
71d3c143d95890f8fca704a4775ec3deac367baf | JavaScript | xuzicn/old-driver | /lib/getValue.js | UTF-8 | 388 | 2.84375 | 3 | [] | no_license | const _ = require('underscore');
module.exports = function (obj, name, type, defaultVal) {
if (!obj.hasOwnProperty(name)) return defaultVal;
var val = obj[name];
switch (type) {
case 'int':
val = Number.parseInt(val);
case 'string':
val = _.isString(val) ? val : val.toS... | true |
eb471dc72e47008ad74de55e13a02a3474347237 | JavaScript | Anjalizi/StudyBuddy | /activities/static/js/colors.js | UTF-8 | 6,240 | 2.984375 | 3 | [] | no_license | console.log("connected!");
// restart game Buttons
var arr = ['one', 'three','five','eight'];
var marks = 0;
function include(arr, obj) {
for(var i=0; i<arr.length; i++) {
if (arr[i] == obj){ arr[i] = 'true'; return true;}
}
return false;
}
function change(){
one.src = "https://w7.pngwing.com/png... | true |
ea581799030753f91968a60a585df5a8fd5e2c60 | JavaScript | autotel/flashcards-utility | /src-js/index.js | UTF-8 | 14,490 | 2.78125 | 3 | [] | no_license | import $ from "jQuery";
import api from "./ApiInterface.js";
function unsort(array) {
var currentIndex = array.length, temporaryValue, randomIndex;
// While there remain elements to shuffle...
while (0 !== currentIndex) {
// Pick a remaining element...
randomIndex = Math.floor(Math.random() * c... | true |
5004d83eddc23aefa2d1c60d80bd3878311171e4 | JavaScript | vfloresp/javascript_course | /chapter_6/DOM.js | UTF-8 | 611 | 3.25 | 3 | [] | no_license |
const para = document.querySelector('body > h1');
console.log(para);
const paras = document.querySelectorAll('p');
paras.forEach(para =>{
console.log(para);
});
console.log(paras);
const errors = document.querySelectorAll('.error');
console.log(errors);
//get an element by index
const title = document.getEl... | true |
1b9c74191b3dc248ea34b80430c7bc59f580d3d4 | JavaScript | romo/core | /src/main/generic/consensus/base/blockchain/_deprecated/DenseChain.js | UTF-8 | 25,246 | 3.015625 | 3 | [
"Apache-2.0"
] | permissive | /**
* A double-ended, contiguous chain of light blocks.
*/
class DenseChain extends Observable {
/**
* @param {BlockStore} store
* @param {Block} head
* @returns {Promise.<DenseChain>}
*/
constructor(store, head) {
super();
this._store = store;
/** @type {Block} */
... | true |
3e3c65f5744f5bef4608e1ea32da42e27636f880 | JavaScript | llenroc/algorithms-practice | /solutions/leetcode/LC007_reverseDigitsofInteger/index.js | UTF-8 | 331 | 3.59375 | 4 | [] | no_license | // Given a 32-bit signed integer, reverse digits of an integer.
// For an int overflow, your code should just return 0.
// -------------------------
// reverse(123) --> 321
// reverse(120) --> 21
// reverse(-123) --> -321
// reverse(2147483649) --> 0
// reverse(-2147483649) --> 0
function reverse(x) {}
module.exports... | true |
80f2e7b9876a74a4381e2055d9a730378b1e961b | JavaScript | martincli/dayplanner | /src/js/sidebar.js | UTF-8 | 2,655 | 2.546875 | 3 | [] | no_license | import { setModalSize, setModalContent, showModal } from './modal';
function initSidebar() {
const sidebarIcon = document.querySelector('.sidebar-icon');
const sidebar = document.querySelector('.sidebar');
const modal = document.querySelector('.modal');
const plansDiv = sidebar.querySe... | true |
b5034d775fe9bd535ade85ddc396f698ae7c27bc | JavaScript | Oluwayelu/ECX-backend | /Week4-ass/quiz2.js | UTF-8 | 769 | 3.046875 | 3 | [] | no_license | const bcrypt = require('bcrypt')
const db = require('./db')
const checkUser = (name, pass) => {
if(db.name === name) {
bcrypt.genSalt(10, (err, salt) => {
bcrypt.hash(db.password, salt, (err, hash) => {
db.password = hash
console.log(db.password)
... | true |
217a76b960d6f2d8109b97756130d2b695f37f59 | JavaScript | Kashish121/PortScanner | /src/static/js/index.js | UTF-8 | 792 | 3.046875 | 3 | [
"MIT"
] | permissive | $(document).ready(function () {
$("#history").show();
$("#timer").hide();
});
var data, minutesLabel, secondsLabel, totalSeconds, valString;
data = 0;
function scanPort() {
if (data == 0) {
data = 1;
$("#history").hide();
$("#timer").show();
setInterval(setTime, 1000);
... | true |
a4d691ed0830dad54d3c1f8042ea1f39c4aa75ea | JavaScript | hellotrei/iMart | /src/store/data/trainings.js | UTF-8 | 2,091 | 2.828125 | 3 | [] | no_license | export const TrainingLevel = {
EASY: "8",
MIDDLE: "10",
HARD: "11",
};
export class Training {
constructor(title, duration, level, image) {
this.title = title;
this.duration = duration;
this.level = level;
this.image = image;
}
get formattedLevel() {
return ` Iphone ${this.level} `;
... | true |
04d31707a3c0670a2bd9f84030d31ed5dab4f8f1 | JavaScript | jonjon81/cool-nerd-stuff-readable | /helpers.js | UTF-8 | 1,043 | 3.109375 | 3 | [] | no_license | export function formatPrice(cents) {
return `$${(cents / 100).toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ',')}`;
}
export function rando(arr) {
return arr[Math.floor(Math.random() * arr.length)];
}
export function slugify(text) {
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Repla... | true |
5dc672b06f2b7b59c48ffd32d35f8f50d65d8dec | JavaScript | mgotliboym/cs546-final-emptystring | /routes/rate.js | UTF-8 | 1,009 | 2.59375 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
const userData = require("../data/users");
router.get('/:id', (req, res) =>
{
if (!req.user) //not logged in
res.status(400).json({ error: "You must be logged in to leave a rating." });
else
{
userData.getUserById(req.para... | true |
df083d8d67d06b05936f4c0b58c4a0c1c7c4088d | JavaScript | huyenltnguyen/FCC-backups | /Javascript Algorithms And Data Structures/Intermediate Algorithm Scripting/missingLetters.js | UTF-8 | 286 | 3.84375 | 4 | [] | no_license | function fearNotLetter(str) {
let arr = str.split('').map(char => {
char = char.charCodeAt(0);
return char;
});
for (let i = arr.length - 1; i > 0; i--) {
if (arr[i] - arr[i-1] !== 1) {
return String.fromCharCode(arr[i] -1);
}
}
}
fearNotLetter("abce");
| true |
27ecc4a01b0414173e022f6926d2fc2aa131888a | JavaScript | davidjamesstone/vsd | /server/plugins/log-errors.js | UTF-8 | 880 | 2.609375 | 3 | [
"MIT"
] | permissive | /*
* Add an `onPreResponse` listener to log request errors
*/
module.exports = {
plugin: {
name: 'log-errors',
register: (server, options) => {
server.ext('onPreResponse', (request, h) => {
const response = request.response
if (response.isBoom) {
// An error was raised during... | true |
93a1d0548a61b897973a940db8245e545275b57c | JavaScript | TomasAiello/CursoIngresoJS | /1-EntradaSalida/jsEntradaSalida-09.js | UTF-8 | 377 | 3.71875 | 4 | [] | no_license | /*
Debemos lograr tomar el importe por ID ,
transformarlo a entero (parseInt), luego
mostrar el importe con un aumento del 10 %
en el cuadro de texto "RESULTADO".*/
function mostrarAumento()
{
var Sueldo;
var Result;
Sueldo = parseInt(document.getElementById("txtIdSueldo").value);
Result=Sueldo+Sueldo*0.1;
docu... | true |
a01215b49158bd3751ce224b37cbf2bb2c3ff655 | JavaScript | OliverKovacs/JavaScript-samples | /index.js | UTF-8 | 2,734 | 2.765625 | 3 | [] | no_license |
// Oliver Kovacs 2020
const https = require("https");
const client_id = "...";
const client_secret = "...";
const scope = "icdapi_access";
const grant_type = "client_credentials";
let token;
function getToken() {
// http header fields to set
const Authorization = `Basic ${new Buffer.from(`${client_id}:${cl... | true |
8dd665d11b64f3ebb7139f87ec4f1fd809a83b08 | JavaScript | Crazycyborg1995/fcc-metric-converter | /controllers/convertHandler.js | UTF-8 | 2,041 | 3.390625 | 3 | [] | no_license | const regexNum = new RegExp(/\d+(?:\.\d+)?(\/\d+)?/g);
const regexUnit = new RegExp(/[a-zA-Z]+/g);
const units = {
gal: [
'gallons',
'l',
v => {
return v * 3.785;
}
],
l: [
'liters',
'gal',
v => {
return v / 3.785;
}
],
mi: [
'miles',
'km',
v => {
... | true |
66d82982c94fee102a98b40d0b521f331db77d37 | JavaScript | salerahul/JavaScript-HtmlRepository | /js/book_mngt.js | UTF-8 | 512 | 3.640625 | 4 | [] | no_license | var books = [];
var input = prompt("Which operation you want perform?[add|list|exist]:");
while(input != "exit"){
if(input == "add"){
var newBook = prompt("Enter name of the book to add");
books.push(newBook);
} else if(input == "list"){
console.log("List of available books :");
... | true |
655fd91c67665a597b5ab50df12f53dc402a3ded | JavaScript | shikshalokam/sl-sunbird-service | /generics/services/kendra.js | UTF-8 | 3,972 | 2.609375 | 3 | [
"MIT"
] | permissive | /**
* name : kendra-service.js
* author : Rakesh Kumar
* Date : 18-May-2020
* Description : All kendra service related api call.
*/
//dependencies
const apiBaseUrl =
process.env.KENDRA_SERIVCE_HOST +
process.env.KENDRA_SERIVCE_BASE_URL +
process.env.URL_PREFIX;
const request = require('request');
co... | true |
839113c45b55c294e1f8f236bbc8fb2b533b8e5c | JavaScript | johnplank211/AVF-1 | /avf-project2/avf-android/assets/www/geolocation/script/main.js | UTF-8 | 1,108 | 3.3125 | 3 | [] | no_license | //geo
// Set an event to wait for Cordova to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// Cordova is loaded and Ready
//
function onDeviceReady() {
navigator.geolocation.getCurrentPosition(onSuccess, onError);
}
// Display `Position` properties from the geolocation
//
function onSuc... | true |
7d6fc06081ba100c04d5f9b91ff4cdbe105c89a0 | JavaScript | pipewriter/noescape.io | /client/js/graphics-tool/initialize-canvas.js | UTF-8 | 2,290 | 2.96875 | 3 | [] | no_license | window.GAME = {};
(function createCanvas(){
window.GAME.canvas = document.getElementById("canvas");
const shell = document.getElementById('shell');
const aspectX = 16;
const aspectY = 9;
let mouseX = 0;
let mouseY = 0;
let mousedown = false;
window.GAME.getMousePos = function getMousePo... | true |
d659cfd2049fe5d3ae1353ea91074356f6eecffc | JavaScript | kdgiddyup/FriendFinder | /app/routing/apiRoutes.js | UTF-8 | 5,269 | 2.921875 | 3 | [] | no_license | // Dependencies
var express = require('express')
var path = require("path");
// firebase integration
// *****************************
var firebase = require("firebase");
// Initialize public Firebase
var config = {
apiKey: "AIzaSyB3_mhY_yIAodzxzVTAAofGmboW92aMOmU",
authDomain: "friendfinder-6a01e.firebaseapp.com",
dat... | true |
f25068eed5f54da00ec027d2465c98dd9b9bcc1e | JavaScript | blackmjck/buzzDB | /lib/mongo.js | UTF-8 | 10,707 | 2.84375 | 3 | [
"MIT"
] | permissive | /**
* All things DB-related
*/
var mongo = require('mongodb'),
MongoClient = mongo.MongoClient,
mongourl = require('./creds').connect_url;
Db = mongo.Db,
Server = mongo.Server,
BSON = mongo.BSONPure,
mongoclient = new MongoClient( new Server( "localhost", 27017 ), { native_parser: true }),
... | true |
1c4d89a7612fd0e07e626f7b0bf5664115f919c0 | JavaScript | wc5858/leetcode-in-javascript | /21~40/34.SearchForARange.js | UTF-8 | 1,888 | 3.640625 | 4 | [
"MIT"
] | permissive | /**
* @param {number[]} nums
* @param {number} target
* @return {number[]}
*/
// 本来想偷懒
// let searchRange = function(nums, target) {
// return [nums.indexOf(target), nums.lastIndexOf(target)]
// }
// 不对,indexOf的实现应该是不满足时间复杂度的要求的
// 翻了翻v8源码,发现indexOf已经在16年的时候从js实现迁移到c++实现了- -看不太懂
// 相关commit地址:https://github.com/v... | true |
02bfef1d12384f21ab6089b265078971565adaf0 | JavaScript | dimas/jirappa | /app/lib/retro.js | UTF-8 | 7,119 | 2.609375 | 3 | [] | no_license |
function personDisplayName(person) {
// After one of our devs was removed from the organisation, I see him as a structure with
// active=false, and 'name'. No 'key', no 'displayName', no avatar URLs....
return person.displayName || person.name;
}
function formatContributors(contributors) {
var result ... | true |
539507b0dabbef2f899b0c54c227fdfc12145b5c | JavaScript | heiisenberrg/Vue-base | /src/utils/storage.js | UTF-8 | 409 | 2.796875 | 3 | [
"MIT"
] | permissive | const setItem = (key, value) => {
localStorage.setItem(key, value);
};
const setItems = (storageObjects) => {
storageObjects.forEach((storageObject) => {
this.setItem(storageObject.key, storageObject.value);
});
};
const getItem = key => localStorage.getItem(key);
const deleteItem = (key) => { localStorage.... | true |
a091efe16101c1669d07770fb4f394c88c7bfeee | JavaScript | Draym/SWmanager | /SWmanager-back/api/scripts/tools/cloneUtils.js | UTF-8 | 1,212 | 3.015625 | 3 | [] | no_license | /**
* Created by kevin on 05/01/2017.
*/
/*** CLONE ***/
function cloneObject(object) {
if (object === null) {
return null;
}
var cloned = {};
for (var key in object) {
var value = object[key];
if (value === null) {
cloned[key] = null;
} else if (Array.is... | true |
13fa198a3df80e8d6046c52a8bd33fb5b6d99065 | JavaScript | TrofimovMS/ToDo | /re-store/src/actions/index.js | UTF-8 | 1,681 | 2.703125 | 3 | [] | no_license | const booksLoaded = (newBooks) => {
return {
type: "FETCH_BOOKS_SUCCESS",
payload: newBooks,
};
};
const booksRequested = () => {
return {
type: "FETCH_BOOK_REQUEST",
};
};
const booksError = (error) => {
return {
type: "FETCH_BOOKS_FAILURE",
payload: error,
};
};
export const bookAdd... | true |
2bc2ac12a3c0bc7ebc329e3b4e3d339343e79acc | JavaScript | riteshgajare/CSC561Projects | /ray-tracing/maths.js | UTF-8 | 3,206 | 3.21875 | 3 | [] | no_license | // Mathematics class for doing relavant work
class Maths {
// Calc dot product of A&B == A.B
static dotproduct(x,y) {
return x[0]*y[0] + x[1]*y[1] + x[2]*y[2];
}
// Calc the magnitude of the vector
static magnitude(a) {
var mag = this.dotproduct(a,a);
if (mag < 0)
throw "magnitude can't be n... | true |
76ad088a75e20c7dc9da957d6bdf22139df947f9 | JavaScript | dpobozniak/movie-search | /src/index.js | UTF-8 | 1,099 | 2.65625 | 3 | [] | no_license | import MovieDb from './services/MovieDb';
import MovieListComponent from './components/MovieList';
import PaginationComponent from './components/Pagination';
import config from './movieDbConfig';
import './styles/main.scss';
const searchForm = document.querySelector('.search-form');
const searchInput = document.query... | true |
5310581d7a47e5f7f0490175a89c3ea32dd31f6e | JavaScript | zj2015262624/tjshopping | /tjshoppingsystem/src/main/webapp/js/pxianz.js | UTF-8 | 17,659 | 2.578125 | 3 | [
"MIT"
] | permissive | $(function(){
/* 省份和城市控制 */
$.each(province, function (k, p){
var option ="<option style='margin:0.2em 0;padding:0.2em 0; padding-left:1em;' value='"+p.ProID+"'>"+p.ProName+"</option>";
$("#proId").append(option);
});
$("#proId").change(function(){
var setValue = $(this).val();
$("#addressId opti... | true |
319f4c13b01ffc23681b7671ea147e4d5aa94f41 | JavaScript | honux77/practice | /javascript/cs-white/arguments.js | UTF-8 | 281 | 2.796875 | 3 | [
"MIT"
] | permissive | (function foo() {
console.log(arguments);
for (var i = 0; i < arguments.length; i++) {
if (typeof arguments[i] === 'object')
console.log( i + ": " + JSON.stringify(arguments[i]));
else
console.log( i + ": " + arguments[i]);
}
})(1, 2, 3, 'hello', {'name': 'honux'});
| true |