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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
f02234d1632e5de218b6b063833be383fc47f8d0 | JavaScript | albertocruzdg/beto-learns-modern-js | /parallel-promises.js | UTF-8 | 546 | 3.359375 | 3 | [] | no_license | function divide (dividend, divisor) {
return new Promise((resolve, reject) => {
if (divisor != 0) {
resolve(`${dividend} / ${divisor} = ${dividend / divisor}`);
} else {
reject(`${dividend} / ${divisor} = Division by 0`);
}
});
}
var divisionParameters = [{
dividend: 4,
divisor: 2,
... | true |
2ee9a1749013a590f7de2dc686fa892e057de3a5 | JavaScript | AhmadDuhoki/Movies-DB-API-Project | /src/components/MoviePage/Actors.js | UTF-8 | 864 | 2.546875 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import { Container, Row, Col } from "react-bootstrap";
import ActorCards from "./ActorCards";
export default function Actors({ movieID }) {
const [actors, setActors] = useState([]);
const TMDB_BASE_URL = "https://api.themoviedb.org/3";
const constructUrl = (pa... | true |
3ab53a638a79a184d2dfccaa0c3462a2a844b857 | JavaScript | opwe37/Algorithm-Study | /LeetCode/src/75.js | UTF-8 | 667 | 3.625 | 4 | [] | no_license | var sortColors = function(nums) {
quickSort(nums, 0, nums.length-1);
}
function quickSort(nums, left, right) {
const index = partition(nums, left, right);
if (left < index-1) {
quickSort(nums, left, index-1);
}
if (index < right) {
quickSort(nums, index, right);
}
}
function partition(nums, left, ... | true |
1b31821dbe5a9d99e791e553ac7d46db8c2748d3 | JavaScript | bhatnagardivyanshu/node-course-andrew-mead | /node-chat-app/server/server.js | UTF-8 | 3,270 | 2.953125 | 3 | [] | no_license | // Package Imports
const path = require('path');
const http = require('http');
const express = require('express')
const socketIO = require('socket.io');
// Local Imports
const {generateMessage, generateLocationMessage} = require('./utils/message');
const {isRealString} = require('./utils/validation');
const {Users} = ... | true |
5292ab7917825f1cf37eed62f6e95ee5f433420a | JavaScript | noconsulate/happy-household | /src/reducers/choreReducer.js | UTF-8 | 2,714 | 2.6875 | 3 | [] | no_license | import { fireDb } from '../firebase'
export const initChores = (family) => {
return async dispatch => {
let arr = []
const snapshot = await fireDb.ref('chores/' + family).once('value')
.catch(error => console.log(error.message))
snapshot.forEach(child => {
const item = {
value:... | true |
e37d490806048147177b916db39dd5003efa67d4 | JavaScript | wswangbo007/caiChang | /caiChang/src/main/webapp/views/unit/unit.js | UTF-8 | 1,598 | 2.609375 | 3 | [] | no_license | /**
* 单位
*/
var params = {};
/**
* 初始化参数
*/
var initParams = function() {
params.addUnitBtn = $("#addUnitBtn");
params.ilUnitList = $("#ilUnitList");
params.unitName = $("#unitName").val();
}
/**
* 点击事件
* 添加单位
*/
var topUnitBtn = function() {
// 查询参数
var queryParams = {
dictName ... | true |
9079c98974679885b9ea58ca1655a4f472757bfa | JavaScript | Mozilla-GitHub-Standards/e61588c291fd279a04a421a11262806c9788219c16937dc8ede6670196fcb077 | /js/infobar.js | UTF-8 | 17,730 | 2.84375 | 3 | [] | no_license | (function() {
'use strict';
var config = {
// list of available languages from either a list of hreflang links
// or options from a select element. Populated by @getAvailableLangs
availableLangs: {},
// Array of one or more user languages as exposed by the user agent
ac... | true |
c97f889ed8132cfb2cbd6fca33bc655b3c5fdb2e | JavaScript | xiaotiantakumi/ExperimentJsCode | /sampleClassES2015/personModel.js | UTF-8 | 226 | 3.03125 | 3 | [] | no_license | export class personModel {
constructor(name,age)
{
this.name = name
this.age = age
}
get myName(){
return this.name
}
conlog(logTarget){
console.log(logTarget)
}
}
| true |
f5cd5d776f50a87806fe3d953f765146d94f5d03 | JavaScript | mjamry/youtubeScrobbler | /tests/spec/DurationSpec.js | UTF-8 | 574 | 3.125 | 3 | [] | no_license | describe("Duration", function(){
//info about ISO 8601 - http://en.wikipedia.org/wiki/ISO_8601
var durationInISO8601 = "PT2M14S";
var duration;
beforeEach(function(){
duration = new window.Player.Duration(durationInISO8601);
});
it("should return value in seconds", function(){
... | true |
05035e24518bb685aa5a588d29c2624516b3dd99 | JavaScript | just-tugsuu/Rim-Discord-Bot | /src/Request.js | UTF-8 | 2,455 | 2.765625 | 3 | [] | no_license | const fetch = require('node-fetch');
async function FetchUserData(api) {
const res = await fetch(api);
if(!res.ok) {
const message = `Error has occured during fetch ${res.status}`
throw new Error(message);
}
const data = await res.json();
return data;
}
function Thumbna... | true |
7423d3dbcc83844f504157d0c234929761264882 | JavaScript | elmoctarebnou/bookmark-server | /src/bookmarks/bookmarks-router.js | UTF-8 | 2,029 | 2.671875 | 3 | [] | no_license | 'use strict';
const express = require('express');
const logger = require('../logger');
const bookmarksRouter = express.Router();
const bodyParser = express.json();
const {v4: uuid} = require('uuid');
const bookmarks = require('../store');
bookmarksRouter
.route('/bookmarks')
.get((req, res) => {
res.json(bookm... | true |
407ad7c4575450f35ea3770723dbc23ebb8dc69f | JavaScript | skupadhyay024/react-app | /src/redux/reducers/courseReducer.js | UTF-8 | 948 | 2.578125 | 3 | [] | no_license | import { LOAD_COURSES_SUCCESS , CREATE_COURSE_SUCCESS, UPDATE_COURSE_SUCCESS } from '../actions/actionTypes';
import initialState from './initialState';
// const initialState = {
// items:[],
// item:{}
// }
export default function(state = initialState.courses, action) {
switch (action.type) {
... | true |
f97fffb80c5b8d7f2e153e63315326039e6084b4 | JavaScript | liugod/iGrow | /igrow/WebRoot/js/nowTime.js | UTF-8 | 889 | 3.453125 | 3 | [
"MIT"
] | permissive | //获取当前时间
function current(){
var d=new Date(),str='';
str += d.getFullYear() + '年';
if((d.getMonth()+1) < 10){
str += '0' + (d.getMonth()+1) +'月';
}else{
str += (d.getMonth()+1) + '月';
}
if(d.getDate() < 10){
str += '0' + d.getDate() + '日 ';
}else{
str +=d.getDate()+'日 ';
}
... | true |
85f0d3f9955155312ff45740482f0700b5799905 | JavaScript | Davidpark27/JSFStechDegree-project-2 | /js/script.js | UTF-8 | 2,419 | 3.625 | 4 | [] | no_license | /******************************************
Treehouse Techdegree:
FSJS project 2 - List Filter and Pagination
******************************************/
//Global Variables.
console.log('hello');
const studentList = document.querySelectorAll('.student-item');
const studentsOnPage = 10;
/***
This is the... | true |
edab17a1435aa91f671f9653faff1307cb6d9072 | JavaScript | meh/miniLOL-framework | /sources/extensions/object.js | UTF-8 | 9,625 | 2.71875 | 3 | [] | no_license | /* Copyleft meh. [http://meh.paranoid.pk | meh@paranoici.org]
*
* This file is part of miniLOL.
*
* miniLOL is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License,
* or (... | true |
9baf5fb7cf39cee52227f9393e464c3ff743ef59 | JavaScript | LuckyArthas/TuyaWaterController | /src/containers/setTimerDlg.js | UTF-8 | 802 | 2.515625 | 3 | [] | no_license | import { useState } from 'react';
import CircularPicker from 'react-native-circular-picker';
export default () => {
const [price, setPrice] = useState(0);
const handleChange = (v) => setPrice((v * 20).toFixed(0));
return (
<CircularPicker
size={400}
steps={[15, 40, 70, 100]}
gradients={{
... | true |
86d4a2f27d5f3c17fe8eefb439c324741e508b10 | JavaScript | AntoineCerqueus/BattleShipProject | /project-battleship-last-ver/JS/app.js | UTF-8 | 10,775 | 3.234375 | 3 | [] | no_license | document.addEventListener('DOMContentLoaded', () => {
const userGrid = document.querySelector('.grid-user');
const computerGrid = document.querySelector('.grid-computer');
const startButton = document.querySelector('#start');
const randomPlacementButton = document.querySelector('#random');
const turnDisplay =... | true |
138be6f928da314e8b3602f98671384b3e08c599 | JavaScript | junyuo/ChromeExtensions | /HelloWorld/helloWorld.js | UTF-8 | 762 | 2.984375 | 3 | [] | no_license | /* The DOMContentLoaded event is fired when the initial HTML document
* has been completely loaded and parsed, without waiting for stylesheets,
* images, and subframes to finish loading.
*/
document.addEventListener('DOMContentLoaded', function() {
var searchBtn = document.getElementById('doSearch');
//... | true |
bb93164d8fc577959cd810ac4bd43f6ab1dfbf7f | JavaScript | MashukeAlam/MashukeAlam.github.io | /snake.js | UTF-8 | 7,376 | 3.125 | 3 | [] | no_license | console.log('alhamdulillah');
let LIMIT = 100;
//FIREBASE
var db = firebase.database();
var REF = db.ref('scores');
//
let DIR = 'RIGHT';
let FPS = 10;
let SCORE = 0;
//colors
var colors = [["green", "lightgreen", "yellow"], ["blue", "lightblue", "orange"], ["red", "orange", "green"], ["purple", "yellow", "white"]];... | true |
4bb512656cf224e6b488782deec33bfb303c6330 | JavaScript | tonywh/homewinex | /recipe/static/newrecipe.js | UTF-8 | 1,485 | 2.921875 | 3 | [] | no_license | document.addEventListener('DOMContentLoaded', () => {
// oninput actions
document.querySelector('#name').oninput = enableCreate;
document.querySelector('#style').oninput = (ev) => {
i = ev.target.selectedIndex;
options = ev.target.options;
if ( i == 0 ) {
document.querySelector('#target-alcohol... | true |
ff2b2bf2541dbc478a92029a55d993027338362c | JavaScript | chetan51/headlyne | /src/helpers/cookies.js | UTF-8 | 1,065 | 2.515625 | 3 | [
"MIT"
] | permissive | /**
* Module for operating on cookies.
**/
/**
* Module dependencies
**/
var sys = require('sys');
var cookie_node = require('cookie');
var querystring = require('querystring');
/*
* The cookies helper
*/
var CookiesHelper = function()
{
// takes request object, returns cookie if it found one that is valid.
... | true |
37b267e504174c511c6307618719f396e1b7ae40 | JavaScript | pitiwatMIKE/cmstock-react-hook-material | /frontend/src/redux/actions/stock.action.js | UTF-8 | 1,713 | 2.515625 | 3 | [] | no_license | import {
server,
STOCK_FETCHING,
STOCK_SUCCESS,
STOCK_CLEAR,
STOCK_FAILED,
} from "../../constants";
import { httpClient } from "../../utils/HttpClient";
export const setStateToFetching = () => ({
type: STOCK_FETCHING,
});
export const setStateToSuccess = (payload) => ({
type: STOCK_SUCCESS,
payload,
... | true |
b329ec126ce619045f3de9f71e517535846d5b1c | JavaScript | nomburlaargonus/CursoIngresoJS | /1-EntradaSalida/jsEntradaSalida-2.js | UTF-8 | 343 | 3.578125 | 4 | [] | no_license | /*Debemos lograr tomar un nombre con 'prompt'
y luego mostrarlo por 'alert' al presionar el botón 'mostrar'*/
function mostrar() {
var nombre;
var usuario;
nombre= prompt("Porfavor ingrese su nombre", usuario);
console.log("ingrese su nombre " + nombre); //esto es para que solo salga en la consola
a... | true |
e71473b8db4b53a8e32abb0d8e8031c47b2f1207 | JavaScript | DionigiMartino/-test_docebo- | /js/carousel.js | UTF-8 | 3,223 | 3.828125 | 4 | [] | no_license | // Creating the Class For the Carousel
class Carousel {
// using the constructor method to take the value that i'll inser inside the recall
constructor(container, title, subtitle){
this.container = container;
this.title = title;
this.subtitle = subtitle;
}
}
// Function to format t... | true |
6e630c5a76e5893833d10d0321fd98e66ad6670c | JavaScript | japhetGitHub/lotide | /test/withoutTest.js | UTF-8 | 1,991 | 3.25 | 3 | [] | no_license | const assert = require('chai').assert;
const without = require('../without');
describe("#without", () => {
it("should return the same array excluding the item specified to be removed [1]", () => {
const inputArr = [1, 2, 3];
const elementToBeRemoved = [1];
const expectedOutput = [2, 3];
assert.deepEq... | true |
363050c13c6c196658672968d22508160e3aa701 | JavaScript | mufniarz/automating-tasks-with-gulp | /gulp-tasks/gulpfile.js | UTF-8 | 3,420 | 2.546875 | 3 | [
"ISC",
"CC0-1.0"
] | permissive | "use strict";
var gulp = require('gulp'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
sass = require('gulp-sass'),
maps = require('gulp-sourcemaps'),
del = require('del');
gulp.task("concatScripts", function() {
// Using 'return' makes sure t... | true |
6fbddcb85efea54d7b71211c8a37d9043b242507 | JavaScript | faridalrafi/BasicJS-exercise | /loop.js | UTF-8 | 959 | 4.25 | 4 | [] | no_license | // for loop
for(let i = 0; i <= 10; i++){
console.log(i)
}
//While Loop
let i = 0;
while(i< 10){
console.log(10);
i++;
}
let todos = [
{
id: 1,
text: "Learn Javascript",
isCompleted: true
},
{
id: 2,
text: "Eat Lunch",
isCompleted: false
... | true |
7214856a03ba0cb6a5aa40db410545c38f191ed1 | JavaScript | hungpchu/JavaScript | /section2_DOM/Event-Mouse-Type.js | UTF-8 | 1,404 | 3.515625 | 4 | [] | no_license | // Keyboard and input event
// clear button
const clearButton = document.querySelector(".clear-tasks");
// all element with class = card
const card = document.querySelector(".card");
// heading h5 tag
const heading = document.querySelector("h5");
// Click
clearButton.addEventListener("click", runEvent);
// Double Cli... | true |
ed9630bf8f8c88b35603093a41f4e9ffc9956371 | JavaScript | pdurkin/Web-Dev-Class | /Back End Lessons/MoreExpress/PostRequestDemo/app.js | UTF-8 | 901 | 2.859375 | 3 | [] | no_license | var express = require("express");
var app = express();
// add in body-parser package
var bodyParser = require("body-parser");
// tell express to use body-parser
app.use(bodyParser.urlencoded({extended: true}));
app.set("view engine", "ejs");
var friends = ["Tony", "Miranda", "Justin", "Pierre", "Lily"];
app.get("/",... | true |
a29082e894d84330c6a0b5bb516be9f85f9ada6f | JavaScript | ArseniumGX/logica-algoritmos | /lvl1/question3.js | UTF-8 | 453 | 3.78125 | 4 | [
"MIT"
] | permissive | /*
Faça um programa para calcular o juros simples segundo a fórmula abaixo.
J = C.i.n
Onde:
J = juros,
C = capital,
i = taxa de empréstimo
n = períodos
Vamos imaginar o seguinte cenário: um empréstimo de R$ 16.000,00 sobre a taxa de 4% durante 4 meses.
*/
function jurosSimples(capi... | true |
7321ffa4a930955191c7b7d959c116da6d406a74 | JavaScript | kdewey13/Career_Finder | /client/src/views/ClusterSurvey/ClusterSurvey.js | UTF-8 | 6,607 | 2.765625 | 3 | [] | no_license | import React, { Component } from "react";
import { connect } from "react-redux";
import PropTypes from "prop-types";
import { submitSurvey } from "../../actions/surveyActions";
import './ClusterSurvey.css';
import ClusterQuestions from "../../components/Body/ClusterQuestions";
import ClusterSurveyResult from "../../com... | true |
ed50aecf911ec3b7afa7b3af3c73f0c101e1db90 | JavaScript | boni01/bleronredjepi | /public/js/music-list.js | UTF-8 | 1,561 | 3.484375 | 3 | [] | no_license | // To add more song, just copy the following code and paste inside the array
// {
// name: "Here is the music name",
// artist: "Here is the artist name",
// img: "image name here - remember img must be in .jpg formate and it's inside the images folder of this project folder",
// src: "music name her... | true |
10a264b7dd78d4d52a1ef5e3a435d4d34a1f480a | JavaScript | Shabbir0001/5th-Assignment | /app.js | UTF-8 | 2,138 | 3.1875 | 3 | [] | no_license | function showMeals(){
let mealName = document.getElementById("mealName").value;
fetch(`https://www.themealdb.com/api/json/v1/1/filter.php?c=${mealName}`)
.then(res => res.json())
.then(data => displayMeals(data.meals))
// .catch(error = displayErrorMsg("Something went wrong..! Please refresh the pag... | true |
28cc1a60a7e81c3b9a51b007bc771dc32e955344 | JavaScript | lewis500/MFD | /scripts/sim.js | UTF-8 | 10,327 | 2.609375 | 3 | [
"MIT"
] | permissive | (function(){
function Slow(){
d3.selectAll(".highlighted").data()[0].slowClick();
}
function Set(){
cars.forEach(function(d,i){
var x = Math.round(i/numCars * numPatches);
d.x = x;
d.v = startV;
d.a = 0;
d.gap = numPatches / numCars;
d.slow = false;
... | true |
48c28ab47f0d7d6772805115b518dca529798f8c | JavaScript | DeclanMorrison/New-York-Times-Scraper | /assets/js/main.js | UTF-8 | 1,363 | 2.828125 | 3 | [] | no_license | $(document).ready(function() {
$("#search-btn").on("click", function() {
console.log("Got here!");
var searchTerm;
var apiKey = "74b0b534002f477ead1026e1b98f1377";
var url = "https://api.nytimes.com/svc/search/v2/articlesearch.json";
searchTerm = $("#search-text").val();
... | true |
af821e1b67f97ad11a32a7f060bd69744f49df0c | JavaScript | PCianes/DesignPatterns-TypeScript | /Visitor/index.js | UTF-8 | 3,653 | 3.90625 | 4 | [] | no_license | /**
* Each Concrete Component must implement the `accept` method in such a way that
* it calls the visitor's method corresponding to the component's class.
*/
var ConcreteComponentA = /** @class */ (function () {
function ConcreteComponentA() {
}
/**
* Note that we're calling `visitConcreteComponentA`,... | true |
b031ce402a10eb92f77b55051097cc618d3292dc | JavaScript | nickmckenney/calanderprojectMERN | /src/components/SearchHolidaysByName/SearchHolidayByName.js | UTF-8 | 1,683 | 2.9375 | 3 | [] | no_license | import React, { Component } from "react";
import "./SearchHolidayByName.css";
class HolidaySearchByName extends Component {
constructor(props) {
super(props);
this.searchArray = [];
this.searchName = "";
this.isLoading = false;
}
// Fetches holiday via a name search. Is case sensitive.
searchH... | true |
98588872958ef0d84bda931a93b38b2256253d35 | JavaScript | 1800Kon/API | /main.js | UTF-8 | 30,922 | 2.53125 | 3 | [] | no_license | var express = require('express')
var mysql = require('mysql');
var validator = require('validator')
var app = express();
var validate = require('jsonschema').validate;
var libxml = require("libxmljs2");
var Chart = require('chart.js');
const ChartJsImage = require('chartjs-to-image');
app.use(express.json());
//Schema... | true |
567f01aa5da86da0df02042e59986ca7d547d226 | JavaScript | Malcolm-Marshall/playground | /ToyProblems/countSmileys.js | UTF-8 | 959 | 3.734375 | 4 | [] | no_license | //return the total number of smiling faces in the array
function countSmileys(arr) {
let count = 0;
for ( let i = 0; i < arr.length; i++) {
arr[i].length === 2 ?
arr[i][0] === ';' || ':' && (arr[i][1] === ')' || 'D)') ? count ++ : null
: (arr[i][0] === ';' || ':') && (arr[i][2] === ')' || 'D') && (ar... | true |
c4f29c05843992f6e09d6fac45827089909fdc80 | JavaScript | thatPamIAm/exercism | /javascript/pangram/pangram.js | UTF-8 | 756 | 3.453125 | 3 | [] | no_license | var Pangram = function(string) {
this.string = string;
}
Pangram.prototype.createABC = function() {
var abc = "abcdefghijklmnopqrstuvwxyz"
abc = abc.split("")
return abc
}
Pangram.prototype.checkLetter = function(letter, arr) {
for(let i = 0; i <= arr.length - 1; i++) {
if(letter === arr[i]) {
... | true |
ca0771cef2ce62c6984b086530955b651a957046 | JavaScript | mori-c/publications | /image-processing/pyladies/helper/revealjs/plugins/leapmotion/test/lib.spec.js | UTF-8 | 2,063 | 2.640625 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | import { expect } from 'chai';
import {
computeCenteredPosition,
computeLeftPosition,
computeTopPosition,
} from '../src/lib';
/* eslint-disable no-unused-expressions */
describe('#computeCenteredPosition', () => {
context('when inverse is false', () => {
it('returns NaN with all 0 input', () => {
... | true |
e951297ebe9abae0c4a8b8b0f05bfa3ef0e025c1 | JavaScript | sybila/biodivine-aeon-client | /script/explorerMain.js | UTF-8 | 6,506 | 2.671875 | 3 | [] | no_license |
var RESULT = undefined;
var network = undefined;
var container = undefined;
var options = {
edges: {
arrows: {
to: {enabled: true, type:'triangle'}
},
width: 0.7
},
nodes: {
color: {
border: '#3a568c',
background: '#ffffff',
hi... | true |
307dc2b35405f00620b41385e0ae60e707b52305 | JavaScript | costaslavich/goit-react-hw-03-bank-account | /goit-react-hw-02/src/components/Bank-Account/Dashboard/Dashboard.js | UTF-8 | 2,445 | 2.546875 | 3 | [] | no_license | import React, { Component } from 'react';
import Controls from '../Controls/Controls';
import Balance from '../Balance/Balance';
import TransactionHistory from '../TransactionHistory/TransactionHistory';
import styles from '../../../stylesBank.css';
const shortid = require('shortid');
const date = new Date();
const ... | true |
d8249d52a9659d3ef03910c6f39864e868e4bd56 | JavaScript | ajlanza/noteful | /src/AddNote/AddNote.js | UTF-8 | 4,278 | 2.859375 | 3 | [] | no_license | import React, { Component } from 'react';
import NotefulContext from '../NotefulContext';
import ValidationError from '../ValidationError';
import FormError from '../FormError/FormError';
import PropTypes from 'prop-types';
import config from '../config';
export default class AddNote extends Component {
static con... | true |
67a1317534a99ba5db92c61a83c8be3fa5a85d24 | JavaScript | Hanmy3/lithograph | /lithograph/run_.js | UTF-8 | 803 | 2.71875 | 3 | [] | no_license |
const { Map, Range } = require("immutable");
const Pipeline = require("./pipeline");
const f = index => value => new Promise(function (resolve, reject)
{
const time = Math.random() * 1000;
console.log(index + " " + value + " " + time);
setTimeout(resolve, time);
});
const pipeline = Pipeline.init([f(0),f(1),f... | true |
5d8c6f8267d6fce498126a718f6a1f2308f827cc | JavaScript | sharonromero/jskid | /robot/robot.js | UTF-8 | 1,662 | 3.703125 | 4 | [
"Apache-2.0"
] | permissive | var rightEye = document.getElementById("righteye");
var leftEye = document.getElementById("lefteye");
var leftArm = document.getElementById("leftarm");
var mouth = document.getElementById("mouth");
rightEye.addEventListener("click", moveUpDown);
leftEye.addEventListener("click", moveUpDown);
leftArm.addEventListener("... | true |
cdff1fe5cca9fc51c76bc42336c74a2f27c197ba | JavaScript | fr33d4n/ez-validator.js | /test/unit/validators/array.mochatest.js | UTF-8 | 3,742 | 2.6875 | 3 | [
"MIT"
] | permissive | const { expect } = require('chai');
const validatorFactory = require('../../../src/validators/array');
describe('array validator', () => {
describe('#constructor', () => {
it('should return a new inactive validator', () => {
const val = validatorFactory(false);
expect(val.priority).to.equal(10);
... | true |
254ce78f3eebe27446614e8b41daf7f5ac6cf670 | JavaScript | habibcodes/katas | /kata4_instructorsNames.js | UTF-8 | 1,201 | 4.5 | 4 | [] | no_license | // Kata 4 - Instructors Names //
/*
- given a list of instructor names, create a function that returns the longest name
- function takes in an array of objects as a parameter: instructorWithLongestName(instructors);
- it must return the name as an object
- if there are 2 equivalent length names, return... | true |
17d94f7c0f790829fcbe015422a5f69fa3e9b684 | JavaScript | raphaelrk/KhanAcademy-sketches | /interactive_sketches/follower/fixed_follower/fixed_avoider/pivot_avoider/superorb_colorweb.js | UTF-8 | 1,101 | 2.8125 | 3 | [] | no_license | // https://www.khanacademy.org/computer-programming/colorweb/5652771869032448
colorMode(HSB, 840);
var mouseMoved = function() {
background(0, 0, 0);
for(var y = 0; y < 420; y+= 10) {
for(var x = 0; x < 420; x += 10) {
var xdiff = mouseX - x;
var ydiff = mouseY - y;
... | true |
b4d14e3003fec36b99890d3335601f09d70581d0 | JavaScript | unkind709/webhook | /server.js | UTF-8 | 2,294 | 2.53125 | 3 | [
"MIT"
] | permissive | process.env.NODE_ENV = process.env.NODE_ENV || 'development';
var mongoose = require('./config/mongoose');
var express = require('./config/express');
var passport = require('./config/passport');
const Discord = require('discord.js');
const bot = new Discord.Client();
const settings = require('./config/settings.... | true |
231f3a4532a8dc2837bfad04c2752d4f3b27c9c2 | JavaScript | tmpvar/EventVat | /lib/index.js | UTF-8 | 21,120 | 2.96875 | 3 | [
"MIT"
] | permissive |
;(function(exports, undefined) {
var hash = (function(){
var S = {};
//
// The highest integer value a number can go to without losing precision.
//
S.maxExactInt = Math.pow(2,53);
//
// Converts string from internal UTF-16 to UTF-8
// and saves it using array of numbers (bytes), ... | true |
fddfa5d2723ac30fa81bf4d49e1683eabd557c98 | JavaScript | ekov1/Telerik-Academy-2016-2017 | /JavaScript Basics/Conditional statements - Homework/exchange-if-greater.js | UTF-8 | 334 | 3.25 | 3 | [
"MIT"
] | permissive | function solve(args) {
'use strict';
var firstNumber = +args[0],
secondNumber = +args[1];
if (firstNumber < secondNumber) {
return firstNumber + ' ' + secondNumber;
}
return secondNumber + ' ' + firstNumber;
}
console.log(solve([1, 1]));
console.log(solve([2, 1]));
console.log(so... | true |
a6defeb0900b05cf7536f860d5108ee30e091ca5 | JavaScript | shit-hao/rep | /zzzLuxroid/算法题/斐波那契/尾调用优化.js | UTF-8 | 380 | 3.609375 | 4 | [] | no_license | // const fib = function(N) {
// return calc(N, 0, 1);
// };
// const calc = function(count, n, m) {
// if (count === 0) return n;
// return calc(count - 1, m, n + m);
// }
let fib = function(N){
return calc(N, 0, 1)
}
function calc(count, before, after){
if(count === 0){
return before
}
return c... | true |
4330b644931ed8377a60e3d15a9b64340c838f7e | JavaScript | Egretia/ethSefSer | /ethInnerSer/utils/lib/array.js | UTF-8 | 323 | 2.90625 | 3 | [] | no_license | var MyArray = {};
MyArray.keys = (object)=>{
let keyArr = [] ;
for (key in object){
keyArr.push(key) ;
}
return keyArr ;
}
MyArray.values = (object)=>{
let valueArr = [] ;
for (key in object){
valueArr.push(object[key]) ;
}
return valueArr ;
}
module.exports = MyArra... | true |
28e36cc7fcbaf5bc2c253593c9a2bd32e7e40581 | JavaScript | abaltaz/c1 | /requests/mlbSchedule.js | UTF-8 | 5,512 | 2.734375 | 3 | [] | no_license | var express = require('express');
var router = express.Router();
var moment = require('moment');
var underscore = require('underscore');
var Converter = require("csvtojson").Converter;
var EventEmitter = require('events');
var c1functions = require('../core/functions');
var eventType = "game";
var cubsParams = {
na... | true |
1735ad752ead58309bddc26169710c704d77c84d | JavaScript | nemnous/Machine-Learning | /Projects/Extension/chromextension 1.0.1/src/scripts/background/background.js | UTF-8 | 975 | 2.875 | 3 | [] | no_license | //JSON object with email and id
var user;
/**
* used to useremail from the browser.
*/
chrome.identity.getProfileUserInfo(function(userInfo) {
user = userInfo;
});
// alert(user)
/**
* Message listener from the content script, which eventually fires the sendMessage.
* Used to transfer the user value from bac... | true |
5e9fbd277375a327b8ae2950adfdf79be4b74a5d | JavaScript | krupelechek/education | /5thh/third/js/main.js | UTF-8 | 225 | 3.359375 | 3 | [] | no_license | function stringReplace(str, arr){
for(var i = 0; i<arr.length; i++){
str = str.replace(new RegExp(arr[i], 'g'),'');
}
return str;
}
var newStr = stringReplace("Hello world", ['l','d']);
console.log(newStr); | true |
e7eef8a9ea7210ab12eacdb0ea36fb59d8334379 | JavaScript | skulleci/submission_of_tasks | /API_practice/app.js | UTF-8 | 1,537 | 3.625 | 4 | [] | no_license | let selectButton = document.querySelector("#selectButton");
let todosList = document.querySelector(".list-group");
let searchBar = document.getElementById("searchBar");
let userTodos = [];
let searchStr = "";
const getUsers = () => {
return axios.get('https://jsonplaceholder.typicode.com/users/');
}
const getU... | true |
538c147967099664f1a2853e1d4a50db557829cb | JavaScript | yyzzz6000/nodejs_exercise | /src/function/hofunction.js | UTF-8 | 157 | 2.5625 | 3 | [] | no_license | function repeat(operation, num) {
while(num > 0) {
operation();
num--;
}
}
// Do not remove the line below
module.exports = repeat;
| true |
e5edd387fd0330a878be61775468f28c34fd23fa | JavaScript | NoUseFreak/Presentation | /web/js/presentation_master.js | UTF-8 | 2,332 | 2.5625 | 3 | [
"MIT"
] | permissive | var PresentationMaster = function() {
var session;
var conn;
var init = function() {
init_connection();
}
var init_connection = function() {
conn = new ab.connect(
'ws://' + wsHost
, function(s) {
session = s;
session.call('... | true |
d3cd172c043625de607f8f9526ffcad02ddab582 | JavaScript | kkokey/node-monitor | /vilog.js | UTF-8 | 920 | 2.53125 | 3 | [] | no_license | // import { logger } from 'd3-vilog';
const logger = require('d3-vilog').logger;
function gen_data() {
const fst = [],
snd = [],
trd = [],
fth = [],
ffth = [],
r1 = Math.random(),
r2 = Math.random(),
r3 = Math.random(),
r4 = Math.random(),
r5 = Math.random();
for (var i = 0; ... | true |
8343e139e9b90a7bb53a6b14fb99d294a91f03c6 | JavaScript | shawndeprey/legacy-knuvu | /main/application/assets/js/input.js | UTF-8 | 2,160 | 2.640625 | 3 | [] | no_license | function Input()
{
var self = this;
self.x = 0;
self.y = 0;
self.screenX = 0;
self.screenY = 0;
var keyMap = {
65:'a', 66:'b', 67:'c', 68:'d', 69:'e', 70:'f', 71:'g', 72:'h', 73:'i', 74:'j', 75:'k', 76:'l', 77:'m',
78:'n', 79:'o', 80:'p', 81:'q', 82:'r', 83:'s', 84:'t', 85:'u', 86:'v', 87:'w', 88:'x', ... | true |
22768932a269a88f542e80302076c5a8bc8a0748 | JavaScript | maryamali96/problem3-solution-maryam-abed | /script.js | UTF-8 | 1,075 | 2.953125 | 3 | [] | no_license |
function addItem() {
var name = document.forms.FridgeList.name.value;
var data = document.forms.FridgeList.data.value;
if(data>0){
localStorage.setItem(name, data);
}
doShowAll();
}
function RemoveItem() {
var name = document.forms.FridgeList.name.value;
document.forms.FridgeList.data.value = localStorag... | true |
07fbfd131cef414c3be20dc9deee457b95dd7e90 | JavaScript | diego-cc/note-taking-app | /src/components/App/App.js | UTF-8 | 8,642 | 2.546875 | 3 | [
"MIT"
] | permissive | /**
* App.js
*/
import React from 'react';
import {Col, Icon, Layout, notification, Row, Switch as ToggleSwitch} from 'antd';
import {SideNav} from "../Nav/SideNav";
import {Route, Switch} from 'react-router-dom';
import {FONT_FACES} from "../../Customisation/fontFaces";
import {THEMES} from "../../Customisation/them... | true |
39b000075747677c0507cd5f53db523c5880dad1 | JavaScript | wang1xiang/typeScript-nodes | /js/命名空间/index.js | UTF-8 | 959 | 2.75 | 3 | [] | no_license | "use strict";
/*
命名空间:
代码量大的情况下,为避免各种变量命名冲突,可将相似功能的函数、类、接口放置在命名空间种
同java的jar包 typescript的命名空间可以将代码包裹取来,之对外暴露需要在外部访问的对象 命名空间的对象通过export
命名空间和模块区别:
命名空间:内部模块,主要用于组织代码,避免代码冲突
模块: ts外部模块的简称,侧重代码的服用,一个模块可能有多个命名空间
*/
// namespace A {
// export class User {
// name: string | undefined
// constru... | true |
bcdf217a4c817996eb49ab7f921dff2809691e07 | JavaScript | Snavelin/Projects-CSC-337-Fa21 | /assg5/public_html/square.js | UTF-8 | 1,991 | 4.1875 | 4 | [] | no_license | /*
* Author: Dylan Snavely
* Purpose: Defines code related to the execution of the Square Cipher encryption method.
*/
/*
* Shuffles the contents of the given list.
* Params:
* list -- the list to be shuffled.
*/
function shuffle(list) {
for (let i = 0; i < list.length; i++) {
let j = Math.floor(Math... | true |
68bdbb584dd49e3d8c49e89f820a7c4f2ae8248d | JavaScript | emilsultanov/user-list-with-context-api-in-reactjs | /src/context.js | UTF-8 | 1,475 | 2.671875 | 3 | [] | no_license | import React, { Component } from 'react';
import axios from 'axios';
const UserContext = React.createContext();
// Provider, Consumer
const reducer = (state, action) => {
if (action.type === 'DELETE_USER') {
return {
...state,
users: state.users.filter((user) => { return action.payload !=... | true |
efd0e85aadb9f2f823c204409f921466c00f5f80 | JavaScript | puchninanastya/nodejs-test-server | /public/script.js | UTF-8 | 305 | 3.46875 | 3 | [] | no_license | const text = document.getElementById('text');
//alert('This is text from DOM: ' + text);
const button = document.getElementById('button');
/*
button.onClick = () => {
text.innerText = "Welcome to Frontend";
};*/
button.addEventListener('click', () => {
text.innerText = 'Welcome to Frontend!';
})
| true |
1004e99ebf94f9f43e4be864ca51f087543548e3 | JavaScript | reruns/ctris | /src/input.js | UTF-8 | 2,318 | 3.109375 | 3 | [] | no_license | var pressedKeys = {};
var pressedLetter = '';
function setKey(event, status) {
var code = event.keyCode;
var key;
switch(code) {
case 37:
key = 'A'; break;
case 40:
key = 'B'; break;
case 39:
key = 'C'; break;
case 65: //a
key = 'LEFT'; break;
case 68: /... | true |
62d19441f630502992c676a3140d09fa9434d393 | JavaScript | lllllLeo/practice | /react/redux-counter/src/containers/CounterContainer.js | UTF-8 | 1,943 | 3.140625 | 3 | [] | no_license | import Counter from '../components/Counter';
import * as actions from '../actions';
import { connect } from 'react-redux';
// 13가지 색상 중 랜덤으로 선택하는 함수
export function getRandomColor() {
const color = [
'#495057',
'#f03e3e',
'#d6336c',
'#ae3ec9',
'#7048e8',
'#4263eb',
... | true |
e845edd5c19dc6f6c18c468388635ad37e590b0f | JavaScript | jpschibul/nodejs-tutorial | /test.js | UTF-8 | 322 | 3.828125 | 4 | [] | no_license | //normal function statement
function sayHi(){
console.log('hi');
}
sayHi();
//function expresseion
var sayBye = function(){//no name, anonymous function
console.log('bye');
};
sayBye();
//save function and use another function as parameter
function callFunction(fun){
fun();
}
callFunction(sayBye... | true |
286d5ecb60d863c3ad448ba9a792d294ff085f7d | JavaScript | mtenrero/woffu-workingHours-report | /analyzer.js | UTF-8 | 1,130 | 3.109375 | 3 | [] | no_license | export function calculateDuration(dayDates) {
let elapsed = 0
let i = 0
while(i < dayDates.length) {
elapsed += dayDates[i] > dayDates[i+1] ? dayDates[i] - dayDates[i+1] : dayDates[i+1] - dayDates[i];
//console.log(elapsed)
i = i + 2
}
//console.log(elapsed)
return ... | true |
b22e506f13c7b6300f0bc51613c46b5a09738633 | JavaScript | d-poon/admin | /PreviousJS/createSite.js | UTF-8 | 984 | 2.71875 | 3 | [] | no_license | $(document).ready(function(){
$('#submit').click(function(){
var name = $('#name').val();
var lat = $('#latitude').val();
var longt = $('#longitude').val();
var tourType = []
if($('#general').is(':checked'))
tourType.push('general');
if($('#concrete').is(':checked'))
tourType.push('concrete');
... | true |
4f56a35e52b334455184e0bb6eb18862bdfe1796 | JavaScript | hedianbin/exchange | /utils/deploy.js | UTF-8 | 2,997 | 2.609375 | 3 | [] | no_license | //引入web3
let web3 = require('../utils/myUtils').getweb3()
//导入fs包
let fs = require("fs")
//导入path包
let path = require("path")
//导入sql连接池
let sqlHelpper = require('./sqlHelpper')
//拿到合约的路径
let contractPath = path.join(__dirname, "../build/", "MyToken.json")
//同步读取合约文件
let data = fs.readFileSync(contractPa... | true |
478e991a44831d8a1ff3b1f67fd18702228ed5cb | JavaScript | latvanii/phonebook-frontend | /src/App.js | UTF-8 | 4,649 | 2.984375 | 3 | [] | no_license | import React, { useState, useEffect } from 'react'
import personService from './services/persons'
import Notification from './components/notification'
const NewPersonForm = ({ handleNameChange, handleNumberChange, addPerson }) => {
return (
<form onSubmit={addPerson}>
<div>name: <input
onChange={ha... | true |
8e6c53fd698de0c216840d165a17e0484eba5e73 | JavaScript | yemi33/diarytown-prototypes | /felt-sim/js/engine.js | UTF-8 | 2,792 | 2.9375 | 3 | [] | no_license | /// ENGINE CODE
// Given an action spec, preprocess it.
function preprocessAction(action){
var query = '[:find ' + action.find + ' :where ';
query += action.where.map(whereClause => '[' + whereClause + ']');
query += ']';
action.query = query;
action.lvars = action.find.trim().split(/\s+/).map(s => s.substr(... | true |
6aa835d8685d1c62e83686a8f74221ad66106fb7 | JavaScript | joses166/lista2javascript | /exe16/funcao.js | UTF-8 | 223 | 3.28125 | 3 | [] | no_license | function f1(v){
v.push(parseInt(prompt("Informe o numero")));
}
function f2(v, c){
c[0] = 0;
var i = 0;
for(i = 0; i < v.length; i++){
c[0] += v[i];
}
}
function f3(c){
alert("Total da soma: " + c[0]);
} | true |
5544892e861fa51a6dd057fe6f0d21af7421acee | JavaScript | ldxf/PlaneGame | /js/KeyControl.js | UTF-8 | 3,535 | 2.65625 | 3 | [
"MIT"
] | permissive | var keyCode = {
keyUp: 38,
keyDown: 40,
keyLeft: 37,
keyRight: 39,
keyW: 87,
keyS: 83,
keyA: 65,
keyD: 68,
keySpace: 32,
keyEnter: 13,
keyEsc: 27,
key0: 96
}
var keyStatus = {
keyUpStatus: false,
keyDownStatus: false,
keyLeftStatus: fals... | true |
37a06268ea5ddc1807406fda38c0b581f91e021c | JavaScript | digitalhen/transcord | /helpers/transcriptionHelper.js | UTF-8 | 9,680 | 2.984375 | 3 | [
"MIT"
] | permissive | var officegen = require('officegen');
const moment = require('moment');
const strings = require('../strings.json');
var transcriptionHelper = {};
transcriptionHelper.buildTranscription = function(leftTranscription,rightTranscription) { // as objects, not JSON
console.log("Building transcription...");
... | true |
daefd8770fe20c06f3e48fb544e351748edfc7ee | JavaScript | ErlanArtykbaev/algorithm-web | /src/components/pages/Lists/SinglyList.js | UTF-8 | 2,103 | 3.203125 | 3 | [] | no_license | import React from "react"
import first from "../../../assets/img/linked-list/linked-list-concept.webp"
import CodePreview from "../../layer/CodePreview"
import ImageWrapper from "../../layer/ImageWrapper"
const SinglyList = () => {
return (
<div className='container'>
<h3 className='title'>Types of Linked... | true |
bd37fecbbd8c3f06d347bb17c07ac9bf4ecce057 | JavaScript | XingXing2019/LeetCode | /Tree/LeetCode 590 - NaryTreePostorderTraversal/NaryTreePostorderTraversal_JS/NaryTreePostorderTraversal.js | UTF-8 | 398 | 3.140625 | 3 | [] | no_license | function Node(val, children) {
this.val = val
this.children = children
}
/**
* @param {Node|null} root
* @return {number[]}
*/
var postorder = function (root) {
var res = []
var dfs = function (node) {
if (!node) return
for (let i = 0; i < node.children.length; i++)
dfs(node... | true |
354aada13f012fbe04ecbbc98c929b6ffdabf964 | JavaScript | shimoal/interviewCake | /test/13.findRotationTest.js | UTF-8 | 899 | 2.984375 | 3 | [] | no_license | var chai = require('chai');
var expect = chai.expect;
var findRotation = require('../13.findRotation.js');
describe('13. findRotation', function() {
it('should be a function', function() {
expect(findRotation).to.be.a('function');
});
it('should find the index of a rotated array', function() {
var words... | true |
97ace4b82090507ccf2673d7cea98f9d0cbe0451 | JavaScript | dsolisl/reciclapp | /action.js | UTF-8 | 474 | 2.796875 | 3 | [] | no_license | var correo = "";
function loadPage(href){
window.location = href;
return false;
}
function validar() {
var usuario= "";
correo = document.getElementById("correo_val").value;
console.log(correo);
if(correo=="omar@gmail.com"){
console.log(usuario);
lo... | true |
d2d94eeb2440621b6f695b0bc0f65264fafe0695 | JavaScript | fabianrios/personal_assistant | /client/main.js | UTF-8 | 4,596 | 2.765625 | 3 | [] | no_license | import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import './main.html';
Template.hello.onCreated(function helloOnCreated() {
// counter starts at 0
this.counter = new ReactiveVar(0);
var count = 0;
var images = "";
var showFlickr = function(tag) {
image... | true |
a70a1cbba30dd94f54f2fe3fd183815529c8d08f | JavaScript | snowwindsand/js-study | /app/react/tutorial/components/TestEs6.js | UTF-8 | 603 | 2.578125 | 3 | [] | no_license | import React, {
Component
} from 'react'
class TestEs6 extends Component {
constructor(props) {
super(props);
this.state = {
count: 1
};
this.handleClick = this.handleClick.bind(this);
}
handleClick() {
this.setState({
count: this.state.count + 1
});
}
render() {
return (
<div>
<butto... | true |
0b59cc3b6fd8f6a8b8a09c43e4dcd218b8982a65 | JavaScript | halineferreira/simple-crud-reactjs | /src/Components/Employees.js | UTF-8 | 4,644 | 2.59375 | 3 | [] | no_license | import React, { Component } from 'react';
import data from '../employees.json'
import { Button, Modal, ModalHeader, Fade, utils } from 'react-bootstrap'
import { Modal as ReactOverlayModal } from 'react-overlays'
let pos;
class App extends Component {
constructor(props, context){
super(props, context);
this.... | true |
4a3d1bb907370c268069b7ae37f6572790f90d00 | JavaScript | jlefebvre94/CoursWeb | /employes.js | UTF-8 | 2,502 | 3.203125 | 3 | [] | no_license | //Je verifie dans la console que la page est chargée
$(document).ready(function(){
console.log("la page est chargée");
});
//Clic sur le bouton envoyer du formulaire
$("#js-button-send").click(function(e){
e.preventDefault() //permet de geler l'event
//récuperation des valeurs des champs du formulaire
... | true |
65543b25ff8b4d2262a31b12b290843ea023e520 | JavaScript | kylePierson/profilebuilder | /Capstone.Web/Content/AddANewLanguage.js | UTF-8 | 404 | 2.515625 | 3 | [
"MIT"
] | permissive | function onSkillAdded(){
location.reload();
}
$(document).ready(function () {
$("#addskill").click(function () {
var newSkill = $("#newLanguageTextbox").val();
if (newSkill) {
var username = $("#hiddenusername").val();
$.post("/Employer/AddSkillInterested", {username: ... | true |
5d355f24cf75db4b1be69b50dc47142a54350dfd | JavaScript | MemeDream2013/monorepo | /projects/WAJS/src/ImageSlider/index.js | UTF-8 | 2,091 | 3.171875 | 3 | [
"Unlicense"
] | permissive | $(document).ready(() => {
console.log("WAJS_ImageSlider Initialising...");
const slider = {
images: [
"https://i.imgur.com/PnBUQYp.jpg",
"https://i.imgur.com/VQoZtY9.jpg"
],
speed: 1000,
position: {
tag: "h2",
text: "Purpose",
offset: 0 // can be -1 for "just before" t... | true |
539532506a83b68c9d7707bd4c0d448499918d7c | JavaScript | mdnooruzzaman/Javascript_Practical_Exercise | /Practical-1_javaScript_exercise/exercise11.js | UTF-8 | 184 | 3.296875 | 3 | [] | no_license | //Program to find the number of even digitd in a array of integer
var arr = [10,2,3,4,5,6];
const evenNum = (arr) => arr.filter(num => num %2 === 0).length
console.log(evenNum(arr));
| true |
46456d79fa9b8a7504eae1dc35db9a6a13080819 | JavaScript | loglogin2/finite-state-machine | /src/fsm.js | UTF-8 | 2,618 | 3.296875 | 3 | [] | no_license | class FSM {
/**
* Creates new FSM instance.
* @param config
*/
constructor(config) {
if(!config) throw new Error("Not configured");
this._state = config.initial;
this._states = config.states;
this._states[this._state].initial = true;
this._... | true |
4944bdc1abde0690574985e97f3db10e4acc044e | JavaScript | emilypo89/Bamazon | /bamazonCustomer.js | UTF-8 | 3,903 | 2.984375 | 3 | [] | no_license | var mysql = require("mysql");
var inquirer = require("inquirer");
var connection = mysql.createConnection({
host: "localhost",
port: 3306,
// Your username
user: "root",
// Your password
password: "",
database: "bamazon_DB"
});
// connection to the bamazon_DB
connection.connect(function(err) {
if (er... | true |
e5faf7f80053106f083c21df36f00a5bde72442a | JavaScript | dodooh/-LeetCode--JS | /LC220_containsDuplicateIII/index.js | UTF-8 | 592 | 3.25 | 3 | [] | no_license | var containsNearbyAlmostDuplicate = function (nums, k, t) {
const s = new Set(nums).length;
const n = nums.length
// If t == 0 which mean return true If and only If there is at least 1 duplicate number
if (t == 0 && n == s) return false;
for (let i = 0; i < nums.length; i++) {
for (let j = i... | true |
6ada9ced2b869a12562316ec9f06d9e81cf62ab8 | JavaScript | azapien22/Coding-Dojo-coursework | /webfundamentals/javascript/foundation_concepts/time/time.js | UTF-8 | 1,047 | 3.828125 | 4 | [] | no_license | var HOUR = 8;
var MINUTE = 50;
var PERIOD = "AM";
var str = "It's";
if (MINUTE > 30) {
str += "almost" + (HOUR + 1);
} else{
str += "just after" + HOUR;
}
if(PERIOD == "PM") {
str += "in the evening.";
} else{
str += "in the morning.";
}
console.log(str);
var HOUR = 7;
var MINUTE = 15;
var PERIOD =... | true |
065237e5cb66307ae955d20cb10f8a37ca219dbc | JavaScript | YehanZhou/js-algorithms | /linked-list/doubly-linked-list.js | UTF-8 | 3,050 | 3.890625 | 4 | [] | no_license |
class DoublyLinkedList extends LinkedList { // 双向链表,不用循环
constructor(equalsFn) {
super(equalsFn)
this.tail = undefined
}
push(element) {
const node = new DoublyNode(element)
if (!this.head) {
this.head = node
this.tail = node
} else {
... | true |
437184a3b8600373084678ca61e3cdd585e9ccda | JavaScript | node-honeycomb/honeycomb-console | /assets/dialog/index.jsx | UTF-8 | 1,639 | 2.578125 | 3 | [] | no_license | 'use strict';
const React = require('react');
const ReactDOM = require('react-dom');
const store = require('../store');
const dialogs = [];
// dynamic create dialog.
// @param name, required, dialog name, declared in ./${dialog name}/index.jsx
// @param value, optional
exports.createDialog = function (name, value) ... | true |
38efe9d853b28abbfd296ac302760cdbacc18bb2 | JavaScript | kirantrainings/birlasoft-nodejs | /public/app/users/userSvc.js | UTF-8 | 807 | 2.515625 | 3 | [] | no_license | var userSvcFn = function ($http, $q) {
this.getAllUsers = function () {
var dfd = $q.defer();
$http.get('/api/user/getAll')
.success(function (response) {
dfd.resolve(response);
}).error(function (response) {
dfd.reject("Error")
})... | true |
7db7805c4aa75cf3083713e1753608218c11743f | JavaScript | saonam/react_example | /src/reducers/place.js | UTF-8 | 405 | 2.625 | 3 | [] | no_license |
const initState = {
listPlace: [],
}
const place = (state = initState, action = {})=>{
switch(action.type){
case 'GET_LIST_PLACE':
let listPlace = [...state.listPlace]
listPlace = listPlace.concat(action.data.data ? action.data.data : [])
return {...state, listPlace:... | true |
1d12527f1352d34cb0d9dda699253171e2f28217 | JavaScript | Spigaa/delightStudio.github.io | /games_web/City Leaping/jogo.js | UTF-8 | 5,474 | 2.75 | 3 | [] | no_license | var myGamePiece;
var myObstacles = [];
var myScore;
var sfxMusic = new Audio();
sfxMusic.src = "sfx/bkMusic.mp3";
sfxMusic.loop = true;
sfxMusic.volume = 0.4;
var sfxGameOver = new Audio();
sfxGameOver.src = "sfx/gameOver.mp3";
sfxMusic.volume = 0.07;
var sfxPoints = new Audio();
sfxPoints.src = "sfx/points.mp3";
sf... | true |
475ed4e7e09b8e8993dd07ac758d22d2f90c905a | JavaScript | elninhojs/react-inline-logic | /lib/index.js | UTF-8 | 832 | 2.640625 | 3 | [
"MIT"
] | permissive | import React from 'react'
const If = ({condition, children})=>(
children = !condition?'':children
);
const Else = ({condition, children})=>(
children = condition?'':children
);
const For = ({list=[], onLoop=(item, index)=>(<div key={index}>{index}</div>), onLoopComplete=()=>{}, onLoopBreakIf=()=>false, onL... | true |