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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
35f7e151898cc098ecd3d5b14b20b8a4fb3b9d27 | JavaScript | colleencleary/weirdworld | /public/js/Comments.js | UTF-8 | 3,714 | 3.0625 | 3 | [] | no_license | class Comments extends React.Component {
constructor(props){
super(props)
this.state = {
commentListIsVisible: true,
addCommentIsVisible: false,
commentIsVisible: false,
editCommentIsVisible: false,
comments: [],
comment: {}
}
this.toggleState = this.toggleState.bin... | true |
918909a0709cd5be8caa013799fa2909bad1e441 | JavaScript | joedevgee/cms-hitech-apd | /api/routes/states/put.js | UTF-8 | 3,878 | 2.53125 | 3 | [
"CC0-1.0",
"LicenseRef-scancode-public-domain"
] | permissive | const logger = require('../../logger')('states route put');
const joi = require('joi');
const pick = require('lodash.pick');
const { loggedIn } = require('../../middleware');
const defaultDataHelper = require('./data');
module.exports = (app, dataHelper = defaultDataHelper) => {
const { getFields, putFields, getStat... | true |
114c072180fb29f7cbcb5e8ed21df40ab04396a7 | JavaScript | jodonnell/AnnoTATE | /line.js | UTF-8 | 429 | 2.859375 | 3 | [] | no_license | var Line = Class.extend({
init: function(point) {
this.points = [];
if (point)
this.addPoint(point);
},
load: function(points) {
this.points = points;
},
addPoint: function(point) {
this.points.push(point);
},
explodePoints: function() {
var points = [];
for (var i = 0; i < thi... | true |
b996b08524ea4d6d74c8ef7276af4209ebed5a24 | JavaScript | adriennedomingus/travel_map_blog | /app/assets/javascripts/view_selectors.js | UTF-8 | 1,808 | 2.59375 | 3 | [] | no_license | function setCSS(controlDiv, map, text) {
var controlUI = document.createElement('div');
controlUI.style.backgroundColor = '#fff';
controlUI.style.border = '2px solid grey';
controlUI.style.borderRadius = '3px';
controlUI.style.cursor = 'pointer';
controlUI.style.marginBottom = '22px';
controlUI.style.text... | true |
8034d6f1ebd67e52e2f3568f4178d26d055c0ca6 | JavaScript | adamgarwacki/iskra-przewodnik | /assets/js/new-char.js | UTF-8 | 2,697 | 3.671875 | 4 | [] | no_license | // new-char.js
// let strInput = document.getElementById('char-str');
// if(strInput) {
// console.log(strInput.value);
// }
// ponieważ jest jeden plik js (bundle.js),
// muszę sprawdzać czy odnosi się do konkretnej
// strony
// tu będą przechowywane informacje o postaci
let charData = {
charName: '',
... | true |
da804f82c2ab59a5a1dd6b5a434660ab56cf25b2 | JavaScript | alyzaw/BirthControlProject4 | /static/js/predict.js | UTF-8 | 6,204 | 2.921875 | 3 | [] | no_license | function makePredictions() {
// Grab a reference to the dropdown select element
var input1 = d3.select("#selDataset1").node().value;
var input2 = d3.select("#selDataset2").node().value;
var input3 = d3.select("#selDataset3").node().value;
var input4 = d3.select("#selDataset4").node().value;
var input5 = d3... | true |
2a1a671bd5d998914ab64b5cb0cfb75396b910f8 | JavaScript | skywalkerFE/skywalker | /packages/components/notification/src/notification.js | UTF-8 | 1,715 | 2.546875 | 3 | [] | no_license | import Vue from 'vue';
import Notification from './main.js';
const NotificationConstructor = Vue.extend(Notification)
let instance;
let instances = []
let seed = 1
const NotificationFun = function(options){
if (Vue.prototype.$isServer) return;
options = options || {};
const userOnClose = options.onClose;
cons... | true |
f442a891e8e3900bb7c4ebafa83232a65a4a0751 | JavaScript | Sharfik69/Sharfik69.github.io | /src/my-script.js | UTF-8 | 3,617 | 2.546875 | 3 | [] | no_license | $(function(){
var id = 0, check = false;
$('.add-new-list').click(function() {
$('.add-new-list').before(
'<div class="new-list" id="' + id + '">' +
'<p class="delete"> x </p> ' +
'<input class="edit-name-column" type="text" placeholder="Введите название к... | true |
846907bef243d4722e4a5539f69426287e1ec8b6 | JavaScript | raged07/test | /www/js/platzom.js | UTF-8 | 2,291 | 4.46875 | 4 | [] | no_license | //si la palabra termina en "ar", se le quitan los dos ultimos caracteres
function platzom(str){
let translation = str;
if (str.toLowerCase().endsWith('ar')){
translation = str.slice(0,-2);//corta la cadera, elimina los 2 ultimos caracteres
}
/*Si la palabra inicia con "z"se le anade los caract... | true |
601e662314cdfd01f0553aca611e753978ea3c67 | JavaScript | Gaja24/it1_1718 | /intro_til_firebase/julekalender/julemain.js | UTF-8 | 816 | 2.890625 | 3 | [] | no_license | // Initialize Firebase
var config = {
apiKey: "AIzaSyA8AG8SMweTNFHrkMIv_sFzN0xAA2iX7xo",
authDomain: "firestore-224e3.firebaseapp.com",
databaseURL: "https://firestore-224e3.firebaseio.com",
projectId: "firestore-224e3",
storageBucket: "firestore-224e3.appspot.com",
messagingSenderId: "146684242... | true |
e68f730da3de95c073e1a8aa5bd0ea44900c7b19 | JavaScript | jeetsj/CovidDashboard | /OOD/OOD/OOD-Server/src/Routes/userRoutes.js | UTF-8 | 1,617 | 2.5625 | 3 | [] | no_license | const express = require('express');
const uniqueString = require('unique-string');
const router = express.Router();
const jwt = require('jsonwebtoken');
const fs = require('file-system');
router.post('/', (req, res) => {
console.log(req.body);
const { email, password } = req.body;
fs.readFile("./assets/us... | true |
12f302310adf1f9474b4468f9c1f32758b726f95 | JavaScript | watership/housingloan-calc | /test/index_old.js | UTF-8 | 2,974 | 2.90625 | 3 | [
"MIT"
] | permissive | const Big = require('big.js');
// 等额本息计算方式
exports.fixCalc = function(loan, year, rate) {
let oldLoan = loan;
loan = Big(loan).times(10000);
let months = Number.parseInt(Big(year).times(12));
rate = Big(rate).div(100);
const rateMounth = rate.div(12)
const a = (rateMoun... | true |
aa308ee418011e9d76919f34180e6630540bd2ab | JavaScript | SiddharthMeyan/React-Habit-Streak | /src/App.js | UTF-8 | 6,148 | 2.59375 | 3 | [] | no_license | import { useState, useEffect } from "react";
import "./App.css";
import { fire, db, timestamp } from "./firebase/config";
import Timer from "./components/Timer";
import { Main } from "./components/Main";
import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
import History from "./components/History... | true |
9ad6d46ae1972ef0518968125fa94e5a2ac720dd | JavaScript | Romanskiy94/New_year | /assets/js/index.js | UTF-8 | 1,045 | 3.390625 | 3 | [] | no_license | timeend= new Date();
// IE и FF по разному отрабатывают getYear()
timeend= new Date(timeend.getYear()>1900?(timeend.getYear()+1):(timeend.getYear()+1901),0,1);
// для задания обратного отсчета до определенной даты укажите дату в формате:
// timeend= new Date(ГОД, МЕСЯЦ-1, ДЕНЬ);
// Для задания даты с точностью до време... | true |
f415f39f9fd3a23846191f2efc0f86647ec5e130 | JavaScript | rphansen91/OurPromise | /ourPromise.spec.js | UTF-8 | 2,253 | 2.828125 | 3 | [] | no_license | var expect = require('expect');
var ourPromise = require('./ourPromise');
describe('Promise Implementation', function () {
it('should throw an error if no resolver ', function () {
expect(ourPromise).toThrow(/You must pass a resolver function/)
})
it('should throw an error if new keyword not used ... | true |
83c0934b07222a355fa13fa94ba2790727578d51 | JavaScript | Tom-Fitz-3/2105-OKU-Wizard-News-Starting-Point | /app.js | UTF-8 | 3,186 | 2.609375 | 3 | [] | no_license | const express = require("express");
const morgan = require("morgan");
const {PORT = 1337} = process.env;
const posts = require("./postBank");
const app = express();
app.use(morgan('dev'));
app.use(express.static('public'));
app.get("/test", (req, res) => res.send("Hello World!"));
app.get("/", (req, res) => {
co... | true |
a6fd1d7d00df3d5f28630362bccdf10756c5319a | JavaScript | denniswong0106/lotide | /test/countLettersTest.js | UTF-8 | 1,206 | 3.21875 | 3 | [] | no_license | const countLetters = require('../countLetters');
const assert = require('chai').assert;
describe('#countLetters',() => {
const sentence = 'hello darkness my old friend';
console.log('const sentence = ', sentence);
it('it should return 2 if given countLetters(sentence)["n"]', () => {
let actualOutput = countL... | true |
af2ad42a1cf37efdc8c7ea32fe9d3d201188ed96 | JavaScript | Delpire/Delpire.github.io | /projects/heliattack/background.js | UTF-8 | 2,698 | 3.015625 | 3 | [] | no_license |
var LEVEL_LENGTH = [3000, 6000, 6000]
// Background class
//----------------------------------
var Background = function(game, x, y) {
this.game = game;
this.back_x = x;
this.mid_x = x;
this.front_x = x;
};
Background.prototype = {
render: function(context) {
context.save();
... | true |
215fa332fa71ce07b5257dfbebd0b47549a22b71 | JavaScript | cadencegail/cadencegail.github.io | /mashUp/mashup-gh-pages/mashup.js | UTF-8 | 6,561 | 2.546875 | 3 | [] | no_license | //FACEBOOK
// This is called with the results from from FB.getLoginStatus().
function statusChangeCallback(response) {
console.log('statusChangeCallback');
console.log(response);
// The response object is returned with a status field that lets the
// app know the current login status of the person.
// Full... | true |
77fc8475742fc00c590cf0d0d6c4493ffb3d5aac | JavaScript | Indre101/Indre101.github.io | /Door_game/js/script.js | UTF-8 | 12,876 | 3.109375 | 3 | [] | no_license | const landingPageContainer = document.getElementById("landingPageContainer");
const startGamePage = document.getElementById("startGamePage");
const popUpInstructionsContainer = document.getElementById("popUpInstructionsContainer");
const gameContainer = document.querySelector(".body");
const startButton = document.getE... | true |
8cfc20340c187845ecdf0b6600ba025174a9e255 | JavaScript | dylanmei/Whendle | /whendle/api/observable.js | UTF-8 | 657 | 2.625 | 3 | [
"MIT"
] | permissive |
Whendle.Observable = Class.create({
initialize: function() {
this._hash = new Hash();
},
observe: function(name, handler) {
var handlers = this.handlers(name);
if (handlers.length) {
handlers.push(handler);
}
else {
this._hash.set(name, [handler]);
}
},
ignore: function(name, handler) {
if... | true |
748e52fa30b15779d4a14c71ea19025cb00a5452 | JavaScript | Albertosnp/weather-app-consola | /app.js | UTF-8 | 1,593 | 2.921875 | 3 | [] | no_license | const { leerInput, inquirerMenu, pause, ciudadesAelegir } = require("./helpers/inquirer");
require("dotenv").config()
require('colors')
const Busquedas = require("./models/Busquedas");
const main = async () => {
let option = 0
const busquedas = new Busquedas()
do {
option = await inquirerMenu()
switch (o... | true |
e2f66720d63b5cd15d80123171295aed28de3bb1 | JavaScript | RadAtanasov/Clock | /assets/js/script.js | UTF-8 | 1,219 | 3.296875 | 3 | [] | no_license | var hourHand = document.getElementsByClassName('hour_hand')[0];
var minuteHand = document.getElementsByClassName('minute_hand')[0];
var secondHand = document.getElementsByClassName('second_hand')[0];
//var startDate = new Date();
//var startRotateSecondHand = startDate.getSeconds();
//var startRotateMinuteHand = startD... | true |
7aef1ba58276fb495b2d18f86be9e7c1dcaa3be8 | JavaScript | lolwuz/it | /react-buggle/src/reducers/checkReducer.js | UTF-8 | 1,404 | 2.65625 | 3 | [] | no_license |
/*
src/reducers/checkReducer.js
*/
export default (state = { loading: false, guesses: [], solutions: [], points: 0, totalPoints: 0 }, action) => {
switch (action.type) {
case 'R_BOARD_CHECK':
return { ...state, loading: true }
case 'S_BOARD_CHECK':
let guess = action.payload... | true |
56cb362bb6b95fc8beca3afcb0033066b9cadf88 | JavaScript | PorcelainAddict/Tues_Painter_Decorator | /specs/room_spec.js | UTF-8 | 711 | 2.828125 | 3 | [] | no_license | const assert = require('assert');
const Room = require('../room.js');
describe('Room', function() {
beforeEach(function() {
//space reserved for room something soemthing
room = new Room (10);
});
it('should have an area in square meters', function() {
const actual = room.area;
const expected = 10;... | true |
b8664c996608c849314f40a70e0506a7494d8259 | JavaScript | kauesedrez/CedrosDatabase | /cedrosDb.jss | UTF-8 | 26,424 | 2.59375 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | /***
[cdoc]
#autor: Winetu Kaue Sedrez Bilhalva
#name: Database Class
#obs: https://msdn.microsoft.com/en-us/library/hww8txat(v=vs.84).aspx - documentação
***/
/*
[init block]
#desc: testa se a jquery está funcionando
*/
if(typeof $ == "undefined") {
document.write("<h1>Cedros Database</h1><h2>Hello Fol... | true |
2f3f1d6350a4c58d3838929ab3f57e33ea9cbde1 | JavaScript | Stephaaan/ang_itat_reg_be_server | /src/runners/tokenRemover.runner.js | UTF-8 | 386 | 2.8125 | 3 | [] | no_license | const state = require("../state/state");
module.exports = () => {
const oldTokens = state("tokens");
const newTokens = []
oldTokens.forEach(token => {
console.log("kukame tokeny");
if(Date.now() < token.validUntil){
console.log("ma to nevymazat");
newTok... | true |
367bd81d8c8030f13ab3c58460691880e1d7bdf4 | JavaScript | vbuzato/tic-tac-toe | /src/components/Board.jsx | UTF-8 | 847 | 2.65625 | 3 | [] | no_license | import React from 'react';
class Board extends React.Component {
render() {
const { board, play, resetGame } = this.props;
return (
<div className="board">
{board.map((_, index,) => {
let option, choice, choose = '';
if (board[index] !== 'E') {
choice = board[ind... | true |
430aa5b3f54e2ea358276ae2f5eca07e961c897a | JavaScript | jsera/gatest | /public/js/resultview.js | UTF-8 | 2,379 | 2.84375 | 3 | [] | no_license | var ResultView = function(controller, resultModel) {
this.controller = controller;
this.model = resultModel;
this.element = document.createElement("div");
this.favorited = false;
this.details = null;
this.init();
};
(function() {
ResultView.prototype.init = function() {
... | true |
9be4637f7a68581d09d505382c64ba93e9cb3cf1 | JavaScript | LL0814/microCourseOnine | /static/assets/javascripts/profile.js | UTF-8 | 4,463 | 2.578125 | 3 | [] | no_license | //upload header image
$("#uploadHeadImg").on('change', function(){
var file = document.querySelector("#uploadHeadImg").files[0];
var min_width = 150;
var min_height = 150;
if (file && /\.(jpe?g|png|gif)$/i.test(file.name) ) {
//读取图片数据
var reader = new FileReader();
reader.readAs... | true |
fa1eb66e25522389883bb9e1d161f62636ff04d9 | JavaScript | ItsJuice/quizzlr | /app/assets/javascripts/quizzlr/quiz/quiz-functions.js | UTF-8 | 7,398 | 2.96875 | 3 | [
"MIT"
] | permissive | $(function()
{
//
//
// ***** Control progress bar *****
//
//
function updateProgress(percentage)
{
// Set progress bar's width and update text to the correct percentage
$('#msch-progress').css('width', '' + percentage + '%');
$('#msch-progress_text').html('' + per... | true |
0d19111d92250b607d509301fd4500e3298c30ea | JavaScript | CSA-DanielVillamizar/voteomatic | /resources/js/mixins/meetingMixin.js | UTF-8 | 1,166 | 2.625 | 3 | [] | no_license | /**
* For any component that needs access to the
* current meeting.
*
* @type {{computed: {}}}
*/
module.exports = {
data: function () {
return {
linkBase: "https://voteomatic.com/lti-entry/"
}
},
computed: {
/**
* The current global meeting
*/
... | true |
4c84362c7bf6b37f9dfaa5a577f195af642adbec | JavaScript | alermar69/StairsGit | /StairsGit/JavaScript/work/calculator/timber_stock/change_offer.js | UTF-8 | 20,884 | 2.5625 | 3 | [] | no_license | function changeOffer() {
var stairModel = params.stairModel;
var model = params.model;
/*меняем главное описание*/
if (model == "тетивы") {
document.getElementById('description').innerHTML =
"<p>Изящная полностью деревянная лестница в классическом стиле." +
"Лестница изготавливается из клееного мебельного щита вы... | true |
ee5b0b3da4f94fbff31cbaf05db6acea9485376f | JavaScript | LoriWinston/lab-04-pokemon-api | /src/Components/Sort.js | UTF-8 | 738 | 2.546875 | 3 | [] | no_license | // import React, { Component } from 'react'
// import pokeData from '../Data'
// export default class Sort extends Component {
// render() {
// return (
// <select
// value={this.props.currentValue}
// onChange={this.props.handleChange}
// >
// {... | true |
71543857d7cc2a259e012b8f966e149b0bd37ecb | JavaScript | karanaso/node-cluster-phrases | /specs/unit/source/phrasesAssessor.spec.js | UTF-8 | 4,406 | 2.796875 | 3 | [] | no_license | const should = require('should');
const rewire = require('rewire');
const os = require('os');
const phrasesAssessor = rewire('../../../source/phrasesAssessor');
describe('phrasesAssessor.js', () => {
let textData;
beforeEach(() => {
textData = 'hypertensive disorder' + os.EOL +
'acid reflosux' + os.EOL... | true |
4c47f4ceb2979fec9d04472b7333a0f9203c26ae | JavaScript | captain-blue210/typescript-lesson | /function-class/points.js | UTF-8 | 225 | 2.703125 | 3 | [] | no_license | var Point = /** @class */ (function () {
function Point() {
this.x = 0;
this.y = 0;
}
return Point;
}());
var pointA = new Point();
var pointB = { x: 2, y: 4 };
var pointC = { x: 5, y: 5, z: 10 };
| true |
146e2fe6a2fc5585f8bfb7d79208e9854401f7e1 | JavaScript | derhuerst/vbb-rest | /lib/to-ndjson-buf.js | UTF-8 | 310 | 2.578125 | 3 | [
"ISC"
] | permissive | const toNdjsonBuf = (items) => {
const chunks = []
let i = 0, bytes = 0
for (const item of items) {
const sep = i++ === 0 ? '' : '\n'
const buf = Buffer.from(sep + JSON.stringify(item), 'utf8')
chunks.push(buf)
bytes += buf.length
}
return Buffer.concat(chunks, bytes)
}
export {
toNdjsonBuf,
}
| true |
e733b0d37f8bd4e512fcaa59cec834941047c782 | JavaScript | kscarrot/involution | /src/leetcode/LC104.js | UTF-8 | 296 | 3.234375 | 3 | [
"MIT"
] | permissive | /**
* @param {TreeNode} root
* @return {number}
* @tag tree
* @description
[二叉树的最大深度](https://leetcode-cn.com/problems/maximum-depth-of-binary-tree/)
*/
var maxDepth = function (root) {
if (!root) return 0
return Math.max(maxDepth(root.left), maxDepth(root.right)) + 1
}
| true |
c763b453c9f07bfe633c47fe12dee7f5f2a6c89b | JavaScript | jike132/doc | /js/func.js | UTF-8 | 4,473 | 4.03125 | 4 | [] | no_license | //手写实现call
/*
思路:
context容错处理
Symbol实现唯一key值
context对象新增唯一key属性,赋值:myCall的调用者
此时this已指向context对象
执行context对象里面的调用者函数
删除添加的唯一key值属性
*/
*/
Function.prototype.call2 = function (context) {
var context = context || window;
context.fn = this;
var args = [];
for(var i = 1, len = arguments.length; i < len; i++)... | true |
92f2dce3624a1017be8f2a0e5cebcef5e201252e | JavaScript | Vlad1m1r95/RubyTaskManager | /app/assets/javascripts/tasks.js | UTF-8 | 4,146 | 2.515625 | 3 | [] | no_license | window.onload = function() {
let $selects_status = document.querySelectorAll('#status_select')
let $selects_assignee = document.querySelectorAll('#assignee_select')
let $search = document.querySelector('#search-js')
let input = ""
let $inputs = document.querySelectorAll('input')
const task_name = document.q... | true |
7b6aec39b8833845564220daacabc733646949f3 | JavaScript | jealob/todo-list | /controllers/todoController.js | UTF-8 | 1,972 | 3 | 3 | [] | no_license | // The controller contains the routes. that is control the request and response flow
// require/immport all the dependencies including the model(todo)
const express = require("express");
const task = require("../models/todo.js");
const router = express.Router();
// Import handlebars helper module package
const hbs = re... | true |
43a38b6abe0af9568df77319bd1590d186220727 | JavaScript | ejohann/webpack-eslint | /src/add-image.js | UTF-8 | 280 | 2.546875 | 3 | [] | no_license | import Hd from './hd_logo.png';
function addImage(){
const img = document.createElement('img');
img.alt = 'Hanne Digital Logo';
img.width = 300;
img.src = Hd;
const body = document.querySelector('body');
body.appendChild(img);
}
export default addImage; | true |
afa4316c66f0aa547fa45ecdb2a7983a8e78cff4 | JavaScript | JohnVHumes/JohnVHumes_Web | /build/web/js/components/blog.js | UTF-8 | 8,267 | 2.515625 | 3 | [] | no_license | function blog(id) {
// ` this is a "back tick". Use it to define multi-line strings in JavaScript.
var content = `
HW 1 Home Page
<p>
My web development experience consists of nothing, prior to this class. This is the first time I've worked on anything front end related.
</p>
<p>
In t... | true |
068f721c372ecb3487902ec6d6ba63a126445194 | JavaScript | vy-b/FlixList | /project/src/Tests/Movie.test.jsx | UTF-8 | 3,665 | 2.5625 | 3 | [] | no_license | import React from 'react';
import {mount} from 'enzyme';
import Movie from '../Components/Movie'
import MovieTableEntry from '../Objects/MovieTableEntry'
import {BrowserRouter as Router} from 'react-router-dom'
describe('Movie.jsx tests', () => {
test('Renders without crashing', () => {
const wrapper = cre... | true |
479e772fac54d564c6c34851b4c36c75d6d9bb50 | JavaScript | CesiumGS/cesium | /packages/engine/Source/Scene/TilesetMetadata.js | UTF-8 | 5,301 | 2.765625 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-free-unknown",
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"OFL-1.1",
"CC-BY-3.0",
"JSON",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-proprietary-license",
"CC-BY-4.0",
"MPL-2.0",
"ISC",
"CC-BY-SA-2.0",
"LicenseRe... | permissive | import Check from "../Core/Check.js";
import defaultValue from "../Core/defaultValue.js";
import defined from "../Core/defined.js";
import MetadataEntity from "./MetadataEntity.js";
/**
* Metadata about the tileset.
* <p>
* See the {@link https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_metadata|3D... | true |
788be35ea9ced76b104fff7f44a576b1567ff6f8 | JavaScript | zonghuang/learning-js-data-structures | /src/01.Array/05.concat-array.js | UTF-8 | 417 | 3.671875 | 4 | [
"MIT"
] | permissive | // 数组合并 concat()
/**
concat() 连接 2 个或 2 个已上的数组,并返回结果。
concat() 可以向一个数组传递数组、对象或是元素。数组会按照该方法传入的参数顺序连接指定的数组。
*/
const zero = 0;
const positiveNumbers = [1, 2, 3];
const negativeNumbers = [-3, -2, -1];
let numbers = negativeNumbers.concat(zero, positiveNumbers); // [-3, -2, -1, 0, 1, 2, 3]
| true |
c02dc57bb488208fb560bb71f318043fb5d4e35b | JavaScript | CarolineVinet/project-m5-e-commerce | /client/src/reducers/companies-reducer.js | UTF-8 | 893 | 2.921875 | 3 | [] | no_license | const initialState = {
companies: null,
status:"idle"
}
const companiesReducer = (state = initialState, action)=> {
switch(action.type) {
case 'REQUEST_COMPANIES' : {
return { ...state, status: "loading" }
}
case 'RECEIVE_COMPANIES' : {
return {
... | true |
ba778580b604fcd32885ff330746f950b15dbf7f | JavaScript | interestdashing/test-data | /makeType1.js | UTF-8 | 1,121 | 3.328125 | 3 | [] | no_license | const process = require("process");
const fs = require("fs");
const iterations = process.argv[2] || 0;
const makeGuid = function () {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
const r = Math.random() * 16 | 0;
const v = c === "x" ? r : (r & 0x3 | 0x8);
return v.... | true |
28f300aa1b113df9c54c55d21b0af67623fb8f02 | JavaScript | leebyp/n-queens | /src/solvers.js | UTF-8 | 9,929 | 3.5 | 4 | [] | no_license | /* _
___ ___ | |_ _____ _ __ ___
/ __|/ _ \| \ \ / / _ \ '__/ __|
\__ \ (_) | |\ V / __/ | \__ \
|___/\___/|_| \_/ \___|_| |___/
*/
// hint: you'll need to do a full-search of all possible arrangements of pieces!
// (There are also optimizations that will allow you to skip a lot of the dead s... | true |
34d08a03c289b4c846ce3a9de424289e76165ddc | JavaScript | brendonion/midterm-project | /server/routes/resources.js | UTF-8 | 4,988 | 2.546875 | 3 | [] | no_license | 'use strict';
const express = require('express');
const router = express.Router();
const dateNow = new Date();
const theDate = dateNow.toLocaleString();
const mw = require('../routes/middleware');
module.exports = (knex) => {
// adds middleware to this page
const middleware = mw(knex);
//retrieves create new ... | true |
d08716029c92b1d40210fea281b98cd55f55bab0 | JavaScript | daniellenguyen/nguyen-danielle-webdev | /public/project/views/search/controllers/petDetails.js | UTF-8 | 2,956 | 2.625 | 3 | [] | no_license | (function() {
angular
.module("PetWebsite")
.controller("PetDetailsController", PetDetailsController);
function PetDetailsController($location, $routeParams, SearchService) {
var vm = this;
vm.petId = $routeParams["petId"];
vm.carouselHelper = carouselHelper;
vm.toRegister = toRegister;
... | true |
2c3ab08f98f36bd5ad5211071688e49243addbd0 | JavaScript | Naixes/demo-collection | /learnVue/vue-cli-webpack/src/pages/jsxScopSlot/components/levelFunction.js | UTF-8 | 535 | 2.609375 | 3 | [] | no_license | // 返回不同级别的标题:l=1/2/3/4/5/6
export default {
props: {
l: {
type: Number
}
},
render (h) {
let tag = `h${this.l}`
// return <tag>{this.$slots.default}</tag>
return h(tag, {}, this.$slots.default)
// h方法的参数:
// h1 on-click={()=>{alert(1)}} style={{color:'red'}}>你好</h1>
// h('h1... | true |
ad9ce9a6884770ed8053a0b07a8e112faf1ad066 | JavaScript | guoyu07/jSound | /src/jSound.js | UTF-8 | 2,341 | 2.828125 | 3 | [] | no_license | /*!
* jSound 0.0.1 preview
* @author TooBug <i@toobug.net>
* @license MIT
*/
(function(w){
'use strict';
var jSound = {};
var elem;
var init = function(){
elem = document.createElement('audio');
if (!elem.canPlayType){
elem = document.createElement('bgsound');
}
document.body.appendChild(elem);... | true |
b8371f2ca5aeebe985daf2c865e81b9ccbf006bf | JavaScript | edsonlima2506/Eventoge | /src/App.js | UTF-8 | 2,890 | 2.65625 | 3 | [] | no_license | import Header from './Components/Header';
import Form from './Components/Form';
import Pratos from './Components/Pratos';
import Result from './Components/Result';
import Lista from './Components/Lista'
import pratosInfos from './data';
import { funcionarios } from './data'
import './App.css';
import React from 'react'... | true |
992e68d69fdfeb51aa26ea4dfa2d0e74455791be | JavaScript | mazsola739/Rika-s-Katas | /Curious_Constructors/5 kyu Simple Fun #166: Best Match/index.js | UTF-8 | 1,723 | 4.09375 | 4 | [] | no_license | /*
Task
"AL-AHLY" and "Zamalek" are the best teams in Egypt, but "AL-AHLY" always wins the matches between them. "Zamalek" managers want to know what
is the best match they've played so far.
The best match is the match they lost with the minimum goal difference. If there is more than one match with the same differen... | true |
283ff6ffbeac76884004372be7647a43cdb540bb | JavaScript | edmundho/ongoing_study | /jul2018/jul18/linked_list_cycle_ii.js | UTF-8 | 942 | 3.953125 | 4 | [] | no_license | // Given a linked list, return the node where the cycle begins.If there is no cycle, return null.
// Note: Do not modify the linked list.
// Follow up:
// Can you solve it without using extra space ?
/**
* Definition for singly-linked list.
* function ListNode(val) {
* this.val = val;
* this.next = nul... | true |
18f5da13575eb45f132b313dddd0bae593d97810 | JavaScript | emilti/ParkingSystem | /client/src/Utils/dropdowns.js | UTF-8 | 2,844 | 2.546875 | 3 | [
"MIT"
] | permissive | const buildCategoriesDropdown = async (dropdownType) =>{
let serverOptions = await getCategories()
switch(dropdownType){
case "Edit visit":
return [...serverOptions]
case "Enter visit":
return [{"value": "", "label": "Select category"}, ...serverOptions]
case "Fi... | true |
35c3ef22c067194bef65f8b4e3f4fec5c54d0f89 | JavaScript | aakash2028/Assignment-6 | /CoinFlipGame/script.js | UTF-8 | 658 | 3.859375 | 4 | [] | no_license | var coinFlip = Math.round(Math.random());
var result = "";
var choice = window.prompt("Enter 'H' for Heads or 'T' for Tails");
if(coinFlip == 0){
result = "F";
}else if(coinFlip == 1){
result = "H";
}
if(result == "H" && choice == "H"){
window.alert("The flip was heads and you chose heads...you win!");
}els... | true |
5772833aa6a307fea2ba94a3cca93347a6e42c83 | JavaScript | EasonLin0716/rgb-to-hex-converter | /main.js | UTF-8 | 1,638 | 3.578125 | 4 | [] | no_license | // red part
const redSlider = document.querySelector('#red-silder')
let redValue = document.querySelector('.red-value')
let redOutCome = document.querySelector('.red-outcome')
// green part
const greenSlider = document.querySelector('#green-slider')
let greenValue = document.querySelector('.green-value')
let greenOutCo... | true |
112f14825e4304c56dded5a90e45336743aeaf8b | JavaScript | ducaale/t9-server | /src/t9.js | UTF-8 | 800 | 3.234375 | 3 | [] | no_license | const Dictionary = require('./dictionary')
const WordRanker = require('./wordRanker')
const dictionary = new Dictionary()
const wordRanker = new WordRanker()
function collectWords(path, words, current = '', depth = 0) {
if (!dictionary.isValidPrefix(current)) { return }
if (current.length == path.length) {
wo... | true |
e21a9acd5ffbe628bd4455948031ed86610df452 | JavaScript | dandyman2601/react-modal-json | /index.js | UTF-8 | 642 | 2.5625 | 3 | [] | no_license | const express = require('express');
const path = require('path');
const list = require('./Test JSON.json')
const app = express();
const cors = require('cors');
app.use(cors());
// Serve the static files from the React app
app.use(express.static(path.join(__dirname, './build')));
// An api endpoint that returns a shor... | true |
edf166f652a9dab8c0dce94203849779bbdcb390 | JavaScript | alissin4444/javascript-study | /ArrayMethodsThatIShouldKnow.js | UTF-8 | 5,033 | 4.59375 | 5 | [] | no_license | // forEach faz com que você consiga percorrer um array
const arr = [1, 2, 3, 4, 5, 6];
arr.forEach(item => {
console.log(item); // output: 1 2 3 4 5 6
});
-----------------------------------------------------------------------------------
// includes permite você checar se existe existe um elemento no array b... | true |
f28424efdad41c55f4ea8480b13b7c9bbff08c9c | JavaScript | wangcylive/code | /javascript/test/drag/mobile/main.js | UTF-8 | 4,784 | 2.625 | 3 | [] | no_license | /**
* Created by Wangcy on 2015/2/3.
*/
(function(w, d) {
var drag1 = d.getElementById("drag1"),
drag2 = d.getElementById("drag2");
var dragList = d.querySelectorAll(".story");
var dragCoords1 = (function() {
var x = drag1.offsetLeft,
width = drag1.offsetWidth,
y ... | true |
804401a6d7be0946d5a1eea40e2f056914fe0a7f | JavaScript | dbwcooper/chatgroup-backend | /controller/comment.js | UTF-8 | 1,338 | 2.65625 | 3 | [] | no_license |
const { _findRoomByLink } = require('../models/room');
const { _createComment, _getRoomDetailByLink } = require('../models/comment');
/**
* 增加一条评论
* userName: 'George James',
* roomLink:
* avatar: { color: '#1890ff', alif: 'C' },
* moment: 1521300207000,
* content: '<span style="color: red">12321332</sp... | true |
557127d132b849f2496c6516443ee53db8619c2e | JavaScript | calvinfreese/Weather-App | /script.js | UTF-8 | 9,189 | 2.796875 | 3 | [
"MIT"
] | permissive | $(document).ready(function () {
const APIkey = "39a1d34577f4801b22aafca38b9e1e96";
var weatherIconCode = "";
var inputResponse = "";
var history = [];
function loadLastSearch() {
if (localStorage.getItem("key_0") != null) {
// for (i = 0; i < localStorage.length; i++) {
var keyIndex = localS... | true |
020328c22700af2811af408d04095c93fa2f6da2 | JavaScript | erin-smith/menu-maker | /client/src/components/MainCard/index.js | UTF-8 | 4,501 | 2.515625 | 3 | [] | no_license | import React, {useState, useEffect} from "react";
import MenuSelectButton from "../MenuSelectButton";
import EditButton from "../EditButton";
import MenuList from "../MenuList";
import API from "../../utils/API";
import CategoryModal from "../CategoryModal"
function MainCard (){
const [selectedMenuData, setSelect... | true |
692de6f5197c74c3ee070ee1a268b83916143efc | JavaScript | mindbullet/mindbullet.github.io | /chapter14/fishcreek/scripts/fishcreek.js | UTF-8 | 219 | 2.765625 | 3 | [] | no_license |
$(function() {
// show last modified date at bottom of page
var dateDisplay = $('#date-display');
var message = 'This page was last modified on: ' + document.lastModified;
dateDisplay.html(message);
}); | true |
77204c03bbec222d84f1d8a99cb30af7df481fc6 | JavaScript | simCecca/ClassicGames | /src/games/gameLogics/SnakeLogic.js | UTF-8 | 1,317 | 3.171875 | 3 | [] | no_license | class SnakeLogic{
constructor(boardDimensions){
this.boardDimensions = boardDimensions;
}
newApplePosition(){
return {row: Math.floor(Math.random() * this.boardDimensions), column: Math.floor(Math.random() * this.boardDimensions)};
}
controller(event, direction){
const newDi... | true |
defc351f90e8c8d9c11bc02367c903b691cdd5df | JavaScript | ZECTBynmo/gyp-to-obj | /gyp-to-obj.js | UTF-8 | 1,165 | 2.953125 | 3 | [] | no_license | //////////////////////////////////////////////////////////////////////////
// gyp-to-obj - Read gyp files and serialize them into JavaScript objects
//////////////////////////////////////////////////////////////////////////
//
// Main script!
/* ----------------------------------------------------------------------
... | true |
e5f123c0c54b87357b70d7a72a89fcc4e57ba64e | JavaScript | YoKaramfilova/SoftUni-Coursework | /Programming Fundamentals with JavaScript/Mid Exam/03-mid-exam.js | UTF-8 | 1,871 | 3.515625 | 4 | [] | no_license | function solve(arr) {
let collection = arr.shift().split(' ');
for (let i = 0; i < arr.length; i++) {
let command = arr[i].split(' ');
if (command.includes('Delete')) {
let index = +command[1];
if (index >= 0 && index < collection.length) {
collection.s... | true |
b17d35f5c3dd4c75c19e4e848d6cf64937dbcf85 | JavaScript | aslafy-z/home-assistant-polymer | /src/panels/lovelace/cards/hui-entity-filter-card.js | UTF-8 | 2,113 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | import { PolymerElement } from "@polymer/polymer/polymer-element";
import { createCardElement } from "../common/create-card-element";
import { processConfigEntities } from "../common/process-config-entities";
function getEntities(hass, filterState, entities) {
return entities.filter((entityConf) => {
const stat... | true |
a16491e921c45db9a3e37abf4800eed56b3ddf13 | JavaScript | landongn/sleepy | /src/level/schemes/DenseCastleScheme.js | UTF-8 | 9,326 | 2.671875 | 3 | [] | no_license | import { digExits } from '../LevelConnections';
import TileContainer from '../TileContainer';
import { TILE_TYPE_FLOOR, TILE_TYPE_WALL } from '../TileData';
import { pickRandom, randomInt } from '../../utils/rand';
import { computeAStar } from '../../utils/AStar';
import { diagonalDistance } from '../../utils/diagonalD... | true |
9ed4dcb8fe46791f6e06bd1b6d232a46d40187be | JavaScript | jccastiblancor/forms | /src/customHooks/useForm.js | UTF-8 | 643 | 2.5625 | 3 | [] | no_license | import { useState } from "react";
const useForm = (validateForm) => {
const [errors, setErrors] = useState({});
const [values, setValues] = useState({});
const handleChange = (evt) => {
setValues({
...values,
[evt.target.name]: evt.target.value,
});
};
const initialValues = (val) => {
... | true |
ef493df9d602d1d218ff418faa1d1d20103279af | JavaScript | yehor-dykhov/SS | /OLD/hw_1602015_module5/group.js | UTF-8 | 1,081 | 3.21875 | 3 | [] | no_license | function Group (_nameGroup) {
var nameGroup = _nameGroup,
students = [];
this.getNameGroup = function () {
return nameGroup;
};
this.addStudent = function (name) {
students.push(new Student(name));
console.log('Student %s was added', name);
};
this.addStudents... | true |
7228699fb588f8dbb7b7a5723a6635c45f0ea11b | JavaScript | riebel/pixi-babel-webpack | /src/app.js | UTF-8 | 1,323 | 2.84375 | 3 | [] | no_license | import * as PIXI from 'pixi.js'
class App {
constructor() {
this.renderer = PIXI.autoDetectRenderer(800, 600, { antialias: true });
// create the root of the scene graph
this.stage = new PIXI.Container();
this.speed = 0.01;
this.frame = 0;
this.render();
... | true |
84cb3fc4fc3ea4e18f17e07c787852c7bcd1f514 | JavaScript | Sivory/sivory.github.com | /mylab/cs/game/scripts/Old/background.backup.js | UTF-8 | 3,465 | 2.71875 | 3 | [] | no_license | var Util = imports('util');
var actorList = [
// assets('zombie001'),
// assets('zombie002'),
// assets('zombie003'),
// assets('zombie004'),
// assets('zombie005'),
// assets('zombie006'),
// assets('zombie007'),
// assets('zombie008'),
// assets('zombie009')
];
var Background = function(callbackCenter) {
... | true |
90c343833432624058cd2439c1661b8747957ac4 | JavaScript | dart-lang/webdev | /dwds/debug_extension/web/devtools.js | UTF-8 | 2,238 | 2.578125 | 3 | [
"BSD-3-Clause"
] | permissive | (function loadDevToolsScript() {
const DDR_DART_APP_ATTRIBUTE = 'data-ddr-dart-app';
// Note: Changes to the DEBUGGER_PANEL_NAME and INSPECTOR_PANEL_NAME
// must be reflected in `tool/update_dev_files.dart` as well.
const DEBUGGER_PANEL_NAME = 'Dart Debugger';
const INSPECTOR_PANEL_NAME = 'Flutter Inspector';... | true |
042112a3209f6b7af105f2c68b304fbee9e791c6 | JavaScript | yiy142/gallerize | /server/store.js | UTF-8 | 4,817 | 2.5625 | 3 | [
"MIT"
] | permissive | "use strict";
const _ = require("lodash");
const bodyParser = require("body-parser");
const express = require("express");
const mongodb = require("mongodb");
const colors = require("colors/safe");
const app = express();
const cors = require('cors');
app.options('*', cors());
const MongoClient = mongodb.MongoClient;
c... | true |
f401f098646681f5aa8e63cfecbb88e08935a2c2 | JavaScript | chezhiangit/BabyCare | /App/Reducers/babyDetailsReducer.js | UTF-8 | 1,072 | 2.75 | 3 | [] | no_license | const DEFAULT_STATE = [{
key:'',
babyName:'',
DOB:'',
placeOfBirth:'',
birthWeight:'',
lengthAtBirth:'',
bloodGroup:'',
identification:'',
remarks:''
}]
export default (state = DEFAULT_STATE, action)=> {
// console.log('baby details reducer : Action type: '+action.type)
switch... | true |
1ad6c669736c92a9edb1068627aaf55f0d31882a | JavaScript | Seb6277/form_project | /routes/event.js | UTF-8 | 833 | 2.546875 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
// Event model
const Event = require('../models/Event');
router.get('/places', (req, res) => {
Event.find((err, items) => {
if (err) {
console.log(err);
res.end();
} else {
res.send(items);
... | true |
443a4ff8aedf88bdd4dc02e21584ecf85dbf6b2a | JavaScript | nttung1211/coding-archive | /node/Jonas/bootcamp/1-node-farm/starter/index.js | UTF-8 | 1,227 | 3.078125 | 3 | [] | no_license | // SYNCHRONOUS
// const fs = require('fs');
// const data = fs.readFileSync(__dirname + '/txt/input.txt', { encoding: 'utf-8' });
// console.log(data);
// const input = `Nguyễn Thanh Tùng: ${data}`;
// fs.writeFileSync(__dirname + '/txt/output.txt', input, { flag: 'w' });
//===========================================... | true |
90fcf512371ce84d05611a019db93174f3b02a8b | JavaScript | hoodielive/esVersions | /es6/syntax-changes-additions/fatArrows/fatArrow.js | UTF-8 | 297 | 3.9375 | 4 | [] | no_license | // let fn = () => console.log('Hellerrrrr!');
let fn = () => "Hello!";
console.log(fn());
let fn2 = () => {
let a = 2;
let b = 3;
return a + b;
}
console.log(fn2());
// or
let fn3 = (a, b) => a + b
console.log(fn3(3, 8));
setTimeout(() => console.log("Helleeerrrr!"), 1000);
| true |
568e7b2dae11b5ff0780a77d75628949e927d0a4 | JavaScript | creograf-experience/2sport | /app/client/public/lib/workout-instagram.js | UTF-8 | 1,578 | 2.625 | 3 | [] | no_license | import _ from 'lodash';
import d3 from 'd3';
export function drawChartInstagram(element, times, values) {
var margin = {top: 20, right: 20, bottom: 30, left: 20},
width = 612 - margin.left - margin.right,
height = 120 - margin.top - margin.bottom;
// Set the ranges
var x = d3.time.scale()
.domain(d3... | true |
7d2ed25615003296ccf65a87e6a4f9440002dc28 | JavaScript | teintinu/bd-stampy | /utils/Paginate.js | UTF-8 | 278 | 2.6875 | 3 | [
"BSD-3-Clause"
] | permissive | /*eslint-disable */
var Paginate = function (array, ammount, page){
var start = page * ammount;
var end = start + ammount;
if(start >= array.length) {
start = array.length - ammount;
}
return array.slice(start, end);
};
module.exports = Paginate; | true |
f961229244ad131a26369a4806b975dac06497a8 | JavaScript | comicrelief/lambda-wrapper | /src/Model/Model.model.js | UTF-8 | 771 | 2.890625 | 3 | [] | no_license | /* eslint-disable class-methods-use-this */
import validate from 'validate.js/validate';
/**
* Model base class
*/
export default class Model {
/**
* Instantiate a function with a value if defined
*
* @param classFunctionName string
* @param value mixed
*/
instantiateFunctionWithDefine... | true |
eb5bbfdbef30bc079164b0e0569b33019ec9b904 | JavaScript | vvuri/learn_babel | /src/main.js | UTF-8 | 205 | 2.71875 | 3 | [] | no_license | let a = 5;
const b = ("const"[(a, b)] = [b, a]);
class First {
constructor(x) {
this.x = x;
}
}
class Second extends First {
set x(d) {
this.x = d;
}
get x() {
return this.x;
}
}
| true |
2a153cad7072d88d74be39a987981f970f5d9185 | JavaScript | trentclainor/ready | /ready.js | UTF-8 | 445 | 2.6875 | 3 | [] | no_license | var ready = function(f) {
if (!ready.r) ready.r = [];
if (!ready.t) ready.t = null;
ready.r.push(f);
var run = function() {
clearTimeout(ready.t);
while (ready.r.length)
ready.r.splice(0,1)[0]();
}
var check = function() {
if (document && document.getElementsByTagName && document.getElementById && docume... | true |
750891761ab63ef41e44acb1fc86bd39571c517e | JavaScript | kilic/relais | /test/helpers/dateHelper.js | UTF-8 | 297 | 2.953125 | 3 | [] | no_license | const DAY = 86400
function now() {
return Math.round(new Date().getTime()/1000)
}
function yesterday() {
return Math.round(new Date().getTime()/1000) - DAY
}
function daysAhead(days) {
return Math.round(new Date().getTime()/1000) + DAY*days
}
module.exports = {now,yesterday,daysAhead}
| true |
2b0c7e07630e3a9fd14bea65881532d012347fe8 | JavaScript | Barry-B15/weather-app | /public/js/app.js | UTF-8 | 1,945 | 3.21875 | 3 | [] | no_license | //11 p5.js uses a set up func, create one and move all code inside it
function setup() {
noCanvas(); //11.2 we do not need a canvas for this project
const video = createCapture(VIDEO); //11.3 we need videocam instead
video.size(300, 240); // resize the video
//8.1 def the lat lon
let lat, lon;
... | true |
9408741a7bfa41dc8c5ca75f6aeab0e313c7efbb | JavaScript | lfgg/lfgg.github.io | /assets/js/lfgg.js | UTF-8 | 4,482 | 2.515625 | 3 | [] | no_license | const Nav = {
elems: {
toggle: document.querySelector('#toggle-nav'),
site: document.querySelector('#site')
},
isOpen: false,
toggle: function() {
document.documentElement.classList.toggle('nav-open');
this.isOpen = !this.isOpen;
},
open: function() {
d... | true |
a0979c3e92c4efa06b7f8cc9d71f98b1aeaf5052 | JavaScript | emanuelecaruso/InteractiveGraphics | /models/robot.js | UTF-8 | 1,162 | 3.359375 | 3 | [] | no_license | // call the render function
var step = 0;
// once everything is loaded, we run our Three.js stuff.
var keyboard = new THREEx.KeyboardState();
var velocity=0;
var maxvelocity= 3.5;
var robotScale=2;
// create meshes
var sphere = createMesh(new THREE.SphereGeometry(robotScale, 10, 10));
sphere.... | true |
56a302179fcdff7643d9280f10300c5731cb870b | JavaScript | randelreiss/tutorial | /server.js | UTF-8 | 2,053 | 3.21875 | 3 | [] | no_license | // An HTTP server with a callback function
// that is called for each request.
// In the callback function, you create a response
// with a status code of 200 (indicating that the request
// was fulfilled successfully) and the message "Hello World".
// Finally, you specify which port the server listens to.
// When Node... | true |
a7cf65f08ff2edda69765a825adf1d7e37e1eeb9 | JavaScript | hello-chenchen/leet-code-algorithms | /linked-list/leetcode-1290/solution.js | UTF-8 | 533 | 3.609375 | 4 | [
"WTFPL"
] | permissive | /**
* Definition for singly-linked list.
* function ListNode(val, next) {
* this.val = (val===undefined ? 0 : val)
* this.next = (next===undefined ? null : next)
* }
*/
/**
* @param {ListNode} head
* @return {number}
*/
var getDecimalValue = function(head) {
let result = 0;
while(u... | true |
8408842bca2a527b063d125b1b1aa14afe8e38ff | JavaScript | Foorkan14/functions | /arrowfunctions/arrowfunctions.js | UTF-8 | 2,281 | 4.96875 | 5 | [] | no_license | //alternative way of writingfunctions
//dont have to wrte functinn keyword all you have to do is this:
//example 1 a function expression without arrow format
// const square = function(x){ //x is what will be passed through as the argument
// return x * x;
// }
// //now same function as arrow function
// const... | true |
691b21d0172e688d2f603554b8815b14d4b11e6a | JavaScript | MidoriyaDeku/algorithm | /search/binary_search_tree.js | UTF-8 | 6,203 | 3.796875 | 4 | [] | no_license | // 二叉查找树结构
function BSTree(data, left, right, parent) {
this.data = data;
this.left = left;
this.right = right;
this.parent = parent;
}
// 二叉查找树的插入操作
// bstree 查找树;data 要插入的数;
function insertBST(bstree, data) {
var current = bstree; // 当前节点
var parent = null; // 父节点
while (t... | true |
094853d82b57829029a6b82a1ee651f176fe51eb | JavaScript | DevNeoLee/canadaTouristRefactor | /src/main.js | UTF-8 | 2,198 | 3.046875 | 3 | [
"MIT"
] | permissive |
//load raw CSV, travel_province_data using D3.js
//prepare only relavant data set array of objects
//initiate putting minimized data cut with default or listened event input
import { putData } from './put_data.js';
d3.csv('data/travel_province_data.csv', function(data) {
const initialDataCut = [];
data.fo... | true |
b335a1e840e6accea9cc4c8f8c3c3cdaaa78059a | JavaScript | emddutton/diceroller | /dice.js | UTF-8 | 1,905 | 2.921875 | 3 | [] | no_license | /**
* Created by emddutton on 3/4/2015.
*/
$(document).ready(function(){
function reset() {
$(".dice").removeClass('animated shake');
$(".dots").hide();
console.log('bye');
}
function roll(side) {
var one = (side + ".centerdot");
var two = (side + '.rightcorne... | true |
a6a67b75e4ea0a0b45b7d2d729f2f7819fa9b47b | JavaScript | DN8630/lotide | /middle.js | UTF-8 | 488 | 2.984375 | 3 | [] | no_license | const eqArray = require("./eqArrays");
const assertArrayEqual = require("./assertArraysEqual");
const middle = function(array) {
let output = [];
let arrLength = array.length;
let index = parseInt((arrLength - 1) / 2);
if (arrLength <= 2) {
return output;
} else if (arrLength % 2 === 0) {
output.push... | true |
ab75d251fbfa638c2616aa8b5c20d5a6ae77610e | JavaScript | MikeHitrov/SoftUni | /JS Advanced/Exam 19.12.2016/01. Move Towns Up Down (Simple DOM Interaction)/move-up-down.js | UTF-8 | 301 | 2.765625 | 3 | [
"MIT"
] | permissive | function move(num) {
let selected = $('#towns :selected');
let action = num > 0 ? moveDown : moveUp;
action(selected);
function moveUp(option) {
$(option).insertBefore(option.prev());
}
function moveDown(option) {
$(option).insertAfter(option.next());
}
} | true |
bce8e5b32ba8fc7e213571ca2bc356b43654e8a9 | JavaScript | hello-kozloff/fodesign | /src/blocks/_parts/navigation/navigation.js | UTF-8 | 460 | 2.53125 | 3 | [] | no_license | $(document).ready(() => {
$(".navigation").on('click', function(event) {
if (event.target !== this) return;
hideNavigationPanel();
});
$(".navigation__button").on("click", function (event) {
event.preventDefault();
hideNavigationPanel();
});
});
function hideNavigation... | true |