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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
dd578f9c058e66cda393b32e8e06209eea5216ac | JavaScript | kyleaedwards/oio | /utils/finish-last-event.js | UTF-8 | 1,493 | 2.75 | 3 | [] | no_license | /**
* Imports
*/
const fs = require('fs');
const sanitizeFile = require('./sanitize-file');
const { TIME_FILE } = require('../constants');
/**
* Constants
*/
const LB = '\n';
function finishLastEvent(cb) {
const readable = fs.createReadStream(TIME_FILE, 'utf8');
let prevLine = '';
let line = '';
let newLi... | true |
39a324bcc3bb86a0dd34151935cddf2d0b74ceff | JavaScript | sites-reviews/webextension | /tests/Badge/BadgeSetText.test.js | UTF-8 | 1,352 | 2.609375 | 3 | [
"CC0-1.0"
] | permissive | const badge = require('../../source/badge');
describe('test setText', () => {
it('set empty data', async () => {
browser.browserAction.setBadgeText = jest.fn().mockImplementation(() => Promise.resolve());
browser.browserAction.setBadgeBackgroundColor = jest.fn().mockImplementation(() => Promise.resolve());
b... | true |
7bd3edbe14a7d9ed02a77270b7e4c2a51a522de0 | JavaScript | iisaint/getANSer | /server.js | UTF-8 | 841 | 2.515625 | 3 | [] | no_license | var express = require('express');
var RateLimit = require('express-rate-limit');
var morgan = require('morgan');
// Create our app
var app = express();
const PORT = process.env.PORT || 3000;
// app.use(function(req, res, next) {
// if (req.headers['x-forwarded-proto'] === 'http') {
// next();
// } els... | true |
96f226eae26cf0b3dfc227cb98cd9a5e323748e4 | JavaScript | gustavohc07/etch-a-sketch | /main.js | UTF-8 | 6,534 | 2.796875 | 3 | [] | no_license | const grid = document.querySelector('.grid');
const reset = document.querySelector(".resetBtn");
const colorBtn = document.querySelector('.colorBtn');
const monoBtn = document.querySelector(".monoBtn");
const partyBtn = document.querySelector(".partyBtn");
const shadeBtn = document.querySelector('.shadeBtn');
const hov... | true |
3e60a1249991e0f6ba91462074f6fe1bb9aaf543 | JavaScript | rapid-eth/rapid-adventures | /packages/3box-ui-state/src/selectors/useGetProfileSelector.js | UTF-8 | 1,143 | 2.59375 | 3 | [
"MIT"
] | permissive | /**
* @function useGetProfile
* @description Get Profile
* @param {Object} state
* @param {Object} dispatch
*/
/* --- Global --- */
import { useState, useEffect } from 'react';
/* --- Component --- */
export const useGetProfile = (state, addressPassed) => {
const [address] = useState(addressPassed);
const [dis... | true |
c7dddc87d5eb7d04ae4dcbb51db9bb07fd33d615 | JavaScript | SLathropDP/lob-rulesengine | /src/rule.js | UTF-8 | 744 | 2.671875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /* @flow */
export class BusinessRule {
ruleObject: any;
constructor() {
this.ruleObject = {};
}
loadJson(definition: string): void {
this.ruleObject = JSON.parse(definition);
if (!this.validateRule()) {
throw new Error('Rule definition is invalid. Please check with the documentation.');
... | true |
281ae4579ca0e2c25c8e2aad1ddd5a813b5f16e0 | JavaScript | chongqiangchen/Blog | /Other/2019.2/2-25.js | UTF-8 | 1,530 | 4.125 | 4 | [] | no_license | //二分查找,非递归
function binary1(arr, find) {
arr = arr.sort();
var lowerBound = 0;
var upperBound = arr.length - 1;
var mid = null;
while (lowerBound <= upperBound) {
mid = parseInt((lowerBound + upperBound) / 2);
if (arr[mid] > find) {
upperBound = mid - 1;
} else if (arr[mid] < find) {
... | true |
cca5cea99e1ed2af0be0423b72ea6b7438c195dc | JavaScript | player-eric/BrownBytes | /client/src/reducers/post.js | UTF-8 | 2,710 | 2.671875 | 3 | [] | no_license | /* eslint-disable import/no-anonymous-default-export */
import {
CREATE_POST_FAILED,
CREATE_POST_SUCCESS,
DELETE_POST_FAILED,
DELETE_POST_SUCCESS,
GET_CREATED_POSTS,
GET_POSTS,
CREATE_POST_COMMENT,
SEARCH_POSTS,
} from "../actions/types";
const initialState = {
posts: [],
createdPosts: [],
fetchedPostIds: n... | true |
152e7933f2731c7d1f1bf0516e5eede86ab4b152 | JavaScript | NicholasHebert/Fall-2017 | /COMP 2406/Lecture material/10 Javascript Functions/04Bfunctions_selfie.js | UTF-8 | 1,153 | 4.3125 | 4 | [] | no_license | /* Example of javascript "selfie" function IIFE
Functions can be invoked right after declaration
IIFE: Immediate Invocation of Function Expression.
The javascript function equivalent of a "selfie".
Form is:
(function(){...}());
or
(function(){...})();
both seem to work. The extra outer brackets seem un-n... | true |
3fd81d31cb24d5eb0c81a09caacd3229c61d98e4 | JavaScript | ZhangHuafan/circleshack19 | /server/static/js/searchBar.js | UTF-8 | 1,290 | 3.15625 | 3 | [] | no_license | function initSearchBar() {
var searchBar = document.getElementById('search');
var searchTypeAlt = document.getElementById('search-type-alt');
searchTypeAlt.onclick = function() {
toggleSearchType(searchBar);
};
var searchBtn = document.getElementById('searchBtn');
searchBtn.onclick = getIncomeFromPostalCode;
}
... | true |
7bdfa47dfa6c49d69af0ad4e12ae86963089cf0f | JavaScript | jamir-hossain/Doctor-Portal-Backend | /RouteController/appointmentController.js | UTF-8 | 2,429 | 2.53125 | 3 | [] | no_license | const AppointmentData = require('../Models/bookAppointment')
// make appointment
exports.makeAppointment = async (req, res) => {
const { selectedDoctor, patientName, phone, email, gender, age, weight, appointmentStatus, appointment, prescription } = req.body
try {
const savedAppointment = new AppointmentD... | true |
9630e789949f40d613d5f3162ea91f7a05fbef0c | JavaScript | izabelkawl/e-Dzialkowiec | /server/controllers/comment-ctrl.js | UTF-8 | 2,840 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | import Comment from "../models/comment.js";
import validateCommentInput from "../validation/comment.js";
import isEmpty from "is-empty";
const createComment = async (req, res) => {
const commentData = req.body;
const { errors, isValid } = validateCommentInput(commentData);
if (!isValid) return res.status(400).jso... | true |
06c7b432a718d56d9706ba637316f331d4d5f4b5 | JavaScript | LexLeach/Project-5 | /src/App/App.js | UTF-8 | 1,830 | 2.671875 | 3 | [] | no_license | import React, { Component } from "react";
import Header from "../Header/Header.js"
import Slider from "../Slider/Slider.js"
import Content from "../Content/Content.js";
import Footer from "../Footer/Footer"
import "./style.css";
class App extends Component {
constructor(props) {
super(props)
this.state = {
... | true |
79c0782907b77ad29af79036cc2cc92b877164ab | JavaScript | Praise-dev/DataStructures-Algos | /Algorithms/hackerRank/runlength.js | UTF-8 | 391 | 3.203125 | 3 | [] | no_license | function runlengthEncoding(str){
//rrrrye
let wordCount = 1;
let regex = /^[0-9a-zA-Z]+$/
let newWord = ""
if (!str || str=== " "){
return "n/a"
}
for(let i=0; i<str.length; i++){
if (regex.test(str[i]))
if (str[i] === str[i +1]){
wordCount++;
}
else {
newWord += wordCount.toString(... | true |
d77b5243af473c88cacc7a0b920f7e210730d611 | JavaScript | yugmani/js-date-format | /date-format.js | UTF-8 | 8,270 | 4.21875 | 4 | [] | no_license | // ***************************
// Everything You Need to Know About Date in JavaScript
// ******************************
// ******* TIMEZONES *********
// 1. Refers to the timezone your computer is in.
// 2. UTC is synonymous with Greenwich Mean Time(GMT) in practice
// By default, almost every date method ... | true |
a6abc5ff4400d82f06b70ff1af065e074dd24385 | JavaScript | timkurvers/advent-of-code | /js/src/2019/22/index.js | UTF-8 | 2,274 | 3.125 | 3 | [
"MIT"
] | permissive | /* eslint-disable no-param-reassign */
import {
mod, modPow, range, solution,
} from '../../utils';
import { cut, dealIntoNewStack, dealWithIncrement } from './techniques';
const parse = (input, cast = Number) => input.trim().split('\n').map((line) => {
if (line.includes('increment')) {
const increment = +li... | true |
5dada2e17c22a46e10a75c11b1dbe3fb77372eff | JavaScript | sergii-bubalo/bsa-2017-react-part-1 | /src/App.js | UTF-8 | 949 | 2.59375 | 3 | [] | no_license | import React, { Component } from 'react';
import UsersList from './components/users-list/UsersList';
import './App.css';
class App extends Component {
constructor() {
super();
this.state = {
users: [],
};
this.pushUser = this.pushUser.bind(this);
this.de... | true |
bcf3f9de0203d60b5e22ebbb1dc4d7e666652cbb | JavaScript | josealvis/MCStreamProject | /express/repos/mediaRepo.test.js | UTF-8 | 2,257 | 2.515625 | 3 | [] | no_license | const rp = require('./mediaRepo');
var fs = require('fs');
const path = require('path');
const mockConfigPath = path.join(__dirname, '../../test/express-mock/mock-config.json');
const mediaRepo = new rp(mockConfigPath);
describe('mediaRepo', function(){
describe('getMediaPaths()', () => {
test('should be... | true |
abd091b4b9751b7822fa5a3c0f0772d0b4a6382a | JavaScript | qwop/userscript | /monolith/70/129665.user.js | UTF-8 | 2,042 | 2.96875 | 3 | [] | no_license | // ==UserScript==
// @name NI Experience123
// @namespace http://nordinvasion.com
// @description Calculates the experience for you
// @include http://www.nordinvasion.com/
// @include http://nordinvasion.com/
// ==/UserScript==
var obj = document.getElementsByClassName('halfpan... | true |
46c8ad7260dfa5f5c4a7feb11a9feac090115a83 | JavaScript | samnorton/the-voice-captioner | /assets/js/script.js | UTF-8 | 1,280 | 2.9375 | 3 | [] | no_license | window.SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
const voiceRecognition = new SpeechRecognition();
voiceRecognition.interimResults = true;
let paragraph = document.createElement('p');
const caption = document.querySelector('.caption');
caption.appendChild(paragraph);
voiceRecog... | true |
84922230d232435f9591785730cf38551bd56934 | JavaScript | TamilRavi214/p5_js_codes | /purple_rain/Rain.js | UTF-8 | 620 | 3.046875 | 3 | [] | no_license | function Rain(){
this.x = random(0, width);
this.y = random(-500, -50);
this.z = random(0, 20);
this.speed = map(this.z, 0, 20, 5, 10);
this.len = map(this.z, 0, 20, 10, 20);
this.fall = function(){
this.grav = map(this.z, 0, 20, 0, 0.5);
if(this.y > height){
this.y = random(-500, -50);
... | true |
e683a8cf471a44d7149732f26430cf9053d75146 | JavaScript | nicocortes/tucumanga | /js/contacto.js | UTF-8 | 1,553 | 3.296875 | 3 | [] | no_license | let visitantes = JSON.parse(localStorage.getItem('visitantes')) || [];
let nombre = document.querySelector('#contact-nombre');
let telefono = document.querySelector('#contact-telefono');
let email = document.querySelector('#contact-email');
let asunto = document.querySelector('#contact-asunto');
let mensaje = document... | true |
5eb63d0216d2e5a538fec89f36dcf45741670c94 | JavaScript | krnorris65/ternary-traveler | /src/scripts/domManager.js | UTF-8 | 654 | 2.875 | 3 | [] | no_license |
export default {
buildHtml(elementType, elementId, elementText) {
let htmlElement = document.createElement(elementType);
if(elementId){
htmlElement.id = elementId;
}
if(elementText){
htmlElement.textContent = elementText
}
return htmlElement;
... | true |
82a123752fa08f38c4af2392919e1d10ad18fdb3 | JavaScript | FY0u11/react-todos | /src/App.js | UTF-8 | 1,050 | 2.515625 | 3 | [] | no_license | import { useState, useEffect } from 'react'
import Todos from './components/Todos'
import useLoad from './useLoad'
const App = () => {
const [todos, setTodos] = useState([])
const [isLoading, setIsLoading] = useState(false)
useEffect(async () => {
const todos = await useLoad('https://jsonplacehold... | true |
cd34885efa79d0f283a83cc8c2d8d6e37ecd4315 | JavaScript | PlayMyCode/jsx | /src/client/main.js | UTF-8 | 14,363 | 2.609375 | 3 | [] | no_license | "use strict";
/**
* JSX Compiler Client
*
* This is the main entry point for the standalone JSX client, for when it is
* run on the command line.
*
* This will run the jsx file, turning JavaScript + extensions into just
* JavaScript.
*/
(function() {
/*
* SETUP
*/
var PATH = require(... | true |
451aaaffe0c527ee7751cceeb8d3f11b2bb3ef97 | JavaScript | keatonBraith/no-db-example-group | /src/Components/Foods.js | UTF-8 | 965 | 2.609375 | 3 | [] | no_license | import React, {Component} from 'react'
import axios from 'axios'
import Food from './Food'
class Foods extends Component{
constructor(props){
super(props)
this.state = {
food: []
}
}
componentDidMount(){
axios.get('/api/food')
.then((response) => {
... | true |
f13c5449b3e64c4761444466c42283940299bc52 | JavaScript | austintheriot/algorithms-and-data-structures | /src/Algorithms/Trees/widthOfABinaryTree/Implementations/2021-2-18 widthOfABinaryTree (recursive).js | UTF-8 | 515 | 3.515625 | 4 | [] | no_license | /*
Give the first node of a binary tree, implement an algorithm
that returns the maximum width of the binary tree.
*/
export default function maxWidth(node, levels = []) {
if (!node) return;
node.level ??= 0;
levels[node.level] ??= 0;
levels[node.level]++;
if (node.left) {
node.left.level = node.lev... | true |
7bf0aa013204c2dd3c5e59f2a265caae0577f019 | JavaScript | vageez/partial-lenses-examples | /exercises/transducers.js | UTF-8 | 2,853 | 4.375 | 4 | [] | no_license | // Transducers
// 2 reducers cannot compose
// We need to change shapes around to make sure things work
const add = (num) => num + 1;
const isOdd = (num) => num % 2 == 1;
const sum = (total, num) => total + num;
const list = [1, 3, 4, 6, 9, 12, 13, 16, 21];
// We need to take manps and filters and do them with reduc... | true |
e57ce491a239809618d087598d0dfc6c711a97e0 | JavaScript | brennon/eim | /public/modules/core/controllers/sound-test.client.controller.js | UTF-8 | 3,531 | 2.515625 | 3 | [
"MIT"
] | permissive | 'use strict';
/**
* The `SignalTestController` coordinates with Max to run a sound test. The
* message to start the sound test is sent to Max immediately when the
* controller is loaded.
*
* @class Angular.SoundTestController
*/
angular.module('core').controller('SoundTestController', [
'$scope',
'Trial... | true |
f7f2f5cf709402e39a20ee628bc88bd08796456b | JavaScript | Ccourter11/kennels | /src/components/location/LocationList.js | UTF-8 | 2,256 | 3.1875 | 3 | [] | no_license | // import React, { useEffect, useContext } from "react"
// import { LocationCard } from "./LocationCard";
// import "./Location.css"
// // To start, you need to import the context object you created in the provider component so that the Context hook can access the objects it exposes
// import { LocationContext } from "... | true |
22d4a862b8254a57b9a6995d1b5573b38067dc2d | JavaScript | dacostaj/inventanet | /almacenes/static/personal/js/entry/entry.js | UTF-8 | 3,156 | 2.78125 | 3 | [] | no_license | $(document).ready(function(){
var total=0;
var contador=0;
var subtotal=[];
// $('#pidarticulo').change(mostrarValores);
function mostrarValores(){
var verificacion = $('#pidarticulo').val();
if(verificacion == 'ninguno'){
$('#idinputpcompra').val('');
$('#idinputcantidad').val('');
$('#idinputserial'... | true |
e2159f56de7024319c64ab538000cf1dfb53e284 | JavaScript | ielvisd/HackerRank-Practice | /JumpingClouds.js | UTF-8 | 2,932 | 4.5 | 4 | [] | no_license | // Problem
// Emma is playing a new mobile game that starts with consecutively numbered clouds. Some of the clouds are thunderheads and others are cumulus. She can jump on any cumulus cloud having a number that is equal to the number of the current cloud plus 1 or 2. She must avoid the thunderheads. Determine the minim... | true |
5ad20066a5cb2e3d6d6bfadb05350b29da728cea | JavaScript | xuesong123/code-generator | /webapp/resource/js/util.js | GB18030 | 15,771 | 2.96875 | 3 | [
"MIT"
] | permissive | /**
* Copyright (C) 2003-2008 xuesong.net
* http://www.j2x.org
* Author: xuesong.net
*
**/
var Util = {version: "1.0.0.0"};
Util.trim = function(s){
return (s != null ? new String(s).replace(/(^\s*)|(\s*$)/g, "") : "");
};
/**
* @param source
* @param length
* @param pad
* @return String
*/
Util.padding... | true |
f9f328ec0aecf38a51f68348994bc79f798ca568 | JavaScript | yj0930/helloajax | /helloServer.js | UTF-8 | 1,448 | 3.078125 | 3 | [] | no_license | // say HELLO to GET / POST request with parameter: "name"
var http = require("http");
var qs = require("querystring");
var url = require("url");
http.createServer(function(request, response) {
var requestMethod = request.method;
var name;
console.info("request.method: " + requestMethod);
if (requestMethod === "... | true |
59fc542342a14b22319e5204678b7d2f6fe67431 | JavaScript | delapsley/brim | /src/js/state/Spaces/reducer.js | UTF-8 | 1,367 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive | /* @flow */
import type {SpacesAction, SpacesState} from "./types"
import produce from "immer"
const init: SpacesState = {}
const spacesReducer = produce((draft, action: SpacesAction) => {
switch (action.type) {
case "SPACES_NAMES":
return action.names.reduce((next, name) => {
next[name] = draft[... | true |
2fca134b37091bac9584e67886eec2984a2e4e63 | JavaScript | JhonatanOropeza/33-english-words-BACKEND | /src/controllers/words_controllers/other_actions.js | UTF-8 | 3,955 | 2.703125 | 3 | [] | no_license | const other_Ctrl = {};
const otherSchema = require('../../models/different_words/other_model');
//1.- Adding other word
other_Ctrl.postOtherWord = async (req, res) => {
//1.- Getting the dates of the user
const { word, track, meaning, type } = req.body;
const user = req.user._id;
//2.- Storing the date... | true |
8f9666c152ea0614aa358a4833296ddc90e68a02 | JavaScript | Tanmay53/cohort_3 | /submissions/sm_110_mihir/week_9/day_1/src/components/login/Form.js | UTF-8 | 1,579 | 2.578125 | 3 | [] | no_license | import React, { Component } from "react";
export class Form extends Component {
constructor(props) {
super(props);
this.state = {
username: "",
password: ""
};
}
handleChange = e => {
this.setState({
[e.target.name]: e.target.value
... | true |
e4ec4553a5bc95b17a296e48951b37f9791ade49 | JavaScript | magnuspaal/veebileht | /app.js | UTF-8 | 1,925 | 2.96875 | 3 | [] | no_license | const hinnad = {
'Viru Valge 0.5L': [10.49, 6.12],
'Caribba Negro 0.5L': [10.99, 6.65],
'Sierra Silver tekiila 1L': [20, 11.5],
'Beefeater London Dry 1L': [29.9, 17.99],
}
const pildid = {
'Viru Valge 0.5L': '/alkod/viruvalge.png',
'Caribba Negro 0.5L': '/alkod/caribba.png',
'Sierra Silver tekiila 1L': ... | true |
5c2679158f95b69f133674af29a86efff08e507a | JavaScript | brandones/CheckYourself | /data/prefs/prefspage.js | UTF-8 | 3,861 | 3.015625 | 3 | [] | no_license | "use strict";
// TODO: make page close on save
var tableNode = document.getElementById( "urltable" );
var rows = [];
self.port.on( "existingPrefs", function( prefs ) {
var sites = prefs.sites;
var allowPass = prefs.allowPass;
console.log( "received existing: " + JSON.stringify( sites, undefined, 2 ));
... | true |
cbe86c12cdc2d8db97b4a5fa2c295293cffb0912 | JavaScript | Varbanov/TelerikAcademy | /JavaScript Fundamentals/10. Strings/10. Strings/hw js strings/scripts/10-extract-palindromes.js | UTF-8 | 794 | 4.25 | 4 | [] | no_license | var text = "elena abba ivan exe? bulgaria lamal ";
function extractPalindromes(input) {
var regex = new RegExp("\\b\\w+?\\b", "g");
var word;
var res = [];
//extract words one by one using regex
while (word = regex.exec(input)) {
word = word.toString();
var reversed = "";
... | true |
267d4fc1f6bd790751c5eee3bee82a16ba5b1983 | JavaScript | zgirtsova/JS-Core---092018 | /JavaScript Fundamentals/10. STRINGS AND REGEX/lab/p11_expressionSplit.js | UTF-8 | 181 | 3.40625 | 3 | [] | no_license | function splitter(input) {
let regex = /[().,; ]/g;
input.split(regex).filter(e => e.trim() !== '').forEach(e => console.log(e));
}
splitter('let sum = 4 * 4,b = "wow";'); | true |
19b105694b3e904841059e9fc64341115236d573 | JavaScript | mikeingber/jamcala | /src/server/index.js | UTF-8 | 8,071 | 2.609375 | 3 | [] | no_license | const express = require('express')
const path = require('path')
const createInitialState = require('./state')
const expressWs = require('@small-tech/express-ws')(express())
const dictionary = require('./dictionary')
const letterScores = require('./letters')
const app = expressWs.app
// healthcheck
app.get('/up', func... | true |
686d76941b713df0a3c6e93b0cf14ae84b79546b | JavaScript | Client-Z/node_internship | /hw2/04-async.js | UTF-8 | 1,476 | 3.140625 | 3 | [] | no_license | const {usersList, rolesList} = require("./04-data");
const dataBaseAsync = {
verifyUser: async (username, password) => {
const result = usersList.filter(obj => obj.username === username);
if(result.length && result[0].password === password) return { username, password };
throw new Error(`User ${username} wasn... | true |
75eeb41b2111f6961f6aa9930cfe72cfc9f77c02 | JavaScript | HadeelAlshaer94/frontend-city-explor | /src/components/FormS.js | UTF-8 | 3,896 | 2.53125 | 3 | [] | no_license | import axios from 'axios'
import React, { Component } from 'react'
import { Form, Button } from 'react-bootstrap'
import Error from './Error'
import Location from './Location'
import Movies from './Movies'
import Weather from './Weather'
export default class FormS extends Component {
constructor(props) {
s... | true |
16bcb4a2da1f50dd04f35a0ceeac6a4bd2ced901 | JavaScript | hippiestlips/100-projects-in-100-days | /6. 1.4 million dollar app/1.4 million dollar app.js | UTF-8 | 254 | 3.203125 | 3 | [] | no_license | function rotateImage() {
var img = document.getElementById('left');
let degrees = ['0', '180'];
let chance = degrees[Math.floor(Math.random()*degrees.length)];
img.style.transform = "rotate(" + chance + "deg)";
console.log(chance);
}
| true |
13b0db911f0775d3ec7909e6538d3d1c3baf0c47 | JavaScript | jrs112/BrewInventory | /controllers/routes/recipeRoutes.js | UTF-8 | 1,075 | 2.59375 | 3 | [] | no_license | var db = require("../../models");
module.exports = function(app) {
//Create Recipe
app.post("/api/recipe", function(req, res) {
db.Recipe.create(req.body).then(function(recipe) {
res.json(recipe);
});
});
//Get All Recipes
app.get("/api/recipe", function(req, res) {
db.Recipe.... | true |
3cdc24da9ef7cacfd1ba166a1eb7e80442fed749 | JavaScript | nopivnick/luna-cycle | /p5/_experiments/content-template-lit/scripts/screens.js | UTF-8 | 6,792 | 2.859375 | 3 | [] | no_license | function setupScreen0(tone) {
const snips = {
s1: {
bliss: 'Delicate and otherworldly',
blah: 'Large and clumsy',
bad: 'Grotesque and shabby'
},
s2: {
bliss: 'palm',
blah: 'hand',
bad: 'fist'
},
s3: {
bliss: 'flaunt',
blah: 'park',
bad: 'foist'... | true |
81ed14779851686b7ba23589c71ca3ff0c146e71 | JavaScript | roybse3113/Pokemon-Canvas-Customizer | /map-builder.js | UTF-8 | 2,830 | 3 | 3 | [] | no_license | /* eslint-env browser */
/* globals $ */
// Default size of map (in tiles)
const DEFAULT_WIDTH = 30
const DEFAULT_HEIGHT = 15
// additional fields
let current = 'grass'
let mouseIsDown = false
/**
* @param {object} $container jQuery node to inject map into
* @param {{ width?: number, height?: number }} params
*/
... | true |
6d3e970d6c0e05d159d30bd97bc28fd40f034f3b | JavaScript | Ianadika44/DELANI | /js/script.js | UTF-8 | 2,220 | 2.75 | 3 | [
"MIT"
] | permissive | $(document).ready(function() {
$(".click1").click(function() {
$(".design").toggle();
$(".p1").toggle();
});
});
$(document).ready(function(){
$(".click2").click(function(){
$(".devpt").toggle();
$(".p2").toggle();
});
});
$(document).ready(function(){
$(".click3").cl... | true |
abdfd9b7f4665eb48fd17fb7fcd1aef5f94bbad9 | JavaScript | samilkorkmaz/CodingForKidsIntermediate | /lesson2/bounceFromBottomAndTop.js | UTF-8 | 2,990 | 3.203125 | 3 | [] | no_license | var canvas = document.getElementById("myCanvas");
var ctx = canvas.getContext("2d");
var r = 50;
var cx = 240;
var dy = 2;
var cy = r-dy;
var angleStart_rad = 0;
var angleEnd_rad = 2 * Math.PI
ctx.font = "22px Arial";
canvas.addEventListener("mousedown", handleMouseDown, false);
var isPaused = false;
document.onkeydo... | true |
b99f9695495e22f1422a3eb30b3f5c7dd9e97bc8 | JavaScript | swc-project/swc | /crates/swc_ecma_minifier/tests/terser/compress/transform/if_return/input.js | UTF-8 | 186 | 2.6875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | function f(w, x, y, z) {
if (x) return;
if (w) {
if (y) return;
} else if (z) return;
if (x == y) return true;
if (x) w();
if (y) z();
return true;
}
| true |
92cce61a505e829753198ccd6ba25eeba0836a5d | JavaScript | Serabass/Docker-Images | /sort.js | UTF-8 | 621 | 2.59375 | 3 | [] | no_license | let exec = require('child_process').execSync;
let sizeValue = require('./size-value').sizeValue;
let humanValue = require('./size-value').humanValue;
let result = exec('docker images').toString();
let rgx = /^([\w./:<>-]+)\s+([\w<>.-]+)\s+([\da-f]+)\s+(\d+\s+\w+\s+\w+)\s+([.\d]+[MGk]?B)\s*$/;
let w = result.split(/[\n... | true |
c8b258882d6204e7f597fe9897bcafc8b7bd1d74 | JavaScript | KenNaNa/javascript-jquery | /第43节课-面向对象/面向对象/面向对象/3.继承/JavaScript.js | UTF-8 | 259 | 3.859375 | 4 | [] | no_license | //构造函数
function personal(age,sex){
this.age = age;
this.sex = sex;
this.information = function() {
return this.age + " " + this.sex;
};
}
var David = new Object(); //继承
personal.call(David,20,"boy");
alert(David.information()); | true |
0c51d0a2eb7e94bf0b7471e97274726c09acc193 | JavaScript | SnehaSeenuvasavarathan/express-app | /public/index.js | UTF-8 | 885 | 2.984375 | 3 | [] | no_license | function add() {
val_1 = parseInt(document.getElementById("value1").value);
val_2 = parseInt(document.getElementById("value2").value);
console.log("Sum is", val_1+val_2)
document.getElementById("sum").innerHTML = val_1 + val_2;
}
function submit() {
id = document.getElementById("value1").value;
... | true |
f5d277be7e41cbf5f787509717c0a2c7c9c1c822 | JavaScript | Duy1205/cronjob | /services/cronjob.service.js | UTF-8 | 3,792 | 2.53125 | 3 | [] | no_license | "use strict";
const Cron = require("moleculer-cron");
const cron = require("node-cron")
const parser = require('cron-parser');
const moment = require('moment');
const CRON_MODEL= require("../models/cron");
const DbService = require("moleculer-db");
const MongooseAdapter = require("moleculer-db-... | true |
324f59fbd7d1cf4da51ee06e69451a99f13f6624 | JavaScript | CilgaIscan/Codecademy | /section-7/projects/school-catalogue.js | UTF-8 | 2,345 | 3.90625 | 4 | [] | no_license | // Create school parent class.
class School {
// Constructor for name, level and number of students.
constructor(name, level, numberOfStudents){
this._name = name;
this._level = level;
this._numberOfStudents = numberOfStudents;
}
// Getters for name, level and number of students... | true |
984f57ec825236f57e16fa456f2a064c2e19466e | JavaScript | freddydijor/SD2799-Capstone-ParksApp | /js/login.js | UTF-8 | 1,135 | 2.78125 | 3 | [] | no_license | $(document).on('ready', function() {
/**
* Data obtained from login modal
* once data is obtained, send the info to
* DB and find if the user is already registered.
* Data need it: username and password
*/
var api = new NPSApi(),
$user_email = $('#inputEmail'),
$user_password = $('#psw'),
$login = $(... | true |
57e8cec1c1ace761236b9908bfe57fd33844a0dc | JavaScript | loysagienn/charts | /src/chart/ChartScaler/Control.js | UTF-8 | 2,583 | 2.59375 | 3 | [] | no_license |
import EventEmitter from '../EventEmitter';
import {createElement, appendChild, addEvent} from '../helpers';
import css from './ChartScaler.styl';
const renderViewElems = (node) => {
const leftScaler = createElement(css.leftScaler);
const leftScalerInner = createElement(css.leftScalerInner);
const leftSca... | true |
83d9db790bd6113e6fb6fdade6c0948fbdf5b31f | JavaScript | cwabrams/Real-Life-Flowcharted | /Functions Wacky/js/script.js | UTF-8 | 1,756 | 4.125 | 4 | [] | no_license | // Charles Abrams 04-30-2013 Assignment: Functions Wacky
// Using this to calcule gallons to cups or liters based on user input. (Use ternary)
var conversionCalc = function(){ //Setting the anonymous function
var liquid = confirm("Select OK if you are working with a liquid"); //Asking the user if they are using a ... | true |
5c7dffd6c6555b17ba26c10ba3c3feee38e95cf7 | JavaScript | bvanderlaan/cassie-odm | /lib/model.js | UTF-8 | 33,141 | 2.84375 | 3 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | 'use strict';
var pluralize = require('pluralize');
var utils = require('util');
var Long = require('long');
var Query = require('./query');
var nullCallback = function () {
};
//TODO: Parse arguments needs to know about modelSchema to take advantage of 'hint' (same w/ parseSave)
//Just some fancy string manipulati... | true |
dead0a8d4d6d07c1e10504040903319c5859629e | JavaScript | jingkecn/WatchWorker | /www/JSCore/Message/MessagePort.js | UTF-8 | 1,376 | 2.640625 | 3 | [
"MIT"
] | permissive | importScripts("EventTarget.js");
importScripts("MessageEvent.js");
/**
*
*/
class MessagePort extends EventTarget {
constructor(instance) {
super();
if (this.constructor.name !== "MessagePort") { return; }
this.instance = instance || scope && scope.createMessagePort();
}
get onm... | true |
eb1a66cdbe7e0935832a5312c0317265a00e6a5f | JavaScript | difuentes/MernTask-react | /cliente/src/context/proyectos/proyectoReducer.js | UTF-8 | 1,533 | 2.578125 | 3 | [] | no_license |
import {
FORMULARIO_PROYECTO,
OBTENER_PROYECTOS,
AGREGAR_PROYECTOS,
VALIDAR_FORMULARIO,
PROYECTO_ACTUAL,
ELIMINAR_PROYECTO,
PROYECTO_ERROR
} from '../../types';
export default (state,action) =>{
switch(action.type){
case FORMULARIO_PROYECTO :
return{
... | true |
f9c2b6a86b0ba0e6ffd69949fc8a69f648aad25f | JavaScript | anuragbakshi/HSCLC | /static/clock.js | UTF-8 | 418 | 2.578125 | 3 | [] | no_license | var clock;
$(document).ready(function() {
var a = new Date();
var b = new Date("November 1, 2014 11:59:59");
var difference = (b - a) / 1000;
clock = jQuery('#clockman').FlipClock( difference, {
clockFace: 'DailyCounter'
});
// clock.start(function() {});
... | true |
8cbfc36b74c495fffeeb8224a5ec2f35458c6fff | JavaScript | TrendTo/AuthCalidad | /js/registro3.js | UTF-8 | 2,362 | 3.046875 | 3 | [] | no_license | const list_items = document.querySelectorAll('.list-item');
const lists = document.querySelectorAll('.list');
var x = document.getElementById('item').getElementsByTagName('img');
let draggedItem = null;
for (let i = 0; i < list_items.length; i++) {
const item = list_items[i];
item.addEventListener('click', functio... | true |
5722e8e4d29c5b3f923606a3c5f2abb9718b3e87 | JavaScript | jakewins/webscad | /lib/webscad/geometry.js | UTF-8 | 19,577 | 2.9375 | 3 | [
"MIT"
] | permissive | // Generated by CoffeeScript 1.4.0
/* Full disclosure:
My current knowledge level of geometry
is something like "squares are a type of rectangle".
I apologize in advance if any of the documentation
below is rediculously incorrect. This is kind of a
learning-by-doing experience.
*/
(function() {
var DEBUG, Face, G... | true |
70c1138e082d578c5b81422f8a64fd8e05361a59 | JavaScript | Waqas-Rizvi/todo | /public/app.js | UTF-8 | 1,247 | 3.03125 | 3 | [] | no_license | function todo() {
var inp = document.getElementById("inp")
var todo = {
input: inp.value
}
var key = firebase.database().ref("ToDo").push(todo).key
var data = firebase.database().ref("ToDo/" + key + "/input").once("value", function (data) {
var list = document.getElementById("wa")
... | true |
2647e371973bef27800476be9f8e7da335f3bca9 | JavaScript | yxs314159/demo-code | /javascript/flow-parrall.js | UTF-8 | 411 | 3.453125 | 3 | [
"MIT"
] | permissive | var count = 0;
for(var i=0; i<5; i++) {
longTimeOperation(i);
}
function longTimeOperation(i)
{
var delay = parseInt((Math.random() * 10000000) % 2000, 10);
console.log('the work is: ' + i )
setTimeout(function() {
console.log('the work ' + i + ' cost ' + delay + ' ms.');
++count;
if(count === 5)... | true |
e0002f444cd18477d2799594c37a10d538570bb7 | JavaScript | Auroratide/hobbes | /src/utils/fs.js | UTF-8 | 694 | 2.546875 | 3 | [
"MIT"
] | permissive | const fs = require('fs');
const path = require('path');
const mkdirp = require('mkdirp');
const writeJson = (filepath, contents) => new Promise((resolve, reject) => {
mkdirp(path.dirname(filepath), err => {
if(err) {
reject(err);
} else {
fs.writeFile(filepath, JSON.stringify(contents, null, 2), ... | true |
a510d319edd17bb4475b6ab28cb39e42110326e1 | JavaScript | apache/openoffice-org | /assets/sr-cyrl/download/msg_prop_l10n_sr-cyrl.js | UTF-8 | 28,382 | 3.078125 | 3 | [
"Apache-2.0"
] | permissive | /* This file is to maintain text information that can be used on the download webpage via JavaScript when
* including this file.
*
* Instead of hard coded text in the green box please use these variables and translate it to your favorite language.
*
* Wrong: "Download Apache OpenOffice"
* Correct: l10n.dl... | true |
93a90d970e7735b56e8685d4fc91a44251971258 | JavaScript | osaisacson/extinction-rebellion | /client_src/src/components/AddAction.js | UTF-8 | 2,429 | 2.53125 | 3 | [
"MIT"
] | permissive | import React, { Component } from "react";
import axios from "axios";
export default class AddAction extends Component {
addAction(newAction) {
axios
.request({
method: "post",
url: "https://extinction-rebellion.herokuapp.com/api/actions",
data: newAction
})
.then(respons... | true |
d89fbd2e51daf4244990ae32bc7e6cf0e2267784 | JavaScript | Timeless0911/FlowerShower | /models/class/MsgBoard.js | UTF-8 | 730 | 2.6875 | 3 | [] | no_license | var pool = require('../mysql/ConnPool');
class MsgBoard {
constructor() {
}
/**
* 用户留言功能
*
* @param {String} content 留言内容
* @param {String} contact 用户的联系方式,可以是邮箱或电话号码
* @return {int} 如果成功返回1,出错则返回0
*/
async writeMsg(content, contact) {
try {
var con... | true |
974806e1ba33b8e30070aef7b2259e9f744a5f8b | JavaScript | albplanas/Chart_graphic_bar | /app.js | UTF-8 | 2,340 | 2.828125 | 3 | [] | no_license |
var w = 800,
h = 400,
bar_size = w/275;
var tooltip = d3.select("body").append("div")
.attr("id", "tooltip")
.style("opacity", 0);
var Graphic = d3.select('.container')
.append('svg')
.attr('width', w + 120)
.attr('height', h + 60);
var requestURL = 'https://raw.githubusercontent.com/freeCodeCamp/ProjectReferenceD... | true |
0e6b608181cd279301fc098d16f559dc7717c9a0 | JavaScript | artmoroz/game_fifteen | /script.js | UTF-8 | 1,283 | 3.875 | 4 | [] | no_license | var matrix = [];
function compareRandom() { //перемешиваем массив
return Math.random() - 0.5;
}
function newGame() {
var arr = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
arr.sort(compareRandom);
console.log( arr );
for (var i = 0; i < 4; i++) {
matrix[i] = [];
matrix[i].push(arr.pop());
matrix[i].push(arr.... | true |
496937fa884797a3d4adacf2eb2ae20493391631 | JavaScript | WilsonHuallpa/CursoIngresoJS | /5-InstruccionWhile/jsIteraciones (10).js | UTF-8 | 1,705 | 3 | 3 | [] | no_license | function mostrar()
{
//declaracion de variables
var numero;
var respuesta="si";
var sumanegativo = 0;
var sumapositivo = 0;
var cantpositivo = 0;
var cantnegativo = 0;
var cantcero = 0;
var cantnumeropares = 0;
var promediodepositivo;
var promediodenegativo;
var diferencias;
do{
numero... | true |
09f62231920c8958362069f7b983b459d80d8e2e | JavaScript | goodman201/todo | /public/scripts/signup.js | UTF-8 | 1,065 | 2.53125 | 3 | [] | no_license | $('form#signUp').submit(function (e) {
e.preventDefault();
var name = $('#name').val();
var email = $('#email').val();
var password = $('#password').val();
var passwordRepeat = $('#passwordRepeat').val();
$.post('/auth/register',
{
name: name,
email: email,
... | true |
90947808285a2a5de1e077a001c53f12f7f19ff0 | JavaScript | GK230/boolean-uk-react-survey-reusable | /src/components/Form.jsx | UTF-8 | 2,199 | 2.546875 | 3 | [] | no_license | import Checkboxes from "./FetauresCheckboxes";
import RadioButtons from "./RadioButtons";
function handleChange(event) {
const chosenFeatures = []
let isChecked = event.target.value;
chosenFeatures.push(isChecked)
console.log(chosenFeatures)
}
function Form() {
return (
<form className="fo... | true |
cb713070da602b5c9e9a17a3b2a299461d5ddbdb | JavaScript | masterfabela/Estudios | /Damián/Java Damian/ProblemaFechas/fechas/fechas.js | UTF-8 | 4,306 | 4.125 | 4 | [] | no_license | // ---------------------------------------------
// Funciones de fechas
// ---------------------------------------------
// Funcion ceros()
// Completa con ceros por la izquierda un número
// 1 parámetro - número a completar
// Devuelve string con cero a la izquierda
var ceros = function(nro) { return ('0' + nro).sl... | true |
d9821a9ea767460e9b74ef72de823bdb6b2acfbf | JavaScript | swc-project/swc | /crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/ignore_class/input.js | UTF-8 | 289 | 2.609375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | global.leak = (x) =>
class dummy {
get pass() {
return x;
}
};
global.module = {};
(function () {
const SuperClass = leak("PASS");
class TheClass extends SuperClass {}
module.exports = TheClass;
})();
console.log(new module.exports().pass);
| true |
66776b31c2d8d60a35d12d76dd998b3d6c8920db | JavaScript | deftio/simpleJSLib | /simpleJSLib.js | UTF-8 | 1,697 | 3.078125 | 3 | [
"BSD-2-Clause"
] | permissive | // Uses Node, AMD or browser globals to create a module.
//begin "boiler plate"
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], factory);
} else if (typeof exports === 'object') {
if ((... | true |
3a54c060ee021b600752938b8c0f53def303cac0 | JavaScript | Rileychatwin/Bamazon | /Bamazon-Customer/bamazonCustomer.js | UTF-8 | 2,154 | 2.890625 | 3 | [] | no_license | var mysql = require("mysql");
var inquirer = require("inquirer");
var selectID;
var connection = mysql.createConnection({
host: "localhost",
port: 3306,
user: "root",
password: "",
database: "bamazon"
});
connection.connect(function (err) {
if (err) {
console.error("error connec... | true |
c230eec797294cc748ef89bab84b2f90b5edc314 | JavaScript | MocanuAndrei31/lucrare_licenta_frontend | /src/store/actions/cartActions.js | UTF-8 | 6,714 | 2.53125 | 3 | [] | no_license | import axios from 'axios';
import { fetchProducts } from './productsActions';
export const addToCart = (product) => (dispatch, getState) => {
let itemsPrice = 0;
getState().products.cartItems
? (itemsPrice = getState().products.itemsPrice)
: (itemsPrice = JSON.parse(localStorage.getItem('cartPrice')));
... | true |
403064482ce9e0f77d288ec25311222c0d2cbf28 | JavaScript | Bombware/CodeChallenge | /scripts.js | UTF-8 | 3,067 | 2.859375 | 3 | [] | no_license | // Source URL for interactions
const medicationUrl = "https://rxnav.nlm.nih.gov/REST/interaction/interaction.json?rxcui=";
// Check medications and reduce to current
document.querySelector("#medCount").innerText = medications.length;
let activeMedications = medications.filter(f => {
return f.STOP == "";
});... | true |
97747798fcfcf2c3e8ad39b311b1e4902fef7ad0 | JavaScript | bojan0624/study | /sort/insertion.js | UTF-8 | 1,015 | 3.375 | 3 | [] | no_license | const d3 = require("d3-random")
const randomUniform = d3.randomUniform
function sort (array) {
let leftArr = [array.shift()]
function insertArray (leftArr, rightArr) {
if (rightArr.length === 0) return leftArr
const len = leftArr.length
let num = rightArr.shift()
let target = 0
// 定位目标位置
... | true |
03237ff72b778d593e0de13784a741ef399157ce | JavaScript | oliversscripts/trova-archived | /static/js/sonarr.js | UTF-8 | 1,600 | 2.640625 | 3 | [] | no_license |
function sonarr_get_status(api_data) {
console.log('sonarr_getstatus called');
console.log(api_data);
var url = 'http://' + api_data.url + ':' + api_data.port + '/api/system/status?apikey=' + api_data.api_key;
console.log(url);
$.get(url, function(data){
console.log(data);
return ... | true |
fa0304515ad184dedc8ba4973259d0ce5c821546 | JavaScript | MRadesh3/Task5 | /app.js | UTF-8 | 3,052 | 3.25 | 3 | [] | no_license | var x = [],
o = [];
let player;
let clicks = 0;
let fcheck = false;
if (Math.round(Math.random()) == 1) {
player = 'x';
control_x();
} else {
player = 'O';
control_o();
}
for (let i = 0; i < 9; i++) {
x[i] = false;
o[i] = false;
}
function control_x() {
if (fcheck == false)
f... | true |
a237618a97b34d3d8c7b76607b228df1bdfd872b | JavaScript | DefMaks/my-first-project | /App.js | UTF-8 | 1,286 | 2.6875 | 3 | [] | no_license | import { StatusBar } from 'expo-status-bar';
import React, { useState } from 'react';
import { StyleSheet, Text, View, ScrollView, Image, Button } from 'react-native';
const setName = (firtstName, secondName, thirdName) => {
return firtstName + " " + secondName + " " + thirdName;
}
const Cafe = (props) => {
const... | true |
e6a63bf0487479ba0bfd5d61ba1b840fe56719f4 | JavaScript | desod-vn/new-thang.pro | /htdocs/m/slider.js | UTF-8 | 1,288 | 2.875 | 3 | [] | no_license | let clearChange;
const change = (num = 0) => {
clearChange = setInterval(() =>{
if(num >= 3) num = 0;
num++;
$('#project-img').attr('src', `${num}.png`);
$('.active-pro').attr('class', 'dot-pro');
$(`#pro-${num - 1}`).addClass('active-pro')... | true |
acda7a2542c9fe78de6e56b950b4d7fb08489740 | JavaScript | crashb/javascript-analyzer | /test/fixtures/resistor-color/338/resistor-color.js | UTF-8 | 430 | 3.125 | 3 | [
"MIT"
] | permissive | const colors = [
'Black',
'Brown',
'Red',
'Orange',
'Yellow',
'Green',
'Blue',
'Violet',
'Grey',
'White'
];
export const COLORS = colors.map(color => color.toLowerCase())
export const colorCode = findColor => {
let result;
colors.map((color, i) => {
if(color.to... | true |
374c2bccad8af5155dac65f94cb329a0fb66fdad | JavaScript | MrShurov/solveIt | /src/pages/game/gameController.js | UTF-8 | 3,431 | 2.609375 | 3 | [] | no_license | import Draggabilly from "draggabilly";
import NumberUtils from "./../utils/numberUtils.js";
import ArrayUtils from "./../utils/arrayUtils.js";
export default class GameController {
init(content, model) {
this.content = content;
this.model = model;
}
makeProperFractionDraggable(properFractionDO... | true |
07aa0735ef81a25186321d24c52ee8a0230fb8d4 | JavaScript | LeoVaris/SortingVisualizer | /algorithms/mergeSortingAlgorithms.js | UTF-8 | 1,037 | 3.28125 | 3 | [] | no_license |
async function mergeSort(array, workArray, n) {
await copyArray(array, 0, n, workArray);
await splitMerge(workArray, 0, n, array);
sorting = false;
}
async function splitMerge(workArray, begin, end, array) {
if (end - begin < 2) {
return;
}
let middle = Math.floor((end + begin) / 2)... | true |
647c6c73a31d0a209e599c000a9518176405e699 | JavaScript | ivanrod/proyectoIndustria | /app/assets/javascripts/home/index.js | UTF-8 | 2,320 | 3 | 3 | [] | no_license | 'use strict';
/* ----Meal, Vegetarian, Dessert recipes (arrays)-----
Ahora se crean los arrays con las recetas para carnivoros, vegetarianos, etc.
Se importan las recetas en formato JSON de forma síncrona (ver syncJsonDownload.js)
*/
/*
var Recipes = JSON.parse(makeCorsRequest("https://dl.dropboxusercontent.com/s/aj9f... | true |
2f6c2ff094ce945dfc3342be9b896abb28729b5b | JavaScript | greenfield-jupiter/legacy | /components/MovieInfo.jsx | UTF-8 | 2,278 | 3 | 3 | [] | no_license | import React, { Component } from 'react';
import PlotContainer from '../containers/PlotContainer';
class MovieInfo extends Component {
constructor(props) {
super(props);
this.handleDirectorsDataType = this.handleDirectorsDataType.bind(this);
this.handleWritersDataType = this.handleWritersDataType.bind(t... | true |
4f625ae01ac6f4a4129b9765843035ee839fc251 | JavaScript | educlarck/curso_igti_modulo_I | /Aulas Modulo 1/funcoes.js | UTF-8 | 559 | 4.375 | 4 | [] | no_license | function multiplicacao(p1, p2) {
console.log("function multiplicacao executada");
return p1 * p2;
}
var resultado = multiplicacao(4, 2);
console.log(resultado);
console.log(multiplicacao(10, 3));
function saudacao(nome) {
console.log("Olá " + nome + " seja bem vindo");
}
saudacao("Eduardo");
function se... | true |
28db63234574d887f2de29b43b9084ab7583919d | JavaScript | gx2g/frontendmasters | /basic-js/js/loops.js | UTF-8 | 1,066 | 5 | 5 | [] | no_license | // 3 ways to do for loop
console.log("====== basic For loop =======");
var arr = ['a', 'b', 'c','d'];
for(var i = 0; i < 4; i++){
console.log(arr[i]);
}
console.log("====================");
// Javascript's 'in' operator does not check if a value is contained in an array. It checks if the object has a property ... | true |
5ee32a9c0c828676de866a0e99e71ae2f395420d | JavaScript | Breadth-First-Search/swapd | /server/socket/index.js | UTF-8 | 1,209 | 2.640625 | 3 | [
"MIT"
] | permissive | module.exports = io => {
// const test = io.of('/test')
// test.on('connect', socket => {
// console.log(`A socket connection to the server has been made: ${socket.id} BUKU BUX`)
// })
io.on('connection', socket => {
console.log(`A socket connection to the server has been made: ${socket.id}`)
sock... | true |
ffc26fb89e00d0a944bccdd7444ed53ba9b8e0c7 | JavaScript | ppKrauss/Sfc4q | /src/GSfc4q.js | UTF-8 | 31,351 | 2.671875 | 3 | [
"CC0-1.0",
"LicenseRef-scancode-public-domain"
] | permissive | /**
* GSfc4q module.
* Source-code: https://github.com/ppkrauss/Sfc4q
* License: Apache2, http://www.apache.org/licenses/LICENSE-2.0
*/
/**
* Generalized (G) [Space-filling Curve](https://en.wikipedia.org/wiki/Space-filling_curve) (SFC) associated to a grid obtained by recursive 4-partitions of quadrilaterals.
... | true |
5af7368e04c4f1f9d42e5ed0022aee1c4dbb2d6f | JavaScript | richer8/snake | /js/snake.js | UTF-8 | 3,206 | 3.734375 | 4 | [] | no_license | // 构造函数
function Snake(m, f) {
// 蛇移动的方向 left top right bottom
this.direction = 'right';
// 蛇的节数 蛇节中的第0个div是蛇头 后面其他的都是蛇身
this.bodys = [];
// 蛇的要追加的地图
this.map = m;
// 蛇要吃的食物
this.food = f;
// 生成蛇
this.createBodys();
}
// 生成蛇
Snake.prototype.createBodys = function () {
// 增加三个新蛇头,初始化为3节
for (va... | true |
daaf8725e0d45bffa0c9e6d1e37a74c3cedc618b | JavaScript | Wafrey/JS-Core | /Arrays and Matrices - LAB/Sum-First-Last/solution.js | UTF-8 | 490 | 3.28125 | 3 | [] | no_license | function solve() {
let arr=document.getElementById('arr').value;
let arrText=JSON.parse(arr);
let result=[];
for (let i = 0; i < arrText.length; i++) {
let product=arrText[i]*arrText.length;
result.push(`${i} -> ${product}`);
}
let resultEl=document.getElementById('result');
for (let i = ... | true |
cd022e5fc8fc2bf683c2828e956d28517d692a29 | JavaScript | zonagilreath/data-structures | /sprint-two/src/doublyLinkedList.js | UTF-8 | 1,482 | 4.03125 | 4 | [] | no_license | const DoublyLinkedList = function() {
this.head = null;
this.tail = null;
this.size = 0;
}
DoublyLinkedList.prototype.addToHead = function(value){
const newNode = Node(value);
let currentHead = this.head;
this.head = newNode;
this.head.next = currentHead;
if (currentHead){
currentHead.prev = this.h... | true |
7709872964e97a2cb460ce540d0f6a3fd83e1b81 | JavaScript | ryanstout/opal_benchmarks | /benchs/js/json_parse.js | UTF-8 | 560 | 2.640625 | 3 | [] | no_license | // var JSONExample = '[ { color: "red", value: "#f00" }, { color: "green", value: "#0f0" }, { color: "blue", value: "#00f" }, { color: "cyan", value: "#0ff" }, { color: "magenta", value: "#f0f" }, { color: "yellow", value: "#ff0" }, { color: ... | true |