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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
b745ce65cadf52f45eeaf799359cd00e5f1499af | JavaScript | michaeljoyner/peakborad | /resources/js/menu.js | UTF-8 | 2,320 | 2.578125 | 3 | [] | no_license | export default {
els: {
trigger: document.querySelector(".menu-trigger"),
navbar: document.querySelector(".navbar"),
categories: [].slice.call(document.querySelectorAll(".nav-top-link")),
last_menu_item: document.querySelector(".top-menu-link:last-child")
},
isNavbarOpen() {
return this.els.n... | true |
0e50ba4a47844d130715bca756a31e1cd895eed9 | JavaScript | Ibenit/WebUI | /dist/triangulated-shape.js | UTF-8 | 3,527 | 2.75 | 3 | [
"MIT"
] | permissive | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var binary_reader_1 = require("./binary-reader");
var TriangulatedShape = /** @class */ (function () {
function TriangulatedShape() {
//This would load only shape data from binary file
this.load = function (source) {
... | true |
4aec27754e253d2ce74703b69b006679a66af322 | JavaScript | aliakseimaniuk/park-detective-api | /src/public/scripts/code/index.js | UTF-8 | 3,461 | 2.59375 | 3 | [
"MIT"
] | permissive | (function($) {
'use strict';
$(document).ready(function() {
var _graph = graphql(GRAPHQL_API_URL);
var _parkCategories = _graph(`{
parkCategories {
categories
}
}`);
_parkCategories().then(function(data) {
var categoriesSelect = $('#parkCategoriesSelect');
for (var ... | true |
97d4a3c49cf69a7630c538027663be21d77aa99b | JavaScript | vmckeown/TheWarriorAdventure | /js/shop.js | UTF-8 | 1,559 | 2.5625 | 3 | [] | no_license | function drawShop(){
canvasContext.drawImage(storeFrontPic, 0,0); // replace with inventory background
colorText("Please let me know if you would like any of our" , 25, 50, "white");
colorText("items in stock." , 25, 65, "white");
colorText("1.) 10 Arrows - 10 gp", 50, 100, "white");
colorText("2.) 1 Heart - ... | true |
bc88ab7648bc8ba94f5fc88d8af331279a38def3 | JavaScript | nsticco/javascript-helpers | /math/greatest-common-divisor-gcd.js | UTF-8 | 674 | 4.34375 | 4 | [] | no_license | // This finds the Greatest Common Divisor or GCD
function gcd(x, y) {
x = Math.abs(x);
y = Math.abs(y);
if (y > x) { var temp = x; x = y; y = temp; }
while (true) {
if (y == 0) return x;
x %= y;
if (x == 0) return y;
y %= x;
}
}
// I can use this with reduce to find... | true |
ac52d45a5fbdf90d376d3e77f563d96c32c3c411 | JavaScript | p0879/TIL | /warmup.js | UTF-8 | 902 | 4 | 4 | [] | no_license | var a = 10;
var b = 20;
console.log(a+b);
console.log("a+b");
var name = "빙봉";
var num = 39;
console.log(name);
console.log(num);
var samsung = 80000;
var kakao = 300000;
var hong = (100 * samsung) + (80 * kakao);
console.log(hong);
var samsung = samsung * 1.2;
var kakao = kakao * 0.9;
var hong = (100 * samsung) ... | true |
57fd3ae7231cc5f20d4281d995d85f580cb4e12d | JavaScript | trylang/Learning | /design-pattern/设计模式/代理模式.js | UTF-8 | 1,688 | 3.46875 | 3 | [] | no_license | class RealImg {
constructor(fileName) {
this.fileName = fileName;
this.loadFromDisk(); // 初始化,即从硬盘中加载模拟
}
display() {
console.log("display..." + this.fileName);
}
loadFromDisk() {
console.log("loading..." + this.fileName);
}
}
class ProxyImg {
constructor(fileName) {
this.realImg = ... | true |
aa5a8d0398bb14db1882cd9491d8db712f6146f4 | JavaScript | HeCaser/work-file | /React/w3c_react/MemoLearn.js | UTF-8 | 1,301 | 2.703125 | 3 | [] | no_license | import React, { useState,useEffect } from 'react'
import { View, TextInput, Text, StyleSheet, Button } from "react-native";
import MemoTodo from './MemoTodo'
// 每次调用 increment 都会刷新
const Todos1 = ({ todos }) => {
console.log("Todos1 render");
return (
<>
<Text>Todos1</Text>
{to... | true |
12d59a2ee3991ba055f884648f81f6acae9c0473 | JavaScript | 97-Jeffrey/freecodecamp-intermediate-algorithem | /integerAnagram.js | UTF-8 | 266 | 3.453125 | 3 | [] | no_license | function isAnagram(num1, num2){
if(num1.toString().length !== num2.toString().length) return false;
if(num1.toString().split("").sort().join("") !== num2.toString().split("").sort().join("")) return false;
return true
}
console.log(isAnagram(304, 403)) | true |
3b96febc1fff3a19755fbf2e56f29029509b6740 | JavaScript | JelaniThompson/Hatch | /projects/javascript/House.js | UTF-8 | 1,005 | 2.734375 | 3 | [] | no_license | var draw = function() {
// Sun
stroke(0, 0, 0);
fill(255, 255, 0);
ellipse(50, 50, 50, 50);
// Ground
stroke(0, 0, 0);
fill(255, 255, 255);
rect(0, 300, 400, 200);
// House
stroke(0, 0, 0);
fill(255, 255, 255);
rect(100, 150, 200, 200);
// Door
stroke(0, 0, 0);
fill(255, 255, 255)... | true |
b1471cc9715c7d70b5ea6d64a01da98037b2e777 | JavaScript | DayltonDouglas/Covid-Data-4-The-Day | /main.js | UTF-8 | 2,635 | 2.953125 | 3 | [] | no_license | let covid19data;
function setButtonFunctions() {
fetch("https://covid-193.p.rapidapi.com/statistics", {
method: "GET",
headers: {
"x-rapidapi-host": "covid-193.p.rapidapi.com",
"x-rapidapi-key": "2dc2b1b91emsh77d8ce735fe22bep1a7a8ajsnf768300d3462",
},
})
.then((response) => response.jso... | true |
160b8c20e93edbc33c99f832179cc983c17ddbdf | JavaScript | thisisdavidbell/mathsgenerator | /javascript/sheet.js | UTF-8 | 648 | 2.78125 | 3 | [] | no_license | function displaySheet() {
var lessonType = parseParams("LESSONTYPE");
var answers = parseParams("ANSWERS");
var sheetParams = parseParams("VALUES");
var valuesArray = paramsToArray(sheetParams);
var date = document.getElementById("date");
var text = document.createTextNode("Date: ");
d... | true |
5d3e9edea5cd4f30b840a79d93be9282cda60dfa | JavaScript | Beckers81/Counter | /src/App.js | UTF-8 | 610 | 2.734375 | 3 | [] | no_license | import React, {useState} from 'react';
import {render} from 'react-dom';
const App = () => {
const [count, setCount] = useState(0);
return(
<React.Fragment>
<h1>Becky Style App</h1>
<span>
<h2>Current Count: {count}</h2>
</span>
<button onClick... | true |
0fbd2f0bc4a6083a900c6ec349022147375446c7 | JavaScript | sensui74/legacy-project | /ExcellenceBase/WebRoot/js/et/tools.js | UTF-8 | 3,337 | 2.546875 | 3 | [] | no_license |
/**
* modify by zhangfeng
* 2008-12-25
**/
// open a new page
//win_name is the open page's name
//loc is the open page's link
//w is the open page's width
//h is the open page's height
//center(true or false) open to the middle position
function popUp(win_name, loc, w, h, menubar, center) {
var NS = (... | true |
7e3b82742dcc321b59584fe41b4900649e31b1f0 | JavaScript | Jinal2711/Blog-web-app | /client/src/Store/Auth/actions.js | UTF-8 | 997 | 2.609375 | 3 | [
"MIT"
] | permissive | import {
LOGIN_ERROR_STATE,
LOGIN_PENDING_STATE,
SET_USER_DATA,
} from "./constants";
import jwt_decode from "jwt-decode";
export const setLoginPendingState = () => {
return {
type: LOGIN_PENDING_STATE,
};
};
export const setLoginErrorState = (err) => {
return {
type: LOGIN_ERROR_STATE,
payload... | true |
f0fbec090a6b0c36687cd0bd314a09916a85e713 | JavaScript | eaallen/Code-Wars | /pluck/index.js | UTF-8 | 1,125 | 3.546875 | 4 | [] | no_license | function pluck(name) {
let arr = []
for(let icount = 0; icount < arr_of_objs.length; icount++){
arr.push(arr_of_objs[icount][name])
}
document.getElementById('output').innerHTML = arr.join()
return arr
}
// console.log(pluck(random_obj(),"a"))
let arr_of_objs
function random_obj(){
let... | true |
d050106b5dd87bb48f4e0ad419a9ed21c7aa381d | JavaScript | imclab/SingleRoomMultiplayer | /rewrite/sandbox/inheritance/scenes.background.js | UTF-8 | 1,415 | 2.515625 | 3 | [] | no_license | var scenes = scenes || {};
scenes.background = {
initialize: function() {
this.makeSkybox();
this.makePlanet();
this.makeSun();
renderer.addPreRenderTickFunction( this.tick );
},
tick: function( dt ) {
scenes.background.planet.tick( dt );
},
makeSkybox: function() {
var skybox = new Skybox({
... | true |
8b20a105cdc330093e676a50a1e86b18347506d9 | JavaScript | ViciousCupcake/Chess-AI | /src/pieces/king.js | UTF-8 | 3,326 | 3.28125 | 3 | [
"MIT"
] | permissive | import Piece from './piece.js';
import { isSameDiagonal, isSameRow, isValidIndex } from '../helpers/index.js'
export default class King extends Piece {
constructor(player) {
super(player,
(player === 1 ? "https://upload.wikimedia.org/wikipedia/commons/4/42/Chess_klt45.svg" : "https://upload.wikimedia.org/w... | true |
98c5b08b6c49fb72773811f857d7759641d6d02b | JavaScript | liujianwen-github/deeppass | /切图/space/space/js/index.js | UTF-8 | 1,664 | 2.796875 | 3 | [] | no_license | //清除人物信息
function clearShowInfo(){
$('.main_l').html("");
}
//弹窗
const shibie = document.getElementById('shibie');
const yanzheng = document.getElementById('yanzheng');
const no = document.getElementById('no');
shibie.onclick = function(){
yanzheng.style.display = "block";
};
yes.onclick = function(){
alert('111'... | true |
dc6bae5d395b7c8e471ace0dbfc58d322bbd01b9 | JavaScript | Mhmdabed11/algo-visualizer | /src/components/Node/Node.js | UTF-8 | 547 | 2.671875 | 3 | [] | no_license | import React from "react";
import "./Node.css";
const Node = React.forwardRef(({ type, children, obstacle }, ref) => {
// check type of node and check if it is an obstacle
let typeClassName = "";
let obstacleClassName = "";
if (type === "start" || type === "finish") {
typeClassName = `is-${type}`;
}
if... | true |
3c221fab30bce9b35a0077ea53c8833eb57e1ea2 | JavaScript | rohanrobinson/athena21W | /src/QuoteOfTheDay.js | UTF-8 | 2,155 | 2.703125 | 3 | [] | no_license | import axios from "axios";
import React, { useEffect, useState } from "react";
import "./QuoteOfTheDay.css";
import backendUrl from './backendUrl';
const QuoteOfTheDay = () => {
const [author, setAuthor] = useState();
const [quote, setQuote] = useState();
const [quotesList, setQuotesList] = useState();
... | true |
7e1694655e0fc406dde5cfa50386ac4b5d41ad4b | JavaScript | henriquetroiano/cursoJS | /Documentos/02. JavaScript para Iniciantes/9. arrays e loops/script-aula.js | UTF-8 | 552 | 3.1875 | 3 | [] | no_license |
// var ultimItemRemove = videoGames.pop();
// videoGames.push('3DS');
for (var numero = 0; numero <= 4; numero++) {
console.log(numero);
}
var i = 0;
while (i <= 10) {
console.log(i);
i = i + 5
};
var videoGames = ['Switch', 'Ps4', 'Xbox', '3DS'];
for (var item = 0; item < videoGames.length; item++) {
... | true |
5731a5519edb2cbc8d263ba977ae784c9c97347e | JavaScript | animax42/news-aggregator | /static_core/js/getdetails.js | UTF-8 | 2,503 | 2.609375 | 3 | [] | no_license | $(document).ready(function(){
loadingIcon()
category=$('#category-dropdown')
$.get('/user/category',(data)=>{
//console.log(data)
category.empty();
category.append(`<option>All</option>`);
for(i=0;i<data.length;i++){
category.append(`<option id = "op${data[i].pk}"... | true |
d16b5e3443bcbd06a9d65008a9e06658a3bef171 | JavaScript | TrevorDev/outLine | /public/custom/game3D/projectile.js | UTF-8 | 278 | 2.5625 | 3 | [] | no_license | var Projectile = function(pos, spd, projId) {
this.projId = projId
this.body = new THREE.Mesh(new THREE.SphereGeometry(7, 10, 10), MATERIALS.DEFAULT)
this.spd = spd;
this.dmg = 10
this.body.position.copy(pos)
this.move = function(){
this.body.position.add(this.spd)
}
} | true |
dcda71a18ac19bcb8949e9fafe8ab89632c30b52 | JavaScript | vladkornea/codesample | /pages/admin/spammers/spammers.js | UTF-8 | 2,962 | 2.59375 | 3 | [] | no_license | $(printSpammersPageInterface)
function printSpammersPageInterface () {
var $localContainer = $('main')
var pageData = window['pageData']
if (!pageData) {
$('<p class="error">Missing pageData</p>').appendTo($localContainer)
return
}
var suspectedSpammers = pageData['suspectedSpammers']
var knownSpammers = page... | true |
f955df28d8ddbf8efa3c345fc6c080d2ba913791 | JavaScript | jayjariwala/algorithem-practice | /basics.js | UTF-8 | 713 | 3.65625 | 4 | [] | no_license | // function same(arr1, arr2) {
// if(arr1.length !== arr2.length) return false;
// let count = 0;
// for (let i = 0; i < arr1.length; i++) {
// const arr1Element = arr1[i];
// for (let j = 0; j < arr2.length; j++) {
// const arr2Element = arr2[j];
// if(arr1Element === arr2Element) {
// ... | true |
2e3b49f03723cdd742a5d3c85a36585530b25539 | JavaScript | SfundoMhlungu/CanvasCrashCourse | /animating on the canvas/index.js | UTF-8 | 2,563 | 3.6875 | 4 | [] | no_license | // r/place = must check
const canvas = document.querySelector("canvas");
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
// getting the 3d context, returning a drawing(2d) context(all methods etc)
// c get all 2d functionality(2d engine)
var c = canvas.getContext("2d");
// c objects ta... | true |
1e2cece099fbd94855c9227850401736520489bc | JavaScript | Rammina/challenge-1 | /main/js/main.js | UTF-8 | 1,965 | 3.34375 | 3 | [] | no_license | // document Objects
// Homepage objects
let homepage = {
emailInput: document.querySelector(".signup__text-input"),
emailInputText: document.querySelector(".signup__text-input").value,
emailInputTwo: document.querySelector(".signup__text-input-2"),
emailInputTextTwo: document.querySelector(".signup__text-... | true |
fd3e428bc2099f618c5870ccfd47825140698fdb | JavaScript | candiepih/alx-higher_level_programming | /0x15-javascript-web_jquery/100-script.js | UTF-8 | 244 | 3.125 | 3 | [] | no_license | /**
* script that updates the text color of the <header>
* element to red (#FF0000)
*
* script imported from the <head> tag
*/
window.onload = () => {
const header = document.querySelector('header');
header.style.color = '#FF0000';
};
| true |
592fa0448c8665ca189b95535ee2fcafcbdccd47 | JavaScript | Kibibit/achievibit-demo | /js/index.js | UTF-8 | 14,380 | 2.65625 | 3 | [
"MIT"
] | permissive | console.clear();
$(document).ready(function() {
var ANIMATIONS = {};
var SCENES = {};
var SELECTORS = {
DEBUG_BUTTON: '.btn',
ANIMATION_CONTAINER: 'body',
MARK_HEADER: '#mark-header',
MARK_CHARACTER_FIRST: '#mark1',
MARK_CHARACTER_SECOND: '#mark2',
MARK_CHARACTER_THIRD: '#mark3',
MA... | true |
88c7320b2c66a114f04cbc4975fd3a25cd7809fd | JavaScript | BrendanCarruthers/LifeTrack | /stats.js | UTF-8 | 1,420 | 3.140625 | 3 | [
"Apache-2.0"
] | permissive | //This is the mathematical functionality section
/* module.exports={
"chiSquare":chiSquare
}*/
/*
List of names
Behavior
LifeTrack
OnTrack
(Home screen)
About screen
(Config screen) Reading and editing list of activities and moods.
Correlation screen (Odds ratio screen (accuracy 1-p... | true |
c8b1ad35eaa504c02c4e7801045a4e0affaadeef | JavaScript | hewking/frontendPractice | /js/mypromis.js | UTF-8 | 1,252 | 3.578125 | 4 | [
"Apache-2.0"
] | permissive | function MyPromise(executor){
this.status = 'pending';
this.value = undefined;
this.reason = undefined;
this.resolve = (value) =>{
console.log('resolve called status', this.status);
if(this.status === 'pending') {
this.status = 'resolved';
this.value = value;
... | true |
a7bfa4fa57a36b0f91b903fd2720ef09c2c531b5 | JavaScript | ElixirTeSS/TeSS_widgets | /components/js/tess-widget.js | UTF-8 | 5,759 | 2.59375 | 3 | [] | no_license | 'use strict';
const TessApi = require('tess_json_api');
const Util = require('./util.js');
// Swagger's generated API client breaks dates in Safari & IE. This hack fixes that.
TessApi.ApiClient.parseDate = function(str) {
return new Date(str);
};
/**
* A TeSS widget.
*
* @constructor
* @param {Object} apiClas... | true |
76fc24ac98f66b207df386b44b1a559bcbdcf8ad | JavaScript | jhoffmcd/code-practice | /frequency-counters/areThereDuplicates.js | UTF-8 | 1,011 | 4.5625 | 5 | [] | no_license | /*
Implement a function called, areThereDuplicates which accepts a variable number of arguments, and
checks whether there are any duplicates among the arguments passed in.
You can solve this using the frequency counter pattern OR the multiple pointers pattern.
This solution uses a frequency counter to count t... | true |
d5d970329a4925e2d849bd8e9aca1aaca64e91c2 | JavaScript | Sheepou01/symfony-api | /src/containers/UserProfile.js | UTF-8 | 2,560 | 2.546875 | 3 | [] | no_license | /**
* Npm import
*/
import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';
/**
* Local import
*/
import UserProfile from 'src/components/UserProfile';
import { userFavTheme, changeInput, editUser } from 'src/store/reducers/userReducer';
import { editTimer, handleInputTimer } from 's... | true |
9868800a2757dade41acd4b940e33d760761c117 | JavaScript | rogerdavid2/dataStructures | /singlyLinkedList/script.js | UTF-8 | 658 | 3.75 | 4 | [] | no_license | import LinkedList from './linkedlist.js';
import ListNode from './listnode.js';
let node1 = new ListNode(2);
let node2 = new ListNode(5);
node1.next = node2;
let list = new LinkedList(node1);
// Output: 5
console.log(list.head.next.data);
// Testing size: 2
console.log(list.size())
// Ouput: a string representatio... | true |
ed12084a13b702c72b341fc973f4d198e14ed52c | JavaScript | JEverhart383/Anchor-Checker-Extension | /contentscript.js | UTF-8 | 4,115 | 3.046875 | 3 | [] | no_license |
var linksObject = {
"relativeLinks": [],
"absoluteLinks": [],
"hashLinks": [],
"otherEnvLinks": [],
"uppercaseLinks" : []
}
var hostname = location.hostname;
console.log(hostname);
var vfbEnvURLS = [
"www.vafb.com",
"fbatstevoq.vafb.com",
"vfbevoqfbatst.personifycloud.com"
];
function filterEnvURL... | true |
aa943a55e7e70b071a4a517bd1bf671ca94f9943 | JavaScript | matthesrwr/oplsystem | /node/apphandler.js | UTF-8 | 1,021 | 2.546875 | 3 | [] | no_license | var fsHandler = require('fs');
var mimeHandler = require('mime');
var urlHandler = require('url');
module.exports = function (logger,request, response,filePath) {
switch(request.method){
case "GET" :
var fileName = urlHandler.parse(request.url).pathname;
fileName = fileName.replace("../","");
if(fileName... | true |
0e77a76bcd41557320e04331a8c506844c4627ff | JavaScript | polyanapimenta/portfolio | /public/main.js | UTF-8 | 523 | 2.75 | 3 | [
"MIT"
] | permissive | window.onscroll = function() {
var topo = window.pageYOffset || document.documentElement.scrollTop
var referencia = document.querySelector('#AppHeader').offsetHeight
var menu = document.querySelector('.App-menu')
if (topo > referencia) {
document.querySelector('#AppMenuContainer').classList.remove("conta... | true |
0d39e61275b30a490f1a6d479343dc54e97b9bf3 | JavaScript | SerginhuXavier/lojadt | /js/categoria.js | UTF-8 | 2,625 | 2.578125 | 3 | [] | no_license | function delCategoria(id) {
$.post('control/categoriaControle.php', {opcao: 'delCategoria', idCategoria: id},
function (r) {
console.log(r);
paginacao(1);
$('#confirm-delete').modal('hide');
});
}
function listaCategoria(id) {
$.post('control/categoriaControle.php', {opcao: 'lis... | true |
7d473e389e5b0f234eb57c2603aaa1fe8e366f84 | JavaScript | HDRUK/gateway-web | /test/utils/unitTest.js | UTF-8 | 989 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | export const DATA_SPEC_ATTRIBUTE_NAME = 'data-spec';
/**
* Finds all instances of components in the rendered `componentWrapper` that are DOM components
* with the `data-spec` attribute matching `name`.
* @param {ReactWrapper} componentWrapper - Rendered componentWrapper (result of mount, shallow, or render)
* @param {... | true |
78eb7e178de22ed0ae61dac82eca32a70152b9bb | JavaScript | KelpGF/teste-as-sistemas_laravel | /myProject/public/categorie.js | UTF-8 | 3,328 | 2.609375 | 3 | [
"MIT"
] | permissive | const baseUrlCategories = 'api/categories';
function getCategories()
{
$.get(baseUrlCategories, function(categories) {
$("#spending_card").html(`
<div class="col-lg-12 my-4">
<h3>Gastos Cadastrados</h3>
</div>
`);
$("#category_select").html(`
... | true |
f650246dc08dd08c8894d9c32eb2b7c4b2000717 | JavaScript | HeeyeongKim/COMP308-W2019-ExpressPortfolio | /public/Scripts/app.js | UTF-8 | 1,043 | 3.25 | 3 | [] | no_license | /*
COMP308-W2019-Assignment1 (ExpressPortfolio)
Student Name: Heeyeong Kim
Student Number: 300954759
Date: 02/16/2019
*/
// IIFE -- Immediately Invoked Function Express
(function(){
function Start() {
console.log(`%c App Started...`, "font-size: 20px; color: blue; font-weight: bold;");
}
windo... | true |
09621e317bc822bb6460d5c451274645c376c74d | JavaScript | isabella232/earthquake-design-ws | /src/lib/component/metadata-factory.js | UTF-8 | 4,688 | 2.859375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-public-domain",
"CC0-1.0"
] | permissive | 'use strict';
const extend = require('extend');
const _QUERY_DATA = `
SELECT
metadata.*
FROM
document, metadata
WHERE
document.id = metadata.document_id
AND document.name = $1::Varchar
AND document.region_id = $2::Integer
`;
const _QUERY_REGION = `
SELECT
region.*
FROM
region, doc... | true |
4a38520170b1095a209eee660ad566818758774c | JavaScript | leipomalla/marileipola | /06/config.js | UTF-8 | 1,028 | 2.6875 | 3 | [] | no_license | //var data = {};
function aseta() { //html:ssä on onclick-elementti, joka kutsuu tätä funktiota
event.preventDefault() //TÄMÄ estää sivun uudelleen lataamisen
var title = document.getElementById("otsikkoconfig").value;// lomakkeen data talteen muuttuja kerrallaan
var titleJSON = JSON.stringify(title)... | true |
18f151fadcb84161044793c3a6b3302cc3275626 | JavaScript | crappy-coder/astrid | /src/Timer.js | UTF-8 | 2,324 | 2.65625 | 3 | [] | no_license | import EventDispatcher from "./EventDispatcher";
import System from "./System";
import TimerEvent from "./TimerEvent";
class Timer extends EventDispatcher {
constructor(interval, repeatCount) {
super();
/** Integer **/
this.repeatCount = astrid.valueOrDefault(repeatCount, 0);
/** Number **/
this.interval ... | true |
1ce5530341fcdda158bb4bec8bba2875e7289dc5 | JavaScript | IrocNinoNiel/nlpfunction | /index.js | UTF-8 | 2,467 | 2.921875 | 3 | [] | no_license | const { NlpManager } = require('node-nlp');
var category = ['allowance','scholarship','website'];
var faq =[
{
title:'allowance.when',
category:'allowance',
utterances:['When is the next allowance'],
answer:'N/A'
},
{
title:'allowance.how',
category:'allowanc... | true |
73b0a6905a9bd62861e29e9d9aa0bfd01e50cb2c | JavaScript | streamr-dev/smart-contracts-init | /generateTestAddresses.js | UTF-8 | 1,143 | 2.515625 | 3 | [] | no_license | const { Wallet } = require("ethers")
const fs = require('fs')
const outputfile = 'genesisAddresses.json'
const outputfileKeys = 'genesisKeys.txt'
for (i = 1; i <= 1000; i++) {
const hexString = i.toString(16)
privkey = '0x' + hexString.padStart(64, '0')
const wallet = new Wallet(privkey)
console.log(wa... | true |
226ac3728380c3cf7b3482193e6071edb0469e07 | JavaScript | bharah08/node-spring-boot-todo-app | /ui/controllers/todo.js | UTF-8 | 3,209 | 2.71875 | 3 | [
"MIT"
] | permissive | const api = require('./api');
/**
* GET /todos
* Todos page.
*/
exports.getTodos = (req, res) => {
const todoId = req.query.id || null;
if(todoId != null){
//TODO: todoId'ye göre veri çek.
console.info('rendeeerrrrrr data --> ');
api.getTodo(req.user, todoId, function(data){
consol... | true |
e547c8851dc7ee44322e3f6ffd377b062dcb118c | JavaScript | mbarouski/js-practice | /functional-javascript-workshop/every-some-lab.js | UTF-8 | 254 | 2.53125 | 3 | [] | no_license | function checkUsersValid(goodUsersList){
return function(testUserList){
return testUserList.every((testUser) => {
return goodUsersList.some((goodUser) => {
return testUser.id == goodUser.id;
});
});
};
}
module.exports = checkUsersValid; | true |
04647b6d8613b96afed67b27015dc36da0e3a768 | JavaScript | ajordan510/oddie | /app/assets/javascripts/image_preview_upload.js | UTF-8 | 547 | 2.59375 | 3 | [] | no_license | $(document).ready(function(){
var preview = $(".upload-preview img");
$(".file").change(function(event){
var input = $(event.currentTarget);
var file = input[0].files[0];
var reader = new FileReader();
$(".upload-preview").css("display", "block");
reader.onload = function... | true |
59dc4000dc5e06024601f2a4bdb15a81379c5d55 | JavaScript | pelincetin/Facial-Recognition-SmartDoor | /Frontend/WP2.js | UTF-8 | 1,571 | 2.6875 | 3 | [] | no_license | $(document).ready(function(){
var apigClient = apigClientFactory.newClient();
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = window.location.search.substring(1),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length;... | true |
921ea58f5d20126a40d19f500783f0aa6d712360 | JavaScript | AbiVickery/javascript-agetester | /js/app.js | UTF-8 | 878 | 3.9375 | 4 | [] | no_license | document.write('hello world');
// function age1() {
// console.log("what is your age?");
// document.write("Please enter your age.");
// if age > 5
// then print('What is a person of your age doing here?');
// else if age >= 10
// then print("I'm sorry, but you are not old enough.");
... | true |
ea54652516d6bc6042887328b8c6995f0fba2b1a | JavaScript | zhaobiyang/my-lakh | /js/tool.js | UTF-8 | 719 | 3.09375 | 3 | [] | no_license | /**
* Created by Beyond on 2019/1/2.
*/
/*bmi*/
'use strict';
var height=parseFloat(prompt('请输入身高(m):'));
var weight=parseFloat(prompt('请输入体重(kg):'));
var bmi=weight/height/height;
if(bmi>32){
console.log(bmi);
console.log("非常肥胖");
}else if(32>=bmi>=28){
console.log(bmi);
console.log("肥胖");
}else if(2... | true |
a3b663d45deeb2db51364984565e29acb775a941 | JavaScript | lavaldi/convert-html-to-markdown | /index.js | UTF-8 | 2,514 | 2.59375 | 3 | [] | no_license | const TurndownService = require("turndown");
const fs = require("fs");
const marked = require("marked");
// From https://github.com/ckeditor/ckeditor5/blob/92aa0b3c999397c8f87cd29595fe4d9ad9d4c376/packages/ckeditor5-markdown-gfm/src/html2markdown/html2markdown.js#L12-L54
// Overrides the escape() method, enlarging it.... | true |
746c829be121cc80dd3eaec8818640e1a6080ab4 | JavaScript | GaniDotNetTech/ReactProject | /FunctionalStateManagement.js | UTF-8 | 1,611 | 3.390625 | 3 | [] | no_license | import React, { useState } from 'react';//manageing state using functional components
import { render } from 'react-dom';
import Hello from './Hello';
import './style.css';
//Manage state Class functional Components
const App = props => {
const [personsState, setPersonsState] = useState({
persons: [
... | true |
d98d51f80e543fa7927625cfebe38919a189605a | JavaScript | puneetghodasara/website-nodejs | /controller/test.js | UTF-8 | 1,520 | 2.53125 | 3 | [] | no_license | const constants = require('../constants');
var os = require("os");
const prettyMs = require('pretty-ms');
const bytes = require('bytes');
const fs = require('fs');
exports.test = (req, res) => {
var content = "<td>Information</td><td colspan='3'>Value</td>";
var hostname = os.hostname();
var ifaces = os... | true |
054f030994db94aa1523915f890a51fec2d92cd8 | JavaScript | jscottbruns/selectionsheet | /.svn/pristine/05/054f030994db94aa1523915f890a51fec2d92cd8.svn-base | UTF-8 | 6,569 | 2.578125 | 3 | [] | no_license | var show = "false";
// ****************************************
function findRef(divId)
{
var setFocus = parent.frames[1].bsscright;
var arrayofPData = setFocus.gPopupData;
try
{
for (var i=0;i<arrayofPData.length;i++)
{
linkAttribute=arrayofPData[i].popupId;
linkAttribute = linkAttribute.s... | true |
e91e33e6379188dbf018c6372166d1389ac905ae | JavaScript | Ritek/PracaReact | /src/components/teacher/groups/ChangeTimeModal.js | UTF-8 | 2,639 | 2.515625 | 3 | [] | no_license | import React, {useState, useEffect} from 'react'
import Modal from 'react-bootstrap/Modal'
function ChangeTimeModal(props) {
const [time, setTime] = useState({time: props.testInfo.time, autoCheck: props.testInfo.autoCheck});
const handleClose = () => {
props.closeTimeModal();
props.updateTest... | true |
25fc43eb1f73af2c461d36e696ab55ba2a8d302e | JavaScript | Sohamkadam333/JavaScript | /12JS Web API/01 Client Storage/01Cookies.js | UTF-8 | 615 | 3.484375 | 3 | [] | no_license |
// local storage
localStorage.setItem('name', 'John'); // key value
console.log(localStorage.getItem('name'));
// localStorage.removeItem('name');
console.log(localStorage.getItem('name'));
// session storage
sessionStorage.setItem('name', 'Jane');
console.log(sessionStorage.getItem('name'));
// sessionStorage.remov... | true |
e3b3cafe0d977dd9f1015d459668e288d0b3faaa | JavaScript | treeskar/html-console | /src/index.js | UTF-8 | 3,845 | 3.265625 | 3 | [] | no_license | 'use strict';
import './index.scss';
import 'imports?global=window!./html-console';
import { PubSub } from './pub-sub';
/*
Supported API
on (eventName, callback, *context):
* should allow to register a callback to event and allow optional context to be invoked to
off (eventName, *callback)
* should allow remove reg... | true |
e72d8fe27cf17f6e6be10c72ae6ac2083e22d041 | JavaScript | pisethyoy1/Passport-Multiple-Strategies-NodeJS | /app/routes/gym/gym.js | UTF-8 | 7,786 | 2.546875 | 3 | [] | no_license | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Add the required modules
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
const mongoose = ... | true |
c2403db470b8beadc192b7feba3ccee4464a2d7f | JavaScript | nihco2/crawlability | /rules/img-alt.js | UTF-8 | 596 | 2.953125 | 3 | [] | no_license | /*
Rule : Use alt text in images
*/
module.exports = function imgAlt() {
var
imgs = document.querySelectorAll("img"),
len = imgs.length,
alt = null,
altVal = "",
results = {},
errors = [],
test = true
;
results.required = false;
while ... | true |
7eef12967f7856cbae9dcbc9d3a768c53759539a | JavaScript | JonathanULP/Proyecto | /docs/JS/puntaje.js | UTF-8 | 709 | 2.890625 | 3 | [] | no_license | function validar(){
var puntaje = document.opinion.puntaj.value
if(!Number.parseInt(puntaje)) {
alert("Por favor ingresa un puntaje correcto");
document.opinion.puntaj.focus();
return false;
}
else if ((puntaje < 0 ) || (puntaje > 10)){
alert("Ingresa un puntaje correcto");
document.opinion.puntaj.... | true |
b4bb935db7dc5200ef1244ac13a5d6467fe88e6e | JavaScript | annesikkema/blijfvanmijndier | /resources/assets/js/map/debug.js | UTF-8 | 2,699 | 3.1875 | 3 | [] | no_license | /**
* This script will capture all events in the DOM by overriding the Event Listener.
* Prints a table with all events to the top of the page.
* based on: https://css-tricks.com/capturing-all-events/
*/
// Event statistics
var listenerCount = {};
var eventCount = {};
var eventOriginMap = {};
if (!document.getEle... | true |
f7b074bf49b76964e6fb81ba7ae9ad3f23e6a116 | JavaScript | elliottwuTW/express-restaurant-list | /app.js | UTF-8 | 1,362 | 2.90625 | 3 | [] | no_license | // Include the modules and files needed in Node.js
const express = require('express')
const exphdbs = require('express-handlebars')
const restaurantList = require('./restaurant.json')
// Create the Express app
const app = express()
const port = 3000
// Set the template engine
app.engine('handlebars', exphdbs({ defaul... | true |
369283ae4b2635e656848b9d7d80b63c79e6f857 | JavaScript | geridashja/internship | /problem_solving/leetcode_1672.js | UTF-8 | 429 | 3.6875 | 4 | [] | no_license | //added by me to find the sum of array
function add(arr){
let temp = 0;
if(arr.length == 0){
return 0;
}
temp += arr[0] + add(arr.slice(1));
return temp;
}
var maximumWealth = function(accounts) {
let res =[];
for(let i =0;i<accounts.length;i++){
let sum =0;
sum... | true |
98f7038185001e16b580e3661ca51973e9aa337a | JavaScript | levilindsey/restaurant-menu | /src/public/components/MenuItemsSection/MenuItemsSection.react.js | UTF-8 | 1,592 | 2.703125 | 3 | [
"MIT"
] | permissive | /**
* This module specifies a component for lists of menu items.
*
* @module MenuItemsSection.react
*/
var React = require('react');
var MenuListItem = require('../MenuListItem/MenuListItem.react.js');
var MenuItemStore = require('../../stores/MenuItemStore');
var MenuCategoryStore = require('../../stores/MenuCate... | true |
d41dac98159cb17b644d452716f46c652baa31f1 | JavaScript | ZhaoUjun/thallo | /src/instantiateComponent.js | UTF-8 | 420 | 2.53125 | 3 | [] | no_license | import { CompositeComponent } from './CompositeComponent'
import { DomComponent } from './DomComponent'
export function instantiateComponent (element){
if(typeof element ==='string'){
return element
}
const {type}=element;
if (typeof type==='function'){
return new CompositeComponent(ele... | true |
18b7c03e274a55629732985e99718cda0579106f | JavaScript | ThePoptartCrpr/jscord | /src/events/Events.js | UTF-8 | 722 | 2.875 | 3 | [] | no_license | const Message = require('../structures/message/Message.js');
const { EventCodes } = require('../util/constants/Codes.js');
class Events {
constructor(bot) {
this.bot = bot;
}
fire(evt) {
let event = JSON.parse(evt.data).t;
if (event === 'READY') {
this.bot.emit(EventCodes.READY);
}
e... | true |
64404db4c1f3a89bc81ea844df288fa777c2277b | JavaScript | codemunkee/readable | /src/reducers/commentReducers.js | UTF-8 | 2,265 | 2.515625 | 3 | [] | no_license | import {
FETCH_COMMENTS,
RECEIVE_COMMENTS,
POST_COMMENT,
ADD_COMMENT,
PUT_COMMENT,
EDIT_COMMENT,
DELETE_COMMENT,
REMOVE_COMMENT,
UP_VOTE_COMMENT,
DOWN_VOTE_COMMENT,
} from '../actions/types';
/* eslint no-param-reassign: 0 */
/* eslint no-case-declarations: 0 */
/* eslint no-return-assign: 0 */
//... | true |
ccebdf208fda65ad3d1605cd5ebd08a580851353 | JavaScript | jvincent-dev/Tutoring-Queue | /components/card.js | UTF-8 | 1,459 | 2.59375 | 3 | [] | no_license | import React from 'react'
import { StyleSheet, Text, View, TouchableOpacity } from 'react-native'
import { Feather } from '@expo/vector-icons'
export default function Card({ data, handleFinished, isFirst }) { // 3 params: student data, delete student function, is first in queue
if (data) // if data exists return som... | true |
c824d7ebf4b6384319b17b38b5b335b1e8ca6349 | JavaScript | Rohan9841/Phage-Visualization-Complete | /htdocs/dashboard/hello/Phage Visualization/ObjectSvgV2.js | UTF-8 | 3,097 | 3.03125 | 3 | [
"BSD-3-Clause",
"MIT",
"Apache-2.0"
] | permissive | class Chart {
//this will be called by our index.html
constructor(opts) {
//this is the element where our rect will be appeneded
this.element = opts.element;
//this.position = opts.position;
//calling drawRect() function
this.drawRect();
}
drawRect() {
... | true |
589913c9a80a4a9d1b97406611357231662922bb | JavaScript | mo-fouad/React-Redux-Firebase-Dasboard | /src/components/auth/SignIn.js | UTF-8 | 1,829 | 2.515625 | 3 | [] | no_license | import React, {Component} from 'react';
import { connect } from 'react-redux';
import {signIn} from "../../store/actions/authAction";
class SignIn extends Component {
state = {
email:'',
password:''
};
handleChange = (e) => {
this.setState({
[e.target.id] : e.target.... | true |
e640612b968b532aa9fe5d47c47c7d7496132f11 | JavaScript | joxper/covid19 | /src/js/plasma/template.js | UTF-8 | 2,828 | 2.734375 | 3 | [] | no_license | export default function template(inputval) {
// make API call for results based on zip or county string
let isZip = false;
if (inputval.match(/^\d+$/)) {
// we are dealing with a zip code
isZip = true;
let url = `https://api.alpha.ca.gov/countyfromzip/${inputval}`;
window.fetch(url)
.then(re... | true |
9e0ff55b9253289df2ba31659d47ee17c8a94b86 | JavaScript | moid-khan/javascript-practice-from-chapter-1-to-67 | /Chapter 02/Question 03/app.js | UTF-8 | 216 | 4 | 4 | [] | no_license | // 3. Write script to
// a) Declare a JS variable, titled message.
// b) Assign “Hello World” to variable message
// c) Display the message in alert box.
var message;
message = "Hello World";
alert(message);
| true |
ed875f62c1d229c05c4eb6d569218a548da06a53 | JavaScript | luisprooc/API_projectsJS | /proyecto_CRM/js/funciones.js | UTF-8 | 1,166 | 2.890625 | 3 | [] | no_license | let DB;
function conectarDB(){
const abrirDB = window.indexedDB.open("crm",1);
// Si ocurre un error
abrirDB.onerror = () =>{
console.error("Hubo un error al conectar la DB");
}
abrirDB.onsuccess = () =>{
// Asignar el resultado de la DB
DB = abrirDB.result;
co... | true |
de488b493798c658e5340db98af6254528fbee7f | JavaScript | Alessandr0sousa/loan | /js/rotas.js | UTF-8 | 527 | 2.6875 | 3 | [
"MIT"
] | permissive | $(document).ready(function () {
callPage('pages/cadastros.html');
$('a').on('click', function(e){
e.preventDefault();
var pageRef = $(this).attr('href');
if(pageRef !== undefined) {
callPage(pageRef);
}
});
});
function callPage(pageRefInput) {
$.ajax({
url: pageRefInput,
type: "POST",
dataTy... | true |
998370f56956192c9dee77a8f41b8ec9a8497c1a | JavaScript | ua-snap/ace-cordova-app | /www/js/util/LocalStorageUtil.js | UTF-8 | 3,696 | 3.734375 | 4 | [
"MIT"
] | permissive | // LocalStorageUtil.js
/**
* @class LocalStorageUtil
* @constructor
*/
// LocalStorageUtil
//------------------------------------------------------------------
// Constructor assigns Cordova window variable
var LocalStorageUtil = function(window) {
/**
* @property _window
* @type window
* @description Priv... | true |
328d7997d3fac28676d729bdc2be98cf267b076b | JavaScript | yonatanahi/CRM | /server/model/insertData.js | UTF-8 | 5,722 | 2.765625 | 3 | [] | no_license | const Sequelize = require('sequelize')
const sequelize = new Sequelize('mysql://root:@localhost/sql_intro')
const data = require('../../src/data')
for(let c of data){
if (c.sold === true) {
c.sold = 1
}else if(c.sold === false){
c.sold = 0
}
}
function addClient(id, name, email, firstCo... | true |
9b475b79055787f5ef12fcce88d203430837d0ac | JavaScript | romantymets/todo-list-redux | /src/redux/titleReduser/titleTodoReducer.js | UTF-8 | 639 | 2.625 | 3 | [] | no_license | const titleTodoInitialState = "";
export { titleTodoInitialState };
// Actions
export const CHANGE_TODOTITLE = "changeTodoTitle";
// Action creators
export const changeTodoTitle = (title, itemId) => (dispatch) => {
dispatch({
type: CHANGE_TODOTITLE,
title: title,
itemId,
});
};
// Reducer
// eslint-d... | true |
74a9875206927a628e34fb2d0077ab9136bb34d0 | JavaScript | raphaella-rose/weatherapp | /src/index.js | UTF-8 | 1,551 | 3.5625 | 4 | [] | no_license | function formatDate(date) {
let now = new Date();
let days = [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
];
let day = days[now.getDay()];
let hour = now.getHours();
let minutes = now.getMinutes();
let currentDate = `${day} ${hour}:${minutes}`
retur... | true |
b6e8d7414dc0722fa300ee9cfd89b5b0777329c8 | JavaScript | zhongrong2/weixin | /js/Cardphone.js | UTF-8 | 963 | 2.65625 | 3 | [] | no_license | $(".btn").click(function () {
var phone = $("#phone").val();
// 判断不为空
if(phone!=""){
// 判断手机号格式
if(/^1[34578]\d{9}$/.test(phone)){
// 获取后台数据
$.ajax({
url:"data.json",
method:"get",
data:"phone",
dataType... | true |
36e8f7fdd983f93d16b6f253411a064439a8c6a8 | JavaScript | netlams/SoapyWService | /src/main/resources/public/images/CHASER_files/mainController.js | UTF-8 | 2,118 | 2.609375 | 3 | [
"MIT"
] | permissive | /****************
mainController.js
-desc: controller module for non-view specific functionalties
-author: Dau Lam
-date: 07/21/2017
*****************/
var app = angular.module('carApp', []);
app.controller('mainController',
function($scope, $http) {
$scope.list = [];
$scope.car = { name: null,
col... | true |
89d4c7963c62bace326f4e4a88578f2a8fe213ad | JavaScript | sateeshchinni/imad-app | /ui/main.js | UTF-8 | 3,180 | 2.953125 | 3 | [] | no_license | var button= document.getElementById('counter');
//var counter = 0;
button.onclick = function (){
//create request
var request = new XMLHttpRequest();
request.onreadystatechange = function (){
if(request.readyState === XMLHttpRequest.DONE) {
if(request.status === 200){
... | true |
9f86b3de1416c83b19d31edb3fe0825d5122229c | JavaScript | ArvindBP/Assignment7 | /Trial.js | UTF-8 | 2,598 | 3 | 3 | [] | no_license | const fs = require('fs');
const readline = require('readline');
const stream = require('stream');
const fs1 = require('fs');
const instream = fs.createReadStream('chicagocrimes.csv');
const outstream = new stream;
let writeStream1 = fs1.createWriteStream('theft1.json');
const fs2 = require('fs'); //module required to r... | true |
4fe238532864b5abd53eba7b1a5b21f919007346 | JavaScript | ryanosten/proj-05-responsive-layout-sass | /js/nav.js | UTF-8 | 869 | 2.71875 | 3 | [] | no_license | var $nav_button = $('<div class="nav-button"><a><img src=images/nav_icon.png></a></div>');
var nav_hidden = true;
//append the hamburger nav button
$(".main-header h1").append($nav_button);
//hide .nav-bar, show .nav-bar;
$nav_button.on("click", function() {
$(".nav-bar").toggle('fast');
if (nav_hidden == true)... | true |
b36ebba4f33cfaff2f0b13b95bf027e1a97c8361 | JavaScript | elasticsearch-cn/kibana | /src/core_plugins/timelion/public/__tests__/_tick_generator.js | UTF-8 | 1,303 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | import expect from 'expect.js';
import ngMock from 'ng_mock';
describe('Tick Generator', function () {
let generateTicks;
const axes = [
{
min: 0,
max: 5000,
delta: 100
},
{
min: 0,
max: 50000,
delta: 2000
},
{
min: 4096,
max: 6000,
delta: 2... | true |
3bf177d27d6cd279646fdf28f47ac645de3e138b | JavaScript | Nanduag0/taskmanager | /promises.js | UTF-8 | 1,939 | 3.015625 | 3 | [
"MIT"
] | permissive | require('./src/db/mongoose')
const User = require('./src/models/user')
/* User.findByIdAndUpdate('5ecfa1e3004ccc65f0ee28e7',{age: 2}).then((user)=>
{
console.log(user)
return User.countDocuments({age : 89})
}).then((result)=>
{
console.log(result)
}).catch((e)=>
{
console.log(e);
})
User.findByIdAndDelet... | true |
65f75ec2ec982a6d5f123f5d7f840454f8ef6be6 | JavaScript | compute-io/gammaincinv | /lib/matrix.js | UTF-8 | 1,501 | 3.15625 | 3 | [
"MIT"
] | permissive | 'use strict';
// MODULES //
var isMatrixLike = require( 'validate.io-matrix-like' );
// FUNCTIONS
var GAMMAINCINV = require( './number.js' );
// INVERSE INCOMPlETE GAMMA FUNCTION //
/**
* FUNCTION: gammaincinv( out, p, a[, tail] )
* Computes the inverse incomplete gamma function for each matrix element
*
* @par... | true |
97320ec9e5237dd2d59101cda26d5ae9cce3bc57 | JavaScript | schu34/Tuneweb | /test/test.js | UTF-8 | 6,323 | 2.78125 | 3 | [] | no_license | var assert = require("assert")
var expect = require("expect.js")
var utils = require("../public/js/utils.js")
var Graph = require("../lib/graph.js")
var AsyncTree = require("../lib/AsyncTree.js")
describe("utils", function() {
describe("#TitleCase()", function() {
it("capitalizes one word", function() {
... | true |
3d2c698101ddac69cdc3fa82528e9a4c06475ef7 | JavaScript | iota-community/mam-watcher | /sender.js | UTF-8 | 892 | 2.703125 | 3 | [] | no_license | ///////////////////////////////
// MAM: Publish messages to Public Stream
///////////////////////////////
const Mam = require('@iota/mam')
const { asciiToTrytes } = require('@iota/converter')
let mamState = Mam.init('https://nodes.devnet.thetangle.org:443')
mamState = Mam.changeMode(mamState, 'public')
const publish... | true |
d43bfff2429d15386ddbc43f86e8cefd6a7cfeac | JavaScript | breakds/SpaceHero | /js/engine/engine.js | UTF-8 | 980 | 2.5625 | 3 | [] | no_license | /***
This is supposed to be a singleton class
Do not create duplicated instance.
***/
var fps = 100;
var Game = function() {
this.status = "pause";
this.timer = null;
this.stage = null;
this.setStage = function( s )
{
if ( this.stage )
{
this.stage.clear();
}
for ... | true |
74c7dc9e4f28ac83a20beca8976b214bdfab55d2 | JavaScript | KirosHailay/CS472-wap | /js.js | UTF-8 | 1,262 | 3.765625 | 4 | [] | no_license | "use strict"
/*
author: kiros Gebregewergs
Problem requirment: to solve the problem using revealing module pattern
*/
const employee = (function() {
var name, age, salary;
function setAge(newAge) {
age = newAge;
};
function setSalary(newSalary) {
salary = newSalary;
};
function setName(newNa... | true |
dcd77c2a6944fef9d0e41c1339846de2827cdb7a | JavaScript | linfenpan/lfp-mock-web | /lib/common/request.js | UTF-8 | 2,547 | 2.671875 | 3 | [] | no_license | 'use strict';
const http = require('http');
const chalk = require('chalk');
const querystring = require('querystring');
const BufferHelper = require('bufferhelper');
/**
* GET 方式,请求一个资源
* @param {String} url 请求的资源
* @returns {Promise}
*/
function request(url) {
return new Promise((resolve, reject) => {
const... | true |
652f887c6ae0d04b104a0257ab815f427cd4dfb2 | JavaScript | alexzeda27/PlasticTecApp | /controllers/operator.js | UTF-8 | 1,851 | 2.609375 | 3 | [] | no_license | 'use strict'
//Librerias
//Carga de Modelos
var Operator = require('../models/operator');
//Carga de Métodos
var Methods = require('../status/methods');
//Función Obtener Operador
function getOperator(req, res)
{
var operatorId = req.params.id;
Operator.findById(operatorId).populate({ path: "employee", popu... | true |
92dd2220510471718e6614d28598b341c09035f4 | JavaScript | parkerhsu/LeetCode-Solution | /剑指offer-JS版/查找/旋转数组最小数字.js | UTF-8 | 876 | 3.765625 | 4 | [
"MIT"
] | permissive | function search(arr) {
if (!Array.isArray(arr) || !arr.length) {
throw new Error("Not an array");
}
let left = 0,
right = arr.length - 1,
mid;
while (left < right) {
if (left + 1 === right) return arr[right];
mid = Math.floor((left + right) / 2);
if (a... | true |
728905670d66f040a2008e71ea3bf24f55e5307f | JavaScript | afalek/weatherapp | /js/scripts.js | UTF-8 | 3,521 | 2.75 | 3 | [
"MIT"
] | permissive | $('document').ready(function() {
// get location using IP API
var location = "http://ip-api.com/json";
$.getJSON(location, function(data) {
var lat = data.lat;
var lon = data.lon;
var city = data.city;
var country = data.country;
// Use location data to get weather data from open weather API... | true |
50a6cd133faabc4d4cf3c08180ca229c4464bea9 | JavaScript | suhdev/scenario-generator | /src/logger/index.js | UTF-8 | 1,158 | 2.765625 | 3 | [] | no_license | var colors = require('colors'),
_ = require('lodash');
var LEVELS = {
info: 0x00001,
debug: 0x00002,
error: 0x00004,
log: 0x00008
},
COLORS = {
info:'green',
debug:'yellow',
error:'magenta',
log:'cyan'
};
module.exports = function(options){
var Logger = function(opts){
this.level = (opts.leve... | true |
cb987515d3b500305894160f565b507be01e77bf | JavaScript | zeyu93/task-manager | /src/routes/tasks.js | UTF-8 | 2,451 | 2.546875 | 3 | [] | no_license | var express = require("express");
var router = express.Router();
const Task = require("../models/Tasks");
const handleAuth = require("../middleware/auth");
router.get("/", handleAuth, async (req, res) => {
const { completed, page, size, sortBy } = req.query;
const match = {};
const sort = {};
if (completed) {
... | true |