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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
7531b16fbde5a0998598d11b92ea965d720ba4cc | JavaScript | dicardoso/Tindev | /backend/src/controllers/LikeController.js | UTF-8 | 1,248 | 2.640625 | 3 | [] | no_license | /**
* Controlador criado para manter a regra dos 5 métodos
*/
const Dev = require('../models/Dev');
module.exports = {
async store(req,res){//criando um novo Like
const { user } = req.headers;//usuário logado
const { devId } = req.params;//usuário alvo do like
//Buscando users no BD
... | true |
baca6c28694c830af01d4b135351d26ab0de8a4d | JavaScript | abdabuzaid/Pure-JS | /js/main.js | UTF-8 | 4,497 | 2.78125 | 3 | [] | no_license | /*global window*/
window.onload = function () {
"use strict";
//LocalStorage Change Color
let mainColor = localStorage.getItem('change-color');
// Check if localStorage is Empty or no To Change Color
if (mainColor !== null) {
document.documentElement.style.setProperty("--main-color", ma... | true |
50b76326deb97a07a7febf0527435e26a05b570f | JavaScript | palladiumkenya/dwh-portal | /src/reducers/HTS/Prep/newOnPrepTrends.js | UTF-8 | 938 | 2.59375 | 3 | [] | no_license | import * as actionTypes from "../../../actions/types";
const initialState = {
lastFetch: null,
loading: false,
listUnfiltered: [],
listFiltered: [],
};
export default (state = initialState, action) => {
let newState = { ...state };
switch (action.type) {
case actionTypes.PREP_NEW_TREND... | true |
53848ab3f1c9bf85e94ddf73185ed11cb0787614 | JavaScript | mrchrmn-ls/JS101 | /06-slightly-larger-programs/tic-tac-toe-my-way2-cr.js | UTF-8 | 5,726 | 3.546875 | 4 | [] | no_license | // INITIALIZATION
const rlsync = require("readline-sync");
const FIELD_SIZE = 9;
const EMPTY = " ";
const PLAYER_SYMBOL = "X";
const COMPUTER_SYMBOL = "O";
const WINNING_SQUARES = [
[1, 2, 3], [4, 5, 6], [7, 8, 9], // rows
[1, 4, 7], [2, 5, 8], [3, 6, 9], // columns
[1, 5, 9], [3, 5, 7] // diagona... | true |
1b3ea8c940706762b43a3f21faad496a57b0e5bf | JavaScript | sairaj225/JavaScript | /Basics/switch-case.js | UTF-8 | 352 | 2.53125 | 3 | [] | no_license |
var user = "";
switch (user) {
case "admin":
console.log("All previlages granted");
break;
case "testprep":
console.log("testprep previlages granted");
break;
case "user":
console.log("user previlages granted");
break;
default:
console.log... | true |
cdbf9b89dde4ef296cd669ac3c83164f2041ed87 | JavaScript | lubing1101/tinyHeard | /tinyHeart/js/fruit.js | UTF-8 | 2,312 | 3.15625 | 3 | [] | no_license | var fruitObj = function() {
this.alive = []; //是否存活
this.x = [];
this.y = [];
this.aneID = [];
this.diameter = []; //直径
this.speed = []; //果实漂浮速度
this.fruitType = []; //blue or orange
this.orange = new Image();
this.blue = new Image();
}
fruitObj.prototype = {
constructor: fruitObj,
num: 50,
... | true |
bcc858da1c05de81d730fc821d84b5bcb817c832 | JavaScript | tanvir510/react-todo-apps | /src/component/pages/MainTodos.js | UTF-8 | 2,252 | 2.75 | 3 | [] | no_license | import React, { Component } from "react";
import uuid from "react-uuid";
import Todos from "../todos/Todos";
import AddTodo from "../todos/AddTodo";
export class MainContent extends Component {
state = {
test: "Tanvir",
todos: [
{
id: 1,
title: "Front End Developer",
status: tru... | true |
1c7deb9bee4fbec9adb69ce68ca69493c6804032 | JavaScript | oceanjack/musketeers | /scripts/addContent.js | UTF-8 | 1,179 | 2.578125 | 3 | [] | no_license | //添加首页文章
var addContent = function() {
var ArticleList = ArticleListInit();
var query = new AV.Query(ArticleList);
query.find({
success: function(mock) {
for(var i = 0, l = mock.length; i < l; ++i) {
var node = $(
'<div class="item">' +
'<a class="imgs" href="' + mock[i].att... | true |
1051adea4f663b4066c0884fdaf33bafd5813311 | JavaScript | kotertom/cyberracing | /Cyberracing/Scripts/Math3D/matrix.js | UTF-8 | 5,547 | 3.265625 | 3 | [] | no_license | /**
* Created by tom on 2017-01-12.
*/
function Matrix(dim, array) {
if(typeof dim == 'number')
dim = [dim, dim];
this.dim = dim.slice();
let len = dim[0] * dim[1];
array = array || [];
while(array.length < len) {
array.push(0);
}
this.elements = array.slice(0, len);
}
Ma... | true |
5241efff781100d618c981ec2690d6225555aaef | JavaScript | TradeBox/TradeBox | /validate.js | UTF-8 | 1,178 | 2.78125 | 3 | [] | no_license | function validate()
{
// deklrarirame kato promenliva vsqka edna forma
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
fname=document.getElementById("name");
address=document.getElementById("address");
city=document.getElementById("city");
email=document.getElementById("contact_email");
custo... | true |
9f6a3f37862a1d0e2c1717b698527ab9cef1834a | JavaScript | hcthanhhh/UCC | /Backend/src/controller/CocomoApi.js | UTF-8 | 4,231 | 2.59375 | 3 | [
"MIT"
] | permissive | const fs = require('fs');
const csv = require('csv-parser');
function CheckFileAvailable(username, name, file) {
return new Promise((resolve, reject) => {
fs.readdir(`../data/result/${username}/`, (err, files) => {
if (files.includes(name))
fs.readdir(`../data/result/${username}... | true |
2974faec0cf7139be0cfe57f164fbc046048b054 | JavaScript | Jun4928/crashing_algorithms | /jun/programmers/kakao/2021_kakao_rank_search_efficiency.js | UTF-8 | 3,365 | 3.125 | 3 | [] | no_license | const log = console.log
const L = {}
const curry = (f) => (first, ...args) =>
args.length ? f(first, ...args) : (...args) => f(first, ...args)
const reduce = curry((f, acc, iter) => {
if (!iter) {
iter = acc[Symbol.iterator]()
acc = iter.next().value
} else {
iter = iter[Symbol.iterator]()
}
f... | true |
d41c5aa79750fa41da92806129d35491169c9c1e | JavaScript | avijeetpandey/redux-simple-examples | /index.js | UTF-8 | 422 | 2.984375 | 3 | [] | no_license | const {
compose,
combineReducers,
createStore,
applyMiddleware,
bindActionCreators,
} = require('redux');
/**
* Demonstration of compose
*/
const sayLouder = (string) => string.toUpperCase();
const sayThreeTimes = (string) => string.repeat(3);
const sayBold = (string) => string.bold();
const Sa... | true |
451721bce4fdf7f1515db0a785b505bec715e32a | JavaScript | RComi/Burger | /controllers/burgersController.js | UTF-8 | 1,734 | 3.046875 | 3 | [] | no_license | //require express and router
var express = require("express");
var router = express.Router();
// Import the model (burger.js) to use its database functions.
var Burger = require("../models/burger.js");
//gets method the default page and load the initial data from the db
router.get("/", function(req, res) {
var burg... | true |
19053f125a159d14ca3076df251b9819962a45e6 | JavaScript | leidenglai/React-Koa2-SSR | /client/utils/handleCompressImage.js | UTF-8 | 2,225 | 3.3125 | 3 | [] | no_license | /**
* File对象转换为dataURL 同时做压缩处理
* @param {File} blob 图片文件
* @param {Function} callback 处理回调
* @return {Object} imageData {blob: 文件对象, dataUrl: base64图片文件}
*/
export default function handleCompressImage(blob, callback) {
const a = new FileReader()
a.onload = function(e) {
compressImage(e.target.... | true |
6e5a4d5a1b853116afdf9e1266ad5c9e4ea9df5f | JavaScript | jwpowers2/rose_front_end | /static/dash_state.js | UTF-8 | 3,252 | 3.140625 | 3 | [] | no_license | function logOut(){
localStorage.clear();
window.location.replace("/");
}
function isLoggedIn(){
if(localStorage.getItem('id') !== null){
axios.get("http://165.227.210.72:5000/api/auth/user", {
headers: {
'Content-Type':'application/json',
'x-access-token': `${localStorage.... | true |
03a3dbfc4cafffe8a2c2b85d37ff8a768b1d2b6d | JavaScript | voop87/Cat-Energy-HTML-CSS--finished | /source/js/app.js | UTF-8 | 395 | 2.84375 | 3 | [] | no_license | //Выпадающее меню
var menuBtn = document.querySelector(".page-header__menu-toggle");
var jsMenuBtn = document.querySelector(".js-menu-toggle");
var menu = document.querySelector(".main-nav");
menuBtn.classList.add("page-header__menu-toggle--js");
function showMenu() {
menuBtn.classList.toggle("page-header__menu-togg... | true |
2ae18a2a1d1544cfdf941b0c27f624eb6e6bbde9 | JavaScript | apishore/apishore-foundation-browser | /src/main/javascript/angular-apishore/filters/filesize.js | UTF-8 | 400 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | apishore.filter('filesize', function() {
var units = [ 'bytes', 'KB', 'MB', 'GB', 'TB', 'PB' ];
return function(bytes, precision) {
bytes = parseFloat(bytes);
if (isNaN(bytes) || !isFinite(bytes)) {
return 'Unknown';
}
var unit = 0;
while (bytes >= 1024) {
bytes /= 1024;
unit++;
}
return unit ... | true |
b4a8b7c1528c2da88a966c0b2c901db4220a9206 | JavaScript | Kapilsh990/JavaScript | /Day1/04Conditional.js | UTF-8 | 257 | 3.375 | 3 | [] | no_license | var temprature;
//TODO : Go to google and get the data
temprature = 20;
if (temprature<20) {
console.log("it's is cold outside");
}
if (temprature<30) {
console.log("it's moderate outside");
} else {
console.log("it's really hot outside");
} | true |
79c4fb16488f66ee4ffeb2d539ed02b8de047dca | JavaScript | ibm-functions/shell | /app/plugins/testing/load-test.js | UTF-8 | 9,113 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | /*
* Copyright 2017 IBM Corporation
*
* 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 law or agreed to ... | true |
c25cfa6eae6e376a3c280c55f95ebf5a615002bf | JavaScript | libin1991/model | /test/test.js | UTF-8 | 3,111 | 2.578125 | 3 | [
"MIT"
] | permissive | // let Model = require("../build/model");
let Model = require("../src/model");
var expect = require('chai').expect;
(function () {
'use strict';
const FORMAT = {
L: "l",
LL: "ll",
KK: "k",
GET: function (data) {
return "get" + data;
}
}
let Basic = new Model({
"source": Date,
... | true |
90fe4b382fa58ae025cbd4d9bdc67a9160f09e8d | JavaScript | danbolt/ggj2018 | /src/actors/levelexit.js | UTF-8 | 837 | 2.734375 | 3 | [] | no_license | var LevelExit = function(game, x, y) {
Phaser.Sprite.call(this, game, x, y, 'coloured_squares', 40);
this.game.physics.enable(this, Phaser.Physics.ARCADE);
this.animations.add('open', [40, 41, 42, 43], 10, false);
this.lock();
this.tween = null;
};
LevelExit.prototype = Object.create(Phaser.Sprite.prototype... | true |
2904870f7334796e3645aa180ac33a7f30f5aacb | JavaScript | CarterKessler/MemoryGame | /alternate.js | UTF-8 | 2,436 | 4.25 | 4 | [] | no_license | //Make the Memomry game work, user visits the site and sees 4 purple cards. User clicks on any of the four cards and it changes to 1 of 2 images. The exposed card remains exposed as the user then clicks on another purple card. It turns over. Now showing two cards up and the remaining two cards down. If they, the car... | true |
0790e97a72c6f653bce3975e089906353a078e93 | JavaScript | whieronymus/map-app | /static_in_app/site/js/maps.js | UTF-8 | 3,717 | 2.53125 | 3 | [] | no_license |
function loadMapScenario() {
var map = new Microsoft.Maps.Map(document.getElementById('myMap'), {});
var pois;
var roads;
var buildings;
var locations = []
$.ajax({
url: "/api/poi/",
dataType: 'json',
async: false,
success: function(data) {
pois = data;
}
... | true |
62f993431ebf911507f1e458968ec144625b29fc | JavaScript | GhettoGeek/lively4-core | /src/components/widgets/lively-resizer.js | UTF-8 | 4,509 | 2.53125 | 3 | [
"MIT"
] | permissive | 'use strict';
import Morph from 'src/components/widgets/lively-morph.js';
import {pt} from 'src/client/graphics.js';
import {Grid} from 'src/client/morphic/snapping.js';
export default class Resizer extends Morph {
initialize() {
// console.log("intialize separator " )
// #TODO #Refactor, because we use d... | true |
e31ea7661acbd910dcf85e6ca78845dfb7203973 | JavaScript | eralpkor/JS_AlgorithmsAndDataStructures | /Big_O_Notation/bigOn.js | UTF-8 | 1,846 | 4.375 | 4 | [] | no_license | function reverse(str) {
return str.split('').reverse().join('')
}
console.log(reverse('eralp'))
function reverse2(str) {
let result = ''
for (let i = str.length - 1; i >= 0; i--) {
result += str[i]
}
return result
}
console.log(reverse2('susan'))
// Write a function that calculates the sum of all numb... | true |
64f9b981b9907e4756d8ff9fe95d3a297467c30a | JavaScript | AdamLangevin/MirrorProject | /views/js/start.js | UTF-8 | 1,126 | 2.921875 | 3 | [] | no_license | const invoc = new XMLHttpRequest();
window.onload = function(){
setTime();
setInterval(setTime, 1000);
var lat = 45.411171;
var long = -75.698120;
let apiKey = "9fc3e0b97c0156c6aade72a379c58f90";
apiKey = "059ef5fec537fe2b4737d26c7217a2b6";
$.get("https://cors-anywhere.herokuapp.com/https://api.darksky... | true |
562328c1f88a04458bf6dcf0e5370253f510529d | JavaScript | mcadonline/canvas-jenzabar-integration | /utils/jsonToCSV.test.js | UTF-8 | 609 | 2.90625 | 3 | [
"MIT"
] | permissive | import jsonToCSV from './jsonToCSV';
describe('jsonToCSV', () => {
it('converts a json collection to csv', () => {
const collection = [
{ id: 1, firstName: 'Jerry', lastName: 'Seinfeld' },
{ id: 2, lastName: 'Benes', firstName: 'Elaine' },
{ id: 3, lastName: 'Kramer' },
{ id: 4, firstName... | true |
18526d2759f3fe57d3ece0587349a3185fc0269c | JavaScript | carrafa/stravavarius | /src/js/activity.js | UTF-8 | 3,132 | 3.09375 | 3 | [] | no_license | const Song = require('./song.js');
const api = require('./api.js');
let map;
class Activity {
constructor(data){
this.data = data;
this.latLngs = this.getLatLngs(data);
this.marker;
this.song;
this.mapOptions = {
center: this.latLngs[0],
zoom: 15
};
this.loadMap();
}
dra... | true |
f71dff94e0731bf1559cfd938a8a97a467bbc411 | JavaScript | AlejandroBlanco2001/AdventOfCode_2020 | /Day 15/index.js | UTF-8 | 1,198 | 3.625 | 4 | [] | no_license | var numbers = new Map()
var lastNumber
var turn = 1
function simulateTheGame(limit){
while(turn <= limit){
var currentPos = numbers.get(lastNumber)
if(currentPos.length == 1){
let zeroPos = numbers.get(0)
zeroPos.push(turn)
if(zeroPos.length > 2)
... | true |
3108008180bafc0649095cfb16e4dd9905860047 | JavaScript | minghu0902/Frontend-02-Template | /week15/packages/animation/core/Animation.js | UTF-8 | 569 | 3.09375 | 3 | [] | no_license | export class Animation {
constructor(obj, prop, startValue, endValue, duration, delay, timingFunc, template) {
timingFunc = timingFunc || (v => v)
template = template || (v => v)
this.obj = obj
this.prop = prop
this.startValue = startValue
this.endValue = endValue
this.duration = dura... | true |
ffacca6acdf3b0e9ce827e66d63e1dc378e52ad0 | JavaScript | krishnamishra9026/ranthambore | /backend/test/test.js | UTF-8 | 1,721 | 2.875 | 3 | [] | no_license | const mongoose = require('mongoose');
const uri = 'mongodb://localhost:27017/ranthamboredb';
/*const option = {
"useNewUrlParser": true,
"auth": { "authSource": "admin" },
"user": "rootuser",
"pass": "rootpass"
};
mongoose.connect(uri, option);*/
var db = mongoose.createConnection('mongodb://rootuser:r... | true |
b7adcf044a803b6eb884b7aa761ac1432fb8a475 | JavaScript | Jogiter/frontend | /js-tips/array-clone.js | UTF-8 | 471 | 4 | 4 | [
"MIT"
] | permissive | //1、最简单的办法,就是创建一个新数组,并遍历数组逐项添加到新数组中
Array.prototype.clone=function(){ var a=[]; for(var i=0,l=this.length;i<l;i++) a.push(this[i]); return a; }
//2、通过Array对象的slice方法
Array.prototype.clone=function(){ return this.slice(0); }
//3、通过Array对象的concat方法
Array.prototype.clone=function(){ return [].concat(this); } //或者 Array.... | true |
70e4b429422dcab81f50c1799c5c0fb4f6fa2fdb | JavaScript | avi1737/bookingApi | /middlewares/vetify.js | UTF-8 | 589 | 2.609375 | 3 | [] | no_license | const jwt = require("jsonwebtoken");
class Verify {
verifyToken(req, res, next) {
const bearerToken = req.headers["authorization"];
console.log(bearerToken);
if (!bearerToken) {
res.json({
error: "Unauthenticated",
});
} else {
const bearer_token = bearerToken.split(" ");
... | true |
1b4e731a64f0a20fdda074ac700a0ef0f3c7decb | JavaScript | cuilan-1994/mmp210 | /Final-1/sketch.js | UTF-8 | 1,531 | 2.671875 | 3 | [] | no_license | var serial;
var portName = "/dev/tty.usbmodem14101";
var sensorValue;
var happyface;
function setup() {
createCanvas(640, 360);
serial = new p5.SerialPort();
serial.on('connected', serverConnected);
serial.on('open', portOpen);
serial.on('data', serialEvent);
serial.on('close', serialErro... | true |
119d5bb6c203a38768ed8c773ab3efff1a3e615b | JavaScript | Calvin1121/exercise | /assets/scripts/hotdog/Master.js | UTF-8 | 2,291 | 2.625 | 3 | [] | no_license | const masters = ['stone', 'ghost', 'hotdog'];
cc.Class({
extends: cc.Component,
properties: {
hotDogPickRadius:0,
masterPickRadius:0,
moveSpeed: 0,
},
// LIFE-CYCLE CALLBACKS:
setPerfabPosition(){
let min_width = this.node.width - this.node.parent.width/2,
max_wi... | true |
66f5c9f76190113fef41d5faf83df745f84c3dad | JavaScript | Gquadej96/javascript-data-structures-library | /BinaryTreeMaxHeap/BinaryTreeMaxHeap.js | UTF-8 | 998 | 2.5625 | 3 | [] | no_license | /**
* Author: Quade Jones
* GitHub: https://github.com/Gquadej96
*/
import {BinaryTreeMinHeap} from "../BinaryTreeMinHeap/BinaryTreeMinHeap.js";
import * as comparators from "../comparators/comparators.js";
export class BinaryTreeMaxHeap {
_heap = null;
_comparator = new comparators.Univers... | true |
4061e20cdf55b8c058e50a9a59d3e5e2b7fe7d4b | JavaScript | josmarsm/openwonderland-modules | /src/modules/web/WonderlandWorldBuilder/web/javascript/svg.js | UTF-8 | 4,123 | 2.609375 | 3 | [] | no_license | //This is the start of the SVG version -- do not develop further until Firefox fixes the image-rendering attribute bug
function createLibraryObjectSVG(catalogIndex,top,width,height) {
var thisObjectID = "obj" + objectID;
var right = getScrollerWidth() + 10;
var insertHTML = "<div style='top:" + top + "px;right:" + r... | true |
6c0eb04ad891e69cd6220d10108553b05e452ece | JavaScript | MaxE0/tic-tac-toe | /tic-tac-toe.js | UTF-8 | 5,941 | 3.546875 | 4 | [] | no_license | // Write all your JavaScript code in this file!
// You can use the namespace variable that's defined here.
var namespace = "http://www.w3.org/2000/svg"
var turn="player1"
function createShape() {
var circle = document.createElementNS(namespace, "circle")
if(turn=="player1") {
circle.setAttribute("cx", 80)
... | true |
aa1b3d2592ec910dab156356d6810a8798aba122 | JavaScript | stilnar92/starline | /src/features/offers/effects/use-offers.js | UTF-8 | 458 | 2.515625 | 3 | [] | no_license | import {request} from "../../common";
import {useEffect, useState} from "react";
export const useOffers = () => {
const [offers, setOffers] = useState([]);
useEffect(() => {
request('/offers').then((data) => setOffers(data));
const timerId = setInterval(async () => {
request('/offe... | true |
f747c5dd15fa28afb7eb89aff679a1240b1acfbc | JavaScript | MykolaVitvytskyi/hamburgers-ES6 | /script.js | UTF-8 | 1,256 | 3.84375 | 4 | [] | no_license | class Hamburger{
constructor(size, stuffing){
this.price = size.price + stuffing.price;
this.calories = stuffing.calories + size.calories;
this.topping = [];
}
static SIZE_SMALL = {price: 50, calories: 20};
static SIZE_BIG = {price: 100, calories: 40};
static STUFFING_CHEESE = {price: 10, calor... | true |
49cc092293e0eabd72d2dca4de00efb4da211120 | JavaScript | darthjoel/kafka | /test/test_periodic_offset_committer.js | UTF-8 | 3,077 | 2.578125 | 3 | [
"MIT"
] | permissive | var assert = require('chai').assert;
var P = require('bluebird');
var Kafka = require('../lib');
var fakeConsumer = {};
fakeConsumer.commits = [];
fakeConsumer.commitOffset = function(payload) {
fakeConsumer.commits.push({topic: payload.topic, partition: payload.partition, offset: payload.offset});
var fakeThen = ... | true |
c96ed88aaa7d0fdbf81f32b79e97050555b6f3d1 | JavaScript | Naveen854/datastructures-algorithms | /JavaScript/Arrays/implementingArray.js | UTF-8 | 1,154 | 3.90625 | 4 | [] | no_license | class myArray{
constructor(){
this.length = 0
this.data = {}
}
get(index){
return this.data[index]
}
push(item){
this.data[this.length] = item
this.length = this.length+1
return this.length
}
pop(){
let lastItem = this.data[this.leng... | true |
4d13cceb6df22c4135b2bdc2672bf7126dba76bd | JavaScript | jarabik8810/Hunter-responsive- | /script.js | UTF-8 | 419 | 2.734375 | 3 | [] | no_license | var btn = document.querySelector('.nav-btn');
var navList = document.querySelector('.nav-list');
btn.addEventListener('click', function(){
navList.classList.toggle('nav-list-active');
});
var navListBtn = document.querySelector('.nav-list-btn');
var vanListCont = document.querySelector('.nav-list-cont');
navListBt... | true |
39ea459c6a1c63f4869a4b8e480cb20fb112d651 | JavaScript | RockF2E20151122/nodejs | /sevenDays/code/_05_file_03_apis_path.js | UTF-8 | 1,177 | 3.765625 | 4 | [] | no_license | //http://nodejs.org/api/path.html
//1. path.normalize
//将传入的路径转换为标准路径,具体讲的话,除了解析路径中的.与..外,还能去掉多余的斜杠。如果有程序需要使用路径作为某些数据的索引,但又允许用户随意输入路径时,就需要使用该方法保证路径的唯一性。以下是一个例子:
var cache = {};
var path = require('path');
function store(key, value) {
cache[path.normalize(key)] = value;
}
store('foo/bar', 1);
store('foo//baz//../bar... | true |
1fa7b451b6e338956a653658d9724e5c480608ae | JavaScript | ljz3/dApp-Lottery-Smart-Contract | /test/tests.js | UTF-8 | 15,870 | 2.65625 | 3 | [] | no_license | const { expect } = require("chai");
const { ethers } = require("hardhat");
describe("Testing MOK", function () {
it("Deployment should assign the total supply of tokens to the owner", async function () {
const accounts = await ethers.getSigners();
const owner = accounts[0];
const MOK = await ethers.getC... | true |
6d16cd1ed736c675d5e516c5c870eec3b3240099 | JavaScript | GPC-debug/code-test | /learn-js/src/alogrithm/stack.js | UTF-8 | 144 | 2.625 | 3 | [] | no_license | // -------------- 棒球比赛 --------------
; (function () {
return
const arr = [4, 1, 3, 2, 8, 0, 9, 5]
console.log(arr, 'arr')
})()
| true |
6d2ff31564cd551359de8ef6dde91ccf6dca7ce2 | JavaScript | shakil232/es6-practic | /const.js | UTF-8 | 177 | 3.671875 | 4 | [] | no_license | // consent
const name = 'shakil'
console.log(name);
const number =[ 11,13,33,44];
console.log(number);
// let
let name = 'shakil';
name ='ahmed'
console.log(name); | true |
81eeb7b174da1ef56e532d377f1bb0afa26b21e9 | JavaScript | Migho/toripoliisi | /tori.js | UTF-8 | 963 | 2.625 | 3 | [] | no_license | const API_URL = 'https://api.tori.fi/api/v1.2/public/ads?'
export async function getNewToriItems(url, previousId, previousTimestamp) {
const response = await fetch(API_URL + url.split('?')[1])
const json = await response.json()
// Sort by timestamp
const sortedItems = json.list_ads.sort((a, b) => b.ad.list_ti... | true |
032d5cbc35e6a327f771e426995dd3782cd45375 | JavaScript | dmytrosem-tech/goit-js-hw-01 | /js/task-6.js | UTF-8 | 160 | 3.796875 | 4 | [] | no_license |
let total = 0;
while (true) {
let input = prompt('Write a number');
if (input === null) break;
total += Number(input);
console.log(total);
}
| true |
ce3b635381162a7b7bbe520fc4a195a027ed0c1f | JavaScript | maxpow/maxpow.github.io | /calc/js/js.js | UTF-8 | 2,250 | 3.0625 | 3 | [] | no_license | var flag1=true;
var flag2=0;
var flag3;
var flag4;
var flag5=true;
var getNumber0,getNumber1;
var display1=document.querySelector('#display');
var left1=document.querySelector('#left');
left1.addEventListener('click', function(e) {
//e.stopPropagation();
getNumber1=e.target.innerHTML;
//alert(e.target.inne... | true |
0b3b33a9f25893246160793c1cbb33b0d4e06829 | JavaScript | shiny/async | /lib/eachOfLimit.js | UTF-8 | 1,167 | 2.75 | 3 | [
"MIT"
] | permissive | import _eachOfLimit from './internal/eachOfLimit';
import wrapAsync from './internal/wrapAsync';
import awaitify from './internal/awaitify'
/**
* 类似 [`eachOf`]{@link module:Collections.eachOf},但限制了同时最多有 `limit` 个异步操作
*
* @name eachOfLimit
* @static
* @memberOf module:Collections
* @method
* @see [async.eachOf]{... | true |
5a26fe005b7edf38455670dc2572b54a5b7452e5 | JavaScript | rgbkrk/nteract | /packages/presentational-components/__tests__/header-editor-spec.js | UTF-8 | 2,126 | 2.546875 | 3 | [
"BSD-3-Clause"
] | permissive | import * as React from "react";
import { shallow } from "enzyme";
import renderer from "react-test-renderer";
import { HeaderEditor } from "../src/";
describe("Header Editor", () => {
it("renders correctly with no props", () => {
const tree = renderer.create(<HeaderEditor />).toJSON();
expect(tree).toMatchS... | true |
d8338d6327561e89f49979ea6196dbe2443cd517 | JavaScript | prabhat903/JsLib | /getElement.js | UTF-8 | 1,237 | 3.296875 | 3 | [] | no_license | class Element {
constructor(node,parent){
if(!node.tag) throw new Error("No Tag is provided");
if(!parent) throw new Error("please provide Parent");
this.ele = document.createElement(node.tag);;
this.node = node;
this.parent = parent;
this.createEle().render()
}
... | true |
7ff03d627c82d3cfb57e7355ab4418cabde40a33 | JavaScript | courtneygives/ImpactHub-App | /src/components/AdminPage/MainComponent/GraphComponent/EventsMemberVSVisitor.js | UTF-8 | 2,257 | 2.609375 | 3 | [] | no_license | import React, { Component } from 'react';
import { Bar } from 'react-chartjs-2';
import axios from 'axios';
class EventsMemberVSVisitor extends Component {
constructor() {
super();
this.state = {
memberEventData: [],
visitorEventData: [],
eventLabels: [],
}
}
/* function to get even... | true |
e477769ffc83d221e4e0e0a826434eb14c94215b | JavaScript | GaneshSawalkar/company-ui | /src/Redux/reducer.js | UTF-8 | 1,156 | 2.640625 | 3 | [] | no_license | const initialstate = {
employees: []
};
const reducer = (state = initialstate, action) => {
state.employees = []
switch (action.type) {
case 'GET_EMPLOYEE':
return {
...state,
employees: state.employees.concat(action.payload)
};
case '... | true |
ce47278a0d12f82ab9d74fe6aea633f5fcb00bb2 | JavaScript | raya/more-data-structures | /spec/hashTableSpec.js | UTF-8 | 3,363 | 3.390625 | 3 | [] | no_license | /*
"Password", "NewPass1", "NewPass12", and "Wordy" map to the key 3 when max_size set to 5. These are used to test collisions.
*/
describe("hashTable", function() {
var hashTable;
beforeEach(function() {
hashTable = makeHashTable();
});
describe("getIndexBelowMaxForKey method", function() {
beforeE... | true |
e78d84fefbd3c7410088589cd2f70ae3c000cba8 | JavaScript | Filipe-barbosa/roteiro-maratona-da-programa-o-UFMG | /primos.js | UTF-8 | 253 | 3.328125 | 3 | [] | no_license | // primos
const isprime = (value) => {
if (value < 2 || value % 2 === 0) {
return false;
}
for (let i = 3; i < Math.trunc(value / 2); i++) {
if (value % i === 0) {
return false;
}
}
return true;
};
console.log(isprime(13))
| true |
e9db3e6565912babdba4677d677f18a803d30443 | JavaScript | arw12625/Game-to-Code | /src/javascript/ExecutionQueue.js | UTF-8 | 1,507 | 3.515625 | 4 | [] | no_license | var ExecutionQueue = function() {
this.queue = [];
this.delays = [];
this.lastTime = null;
// RUN_TIME_DELAY is used if there are no items in the queue
this.RUN_TIME_DELAY = 1000; // ms
// SHORT_DELAY is used to give a very short delay between run() and the function in the queue
this.SHORT_D... | true |
eca3e9f18f109cfd79c19f8808d8cff7353caf64 | JavaScript | namangirdhar16/tabsMonster | /docs/src/scrpit.js | UTF-8 | 943 | 3.109375 | 3 | [
"MIT"
] | permissive | let isMovable = true;
let eyeBall = document.querySelector('.eye-ball');
let innerEyeBall = document.querySelector('.inner-eye-ball');
let monsterLogo = document.querySelector('.monster-logo');
monsterLogo.addEventListener('click',()=>{
isMovable = !isMovable;
})
document.addEventListener('mousemove',(e)=>{
let x =... | true |
9509a799871c6d26e9ddeaf1aa0d812d92b0b4b6 | JavaScript | adi93/cryptopals | /set2/byte_at_time_harder.js | UTF-8 | 2,488 | 3.421875 | 3 | [] | no_license | // Challenge 14
crypto = require("crypto")
function generate_random_bytes(size) {
return Array.from(crypto.randomBytes(size))
}
function generateRandomNumber(min, max) {
if (min == undefined) {
min = 5
}
if (max == undefined) {
max = 32
}
return Math.floor((Math.random() * (max... | true |
dfc63c83343e1ba54112dcc6922e3588a2e96fb9 | JavaScript | sudip-modi/ehh-filehandle | /tmp/ComponentsTemplates/editor.js | UTF-8 | 2,619 | 3.125 | 3 | [] | no_license | // Syntax highlight for JS
const js = el => {
for (const node of el.children) {
const s = node.innerText
.replace(/(\/\/.*)/g, '<em>$1</em>')
.replace(
/\b(new|if|else|do|while|switch|for|in|of|continue|break|return|typeof|function|var|const|let|\.length|\.\w+)(?=[^\w... | true |
c3b2271084f8398622ce93ff227d4d56f0e652a2 | JavaScript | Lilybon/leetcode | /src/412. Fizz Buzz.js | UTF-8 | 316 | 3.421875 | 3 | [] | no_license | /**
* @param {number} n
* @return {string[]}
*/
export function fizzBuzz(n) {
return Array.from(Array(n), (_, idx) => idx + 1).map(formatStr)
}
function formatStr(num) {
let result = ''
if (num % 3 === 0) result += 'Fizz'
if (num % 5 === 0) result += 'Buzz'
return result === '' ? '' + num : result
}
| true |
f343ac4a08ed58e74dbf108b82547a0d86ac785a | JavaScript | deepikaasharma/draftVIT | /final-project/index.js | UTF-8 | 1,077 | 2.921875 | 3 | [] | no_license |
var inventoryList= ["Fettucine Pasta", "Alfredo Sauce", "Olive Oil", "Salt", "Italian Seasoning", "Black Pepper", "Spinach","Broccoli"]
var recipeFettucineAlfredo= ["Fettucine Pasta", "Alfredo Sauce", "Olive Oil", "Salt", "Italian Seasoning", "Black Pepper", "Spinach","Broccoli"]
var recipeSushi=["Sushi Rice", "Seawe... | true |
c023864b4145c7ef98a17b8b05e152b7b2fe6c47 | JavaScript | dvgeorgiev/netit-webdev-js | /#meetings/w08-1/scripts/models/product.model.js | UTF-8 | 1,179 | 3.21875 | 3 | [] | no_license | // Създаваме фабрика (обикновенна функция която връща обект)
const createProduct = function(objectParameter) {
return {
category : objectParameter.category,
title : objectParameter.title,
count : objectParameter.count,
buyPrice : objectParameter.buyPrice ,
... | true |
bb0f183fd1d9e256a6337c36218834a635b13dd6 | JavaScript | aahmed9to6/scrapper | /assets/scrapper.js | UTF-8 | 1,217 | 2.671875 | 3 | [] | no_license | function handleExec(response, dataset){
var item = response[1]+1;
if(response[0] != 'null'){
$('#captcha').attr('src', response[0]);
$( "#captcha-container" ).dialog({
modal: true,
minHeight: 600,
minWidth: 600,
show: {
effect: "bli... | true |
2830fd9f5ad5f2fda3b08cb2764c7b738399beba | JavaScript | roelkers/JavaScript30 | /11 - Custom Video Player/scripts.js | UTF-8 | 1,638 | 3.234375 | 3 | [] | no_license | /*Get Our Elements */
const video = document.querySelector('video');
const inputVolume = document.querySelector('input[name="volume"]');
const inputSpeed = document.querySelector('input[name="playbackRate"]');
const buttonPlay = document.querySelector('button.toggle');
const buttonsSkip = document.querySelectorAll('[da... | true |
fb06e280cc451c6649ac8875bc507f4be823dd76 | JavaScript | aoliverwd/wordpress_starter_theme | /admin/admin.js | UTF-8 | 640 | 2.765625 | 3 | [] | no_license | (function () {
"use strict";
window.addEventListener("load", function () {
const toggle_switches = document.querySelectorAll("label.toggle_switch input");
if (toggle_switches) {
toggle_switches.forEach(function (this_switch) {
this_switch.onclick = function () {
... | true |
2e6a94e4d90dca6bb56b6262cc91d277ce99753f | JavaScript | skalia0594/programming-questions | /dynamicProgramming/minimumPathSum.js | UTF-8 | 654 | 3.71875 | 4 | [] | no_license | // in :
const a = [
[1, 3, 1],
[1, 5, 1],
[4, 2, 1]
];
// out: 7
const minimumPathSum = arr => {
const result = [[arr[0][0]]];
for(let i =1 ; i< arr.length; i++) {
result.push([arr[i][0] + result[i-1][0]]);
}
for(let i =1 ; i< arr[0].length ; i++) ... | true |
e3ca1c99e34699c1332e7291489e2be15d69467f | JavaScript | motta1616/card-repo | /frontend/src/reducers/reducer.js | UTF-8 | 1,258 | 2.8125 | 3 | [] | no_license | const reducer =(state, action) => {
switch (action.type) {
case 'update-item':
const gamerUpItem = state.gamer;
const listUpdateEdit = gamerUpItem.list.map((item) => {
if (item.id === action.item.id) {
return action.item;
}
return item;
});
... | true |
b07eeb1740af850c0c86740daa0e287005da3e41 | JavaScript | ngimenez17/Converter | /converter.js | UTF-8 | 3,896 | 2.9375 | 3 | [] | no_license | // Required Libraries
var fs = require('fs');
var util = require('util');
// Helper function
function deep(obj){
console.log(util.inspect(obj, false, null));
}
var data = fs.readFileSync('practices.json', 'utf-8');
var data_object = JSON.parse(data);
var numberOfWorkouts = data_object.length;
/***************... | true |
72f4b4c96cab57d5c4b5a26c4f5272cd34285df7 | JavaScript | woaidouya123/LeetCodeDemo | /happy-number/happy-number.js | UTF-8 | 909 | 3.90625 | 4 | [] | no_license | /**
题目:快乐数
编写一个算法来判断一个数 n 是不是快乐数。
「快乐数」定义为:对于一个正整数,每一次将该数替换为它每个位置上的数字的平方和,然后重复这个过程直到这个数变为 1,也可能是 无限循环 但始终变不到 1。如果 可以变为 1,那么这个数就是快乐数。
如果 n 是快乐数就返回 True ;不是,则返回 False 。
示例:
输入:19
输出:true
解释:
12 + 92 = 82
82 + 22 = 68
62 + 82 = 100
12 + 02 + 02 = 1
*/
/**
* @param {number} n
* @return {boolean}
*/
... | true |
a91a815bc1ccec70b897a16b3c1231502338e7eb | JavaScript | ikarienator/Geoboard | /src/command/ConstructPoint.js | UTF-8 | 370 | 2.796875 | 3 | [
"BSD-3-Clause"
] | permissive | function ConstructPointCommand(x, y) {
this.x = x;
this.y = y;
}
;
ConstructPointCommand.prototype = new ConstructCommand();
ConstructPointCommand.prototype.canDo = function (gdoc) {
return !!(this.x !== undefined && this.y !== undefined);
};
ConstructPointCommand.prototype.createNew = function (gdoc) {
... | true |
380cb7723e9556e5f255afd5bf8e93a7100ec79f | JavaScript | northbeachmedia/kanagawa-p-10.0 | /js/my.javascript.js | UTF-8 | 2,224 | 2.59375 | 3 | [] | no_license | // enable tooltips everywhere
$(function () {
$('[data-toggle="tooltip"]').tooltip()
});
// remove empty p tags in editor
$('p:empty').remove();
// enable imagesloaded
$('.pre-loader').imagesLoaded( function() {
$("#loader-wrapper").fadeOut().hide(1000);
});
// instantiating clipboard.js
var clipboard = new Cli... | true |
0f62e53c02e26fb6705030da9e863b09ca64523f | JavaScript | AlexanderSachin/euro2016 | /assets/history.js | UTF-8 | 2,000 | 2.671875 | 3 | [
"CC-BY-3.0"
] | permissive | $(function() {
// check if there is a canvas (only on user page)
if($('#history').length === 0) {
return;
}
$.get(location.pathname + '/history').done(function(result) {
if(! result.ok) {
console.error(result);
return;
}
var datasets = [{
... | true |
d96306f94fe108488e813da9e002261bd64dcbad | JavaScript | chenchen0223/CookingMania | /sketch.js | UTF-8 | 4,721 | 2.890625 | 3 | [] | no_license | var world
var recipe_container
var recipe_steak_button,recipe_steak_textholder
var recipe_noodle_button, recipe_noodle_textholder
var steak_container, steak_button, steak_textholder
var noodle_container, noodle_button, noodle_textholder
function setup() {
noCanvas();
world = new World('VRScene');
... | true |
ccaa8dc7515bef2e6ea381f2277c7afb38d8ca5e | JavaScript | bugs84/skoleni_Javascript_Typescript_Ondra | /tsProjectTemplate/index.js | UTF-8 | 1,057 | 3.34375 | 3 | [] | no_license | "use strict";
document.write("TypeScript!");
function addNumber(value) {
return value + 1;
}
var name2 = "";
var age = 5;
var amount = 4.5;
var visible = true;
// const visible2: false = true //sem jde dat jen false
// any -
// unknown -
var notSure = 4;
var unKnown = new Date();
// když nevíš co ti přišlo
// any ... | true |
250a7686264062db36f43099a96707cbb99c29e2 | JavaScript | yisroelchaim/Javascript | /chap1_assgm3.js | UTF-8 | 1,621 | 3.5625 | 4 | [] | no_license | var buttonClear = document.getElementById("buttonclear")
buttonclear.onclick = function() {
document.getElementById("txb1").value = "";
document.getElementById("txb2").value = "";
document.getElementById("result").innerHTML = "";
}
var buttonCompute = document.getElementById("buttoncompute")
buttonCompute.oncli... | true |
ef76f6487e9f148a602368d5631f34d2f30052bc | JavaScript | Daniel-Key/micro-bit_project | /project-code-master/project-code-master/website/login.js | UTF-8 | 4,214 | 2.796875 | 3 | [] | no_license | const bcrypt = require('bcrypt');
let con = undefined;
let login = exports;
// get database connection from parent process
login.init = (conarg) => {
con = conarg;
};
// register a user account
login.register = async (req, res) => {
// case insensitive
let username = req.body.username.toLowerCase();
... | true |
b046131e8721bb13623c2af97164a97f7bb54018 | JavaScript | liling0726/jsExcise | /regex/.vscode/optisite.js | UTF-8 | 239 | 3.171875 | 3 | [] | no_license | // 反向引用
const str = `people in the lonely is the most easy to fall in love with som`
console.log(str.match(/(the).+\1/g))
console.log(str.replace(/(people in the lonely) (is) (the most easy to fall in love with som)/,'$3 $2 $1')) | true |
b58fd8d4bfd2903958e280a340168b11989436a2 | JavaScript | HenriquePopi/Animais-Fantasticos | /js/modules/fetchanimais.js | UTF-8 | 1,196 | 3.515625 | 4 | [] | no_license | import AnimaNumeros from './anima-numeros.js';
export default function fetchAnimais(url, target){
// cria a div de cada animal q sera inserida no body
function criaElementoAnimal(animal) {
const divAnimal= document.createElement("div")
divAnimal.classList.add("numeros-animal")
divAnimal.innerHTML = `... | true |
9f48b934d49d71ce7f78ae5821c95583a3b3f669 | JavaScript | ajb85/The-Diner-Textbased-RPG | /src/components/SelectCharacter/CharCard.js | UTF-8 | 1,366 | 2.96875 | 3 | [] | no_license | import React from "react";
/*
Props:
char={this.state.chars[charNum]}
*/
export default function CharCard(props) {
const buttonClass = getButtonClass(props.char.stats);
const { str, dex, intel, luck } = props.char.stats;
const { name } = props.char;
return (
<div className="charCard" onClick={() => props.... | true |
fe546da6396bd13ba8d28f9a8a925e2839cedfc8 | JavaScript | duynhat369/Music-Player | /validator2.js | UTF-8 | 4,488 | 2.859375 | 3 | [] | no_license | new Validator("#form-1");
function Validator(formSelector) {
var _this = this;
function getParent(element, selector) {
while (element.parentElement) {
if (element.parentElement.matches(selector)) {
return element.parentElement;
}
element = element.parentElement;
}
}
const fo... | true |
4907bdc87fb998e23cbc13de5b607ca5a6db5bb0 | JavaScript | slashman/autodm | /src/consoleui.js | UTF-8 | 1,332 | 2.859375 | 3 | [
"MIT"
] | permissive | import items from './generators/items';
export default {
init() {
this.optionListener = null;
document.addEventListener("keydown", this.keydown.bind(this), true);
},
printLocationInfo(location, options) {
this.print('------');
this.print('It\'s Wednesday, morning'); // TODO: Simulate time passing... | true |
a994817a1636c0a5d49ee7179d3e4857c007ed34 | JavaScript | jtrindade/isel-pi-2021-1 | /08 - chai, middleware/02-middleware/03-mw-body.js | UTF-8 | 1,307 | 2.59375 | 3 | [] | no_license | 'use strict'
const PORT = 8888
const express = require('express')
const app = express()
app.use((req, res, next) => {
console.log('.. interceptor 1 ..')
next()
})
app.use(
'/items',
(req, res, next) => {
console.log('.. interceptor 2 ..')
next()
},
(req, res, next) => {
console.log('.... | true |
ec704cc1242150fdd926e0fd7fdb7df6580e36e5 | JavaScript | angelsl/sinter | /test_programs/prim_stream_for_each.js | UTF-8 | 412 | 2.953125 | 3 | [
"Apache-2.0"
] | permissive | stream_for_each(display, null);
stream_for_each(display, stream(1, 2, 3, 4, 5));
stream_for_each(display, [[1], () => [[2], () => [[3], () => [[4], () => [[5], () => null]]]]]);
stream_for_each(x => display(x * x), null);
stream_for_each(x => display(x * x), stream(1, 2, 3, 4, 5));
stream_for_each(x => display([x[... | true |
bfe3c17f7751691d5a3904e53e5b6d15be8f176d | JavaScript | cerebralideas/phi-full-stack | /front-end/phi/app/controllers/ctrlr-data-services.js | UTF-8 | 1,348 | 2.53125 | 3 | [
"MIT"
] | permissive | angular.module('PHI').service('dataServices', function ($http) {
'use strict';
// Now, create our Constructor function
var ModifyData = function ModifyData() {
// We first test to see if the newly created object
// is an instance of this Constructor. In other words,
// test if the *new* keyword was used.
... | true |
747976cd5d5619dfe9533f957176440c4053a6bb | JavaScript | Vnsgum99/MITESH_GANDHI_M118_P01 | /PRACTICAL ASSIGNMENT_01.JS | UTF-8 | 4,756 | 3.296875 | 3 | [] | no_license | const readline = require("readline");
const rl =readline.createInterface({
input:process.stdin,
output:process.stdout,
});
const fs=require('fs');
var filename="";
var content="";
var foldername = "";
var rena="";
var start=() =>{
rl.question("enter your choice: ",(answer) => {
if (answer== "1"){
... | true |
93a77e7f00b2fc5897e440b871f3e13eee365e19 | JavaScript | AdrianKauz/HSLU_HS18_CG_Exercises | /Test/js/CameraViewMatrix.js | UTF-8 | 4,763 | 2.765625 | 3 | [] | no_license | export function CameraViewMatrix() {
let ctx = {
matrix : null,
matrixHasChanged : false,
vectors : {
cameraPos : [0.0, 0.0, 0.0],
cameraFront : [0.0, 0.0, 0.0],
cameraUp : [0.0, 0.0, 1.0],
cameraTarget : [0.0, 0.0, 0.0],
cameraDire... | true |
1055e58e52d8b5db5926e767b0c767abe6a57e51 | JavaScript | consoleloghello/Publish-Subscribe | /Publish-Subscribe/login.js | UTF-8 | 1,667 | 2.71875 | 3 | [] | no_license | /*
*没有发布-订阅模式之前的代码是这样的
*/
login.succ(function(data){
header.setAvatar( data.avatar ); //设置登陆后的头像
nav.setAvatar( data.avatar ); //设置登陆后nav模块的头像
message.refresh(); //刷新消息列表
cart.refresh(); //刷新购物车列表
});
/*
*利用发布-订阅模式开发
*/
$.ajax('http:xxx.com?login', funct... | true |
a93c319e62df1d8270a724680ab7c273f4e8534a | JavaScript | manav809/RESTful-API | /app.js | UTF-8 | 4,056 | 2.671875 | 3 | [] | no_license | const express = require("express");
const bodyParser = require("body-parser");
const ejs = require("ejs");
const mongoose = require("mongoose");
const app = express();
app.set('view engine', 'ejs'); // ejs is initialized so that we could template html
app.use(bodyParser.urlencoded({extended: true}));//all... | true |
6758a278a9b984e862be2ffaa4ce1439c6d44b82 | JavaScript | lidannili/free-code-camp | /7. Intermediate Algorithm Scripting/19.Bonfire- Binary Agents.js | UTF-8 | 809 | 3.421875 | 3 | [] | no_license | // Return an English translated sentence of the passed binary string.
// The binary string will be space separated.
function binaryAgent(str) {
var myArray = str.split(" ");
var newArray = [];
for(var i=0;i<myArray.length;i++)
{
newArray.push(String.fromCharCode(parseInt(myArray[i],2)));
};
re... | true |
8c79bd3f009b8e9ef7a5581df6470c8c726429e6 | JavaScript | ogadev/Spacex-Lift-Off | /spacex/src/TimeLogic.js | UTF-8 | 1,182 | 2.734375 | 3 | [] | no_license | class Time {
getDate(data){
const dateObj = new Date(data * 1000);
var month = ["January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"][dateObj.getMonth()];
var day = dateObj.getUTCDate();
var year = dateO... | true |
53354ad813d2e14763742a9fc6dfd0ed51154242 | JavaScript | valoriedodge/react-bloc-chat | /src/App.js | UTF-8 | 3,470 | 2.546875 | 3 | [] | no_license | import React, { Component } from 'react';
import { Route, Link } from 'react-router-dom';
import * as firebase from "firebase";
import moment from 'moment';
import './App.css';
import config from './config/config';
import RoomList from './components/RoomList';
import MessageList from './components/MessageList';
fireb... | true |
ebe9f0092714859897c702ae87dd1443fde3cdcd | JavaScript | des04/des04.github.io | /TDBB/js.js | UTF-8 | 588 | 2.84375 | 3 | [] | no_license | function showEnglish()
{
var x = document.getElementById("english");
if (x.style.display != "block") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}
function showMath()
{
var x = document.getElementById("math");
if (x.style.display != "block") {
x.style.dis... | true |
425df36f07ccd8f7af33ae449392119dcbc76e3c | JavaScript | pogilvie/pogilvie_opt | /test.js | UTF-8 | 3,488 | 2.65625 | 3 | [
"MIT"
] | permissive | const
spawnsync = require('child_process').spawnSync,
chai = require('chai'),
assert = chai.assert,
expect = chai.expect,
should = chai.should(),
Program = require('./opt.js')
function captureStream(stream) {
let oldWrite = stream.write,
buf = ''
stream.write = function(chunk, e... | true |
83d0f6acba753f5eef2abd2bbaddf8fa43bf1d8d | JavaScript | MissYou-MA/gitbook-plugin-navigation | /assets/nav.js | UTF-8 | 1,232 | 2.71875 | 3 | [] | no_license |
require([
"gitbook"
], function(gitbook) {
var navigationConfig = {};
gitbook.events.bind("start", function(e, config) {
console.log('gitbook:start', config)
navigationConfig = config.navigation || {};
});
gitbook.events.bind("page.change", initNav);
function initNav() {
console... | true |
42064a0633b8ce7487e82b8e7afafa5495bdece0 | JavaScript | chenzhen1213/reactweb | /src/index.js | UTF-8 | 3,639 | 2.515625 | 3 | [] | no_license | //不是一个react组件,他是链接react与htnl模板的桥梁,所有的react组件最终都是由他进行渲染到html模板中 整个文件中引入了一个系统默认生成的组件APP,有index.js进行渲染。
import React from 'react';//import 是react的es6使用,就像我们在页面中用<script src="react.js"> 更多的使用import来引入js以及css文件
import ReactDOM from 'react-dom'; //ReactDOM是react的方法类
import { Router, Route, hashHistory } from 'react-router... | true |
0be8a4c2016a007c4acb568a7d5e0ac70a560ca7 | JavaScript | VaishnaviThamshetty/Berkadia_training | /week3/array_functions/shift.js | UTF-8 | 165 | 3.375 | 3 | [] | no_license | /*Example1
Removes the first element from an array and returns that element slice*/
var arr = [10, 1, 2, 3].shift();
console.log("Shifted value is : " + arr ) | true |
a1f530ffb11486d917e5de114f933ca6a6ab36ba | JavaScript | juliankyer/react-router4 | /src/createItem.js | UTF-8 | 765 | 2.5625 | 3 | [] | no_license | import React, { Component } from 'react';
export default class CreateItem extends Component {
constructor() {
super();
this.state = {
title: '',
body: ''
}
}
handleChange(e, title) {
this.setState({ [title]: e.target.value });
}
handleSubmit() {
this.props.submitForm(this.st... | true |