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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
926f6a9dce25e8b0a50db9f8a72a81ddd6813e83 | JavaScript | jorge-vargas-p/Rahuitia | /client/actions/tautoko.js | UTF-8 | 280 | 2.640625 | 3 | [
"MIT"
] | permissive | export const incrementCount = count => {
const num = count + 1
return {
type: 'INCREMENT_COUNT',
count: num
}
}
export const decrementCount = count => {
const num = count - 1
return {
type: 'DECREMENT_COUNT',
count: num
}
} | true |
0e6388e0d2816919a170e8a0c2db42ca61e1f106 | JavaScript | Dale-/tdd-length | /src/length/__test__/length-test.js | UTF-8 | 2,525 | 2.9375 | 3 | [] | no_license | /**
* Created by Dale on 4/10/16.
*/
import Length from '../length';
import {Unit, UnitMap} from '../unit';
describe('Class Length', () => {
let lengthOneUnitM;
let lengthTwoUnitM;
let lengthOneUnitKM;
let lengthOneUnitCM;
let lengthTwoUnitCM;
let lengthOneHundredUnitCM;
let lengthOneTh... | true |
d0884845d59e7770e8065bd78856bc884b6b6691 | JavaScript | arturcp/arsenal | /app/assets/javascripts/modules/landing/shopping-cart.js | UTF-8 | 2,382 | 2.71875 | 3 | [] | no_license | define('shopping-cart', [], function() {
function ShoppingCart() {
this.productsCount = $('[data-products-count]');
this.totalPrice = $('[data-total-price]');
this.itemCounter = $('.shopping-cart__item-counter');
this.checkoutSubmit = $('[data-checkout-submit]');
this.checkoutRemoveButton = $('[da... | true |
656064f7f58f433da3624e834e9e56cf91491f2e | JavaScript | daniloprevides/corontine-cms-api | /cms-frontend/src/services/web-component.service.js | UTF-8 | 654 | 2.5625 | 3 | [
"MIT"
] | permissive | import { handleError } from "./default-service";
let loadedList = [];
export default {
loadWebComponent: async url => {
if (loadedList.indexOf(url) >= 0) return;
loadedList.push(url);
return new Promise((resolve, reject) => {
try {
var link = document.createElement("script");
link.... | true |
21d83784f5cb30deeae7c7e41f0fcdc6063745ab | JavaScript | itsKros/paypaltest | /assets/js/script.js | UTF-8 | 1,487 | 2.71875 | 3 | [] | no_license | $( document ).ready(function() {
$("#tbl").on("click", "td", function(){
$("#tbl td").removeClass("hasSelected");
$(this).addClass("hasSelected");
var urgency = $(this).parent("tr").find("th:first").text();
var currentPrice = $(this).text();
var currentPr... | true |
13fc01dccb57ee6510c832d7fb31d49885ab206c | JavaScript | jmb1993/rockpaperscissors | /w07/d04/ASSIGNMENT/js-ajax-lesson/starter-code/app/app.js | UTF-8 | 553 | 2.859375 | 3 | [] | no_license | $(document).ready(function(){
$('#new-doughnut').on('submit', sendOurDataViaAjax);
getDoughnuts();
})
function sendOurDataViaAjax(e){
e.preventDefault();
//use our form data to hit the api with js
var doughnut ={
style: $("form#new-doughnut select#doughnut-style").val(),
flavor: $("form#new-doughnut input#doughn... | true |
81f64e956b08f6666560f4631d911bdfe03f8b71 | JavaScript | kadikraman/presentation-intro-to-apollo | /slides/presentation/index.js | UTF-8 | 9,236 | 2.53125 | 3 | [
"MIT"
] | permissive | // Import React
import React from 'react';
import createTheme from 'spectacle/lib/themes/default';
import { Deck, Heading, Slide, CodePane, Image, Notes } from 'spectacle';
import restSrc from '../assets/rest.jpg';
import formidableLogoRedSrc from '../assets/formidable-red-logo.png';
import apolloWebsiteSrc from '../as... | true |
7fef6c247cd1c4acffb626acc96a78300754cba2 | JavaScript | Unosquare-CoE-JavaScript/alexis-delgado | /design_patterns/Structural/Proxy/property.js | UTF-8 | 568 | 3.859375 | 4 | [] | no_license | class Property {
constructor(value, name = "") {
this._value = value;
this.name = name;
}
get value() {
return this._value;
}
set value(newValue) {
if (this._value === newValue) return;
console.log(`Assigning ${newValue} to ${this.name}`);
this._value = newValue;
}
}
class Creature... | true |
c3dd1582ca74c3c4851b857b16e7e839942cfcf4 | JavaScript | camshaft/ast2template | /lib/safe-expression.js | UTF-8 | 694 | 2.609375 | 3 | [
"MIT"
] | permissive | module.exports = __ast2template_safe_expression;
function __ast2template_safe_expression(val, expr) {
if (!val || typeof val !== 'object' || Array.isArray(val)) return val;
if (process.env.NODE_ENV !== 'production') {
if (!__ast2template_safe_expression[expr[0] + expr[1]]) {
__ast2template_safe_expressi... | true |
05aa12c275ffbc30a90e4a7fa1482065e6a7212d | JavaScript | brand-icons/brands | /bin/build-sprites.js | UTF-8 | 1,576 | 2.75 | 3 | [
"MIT"
] | permissive | import fs from 'fs';
import path from 'path';
import ora from 'ora';
import icons from '../dist/icons.json';
import ICON_DIRS from '../util/icon-dirs.json';
import DEFAULT_ATTRS from '../util/default-attrs.json';
const spinner = ora();
const BRANDS = Object.keys(icons);
/**
* Get all icon objects for a given color... | true |
0a14fc84199eb532103144a8574d66c0f4e2bd93 | JavaScript | sghaierwassim/form-validation | /validation.js | UTF-8 | 1,167 | 2.953125 | 3 | [] | no_license | function valid(){
console.log("ab3ath")
let adress=document.getElementById("adress").value;
let name=document.getElementById("name").value;
let pass=document.getElementById("pass").value;
let msg=document.getElementById("msg").value;
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*... | true |
c5b1da12665406114a655439da6a8d708b4f85e3 | JavaScript | arpethel/SnakeGame | /SnakeStart/files/SnakeGame.js | UTF-8 | 1,056 | 2.765625 | 3 | [] | no_license | import GameBoard from '/GameBoard.js';
let buttonPressed = {"LEFT" : false, "UP" : false, "RIGHT" : false, "DOWN" : false, "N" : false, "P" : false};
export default class SnakeGame {
constructor(canvas) {
this.board = new GameBoard(canvas);
this.ConfigureKeyPressed();
}
ConfigureKeyPressed() {
document.onke... | true |
843eb6c8e23e0a0fb3446c8b7f00f0545a1128b6 | JavaScript | EricGlover/LoLDamageCalculator | /backend/DataScraper/WikiScraper.js | UTF-8 | 15,774 | 2.921875 | 3 | [] | no_license | const puppeteer = require('puppeteer');
class WikiScraperError {
constructor(e, info) {
this.e = e;
this.info = info;
}
}
/**
*
* example champion data url
* https://leagueoflegends.fandom.com/wiki/Template:Data_Sylas
*
* example champion ability url
* https://leagueoflegends.fandom.com/... | true |
8b39bd6fa0a384154de6f47dcb290eb439e2762f | JavaScript | sircodesalittle/codescape | /renderer.js | UTF-8 | 5,516 | 2.8125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"CC0-1.0"
] | permissive | // This file is required by the index.html file and will
// be executed in the renderer process for that window.
// All of the Node.js APIs are available in this process.
const {ipcRenderer} = require('electron')
const {remote} = require('electron');
const player = require('./player.js');
const entries = require('./ent... | true |
2d0399ef9bb6a0c81f983c94898d4ceaedd6b01d | JavaScript | Jahazielvaz/learningJavascript | /javascript/JSON AND AJAX.js | UTF-8 | 381 | 3.25 | 3 | [] | no_license | //https://learnwebcode.github.io/json-example/animals-1.json
var youtubeRequest = new XMLHttpRequest();
youtubeRequest.open ("GET", "https://learnwebcode.github.io/json-example/animals-1.json");
youtubeRequest.onload = function(){
var youtubeData = JSON.parse(youtubeRequest.responseText);
console.log(youtubeData[0]... | true |
8db03b80451e7e96974076db36da8d3799f0f7ec | JavaScript | nss-day-cohort-21/d21-spa-milestone-fang-w-shen | /javascripts/CarLot.js | UTF-8 | 996 | 2.78125 | 3 | [] | no_license | // This IIFE will add a new module to Carlot in the
// namespace of CarLot.Inventory
var CarLot = (function (globalScopeCarLot) {
// Define a private scope variable to store cars
let _car_inventory = [];
// Start building the Object that will be attached
// to the CarLot.Inventory namespace
let inventory ... | true |
3edc20bd4fa47cc5c97db1bac8573508a06a412f | JavaScript | appzing/pure-js-todo-app | /src/mixins/state.spec.js | UTF-8 | 1,505 | 3.125 | 3 | [] | no_license | import test from 'tape';
import State from './state';
test( 'State', t => {
let state, actual, expected;
// The state mixin is actually a function
state = State();
// We pull the state out of the mixin
actual = state.getState();
// Then the state should be an empty object
expected = {};
... | true |
3a97180d0ea8bcdd9c4dae5c9eb162c9fc37cb29 | JavaScript | emtseng/senior-enrichment | /utils/server.js | UTF-8 | 148 | 2.5625 | 3 | [] | no_license | export const httpErrorCreator = (statusCode, message) => {
const newError = new Error(message)
newError.status = statusCode
return newError
}
| true |
00e7c89f321a0401e56fb50fd093bdd5a076ece2 | JavaScript | sumanthSuvarna/User_Catalog | /src/components/products/productList.js | UTF-8 | 1,094 | 2.5625 | 3 | [] | no_license |
import React,{Component} from 'react';
import PropTypes from 'prop-types';
import GridList from '../common/GridList'
import GridTile from '../common/GridTile'
class ProductList extends Component {
constructor(props) {
super(props)
this.state = {
elements: this.buildProducts(props.products),
}
... | true |
2972ae7d586b6149ca0d0b2bddf9361fc4ab5fe9 | JavaScript | 7772/MessageApp | /src/redux/modules/profile.js | UTF-8 | 1,493 | 2.71875 | 3 | [] | no_license | // Action Types
const SHOW_PROFILE = "MESSAGEAPP/profile/SHOW_PROFILE";
const ADD_PROFILE = "MESSAGEAPP/profile/ADD_PROFILE";
const DELETE_PROFILE = "MESSAGEAPP/profile/DELETE_PROFILE";
// Action Creators
export const showProfile = bool => ({
type: SHOW_PROFILE,
bool
});
export const addProfile = userInfo => ({
... | true |
bea556af9ea9c75f75363f6753e024c28facdcd2 | JavaScript | ClaudioRicci/React-Todos | /react-todos/src/new-todo.js | UTF-8 | 770 | 2.5625 | 3 | [] | no_license | import React from "react";
import PropTypes from "prop-types";
export class NewTodo extends React.Component {
state = {
todoTitle: ""
}
render() {
const {todoTitle} = this.state;
return (
<form className="new-todo" onSubmit={this.onSubmit}>
<input
type="text"
class... | true |
34ea22f8d28a2985b7123ef5bb1ccdc3dc28aeb5 | JavaScript | AlexxNica/electron-cryptocoin-tracker | /renderer.js | UTF-8 | 1,341 | 3.140625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"CC0-1.0",
"LicenseRef-scancode-public-domain"
] | permissive | const ipc = require('electron').ipcRenderer
const smalltalk = require('smalltalk')
let app = null
let cryptocurrencies = ['BTC', 'ETH', 'LTC']
// Fetch price data from CryptoCompare API
function getPrices() {
return fetch(
`https://min-api.cryptocompare.com/data/pricemulti?fsyms=${cryptocurrencies.join(',')}&ts... | true |
0bbacd4c71714c90e9980ecde87cef3810b689fa | JavaScript | fordarnold/Broadcaster | /server/controllers/UserController.js | UTF-8 | 2,317 | 2.65625 | 3 | [
"MIT"
] | permissive | import User from '../models/User';
import Authenticate from '../helpers/auth';
class UserController {
static signUp(req, res) {
const userExists = User.userExists(req.body.email);
const username = User.usernameExists(req.body.username);
if (username) {
return res.status(409).... | true |
2b033847fc3bc990478a8413b623adf7351d783e | JavaScript | monikmakwana/bvp-FullStack | /frontendlayer copy/src/components/register.js | UTF-8 | 1,543 | 2.59375 | 3 | [] | no_license | import React from 'react';
import { constants } from '../utils/config';
export class Register extends React.Component{
constructor(props){
super(props);
this.state = {};
}
async doRegister(){
let userid = this.refs.userid.value;
let password = this.refs.pwd.value;
let... | true |
064d383540838e0527e221e8e3b7e8e1dfe2e033 | JavaScript | marcalexiei/superagent-jsonp | /src/superagent-jsonp.js | UTF-8 | 2,926 | 2.640625 | 3 | [
"MIT"
] | permissive | class SuperagentJSONP {
constructor(request, config = {}, callbackFunction) {
this.callbackParam = config.callbackParam || 'callback';
this.callbackName = config.callbackName || `superagentCallback${new Date().valueOf() + parseInt(Math.random() * 1000, 10)}`;
this.timeout = config.timeout || 1000;
thi... | true |
66c859cd758499bac2ceac2b7c1532ae1584b0b5 | JavaScript | eleerogers/fe-code-challenge | /src/js/utilities/dataParsingFunctions.js | UTF-8 | 1,423 | 2.859375 | 3 | [] | no_license | function cheapestVariant(variantsArr) {
return variantsArr.reduce((acc, cv) => {
return Number(acc.prices.regular) < Number(cv.prices.regular) ? acc : cv;
});
}
function findVariantImage(imagesArr, variantName) {
// find the first image of variant/option (there may be multiple)
const variantImage = imagesA... | true |
38b516b466c63c0f522688c4933a5a93574d7eb6 | JavaScript | mozhgan-ghasemzadeh/Personal-Page | /code.js | UTF-8 | 2,262 | 2.59375 | 3 | [] | no_license | function loadPage(){
var txt =location.href.split("#"),li;
if(txt.length==1)
li = "about";
else
li = txt[txt.length-1];
var ele = document.querySelector("ul").children;
var ele = document.querySelector(' a[ href = "#'+li+'" ]');
//rgb(140,130,121,0.3)
ele.parentNo... | true |
8856e8f374a2fa9ba33679cc87cec7512ef4b860 | JavaScript | caleb-ogbole/site2 | /arrow.js | UTF-8 | 1,302 | 3.234375 | 3 | [] | no_license | function z;
document.getElementsByTagName('div')[0]
.style.backgroundColor = 'red';
document.querySelector('div').style.backgroundColor = 'grey';
document.querySelector('button').addEventListener('click',()=> alert('hello!!!'));,
textcontent,innertext,innerHTML;
/*const userName = "admin";
const passWord = "admin123";... | true |
769a8b0e61a68dfbe92da43a94082e9bd26ee378 | JavaScript | joembaya/ReatcJS-Form | /components/signup.js | UTF-8 | 3,557 | 2.65625 | 3 | [] | no_license | //Showing Menu
var Menuheadload = React.createClass({
render: function () {
return (
<div> <a href="../" >HOME</a> | <a href="" > Signup </a> | <a href="http://www.athome.lu"> AtHomelu </a> </div>
);
}
});
ReactDOM.render(
<Menuheadload />,
... | true |
a092ca5cbc7b4a1617aecb701894de3674020f7a | JavaScript | marcoswitcel/kart-project | /web-src/source/libs/renderer.js | UTF-8 | 1,085 | 2.828125 | 3 | [] | no_license | import { Scene } from './scene-builder';
export default class Renderer {
/**
*
* @param {Node} node
* @param {Scene} scene
*/
static render(windowNode, scene) {
// Seta a altura, largura e perspectiva no elemento selecionado
windowNode.setAttribute('style', `width: ${... | true |
87a262fe94e196c5c5106b8c365f47de2c0d08f3 | JavaScript | corbel-platform/corbel-sdk-js | /test/node/unit/validate.js | UTF-8 | 8,014 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | 'use strict';
/* jshint camelcase:false */
var corbel = require('../../../dist/corbel.js'),
chai = require('chai'),
expect = chai.expect;
describe('Validate module', function() {
it('exists and is an object', function() {
expect(corbel.validate).to.be.an('object');
});
it('has all namesp... | true |
08dbbbce38d26958fc14ee73ca8a2e7fc1c0752c | JavaScript | danroche10/bank-tech-test | /src/Transaction.js | UTF-8 | 447 | 2.984375 | 3 | [] | no_license | /* eslint-disable no-underscore-dangle */
class Transaction {
constructor(transactionDate, transactionValue) {
this._transactionDate = transactionDate;
this._transactionValue = transactionValue;
this._transactionType = Transaction._transactionType(
this._transactionValue
);
}
static _transa... | true |
013bcac34aacda2c73b005e10db4bce4a553cd3b | JavaScript | yakhousam/FCC-SQAP-Anonymous-Message-Board | /tests/2_functional-tests.js | UTF-8 | 6,203 | 2.5625 | 3 | [] | no_license | /*
*
*
* FILL IN EACH FUNCTIONAL TEST BELOW COMPLETELY
* -----[Keep the tests in the same order!]-----
* (if additional are added, keep them at the very end!)
*/
var chaiHttp = require('chai-http');
var chai = require('chai');
var assert = chai.assert;
var server = require('../server');
chai.u... | true |
016e96393ad184956f81749d8d49165eefd2fe07 | JavaScript | summerce-platform/newDatatables | /js/testDialog.js | UTF-8 | 5,780 | 2.671875 | 3 | [] | no_license | "use strict";
/**
* UINamespace 샘플 확장
*
* 이것은 UINamespace 샘플의 팝업 확장 부분입니다.
* uiNamespace.js 외에 컨텍스트를 위해. 이 확장은
* 사용자의 구성 설정 수집 및 통신 담당
* 그 정보는 부모 확장으로 돌아갑니다.
*
*이 샘플은 이를 수행하는 두 가지 방법을 보여줍니다.
* 1) 제안되고 가장 일반적인 방법은 정보를 저장하는 것입니다.
* 설정 네임 스페이스를 통해. 부모는 다음과 같은 경우 알림을 구독 할 수 있습니다.
* 설정이 업데이트되고 그에 따라... | true |
ebcb5311bd05f99b9eaf837c85f3716d37b37bfe | JavaScript | tkim90/algorithms_practice | /.history/algorithms/quickSort/quickSort_20220226181327.js | UTF-8 | 678 | 3.828125 | 4 | [] | no_license | /*
Quicksort
select partition
base case:
len = 0 -> return []
len = 1 -> return [element]
return quicksort(left) + partition + quicksort(right)
*/
function quickSort(arr) {
if (arr.length === 0) return [];
if (arr.length === 1) return [arr[0]];
const partition = arr[0]; // artibitrarily pick the firs... | true |
b006de9884b6b7b3874022811c24653eb4eadb1f | JavaScript | achandi/learn-me-some-node | /06_mymodule.js | UTF-8 | 380 | 2.625 | 3 | [] | no_license | var fs = require('fs');
var path = require('path');
module.exports = function (dirname, extension, callback) {
fs.readdir(dirname, function(err, files) {
if (err) return callback(err);
else {
files = files.filter(function(file) {
if(path.extname(file) === '.' + extension) return true;
}... | true |
1b495f1443391d79d05496b70e61dd5c42a8fe77 | JavaScript | Dixit-Mendon/Shopping-App | /1_/index1.js | UTF-8 | 1,532 | 3.640625 | 4 | [] | no_license | const redux = require('redux');
const createStore = redux.createStore;
const BUY_CAKE = 'BUY_CAKE';
//action creater function --> returns an action (action is an object with type property)
const buyCake = () => {
return {
type: BUY_CAKE,
info: 'First redux action'
}
}
// (prevState, action) =>... | true |
1b193d972a5d1a33012a062e50be8a65d2225084 | JavaScript | Cherry180808/VuePrj | /src/lessons/es/js-inherit/inherit.js | UTF-8 | 2,437 | 4.40625 | 4 | [] | no_license | // //创建对象的方式
// //1.------------------------------------------------生命一个对象
// function createPerson(name) {
// var obj = {};
// obj.name = name;
// obj.greeting = function() {
// console.log("Hello, my name is " + name);
// };
// return obj;
// }
// let json1 = createPerson("json1");
// console.log(json1... | true |
fdb9841c2efdde05b83c2944e1bd477fa459c8d0 | JavaScript | smcnaught/Advent-Of-Code | /shared/subsets/getSubsets.js | UTF-8 | 867 | 3.296875 | 3 | [] | no_license | let fs = require("fs");
const combine = (a, min) => {
const fn = function (n, src, got, all) {
if (n == 0) {
if (got.length > 0) all[all.length] = got;
return;
}
for (let j = 0; j < src.length; j++) {
fn(n - 1, src.slice(j + 1), got.concat([src[j]]), all);
}
return;
}
let al... | true |
bc61897128a377db68ddc7358c880e64b6caaaaf | JavaScript | christinebussingerdev/JavaScript-IV | /assignments/lambda-classes.js | UTF-8 | 1,813 | 3.375 | 3 | [] | no_license | // CODE here for your Lambda Classes
class Person {
constructor(personAttrs) {
this.name = personAttrs.name;
this.age = personAttrs.age;
this.location = personAttrs.location;
}
speak() {
console.log(`Hello, my name is ${this.name}, I am from ${this.location}`);
}
}
cla... | true |
4e7ad95ee7603299f21f41e7d3bfc8c9f54d0ba7 | JavaScript | joyjoe/nodeBook | /source/004/02_buffer_operation.js | UTF-8 | 586 | 3.1875 | 3 | [
"MIT"
] | permissive | var chalk = require("chalk");
// buffer methods
var buffer1 = Buffer.from("I ");
var buffer2 = Buffer.from("am ");
var buffer3 = Buffer.from("from ");
var buffer4 = Buffer.from("China!");
var buffer = Buffer.concat([buffer1, buffer2, buffer3, buffer4]);
var subBuffer = Buffer.concat([buffer1, buffer2, buffer3, buffer4... | true |
bb3a0d715e1cb809439a4fa547367d35ab8a378b | JavaScript | ashishdotme/code.ashish.me | /patterns/sliding-window/06-fruit-baskets.js | UTF-8 | 503 | 3.40625 | 3 | [] | no_license | /**
*
* Ashish Patel
* e: ashishsushilPatel@gmail.com
* w: https://ashish.me
*
*/
const fruitBaskets = trees => {
let left = 0
let w = {}
let max = 0
for (let right = 0; right < trees.length; right++) {
w[trees[right]] = w[trees[right]] + 1 || 1
while (Object.keys(w).length > 2) {
w[trees[l... | true |
152462f7f3f44d1ca89e2dc3eb457054685d9251 | JavaScript | jasontschool/tabletop-master | /js/hand.js | UTF-8 | 4,101 | 2.703125 | 3 | [] | no_license | /*
Hand class. This is simply a subclass of deck,
as most of the options are the same.
*/
var Hand = function(){
this.cards = new Array();
//
}
Hand.prototype = new Deck({cards:"Varies by hand"});
Hand.prototype.constructor = Hand;
Hand.prototype.drawFromDeck = function(deck) {
var car... | true |
2683f7f750d4690ed01116ad009fe0525229420b | JavaScript | tnhuynh09/ReactJoblyFrontend | /src/Search.js | UTF-8 | 879 | 2.5625 | 3 | [] | no_license | import React, { useState } from "react";
import "./Search.css";
function Search({ handleSearch }) {
const [searchTerm, setSearchTerm] = useState("");
function handleSubmit(evt) {
evt.preventDefault();
handleSearch(searchTerm);
}
function handleChange(evt) {
setSearchTerm(evt.t... | true |
b7103d7edc660dc1969bae32c255b66c44c307b7 | JavaScript | littileyu/Operation-assistant | /src/common/js/util.js | UTF-8 | 230 | 2.65625 | 3 | [] | no_license | export function normalizePage(page) {
let list = page.list
let pageNum = page.pageNum
let pageSize = page.pageSize
list.forEach((item, index) => {
item.index = (pageNum - 1) * pageSize + 1 + index
})
return list
}
| true |
e95e3013a1479f66d6c4ae35407d6febf3dac65d | JavaScript | Pobermeier/shoppizilla-app | /src/hooks/useLocalstoragePersist.js | UTF-8 | 430 | 2.515625 | 3 | [] | no_license | import { useEffect } from "react";
const useLocalstoragePersist = (keyString, itemToObserve, setterFn) => {
useEffect(() => {
const item = localStorage.getItem(keyString);
if (item) {
setterFn(JSON.parse(item));
}
}, [keyString, setterFn]);
useEffect(() => {
localStorage.setItem(keyString,... | true |
a826ffad0598333614fa8b3f99553302dbc54aa2 | JavaScript | EmanuelaMollova/Frontend-JavaScript | /week1/problems/19_nested_ol/solution.js | UTF-8 | 811 | 2.859375 | 3 | [] | no_license | "use strict";
var SPACES_FOR_TAB = 2;
var ol = function(items) {
return printList(0, 'ol', items);
};
var printList = function(tab, type, items) {
var content = items.map(function(object) {
var childrenList = object.children ?
"\n" + printList(tab + 2, type, object.children) + "\n" : '';
... | true |
f2b2654ac8ab04bf0663ac69e8cf8aee25b52bb9 | JavaScript | labsan/dicoding-pwa-resthunter-app-optimized | /specs/favoriteRestoArraySpec.js | UTF-8 | 769 | 2.546875 | 3 | [] | no_license | import { itActsAsFavoriteRestoModel } from './contract/favoriteRestoContract';
let favoriteResto = [];
const FAVORITE_RESTO_ARRAY = {
getRestaurant(id) {
if (!id) {
return;
}
return favoriteResto.find((resto) => resto.id === id);
},
getAllRestaurant() {
return favoriteResto;
},
put... | true |
f86ac52c84193138a4cde09e8f6dbde07b476a09 | JavaScript | liyangli/epg_adapter | /server.js | UTF-8 | 6,801 | 2.625 | 3 | [] | no_license | /**
*
* udp服务器类。主要在指定位置进行接受对应数据
*
* 主要进行模拟对应137进行处理
*
* auth: liyangli
* date: 17/5/16 上午9:27 .
*/
"use strict";
const setting = require('./setting');
/**
* udp接收处理类
*/
class UdpRevice{
constructor(ev){
const dgram = require('dgram');
const serverSocket = dgram.createSocket('udp4');
... | true |
303b1b9625581f5bb736c52c206e50b05127fc34 | JavaScript | smokeelow/ChatKit | /client/app/js/client.js | UTF-8 | 9,546 | 2.515625 | 3 | [] | no_license | window.addEventListener('DOMContentLoaded', function () {
/*********** SOCKET EVENTS ***********/
var socket = new WebSocket('ws://localhost:8080');
/**
* Open socket
*/
socket.addEventListener('open', function () {
document.getElementById('overlay').style.display = 'none';
});
... | true |
a9d18222c89cbd334d0c8e63abe667665eb4a503 | JavaScript | dooremont/globalemsg-hilary | /lib/rest.js | UTF-8 | 6,312 | 2.609375 | 3 | [] | no_license | // Get a named logger so we can post messages in the log
var log = require('oae-logger').logger('oae-globalemsg-rest');
// Import the core OAE utility that contains the Express servers on which we can bind routes
var OAE = require('oae-util/lib/oae');
// Import the API component to get the global message create and l... | true |
29a308735ce0602c9e9601f01d334a3c57fe216f | JavaScript | JTThrapp/js-fundamentals | /1-grammarAndTypes/02-declarations.js | UTF-8 | 392 | 4.28125 | 4 | [] | no_license | // Variables
let a = 2;
// this declares "a" to be a variable and then initializes it to be 2
console.log(a);
let b = 123 ;
// 1 2 3 4
/*
1 - Keyword
2 - name you give the variable
3 - assignment operator
4 - value
*/
numberone = "Riker";
console.log(num... | true |
2d14b347f49b9213a8794f944b2867af876fbc7a | JavaScript | sandstone1/course-github-finder | /src/context/alert/alert.reducer.js | UTF-8 | 714 | 2.96875 | 3 | [] | no_license |
import {
SET_ALERT,
REMOVE_ALERT
} from '../types';
// remember a reducer is just a function and the reducer takes in 2 arguments, the state and
// the action and then we want to use a switch statement to evaluate the action type and then
// within the return{}; we are updating the state
const AlertReducer ... | true |
6b8c5bdefdc5e4aa9e296f6110fe4d8c9052d6f8 | JavaScript | zheath/2020aoc | /classes/Grid.js | UTF-8 | 2,490 | 3.453125 | 3 | [] | no_license | const _ = require('lodash');
class Grid {
constructor(rows, cols, data){
this.rows = rows;
this.cols = cols;
this.nodes = data;
}
setNode(posn, value){ this.nodes[posn.y][posn.x] = value }
forEachCell(fn){ this.nodes.forEach((row, rowNum) => { row.forEach((cellValue, colNum) => ... | true |
57d43e200f0e8ebb7f486b125f671642bdc588ff | JavaScript | BLZbanme/leetcode | /0301-0400/0301-0350/0349IntersectionOfTwoArrays/demo-1.js | UTF-8 | 192 | 2.71875 | 3 | [] | no_license | "use strict";
function intersection(nums1, nums2) {
var set1 = new Set(nums1);
var set2 = new Set(nums2);
return Array.from(set1).filter(function (e) { return set2.has(e); });
}
;
| true |
8a53a206a07238030f1d7a2171da9f92905db105 | JavaScript | JoeShep/JS-drills-and-sample-apps | /2014-01-23-Inception.Boxes/app/js/source/main.js | UTF-8 | 1,198 | 3.015625 | 3 | [] | no_license | (function(){
'use strict';
$(document).ready(init);
function init(){
$('#btn').click(inceptionize);
$('#number').keypress(submitWithEnter);
$('#clear').click(clearScreen);
}
function submitWithEnter(){
if (event.keyCode === 13) {
inceptionize();
}
}
function clearScreen(){
... | true |
0048aa4194154cdc07a990b81cdb791e75751a87 | JavaScript | baikhonov/keksobooking | /js/filter.js | UTF-8 | 4,397 | 2.765625 | 3 | [] | no_license | 'use strict';
(function () {
var initialAds = [];
var filteredAds = [];
var filterForm = document.querySelector('.map__filters');
var filterHouseType = filterForm.querySelector('#housing-type');
var houseTypeValue = filterHouseType.value;
var filterHousePrice = filterForm.querySelector('#housing-price')... | true |
5d2b9a83bd0dc964b6e737652c38207243589832 | JavaScript | butfunny/d3-chart | /src/app/components/bar-chart/bar-chart.jsx | UTF-8 | 2,117 | 2.625 | 3 | [] | no_license | import React from "react";
import dataTSV from "./data";
export class BarChart extends React.Component {
constructor(props) {
super(props);
}
render() {
let svgWidth = 960, svgHeight = 500,
margin = {top: 20, right: 20, bottom: 30, left: 40},
width = svgWidth - mar... | true |
bd2103f47fb628682c1b6bb89f201521052930d0 | JavaScript | rztlxqrqn/practice | /trains/test/graghTest.js | UTF-8 | 4,061 | 2.90625 | 3 | [] | no_license | const expect = require('chai').expect;
const Graph = require('../lib/graph');
describe('generate a graph.first step:generate a empty graph;second step:add edges one by one',()=>{
describe('empty graph',()=>{
it('constructor',()=>{
let graph = new Graph();
expect(graph instanceof Graph).to.be.true;
... | true |
f0b6738332c09afe30df866866244b9812d7850b | JavaScript | tobkle/create-graphql-server-query-arguments | /resources/inline-invariant.js | UTF-8 | 1,391 | 2.578125 | 3 | [
"MIT"
] | permissive | /**
* Copyright (c) 2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';... | true |
db92daf04259af7fd8c230853e528a7c8d34662b | JavaScript | saylestyler/gaythub | /queensWithClass.js | UTF-8 | 2,011 | 3.8125 | 4 | [] | no_license | /*
* Q: what's all this class stuff and what's it look like when it's compiled to es5
* A: a quicker way that compiling with grunt/gulp or some other build tool is to just use babel's repl
* https://babeljs.io/en/repl
*/
class DragQueen {
constructor (name, wig, designer) {
this.name = name
this.wig = wi... | true |
56e37c38c744fbf83536720ded22a3528da32fe1 | JavaScript | BillyG83/nextjs | /pages/pokemon/index.js | UTF-8 | 1,025 | 2.5625 | 3 | [] | no_license | import { useRouter } from 'next/router'
import styles from './Pokemon.module.css'
function PokemonList() {
const pokemon = require('pokemon');
const allPokemonANames = pokemon.all();
const router = useRouter()
const handleSelection = function(event) {
event.preventDefault()
if(!event.target.id) return
route... | true |
ca5a245dd1090997adca31028f0cc0118a9e0a4c | JavaScript | sebastiangr10/taller_ciclos | /ejercicio16/ej16.js | UTF-8 | 88 | 2.53125 | 3 | [] | no_license | function ciclo(){
for(let i=100;i>=1;i--){
document.write(i +"<br>")
}
} | true |
13591570dae00ee26e497f0449efac06c359cd10 | JavaScript | green-fox-academy/geriari | /week-07/day-2/01_giphy_api/giphy_api.js | UTF-8 | 852 | 2.875 | 3 | [] | no_license | 'use strict'
console.log('OK');
const myAPIKey = 'QF5htYCILFyqeSK6Ea5hGo6oCreq8KgU';
let httpRequest = new XMLHttpRequest();
httpRequest.open('GET', `http://api.giphy.com/v1/gifs/search?q=monkey&api_key=${myAPIKey}&limit=16`, true);
httpRequest.send();
httpRequest.onreadystatechange = () => {
if (httpRequest.read... | true |
186aeb9c4c0972ee16e2ef4badf0c3f1e3392294 | JavaScript | gondr99/riot | /sample.js | UTF-8 | 169 | 2.734375 | 3 | [] | no_license | let obj = {"name":"최선한", "job":"교사", "nickname":"gondr"};
let list = Object.keys(obj);
for(let i = 0; i < list.length; i++){
console.log(obj[list[i]]);
} | true |
781eb9dc33572f53bc8a032b447b5f4988a373b2 | JavaScript | barish90/barish-bozkurt-project3 | /src/Planters.js | UTF-8 | 1,219 | 2.546875 | 3 | [] | no_license | import firebase from './firebase';
import { useEffect, useState} from 'react'
import './Planters.css';
const dbRef = firebase.database().ref(); // declaring db ref
function Planters() {
const [planters, setPlanters] = useState([]);
useEffect( () => {
dbRef.on('value', (response) =>{
const n... | true |
4c1c23c167edf6344046f1a4acdd6991fe7c3e25 | JavaScript | umangmathur92/studentWebsite | /routes/search.js | UTF-8 | 1,077 | 2.515625 | 3 | [] | no_license | var express = require('express');
var router = express.Router();
const dbConnection = require('../db/index.js');
router.post('/', function(req, res, next) {
var key = req.body.search_query;
var searchCriteria = req.body.search_criteria;
var columnName = "";
switch(searchCriteria) {
case "First-... | true |
1f07b18542d50c797daa44627aa3806967997a65 | JavaScript | shahzaibMughal/shahzaib | /public/js/app.js | UTF-8 | 15,091 | 2.578125 | 3 | [] | no_license | $('document').ready(function(){
//******** Detect Scroll position and hide show nav
const MAIN_NAV = $('#main_sticky_nav');
// const MAIN_NAV = $('.js--main_nav');
var position = $(window).scrollTop();
// should start at 0
$(window).scroll(function() {
var scroll = $(window).scrollTop... | true |
2cd8484ed9df487ebdd9213fd50eb4ad7f1e8880 | JavaScript | angsherpa232/node_backend | /server/hash.js | UTF-8 | 589 | 2.640625 | 3 | [] | no_license | const bcrypt = require('bcrypt');
const {MD5} = require('crypto-js');
const jwt = require('jsonwebtoken');
// const secret = 'mysecret';
// const secretSalt =
// const user = {
// id: 1,
// token: MD5('angdawa').toString() + secretSalt
// }
// const receivedToken = '5ed34f06304fbdc779d8f9cd765e7bce';
// i... | true |
5827da04aa7aadbfacb8c6cbef62fec17ffbfbcb | JavaScript | AlanMendozax/Javascript | /Exercises/Ejercicio 4/JS/JSEjercicio4.js | UTF-8 | 1,316 | 3.703125 | 4 | [] | no_license | /* Funcion que se encarga del evento click del boton */
window.onload = function(){
document.getElementById("enviar").onclick = function(){
Palindromo();
}
}
/* Inicio de la funcion palindromo */
function Palindromo(){
/*Variables para text1 frase, cantidad, invertido*/
var txt = document.getElementByI... | true |
9456b99b978350c1b0824943ccd7a486bde8c771 | JavaScript | paul-chelarescu/HackKings | /snake.js | UTF-8 | 4,151 | 2.9375 | 3 | [] | no_license | //initializing canvas
var canvas = document.getElementById("canvas"),
ctx = canvas.getContext("2d"),
//full width and height
w = window.innerWidth,
h = window.innerHeight;
canvas.height = h;
canvas.width = w;
var reset, scoreText, menu, reMenu, score = 0;
function init() {
menu=startMenu();
menu.style.zIndex = "... | true |
227cf0491084e309c9d9f7e7198137fba55ad798 | JavaScript | ANURAGVASI/react-redux-tut | /src/selectors/expensesSelector.js | UTF-8 | 723 | 2.90625 | 3 | [] | no_license | // get all Expenses based on filters
export const getVisibleExpenses = (expenses,{ text, sortBy, startDate, endDate}) => {
return expenses.filter((expense) => {
const startDateFilter = typeof startDate !== 'number' || expense.createdAt >= startDate;
const endDateFilter = typeof endDate !== 'number'... | true |
2602bf53150d2b53a93351bc02781654307c77f2 | JavaScript | vanessaaurellia/Heartland | /Assets/registerscript.js | UTF-8 | 2,730 | 2.953125 | 3 | [] | no_license | let mainNav = document.getElementById("js-menu");
let navBarToggle = document.getElementById("js-navbar-toggle");
navBarToggle.addEventListener("click", function() {
mainNav.classList.toggle("active");
});
var button = document.getElementById('registerbutton');
button.disabled = true;
function validasi... | true |
209a541bda4397a8107904744492592d456bf9b2 | JavaScript | marzdevs/100-javascript-projects | /exercises/081816-recursion.js | UTF-8 | 1,661 | 4.96875 | 5 | [] | no_license | // Recursion
// We’ve seen that % (the remainder operator) can be used to test whether a number
// is even or odd by using % 2 to check whether it’s divisible by two.
// Here’s another way to define whether a positive whole number is even or odd:
// Zero is even. One is odd.
// For any other number N, its evenness i... | true |
46d6bfbb18ea849f6f0f225f6c1a976e5d382f9f | JavaScript | newjersey/career-network | /components/Firebase/useUserSubcollection.js | UTF-8 | 3,216 | 2.71875 | 3 | [
"MIT"
] | permissive | import { useEffect, useRef, useState } from 'react';
import useAuth from '../Auth/useAuth';
// Adapted from JSum implementation: https://github.com/fraunhoferfokus/JSum
// Foregoing a full library to avoid the weight, since this is such a narrow need.
// Note that this just serializes (doesn't create an actual hash) ... | true |
ca3b9249096e1011b7be3d870e435e63966d443d | JavaScript | zship/joss | /src/jossx/GameLoop.js | UTF-8 | 3,672 | 2.78125 | 3 | [
"MIT"
] | permissive | /*
* Implements a fixed-timestep game loop
* http://gafferongames.com/game-physics/fix-your-timestep/
*/
define(function(require) {
var $ = require('jquery');
var declare = require('dojo/_base/declare');
var lang = require('dojo/_base/lang');
// requestAnimationFrame polyfill by Erik Möller
// fixes from Pa... | true |
47bb0bccfdea5b98427d27783dbd97d1fd605a40 | JavaScript | whoant/facebook-give-away | /module/share.js | UTF-8 | 458 | 2.515625 | 3 | [] | no_license | const axios = require('axios');
async function getShare(token, idpost, limit){
return await axios.get('https://graph.facebook.com/'+idpost+'/sharedposts?fields=from&limit='+limit+'&access_token='+token)
.then(function(response){
// console.log(response.data.data.length)
if(response.data.data.length != 0){
ret... | true |
a8c53ec6600c188c71df36b799763c4b13ccd3b8 | JavaScript | noodle-learns-programming/experimental-hq | /google-compiler/second.js | UTF-8 | 236 | 2.921875 | 3 | [] | no_license | //java -jar compiler.jar --js_output_file=second.min.js second.js
(function(){
var STR_HELLO = 'Hello world!';
var PI = 3.1416;
function test()
{
alert(2*PI*10);
alert(STR_HELLO);
}
test();
})(); | true |
fa9c7b399c24796782232de1faf3030e59a2d5da | JavaScript | poojams1710/nodexpress | /Javascript Tutorial/ac.js | UTF-8 | 713 | 3.6875 | 4 | [] | no_license | //extracting letters from words sentenc
var firstname="mohit";
var l1=firstname[0];
console.log(l1);
//String are immutable means once it created it cannt be altered again .it does not means it can be changed
/*var str1="jello world";
str1[0]="h";
//it show error
str1="hello world" work*/
// to get thhe last ... | true |
21dab86a5045693fb937eec25ea3204db7f207a0 | JavaScript | clburdette/BurdetteCurtis_CIS14a_42098 | /Proj/cis14astoreproject/actions.js | UTF-8 | 19,910 | 2.640625 | 3 | [] | no_license | var currentCart = [];
var cartItems = 0;
var $title = "title";
var $year = "year";
var $rarity = "rarity";
var $price = "price";
function srtIndx(obj,sort)//sort function takes object to sort and attribute to sort by
{
var idx = obj;
for (i = 0; i < idx.length; i++)
{
for (j = 1; j < idx.length... | true |
f08ae2048032a2f5c3db0d5960ece935e0a1f86d | JavaScript | mluria21/vue-input-fields | /src/forms/validators/required.js | UTF-8 | 160 | 2.921875 | 3 | [] | no_license | export function required(value,label){
if(typeof value === 'string')value = value.trim()
if(!value){
return `${label} is required`
}
} | true |
8cbd41e0eb6a8b4dcf080ebc89b4d20482f852d9 | JavaScript | KSriki/react-events-in-detail-lab-dc-web-082718 | /src/components/CoordinatesButton.js | UTF-8 | 411 | 2.796875 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // Code CoordinatesButton Component Here
import React, {Component} from 'react';
export default class CoordinatesButton extends Component {
handleCoord = (e) => {
const coord = [e.clientX,e.clientY];
if(this.props.onReceiveCoordinates(coord)){
console.log(coord)
}
}
... | true |
7f005b432f039cb66c26e064de4c10a628896ad1 | JavaScript | MisterMChem/ZolaExample | /react-isomorphic-render/tools/static-site-generator.js | UTF-8 | 1,243 | 3.046875 | 3 | [
"MIT"
] | permissive | // 1. Run the website locally in production mode
// 2. Run this script passing the `PORT` environment variable
// 3. See the output folder (`../static` by default) for the statically generated website snapshot
// 4. Copy webpack-built assets to the output folder too
// 5. Host the output folder in the cloud at virtuall... | true |
94566c465d05ef03796a33cee2a785f6472a65b9 | JavaScript | Ashwinisuresh22/portfolio | /resources/img/street/addimages.js | UTF-8 | 580 | 3.125 | 3 | [] | no_license | const total_images = 4;
(function () {
let html, newHtml;
for (let i = 1; i <= total_images; i++) {
//create HTML string with placeholder text
html =
'<div class="img"><a href="resources/img/street/#.jpeg" data-toggle="lightbox" data-gallery="example-gallery" class=""><img src="resources/img/street/#... | true |
90ed1c8337f97a11e80e6fc0884ffb4135d5e9a3 | JavaScript | enajeeb/javascript-es6-learn | /arrow-functions.js | UTF-8 | 1,538 | 4.875 | 5 | [
"MIT"
] | permissive | // => fat arrow
//////////////
// implicit return
//////////////
const add = (a, b) => a + b;
// console.log(add(1,2));
//////////////
// with curly braces
//////////////
const sub = (a, b) => {
// return statement is required
return a - b;
}
// console.log(sub(5, 2));
//////////////
// parenthesis can be ... | true |
16286b91f1bbd356ec807834c4a3ed20b7ebef10 | JavaScript | nickliqian/keep_learning | /KnowledgeMapping/JavaScriptExp/1-Code/3-js-fucntion.js | UTF-8 | 361 | 3.25 | 3 | [
"MIT"
] | permissive | function abs(x) {
if (x >= 0) {
return x;
} else {
return -x;
}
}
var abs = function (x) {
if (x >= 0) {
return x;
} else {
return -x;
}
};
function abs(x) {
if (typeof x !== 'number') {
throw 'Not a number';
}
if (x >= 0) {
return x... | true |
da799a65743ba37585882b9758c225c1651d65a5 | JavaScript | aymzki/liri-node-app | /liri.js | UTF-8 | 5,539 | 3.140625 | 3 | [] | no_license | require("dotenv").config();
//all variables
var keys = require("./keys.js");
var fs = require("fs");
var request = require("request");
var moment = require('moment');
var Spotify = require('node-spotify-api');
var axios = require("axios");
//make log.txt file
var filename = './log.txt';
//NPM module used to write outp... | true |
894a1cdca03fd920089b0f519d83e9a4e9b727da | JavaScript | Benleie/hello-world | /try/underscore/do.js | UTF-8 | 746 | 2.53125 | 3 | [] | no_license | var _ = require('./183.js')
var fs = require("fs")
var util = require("util")
// console.log(exports)
// console.log(module)
var cache = [];
function output(o){
return JSON.stringify(o, function(key, value) {
if (typeof value === 'object' && value !== null) {
if (cache.indexOf(value) !== -1)... | true |
cd685add2fe0d7fd4a1eae851689f4f55b03f7bc | JavaScript | eBorovikov/homework | /lesson-2/10.js | UTF-8 | 272 | 3.609375 | 4 | [] | no_license |
const arr = [6, 5, 4, 3, 2, 1];
for(let i = 0; i < arr.length; i++){
for (let j = 0; j < arr.length; j++){
if(arr[j] > arr[j+1]){
let temp = arr[j];
arr[j] = arr[j+1];
arr[j+1] = temp;
}
}
}
console.log(arr);
| true |
75c20c2f40e60332eb7546362f3eb5f6e499956f | JavaScript | yfdyh000/Cookie-AutoDelete | /src/services/WhiteListService.js | UTF-8 | 2,619 | 2.953125 | 3 | [
"MIT"
] | permissive | const defaultWhiteList = "defaultWhiteList";
class WhiteListService {
constructor(items, contextualIdentitiesEnabled = false) {
this.cookieWhiteList = new Map();
//Sets up the whitelist for the map
if(contextualIdentitiesEnabled) {
cache.nameCacheMap.forEach((value, key, map) => {
let cookieStoreId = ke... | true |
7e70601ecc4053219db14adff34e5984a4001492 | JavaScript | onipetheoderic/tchatbackend | /controllers/categoryController.js | UTF-8 | 815 | 2.734375 | 3 | [] | no_license | const mongoose = require('mongoose');
const Category = mongoose.model("Category");
exports.createCategory = async (req, res) => {
// now we can acccess req.payload because we have added it in the middleware
const { name } = req.body;
const { id } = req.payload;
const nameRegex = /^[A-Za-z\s]+$/
if... | true |
0c0363108d75847817a76e17eeb4c6c068470935 | JavaScript | patyattack/resort | /src/components/RoomsFilter.js | UTF-8 | 1,443 | 2.546875 | 3 | [] | no_license | import React, { useContext } from 'react';
import { RoomContext } from '../Context';
import Title from '../components/Title';
// get all unique values
const getUnique = (items, value) => {
return [...new Set(items.map(item => item[value]))]
}
export default function RoomsFilter({rooms}) {
const context = useC... | true |
38a821035a47920650a8b71bd32e32a6d8f0869d | JavaScript | gauravs2989/Trains | /src/server/game/MapHex.js | UTF-8 | 1,433 | 2.6875 | 3 | [] | no_license | /**
* Represents a Hex on the Map from the model side
*
* The term rotation is used to indicate the amount of rotation in 60 degree
* units from the standard orientation of the tile (sometimes the term
* orientation is also used to refer to rotation).
* Rotation is always relative to the standard orientation, w... | true |
22f3c76131778739ae4cf0cc27f9440b41aa3673 | JavaScript | xiaowenyong/shenchong | /js/login.js | UTF-8 | 298 | 2.78125 | 3 | [] | no_license | // JavaScript Document
function xlogin(){
var user = document.getElementById("user").value;
var password = document.getElementById("password").value;
if( user == "xiaowenyong" && password =="123456"){
return true ;
}else{
alert("用户名或密码错误!");
return false;
}
} | true |
3478349ba475edc0fda2e5633575efa8ae225f63 | JavaScript | DivyaTyagi1111/react | /src/contacts/App.js | UTF-8 | 1,651 | 2.828125 | 3 | [] | no_license | import Contact from './Contact'
import {useRef, useState, useEffect} from 'react'
const URL='http://laozi.in:8000/contacts'
function App(){
const name_ref=useRef()
const ph_ref=useRef()
const mail_ref=useRef()
const [contact, setContact]=useState([])
const [detail, setDetail] = useState({})
... | true |
f2f69e722759338e45a2aae11d49b0f297d299cb | JavaScript | tjakopec/OSC3JS | /02_varijable_tipovi_podataka/ljubavniKalkulator1.js | UTF-8 | 188 | 3.0625 | 3 | [] | no_license | var ime1;
var ime2;
ime1 = prompt("Unesite ime 1. osobe", "Marija");
ime2 = prompt("Unesite ime 2. osobe", "Marko");
alert(ime1 + " i " + ime2 + " se vole " + Math.random()*100 + " %");
| true |
90ce5eba1e8fcc8d8b7617e9b04afc9f6fb8a9ad | JavaScript | svard/svard-mail | /modules/utils.js | UTF-8 | 1,794 | 2.53125 | 3 | [
"MIT"
] | permissive | module.exports = (function() {
'use strict';
var _ = require('underscore');
var existy = function (x) {
return x !== null;
};
// var truthy = function (x) {
// return (x !== false) && existy(x);
// };
var cat = function () {
var head = _.first(arguments);
... | true |
d432e28a45ff6356c54a7564f6089e4bf4c765af | JavaScript | THEjoezack/BoxPusher | /public/config.js | UTF-8 | 3,821 | 2.59375 | 3 | [] | no_license | (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.ex... | true |
e90cf25b06b557144bfbd26051cb119e9a86bb57 | JavaScript | qcom/emobo | /src/lib/expand.js | UTF-8 | 674 | 2.984375 | 3 | [
"MIT"
] | permissive | var validator = require('./validator');
function expand(input, dictionary, prefix='$') {
let escapeRegExp = (string) => string.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
let marks = [];
input.split('').forEach((c, pos) => {
if (c === prefix) marks.push(pos);
});
let keys = [];
marks.forEach((mark) => {... | true |
06147a33ff752af7e69ea3009429900643903ddb | JavaScript | jsbenning/js-tictactoe-rails-api-backend-v-000 | /app/assets/javascripts/tictactoe.js | UTF-8 | 1,519 | 2.796875 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | $(document).ready(function() {
attachListeners();
});
var player = function() {
if (turn % 2 === 0) {
return "O";
} else {
return "X";
}
}
function attachListeners() {
console.log("Yeah");
$('td').on('click', function() {
});
$('#save').on('click', function() {
... | true |