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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
f86c8664e2c6953c8a193b9809490aa0a7eb49b1 | JavaScript | rachmansa/dapoernenek | /src/scripts/views/templates/template-creator.js | UTF-8 | 2,819 | 2.59375 | 3 | [] | no_license | import CONFIG from '../../globals/config';
const createRestaurantDetailTemplate = (restaurant, meals, drinks) => `
<div class="movie__info">
<h2 class="movie__title">Restaurant Name : ${restaurant.name}</h2>
<h2>Rating</h2>
<p>⭐ ${restaurant.rating}</p>
<h2>Address</h2>
... | true |
b3e6a2a38c3137624e97bf44016e93255a39749a | JavaScript | tylerlaberge/ComputerGraphicsAssignments | /assignment_one/js/shaders/shader_program.js | UTF-8 | 1,705 | 3.015625 | 3 | [] | no_license | function ShaderProgram(gl, vertex_shader, fragment_shader) {
/*
* A class which represents a Shader Program to be used with webgl.
*
* @param gl: The webgl object to use with this ShaderProgram.
* @param vertex_shader: The vertex shader to be part of this ShaderProgram.
* @param fragment_sh... | true |
8c5a10ccb090098fec92c951f8736b2f7294b9ff | JavaScript | kuddleman/javascript-interview-skilledinc | /week-2/cycleiterator.js | UTF-8 | 904 | 4.78125 | 5 | [] | no_license | /* Create a function "cycleIterator" that accepts an array,
and returns a function. The returned function will accept zero arguments.
When first invoked, the returned function will return the first element of the array.
When invoked a second time, the returned function will return the second
element of the array, a... | true |
7de3a893f16913360dca24a67812d60db89a4fc0 | JavaScript | hleal18/expensify-app | /src/routers/PrivateRoute.js | UTF-8 | 1,338 | 2.578125 | 3 | [] | no_license | //Se encarga de gestionar las rutas privadas.
import React from 'react';
import { connect } from 'react-redux';
import { Route, Redirect } from 'react-router-dom';
import Header from '../components/Header';
export const PrivateRoute = ({
isAuthenticated,
component: Component,
//Señala todos los demas cam... | true |
6dd6f9c3c33a082dd02c2afa42eb14dbff7345c8 | JavaScript | pingji00/wellesley | /cost/js/video_btn.js | UTF-8 | 900 | 3.109375 | 3 | [] | no_license | var joy_video = document.getElementById('joy');
var joy_btn = document.getElementById("joy_btn");
joy_btn.addEventListener("click", toggleJoy);
function toggleJoy() {
if (joy_video.paused) {
joy_video.play();
joy_btn.innerHTML = "▌▌";
joy_btn.style.fontSize = ".6rem";
}
... | true |
f27dc95dc5041570e0faf81880b666a630d2106a | JavaScript | olegsas/nodejs | /mongoose1.js | UTF-8 | 593 | 2.5625 | 3 | [] | no_license | var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/transactions');
var User = mongoose.model('User',{
name: String,
age: Number,
surname: String
});
var user1 = new User({name: 'Vasya', age: 23, surname: 'Smith'});
user1.save(function(err){
if(err){
console.log(err);
}... | true |
c8df2bc2bf8330fdb64f100b602b42590d53e6ad | JavaScript | aleleyva10/blocksBlocksBlocks_Omega | /scripts/blocks.js | UTF-8 | 2,096 | 3.15625 | 3 | [] | no_license | $( document ).ready( function(){
console.log( 'JQ' );
// click handler for addBlockButton
$( '#addBlockButton' ).on( 'click', function(){
console.log( 'in addBlockButton on click' );
// append a block to DOM
var appendString = "<div class='blocky ";
// with a random color
var rando = Math.rand... | true |
50e1471b6be5242fcfdfdb52aaee43d7dc9ad53b | JavaScript | john-hc-hwang/rc0521-code-solutions | /string-manipulation-2/src/truncate.js | UTF-8 | 168 | 2.96875 | 3 | [] | no_license | /* exported truncate */
function truncate(length, string) {
if (string.length < length) {
return string + '...';
}
return string.slice(0, length) + '...';
}
| true |
00a512990d3af7c173d498e5ad4af9b4ea166b84 | JavaScript | lutherye/PHPlearning | /977.squares-of-a-sorted-array.js | UTF-8 | 393 | 3.359375 | 3 | [] | no_license | /*
* @lc app=leetcode id=977 lang=javascript
*
* [977] Squares of a Sorted Array
*/
/**
* @param {number[]} A
* @return {number[]}
*/
var sortedSquares = function(A) {
let answer = [];
for (let i = 0; i < A.length; i++) {
let pow = Math.pow(A[i], 2);
let x = answer.length;
answer.... | true |
1df39e04d3bef3d0554269c6a045f66f3d0a1441 | JavaScript | tigsar/sim | /src/utils.js | UTF-8 | 360 | 3.390625 | 3 | [] | no_license | export function gcd(numbers) {
return numbers.reduce((current, state) => gcdTwoNumbers(current, state));
}
export function lcm(numbers) {
return numbers.reduce((current, state) => current * state) / gcd(numbers);
}
function gcdTwoNumbers(a, b) {
while (b > 1E-10) {
let temp = b;
b = a % b;... | true |
473ebe68d44fd5101f4322893d1f4f83645be05d | JavaScript | jonom/silverstripe-image-coord | /client/javascript/ImageCoordField.js | UTF-8 | 1,814 | 2.578125 | 3 | [
"MIT"
] | permissive | (function ($) {
$.entwine('ss', function ($) {
$('.image-coord-field .grid').entwine({
onmatch: function () {
this.updateGrid();
},
getCoordField: function (axis) {
var fieldName = (axis.toUpperCase() === 'Y') ? this.data('yFieldName') : this.data('xFieldName');
var fieldSelector = "input[name... | true |
2d57a215071c8cc508cbc4d6de56d6867b6fa71a | JavaScript | sagawest/vgweather | /main.js | UTF-8 | 4,047 | 2.828125 | 3 | [
"MIT"
] | permissive | let city1 = document.getElementById("malmo");
city1.addEventListener("click", onMyButtonClick);
let city2 = document.getElementById("kiruna");
city2.addEventListener("click", onMyButtonClick);
let city3 = document.getElementById("sthlm");
city3.addEventListener("click", onMyButtonClick);
let cityy = document.getElement... | true |
8efd66b5dd2f0119f0cc7e12dbb94fe531ee780b | JavaScript | Aomi05/-Marubatsu-game | /game.js | UTF-8 | 1,521 | 3.421875 | 3 | [] | no_license | var order = 0;
var squares = [["","",""],["","",""],["","",""]];
var win = [['00','01','02'],['10','11','12'],['20','21','22'],
['00','10','20'],['01','11','21'],['02','12','22'],
['00','11','22'],['02','11','20']];
var flag = 0;
function game(input){
var cell = document.getElementById(input);... | true |
8d7d378465bcf5612563cf0e8c035a0a9ed82d40 | JavaScript | raajatk/coach | /application/controller-service-layer/services/UserService.js | UTF-8 | 2,762 | 2.59375 | 3 | [] | no_license | var BaseService = require('./BaseService');
var encrypt = require('../../../application-utilities/EncryptionUtility');
UserService = function (app) {
this.app = app;
};
UserService.prototype = new BaseService();
UserService.prototype.createUser = function (body, callback) {
var salt = uuid.v1();
var user = new d... | true |
ffd8b9b344f02999d2ef701399d2dcabda7783d7 | JavaScript | gurramsrikanth/firebase-sample-project | /app.js | UTF-8 | 3,224 | 3.125 | 3 | [] | no_license | // Firebase configuration
var firebaseConfig = {
apiKey: "", // yor API_KEY goes here
authDomain: "",// yor AUTH_DOMAIN goes here
databaseURL: "",// yor DATABASE_URL goes here
projectId: "",// yor PROJECT_ID goes here
storageBucket: "",// yor STORAGE_BUCKET goes here
messagingSenderId: "",// yor MESSAGING_... | true |
ed4c58ce6160aebd9ede8ace2977b9fec500e73c | JavaScript | frank10gm/hwNext | /store.js | UTF-8 | 3,290 | 2.515625 | 3 | [] | no_license | import { createStore, applyMiddleware } from 'redux'
import { composeWithDevTools } from 'redux-devtools-extension'
import thunkMiddleware from 'redux-thunk'
const exampleInitialState = {
lastUpdate: 0,
light: false,
count: 0,
logo: null,
changeLogo: null,
main_article: [],
articles: [],
lang: '',
wp... | true |
6a3472d03c3e87d22342cf76a1feed24e3f422dd | JavaScript | ChloeLiang/goal-tracker | /views/goal/Index.jsx | UTF-8 | 3,205 | 2.5625 | 3 | [
"MIT"
] | permissive | const React = require('react');
const Navigation = require('../layout/Navigation');
const Goal = require('./Goal');
class Index extends React.Component {
render() {
const goals = this.props.goals;
let ongoingList, upcomingList, completedList, overdueList;
if (goals) {
const ongoing = goals.filter(... | true |
dfb38888d01ed0c6717a4c40832015d353de414e | JavaScript | MarsacKg86/NOTES | /Week5/w5d5notes.js | UTF-8 | 457 | 2.765625 | 3 | [] | no_license | /*
Local Storage
-Refer
Reading and Setting Cookies
Cookies let you store user information in web pages.
Cookies are save in name-value pairs.
JavaScript can create, read, and delete cookies with the property.
*/
document.cookie
document.cookie = "username=Katharine";
// You can also add an expiry date (in UTC time)... | true |
9f0af88f8524936e69c5718dedd5d848bf6a6776 | JavaScript | bk120bk/Spongebob-Jellyfish-Game-Final-Project | /sketch.js | UTF-8 | 8,065 | 2.640625 | 3 | [] | no_license | var song;
var jelly1 = [];
var jelly2 = [];
var ct = 0;
function preload() {
song = loadSound('jellyfish_jam.mp3');
bg = loadImage('11j34o.jpg');
}
var num;
var cenX, cenY;
var counter = 10;
var Dist = 5;
var sign = 1.3;
var move = true;
var button;
var slider
var ang = 50;
var otherslider
var diaNum;
var Diame... | true |
60c2d39046b69592f0acefc0fb7bd0ea856d8aa7 | JavaScript | edina/survey-preview | /app/component/fieldSelect.js | UTF-8 | 1,067 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive | (function(window){
'use strict';
var angular = window.angular;
angular.module('component')
.component('fieldSelect',{
templateUrl: 'partials/fieldSelect.html',
controller: ['$log',function($log){
var self = this;
this.response = undefined;
this.$onInit = function(){
$log.debug('fieldSelect.$... | true |
9f0587909bed8f0f9bbe70c35e393a2f7dd268f1 | JavaScript | llli0v0/algorithms | /leetcode-solutions/tree/solution-1373/solution.js | UTF-8 | 719 | 3.421875 | 3 | [] | no_license | /**
* Definition for a binary tree node.
* function TreeNode(val) {
* this.val = val;
* this.left = this.right = null;
* }
*/
/**
* @param {TreeNode} root
* @return {number}
*/
var maxSumBST = function(root) {
let result = 0;
helper(root);
return result;
function helper(node) {
if (node ... | true |
a612cc6d25be62cc0e029e189b7ecec4452adccb | JavaScript | kubasulek2/es6-extra-stuff | /Reflect_Proxy_Api/reflect.js | UTF-8 | 2,775 | 3.8125 | 4 | [] | no_license | class Person {
constructor (name, age) {
this.name = name;
this.age = age;
}
greet() {
console.log(`Hello, i'm ${ this.name }`);
}
}
class TopObj {
constructor () {
this.age = 27;
}
}
/* Reflect.construct take 3 args constructor/class, array of arguments, and optional constructor/class to override prot... | true |
a9b72dd285f9b2fb58ee1522c0ae5821099a4908 | JavaScript | GioLopez/react | /udemy_course/rest_api/src/DetailedPost/DetailedPost.js | UTF-8 | 1,257 | 2.5625 | 3 | [] | no_license | import React from 'react';
import axios from 'axios';
import './DetailedPost.css'
class DetailedPost extends React.Component{
state = {
post: null
}
componentDidUpdate() {
if(this.props.postID){
if(!this.state.post || (this.state.post && (this.props.postID !== this.state.post... | true |
157b3d01718e5d6dea7a38f010a92d42607e9d4d | JavaScript | taboca/doc-js-redux-observable-sample-learning | /src/store/reducer.js | UTF-8 | 405 | 2.546875 | 3 | [] | no_license | import * as types from './actionTypes';
const defaultState = {
flag: 0
}
export default function reduce(state = defaultState, action = {}) {
switch (action.type) {
case types.ACTION_FLAG_1:
return Object.assign({}, state, {
flag : 1,
});
case types.ACTION_FLAG_2:
return Object.as... | true |
02ee5d3b868d7a30abf3bbaa4841e2698de3e880 | JavaScript | AnserrrR/AnserrrR.github.io | /main-page/script.js | UTF-8 | 1,819 | 2.75 | 3 | [] | no_license | let startButton = document.getElementById('start-btn')
let menuBtn = document.querySelector('.bi-list')
let menuList = document.querySelector('.menu-list')
startButton.onclick = function() {
window.scrollTo({
top: window.innerHeight,
behavior: 'smooth'
})
}
menuBtn.onclick = function() {
m... | true |
f5724bd4702f0e53a884d23d5deae260d4291ee1 | JavaScript | KamilFlak/JavaScript | /if-statement.js | UTF-8 | 190 | 2.9375 | 3 | [] | no_license | var score = 75;
var msg;
if (score>50)
{
msg = 'gratulacje ';
msg+= ' przechodzisz do kolejnej rundy';
var el = document.getElementById('answer-if')
el.textContent = msg;
} | true |
37bea2b88304ce96100b28570becd836ea387ae6 | JavaScript | nelsondio/USER-NAME-EMAIL-PASSWORD | /database.js | UTF-8 | 3,293 | 2.90625 | 3 | [
"CC0-1.0"
] | permissive | // database.js
// database.js with sql for now
const sqlite3 = require('sqlite3').verbose();
const md5 = require('md5');
let db;
const dbName = "db.sqlite3";
db = new sqlite3.Database(dbName, (err) => {
if (err) {
console.error(err.message);
}
else {
console.log('Connected to the db.sqli... | true |
a1998036d8d4be4d53fd1ed59bd95b4e46dfe458 | JavaScript | elyesmarzouki/mongoose-RESTAPI | /routes/user.js | UTF-8 | 1,652 | 2.78125 | 3 | [] | no_license | const express=require('express')
const router=express.Router()
const User =require('../models/User')
//GET : RETURN ALL USERS
router.get("/",async(req,res)=>{
try {
const users= await User.find()
res.status(200).send({msg:"all users",users})
} catch (error) {
res.status(500).send("Th... | true |
5c22fa9070ba6c49f13d59fcb7ec712f20b58af7 | JavaScript | JrLima/patente-webseite | /examples/QueryBindExample.js | UTF-8 | 616 | 2.515625 | 3 | [
"MIT"
] | permissive |
/*
* This example shows how external variables can be bound to XQuery expressions.
*/
var basex = require("../index");
var log = require("../debug");
//basex.debug_mode = true;
var session = new basex.Session("localhost", 1984, "admin", "admin");
// create query instance
var input = "declare variable $name extern... | true |
f7ce8a7e281235b483f34f4c1a9a92a99076f5aa | JavaScript | santyroy/React-Tutorials | /complete_react_course/hello-world/src/contextapi/UserContext.js | UTF-8 | 591 | 2.515625 | 3 | [] | no_license | import React from "react";
// There are 3 steps to use Context API
// 1. Create Context
// 2. Provide a Context value - provider (Provider Component is responsible to provide a value to all the descendent components)
// 3. Consume the Context value - consumer
// BELOW IS STEP 1
const UserContext = React.createContext... | true |
94e90b5d3dd2b5d2dfba92af1b32848adbb06ad9 | JavaScript | yejiang1015/utils-used | /src/cookie/setCookie.js | UTF-8 | 676 | 2.859375 | 3 | [
"MIT"
] | permissive | /**
*
* @desc 设置Cookie
* @param {String} name
* @param {String} value
* @param {Number} days:过期时间
*/
module.exports = function(name, value, expires = null, path = '/', domain = null, secure = false) {
const exp = new Date();
const time = expires * 24 * 3600 * 1000;
let expiresSelf = expires ? exp.setTime(e... | true |
deecc98add3ba3ed7caf4019893668fe57ca4025 | JavaScript | nshid/react-assessment | /eog-todo-list/src/redux/reducers/taskReducer.js | UTF-8 | 566 | 2.734375 | 3 | [] | no_license | import { ADD_TASK, DELETE_TASK, UPDATE_TASK } from "../constants/action-types";
const taskReducer = (state = [], action) => {
switch (action.type) {
case ADD_TASK:
return [...state, action.payload];
case DELETE_TASK:
return state.filter(item => item.id !== action.id);
case UPDATE_TASK:
... | true |
a50e0c74963ee4935893e20c8f7e87e937d3b10b | JavaScript | Ziyue-Xu/RandomBot4Discord | /main.js | UTF-8 | 17,231 | 2.953125 | 3 | [
"MIT"
] | permissive | const Discord = require('discord.js');
const prefix = '+';
const fetch = require('node-fetch');
const fs = require('fs');
const InventoryManager = require('./Inventory/InventoryManager')
const inventoryManager = new InventoryManager;
function checkAnswer (correctAnswer, answer, message) {
if(answer.toLower... | true |
641872b5034c3cd2b167c7ba3c09d9e7dba59bdf | JavaScript | ParameshMohan/slider | /script.js | UTF-8 | 852 | 3.078125 | 3 | [] | no_license | const nextBtn = document.querySelector('.nextBtn');
const prevBtn = document.querySelector('.prevBtn');
const container= document.querySelector('.images');
let counter =0;
nextBtn.addEventListener('click',nextSlide);
prevBtn.addEventListener('click',prevSlide);
function nextSlide(){
container.animate([{opacity:'0... | true |
c657c2182df285e2ee732b69c81da6d9cc61a5ff | JavaScript | ManassehGit/buildLibrary | /buildLibrary.js | UTF-8 | 3,119 | 3.671875 | 4 | [] | no_license | //Creating the Media parent class
class Media{
constructor(title, isCheckedOut, ratings){
this._title = title;
this._isCheckedOut = false;
this._ratings = [];
}
get title(){
return this._title;
}
get isCheckedOut(){
return this._isCheckedOut;
}
get rating(){
ret... | true |
b40d39c00b5b72609461e3a70dd5f2dad3951b9a | JavaScript | Jelly-exe/FrozenwatersBot-Old | /Old Bot/commands/purge.js | UTF-8 | 996 | 2.625 | 3 | [] | no_license | const Discord = require("discord.js");
const config = require("../config.json");
const colour = config.colour;
module.exports.run = async (client, message, args) => {
// Deletes the command when executed
message.delete();
const amount = parseInt(args[0]);
if(message.member.hasPermission("MANAGE_MESSAGES")) {
... | true |
2a84a8c6383892bb4812bea219d47f346d673431 | JavaScript | huangxinyan/- | /js/common.js | UTF-8 | 1,028 | 3 | 3 | [] | no_license | /**
* Created by Administrator on 2016/10/10.
*/
var time = document.querySelector(".time");
var timeI = document.querySelector(".timeI");
//var data = new Date();
var hour = new Date().getHours();
var minute = new Date().getMinutes();
function getTime(){
if(minute<10){
minute = "0" + minute;
... | true |
8cd8497cee7faf090406df4be9596162159c7b20 | JavaScript | kardasjan/flexera-tech-test | /www/src/js/services/api.js | UTF-8 | 1,383 | 2.671875 | 3 | [] | no_license | import { API_URL, PEOPLE_PATH } from "../constants/api"
export async function getPeople(payload) {
const url = new URL(API_URL + PEOPLE_PATH);
Object.keys(payload).forEach(key => url.searchParams.append(key, payload[key]))
const config = {
method: "GET",
headers: {
"Content-Type": "application/json... | true |
2ba6a5cba099a5f3091db5a78c0ae419165536bb | JavaScript | selfup/crowdsource | /public/application.js | UTF-8 | 2,990 | 2.65625 | 3 | [] | no_license | 'use strict'
const socket = io()
const submitsLive = document.querySelectorAll('#submits-live')
const submitsLiveFeedback = document.querySelectorAll('#submits-feedback')
const adminLiveChannel = document.getElementById('admin-live-channel')
const pollClosed = document.getElementById('closed')
const liveFeedBack = docu... | true |
9cc45bae4e4adda248239ae523e030fd68f72cf4 | JavaScript | AlexPoint/meds-backoffice | /src/connector.js | UTF-8 | 930 | 2.53125 | 3 | [] | no_license | import mongodb from 'mongodb';
import {connectionString} from '../config/connection-strings';
//We need to work with "MongoClient" interface in order to connect to a mongodb server.
var MongoClient = mongodb.MongoClient;
export function insert(table, values){
debugger;
// Use connect method to connect to the Serve... | true |
cd4da0f09f05883d2e78de60183621f43cd7bf1c | JavaScript | chelzeasalvador-ubidy/React-Starter-Kit | /src/components/06-ComponentLifecycles/SetState/index.jsx | UTF-8 | 589 | 2.703125 | 3 | [] | no_license | import React, { Component } from "react";
class SetState extends Component {
state = {
name: "Initial State"
};
handleClick = () => {
this.setState({
name: "New State !!!"
});
};
render() {
return (
<div className="test-app">
<span className="title">set state</span>
... | true |
4495982b74586ba090f9c8c52558ead29902bbed | JavaScript | PaulineRoppe/JS-exercices | /4.1.js | UTF-8 | 255 | 2.984375 | 3 | [] | no_license | const readlineSync = require("readline-sync");
let long = readlineSync.question("Donnez moi la longueur : ");
let larg = readlineSync.question("Donnez moi la largeur : ");
function calcSurface (a, b) {
return a*b;
}
console.log(calcSurface(long, larg)); | true |
ad867472d30fcef53980f7ec59c52e6f6d65bed0 | JavaScript | gisai/Oraculos-Blockchain | /Input-Output user/js/app.js | UTF-8 | 3,461 | 2.5625 | 3 | [] | no_license | //////////////////////////////////////////////////////////////////
/*************** CONNECTION WITH THE SMART CONTRACT*************/
var http = require('http');
var url = require('url');
var fs = require('fs');
var Web3 = require('web3');// Import the web3 module
if(typeof web3 !== 'undefined'){
web3 = new Web3(... | true |
af02fab5ec2966054cd57a87bd2e5bb1d14d526b | JavaScript | logicfeel/OOP | /src/OOP.js | UTF-8 | 981 | 2.8125 | 3 | [] | no_license |
/**
* ############################################################
* 최상위 클래스
*/
function Parent(pOnwerContainerAdapter) {
this.isDebug = false;
// ### 생성자 처리 위치 ###
}
(function() {
// ### 메소드 ###
}());
/**
* ############################################################
* 상속 클래스
*/
... | true |
5ec1b7f59099904359ea1b3426956f5bdf613111 | JavaScript | Ayub-Begimkulov/algorithms | /merge-sort.js | UTF-8 | 1,032 | 3.578125 | 4 | [] | no_license | function mergeSort(arr) {
if (arr.length === 1) return arr;
if (arr.length === 2) {
if (arr[0] > arr[1]) {
swap(arr);
}
return arr;
}
const center = Math.floor(arr.length / 2);
const left = mergeSort(arr.slice(0, center));
const right = mergeSort(arr.slice(center));
return orderMerge(lef... | true |
3bcb63ab25c0a8cfc4fa47ac448609f88bd77def | JavaScript | loicbdev/Pylot | /frontend-pylot/nts-js-202009-p3-frontend-pylot-dev/src/utils/formatDate.js | UTF-8 | 337 | 3.015625 | 3 | [] | no_license | export default (date) => {
const strDate = date.substring(0, 10);
const splittedDate = strDate.split('-');
const day = splittedDate[2];
const d = new Date(date);
const weekday = d.toLocaleString('fr', { weekday: 'long' });
const month = d.toLocaleString('fr', { month: 'short' });
return `${weekday} ${da... | true |
b88752b4fca7f1a60fed6623d9b9b33ba5a428cc | JavaScript | RISHU-GUPTA/MERN | /Node/file.js | UTF-8 | 504 | 2.640625 | 3 | [] | no_license | var fs=require('fs');
const path='D:/MOVIES/Hollywood/Avengers/TheIncredibleHulk.mp4';
const path2='D:/MOVIES/Hollywood/Avengers/TheIncredibleHulkcopy.mp4';
var stream=fs.createReadStream(path);
var writestream=fs.createWriteStream(path2);
stream.on('data',(chunk)=>{
writestream.write(chunk);
console.log('chunk... | true |
bc39073da7edb3dacdc61c218b84d58bc3b4aadb | JavaScript | brendansky/giphy-api | /assets/javascript/app.js | UTF-8 | 2,529 | 3.046875 | 3 | [
"MIT"
] | permissive | $(document).ready(function () {
var animalArray = ["cat", "dog", "bird", "mouse", "rabbit", "elephant", "ostrich", "otter"];
function renderButtons() {
for (var i = 0; i < animalArray.length; i++) {
var a = $("<button>");
a.addClass("animal btn btn-primary");
a.at... | true |
79f35dd50bc785048fea53e1a6378f820a31cf3d | JavaScript | jc328/CodeWars-1 | /5kyu_RGBToHexConversion.js | UTF-8 | 792 | 3.859375 | 4 | [] | no_license | // 5kyu - RGB To Hex Conversion
// Description:
// The rgb() method is incomplete. Complete the method so that passing in RGB decimal
// values will result in a hexadecimal representation being returned. The valid decimal
// values for RGB are 0 - 255. Any (r,g,b) argument values that fall out of that range
// sho... | true |
30b1137608d0316c29bc8fc7dda46386b9fd41e4 | JavaScript | geoffreymarche/django_react | /static/js/component/ajax_call_exemple.js | UTF-8 | 1,386 | 2.671875 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
import $ from 'jquery';
/* message */
const Message = ({ text, classValue }) =>
<div><p className={classValue}>{text}</p></div>
class callAjaxExemple extends React.Component {
constructor(props) {
super(props);
this.state = {
... | true |
4c9eabc1863e548002016c050c7af233da1af1f0 | JavaScript | Michael-Yimam/CS572 | /NodeDayThree/excerciseOne.js | UTF-8 | 650 | 3.09375 | 3 | [] | no_license | var {Observable} = require('rxjs');
var os = require('os');
function checkSystem(){
console.log('Checking your system...');
const obs = Observable.create(function(observer) {
if(os.totalmem()/1073741824 < 4){
observer.next("This app needs at least 4GB of RAM");
return;
... | true |
a88934335e396bbccf5667db397b69e7891d2f30 | JavaScript | TheWingedShake/fruitninja | /app/fruits/fruit.js | UTF-8 | 2,689 | 2.65625 | 3 | [] | no_license | import { options } from '../options';
import { GameObject } from './gameObject';
class Fruit extends GameObject{
constructor(){
super();
this.score = 0;
this.time = 0;
this.id = '';
}
setShape(shape){
this.shape = shape;
}
initMovement(){
const rand... | true |
df9181dd69b67a1bd171d8b75f2be99714f07606 | JavaScript | nitrogenlabs/webpack-plugin-static-site | /tests/successCases/requireEnsure/index.js | UTF-8 | 358 | 2.578125 | 3 | [
"MIT"
] | permissive | // Do not actually call this function, because executing require.ensure requires a 'document'.
const dontDoIt = () => {
require.ensure([], () => {
require('./foo');
});
};
console.log('dontDoIt', dontDoIt);
module.exports = (locals, callback) => {
setTimeout(() => {
callback(locals.template({html: `<h1>... | true |
8dd844d312e6c23efdb95845cdfeefaf88fa4ed2 | JavaScript | sejalg1019/project-28-- | /sketch.js | UTF-8 | 1,956 | 2.734375 | 3 | [] | no_license | const Engine=Matter.Engine;
const World=Matter.World;
const Bodies=Matter.Bodies;
const Constraint = Matter.Constraint;
var engine,world,ground,launcher;
var mango1, mango2, mango3, mango4, mango5;
var tree, boy, stone, boyImage;
function preload(){
boyImage = loadImage("sprites/boy.png");
}
function setup() {
... | true |
936dfe4f6bb32eba885d0b45a51eac5045bfa210 | JavaScript | fedeghe/ridof | /source/test/tags.js | UTF-8 | 4,416 | 2.671875 | 3 | [
"MIT"
] | permissive | describe('no transition config', () => {
var store = Ridof.getStore((state, action, params) => {
var newState = Object.assign({}, state);
switch(action) {
case 'INCREMENT': newState.count++; break;
case 'DECREMENT': newState.count--; break;
case 'VALIDATE': newSta... | true |
3ed892b15898734b4ac255ea2a49db81182a9ccf | JavaScript | nur4450/Launch-Checklist-Form | /script.js | UTF-8 | 4,527 | 3.46875 | 3 | [] | no_license | // Write your JavaScript code here!
/* This block of code shows how to format the HTML once you fetch some planetary JSON!
<h2>Mission Destination</h2>
<ol>
<li>Name: ${}</li>
<li>Diameter: ${}</li>
<li>Star: ${}</li>
<li>Distance from Earth: ${}</li>
<li>Number of Moons: ${}</li>
</ol>
<img src="${}">
... | true |
ee1ce854698821badd36f1373c59159d365aa7bd | JavaScript | passwd10/daily_algorithm_ps | /programmers/news-clusting/newsClusting.test.js | UTF-8 | 1,389 | 3.78125 | 4 | [] | no_license | const solution = (str1, str2) => {
let arr1 = removeSpecialChar(getTwoPair(str1.toLowerCase()));
let arr2 = removeSpecialChar(getTwoPair(str2.toLowerCase()));
let interLength = 0;
for (let i = 0; i < arr1.length; i++) {
for (let j = 0; j < arr2.length; j++) {
if (arr1[i] === arr2[j]) {
arr2[j... | true |
243fc9d1602765efe6d9db5a2f67e6b91e10e5b0 | JavaScript | decatur/appchen | /appchen/web_client/io.js | UTF-8 | 5,518 | 2.5625 | 3 | [] | no_license | /**
* Author: Wolfgang Kühn 2020
* Source located at https://github.com/decatur/appchen
*
* Module implementing support for real time streaming via Server Send Events.
*
*/
// console.log(import.meta.url)
export const readyStateLabels = [];
['CLOSED', 'CONNECTING', 'OPEN'].forEach(state => readyStateLabels[Even... | true |
c5ffbe6acec16a390a3885a3922e1fed3dbaeee5 | JavaScript | questsin/p4wn | /misc/transitional/example.js | UTF-8 | 3,941 | 3.421875 | 3 | [
"CC0-1.0",
"LicenseRef-scancode-public-domain"
] | permissive |
//extract of parse function
//Written for Andy King's book.
//The moves array is used to find the legal moves for each major (non-pawn) piece.
//The offset into the array corresponds to the first 3 bits of the piece
// eg: a knight has the number 3, so it's moves are
// [21,19,12,8,-21,-19,-12,-8]
// which are the... | true |
4cc62cfc495f5034ce0fc3c05b1242f75537025f | JavaScript | zipang/crud-players | /src/api/players/read.js | UTF-8 | 619 | 2.640625 | 3 | [
"MIT"
] | permissive | const store = require("../store")("players");
const { send } = require("micro");
const { sendError } = require("../utils");
const parseUrl = require("url").parse;
/**
* RETRIEVE A SINGLE PLAYER
*/
module.exports = async (req, resp) => {
let playerId;
try {
playerId = parseUrl(req.url)
.pathname.split("/")
... | true |
ee118183c1e32bed5349b29fa67d6b0fbf192138 | JavaScript | banksbestrates/BankFx | /assets/admin_panel/libs/userProcess.js | UTF-8 | 897 | 2.6875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | let userData = "";
function get_user_list() {
let formData = new FormData();
let url = baseUrl + "api/get_user_list";
let xhr = new XMLHttpRequest();
xhr.open('POST', url);
xhr.send(formData);
xhr.onload = function() {
if (xhr.status == 200) {
let obj = JSON.parse(xhr.respon... | true |
d4138e0ec9ebcd7e4309cb1d6c365d6bdbc15759 | JavaScript | bikkimahato/Edabit-Challenges-JavaScript | /Very Easy/return_the_sum_of_two_numbers.js | UTF-8 | 129 | 2.796875 | 3 | [] | no_license | // Return the Sum of Two Numbers
// https://edabit.com/challenge/3LpBLgNRyaHMvNb4j
function addition(a, b) {
return a + b;
} | true |
f7025468c53615f949da196c046deb9c3f2c88b3 | JavaScript | hala-hasan/react | /React-Traning/my-app/src/App.js | UTF-8 | 1,775 | 2.75 | 3 | [] | no_license | import React from 'react';
import './App.css';
import Add from './components/Utils/Buttons/AddButton/AddButton';
import TextInput from './components/Utils/TextInput/TextInput';
import Todolist from './components/Todolist/Todolist';
class App extends React.Component {
constructor(props) {
super(props);
this.s... | true |
8e8a0ef52d14ef0902539ae44891839e143f89df | JavaScript | t-matsumo/something | /app/Room/Rooms.js | UTF-8 | 1,166 | 2.65625 | 3 | [] | permissive | var ReversiLogic = require('../logic/ReversiLogic').ReversiLogic;
exports.Rooms = class {
constructor() {
this.blackQueue = [];
this.whiteQueue = [];
this.rooms = {};
}
register(id, playerColor) {
let opponent;
if (playerColor.id === 'BLACK') {
if (this.... | true |
d1e537c41894b35fe67d3adc714f8a8890a2b2f8 | JavaScript | maildejoliveira/feup-cgra | /tp3/MyTangram.js | UTF-8 | 6,776 | 2.578125 | 3 | [] | no_license | import {CGFobject, CGFappearance} from '../lib/CGF.js';
import { MyDiamond } from "./MyDiamond.js";
import { MyParallelogram } from "./MyParallelogram.js";
import { MyTriangle } from "./MyTriangle.js";
/**
* MyTangram
* @constructor
* @param scene - Reference to MyScene object
*/
export class MyTangram extends CGF... | true |
5c2867ac2804d3c0f7b4821b9ecde55537e4ca24 | JavaScript | ctreuselex/ctsystem | /public/js/getr.js | UTF-8 | 10,616 | 2.859375 | 3 | [
"MIT"
] | permissive |
// AFFINITIES
// ============================================================================================================
// ============================================================================================================
var specialAffinities = 6;
function getAffinityIcon(id) {
var icon = "";
fo... | true |
9503c9dd9bb83011a07c8d5804a3e0dc87c6954a | JavaScript | sharat94/mern_stack | /dct_mern/day5-session1-crud/list-tickets.js | UTF-8 | 800 | 2.921875 | 3 | [] | no_license | var axios = require('axios');
var url = 'http://dct-api-data.herokuapp.com/tickets';
var key = 'b770c42d94398f31';
// http://dct-api-data.herokuapp.com/tickets?api_key=b770c42d94398f31
//url - uniform resource locator
//protocol -http/https
//domain( base url) = dct-api-data.herokuapp.com
//sub domain - dctg-api-da... | true |
68cfbe082ba66f7b5f6fcbd52a916a354bd5f72b | JavaScript | MChapman180/JS101_Programming_Foundations_with_JavaScript | /small_problems/sumIntegers.js | UTF-8 | 2,513 | 4.90625 | 5 | [] | no_license | // Sum or Product of Consecutive Integers
// Write a program that asks the user to enter an integer greater than
// 0, then asks whether the user wants to determine the sum
// or the product of all numbers between 1 and the entered integer, inclusive.
// Examples:
// Please enter an integer greater than 0: 5
// En... | true |
aac029f6cdaaed368fbd43d0e3bad3e004598e4b | JavaScript | flozz/stonejs-tools | /src/extract.js | UTF-8 | 16,754 | 2.703125 | 3 | [
"BSD-3-Clause"
] | permissive | "use strict";
var fs = require("fs");
var async = require("async");
var glob = require("glob");
var espree = require("espree");
var gettextParser = require("gettext-parser");
var cheerio = require("cheerio");
var helpers = require("./helpers.js");
/**
* @class extract
* @constructor
*/
var extract = {};
/**
*... | true |
a7854a7d6538c0a383958e5096625cb25bcc5dbc | JavaScript | edgemony-coding-bootcamp/codingbootcamp-2 | /12-11-2021/data.js | UTF-8 | 244 | 2.640625 | 3 | [
"MIT"
] | permissive | const saveData = (data) => {
const str = JSON.stringify(data);
localStorage.setItem("data", str);
};
const getData = () => {
const value = localStorage.getItem("data") || "";
return JSON.parse(value);
};
export { saveData, getData };
| true |
a83e0ed8f71bf4934cc52214c1cdddd6c226a909 | JavaScript | den-abidov/landing4.gerbal-lavka.ru | /dist/assets/js/get-device-id.js | UTF-8 | 890 | 2.9375 | 3 | [] | no_license | 'use strict';
console.log('get-device-id.js : зашёл.');
function getDeviceIdFromLS() {
let deviceId = localStorage.getItem("deviceId");
if (deviceId === null) {
deviceId = generateDeviceId();
localStorage.setItem("deviceId", deviceId);
}
return deviceId;
}
function generateDeviceId() {
const site... | true |
7f1323588a499b6e853c9db9cea7dc795aaf94fd | JavaScript | XueyiGu/cs5610 | /public/experimnt/promise/app.js | UTF-8 | 1,846 | 2.890625 | 3 | [] | no_license | /**
* Created by ceres on 3/17/16.
*/
(function(){
angular
.module("WhiteBoardApp", [])
.controller("AppCtrl", function($scope, $q){
//Step One
//$scope.total = 7+2;
/*$scope.total = add(7,2);
function add(a,b){return a+b; }
*/
... | true |
c52ec855b35f846d2c300b096807635db0036331 | JavaScript | JohannaForsberg93/Berras_Boats | /src/components/Add.js | UTF-8 | 1,574 | 2.671875 | 3 | [] | no_license | import React from 'react';
import { useForm } from 'react-hook-form';
export const Add = () => {
const { register, handleSubmit } = useForm()
function addBoat(data) {
if (data.motor === "") {
data.motor = "nej";
}
console.log("Värdet av motor", data.motor)
if (data.sail === "") {
data.sail = "nej";
... | true |
2a626587a4b8375b60d75d6362e41284310df8c1 | JavaScript | hognogi/cherryplum-blog | /client/interfaces/web/app/components/contact/ContactForm.js | UTF-8 | 4,985 | 2.578125 | 3 | [
"MIT"
] | permissive | /*Bootstrap Classes*/
var Grid = ReactBootstrap.Grid;
var Row = ReactBootstrap.Row;
var Col = ReactBootstrap.Col;
var BlogActions = require('../../actions/BlogActions.js');
/*constants*/
var Actions = require('../../constants/Actions.js');
var validateSubmit = function(state){
var _errs = [];
if ( state.mess... | true |
5c58522377079895da6420ed9c70bb43aaac5bc6 | JavaScript | lindamariemummy/module-apartment-complex | /lib/apartment.js | UTF-8 | 305 | 2.515625 | 3 | [] | no_license | var unit = require('unit.js');
function ApartmentComplex() {
this.units = [];
}
ApartmentComplex.prototype.printApartmentInformation = function() {
};
ApartmentComplex.prototype.addUnit = function(number) {
};
ApartmentComplex.prototype.addInhabitant = function(number, name, species) {
}; | true |
45056ca296f1e676273de1903d069b8f472c9855 | JavaScript | SoyWachu/AirGarageCodingChallenge | /src/components/ParkingSearch.js | UTF-8 | 1,023 | 2.578125 | 3 | [] | no_license | import React from "react";
import ParkingList from "./ParkingList";
import Pagination from "./Pagination";
import SearchForm from "./SearchForm";
import { useState } from "react";
export default function ParkingSearch() {
const [data, setData] = useState([]);
const [currentPage, setCurrentPage] = useState(1);
co... | true |
69dd40e367c38fbe5f652ead907ae523738df44d | JavaScript | peterphan20/frontend-rock-paper-scissors | /src/helper/scoring.js | UTF-8 | 671 | 2.859375 | 3 | [
"MIT"
] | permissive | export const userWins = (userChoice, computerChoice) => {
return (
(userChoice === "paper" && (computerChoice === "rock" || computerChoice === "spock")) ||
(userChoice === "scissors" && (computerChoice === "paper" || computerChoice === "lizard")) ||
(userChoice === "rock" && (computerChoice === "scissors" || com... | true |
9a61dc8b3e9911d2468f91ffe7af187199ded038 | JavaScript | kovrichard/js-hf | /middleware/movie/unrentMovie.js | UTF-8 | 1,008 | 2.75 | 3 | [] | no_license | /**
* Get the user from res.user, get the movie from res.movie, increment its available count by 1,
* then remove it from user
*/
module.exports = (objectRepository) => {
return (req, res, next) => {
if (typeof res.locals.movie === 'undefined' || typeof res.locals.user === 'undefined') {
retu... | true |
3e8b023328590f0fe1573fd5fbecf183c7f57393 | JavaScript | sanatankc/watchlist | /src/db_queries/addMovieToUser.js | UTF-8 | 620 | 2.546875 | 3 | [
"MIT"
] | permissive | const UserMovie = require('../models/userMovie')
const getMovieFromDB = require('./getMovieFromDB')
const addMovieToDB = require('./addMovieToDB')
module.exports = async (tmdbId, movieName, username) => {
if (await UserMovie.findOne({tmdbId, username})) {
throw new Error('ALREADY_EXISTS')
}
let movie = awai... | true |
b1178b219c5dbed2a12ebc74e8ade59bc477310e | JavaScript | yoonhyung/seedproject | /apps/ide/ProjectWizard-templates/internal/default/basic/project/js/main.js | UTF-8 | 3,852 | 2.53125 | 3 | [] | no_license | /*
* Copyright (c) 2012-2015 S-Core Co., Ltd.
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable ... | true |
a0d8332acee4088c51c58b3f0e02da7e873f9d11 | JavaScript | uncofits/Dairy-Business | /report.js | UTF-8 | 1,848 | 3.484375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | var k = "The production for shed A,shed B,shed C and shed D are : ";
var input = document.getElementsByName('array[]');
var k = "The respective values are : <br>";
function show() {
var input = document.getElementsByName('array[]');
for (var i = 0; i < input.length; i++) {
var a = input[i];
k... | true |
48052e1b9d027b1390674aa3c1842ec66e69e15f | JavaScript | Galaraz/trybe-exercises-Back-end | /Bloco-23/Dia1/book.js | UTF-8 | 921 | 3.0625 | 3 | [] | no_license | Para importar a coleção books para um banco chamado class , utilize o comando abaixo:
mongoimport --db class books.json
Apost a importação, selecione o banco class no seu cliente:
use class
Exercício 7 : Retorne a quantidade de documentos da coleção books .
db.books.count()
Exercício 8 : Conte quantos livros existem... | true |
4ee8e6b3cd6ce7757328f4f5c6c6fb586a55b85d | JavaScript | jaysolanki00/snake-game | /food.js | UTF-8 | 1,095 | 3.171875 | 3 | [] | no_license | import { getRandomGridPosition } from "./grid.js";
import { expandSnake, onSnake } from "./snake.js";
let food = getRandomFoodPos();
let expansionRate = 1;
let isVisible = false;
export function resetFood() {
food = getRandomFoodPos();
isVisible = false;
}
export function update() {
if(onSnake(food)) {
... | true |
c910c23c10c138342e63bd043e0d1c9ef5aa1a30 | JavaScript | gustavogte/master-g-en-code-g2 | /exaples/master-en-code-g2-master 2/2_Kata_JS/3_Ciclos/extra.js | UTF-8 | 672 | 4.6875 | 5 | [] | no_license | /*
Write a short program that prints each number from 1 to 100 on a new line.
For each multiple of 3, print "Fizz" instead of the number.
For each multiple of 5, print "Buzz" instead of the number.
For numbers which are multiples of both 3 and 5, print "FizzBuzz" instead of the number.
*/
// i=1; 1 <= 100; (se ejecuta... | true |
2797765885d5d162e751c52015c98d8ed0ccf37a | JavaScript | Yashika-14/vishalsales | /app.js | UTF-8 | 282 | 2.53125 | 3 | [] | no_license | // create an express app
const express = require("express")
const app = express()
// use the express static as middleware
app.use(express.static("./"))
// start the server listening for request
app.listen(process.env.PORT || 9000,
() => console.log("Service is running..."));
| true |
3a8c7b77c8c3c6c18b9df9125dfecec85cd05192 | JavaScript | choice-form/letvCloud | /letvCloud/letv.js | UTF-8 | 7,336 | 2.53125 | 3 | [] | no_license | // var md5 = require('md5');
var crypto = require('crypto');
var request = require("request");
// var formdata = require("form-data");
var config = require("../config");
var querystring = require('querystring');
module.exports = function () {
// letv云的参数
var letvObj = {
user_unique: config.user_unique,
secret_ke... | true |
d75296052e612cdb775e6e28a3f5f90c7fa2bf72 | JavaScript | bumbu/pathvisiojs | /src/js/renderer/info-box.js | UTF-8 | 1,968 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | 'use strict';
module.exports = {
render: function(viewport, data) {
if (!viewport || !data) {
return console.warn('Error: Missing input parameters.');
}
// Although gpml has x and y values for infobox, we have decided to ignore them and always set it in the upper left.
var infoBoxData = [];
... | true |
36052b8a1094bfd8a918f97b3be4094fd09e2e35 | JavaScript | hackxu/studycode | /jsStudy/ES5ES6继承区别.js | UTF-8 | 327 | 3.875 | 4 | [] | no_license | // new Promise(resolve => {
// resolve(1);
// Promise.resolve().then(() => console.log(2));
// console.log(4)
// }).then(t => console.log(t));
// console.log(3);
const promise = new Promise((resolve, reject) => {
console.log(1)
resolve()
console.log(2)
})
promise.then(() => {
console.log(3)
})
console... | true |
4cac861965546b4bf686bf32f8b6e30b56c8c743 | JavaScript | meriem26/group-project-dogs | /src/components/DogBattle.js | UTF-8 | 817 | 2.671875 | 3 | [] | no_license | import React from "react";
import Dog from "./Dog.js";
import "./DogBattle.css";
class DogBattle extends React.Component {
vote = (breed) => {
console.log(breed);
};
render() {
return (
<div className="DogBattle">
<h2 className="DogBattle-title">Choose the best dog</h2>
<div classNa... | true |
25a52705a17bb2a6250998064af3af537735f862 | JavaScript | BayechouAbdelhadi/geo-game-react-spring-boot | /react-client/src/actions/securityActions.js | UTF-8 | 2,215 | 2.53125 | 3 | [] | no_license | import axios from "axios";
import { GET_ERRORS, SET_CURRENT_USER ,SET_PARTS} from "./types";
import setJWTToken from "../securityUtils/setJWTToken";
import jwt_decode from "jwt-decode";
import authHeader from "../securityUtils/authorisationHeader"
export const createNewUser = (newUser, history) => async dispatch =>
{... | true |
b603d2eb4ef1c16c21612355a6a19ffb2c7f116d | JavaScript | jjjiia/h1bvisa | /common_test.js | UTF-8 | 27,625 | 2.984375 | 3 | [] | no_license |
function titleCase(input) {
var output = ""
input = input.toLowerCase().split(' ')
for(var c = 0; c < input.length; c++){
output += input[c].substring(0,1).toUpperCase() + input[c].substring(1,input[c].length) + ' ';
}
return output.trim()
}
var companiesSelect = true;
var visas = []
d3.csv(csv, function(da... | true |
cbb1e3d891a75b16ba78ace8209a8f44b842b8d9 | JavaScript | Sonam-1112/react-employee-management-system | /src/pages/EmployeeFolder/EditEmpForm.jsx | UTF-8 | 3,817 | 2.640625 | 3 | [] | no_license | import React,{useState,useEffect} from 'react'
import Modal from 'react-modal'
function EditEmpForm({handleEditEmployee,currentId,empObjects}) {
// const initialValues={
// name:"",
// phone:"",
// email:"",
// desig:"",
// dept:""
// }
const [name, setName] = useSta... | true |
564605347b1923288614f756b6a296f98d27902f | JavaScript | MichaelBoegner/Node-Blog | /data/posts/postRoutes.js | UTF-8 | 2,417 | 2.5625 | 3 | [] | no_license | const express = require('express');
const postDb = require('../helpers/userDb');
const router = express.Router();
function postCreateCheck(req, res, next){
let [body] = [req.body]
if(body.text) {
next();
} else {
res.status(400).json({error: "Text is a required property with a value as ... | true |
36a9d63e8a0604abf8473ce64493268ac8e21a76 | JavaScript | HackTheDeep/gs-map-the-collections | /gs-map-the-collections-ui/src/pages/Data/utils.js | UTF-8 | 316 | 2.71875 | 3 | [] | no_license | // const csvFilePath='./file.csv'
// const csv=require('csvtojson')
// csv()
// .fromFile(csvFilePath)
// .on('json',(jsonObj)=>{
// // combine csv header row and csv line to a json object
// // jsonObj.a ==> 1 or 4
// console.log(jsonObj);
// })
// .on('done',(error)=>{
// console.log('end')
// }) | true |
a7ae6abf006f4205e984836feb9f1c3eb4523d9b | JavaScript | benji/darwins-dream-js | /javascript/Creature.js | UTF-8 | 2,151 | 3.1875 | 3 | [
"Apache-2.0"
] | permissive | // http://stackoverflow.com/questions/387707/whats-the-best-way-to-define-a-class-in-javascript
function Creature(options){
absorb(this, options)
this.creationCycle = WORLD.cycle
var cellOpts = {x:this.x,y:this.y,z:this.z}
LOGGER.debug("Creating new creature: x="+cellOpts.x+" y="+cellOpts.y+" z="+cellOpts.z)
... | true |
774a1fc2bda8d5b1d04eb95193261864f131acf6 | JavaScript | Anil1111/cewp-339-winter-2021-code | /class2/test_scores.js | UTF-8 | 499 | 3.859375 | 4 | [] | no_license | let total = 0;
let count = 0;
let score = 0;
do {
score = parseInt(prompt("Enter a test score between 0 and 100, enter -1 to terminate"));
if (score >= 0 && score <= 100) {
total += score;
count++;
document.write(`<p>Score = ${score} Count is ${count}`);
} else if (score != -1){
... | true |
5f05c4dbe1d371414f23b290214752d4079446a6 | JavaScript | smilish67/JNUCapstone | /app/src/public/js/home/crud.js | UTF-8 | 1,324 | 2.640625 | 3 | [] | no_license | "use strict";
const contentTitle = document.querySelector("#contentTitle");
const contentCategory = document.querySelector("#contentCategory");
const contentText = document.querySelector("#contentText");
const peopleNum = document.querySelector("#peopleNum");
const uploadBtn = document.querySelector("#button1");
const... | true |
fc22a804d4d3389b692af3db161278845693dd3e | JavaScript | kstreich/frog-racing | /app/components/raceController.js | UTF-8 | 1,022 | 3.265625 | 3 | [] | no_license | //private
import RaceService from "./raceService.js";
let _raceService = new RaceService()
function drawRacers() {
let template = ''
let frogs = _raceService.getRacers()
frogs.forEach((frog, index) => {
template += `
<div class="col racer">
<img src="${frog.img}"/>
<h5>${frog.name}</h5>
<button clas... | true |
34e6d607d06c6b22582bd21460aee928cb0511bb | JavaScript | Quantomic/metaphorjs | /src/func/dom/isVisible.js | UTF-8 | 162 | 2.546875 | 3 | [
"MIT"
] | permissive | /**
* @param {Element} el
* @returns {boolean}
*/
module.exports = function isVisible(el) {
return el && !(el.offsetWidth <= 0 || el.offsetHeight <= 0);
}; | true |
fcd32dabf21b60c74d066ac21aa353554ea08107 | JavaScript | jingXuOne/TicTacToc2 | /src/script.js | UTF-8 | 3,531 | 3.359375 | 3 | [] | no_license | // const winResults = [
// [0,1,2],
// [0,3,6],
// [0,4,8],
// [1,4,7],
// [2,4,6],
// [2,5,8],
// [3,4,5],
// [6,7,8]
// ];
// const symbols = {"player1": "X", "player2":"O"};
// var isPlayer1, board;
// var player1Status = [];
// var player2Status = [];
// var allSquares = document.ge... | true |