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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
b91b18a3024767239d2b478bd8a5450c2695d6fc | JavaScript | appliedblockchain/explorer-server | /server/model/blocks/blocks.spec.js | UTF-8 | 902 | 2.578125 | 3 | [] | no_license | 'use strict'
const { getBlocks } = require('.')
const TOTAL_BLOCKS = 100
const web3 = {
eth: {
getBlockNumber: jest.fn(async () => TOTAL_BLOCKS),
getBlock: jest.fn(async number => ({
number,
transactions: []
}))
}
}
describe('blocks.getBlocks()', () => {
it('returns an array', () => {
... | true |
0fdeef6414e7969154e2cc5182a84240a6644110 | JavaScript | zahinraidah/SWE4637 | /Test/App1/src/screens/BoxScreen.js | UTF-8 | 678 | 2.796875 | 3 | [] | no_license | import React, { useState } from "react";
import { Button, View } from "react-native";
const CreateRGB = () => {
let red = Math.floor(Math.random() * 255);
let green = Math.floor(Math.random() * 255);
let blue = Math.floor(Math.random() * 255);
let str = "rgb(" + red + "," + green + "," + blue + ")";
return ... | true |
0e169425934db64fe9bb4ff1e8f21b4256822e77 | JavaScript | evangelia-mitsopoulou/restaurant-menu | /src/components/organisms/Results/Results.jsx | UTF-8 | 1,214 | 2.6875 | 3 | [] | no_license | import React from 'react';
import styles from './results.module.scss';
import CoursesData from '../../../data/courses.json';
const menus = {
0: "Hors d'oeuvres",
1: "Soup",
2: "Fish",
3: "Salad",
4: "Main Course",
5: "Dessert"
}
class Results extends React.Component {
constructor(props) {
super(pr... | true |
dc9e93751e56a660dc79b7caa96805a508ca0e2c | JavaScript | yan358941877/react-todo | /src/components/TodoItem/index.jsx | UTF-8 | 3,886 | 2.625 | 3 | [] | no_license | import React from 'react'
import './style.css'
class TodoItem extends React.Component {
constructor(props) {
super(props)
this.state = {
content: this.props.data.content,
finish: this.props.data.finish,
delete: this.props.data.delete,
important: this... | true |
ba0121ddee11918f3ff6900fee55072615da0117 | JavaScript | rafajeff/calculadora-javascript | /content/js/script.js | UTF-8 | 1,083 | 4.15625 | 4 | [] | no_license | function calcular() {
var resultado = 0;
var numero1 = parseInt(document.getElementById('primeiroNumero').value);
var numero2 = parseInt(document.getElementById('segundoNumero').value);
var operacao = document.getElementById('tipoOperacao').value;
switch (operacao) {
case '+':
... | true |
c6ec0899148ea31a2ee1fea0aca2a2ed0dcbc09e | JavaScript | LeonardoKunkel/OMS-B | /Routes/representanteRoute.js | UTF-8 | 3,689 | 2.78125 | 3 | [] | no_license | const express = require('express'),
representanteModel = require('../Models/representanteModel'),
app = express();
// POST
app.post('/create', (req,res) =>{
let body = req.body;
let newData = {
nombre: body.nombre,
apellidos: body.apellidos,
telefono: b... | true |
c12f3e73f08dbb56b9b4b08bef64445664a74c43 | JavaScript | akaraatanasov/JS-Core | /JS Fundamentals/Expressions and Loops - Exercise/NowPlaying.js | UTF-8 | 149 | 2.71875 | 3 | [
"MIT"
] | permissive | function playing(arr) {
let[track, artist, duration] = arr;
console.log("Now Playing: " + artist + " - " + track + " [" + duration + "]");
} | true |
48bfb90e199c7ff7822def9256b0cc9358a3e18b | JavaScript | CaraMonica/techswitch-dynamite.js | /randomBot.js | UTF-8 | 1,068 | 3.5625 | 4 | [] | no_license | const moves = ["R", "P", "S", "D", "W"];
const nMoves = moves.length;
const nonDynamiteMoves = ["R", "P", "S", "W"];
const nNonDynamiteMoves = nonDynamiteMoves.length;
function randomMove() {
// Generate a random integer between 0 and 4 (the length of the moves array)
const randomInt = Math.floor(Math.random(... | true |
89225725d00f2b39f5d90e16a214435aac5da288 | JavaScript | 1501Anupam/Glimpse-of-JavaScript | /Section 1/script.js | UTF-8 | 3,358 | 3.65625 | 4 | [] | no_license | // Coding Challenge 1
const marksWeight = 78;
const marksHeight = 1.69
const johnsWeight = 92;
const johnsHeight = 1.95
let bmiOfMark = marksWeight / (marksHeight ** 2);
let bmiOfJohn = johnsWeight / (johnsHeight ** 2);
console.log(bmiOfMark, bmiOfJohn);
let markHigherBMI = bmiOfMark > bmiOfJohn;
console.log(markHig... | true |
72f6353a078d44fd1a4446095238ab879cfbc92e | JavaScript | live-change/db | /lib/AtomicWriter.js | UTF-8 | 9,749 | 3.125 | 3 | [] | no_license | function getProperty(of, propertyName) {
const path = propertyName.split('.')
let p = of
for(let part of path) p = p[part]
return p
}
function hasProperty(of, propertyName) {
const path = propertyName.split('.')
let p = of
for(let part of path.slice(0,-1)) p = p[part]
return p && p.hasOwnProperty(path[p... | true |
fa75a13f550cd94c95ee81797a09f75cdd70f9ea | JavaScript | brianloveswords/husort | /test/husort.test.js | UTF-8 | 472 | 2.5625 | 3 | [
"MIT"
] | permissive | const test = require('tap').test;
const husort = require('..');
const data = require('./data.json');
test('toBytes', function (t) {
t.same(husort.toBytes('1.0G bones'), husort.SIZES['G']);
t.same(husort.toBytes('1.0GRAPES'), 1.0);
t.same(husort.toBytes('1.0Klol'), 1.0);
t.ok(isNaN(husort.toBytes('some other th... | true |
c277425d246effcb62bf5990e084aa9dd0d6df88 | JavaScript | Seokkyu-Yoon/hobby | /hobby/node/programmers/level2/maximumAndMinimum.js | UTF-8 | 764 | 3.625 | 4 | [] | no_license | /**
* This function is called when check brackets are right.
* @param {string} s
* @return {string}
*/
function solution(s) {
const MAX_INTEGER = 2147483647;
const MIN_INTEGER = -2147483648;
const {max, min} = s.split(' ')
.map((value) => Number(value))
.reduce(({max, min}, value) => {
max... | true |
ce99e898f280e069b769089521942f322e2957b8 | JavaScript | Cizzyphus/jslibrary | /5-Expressions and Operators/03-callingFunctions.js | UTF-8 | 1,375 | 4.1875 | 4 | [] | no_license |
/*
function hi() {
console.log('Hi');
}
hi();
(1);
1- This is how we call, or 'invoke' our function
*/
function hi() {
console.log('Hi')
}
hi();
// Functions give us reusable chunks of code
console.log(hi());
function lol() {
for(let i=0; i<11;i+=1 ){
console.log(i);
}
}
lol();
... | true |
9cac19c69f9cb0d5d656a4a41074d760bfad59bb | JavaScript | Tejashr/student-mentor | /src/student.js | UTF-8 | 1,418 | 2.71875 | 3 | [] | no_license | import { useState } from "react";
import { PostStudentData } from "./api";
export default function Student() {
let [sname, setsname] = useState("");
let [age, setage] = useState("");
let userData ={sname,age}
return (
<>
<form onSubmit={async (e)=>{
e.prev... | true |
caf9f23af168ce16a43dc0caa7fe0b7a12f37d27 | JavaScript | avirat8497/CS546-Web-Programming | /lab_4/data/movies.js | UTF-8 | 3,762 | 2.859375 | 3 | [] | no_license | const mongoCollections = require('../config/mongoCollections');
const { ObjectId } = require('mongodb').ObjectID;
const movies = mongoCollections.movies;
function checkCreate(title,plot,rating,runtime,genre,cast,info){
if (typeof title !== 'string' || typeof plot !== 'string' ||
typeof rating!== 'string' || t... | true |
d4617b04cf26c68d058b3dc3c18477d095ec7316 | JavaScript | Jisha2008/virtual-2 | /food.js | UTF-8 | 936 | 3.078125 | 3 | [] | no_license | class Food{
constructor(){
this.foodStock = 20;
this.lastFed = 0;
this.x = 0;
this.image = loadImage("Milk.png");
}
updateFoodStock(food){
this.foodStock = food;
database.ref('/').update({
Food: food
});
}
getFoodStoc... | true |
867eb881ebd2791d45e63492357cc7a041b2d4c4 | JavaScript | lebrowley/shelfie | /src/Components/Form/Form.js | UTF-8 | 4,308 | 2.921875 | 3 | [] | no_license | import React, { Component } from 'react';
import axios from 'axios';
class Form extends Component {
constructor() {
super()
this.state = {
name: '',
price: 0,
imgurl: '',
editProductId: null
}
this.componentDidUpdate = this.c... | true |
dab7a4c1e64e0560fb1c19d01600c92bfb82ac1b | JavaScript | ChunYaoChang/Web-Programming | /hw4/review/1/src/components/Header.js | UTF-8 | 807 | 2.78125 | 3 | [] | no_license | import React from "react";
import "./Table.css"
export default function Header(props) {
const start = 'A';
const headerCharacter = (index) => {
let string = "";
let a = index;
if (a == 0) {
return String.fromCharCode(start.charCodeAt(0));
}
while (a != 0) {
... | true |
a8610b122cb68e215215caf459204a93b60f03ff | JavaScript | zdsmit/fewpjs-removing-altering-and-inserting-html-lab-online-web-sp-000 | /index.js | UTF-8 | 301 | 3.359375 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // Write your code here!
let body = document.querySelector("body")
body.removeChild(body.querySelector("main"))
let newHeader = document.createElement('h1')
body.appendChild(newHeader)
newHeader.setAttribute("id", "victory")
document.querySelector('h1#victory').innerHTML = "YOUR NAME is the champion" | true |
eac1c246c66eba5186d2217fdf417e8c66f61665 | JavaScript | hwadn/web-projects | /百度前端技术学院/JS练习/7精明小卖家/2pillar/dataProcess.js | UTF-8 | 746 | 2.953125 | 3 | [] | no_license | //归一化
function dataNormal(sourceData){
//取最大值
var dataMax=0;
for(i in sourceData){
var iMax=Math.max.apply(Math,sourceData[i].sale);
if(dataMax<iMax){
dataMax=iMax;
}
}
//纵坐标刻度最高值
var yMax=ceilRound(dataMax);
//归一化后折算
var dataPx=[];
for(i in sourceData){
var iPx = [];
for(j in sourceData[i].sale){... | true |
db3bcaa4229e5201329690ff46f6dd8c32a3e830 | JavaScript | JosueCesar/gerenciadorbiblioteca | /src/database/index.js | UTF-8 | 1,086 | 2.640625 | 3 | [] | no_license | const Sequelize = require('sequelize');
const databaseConfig = require('../config/database');
const models = [
require('../app/models/Livro'),
require('../app/models/Usuario'),
require('../app/models/Emprestimo'),
require('../app/models/Reserva'),
];
class Database {
constructor(){
this.init();
}
in... | true |
7131173ebcd5ba69682603245908d67b68c833fb | JavaScript | whos-bhdn/HomeWork4-JS- | /index.js | UTF-8 | 4,327 | 4 | 4 | [] | no_license |
// !TASK#1
// Пароль і 4 спроби. Завдання виконуємо через while або do while.
// 1. Запросити у користувача пароль!
// 2. Якщо пароль не вірний повідомити що залишилось 4 спроби!
// - якщо далі невірні паролі спроби зменшуються.
// - коли спроб вже нема вивести повідомлення: "Будь ласка спробуйте пізніше!".
// 3. Якщ... | true |
19e844d37ce82d995770eab0147b0d05884318ba | JavaScript | kamp-placeholders/header-photos | /images/img-generator.js | UTF-8 | 1,151 | 2.703125 | 3 | [] | no_license | const path = require('path');
const Promise = require('bluebird');
const fs = Promise.promisifyAll(require('fs'));
const request = require('request');
const sprintf = require('sprintf-js').sprintf;
const imageDir = 'images'; // make this directory prior to running, otherwise it will throw an error
const runs = 15; // ... | true |
a6cebb983ddddb21819a6d809e668bff7607a879 | JavaScript | pkiop/threejs | /withReact/threejs/src/App.js | UTF-8 | 2,970 | 2.609375 | 3 | [] | no_license | import * as THREE from 'three';
import { useRef, useState, useEffect } from 'react';
import * as dat from 'dat.gui';
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
function App() {
const gui = new dat.GUI();
const mount = useRef();
const path = 'http://localhost:3030/deskma123t.glb';
u... | true |
f40c61a342b4e19fdb5e3802e96e2cb99a1f61b6 | JavaScript | kareemlashin/learn-js | /js/4-if-else.js | UTF-8 | 767 | 3.40625 | 3 | [] | no_license | let time=5;
if (time > 1 && time < 5 ) {
console.log("Good morning");
} else if (time > 5 && time < 9) {
console.log("Good after noon");
} else if (time > 9){
console.log("Good evening");
}
let name="kareem";
let password="123";
if(name=="ahmed" || password=="123")
{
c... | true |
4bbd90d81a6412af576cabd7082a68551080de32 | JavaScript | jociemoore/javascript_practice | /210_exercises/easy5/double_char2.js | UTF-8 | 496 | 3.640625 | 4 | [] | no_license |
function doubleConsonants(str) {
var chars = str.split('')
chars = chars.map(function (char) {
if (char.match(/[^aeiou0-9\W_\s]/i)) {
char = char + char;
}
return char;
});
return chars.join('');
}
console.log(doubleConsonants('String')); // "SSttrrinngg"
console.log(doubleConso... | true |
fcd6ee8a09cd1a23f77b923e240239b867793303 | JavaScript | Teranya/USKeys | /sketch.js | UTF-8 | 7,829 | 2.90625 | 3 | [] | no_license | var pressMotionTime = 0;
var prevKeyIsPressed = false;
var prevKey;
var sensor1;
var sensor2;
var sensor3;
var serial; // variable to hold an instance of the serialport library
var options = {
baudRate: 9600
};
// variables for calculating easing
let y = 0;
let easing = 0.05;
//for fft
var volhistory = [];
fu... | true |
242a9b193b78616800e06e66ae4e8c007029db94 | JavaScript | aaptacy/BookStore | /frontend/js/authors.js | UTF-8 | 5,421 | 2.6875 | 3 | [] | no_license | $(function(){
var authorsList = $("#authorsList");
var formElement = document.querySelector('#authorAdd');
var authorEditSelect = $("#authorEditSelect");
function showAuthor(elem){
var html = $('#authorsList').html() + '<li class="list-group-item" data-id="'+elem.id+'"><div class="panel pa... | true |
8d6b1ae4582c9f5f350c504aac6ad1a292456408 | JavaScript | zhemeduogewangtianyi/document | /基础/stuenroll/WebRoot/js/user.js | UTF-8 | 1,519 | 2.59375 | 3 | [] | no_license | var isSelectAll = false;
function selectAll() {
isSelectAll = !isSelectAll;
document.getElementById("btn_1").value = (isSelectAll == true ? '取消' : '全选');
var array = document.getElementsByName("userId");
for (i = 0; i < array.length; i++) {
array[i].checked = isSelectAll;
}
}
function deleteUser(id) {
... | true |
869587cf9aa00c9f3f4f2cb377a2ca46deeca74f | JavaScript | leandrasilver/reactanddata | /src/components/App.js | UTF-8 | 1,209 | 2.59375 | 3 | [] | no_license | import React from 'react';
import './App.css';
import Table from './Table';
import Navigation from './Navigation';
import Search from './Search';
import TableButtons from './TableButtons';
const APIurl = "https://gist.githubusercontent.com/espinet/922527b7ea1606127f7dba413a911937/raw/245370f480934a50eb3fa68891fc9476cce... | true |
26b8bd9480fc62ac6ee7d5f6382f4217aa09b7da | JavaScript | gaoyanglol/threejs-demo | /js/train.js | UTF-8 | 2,840 | 2.6875 | 3 | [] | no_license | // import * as THREE from './vendor/three/three.js';
// import * as GLTFLoader from "./vendor/three/GLTFLoader";
let container;
let scene;
let camera;
let renderer;
const mixers = [];
const clock = new THREE.Clock();
function init() {
container = document.querySelector('#scene-container');
scene = new THREE.Scene... | true |
6273e841b6f2047e727cfa6a6161666d83d06c0e | JavaScript | Akinoriv/navigation-thesis | /index.js | UTF-8 | 827 | 3.3125 | 3 | [] | no_license | // длина от датчика до приемника
// var sensorsLength = {
// sens1 = "",
// sens2 = "",
// sens3 = ""
// };
var x = {
a: 0,
b: 18,
c: 7.5
};
var y = {
a: 0,
b: 0,
c: 16
};
var z = {
a: 28.5,
b: 0,
c: 27
};
const readline = require('readline')
function test() {
l... | true |
cbdbaf6d39c7a32f10cbb3c951474e03ebb25cec | JavaScript | AhmedSamehh/Bookmarker | /index.js | UTF-8 | 2,710 | 3.296875 | 3 | [] | no_license | var siteNameInp = document.getElementById("siteName");
var siteUrlInp = document.getElementById("siteURL");
var addBtn = document.getElementById("addBtn");
var alertContainer = document.getElementById("alertContainer");
var sitesContainer;
if(localStorage.getItem("sitesContainer") == null)
{
sitesContainer... | true |
357438895ec3a1a627ac0fee84d4d1069285a088 | JavaScript | samridhi18/JavaScript-Projects | /currency-converter/script.js | UTF-8 | 933 | 3.03125 | 3 | [] | no_license | const currency__buttons = document.getElementById('currency__buttons');
const usdvalue = document.getElementById('usdvalue');
const resultInput = document.getElementById('result');
currency__buttons.addEventListener('click',function(event){
const button = event.target;
const currencyId = button.getAttribute('da... | true |
e26739e486768f6e9e873565fa25e46b39d7cc83 | JavaScript | Mas-Studio/Weapon-and-Wizardry | /WeaponAndWizardry/WeaponAndWizardry/Scripts/mainmenu.js | UTF-8 | 1,793 | 2.640625 | 3 | [] | no_license | //Author: Jia Qi Lee (George) Date: 2017-12-08
openSoundPlayer();
var sessionid = getCookie("sessionid");
localStorage.setItem("soundLoaded", "false");
localStorage.setItem("sessionid", sessionid);
var soundLoaded = localStorage.getItem("soundLoaded");
var elapsed = 0;
var percentText = document.getElementById('perce... | true |
5598547c79c2648a388d1af8a299f24494fd6f21 | JavaScript | MITZHANG/JVMByNodeJS | /src/develop_code/native/java/lang/Float.class.js | UTF-8 | 1,057 | 2.53125 | 3 | [] | no_license | /**
* @author: HuRuiFeng
* @file: Float.class.js
* @time: 2019/10/20 13:35
* @desc: java.lang.Float类
*/
const struct = require('python-struct');
const register = require("../../Registry.class").register;
/**
* public static native int floatToRawIntBits(float value);
(F)I
* @param frame
*/
function floatToRaw... | true |
fd77d74ed6c4fbf4b4a363f84f95821641480ec9 | JavaScript | sagarguptanp/firstrepo | /javascript/practice/25_objects.js | UTF-8 | 287 | 2.890625 | 3 | [] | no_license | var person = new Object();
person["firstName"] = "John";
person["lastName"] = "alicea";
var firstNameProperty = "firstName";
console.log(person[firstNameProperty]);
console.log(person["lastName"]);
person["address"] = {Line1 : "Dixitpura",Line2 : "jabalpur"};
console.log(person);
| true |
2d862a59d92e74e690f2476a4bbbad1e9115758c | JavaScript | vergilius/js-tetris2 | /src/js/pixi_helpers.js | UTF-8 | 846 | 2.53125 | 3 | [] | no_license | import {getAssets} from './assets';
// import {getTime} from './time';
export const preloadAssets = callback => {
PIXI.loader
.add(getAssets().map(asset => asset.path))
.load(callback);
};
// let previous = 0;
export const gameLoop = (renderer, scene, _Tetris) => {
// ah, actually I don't use delta time t... | true |
c9d98d5525cb291622331f4396c83f865ae11b23 | JavaScript | colomolo/20questions | /src/components/AnswerButtons/AnswerButtons.js | UTF-8 | 726 | 2.640625 | 3 | [] | no_license | import React, { Component } from 'react'
class AnswerButtons extends Component {
constructor(props) {
super(props)
this.sendYes = this.sendYes.bind(this)
this.sendNo = this.sendNo.bind(this)
}
get latestQuestion() {
if (!this.props.questions.length) return false
const lastQuestion = this.p... | true |
e8754788c9e96e73173776265e146a616d14a52c | JavaScript | marku123/LegalMappingTool_Dev | /target/LegalMappingTool_Dev/js/pages/datacollection/oldversions/datacollection2_sep5.js | UTF-8 | 35,153 | 2.671875 | 3 | [] | no_license | //If a rights group has not been selected by the user, ensure the rest of the page is empty.
$(document).ready(function() {
var index = document.getElementById("personofconcernselect").selectedIndex;
if (index == 0) {
$("#allquestions").hide();
}
});
/*
* ******************* Internation... | true |
efdaa0ea40ab517aef4ba789c3b927fce2ac347d | JavaScript | Eymric/examen_nodejs_m1_dev_hitema_2020 | /io/io.js | UTF-8 | 605 | 2.71875 | 3 | [] | no_license | const fs = require('fs');
module.exports.decodeHexFileContent = (filePath) => {
return new Promise((resolve, reject) => {
// To be implemented!
let stream = fs.createReadStream(filePath);
stream.on("data", function(data) {
let chunk = data.toString();
const convert... | true |
c2debe15df52ba0ccb382543cc99ded7ea58bdb4 | JavaScript | katiemgray/kawaii-react | /src/Home.js | UTF-8 | 669 | 2.6875 | 3 | [] | no_license | import React, { Component } from 'react';
import { Mug } from 'react-kawaii';
// import './Home.css';
class Home extends Component {
constructor(props){
super(props)
this.state = {
moods: ["sad", "shocked", "happy", "blissful", "lovestruck", "excited", "ko"]
}
this.randomMood = this.randomMood.... | true |
f01c17787ec75f648d979d8a49bb84422dcd35b8 | JavaScript | kstreich/frog-racing | /app/components/raceService.js | UTF-8 | 562 | 2.8125 | 3 | [] | no_license | import User from "../models/user.js";
import Frog from "../models/frog.js";
let _racers = []
let _user = new User()
export default class RaceService {
constructor() {
console.log("race service working")
}
addFrog(frogData) {
let frog = new Frog(frogData)
_racers.push(frog)
}
getRacers() {
retu... | true |
e85bbb6b1aed6ea746fafae136cae08d2892c163 | JavaScript | ZaprevD/e-commerce | /client/src/Components/CartComponents/Partials/CartInfo.js | UTF-8 | 1,266 | 2.609375 | 3 | [] | no_license | import React, { useEffect, useState } from "react";
import axios from "axios"
import CartItems from "./CartItems";
const CartInfo = (props) => {
const currentUser = JSON.parse(localStorage.currentUser);
const token = "Bearer " + currentUser.token;
const [cartItems1, setCartItems1] = useState([]);
cons... | true |
2553d59dad4d0553486361fc9d83ba33b5a26040 | JavaScript | ezwang/card-game | /simulate.js | UTF-8 | 3,306 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env nodejs
var path = require('path');
var sinon = require('sinon');
var constants = require('./public/js/constants.js');
var Player = require('./player.js');
var Game = require('./game.js');
if (process.argv.length < 4) {
console.log(`Usage: ${process.argv[0]} ${process.argv[1]} <bot 1 script> <bot 2... | true |
930c8a0c896ceeebadf19aa922e30f7d08c4a45d | JavaScript | BAT6188/bo | /2s/web/src/main/webapp/js/txnbase.js | UTF-8 | 4,140 | 2.515625 | 3 | [] | no_license | ;(function () {
$().ready(function () {
//车牌号//车主姓名、手机号/用品配件品名(简写缩写)/
// $("#vehicleNumber").focus( function () {
// if ($("#vehicleNumber").val() == "车牌号") {
// $("#vehicleNumber").val("");
// $("#vehicleNumber").css("color", "#000000");
// }
... | true |
6efda6277db7b330130be8854afd9dd73f817aed | JavaScript | chinadbo/web-front-end | /professional javascript for web development/21.Ajax.Comet.js | UTF-8 | 9,279 | 3.140625 | 3 | [] | no_license | /**
* XMLHttpRequest
*/
function createXhr() {
if(typeof XMLHttpRequest != undefined){
return new XMLHttpRequest()
}else if(typeof ActiveXObject != undefined){
// < IE 7
if(typeof arguments.callee.activeXString != 'string'){
var versions = ['MSXML2.XMLHttp.6.0', 'MSXML2.XM... | true |
29448692cb07d1ce3ce001e79b53f0c35ea9cf94 | JavaScript | colin92/hexo_mailer | /hexo_mailer_replace.js | UTF-8 | 927 | 2.859375 | 3 | [] | no_license | var fs = require('fs');
var csvFile = fs.readFileSync('friends_list.csv','UTF-8');
var emailTemplate = fs.readFileSync('email_template.html', 'UTF-8');
function csvParse(csvData) {
var parsed_data;
var csv_lines = csvData.split('\n');
var contact_info_list = [];
for(i in csv_lines.slice(1,csv_lines.length-1))... | true |
e975219cd260c08bbd9743d76d5ddef2292c61f9 | JavaScript | AlyxMoon/advent-of-code-2020 | /src/solutions/day3.js | UTF-8 | 1,559 | 3.59375 | 4 | [] | no_license |
class SnowMap {
grid = []
width = 0
height = 0
constructor (stringInput = '') {
this.createGridFromInput(stringInput)
}
createGridFromInput (stringInput) {
this.grid = stringInput.replace(/\s+/g, '')
this.height = stringInput.trim().match(/\s+/g).length + 1
this.width = this.grid.length /... | true |
648a08fa46816d0318c320b8566a0f72f3a74815 | JavaScript | ZKeLin/Miscellaneous | /Algorithm/Documents/tree/二叉树的层次遍历II.js | UTF-8 | 878 | 3.25 | 3 | [] | no_license | /**
* https://leetcode-cn.com/problems/binary-tree-level-order-traversal-ii/
*/
const TreeNode = require('./TreeNode');
function levelOrderBottom(root) {
if(!root) {
return [];
}
let levelOrder = [];
let queue = [ root ];
while(queue.length > 0) {
let levelSize = queue.length;
let level = [];
... | true |
0b6c435c3e2d88bdff1bef5bb5ea5f33a0e55005 | JavaScript | DArena3/Web | /[DEPRECATED] cookies.js | UTF-8 | 8,912 | 2.96875 | 3 | [
"MIT"
] | permissive | var chats = new Array();
var connIP = "";
var connPort = "";
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
var expires = 'expires=' + d.toUTCString();
document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/';... | true |
7b4dcebc79d263a382db1d2e4278f7fda500439a | JavaScript | flvanroekel/web-340 | /Week 4/json-api/vanroekel-exercise-4.2.js | UTF-8 | 849 | 2.6875 | 3 | [] | no_license | const header = require('../../Vanroekel-header.js')
console.log(header.display("Faye", "Van Roekel", "Exercise 4.2"));
/*
============================================
; Title: vanroekel-assignment-4.2.js
; Author: Faye Van Roekel
; Date: 31 August 2019
; Description: json-api
;==============... | true |
21ed1dcf26aa27656f1605b9dfc88e07ed5ab880 | JavaScript | may-arden/stagegram | /frontend/src/operaApi.js | UTF-8 | 1,350 | 2.984375 | 3 | [] | no_license | const titleInput = document.querySelector("#opera-title")
const directorInput = document.querySelector("#opera-director")
const descriptionInput = document.querySelector("#opera-description")
const imgSrcInput = document.querySelector("#opera-img-src")
class OperaApi {
constructor(port){
this.baseUrl = `$... | true |
cc471b35e4b87486503d174fac2f99e50427f3da | JavaScript | liveqmock/projectYNW | /public/module/zoomImg.js | UTF-8 | 1,004 | 2.53125 | 3 | [] | no_license | /**
* 放大图片
var zoom = require('zoomImg.js')
zoom.get().render('/public/image/*.jpg')
*/
require('./zoomImg.css')
module.exports = function() {
var instance
var create = function() {
var body = $('body');
var tag = `<div id="ynPopImageOverlay">
<div id="ynPopIma... | true |
bdd5c3b2d4354aca49175ffe76149e8dd0ed618e | JavaScript | Pieces312/test | /src/Components/connect/Html/index.js | UTF-8 | 4,750 | 2.671875 | 3 | [] | no_license | import React, { Component } from 'react'
import "./index.less";
import { Card, Divider } from 'antd';
export class HtmlSemantics extends Component {
render() {
return (
<Card>
<Card
className="infos"
type="inner"
title="HTML的语义化"
>
<p>一般要了解一个东西,从三方... | true |
199e8075ee783ad1771110e533f706e47e729854 | JavaScript | WepProglam/Trabel | /server.js | UTF-8 | 1,024 | 2.640625 | 3 | [] | no_license | var express = require('express');
var app = express();
var router = require('./router/main')(app);
//views(보이는 것)의 기본 주소를 /mnt/c/Users(혹은 본인 이름)/USER/Desktop/trabel/views로 하겠다고 설정
//따라서 router/main.js에서 보면 html파일을 로드할때 1_trabel.html로 간단히 로드
app.set('views', __dirname + '/views');
//ejs라는 html 해석하는 툴이 있나봄
... | true |
d1749a53635f4da86f8cf17c528ce3df9bb43be6 | JavaScript | zhuchangzhou/zhuchangzhou.github.io | /sc/js/login.js | UTF-8 | 2,590 | 2.671875 | 3 | [] | no_license | /**
* Created by duodi on 2017/11/15.
*/
var cliH;
function getH(){
return window.innerHeight||document.body.clientHeight;
}
cliH=getH();
var body=document.querySelector("body");
var section=document.querySelector("section");
body.style.height=cliH+"rem";
section.style.height=cliH-1.32+"rem";
var flag3=false;
/... | true |
28f345ba145e5747fd3bb88a79f77e71513fb527 | JavaScript | Voltra/jq-flash | /src/flash.js | UTF-8 | 2,892 | 2.6875 | 3 | [
"MIT"
] | permissive | const flashInstaller = ($ => {
$(document).ready(() => {
//////On first DOM load
$(".flash").click(function(){
const $this = $(this);
$this.addClass("flash-folded");
setTimeout(
() => $this.remove(),
2000//wait 2s before rem... | true |
93558cf563d9bc68a42fd2a26f8bd18745a0879a | JavaScript | future4code/Frank-Castro | /semana14/aula-41/exer-2/index.js | UTF-8 | 427 | 3.703125 | 4 | [] | no_license | const numberUne = Number(process.argv[2]);
const numberTow = Number(process.argv[3]);
const operacao = process.argv[4]
let result = 0
switch(operacao){
case "add":
result = numberUne + numberTow
break;
case "sub":
result = numberUne - numberTow
break;
case "mult":
result = numberUne * numberTow
bre... | true |
2bd7d47c377fe4044fd2f7074e923b7474a0e65a | JavaScript | FullHuman/purgecss-from-js | /index.js | UTF-8 | 1,581 | 2.8125 | 3 | [] | no_license | import * as esprima from 'esprima';
export default function extract(content) {
const tokens = esprima.tokenize(content);
let selectors = tokens
.filter(token => {
return (
token.type === 'Identifier' ||
token.type === 'Template' ||
token.type ... | true |
f8047d282d3d5ca276e6a2ea03989fa666b9e5b2 | JavaScript | teejays/talha.io | /assets/pi.imgloaded.js | UTF-8 | 1,254 | 2.9375 | 3 | [] | no_license | // $('img.photo',this).imagesLoaded(myFunction)
// execute a callback when all images have loaded.
// needed because .load() doesn't work on cached images
// mit license. paul irish & andreé hansson. 2010.
// callback function is passed the last image to load
// as an argument, and the collection as `this`
// Add... | true |
5b2f1eed6d2d1b09999039ccfb0ff376089e6d81 | JavaScript | 0948466/198809-gllacy-1 | /js/script.js | UTF-8 | 3,933 | 2.6875 | 3 | [] | no_license | var linksearch = document.querySelector(".search");
var popupsearch = document.querySelector(".modal-content-search");
var formsearch = popupsearch.querySelector(".modal-search-form");
var search = popupsearch.querySelector(".modal-search");
linksearch.addEventListener("click", function (event) {
event.preventDe... | true |
b2bb1e68b457039ea45d5f9a014a42288226b39c | JavaScript | josealfredojimenezgarcia/Sintaxis_JavaScript_02_07_2021 | /main.js | UTF-8 | 1,969 | 3.65625 | 4 | [] | no_license |
nombreString = `José Alfredo Jiménez García`;
edadNumber = 45;
soyEstudianteBoleano = true;
estudiantesAprobadosDiplomadoNull = null;
cocerUndefined = undefined;
hobbiesArray = ["Programar","Leer", 3114288938, null];
hobbiesArray["Soy Estudiante"] = soyEstudianteBoleano;
dirrecionPersonalObjecte = {
dirrecion: "C... | true |
9f68618d6b74ade08a5460639c51b4dbfa502597 | JavaScript | imatveev/js-basic | /Exercises/closures/closures.js | UTF-8 | 496 | 3.4375 | 3 | [] | no_license | const user = {
name: 'Test',
surname: 'Testing',
};
function greetUser(user, getNameFunc) {
return `I am happy to see you ${getNameFunc(user)}`;
}
/**
* @param field - name of property in object
*/
const getGreetNameByField = (field) => {
};
//wrap in console log to check
greetUser(user, getGreetNameByField(... | true |
a57f790b4ed72ce2b486ca6e88a58209abb0d2ba | JavaScript | ju1234/blog-app-interface | /sql/selectData.js | UTF-8 | 859 | 2.71875 | 3 | [] | no_license | /**
* 文件说明: 数据查询
* 详细描述:
* 创建者: JU
* 时间: 2017/1/5.
*/
let connection = require('./createConnect');
function selectData(target, table) {
return new Promise((resolve, reject) => {
const url = dataProcessing(target, table);
connection.query(url, function (err, res) {
console.log(url);
if (err) ... | true |
0b6524bfb39fac257d2248b55dccb529cfc9dce3 | JavaScript | cleancoindev/WT-Hackathon-Emergency-Shelter | /src/components/TabBar/Tabs/Tabs.js | UTF-8 | 2,421 | 2.546875 | 3 | [
"MIT"
] | permissive | // Import React Modules
import React, { Component } from 'react';
import { withRouter } from 'react-router-dom';
import { drizzleConnect } from 'drizzle-react';
import PropTypes from 'prop-types';
// Import Redux
import { bindActionCreators } from 'redux';
import { setSelectedTab } from '../../../redux/actions';
// Im... | true |
2f745c58098614b4bccf884f3844836833db2f14 | JavaScript | Linh91/ctm | /airport_js/src/airport.js | UTF-8 | 283 | 2.75 | 3 | [
"MIT"
] | permissive | function Airport(weather) {
this._plane = [];
};
Airport.prototype.land = function(plane) {
this._plane.push(plane);
};
Airport.prototype.takeOff = function(plane, weather) {
if (weather) {
throw 'Plane can not take off!';
}
else {
this._plane.pop(plane);
}
};
| true |
f27c564b3d591c9d9ff0a32a866cd55341583e08 | JavaScript | katyeh/busker | /react-app/src/store/reducers/trackReducer.js | UTF-8 | 230 | 2.5625 | 3 | [] | no_license | export const GET_TRACKS = 'GET_TRACKS'
const trackReducer = (state = [], action) => {
switch(action.type) {
case GET_TRACKS:
return action.tracks;
default:
return state;
}
};
export default trackReducer;
| true |
2ed7dd21045e884286b41c787c4d23a6a01c1cfc | JavaScript | carmenansio/jugant-amb-p5js | /exemples/3.2_randomWalker.js | UTF-8 | 722 | 3.609375 | 4 | [] | no_license | var x
var y
function setup () {
createCanvas (640,360);
background(255);
x=width/2 //x comença a la meitat de la pantalla
y=height/2 //y comença a la meitat de la pantalla
}
//dibuixa el nuestre cami aleatori a la pantalla
function walker () {
ellipse(x,y,30,30); //cap
line (x,y+15,x,y+45); //cos
line(x,y+30,x-10,y+15)... | true |
cc1c812bab1ad6e0499ab8c41a0d5f33b2e9febe | JavaScript | chrisblum/random-a11y-nn | /get-vote-data.js | UTF-8 | 618 | 2.875 | 3 | [
"MIT"
] | permissive | var got = require('got')
var fs = require('fs')
var page = process.argv.slice(2)[0]
function getVoteData () {
var combos = JSON.parse(fs.readFileSync('data.json', 'utf8'))
var promise = got('http://randoma11y.com/combos?per_page=100&page=' + page)
.then(function (response) {
var body = JSON.parse(respo... | true |
bf590df4fbe1e12d91ca3f67d14be733f50942ce | JavaScript | Feliciter/simpletasks | /task1/javascript.js | UTF-8 | 345 | 3.578125 | 4 | [] | no_license | ////
//
Function.prototype.delay = function(ms) {
var fn = this;
return function() {
setTimeout(fn, ms);
};
};
var foo = function () {
alert( "bingo!" )
}
function bar() {
alert( "Wow!" )
}
var fooDelayed = foo.delay(300);
var barDelayed = bar.delay(600);
fooDelayed(... | true |
a477532a2ef46d2462b344d7b31ae8e366f41f12 | JavaScript | Jacobsmi/CustomerTracker | /client/pages/signup.js | UTF-8 | 3,166 | 2.734375 | 3 | [] | no_license | import styles from "../styles/Signup.module.css";
export default function Signup() {
const processSignUp = async () =>{
document.getElementById("nameErrors").innerHTML = ""
document.getElementById("emailErrors").innerHTML = ""
document.getElementById("passwordErrors").innerHTML = ""
document.getElem... | true |
b046b9efa600f9e866eb566a5c7af80e7f79b658 | JavaScript | amejiarosario/dsa.js-data-structures-algorithms-javascript | /src/data-structures/custom/lru-cache.spec.js | UTF-8 | 2,902 | 3.09375 | 3 | [
"MIT"
] | permissive | const LRUCache = require('./lru-cache-3');
describe('LRU Cache', () => {
let c;
describe('#constructor', () => {
it('should initialize', () => {
c = new LRUCache();
expect(c).toBeDefined();
});
it('should initialize with capacity', () => {
c = new LRUCache(7);
expect(c.capacit... | true |
1bb5499e916769e51c53b26021c6278a8c3eafd9 | JavaScript | featherfeet/FilamentController | /static/scripts/index.js | UTF-8 | 1,547 | 2.53125 | 3 | [] | no_license | const app = {
data: function() {
return {
computer_control: true,
active_users: 0,
filament_status_message: ""
};
},
methods: {
filamentOn: function() {
var self = this;
axios.get("/filament-on").then(function(response) {
self.filament_status_message = response.data;
})
.catch(function... | true |
1bbce90e9c26b7a67861f8a64dddda567725c497 | JavaScript | djavrell/botdl | /src/downloader.js | UTF-8 | 1,439 | 2.53125 | 3 | [] | no_license | const debridLink = require('./linkManager').debridLink;
const nextLink = require('./linkManager').nextLink;
const out = require('./linkManager').setOutput;
const handleError = require('./utils/utils').handleError;
const wget = require('wget-improved');
const status = require('node-status');
function downloader(cleane... | true |
7481b2efadfb6026490eb7fffaf022eb1b0c19ed | JavaScript | potor10/Nozomi-Bot | /commands/gacha/characters.js | UTF-8 | 2,564 | 2.84375 | 3 | [] | no_license | module.exports = {
name: 'characters',
aliases: [],
category: 'Gacha',
utilisation: '{prefix}characters <page number>',
description: 'View the characters you have obtained from gacha.',
adminonly: false,
async execute(client, message, args) {
const { MessageEmbed } = require(... | true |
fc5d966a741aeaa70c2b5805d4f85c6af36a0b0e | JavaScript | jasonj85/playground-javascript | /picture-in-picture/script.js | UTF-8 | 630 | 2.953125 | 3 | [] | no_license | const videoEl = document.getElementById('video');
const btn = document.getElementById('button');
// prompt to choose the media stream
async function selectMediaStream() {
try {
const mediaStream = await navigator.mediaDevices.getDisplayMedia();
videoEl.srcObject = mediaStream;
videoEl.onlo... | true |
2eb708cd15e3dbb397b3414f342aaf5df3b63117 | JavaScript | biyanisuraj/memex-dossier-open | /memex_dossier/web/static/v1/deps/SortingQueue.js | UTF-8 | 36,269 | 2.671875 | 3 | [
"MIT"
] | permissive | /**
* @file Sorting Queue component.
* @copyright 2014 Diffeo
*
* @author Miguel Guedes <miguel@miguelguedes.org>
*
* Comments:
*
*
*/
/*global jQuery, define */
/*jshint laxbreak:true */
/**
* The Sorting Queue module.
*
* @returns an object containing class constructors.
* */
var SortingQueue_ = func... | true |
d496a7552012d37b05704e7817fe6e71cc1ec208 | JavaScript | mkyaw6/code-collaborate | /backend/index.js | UTF-8 | 948 | 2.890625 | 3 | [] | no_license | //initializing
const express = require('express'),
app = express(),
port = process.env.PORT || 4000;
//socket.io initializing
const socket = require('socket.io');
//server setup
const server = app.listen(port, function(){
console.log("APP IS RUNNING ON PORT " + port);
})
//socket connection
const io = so... | true |
268c04a90727a2110449a39f4839b17930803b94 | JavaScript | zouzhenyu-star/zzy_fullstack | /leetcode/202快乐数/1.js | UTF-8 | 410 | 3.71875 | 4 | [] | no_license | /**
* @param {number} n
* @return {boolean}
*/
var isHappy = function(n) {
var sum,
count = 50; // 最多循环50次
while (count >= 0) {
var remainder; // 余数
sum = 0;
while (n !== 0) {
remainder = n % 10;
sum += remainder * remainder;
n = parseInt(n / 10);
}
if (s... | true |
e9e6ac53c23768fa2ffe6bc2b099329082450dc3 | JavaScript | brothernew-br/santander | /fatorial.js | UTF-8 | 246 | 3.84375 | 4 | [] | no_license | function fatorial(numero){
let resultado = numero;
if(numero == 0){
return 1;
}else{
for (let i = 1; i < numero; i++){
resultado = resultado * i;
}
}return resultado;
}
console.log(fatorial(0)); | true |
46b238b5daf37e3f28e9261d9112a5179e2c16d0 | JavaScript | miaochin/API-with-JavaScript | /recipe-app/app.js | UTF-8 | 2,640 | 3.4375 | 3 | [] | no_license | // API: https://www.themealdb.com/api.php
const searchBtn = document.getElementById('search-button');
const searchText = document.getElementById('search-text');
const recipeList = document.querySelector('.recipe-list');
searchBtn.addEventListener('click', () => {
searchName(searchText.value);
})
searchText.addEv... | true |
f731ce98c2928bbe2a46c74793a9ca9d3cee5227 | JavaScript | briandicola/karate-scheduler | /serverless-project/index.js | UTF-8 | 29,743 | 2.6875 | 3 | [] | no_license | /* eslint-disable func-names */
/* eslint-disable no-console */
const Alexa = require('ask-sdk');
const activities = require('./activities');
const students = require('./students');
const scheds = require('./schedules');
const classes = require('./belt-age-class');
const belts = require('./belt-ranges');
const ages ... | true |
f03b410d72ca2c3ee0ab568db72b1b8fc25d9cc1 | JavaScript | fossabot/ppc-vr-tour | /js/index.js | UTF-8 | 439 | 2.640625 | 3 | [] | no_license |
// add clickble class to a-enities of main scene.
AFRAME.registerComponent('starting-scene', {
schema: {
scene: {default: 'sceneMain'}
},
init: function () {
let sceneToLoad = document.getElementById(this.data.scene);
sceneToLoad.object3D.visible = true;
let entity = document.querySelectorAll('#' + scen... | true |
37d5f7d580d2465e18952f04e773992ad606d648 | JavaScript | andrewbmcintosh/desirePath | /controllers/foodController.js | UTF-8 | 1,099 | 2.609375 | 3 | [] | no_license | const Food = require("../models/Food")
const foodController = {
index: (req, res) => {
Food.find({}).then(food => {
res.render('app/indexFood', { food })
})
}, new: (req, res) => {
res.render("app/newFood")
},
create: (req, res) => {
console.log(req.body)
... | true |
9611027aa736177cd833f3bf665e85e42ea7dab5 | JavaScript | angadgill92/learnyounodeExercises | /MAKE_IT_MODULAR/module.js | UTF-8 | 682 | 3.046875 | 3 | [] | no_license | var fs = require('fs')
var path = require('path')
module.exports = function (directory, extension, callback) {
extension = '.' + extension; // prepends a . to the extension passed
fs.readdir(directory, function (err, list) {
/* function that converts the array of filenames received from fs.readdir
to a st... | true |
636705591efa7dde7a64ef790c139abca905e723 | JavaScript | sam202020/Todo-App | /src/Components/changeTodo.js | UTF-8 | 1,271 | 2.953125 | 3 | [] | no_license | import React, { useState } from "react";
// Higher Order functional component that handles the adding and editing of a todo that is added or edited in the AddToDoDisplay component.
const changeTodo = AddOrEdit => props => {
let { title, description } = props;
let setTitle, setDesc;
[title, setTitle] = useState(... | true |
db14464d4c38d9c5df17fccdf9754f84f2eb05b2 | JavaScript | NikZprojects/Food-Blog-Django | /static/scripts/cookieConsent.js | UTF-8 | 485 | 2.5625 | 3 | [] | no_license | $(document).ready(function(){
setTimeout(function () {
$("#cookieConsent").fadeIn(200);
}, 3000);
$("#closeCookieConsent").click(function() {
$("#cookieConsent").fadeOut(200);
});
$(".cookieConsentOK").click(function() {
var expTime = (new Date(Date.now() + 365 * 86400 * 1000)).to... | true |
88aefab855b7bb00915b6916463f7fbd81b7dd9e | JavaScript | MarchCorbin/Tic-tac-toe-Corbin | /src/player.js | UTF-8 | 545 | 3.1875 | 3 | [] | no_license | class Player {
constructor(mark, name) {
this.mark = mark
this.wins = []
this.name = name
}
storeTheWins() {
if(this.wins.length) {
var gameToStore = this.wins
var stringifyGame = JSON.stringify(gameToStore)
localStorage.setItem(`${this.name}`, stringifyGame)
}
}
retrie... | true |
f3240919f23d57921e0b2ff4698a80e60630ee80 | JavaScript | future4code/Tiago-Kodama | /semana15/nodeEPackage/task3/index.js | UTF-8 | 352 | 2.546875 | 3 | [] | no_license | const chalk = require('chalk')
const {read, update} = require('./database/handle')
const main = async () => {
try {
const [,,newTask] = process.argv
const newList = await read()
await update([...newList, newTask])
} catch (error) {
console.error(chalk.red(`Erro: ${er... | true |
3aed843430bc21dadf0b39e70b3abd5c4e14e627 | JavaScript | midera/JSbasic_lesson1 | /main.js | UTF-8 | 7,082 | 3.828125 | 4 | [] | no_license | /*присвоить каждому из следующих значений свою переменную:
'hello','owu','com', 'ua', 1, 10, -999, 123, 3.14, 2.7, 16, true, false
Вывести каждую при помощи console.log , alert*/
/*let a = 'hello ';
console.log(a);
alert(a);
let b = 'owu';
console.log(b);
alert(b);
let c = 'com';
console.log(c);
alert(c);
let d = 'ua... | true |
1470a4bc9e0fe4e33343c6438299fbdf86ff5c4b | JavaScript | limyifan/pedometer | /platforms/browser/www/js/googlemap.js | UTF-8 | 3,461 | 2.671875 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | var currentLocationMap;
var directionsDisplay;
var directionsService;
var currentLocationMap;
var CONTENT = 0;
var LATITUDE = 1;
var LONGITUDE = 2;
var locations;
var mapWindow;
var lat = 0.0;
var long = 0.0;
var loc;
window.onload = onAllAssetsLoaded;
function onAllAssetsLoaded()
{
// Wait for Cordova to connect ... | true |
9b5e9eba22af794362804238ff64c4bc3da3ad34 | JavaScript | tonyidarraga/hw5 | /lewitt-630.js | UTF-8 | 541 | 3.015625 | 3 | [] | no_license | function setup() {
createCanvas(380, 200);
}
function draw() {
background(225);
strokeWeight(20);
line(0, 20, 400, 20);
line(0, 60, 400, 60);
line(0, 100, 400, 100);
line(0, 100, 0, 400);
line(50, 100, 50, 400);
line(100, 100, 100, 400);
line(150, 100, 150, 400);
line(200, 100, 200, 400);
line(250, 100, ... | true |
b38f340b1a837a4508e65fd4404b38bdaa15792f | JavaScript | Hussny/100daysofcoding-javascript | /Day7_Strings/match.js | UTF-8 | 98 | 2.984375 | 3 | [] | no_license | var stringtwo = 'Not the end, since end is near'
// match()
console.log(stringtwo.match(/end/g)); | true |
201ff05864c7b80e2660654a8df597e29e36336d | JavaScript | badawi1713/basic-js | /1st-answer/javascript-controls/arithmetics.js | UTF-8 | 395 | 3.9375 | 4 | [] | no_license | // Menggunakan operator matematika sebagai proses untuk melakukan perhitungan
const a = 10;
const b = 2;
// Penjumlahan
console.log('Penjumlahan (a+b) =', a + b);
// Pengurangan
console.log('Pengurangan (a-b) =', a - b);
// Perkalian
console.log('Perkalian (a*b) =', a * b);
// Pembagian
console.log('Pembagian (a/b)... | true |
b2cd3ef18d861f09fa1fc70f7d4bb28f034ea9c0 | JavaScript | kuzditomi/angular-infinite-scroller | /docs/assets/js/changelog.js | UTF-8 | 2,237 | 2.671875 | 3 | [
"MIT"
] | permissive | (function() {
/**
* Fetch releases from github with a cache of 1 hour
* @returns {promise<object[]>}
*/
function fetchReleases() {
var cacheDate = localStorage.releasesCacheDate;
if (cacheDate && (new Date() - new Date(cacheDate)) < 1000 * 3600) {
return $.when(JSON.parse(localStorage.releas... | true |
bedc94a08d7edaf19003d79c12f127e34715a244 | JavaScript | codefellows/seattle-javascript-401n5 | /33-redux-middleware/demos/middleware-demo/src/reducers/savory.js | UTF-8 | 542 | 2.609375 | 3 | [] | no_license |
import uuid from 'uuid/v1';
const defaultState = { savories : []};
// Action type
export const ADD = 'Savory/ADD';
// Reducer
export default function reducer(state = defaultState, action) {
const { type, payload } = action;
switch (type) {
case ADD:
return {
...state,
savories: [...s... | true |
2ab2b769877c7e89a770cac78242580698e3ac23 | JavaScript | heowc/do-it-nodejs | /07.module_09.js | UTF-8 | 444 | 2.953125 | 3 | [] | no_license |
class User {
constructor(id, name) {
this.id = id;
this.name = name;
}
getUser() {
return {
id: this.id,
name: this.name
};
}
static group() {
return {
id: 'g01',
name: '친구'
};
}
printUser() ... | true |
987a2d296c75b16356802b3d5265982048c18806 | JavaScript | ReanyAlex/weather-app-react | /src/Chart.js | UTF-8 | 3,016 | 2.671875 | 3 | [] | no_license | import React, {Component} from 'react';
import * as d3 from "d3";
import './App.css'
class Chart extends Component {
createLineChart(){
let temp = this.props.hourly
var div = d3.select("body").append("div")
.attr("class", "tooltip")
.style("opacity", 0);
var margin = {top: 50, right: 50, bottom... | true |
ceed66799c81609a51e1510cb64bd6c829d479c4 | JavaScript | kody-samaroo/fewpjs-sending-data-with-fetch | /index.js | UTF-8 | 673 | 3.390625 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // Add your code here
function submitData(name, email) {
const url = `http://localhost:3000/users`
let newUser = {name, email}
return fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
"Accept": "application/json"
},
body: JSO... | true |