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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
af784205a42c104d5d6a66631f8f41607009e350 | JavaScript | msong793y/lc | /lc1318.js | UTF-8 | 817 | 3.5 | 4 | [] | no_license | var largestRectangleArea = function (heights) {
if(heights.length===1) return heights[0]
let max=0;
for (let i = 0; i<heights.length; i++){
let current = large(heights, i)
if(current> max){
max= current;
}
}
return max;
};
function large(arr, idx){
let i=... | true |
9f8a5391596a91ced36ca916a53f845165e92015 | JavaScript | assecopl/fh | /packages/components/fhdp-controls/toggle-development.js | UTF-8 | 1,641 | 2.625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | const fs = require('fs');
const getVersion = (file) => {
const package = JSON.parse(fs.readFileSync(file));
return package.version;
}
const toggleDevelopment = () => {
const path = '../../../fhdp-common/fhdp-commons/fhdp-commons-fh-starter/package.json';
const package = JSON.parse(fs.readFileSync(path));
co... | true |
bddecbf5e34356139edf8835c2b646e3a2ba39ec | JavaScript | hajkowicz/eardrum-monster | /src/SpotifyAPI.js | UTF-8 | 4,030 | 2.515625 | 3 | [] | no_license | export default class SpotifyAPI {
constructor(accessToken, onUnauthorized) {
if (accessToken == null) {
throw new Error("Access token was null");
}
this.accessToken = accessToken;
this.onUnauthorized = onUnauthorized ?? (() => {});
this.maybeHandle401 = this.maybeHandle401.bind(this);
}
... | true |
de1f8b1961a4631c256ea7cfd97922dffd8246e6 | JavaScript | serahmetpalli/lotide | /assertArraysEqual.js | UTF-8 | 478 | 3.34375 | 3 | [] | no_license | const eqArrays = function (actual,expected){
if (expected.length===actual.length){
for (i=0; i<actual.length; i++){
if (actual[i] !== expected[i]) {
return false;
}
}
return true;
} else {
return false;
}
};
const assertArraysEqual= function (actual,expected){
if (eqArrays... | true |
0aca35cf5d1f1f4fe93e6cbba1c52926ff290cbd | JavaScript | yanivle/yanivle.github.io | /assets/javascripts/clothsim3d/UIValue.js | UTF-8 | 3,764 | 2.828125 | 3 | [] | no_license | let hide_ui = true;
let getters = new Map();
class Getter {
constructor(name, initial_value, min, max, step = 1) {
this.name = name;
this.initial_value = initial_value;
this.min = min;
this.max = max;
this.step = step;
this.detected_inconsistency = false;
this... | true |
970a0f3eb6370ba259e79a4e2bd2c50b4cd0cecd | JavaScript | Davids89/TwitterReactNode | /components/TweetsApp.react.js | UTF-8 | 4,703 | 3.03125 | 3 | [
"MIT"
] | permissive |
module.exports = TweetsApp = React.createClass({
//render the component
render : function(){
return (
<div className="tweets-app">
<Tweets tweets={this.state.tweets}/>
<Loader paging={this.state.paging}/>
<NotificationBar count={this.state.cou... | true |
9eda367c4dbd43c446aa1a95b6a021387c470660 | JavaScript | sengartech/ecomm-restapi | /user-end/app/controllers/forgot-password.js | UTF-8 | 2,883 | 2.578125 | 3 | [] | no_license | //including dependencies.
var express = require('express');
var mongoose = require('mongoose');
//including libs and middlewares
var responseGenerator = require("../../libs/responseGenerator.js");
var encrypt = require('../../libs/encrypt.js');
var auth = require('../../middlewares/auth.js');
var router = express.Rou... | true |
48baf128d056cff5184ffc82c97a41c2adb2e8de | JavaScript | Dan-Steinberg-Intuit/FEBootcampWeek3-infer | /dev/exercises/3_2_lab/js/app.js | UTF-8 | 1,309 | 2.515625 | 3 | [] | no_license | require(["TrialOverView"], function(TrialOverView){
/* // Test that jQuery is loaded
$('.target').html('jQuery is working <br>');
// Test that Underscore is loaded
if (_.contains([1, 2, 3], 3)) {
$('.target').append('Underscore is working <br>');
}
// Test that Backbone is working
var model = new ... | true |
b63a4498f1028309f7fe7cdfaad1fb0db35f7021 | JavaScript | simde-utc/woolly-front | /src/redux/reducers/messages.jsx | UTF-8 | 516 | 2.671875 | 3 | [] | no_license | import { MESSAGE_REDUX_PREFIX } from "redux/constants";
const DEFAULT_MESSAGE_STORE = [];
/**
* Simple push/pop messaging system reducer
*/
export default function messagesReducer(state = DEFAULT_MESSAGE_STORE, action) {
switch (action.type) {
case `${MESSAGE_REDUX_PREFIX}_PUSH`:
const data = action.payload;
... | true |
e8c05549efcdc07c69ec92810de864a4d4d46400 | JavaScript | mshapir/LeetCode-Solutions | /plusOne.js | UTF-8 | 400 | 3.296875 | 3 | [] | no_license | var plusOne = function(arr) {
let num = 0
let resultNum = 0
for(var i = arr.length - 1; i >= 0; i--){
resultNum = arr[i] + 1
if(resultNum === 10){
arr[i] = 0
} else {
arr[i] = resultNum
return arr
}
num = parseInt(resultNum / 10)
... | true |
4af2c120ee30e4b6bb0dbf530f5abb8daa498636 | JavaScript | bjmendy/Tensorflow-JS-Examples | /01_XOR/sketch.js | UTF-8 | 817 | 3.4375 | 3 | [] | no_license | let data = {
inputs: [
[0, 0],
[0, 1],
[1, 0],
[1, 1]
],
targets: [
[0],
[1],
[1],
[0]
]
}
function setup() {
createCanvas(400, 400);
nn = new NeuralNetwork(2, 4, 1);
let counter = 0;
nn.train(data, finished);
function finished() {
console.log('Training pass: ' +... | true |
d61e638cd94efe666a2d1593c8947ca0f09870ae | JavaScript | KaiserPhemi/sock-demo | /src/app.js | UTF-8 | 246 | 2.859375 | 3 | [] | no_license | function onChatMessage(text) {
const chatList = document.querySelector("#app-chat");
let newChatItem = document.createElement("li");
newChatItem.innerHTML = text;
console.log(newChatItem.innerHTML)
chatList.appendChild(newChatItem);
}
| true |
fcf831606247ea638223cba3f9923b74c21ac656 | JavaScript | jnastase/ReactWebpack3 | /src/app.js | UTF-8 | 1,528 | 2.765625 | 3 | [] | no_license | import React, { Component } from 'react';
import TodoItem from './todoItem';
import Parent from './components/parent';
class App extends Component {
state = {
name: 'react',
inputText: '',
todos: []
}
render() {
return (
<div>
<h1>Hey {this.state... | true |
65893a4e5b6fb4f83ff66f1822dc1b760bee781f | JavaScript | cctv-hk/HelloWing | /libs/core/extension/gui/effect/animation/RepeatBehavior.js | UTF-8 | 821 | 2.578125 | 3 | [] | no_license | var egret;
(function (egret) {
var gui;
(function (gui) {
var RepeatBehavior = (function () {
function RepeatBehavior() {
}
/**
* 指定在每个迭代上重复的动画在前进方向上的进度。
*/
RepeatBehavior.LOOP = "loop";
/**
* 指定重复动画应该在每个迭... | true |
23299c1de3cc3e6dcc035773c56f7f4cc600c909 | JavaScript | mikehaley1999/shoppingList | /js/app.js | UTF-8 | 922 | 2.53125 | 3 | [] | no_license | $(document).ready(function() {
$('#shopping-list').on('click', '.delete', function(event) {
event.preventDefault();
$(this).closest('li').remove();
})
$('#shopping-list').on('change','.check-box', function(){
var input = $(this).closest('li').find('.new-item');
if ($('.check-box').is(':checked')) {
... | true |
d05c099490b9557224ecc506308a519d6a07851c | JavaScript | wierdotechman/KannaKamuiBot | /commands/commands/utility/valorant/agent-stats.js | UTF-8 | 8,576 | 2.765625 | 3 | [
"MIT"
] | permissive | const axios = require('axios');
const Discord = require('discord.js');
module.exports = {
commands: ['agentstats', 'valagentstats'],
callback: (message, args) => {
const profile = args[0]
const tag = args[1]
if (!args[0] || !args[1]) {
message.channel.send('Please specify yo... | true |
e54a40c458270b3c337936867a61ff19add0b952 | JavaScript | JerryZhu99/osu-preview | /popup/canvas.js | UTF-8 | 3,319 | 2.609375 | 3 | [
"MIT"
] | permissive | import { isSlider, isSpinner, isHold, isNewCombo } from './renderers/utils'
import OsuRenderer from './renderers/osu';
import ManiaRenderer from './renderers/mania';
const toTimeString = (time) => {
const seconds = Math.floor(time / 1000) % 60;
const minutes = Math.floor(time / 1000 / 60);
return `${minutes}:${... | true |
8d6801434eb42f19dd87fd5dea0fe8320c587d54 | JavaScript | ElRorro/2-DAM | /Desarrollo de Interfaces/Angular/ejercicio2/main.js | UTF-8 | 893 | 2.8125 | 3 | [] | no_license | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Persona_1 = require("./Persona");
var arrayPersonas = new Array();
arrayPersonas.push(new Persona_1.Persona('Pepe', 'García Maroto', 200));
arrayPersonas.push(new Persona_1.Persona('Carlos', 'García Montero', 300));
arrayPersonas.push(new ... | true |
82bffeac385f24672120bcf167fcbd88c49b4793 | JavaScript | geosheehan/code-wars | /6-kyu/js/array-diff.js | UTF-8 | 702 | 3.75 | 4 | [] | no_license | // Array.diff
// https://www.codewars.com/kata/523f5d21c841566fde000009
/**
* Get the set of numbers from an array that don't exist in a separate array
* Examples:
* [], [4, 5] -> []
* [3, 4], [3] -> [4]
* [1, 8, 2], [] -> [1, 8, 2]
* [1, 2, 3], [1, 2] -> [3]
* [1, 2, 2, ... | true |
170971d54f25d7aff4a85a2050a48e720f7dbffd | JavaScript | Sadia-web/node-mongo | /index.js | UTF-8 | 1,036 | 2.796875 | 3 | [] | no_license | const express = require('express');
const cors = require('cors');
const app = express();
app.use(cors());
const users = ["asad", "Moin", 'Saber', 'Zabed', 'zara', 'sabana'];
// function rootCall(req, res){
// res.send('Thank You very much')
// }
// const rootCall = (req, res) =>{
// res.send('Thank you ve... | true |
95f53cec17cd3737a47ccb81845d7642ff3e10c2 | JavaScript | Den4yk76/goit-react-hw-04-movies | /src/components/HomePage/HomePage.js | UTF-8 | 1,564 | 2.625 | 3 | [] | no_license | import axios from 'axios';
import { useState, useEffect } from 'react';
import { Link } from 'react-router-dom';
import styles from './HomePage.module.css';
export default function HomePage() {
const [movies, setMovies] = useState([]);
const base_url = 'https://api.themoviedb.org/3/trending/movie/day';
const ap... | true |
8f2eaf8a0c1ee2bcefefd4f03b2281a23055d601 | JavaScript | aliakseyevavikt/codewars-solutions | /8 kyu/Correct the mistakes of the character recognition software.js | UTF-8 | 829 | 4.0625 | 4 | [] | no_license | /*
https://www.codewars.com/kata/577bd026df78c19bca0002c0/javascript
Description:
Character recognition software is widely used to digitise printed texts. Thus the texts can be edited, searched
and stored on a computer.
When documents (especially pretty old ones written with a typewriter), are digitised character rec... | true |
4ece12b14c3f866a28881a2b204e6e7413b10ad1 | JavaScript | fxkulou/maptalks.js | /test/map/ProjectionSpec.js | UTF-8 | 2,911 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | describe('#Projection', function () {
var container;
var map;
var center = new maptalks.Coordinate(118.846825, 32.046534);
beforeEach(function () {
container = document.createElement('div');
container.style.width = '800px';
container.style.height = '600px';
document.bod... | true |
70effce45de93b76b2877235025a7c1041236f95 | JavaScript | FelixMo42/nav | /src/struc/Vector.js | UTF-8 | 1,267 | 3.421875 | 3 | [] | no_license | module.exports = class Vector {
constructor({x, y}) {
this.x = x
this.y = y
}
setX(x) {
this.x = x
}
setY(y) {
this.y = y
}
//
rotate({angle, source}) {
let ox = source && source.x || 0
let oy = source && source.y || 0
let x = ... | true |
f19164003c34c32d2943bfdef8098cda3a4ce4f7 | JavaScript | mbilyk/at-ui-full | /src/components/App.js | UTF-8 | 1,564 | 2.53125 | 3 | [] | no_license | import React from 'react';
import SpaceList from './SpaceList';
import PropTypes from 'prop-types';
import * as api from '../api';
class App extends React.Component {
constructor() {
super();
this.state = {
spaces: {},
entries: {},
assets: {},
activeIndex: 0
};
this.handleSpa... | true |
9e87e8f464d9dc4e661be3bf1a18f016ed9772f7 | JavaScript | elainechan/chekhov | /public/client.js | UTF-8 | 8,197 | 2.65625 | 3 | [
"MIT"
] | permissive | 'use strict';
const token = localStorage.getItem('token');
const userId = localStorage.getItem('userId');
function getUserClientData(callback) {
$.getJSON(`/clients/${userId}/${token}`, callback);
}
function renderClients() {
console.log('renderClients');
$.ajax({
url: `/clients/user/${userId}/${token}`,
type... | true |
af7ccbf6fa2a145b42f1d6ad1e12dceebae02a7d | JavaScript | matej24/weather-app | /src/App.js | UTF-8 | 3,411 | 2.96875 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import ConstantWeather from './components/ConstantWeather/ConstantWeather';
import SearchBar from './components/SearchBar/SearchBar';
const api = {
key: "0b5e84adb64509589cc6d96bf7513dce",
base: "http://api.openweathermap.org/data/2.5/"
}
function App() {
co... | true |
a8f72fb680ca922b683b1e1122d46f7e372f4ec4 | JavaScript | gfoteinos/curriculum-prod | /config/passport.js | UTF-8 | 1,340 | 2.59375 | 3 | [] | no_license |
// ======== Import Required Modules ========
// Define the Strategy
const LocalStrategy = require('passport-local').Strategy;
const mongoose = require('mongoose');
const bcrypt = require('bcryptjs');
// ======== Load User Model ========
const User = mongoose.model('users');
// ======== Export Passport ========
... | true |
d09a14cebc81f1bc3eb9ea6cbbff6f9a36fd77eb | JavaScript | Sambhav-Saraswat123/Project-84 | /script.js | UTF-8 | 1,048 | 3.203125 | 3 | [
"MIT"
] | permissive | const canvas = document.getElementById("canvas");
const ctx = canvas.getContext("2d");
const car1Image = "./car1.png";
const car2Image = "./car2.png";
const backgroundImage = "./racing.jpg";
const carHeight = 50;
const carWidth = 100;
let car1X = 10;
let car1Y = 10;
let car2X = 10;
let car2Y = 80;
window.onl... | true |
8a2abecdcb886a5601a05b378a4aa74a0a1642d7 | JavaScript | vasildimov98/softuni-tutorials | /06.JSAdvanced/02.Applications/Exercise/02.RestServicesAndAJAX/02.Exercise/Problems/04.MESSENGER/app.js | UTF-8 | 1,620 | 3.09375 | 3 | [] | no_license | function attachEvents() {
const GET_POST_URL = 'https://rest-messanger.firebaseio.com/messanger.json';
const SUBMIT_BTN = document
.querySelector('#submit');
const AUTHOR_INPUT_ELEMENT = document
.querySelector('#author');
const CONTENT_INPUT_ELEMENT = document
.querySelector('#c... | true |
73934ae5891e9e4efacd7eb7486782ab6594e689 | JavaScript | MonroeGollaher/InspireCheckpoint | /app/Services/TodoService.js | UTF-8 | 1,099 | 2.609375 | 3 | [] | no_license | import { ProxyState } from "../AppState.js";
import { api } from "../Services/AxiosService.js";
import Todo from "../Models/Todo.js";
let url = 'monroe/todos/'
class TodoService {
constructor(){
this.getTodos()
}
async getTodos() {
let res = await api.get(url);
ProxyState.todos = res.data.data.map... | true |
548bd363f5c7047488df7cb2a913bbb5f4c62ce9 | JavaScript | VinMannie/aaaaas | /js/levelEditor/CreatedLevels.js | UTF-8 | 2,439 | 2.828125 | 3 | [
"MIT"
] | permissive | function CreatedLevels() {
var view = View.getInstance();
var storage;
var levelsWrapper;
var that = this;
this.init = function() {
var mainWrapper = view.getMainWrapper();
var deleteAllBtn = view.create('button');
levelsWrapper = view.create('div');
view.addClass(levelsWrapper, 'levels-wr... | true |
9c8b78e9d9d3c259f6c9e1c0295baedc7360fe33 | JavaScript | aod1411/05Homework | /Develop/script.js | UTF-8 | 2,237 | 3.046875 | 3 | [] | no_license | $(document).ready(function(){
// getting current day from moment.js
$('#currentDay').text(moment().format("dddd, MMMM Do"))
$(".saveBtn").on('click', function(event){
event.preventDefault();
// getting use text value from each time block using 'this'
var userText = $(this).siblings(".description").val... | true |
8e9a538987919760ddb124608798b5297b1d1b73 | JavaScript | alokpandey78/ES6 | /11.mapSet/set-example1.js | UTF-8 | 354 | 3.171875 | 3 | [] | no_license | var founder = new Map();
founder.set("fb","mark");
founder.set("google","larry");
console.log(founder.size); //2
console.log(founder.get("twitter"));// undefinded
console.log('yahoo has',founder.has("yahoo")); //false
console.log('google has ',founder.has("google")); //true
for(var [key,value] of founder){
consol... | true |
e5baae833419bd1262f1749c5f544fe9316c87f7 | JavaScript | bgoonz/UsefulResourceRepo2.0 | /_RESOURCES/my-gists/__CONTAINER/4caa8463a5/Easy_-_14_-_Ex_Oh.js | UTF-8 | 680 | 4.53125 | 5 | [
"MIT"
] | permissive | // Step By Step
function ExOh(str) {
// First, we declare two variables:
// One which remove all characters in the string that aren't x's...
var strX = str.replace(/[^x]/g, "");
// ...and and the second which removes all characters that aren't o's
var strO = str.replace(/[^o]/g, "");
// Next, we get the l... | true |
238c6108480aea4823809d12d96219402c70b888 | JavaScript | Kenechvkwv/Toast-Array | /js/js_p.js | UTF-8 | 303 | 3.3125 | 3 | [] | no_license | // function is_leap_year(year) {
// if (year / 400 == 0) {
// return true;
// }
// else if (year / 4 == 0) {
// return true;
// }
// else {
// return false;
// }
// }
// console.log(is_leap_year(0));
for (var i = 0; i <= 10; i++) {
console.log(i);
} | true |
7268a1dd8e14c2e8e47ea114abf1d0e2b334aaf6 | JavaScript | ninjadude773/week_7_weather_api-java_project | /js/main.js | UTF-8 | 1,341 | 3.09375 | 3 | [] | no_license | function getJson() {
let city = document.querySelector('#city').value;
fetch(`https://api.openweathermap.org/data/2.5/weather?q=${city}&appid=c941c9ca854444abd337e4baa9e01cb5`)
.then(response => response.json())
.then(data => {
console.log(data)
let high_temp = Math.round((((data.main.temp_m... | true |
ab69ecd71272b0715fceb8258efae9a8b6e5031d | JavaScript | kristofsimonyi/Children-of-the-Elements | /Titanium/Children Of Elements/app/lib/common/PedalMenu.js | UTF-8 | 5,020 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | function PedalMenu(_titleTarget , _textTarget){
this.screenTitle = _titleTarget;
this.screenText = _textTarget;
////add the main container
var cirContainer = Ti.UI.createImageView({
image:"/bookshelf/bookshelf_pedalMenu_container.png",
left:0,
bottom:0,
width:512,
height:517,
touchEnabled:false,
z... | true |
b321416f93f7980bfe64d9c23680b1a4f08f49c4 | JavaScript | logorn/serverAuth | /services/passport.js | UTF-8 | 2,340 | 2.703125 | 3 | [] | no_license | const passport = require('passport');
const User = require('../models/user');
const config = require('../config');
const JwtStrategy = require('passport-jwt').Strategy;
const ExtractJwt = require('passport-jwt').ExtractJwt;
const LocalStrategy = require('passport-local');
/*
Authentication flows
3 use cases
1. Si... | true |
ac084ac8167e3dce4d0806e405a6a8ff09a8ec41 | JavaScript | faustinop/Integrador-Prog | /Programacion_1/Producto.js | UTF-8 | 702 | 2.53125 | 3 | [] | no_license | class Producto {
constructor(_precio_unidad, _porcentaje_descuento, _cantidad) {
this._precio_unidad = _precio_unidad;
this._porcentaje_descuento = _porcentaje_descuento;
this._cantidad = _cantidad;
}
CalcularPrecioTotal() {
return `{precio_total = ${this.precio_total ... | true |
37866427203bb57068b0200081cd1dd49927277c | JavaScript | ndutagrace25/knexcrud2 | /utils/stickerValidator.js | UTF-8 | 433 | 2.828125 | 3 | [] | no_license | const validSticker = sticker => {
const hasTitle = typeof sticker.title == 'string' && sticker.title.trim() != '';
const hasURL = typeof sticker.url == 'string' && sticker.url.trim() != '';
const hasDescription = typeof sticker.description == 'string' && sticker.description.trim() != '';
const hasRating = !isNa... | true |
039f956e175c0c3aa2d751972e0b34407d796e15 | JavaScript | CRYPPTON/MultiCriteriaDecision | /MultiCriteria.js | UTF-8 | 1,768 | 3.609375 | 4 | [] | no_license |
/*
- task add matrix maker
- add weight for each alternative ***
*/
var table = [
[250,16,12,5],
[200,16,8,3],
[300,32,16,4],
[275,32,8,4],
[225,16,16,2]
]
var non_beneficial = function(){
var w = 0.25; //set weight non_benef... | true |
c92e5def94cdedc8f712b4d8c7cd4aeb4be1209c | JavaScript | TuxFriends/node-study | /01. express helloworld/03_helloworld_with_ejs.js | UTF-8 | 302 | 2.671875 | 3 | [] | no_license | const express = require('express')
const app = express()
const port = 3000
app.set('view engine', 'ejs');
app.get('/', (req, res) => {
const who = "pocopoco"
res.render('pages/index', {
who: who,
})
})
app.listen(port, () => console.log(`Example app listening on port ${port}!`)) | true |
9920099d54d2fd544d5c0b69482dccc51a7d53f6 | JavaScript | sylvia963838/online-album | /static/js/user_edit.js | UTF-8 | 4,248 | 3.234375 | 3 | [] | no_license | var url_prefix = "/vhwzma2k/p3";
//Current user
var username;
//using AJAX to get the current information and insert it into the form
$.ajax(url_prefix+"/api/v1/user",{
type: "GET",
contentType: "application/json",
//data: JSON.stringify(),
success: function(data, status){
username = data.username;
documen... | true |
e890982eb955a7223386a149571393bfb0027008 | JavaScript | elisha10108/all | /befor_node.js/l15/proto_js/bike_chaining.js | UTF-8 | 810 | 3.265625 | 3 | [] | no_license | class Bike{
constructor(_parent,_name,_color){
this.parent = _parent;
this.name = _name;
this.color = _color;
}
render(){
let newDiv = document.createElement("div");
document.querySelector(this.parent).append(newDiv);
// במידה ואני רוצה לדבר עם משתנה או אלמנט שיצרתי
// בתוך מיטודה אז ני... | true |
2464880f58d81d0ee8e377e0551e19aca423c799 | JavaScript | jdbrouwer3/john-repo | /gitrepo/2018/Dec14/TodoWeb/scripts/ajax.js | UTF-8 | 1,011 | 2.75 | 3 | [
"MIT"
] | permissive | 'use strict';
export function appGet(url, func) {
let init = {
method: 'get'
};
let errorUrl = 'https://localhost:5001/todo/';
let request = new Request(url, init);
fetch(request).then((response) => {
if (response.ok) {
response.json().then(func);
} else {
throw new Error(response)... | true |
9116c3800504b9b4dbc1e23fe77967d665dbc4c3 | JavaScript | mcrider/thingy | /models/index.js | UTF-8 | 750 | 2.671875 | 3 | [] | no_license | // Loop over all files in this folder and require each model
var fs = require("fs"),
path = require("path");
var properties = {};
var startTime = new Date().getTime();
fs.readdir(__dirname, function (err, files) {
if (err) {
throw err;
}
files.map(function (file) {
return path.join(__dirname, ... | true |
6d5a30cf307b2c0bf3aa2f471962667d23902c85 | JavaScript | adityasharma3/groww.in-clone | /src/script.js | UTF-8 | 594 | 2.59375 | 3 | [] | no_license |
function open_section(evt, section_name) {
var i, tabcontent, tablinks;
// section_name = 'stocks';
tabcontent = document.getElementsByClassName("tab-content");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
console.log(i);
}
tablinks = document.getElementsByClassNa... | true |
06995c2f614dd2252d1d9e3ad17f73809bb3504b | JavaScript | hasshy/game | /jsloader.js | UTF-8 | 3,407 | 2.546875 | 3 | [] | no_license | /**************************************************************************
* author : hasshy
* Create : 2013/06/09
* Update : 2013/06/09
* Description : ファイル読み込み
**************************************************************************/
var metaLoader = {
conf : {
loader : "jsloader.js",
... | true |
01242559ba8f8c19051165aab419c21b84e1cc92 | JavaScript | Neo534/Rock-Paper-Scissors2 | /rock-paper-scissors.js | UTF-8 | 4,433 | 3.4375 | 3 | [] | no_license | let myScore = 0;
let compScore = 0;
function randomComputer() {
let rand = ["rock", "paper", "scissors"];
return (rand[Math.floor(Math.random() * rand.length)]);
}
const buttons = document.querySelectorAll('button');
buttons.forEach((button) => {
button.addEventListener('click', () => {
playRound(button... | true |
760ae2ef21ae7d71a49f537735874f4a125d2ce2 | JavaScript | hcl1687/braces-template | /src/parsers/directive.js | UTF-8 | 380 | 2.546875 | 3 | [
"MIT"
] | permissive | import Cache from '../cache'
const cache = new Cache(1000)
/**
* Parse a directive value and extract the expression
* and its filters into a descriptor.
*
* @param {String} s
* @return {Object}
*/
export function parseDirective (s) {
var hit = cache.get(s)
if (hit) {
return hit
}
var dir = {}
di... | true |
fe02fcdf478ab43b370b97067315544a6dd1d46e | JavaScript | PC846/K-Bakery | /K-Bakery/src/hamburger.js | UTF-8 | 191 | 2.65625 | 3 | [] | no_license | const btnList = document.querySelectorAll('.btn');
btnList.forEach(btn => {
btn.addEventListener('click', function(e){
e.preventDefault();
this.classList.toggle('open');
});
}); | true |
3b170e18b90235e5a6b8e5a6c7099c718c08e0cd | JavaScript | jessicadever1/daily-journal | /scripts/journalEntry.js | UTF-8 | 531 | 3.015625 | 3 | [] | no_license | /*
* Purpose: To render a single journal entry as an
* HTML representation of the data
*/
export const JournalEntryComponent = (entry) => {
return `
<section id="entry--${entry.id}" class="journalEntry">
<div class="entry__concept"><h2>${entry.concept}</h2></div>
<di... | true |
4fb07c7872d982c917115de5a97ffc8dae6d33a9 | JavaScript | Nargon271/presupuesto | /src/components/Form.js | UTF-8 | 2,209 | 2.703125 | 3 | [] | no_license | import React, { useState } from 'react';
import Error from './Error'
import shortid from 'shortid'
import PropTypes from 'prop-types'
const Form = ({saveSpending, saveCreateSpending}) => {
const [name, saveName] = useState('')
const [quantity, saveQuantity] = useState(0)
const [error, errorHandling] = us... | true |
80c25139cb8073fbf21b92d8f4ae4a139ea6b186 | JavaScript | MarioReid/workout-tracker | /routes/api_routes.js | UTF-8 | 593 | 2.546875 | 3 | [] | no_license | const router = require("express").Router()
const Workout = require('../models/workoutModel')
//GET ROUTE ALL WORKOUT DATA
router.get("/workouts", (req, res) => {
Workout.find().then((allWorkouts) => {
res.json(allWorkouts);
});
});
router.post("/submit", ({ body }, res) => {
res.send('This is the post ro... | true |
091315da3698f512f32f3a607b5f33052fd9bb9b | JavaScript | meryka/JavaScript-Developer-Test | /tests/level2.test.js | UTF-8 | 2,508 | 2.6875 | 3 | [] | no_license | import Collection from "../src/level2";
import fs from "fs";
test("Testing a single line", () => {
const singleLine = "1 ATIVO 1120807,67D 527.081,41 464.716,15 1.183.172,93D ";
const expected = [
{
description: "ATIVO",
classifier: "100000",
openingBalance: 112080... | true |
a8738483f06d188ff65c6df491798ec3ee4b2a52 | JavaScript | runingYao/invitationCard | /js/utils.js | UTF-8 | 1,792 | 3.296875 | 3 | [] | no_license | var Utils = {
getArrayItems:function (array,length) {
//新建一个数组,将传入的数组复制过来,用于运算,而不要直接操作传入的数组;
var temp_array = new Array();
for (var index in array) {
temp_array.push(array[index]);
}
//取出的数值项,保存在此数组
var return_array = new Array();
for (var i = 0; ... | true |
1295488432a8197f347157fc546b53d3e485af6d | JavaScript | Adevaldo10/Progamacao_Imperativa | /if1.js | UTF-8 | 120 | 2.90625 | 3 | [] | no_license |
let status = 'sou feliz'
if (status == 'sou feliz'){
console.log('verdadeiro')
}else{
console.log('falso')
}
| true |
b8f7351a75292bd33981a5aefb3648488ac9b190 | JavaScript | SchuyTyr/Website_1_0 | /src/old/FadeAnim.js | UTF-8 | 851 | 3.421875 | 3 | [] | no_license | /*const time = Math.random() + .5;
// I’m adding .5 here so the flicker isn’t too obnoxious
console.log(time);
const roundedLine = document.querySelector('.rounded');
const roundedTwoLine = document.querySelector('.roundedTwo');
roundedLine.style.setProperty('--animation-time', time +'s');
roundedTwoLine.style.setPro... | true |
8383dfa3221d99ef436c7703c8bfe368443ab5d2 | JavaScript | Slooowpoke/wobbly-man | /src/entities/Rock.js | UTF-8 | 509 | 2.546875 | 3 | [] | no_license | import ClippedObject from "./ClippedObject";
/**
* A rock
*
* An object which falls off if out of view and resets its position elsewhere
*/
export default class extends ClippedObject {
constructor (scene, x, y, angle, player, collideWithPlayerAction) {
super(scene, x, y , 'rock', angle, player);
... | true |
caf39f8c2075d720bb556fe9a0bccd7882f0920c | JavaScript | ahmedali20024/test | /exampls/work2.js | UTF-8 | 722 | 3.015625 | 3 | [] | no_license | function exit() {
document.getElementById("goodbye").innerHTML = "See You later";
document.getElementById("goodbye").style.display = "block";
}
function hidden(){
document.getElementById("goodbye").style.display="none";
}
function h3() {
document.getElementById("h11").style.display = "none";
}
functio... | true |
9d6479f7d7c6d94fd5da799fdf4ecb8f48cff950 | JavaScript | johnzhouinfo/Project-Vex | /lib/js/undo_redo.js | UTF-8 | 1,540 | 2.8125 | 3 | [
"MIT"
] | permissive | var undo_manager = new UndoManager();
var undoBtn = document.getElementById('undo');
var redoBtn = document.getElementById('redo');
/**
* Add listener when click undo btn
*/
undoBtn.addEventListener('click', function () {
$(".drop").contents().find("[data-dragcontext-marker]").remove();
undo_manager.undo();
... | true |
5fbce031ae52590e12c5b2a27a4466d3a93e7542 | JavaScript | felynirnanda/tugasPwebMinggu11 | /script.js | UTF-8 | 650 | 3.09375 | 3 | [] | no_license | document.addEventListener('load', alert("Selamat Datang"));
const tombolSubmit = document.getElementById("tombolSubmit");
tombolSubmit.addEventListener("click", cekLogin)
function cekLogin() {
const inputanUsername = document.getElementById("username").value;
const inputanPassword = document.getElementById("pa... | true |
0f6585ba6af6316c071954aa2747233fb2bd6e95 | JavaScript | pkey/todo-react | /frontend/lib/todo/TodoItemForm.jsx | UTF-8 | 2,262 | 2.625 | 3 | [] | no_license | import React from 'react';
import service from './todoInfraService'
class TodoItemForm extends React.Component {
constructor(props) {
super(props);
this.state = {
isUpdating: null,
title: "",
description: "",
isDone: ""
}
this.handle... | true |
70091969f1a0a3425e945c518e46b9737d963854 | JavaScript | baobao12356/webLog | /demos/OOP/Object7.js | UTF-8 | 668 | 3.09375 | 3 | [] | no_license | var Parent = function() {};
var Child = function() {
Parent.call(this);
};
Child.prototype = {
__proto__: Parent.prototype,
constructor: Child
};
Object.defineProperties(Child.prototype, {
isEnumerC: {
enumerable: true,
value: 'Child.isEnumer'
},
unEnumerC: {
value: 'C... | true |
289cd5f1735ae26799f06dcd0571b581d17cad3d | JavaScript | PatrickNiyogitare28/React_Todo_app | /src/pages/Home.jsx | UTF-8 | 3,542 | 2.546875 | 3 | [
"MIT"
] | permissive | import React, {Component, lazy, Suspense} from 'react';
import {Link} from 'react-router-dom'
import ReactTooltip from 'react-tooltip';
import '../styles/home.css';
import imageURL from '../assets/images/home-img.svg';
// import Footer from '../components/Footer';
const Footer = lazy(() => import('../components/Footer'... | true |
9ac69fded281d5fc3513e3129bd945435ba7aed4 | JavaScript | yenaingoo992/ReactNativeDemo | /SignIn_Demo/SecureView.js | UTF-8 | 844 | 2.640625 | 3 | [] | no_license | "use strict";
import React, {Component} from 'React';
import {
StyleSheet,
Text,
View
} from 'react-native';
class SecureView extends Component {
constructor(props) {
super(props);
this.state = {
username: this.props.username,
password: this.props.password
};
... | true |
9be4c84a24e7751d1c2f0dd7efff2c311383996a | JavaScript | popeyethe13th/donut_shop | /struggling_donuts.js | UTF-8 | 2,703 | 3.015625 | 3 | [] | no_license | (function() {
var StrugglingDonuts = function(store, options) {
this.minC = options.minC;
this.maxC = options.maxC;
this.avgPC = options.avgPC;
this.hOpen = 11;
this.store = store;
};
StrugglingDonuts.prototype.generateRandom = function() {
return Math.floor(Math.random()... | true |
e247a5357c74bd27cc2c1e85e2784e7cf68bac67 | JavaScript | zlsa/chrome-todo | /src/assets/scripts/todo.js | UTF-8 | 1,173 | 3.109375 | 3 | [
"CC0-1.0"
] | permissive |
var TodoItem=function(name) {
this.id=-1;
this.name="";
this.completed=false;
this.save=function() {
return {
id:this.id,
name:this.name,
completed:this.completed
};
};
this.restore=function(data) {
this.id=data.id;
this.name=data.name;
this.completed=data.complete... | true |
26674f4bacf47aabfbd02225b178bb41440e4a5d | JavaScript | Avantjurist/RollingScopeClone | /Avantjurist-front-end-course/custom-jquery/custom-jquery-tests/index.js | UTF-8 | 4,021 | 2.90625 | 3 | [] | no_license | window.$ = (function() {
var JQueryObj = function(selector) {
this.arr = document.querySelectorAll(selector);
Object.defineProperty(this, 'length', {
get: function() {
return this.length;
}
})
}
function $(selector) {
var obj = new JQu... | true |
828e0d8cc6ea1e911c3247bdcbdc26b1aa643b7f | JavaScript | CaiIsProgrammer/Sprint-Challenge-React-Wars | /starwars/src/components/StarWarsCharacters.js | UTF-8 | 842 | 2.546875 | 3 | [] | no_license | import React, { Component } from "react";
import "./StarWars.css";
import axios from "axios";
import CharacterList from "./ListCharacters";
export default class StarWarsChars extends Component {
state = {
currentPage: "",
starwarsCharsList: []
};
componentDidUpdate = () => {
if (this.state.currentPag... | true |
a858a055f535348af9a3f0f6699aff31613ae30e | JavaScript | NascHQ/replace-terms-in-files | /index.js | UTF-8 | 3,911 | 2.578125 | 3 | [
"MIT"
] | permissive | const path = require('path');
const fs = require('fs-extra');
const glob = require('glob');
async function replaceTermsInFiles (opts) {
return new Promise(async (resolve, reject) => {
if (opts.extensions) {
// ensuring it is an array, just in case we received a simple string
opts.e... | true |
987a7bfe6e63f928d791960f9927cef7f492f4e5 | JavaScript | Raremaa/react-demo | /src/Xiaojiejie.js | UTF-8 | 2,508 | 2.53125 | 3 | [] | no_license | import React, { Component, Fragment } from 'react'
import XiaojiejieItem from './XiaojiejieItem';
import axios from 'axios'
class Xiaojiejie extends Component {
constructor(props) {
super(props)
this.state = {
inputValue: 'TWT',
list: ['一个优秀的java程序员', '不可能不会前端']
}
... | true |
b0bcfab50a8935475668fc030e66a6557306b970 | JavaScript | JasmineEllaine/eng1003 | /1-assignment/skeleton/barcode final ver 2.js | UTF-8 | 5,755 | 3.40625 | 3 | [] | no_license | //Feature 1-2
let parityReference = ["LLLLLL","LLGLGG", "LLGGLG", "LLGGGL", "LGLLGG", "LGGLLG", "LGGGLL", "LGLGLG", "LGLGGL", "LGGLGL"];
function checkGuards(barcode)
{
leftGuard = barcode.slice(0,3);
rightGuard = barcode.slice(92,95);
middleGuard = barcode.slice(45,50);
if (leftGuard != "101")
... | true |
12598ff148cf2bc91f41a9b12379ee2ad7ff7c62 | JavaScript | gitkuba/coding_challanges | /coding_interview_bootcamp/sorting/index.js | UTF-8 | 1,263 | 3.6875 | 4 | [] | no_license | // --- Directions
// Implement bubbleSort, selectionSort, and mergeSort
function bubbleSort(arr) {
for (let i = 0; i < arr.length; i++) {
for (let j = 0; j < arr.length - i; j++) {
if (arr[j] > arr[j + 1]) {
let tmp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = tmp;
}
}
}
... | true |
4d049f4e8e3d99d91c897af242a2d6e1fef6db76 | JavaScript | JunhoS/playground | /nodejs/loginModule/sampleloginModule.js | UTF-8 | 3,797 | 2.703125 | 3 | [] | no_license | /**
* user.js
*/
'use strict';
var express = require('express');
var passport = require('passport');
var auth = require('./auth');
// 패스포트 세팅
require('./passport').setup();
var router = express.Router();
// 로그인 라우팅 POST /login
router.post('/', function(req, res, next) {
// 패스포트 모듈로 인증 시도
passport.authenticat... | true |
a76487d66808956dac106a74ab83cd03a79e0d5d | JavaScript | marianac94/lessons_oct | /10-11-mongoose-lab/company-query.js | UTF-8 | 2,172 | 2.5625 | 3 | [] | no_license | require('./db');
const Company = require('./company');
// Creating new company (Apple)
Company.create({
name: 'Apple',
founded: 'April 1, 1976',
employees: 2,
active: false,
products: ['computers'],
name: 'Steve Jobs',
age: 21
}, (err, createdAppleCompany) => {
if(err) {
console.log(err);
} else {... | true |
e6311277c45eef2c4fb1def0dfae863a8d063e3a | JavaScript | xinleiye/LeetCode | /双周赛 2020/第 33 场双周赛/5480. 可以到达所有点的最少点数目/javascript/ac_v1.js | UTF-8 | 541 | 3.21875 | 3 | [
"Apache-2.0"
] | permissive | /**
* @param {number} n
* @param {number[][]} edges
* @return {number[]}
*/
var findSmallestSetOfVertices = function(n, edges) {
let res = [];
let fromSet = new Set();
let toSet = new Set();
edges.forEach(edge => {
if (!toSet.has(edge[0])) {
fromSet.add(edge[0]);
} else ... | true |
124dcb14e29fe8876b682ef64110653fcf17338b | JavaScript | GOD-FUKUOKA/meta_trader | /app/assets/javascripts/symbols.js | UTF-8 | 533 | 2.703125 | 3 | [] | no_license | function fetchSymbol(pos){
$.ajax({
url: '/fetch_symbol',
data: { pos: pos },
dataType: 'script'
}).success(function(data, status, xhr) {
});
}
function initSymbolEvents(){
$(".symbol-row").click(function(){
var pos = $(this).data().pos;
fetchSymbol(pos);
});
$("#new-symbol-link").clic... | true |
2dab002ba97f6a96a12a81f30c733ab8231764ae | JavaScript | Marko1212/bit_pp | /Week6_Day5_JS/MVCAdvanced/js/MVC.js | UTF-8 | 5,723 | 3.359375 | 3 | [] | no_license | 'use strict';
Array.prototype.last = function (){
return this[this.length - 1];
}
var dataModule = (function () {
function Genre(name) {
this.name = name;
}
Genre.prototype.getData = function(){
return (this.name[0] + this.name[this.name.length - 1]).toUpperCase();
}
var ge... | true |
ab86f932901f3df6891ae274fe9f54e49b33f980 | JavaScript | Harshitgoyal1402/AIChE_IITR | /src/components/Contact_us_modal/Contact_us_modal.jsx | UTF-8 | 5,062 | 2.5625 | 3 | [] | no_license | import React from "react";
import './Contact_us.css';
import emailjs from 'emailjs-com';
var receivingEmail = "aiche.iitr@gmail.com";
var user_id =process.env.REACT_APP_USER_ID;
var template_id =process.env.REACT_APP_TEMPLATE_ID;
var service_id = process.env.REACT_APP_SERVICE_ID;
emailjs.init(user_id);
var $ ... | true |
9394cf8b5e2e81c01af02d8c17aee502cf925e2c | JavaScript | ExiaEmbeddedProject/Tracker | /drop.js | UTF-8 | 681 | 2.546875 | 3 | [
"MIT"
] | permissive | 'use strict'
const electron = require('electron');
const holder = document.getElementById(TrackerGoogleMap.defaultMapName());
holder.ondragover = (e) => {
e.preventDefault();
holder.className = "trans";
return false;
};
holder.ondragleave = holder.ondragend = (e) => {
e.preventDefault();
holder.class... | true |
c56006669e37e162d58d5120ff40764105d57bff | JavaScript | shashank10456/codeasylums_final_project | /components/submission.js | UTF-8 | 2,149 | 2.53125 | 3 | [] | no_license | import React, {Component} from 'react';
const getSubmission = (submissionId) => {
fetch("http://5f143cd2.problems.sphere-engine.com/api/v3/submissions/"+submissionId+"?access_token=358102489eab046820e65ce57ec00ee1")
.then(response => response.text())
.then(contents => {
console.log(co... | true |
073dca9a345bedb01f0e348c5f9265e0ef158294 | JavaScript | Hisham2150/software-product-sprint | /portfolio/src/main/webapp/script.js | UTF-8 | 3,438 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | // Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... | true |
c6b4a06a41eccb1111d1b00bea50b9ce44d97af7 | JavaScript | drashti93/HTML-CSS-Node-Bootstrap | /Color Toggle/ColorToggle.js | UTF-8 | 151 | 2.53125 | 3 | [] | no_license | var cl = document.querySelector("button");
cl.addEventListener('click', function(){
document.querySelector("body").style.background = "#9400D3";
})
| true |
b564c45b74b76d1ab450561bf177705378212709 | JavaScript | baros-code/VirtualQueue | /src/Client/CreateReservation.js | UTF-8 | 9,929 | 2.59375 | 3 | [] | no_license | import React, { useState,useEffect, useContext } from 'react';
import { StyleSheet, View,Text, TextInput,Button} from 'react-native';
import { firebase } from '../firebase/config'
import { AuthContext } from '../Authentication/AuthContext';
import ScrollPickerComponent from "../ExternalComponents/ScrollPickerComponent"... | true |
eb5661db13471f1ef11b60fcd9d30bf695187b73 | JavaScript | dmax66/BoardGameEngine | /armies.js | UTF-8 | 8,721 | 2.8125 | 3 | [] | no_license | class COP
{
constructor (playerId, army, json_data)
{
this.id = "COP:" + army.armyId;
this.playerId = playerId;
this.army = army;
this.name = "Center of Ops";
this.x = 1 * json_data.COP_x;
this.y = 1 * json_data.COP_... | true |
170aebb4dab8643409bedb9b1457f178a9a93313 | JavaScript | Richyden/javascript-exercises | /04-dates/05-get-spooky-fridays/script.js | UTF-8 | 1,311 | 3.421875 | 3 | [] | no_license | (function() {
// your code here
document.getElementById("run").addEventListener("click", function() {
var day, month, x, fiday;
var tabMonth = new Array();
var tab = [
"January",
"February",
"March",
"April",
"May",
... | true |
994e248b7bbc74d92e253680110dd25092d24a73 | JavaScript | Jason171096/Task | /src/components/TaskRow.js | UTF-8 | 458 | 2.625 | 3 | [] | no_license | import React from "react"
export const TaskRow = (props) => {
return (
<tr key={props.task.name}>{/* key is equal */}
<td>
{props.task.name}{/* Name of the task */}
</td>
<td>
<input
type="checkbox"
checked={props.task.done} //Receive true or false
... | true |
3c58aed391c06b8d31f551f3bec287ab647cdd79 | JavaScript | ibtehalFahd/Firebase-Mongodb-Websit- | /models/auth.model.js | UTF-8 | 2,627 | 2.53125 | 3 | [] | no_license | const mongoose=require('mongoose')
const bcript=require('bcrypt')
const db_url='mongodb://localhost:27017/mashtal'
const userSchema=mongoose.Schema({
name:String,
email:String,
password:String,
isAdmin:Boolean
})
const userModel=mongoose.model('user',userSchema)
exports.createUser=(n,e,p)=>{
... | true |
23acd5c47e45766c64bdd7700d26b4f35ed86fc5 | JavaScript | danieljbruce/basic-graph-game-for-now | /bodyscript.js | UTF-8 | 1,574 | 2.75 | 3 | [
"BSD-3-Clause"
] | permissive |
var generateLevel = function(level){
var cycle = new UndirectedGraph();
var ugK5 = new UndirectedGraph();
var max3 = new UndirectedGraph();
var lclNumberOfNodes = level;
for (var i = 0; i < lclNumberOfNodes; i++){
//cycle.addNode({A: 1, B: i});
//ugKlclNumberOfNodes.addNode({A: 1, B: i});... | true |
174e1788b6ae523a4987a37dd88c7f233628fb50 | JavaScript | vinicius-je/jquery-studies | /aula05-children/script.js | UTF-8 | 204 | 3.078125 | 3 | [
"MIT"
] | permissive |
let lista1 = $("#lista1");
// Vai além dos elememtos filhos (vários níveis)
lista1.find(".item2").fadeOut(2000);
// Apenas elemtos filhos(apenas um nível)
lista1.children(".item2").fadeIn(4000);
| true |
474ca3e2a3fd1b94b96f36321d209808754b4207 | JavaScript | future4code/molina-pokedex8 | /src/screens/Detalhe.js | UTF-8 | 2,221 | 2.734375 | 3 | [] | no_license | import axios from "axios";
import React, { useEffect, useState } from "react";
import { useParams} from "react-router-dom";
import styled from "styled-components";
const Container = styled.div`
margin-left: 200px;
border: 60px solid red;
background-color: black;
color: red;
display: flex;
flex-direction... | true |
bf1cf018a219c78afa6a77a9d7b2cc579f7ab428 | JavaScript | redDragonLH/ldle | /leetcode/algorithm/2055-plates-between-candles.js | UTF-8 | 2,859 | 3.703125 | 4 | [] | no_license | /**
* 2055. 蜡烛之间的盘子
*
* 给你一个长桌子,桌子上盘子和蜡烛排成一列。给你一个下标从 0 开始的字符串 s ,它只包含字符 '*' 和 '|' ,其中 '*' 表示一个 盘子 ,'|' 表示一支 蜡烛 。
*
* 同时给你一个下标从 0 开始的二维整数数组 queries ,其中 queries[i] = [lefti, righti] 表示 子字符串 s[lefti...righti] (包含左右端点的字符)。
* 对于每个查询,你需要找到 子字符串中 在 两支蜡烛之间 的盘子的 数目 。如果一个盘子在 子字符串中 左边和右边 都 至少有一支蜡烛,那么这个盘子满足在 两支蜡烛之间 。
*
... | true |
de690d8fea42c37e95fd7c41541c7a1fecb16e8b | JavaScript | OskarZeta/Moviesearcher | /src/Redux/reducers/favorites.js | UTF-8 | 532 | 2.515625 | 3 | [] | no_license | import {ADD_FAVORITE, REMOVE_FAVORITE, LOAD_FAVORIES} from '../actions/change_favorites';
export function favorites(state = [], action) {
switch (action.type) {
case ADD_FAVORITE: {
return state.concat(action.movie);
}
case REMOVE_FAVORITE: {
return state.filter(fave =>
fave.id !== ac... | true |
742715a8ac71943c1b2a92db4d1ce5cc83105e68 | JavaScript | pointgaming/point-gaming-rails | /app/assets/javascripts/global/chatbox.js | UTF-8 | 4,856 | 2.53125 | 3 | [] | no_license | var PointGaming = PointGaming || {};
PointGaming.chatbox = function(options, socket){
this.message_window_selector = options.message_window_selector;
this.exchange_name = options.chat_room || 'general';
this.socket = socket;
this.registerHandlers();
};
PointGaming.chatbox.prototype.appendMessage = function(... | true |
cde3853660233d12546288b8c9dfea8796de6043 | JavaScript | Manou-Codeur/my-Algorithms__Data-strucutre | /Data-Structure/double-linkedList.js | UTF-8 | 1,705 | 3.84375 | 4 | [] | no_license | //double liked list are same as singly linked list, the defference is only that dll has two pointers
//rather than one for the sigly linked list
class Node2 {
constructor(val) {
this.val = val;
this.next = null;
this.prev = null;
}
}
class DoubleLinkedList {
constructor() {
this.tail = null;
... | true |
a2f31d93c3b1b62f4565d9738ba7770510d3ec68 | JavaScript | ahodyna/epam-frontend-programm-stage-1 | /FL16_HW8/homework/app.js | UTF-8 | 1,549 | 3.734375 | 4 | [] | no_license | function reverseNumber(num) {
const ten = 10;
const zero = 0;
let number, result = 0
while (num) {
number = num % ten
result = result * ten + number
num = num / ten | zero
}
return result
}
function forEach(arr, func) {
for (let i = 0; i < arr.length; i++) {
... | true |
71201cb5d8818b079ebfb7d53291738b91565609 | JavaScript | anthonyrivas/ideal-system | /assets/js/script.js | UTF-8 | 1,492 | 3.640625 | 4 | [
"MIT"
] | permissive | var todosContainer = document.querySelector('#todos');
var input = document.querySelector('#newTodo');
var todos = [];
function addNewItem(event) {
event.preventDefault();
var newItem = input.value;
todos.push(newItem);
storeListInLocalStorage();
input.value = '';
renderListToScreen();
}
function deleteIt... | true |
43dd65c508cb30d3e701199516bc1e8a014c1071 | JavaScript | Siirusho/CRUD | /service.js | UTF-8 | 542 | 2.65625 | 3 | [] | no_license | class service{
readUsers = arr => {
return `USERS:
${ arr.length === 0 ? "" : arr.map(val => JSON.stringify(val)) }`;
}
addUser=(user ,arr)=> arr.push(user);
updateUser=(id, updatedInfo, arr)=> {
arr.forEach(element => {
if(id == element.id) arr.splice(id-1, 1, upd... | true |