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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
daa2ffb73b746bf7aea46ae875a5beb61c28d716 | JavaScript | sprise/plant | /app/components/ReactDebugSettings.jsx | UTF-8 | 1,544 | 2.8125 | 3 | [
"MIT"
] | permissive | const React = require('react');
class DebugSettings extends React.Component {
constructor() {
super();
this.clickCheck = this.clickCheck.bind(this);
let debugSettings = localStorage.getItem('debug-settings');
try {
debugSettings = JSON.parse(debugSettings);
} catch(e) {
debugSettings ... | true |
391b2025bc8cebfec319a436cef4be847e5e26a4 | JavaScript | howareyoucolin/infiscroll | /src/index.js | UTF-8 | 2,057 | 2.546875 | 3 | [] | no_license | import './style.css';
import $ from 'jquery';
import scroller from './includes/scrollerAdapter';
import SyncAppendHandler from './includes/syncAppendHandler'
/**
*
* an array with some test data
*
**/
let articleIndex = 0;
const articleArray = [
'http://142.93.13.19/infiscroll/sample_data/1.html',
'... | true |
103b549784135e5330231c68b72ad18d0e5999f9 | JavaScript | brianilles/Sprint-Challenge--Testing | /games/games-router.spec.js | UTF-8 | 2,735 | 2.625 | 3 | [] | no_license | const db = require('../data/dbConfig.js');
const server = require('../api/server.js');
const request = require('supertest');
describe('games-router.js', () => {
beforeEach(async () => {
await db('games').truncate();
});
describe('POST /games', () => {
it('should return status 201 if the fields are compl... | true |
5566bde97cc24c0956f5bd69db69a6bc587b647f | JavaScript | NielsTRS/KickTournamentNSI | /public/assets/js/utils.js | UTF-8 | 2,098 | 2.59375 | 3 | [] | no_license | function rndmInt(max) {
return Math.floor(Math.random() * Math.floor(max));
}
function playSound(source, volume) {
var sound = new Audio(source);
sound.volume = volume;
sound.play();
}
function rndmKey(object) {
var keys = Object.keys(object);
return object[keys[Math.floor(keys.len... | true |
90ba2ceb22e6fbf28dae9bbd406f5696ef6b38fb | JavaScript | abizebel/React-kanban | /src/components/ReactForm/functions.js | UTF-8 | 931 | 2.625 | 3 | [] | no_license | import React from 'react';
export function createUID (){
var S4 = function() {
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
};
return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
}
export function createIcon (icon){
if(icon === null) return ;
if (icon.... | true |
f117b00358c40f7a96ebae3cadb9696dd7a0d09d | JavaScript | charlesWise/lexiao-wap | /js/views/components/DatePicker/index.js | UTF-8 | 9,665 | 2.578125 | 3 | [] | no_license | import React, { Component } from 'react';
import Wrapper from './../../components/Picker/Wrapper';
import Picker from './../../components/Picker/Picker';
import Header from './../../components/Picker/Header';
import Footer from './../../components/Picker/Footer';
var dateNow = new Date();
var nowYear = dateNow.getFul... | true |
75bc531da825cc098d45a19778ee7ef0147f42d0 | JavaScript | gpilleux/MOV_ACADEMICA | /client/src/reducers/visit.js | UTF-8 | 1,026 | 2.640625 | 3 | [] | no_license | import {
ADD_VISIT,
GET_VISIT,
UPDATE_VISIT,
DELETE_VISIT,
VISIT_ERROR
} from '../actions/types';
const initialState = {
visits: [],
visit: null,
loading: true,
error: {}
};
export default function(state = initialState, action) {
const { type, payload } = action;
switch (type) {
case ADD_VI... | true |
60a01fe9f1f9e4a5ae4bc652bc67321b465bcb0a | JavaScript | 23Arya/Newton-s-Cradle | /sketch.js | UTF-8 | 1,555 | 2.953125 | 3 | [] | no_license | const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Body = Matter.Body;
const Constraint = Matter.Constraint;
var bobObject1, bobObject2, bobObject3, bobObject4, bobObject5;
var roofObject, rope1, rope2, rope3, rope4, rope5;
function setup() {
createCanvas(1500, 6... | true |
2853f758a408a7379342c718a46ea53ac3d45ec7 | JavaScript | YunHsiao/engine-3d | /lib/misc/path.js | UTF-8 | 436 | 2.625 | 3 | [
"MIT"
] | permissive | function _normalize (url) {
return url
.replace(/\\/g, '/')
.replace(/[\/]+/g, '/')
.replace(/\/\?/g, '?')
.replace(/\/\#/g, '#')
.replace(/\:\//g, '://');
}
export default {
/**
* @method normalize
* @param {string} url
*/
normalize(url) {
return _normalize(url);
},
/**
* @method ... | true |
dc9270f6f8cea7c0ebc35eb1a89f3325512ada1f | JavaScript | npsand/fullstack-open | /osa4/blogilista/tests/blog_api.test.js | UTF-8 | 3,121 | 2.578125 | 3 | [] | no_license | const mongoose = require('mongoose')
const supertest = require('supertest')
const helper = require('./test_helper')
const app = require('../app')
const api = supertest(app)
const bcrypt = require('bcrypt')
const User = require('../models/user')
const Blog = require('../models/blog')
//token for postin blogs
let token... | true |
fc72f50d14c5fdd9e05b21047f488952ebd30082 | JavaScript | schmidgallm/weddingSite | /server.js | UTF-8 | 1,204 | 2.515625 | 3 | [
"MIT"
] | permissive | // Dependencies
const dotenv = require('dotenv');
dotenv.config();
const express = require('express');
const bodyParser = require('body-parser');
const exphbs = require("express-handlebars");
const path = require('path');
const mongoose = require('mongoose');
const logger = require('morgan');
// Init App
const app = e... | true |
273817a1e0950249e816d7b7e6d1320b1d56710c | JavaScript | doxas/slide_webglmu2015 | /js/script.js | UTF-8 | 1,433 | 3.0625 | 3 | [] | no_license | var pages = [];
var pagesCount = 0;
var activePage = 0;
window.onload = function(){
var a, e;
a = document.getElementById('content').childNodes;
for(var i = 0, len = a.length; i < len; i++){
if(a[i].nodeName !== '#text' && a[i].nodeName !== '#comment'){
pages.push(a[i]);
}
}
pagesCount = pages.length;
win... | true |
53d50be20db8f5f9ad9b26bd473231201172698e | JavaScript | dewyoyo/sequelizeBurger | /controllers/burgers_controller.js | UTF-8 | 1,795 | 2.515625 | 3 | [] | no_license | // routes
var express = require("express");
var router = express.Router();
// // Import the model (burger.js) to use its database functions.
var db = require("../models");
// Create all our routes and set up logic within those routes where required.
router.get("/", function (req, res) {
db.JoinBurgers.findAll({
... | true |
bf29b11df0fe614e12b799ccb592e38ee2368d38 | JavaScript | YaroslavW/trening-js | /FB-tasks/spread/index.js | UTF-8 | 158 | 3.328125 | 3 | [] | no_license | let arr = [10, 20, 30, 40, 50];
let [a, b, c, ...d] = arr;
console.log(a);
console.log(b);
console.log(c);
console.log(d);
// 10
// 20
// 30
// [ 40, 50 ]
| true |
454943c0b61e837379ddf74fdffd4b9205b705d7 | JavaScript | mjimaz/Assessment-2-Exercise | /employee.js | UTF-8 | 1,566 | 3.671875 | 4 | [] | no_license | var Employee = function(name, department) {
this.name = "Faithful servant " + name;
this.department = department || "everywhere";
this.hours = 0;
}
Employee.prototype.work = function(hours) {
this.hours += hours;
}
Employee.prototype.getPaid = function(){
return 10000000;
}
var Manager = function(name, dep... | true |
f22ee3c01c54d18e219c27e1f6a69e010daacea7 | JavaScript | Ljuelch/Udemy | /Javascript/Projekt/src/js/dev/classes/Haushaltsbuch.js | UTF-8 | 2,267 | 2.515625 | 3 | [] | no_license | import Navigationsleiste from "./Navigationsleiste.js";
import Eingabeformular from "./Eingabeformular.js";
import Monatslistensammlung from "./Monatslistensammlung.js";
import Gesamtbilanz from "./Gesamtbilanz.js";
import Eintrag from "./Eintrag.js";
export default class Haushaltsbuch {
constructor() {
this._e... | true |
dc53fd780301791c04ca37a9e093d5f302584f45 | JavaScript | Tejasvi995/Crumpled-Balls | /sketch.js | UTF-8 | 908 | 2.78125 | 3 | [] | no_license | var engine, world;
var paper;
var left, bottom, right;
var ground;
const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Body = Matter.Body;
function preload()
{
}
function setup() {
createCanvas(1500, 700);
engine = Engine.create();
world = engine.world;
//Create the ... | true |
00b123dc263684ad5e03a50d41de3159a9f07da2 | JavaScript | IgorRomG3/bla | /components/Categories.js | UTF-8 | 1,554 | 2.515625 | 3 | [] | no_license | import React from 'react';
import $ from 'jquery';
export default class Categories extends React.Component {
componentDidMount() {
//Логика работы категорий
$(document).ready(function() {
var categoriesItem = $('.categories .categories-item'),
firstCategoryItem = $('.categories .categories-item... | true |
34d9cc306cb129db5e8919fe132d2c4b4aabc1e1 | JavaScript | concord-consortium/lab | /test/jest/energy2d/part-test.js | UTF-8 | 3,227 | 2.640625 | 3 | [
"MIT"
] | permissive | const assert = require("assert");
import validator from "common/validator";
import metadata from "models/energy2d/metadata";
import {makeCoreModel} from "models/energy2d/models/core-model";
import {Rectangle } from "models/energy2d/models/shape";
import {Part} from "models/energy2d/models/part";
describe("Part initial... | true |
f7aa21ed26908220eb7b500bde09142dc989aef3 | JavaScript | gualambob3peru/simuladorVainsa | /js/js.js | UTF-8 | 604 | 2.59375 | 3 | [] | no_license | $(function(){
$(".flotante").click(function(){
let valor = $(this).attr("punto");
$(".filaImagenes").css("display","none");
$(".imagenes" + valor).css("display","block");
});
$(".divProducto").click(function(){
let numero = $(this).attr("numero"),
grupo... | true |
c6d6fc4f901eec7fe10309b246ed1b6ea43175f2 | JavaScript | pawan1773/expressjs-authentication-starter-app | /routes/login-route.js | UTF-8 | 1,887 | 2.9375 | 3 | [] | no_license | /**
* @author Joginder Pawan Kumar
* @description login-route.js contains login, signup and home routes.
*/
var passportConfig = (app, passport) => {
// display login page.
app.get('/', (req, res) => {
// render login page and pass flash data if it exists.
res.render('login.ejs', { message: req.flash('login... | true |
11a9066fde35e3b48d6620993531228dcee477d1 | JavaScript | mbaxter/time-tracker | /src/backend/api/response/response-factory.js | UTF-8 | 1,164 | 2.671875 | 3 | [] | no_license | "use strict";
const httpCodes = require('http-status-codes');
const ResponseFactory = {};
ResponseFactory.internalError = function(res, err) {
let errorMessage = "Internal Error.";
if (err instanceof Error) {
errorMessage = err.message;
} else if (err instanceof String) {
errorMessage = er... | true |
f938425371bc55283f3a9d23b6c37be6388ed6f0 | JavaScript | ku6ryo/artdope | /themes/crystal/demo.js | UTF-8 | 928 | 2.75 | 3 | [
"MIT"
] | permissive | /**
* @fileoverview
* @author ku6ryo@gmail.com (Ryo Kuroyanagi)
*/
function createSideMenu() {
var sidemenu = new Crystal.SideMenu();
sidemenu.addItem('HOME', '#');
sidemenu.addItem('DIST 0', '#0');
sidemenu.addItem('DIST 1', '#1');
sidemenu.addItem('DIST 2', '#2');
sidemenu.appendTo(document.body);
};... | true |
972b90042a0ae9f0f25983daca249e274d6f5f95 | JavaScript | cicomsa/bght-usd-client | /src/components/logic/categoryPrice.js | UTF-8 | 856 | 2.78125 | 3 | [] | no_license | export const categoryPrice = (products, value) => {
const currentProducts = products.filter(product => product.renewed === null);
const basics = currentProducts.filter(product => product.basics === value);
if (basics.length > 1) {
if (basics.filter(product => product.usagePrice === null) === 'true') {
... | true |
d7a25182796aee717d3002eb068fa084d3e15a3f | JavaScript | BillyVector117/reactjs-expense-project | /src/components/CategorySelection.jsx | UTF-8 | 3,322 | 2.65625 | 3 | [] | no_license | // Dependencies
import React, { useState } from "react";
import styled from "styled-components";
// Elements
import theme from "../theme";
import { ReactComponent as Down } from "../images/down.svg";
import CategoryIcon from "../elements/CategoryIcon";
// Extract props from 'ExpenseForm' component (category state)
cons... | true |
85892cd8584e697424335c4db764768bd055f9f9 | JavaScript | zgc103643/miaov-6 | /test/08-nodeJS/fs/3.js | UTF-8 | 1,205 | 3.171875 | 3 | [] | no_license |
//fs.write(fd,buffer,offset,length[,position],callback)
//--通过文件标识fd,向指定的文件中写入buffer
//fs.write(fd,data[,position[,encoding]],callback)
//--把data写入到文档中通过指定的fd,如果data不是buffer对象的实例则会把值强制转化成一个字符串
//fs.writeSync(fd,buffer,offset,length[,position])
//--fs.write()的同步版本
//fs.writeSync(fd,data[,position[,encoding]])
//--fs... | true |
008e618aea4299192b67a377c06cf46339caf159 | JavaScript | minhhy2801/portal-builder | /src/utils/util.js | UTF-8 | 321 | 2.6875 | 3 | [] | no_license | const createLinkRouter = (title, text, href) => {
let p = document.createElement('p')
let a = document.createElement('a');
let linkText = document.createTextNode(text);
a.appendChild(linkText);
a.title = title;
a.href = href;
p.appendChild(a)
return p;
};
export {
createLinkRouter
... | true |
32088398116be3e4c7c05361bc157599f54aaf59 | JavaScript | archcorsair/JS-Challenges | /Exercism.io/javascript/isogram/isogram.spec.js | UTF-8 | 1,270 | 2.625 | 3 | [] | no_license | const Isogram = require('./isogram');
describe('Isogram Test Suite', () => {
it('duplicates', () => {
const word = new Isogram('duplicates');
expect(word.isIsogram()).toBe(true);
});
it('eleven', () => {
const word = new Isogram('eleven');
expect(word.isIsogram()).toBe(false);
});
it('sub... | true |
81e93ba370b00526f7d6462796d25724e4a5a144 | JavaScript | daputnam/javascript-workbook | /06week/towersOfHanoi/script.js | UTF-8 | 3,047 | 3.546875 | 4 | [] | no_license | 'use strict';
document.addEventListener('DOMContentLoaded', () => {
// Your code here
document.querySelectorAll('[data-stack]').forEach(cell => {
cell.addEventListener("click", function(){
//if there is a block append it to the row and blockhel= null
if (blockHeld){
console.log("there is ... | true |
317fb6cf391809e91bd1b4e9e4a84150f92c1716 | JavaScript | JakeSmith1/gregarious-giraffes | /client/actions/getPets.js | UTF-8 | 2,090 | 2.640625 | 3 | [] | no_license | import axios from 'axios';
import * as types from '../constants/ActionTypes'
//action to be dispatched if getNews is successful
const getPetNewsSuccess = (data) => {
return {
type: types.GET_PET_NEWS,
data: data
}
};
//action to be dispatched if getPet is successful
const getPetSuccess = (data) => {
retu... | true |
4bcc36c56b21177f77f00453f5f3e370bf8a3674 | JavaScript | bcw1145/VanilaJS_Day_Eight_Blueprint | /src/index.js | UTF-8 | 1,206 | 3.59375 | 4 | [] | no_license | // <⚠️ DONT DELETE THIS ⚠️>
import "./styles.css";
// <⚠️ /DONT DELETE THIS ⚠️>
const h3 = document.querySelector("h3"),
rangeNum = document.querySelector(".js-range"),
getNum = document.querySelector(".js-getNum"),
button = document.querySelector("button"),
random = document.querySelector(".js-random"),
resu... | true |
442830d9bd60e942bcc2de757bf79f245f9105ee | JavaScript | Giotino/Quine-McCluskey | /utility.js | UTF-8 | 1,443 | 3.390625 | 3 | [] | no_license | exports.clone = function(source) {
if(source == null) {
return null;
}
if (Object.prototype.toString.call(source) === '[object Array]') {
var clone = [];
for (var i=0; i<source.length; i++) {
clone[i] = exports.clone(source[i]);
}
return clone;
} else if (typeof(source)=="object") {
... | true |
38bc4887f3cea5181410a273a58ddbbd1cb7f84a | JavaScript | aliyassme/resume_535 | /main.js | UTF-8 | 2,533 | 3.34375 | 3 | [] | no_license | //initialising the ajax technique
function push(file,callback){
var xhr=new XMLHttpRequest();
xhr.overrideMimeType("application/json");
xhr.open("GET",file,true);
xhr.onreadystatechange =function() {
if (xhr.readyState ===4&&xhr.status=="200"){
callback(xhr.responseText);
}
}
xhr.send();
}... | true |
2bb7d4cf145dab8e5709655fb765d246038c23ac | JavaScript | ds-duongnt/blackjack | /frontend/game.js | UTF-8 | 552 | 2.640625 | 3 | [] | no_license | var Game =
{
ChipOffset: 6,
AdjustChips: function(n)
{
Game.ChipOffset += n;
Game.UpdateChips();
},
UpdateChips: function()
{
var off = Game.ChipOffset * -50;
Obj.Chip[0].style.backgroundPosition = off + "px 0"; off -= 50;
Obj.Chip[1].style.backgroundPosition = off + "px 0"; off -= 50... | true |
93e18cec857dc078d18ce6295488573da6692d5d | JavaScript | funnylookinhat/tetryon | /client/tetryon.js | UTF-8 | 18,554 | 2.6875 | 3 | [] | no_license | /**
* Tetryon - An open-source UTM tracker and metrics engine.
*/
/**
* Create a Tetryon instance.
* @param {Object} config An object with the following keys:
* - serverUrl {String} The URL for the path to the Tetryon server.
* - serverHttpPort {String} The port HTTP is running on.
* - serverHttpsPort {String} ... | true |
49c4072b97ccb97a8f779065791272d1679743cb | JavaScript | ufukomer/lwjgl3-www | /client/routes/guide/sample.js | UTF-8 | 3,590 | 2.9375 | 3 | [] | no_license | const sample = `import org.lwjgl.*;
import org.lwjgl.glfw.*;
import org.lwjgl.opengl.*;
import org.lwjgl.system.*;
import java.nio.*;
import static org.lwjgl.glfw.Callbacks.*;
import static org.lwjgl.glfw.GLFW.*;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.system.MemoryStack.*;
import static org.lw... | true |
0e503217c3f3d8697d97b837cae15d4f81deeaac | JavaScript | SIANSS/JS | /basic.js | UTF-8 | 419 | 3.671875 | 4 | [] | no_license | var x = 3; //variable initilization/declaration
var y = 5; //variable initilization/declaration
var total = 0;
total = x + y; //output will be 5+3 = 8;
console.log(total);
// window.alert(total);
// document.getElementById('id').innerHTML = total;
// document.write('<p style="font-size:30px; color:red; display:block... | true |
f68c3a70ffe85fa8e383b2d788842fd74e2eda4b | JavaScript | eero-k/skeletor | /scripts/runserver.js | UTF-8 | 828 | 2.625 | 3 | [] | no_license | /*
Sets up a node.js server that uses the Connect middleware framework for providing providing access to the static content in the public directory.
Due to standard browser security setup XMLHTTPRequests via file:/// are not possible and thus some parts of the application would not work.
USAGE:
Setup:
$ cd scripts... | true |
4481f442528fc19e797823913db10f13a1fff98f | JavaScript | LinaDev14/Manipulando-Arrays | /reto-findIndex.js | UTF-8 | 215 | 3.265625 | 3 | [] | no_license | // dime el indice de la gallina
const animales2 = ['🐭', '🐷', '🐸', '🐔', '🐻'];
const indiceAnimal = animales2.findIndex(function(animal2) {
return animal2 === '🐔'
})
console.log(indiceAnimal); | true |
886437bb2a7be8160e6f20d96ea78bfa4cb854ee | JavaScript | vasyaivanov/gstlst | /APP/gstlst/platforms/ios/www/js/fb.js | UTF-8 | 887 | 2.625 | 3 | [] | no_license | var facebookObj = new Object();
facebookObj.login = function() {
var fbLoginSuccess = function (userData) {
console.log("UserInfo: ", userData);
}
facebookConnectPlugin.login(["public_profile"], fbLoginSuccess,
function loginError (error) {
console.error(error)
});
}
fa... | true |
3fd8bfff67c749a58720a570bbc6f3d496b76a72 | JavaScript | walasek/node-reliable-udp | /tests/socket.test.js | UTF-8 | 6,900 | 2.578125 | 3 | [
"MIT"
] | permissive | const ReliableSocket = require('../socket');
const unreliablizeSocket = require('./socket.mockup');
const Session = require('../session');
const Timeout = require('../timeout');
const XBuffer = require('../infinite-buffer');
module.exports = async function(test){
test('Sockets use a random seed', (t) => {
const h1 ... | true |
291c955f712faf2e04ef854006b4da59e29a1c1f | JavaScript | corwinc/subclass-dance-party | /src/pulseyDancer.js | UTF-8 | 743 | 2.765625 | 3 | [] | no_license | var PulseyDancer = function(top, left, timeBetweenSteps) {
Dancer.call(this, top, left, timeBetweenSteps);
this.size = 10;
this.toggleSize = true;
};
PulseyDancer.prototype = Object.create(Dancer.prototype);
PulseyDancer.prototype.constructor = PulseyDancer;
PulseyDancer.prototype.step = function () {
Dan... | true |
5e8e38b0366916a8c7cab6c26ad008a7cf5f0c82 | JavaScript | Mupati/weather-app | /src/features/weather/weatherSlice.js | UTF-8 | 3,500 | 2.703125 | 3 | [] | no_license | import {
createAsyncThunk,
createSlice,
createSelector,
} from "@reduxjs/toolkit";
import { fetchWeatherData } from "./weatherAPI";
import { groupByDtTxt, paginator } from "../../utils";
const initialState = {
data: { metric: {}, imperial: {} },
status: "loading",
temperatureUnit: "F",
currentPage: 0,
... | true |
2a898bb7869c56976d0ccf30340361bf118ac1b7 | JavaScript | Frederico3101/Cursojs | /Conversor/conversor3/script.js | UTF-8 | 372 | 3.4375 | 3 | [] | no_license | function verificar () {
var temp = window.document.getElementById('num');
var n = Number(temp.value);
var res = window.document.getElementById('res');
var k = n + 273
var f = (n*9/5) - 32
if (k < 0) {
res.innerHTML = 'Essa temperatura não existe'
} else {
res.innerHT... | true |
1d17fdcaa0d92fba9d0240b3e823a7ac7cd97264 | JavaScript | ukates/TwilioJavaScriptFiles | /getFirstAmountSorted.js | UTF-8 | 146 | 2.96875 | 3 | [] | no_license | // JavaScript source code
function getFirstAmountSorted(arr, num) {
arr.sort();
let newArray = arr.slice(0, num);
return newArray;
} | true |
8ea48a4041a50a5c149452e3337b122a6996904c | JavaScript | n3ur4l/gruvdeck | /mode.js | UTF-8 | 2,379 | 2.984375 | 3 | [
"Unlicense"
] | permissive | class Mode {
constructor({ root = 60, octaves = 2, tones } = {}) {
this.pitches = [];
let pitch = root;
this.pitches.push(pitch);
tones.split("").map((t) => {
if(t.toUpperCase() === "H") {
pitch = pitch + 1;
}
if(t.toUpperCase() ==... | true |
4c7547d53842333c053f08abe9736742cc069038 | JavaScript | Ethenalee/LuhnAlgorithm | /lib/luhnfunction.js | UTF-8 | 1,062 | 3.328125 | 3 | [] | no_license | function checkAl (number) {
var eachD = number.split("");
var eachEven = [];
if(eachD.length % 2 === 0) {
for(var i = (eachD.length - 1); i >= 0; i --) {
if(i % 2 === 0) {
var element = eachD[i] * 2;
eachEven.push(element);
}
else {
eachEven.push(eachD[i]);
}
... | true |
5ba5eb90e7fb32c007d912b3c60a570d09466061 | JavaScript | jpleyvat/my-mandarin-notes | /scripts/scripts.js | UTF-8 | 12,398 | 2.84375 | 3 | [] | no_license | "use strict";
const numberOfPages = 2;
class Section {
constructor(content, horizontalSpaces, verticalSpaces) {
this.horizontalSpaces = horizontalSpaces;
this.verticalSpaces = verticalSpaces;
this.keepRow = false;
// this.hidePage();
this.sectionName =
document.sc... | true |
430e6cb30ad539a62fccffd13077d2a96d173a66 | JavaScript | 0xbboyd/b9lab-w3 | /test/dividend.js | UTF-8 | 1,579 | 2.515625 | 3 | [] | no_license | contract('Dividend', function(accounts) {
it('should not have a starting balance', function(){
var balance = web3.eth.getBalance(Dividend.deployed().address);
assert.equal(balance, 0);
});
it("should pay half the received amount to shareHolderA and shareHolderB", function() {
var shareHolderA = accoun... | true |
ac6038735b19e27ea7dd9361a88a11d6f4f1edd9 | JavaScript | sofiegraham/facebook-content-microservice | /test/curlTests.js | UTF-8 | 1,748 | 2.546875 | 3 | [] | no_license | require('dotenv').config();
const axios = require('axios');
const url = `http://${process.env.SERVER_HOST}:${process.env.SERVER_PORT}`;
// TEST POST USER POST
// axios.post(`${url}/users/33/posts`, {
// content: 'PUPPIES ARE GREAT',
// })
// .then(function (response) {
// console.log(response);
// })
// .catch(fu... | true |
6e066accfca4d842ace7a438c1fb8e3140b2b95d | JavaScript | akashnimare/zulip-mobile | /src/account/accountsReducers.js | UTF-8 | 2,522 | 2.625 | 3 | [
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | /* @flow */
import {
REALM_ADD,
LOGIN_SUCCESS,
ACCOUNT_SWITCH,
LOGOUT,
ACCOUNT_REMOVE,
} from '../actionConstants';
import type {
AccountsState,
AccountAction,
RealmAddAction,
AccountSwitchAction,
AccountRemoveAction,
LoginSuccessAction,
LogoutAction,
} from '../types';
import { NULL_ARRAY } fr... | true |
cc3d10a2adb0d0e1abe14469e1b3a8ed4feb6941 | JavaScript | robertsonedward52/Javascript-for-Beginner | /arrays.js | UTF-8 | 474 | 3.921875 | 4 | [] | no_license | /*let a = [3, 5, 6, 7, 8];
let b = ['Edward', 'Robertson', 'Dude', 'Greatful'];
/*
console.log(a[0]); this an array
console.log(a[1]);
console.log(a);
*/
/* a [1] = 7;
console.log(a)
*/
// console.log(typeof a) // object
// console.log(b[5]); // variables with no values is Undefined
// console.log(b.length); // a... | true |
f7d9a2a187b371603d15daa717014e1f80a86178 | JavaScript | mtinning/techpoll | /app/store/reducer.spec.js | UTF-8 | 4,946 | 2.578125 | 3 | [] | no_license | /* global describe, it*/
import { expect } from 'chai'
import { Map, fromJS } from 'immutable'
import reducer from './reducer'
describe('reducer', () => {
describe('when SET_STATE action is dispatched', () => {
const initialState = Map()
const stateToTransitionTo = { tech: [
{
name: 'tech_1',... | true |
aaa216892e9b3889dbb7f38e6aa67dc7f79a3ea7 | JavaScript | pepsipu/troy.js | /misc/embed.js | UTF-8 | 574 | 2.546875 | 3 | [] | no_license | const {RichEmbed} = require("discord.js");
function genColor() {
let hex = "#";
for (let i = 0; i < 6; i++) {
hex += Math.floor(Math.random() * 16).toString(16)
}
return hex;
}
module.exports = (msg, title, description) => {
return new RichEmbed()
.setColor(genColor())
.set... | true |
589121bf3ee4888c680b1c5de29cf9cfd07c3a03 | JavaScript | szwork2013/SGM-Apps | /BaiduMusic/static/js/local_storage.js | UTF-8 | 2,532 | 2.546875 | 3 | [] | no_license | var Storage = {
filePath : "dir/subdir/myfile.txt",
searchHistory:"dir/subdir/SearchHistory.txt",
writeFile : function (v, path) {
//test
if(path=="dir/subdir/myfile.txt"){
alert("dir/subdir/myfile.txt");
}
gm.io.writeFile(path || this.searchHistory, encod... | true |
8b19b195feb76077c65462715cd0e9d749e6fe50 | JavaScript | yusufskebbe/Weather-App | /app.js | UTF-8 | 3,318 | 2.96875 | 3 | [] | no_license |
window.addEventListener('load',()=>{
let long;
let lat;
let temperatureDescription = document.querySelector('.temperature-description');
let temperatureDegree = document.querySelector('.temperature-degree');
let locationTimeZone = document.querySelector('.location-timezone');
let temperatureSe... | true |
fb051becc081c68eafa5d1a0bbb0ccdca7a05211 | JavaScript | Achap92/Initial-Pre-Work | /5-Introduction-to-JavaScript/37-Nest_one_Array_within_Another_Array.js | UTF-8 | 278 | 3.625 | 4 | [] | no_license | /*Learned to nest an array inside of another array. This is know as a multi-
dimensional Array.*/
// Example
var ourArray = [["the universe", 42], ["everything", 101010]];
// Only change code below this line.
var myArray = [["Socks", 12, "Crinkles"], ["Stars", 100, "Bread"]];
| true |
2a3406c898def453b7acc1837210b224a9f6b40a | JavaScript | randreiii/SIIT_Andrei_Radu | /14 week/learn-react/src/exemples/02 - post.jsx | UTF-8 | 549 | 2.75 | 3 | [] | no_license | // React fara jsx
import React from 'react';
import ReactDOM from 'react-dom';
const postTitle = React.createElement('h1', null, 'Title 1')
const postBody = React.createElement('p', null, 'Content 1')
const PostElment = React.createElement('div', null, postTitle, postBody)
ReactDOM.render(
PostElment,
docu... | true |
fc2658fe90bd7e10135eecfe240cdbe1c8bff2dd | JavaScript | vandecastro95/indecisionApp | /src/components/IndecisionApp.js | UTF-8 | 2,712 | 2.828125 | 3 | [] | no_license | import React from 'react';
import AddOption from './AddOption.js'
import Options from './Options'
import Action from './Action'
import Header from './Header'
import OptionModal from './OptionModal'
//stateless functional component
export default class IndecisionApp extends React.Component {
state = {
optio... | true |
24770b6ddb83e6440fb54a8086478315ddfa31e3 | JavaScript | OtakuQuotes/OtakuQuotes | /client/src/components/submit.js | UTF-8 | 9,770 | 2.8125 | 3 | [] | no_license | import React, { Component } from 'react';
import axios from 'axios';
import ReCAPTCHA from "react-google-recaptcha";
class Submit extends Component {
constructor(props) {
super(props);
this.state = {
anime: '',
character: '',
quote: '',
episode: '',
... | true |
8f5c04236d1bb130658eaecc2d82bd1fc19b9d06 | JavaScript | honger05/effects-jsdom | /src/utils/core/_time.js | UTF-8 | 3,492 | 3.546875 | 4 | [] | no_license |
// 日期时间操作类
/**
* 对 Date 的扩展,讲 Date 转化为指定格式的 String
* 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
* 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
* 例子:
* (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
* (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18
*
* ... | true |
e2b42cc248da896f93ef6f28f3ca0c26d047b8ca | JavaScript | jesseweed/maverick | /_assets/js/lib/image-hd.js | UTF-8 | 7,902 | 3 | 3 | [] | no_license | /*
= = = = = = = = = = = = = =
= ABOUT = = = = = = = = = =
= = = = = = = = = = = = = =
SCRIPT : image-hd.js
NAME : Image HD
DESCRIPTION: Javascript library for working with hi-res images (retina, hdpi, etc.)
AUTHORS :
- Jesse Weed
= = = = = = = = = = = = = =
= = = = = = = = = = = = = =
*/
/*jslint browser: tr... | true |
5f42ecea0b642285bf6481b18e098252d1345768 | JavaScript | raphaelstary/poopyplanes | /www/js/myscenes/SplashScreen.js | UTF-8 | 1,755 | 2.609375 | 3 | [] | no_license | var SplashScreen = (function (Event) {
"use strict";
function SplashScreen(services) {
this.stage = services.stage;
this.events = services.events;
this.timer = services.timer;
}
SplashScreen.prototype.show = function (next) {
var screenWidth = 1920;
var screenHe... | true |
bea37bab223efb7302e78b1040469877d17b5232 | JavaScript | takuminish/TerasolunaBingoApplication | /src/main/webapp/resources/app/javascript/bingogame/bingogame.js | UTF-8 | 976 | 2.796875 | 3 | [] | no_license | function lottery() {
$("#lotteyStart").remove();
let randomValue = 0;
let resultValue = 0;
let flag = true;
while (true) {
resultValue = Math.floor(Math.random() * (99 - 0));
$(".bingoResult").each(function() {
if (resultValue === $(this).text()) {
flag... | true |
9916cd845e4ec3a3a42abdaf762a888c0424d473 | JavaScript | A-Maged/booking-form-es6 | /src/stateManager/stateEvents.js | UTF-8 | 2,754 | 2.53125 | 3 | [] | no_license | import store from './store';
import * as actions from './actions';
let reservationForm = document.querySelector('[data-hook=reservation-form]'),
checkInOutField = reservationForm.querySelector('[data-hook=form-field-check-in-out]'),
occupancyField = reservationForm.querySelector('[data-hook=form-field-occupancy]'),
... | true |
d3ff01ae3e23515caf33ee5a6a101cd24ed22751 | JavaScript | Ali-Tigui/Programing_Cours | /javascript/App/js-RandomImageForInterval-main/main.js | UTF-8 | 303 | 2.78125 | 3 | [] | no_license | const li=["img/01.png","img/02.png","img/03.png","img/04.png","img/05.png","img/06.png","img/07.png"],
el=document.querySelector("img");var i=0;
el.setAttribute("src",li[i]);
window.onload=setInterval(function(){
i=Math.floor(Math.random()*li.length)
el.setAttribute("src",li[i])
},2000) | true |
958f4afa9e82dcefb156cbb875712be36a874204 | JavaScript | SARATH-VARMA/Decision-Maker | /routes/choices.js | UTF-8 | 1,764 | 2.6875 | 3 | [] | no_license | /*
* All routes for Polls are defined here
* Since this file is loaded in server.js into api/polls,
* these routes are mounted onto /polls
* See: https://expressjs.com/en/guide/using-middleware.html#middleware.router
*/
const express = require('express');
const router = express.Router();
module.exports = (db)... | true |
e563f513dd72a8220a3b8ed49d4bb5f99ddbf3e0 | JavaScript | liujinyu1029/util-bar | /pure-fun/event.js | UTF-8 | 1,407 | 2.984375 | 3 | [] | no_license | function Events() {
// 放置所有添加的 监听事件
this._events = {};
}
Events.prototype = {
on: function (name, fn, ...argOrg) {
// 必传参数验证
if (!name || !fn) {
throw new Error(
`[Events TypeError] Failed to execute 'Events' on '${name}' : 2 arguments required`
);
}
// 阻止重复添加相同的监听
let fns ... | true |
6805e9dc804801b671ab54fbad8a3372c09d05d8 | JavaScript | markkuleppala/time-tracking-gs | /timeTracking.gs | UTF-8 | 5,668 | 2.734375 | 3 | [
"MIT"
] | permissive | function onOpen() { // Add the script to spreadsheet UI
var ui = SpreadsheetApp.getUi();
ui.createMenu('Time tracking')
.addItem('Send report to individuals', 'sendEmails')
.addToUi();
}
function toColumns(values) { // Array data to JSON
var current;
var header = values[0];
var ans = [];
for (... | true |
f8f4e8a7ff9754a47abf6d08165e1e744bb324a0 | JavaScript | ercling/unit1 | /assets/js/script.js | UTF-8 | 2,063 | 2.515625 | 3 | [] | no_license | $( document ).ready(function(){
$('#searchbutton').click(function(e){
e.preventDefault();
$('#template').slideUp(300,renderSearch);
});
renderIndex();
// $("#price-slider").slider({
// tooltip: 'hide'
// });
// $("#price-slider").on('slide', function(slideEvt) {
// $('#start-price-input').va... | true |
053c1980d7945cced8e2a96850b1082264dca19e | JavaScript | gfgafn/heytea_DianSumTask | /src/redux/reducers/register.js | UTF-8 | 609 | 2.59375 | 3 | [] | no_license | import {
REGISTER_REQUEST,
REGISTER_RESPONE
} from '../constants'
const initialState = {
registerStatus: false
}
const registerState = (state = initialState, action) => {
const {type} = action
switch (type) {
case REGISTER_REQUEST:
return state
case REGISTER_RESPONE:
... | true |
22f31e8609704e7a51d5381d5436178985154f80 | JavaScript | 1997sanket/Learning-Mean-Stack | /JavaScript own + class/Day 2/Assignment 6/function.js | UTF-8 | 162 | 2.671875 | 3 | [] | no_license | function myFunction()
{
var x = document.getElementById('a').value;
document.getElementById('a').value = "";
document.getElementById('b').value = x;
} | true |
a72aa9e60a78263b8739d44fc0684db4a8704a13 | JavaScript | JasonOuyang8000/Team-Chat-Frontend | /src/components/Signup.js | UTF-8 | 2,550 | 2.578125 | 3 | [] | no_license | import axios from "axios";
import { useState, useContext } from "react";
import { UserContext } from "../context/UserContext";
export default function Signup({currentForm, setCurrentForm}) {
const {userState} = useContext(UserContext);
const [error, setError] = userState.error;
const [user,setUser]... | true |
284bfd1a9ebaba29f635665dbb0181bdde2a5ddf | JavaScript | Magikcraft/regenerate-spawn | /autoload/index.js | UTF-8 | 1,826 | 2.59375 | 3 | [] | no_license | "use strict";
exports.__esModule = true;
var commando_1 = require("@magikcraft/commando");
var log_1 = require("@magikcraft/regenerate-spawn/lib/log");
var utils = require("utils");
var log = log_1.Logger(__filename);
log('@magikcraft/regenerate-spawn loaded!');
// @TODO make configurable via environment
// @TODO take ... | true |
f2fec5afb8134ca20a51a6a1e22b2992d470e5b1 | JavaScript | piotrbaranski/codewars | /8kyu/Sum of positive.js | UTF-8 | 333 | 3.875 | 4 | [] | no_license | /**You get an array of numbers, return the sum of all of the positives ones.
Example [1,-4,7,12] => 1 + 7 + 12 = 20
Note: array may be empty, in this case return 0.**/
function positiveSum(arr) {
return arr.filter(function (num) {
return num > 0;
}).reduce(function add(a, b) {
return a + b;... | true |
b289d8040102ef0b02ae69cf0b60f509be98fbdf | JavaScript | emorenom20/juego-de-cartas | /engine.js | UTF-8 | 23,273 | 3.296875 | 3 | [
"MIT"
] | permissive |
//-----------------------------FUNCIONES UTILES-----------------------------
//devuelve la posicion de un elemento HTML
function elementPosition(el){
var rect = el.getBoundingClientRect();
return {y: rect.top, x: rect.left}
}
//da el ángulo en radianes entre dos puntos
function pointAngle(x1, y1... | true |
da61aefc9c5511e62b96d05520bc93c2ba2708b3 | JavaScript | enocsoto/NodePrimerosPasos | /helpers/multiplicar.js | UTF-8 | 805 | 2.9375 | 3 | [] | no_license | const fs = require('fs');
const color = require('colors');
const crearArchivo = async (base = 5, listar=false, hasta=10) => {
try {
let salida = '';
for (let i = 1; i <= hasta; i++) {
salida += (`${base} x ${i} = ${base * i} \n`);
}
if (listar) {
... | true |
38f15992df4960f5a0fde76cc2575d83eb0a29f4 | JavaScript | YFCoder/WK | /worktileServer/src/main/webapp/WEB-INF/webapp/app/js/calendar.js | UTF-8 | 4,323 | 2.984375 | 3 | [] | no_license | window.onload=function(){
var calendar=document.getElementsByClassName('calendar-panel')[0];
var day=document.getElementsByClassName('day')[0];
var oH=document.getElementsByTagName('h6')[0];
var oS1=document.getElementsByClassName('s1')[0];
var oS2=document.getElementsByClassName('s2')[0];
var year=0;
var month ... | true |
670a91123c320a257734f682c2211f898dc88be5 | JavaScript | DanielIndie95/HadaAdmin | /app/scripts/controllers/main.js | UTF-8 | 2,340 | 2.546875 | 3 | [] | no_license | 'use strict';
/**
* @ngdoc function
* @name hadaAdminApp.controller:MainCtrl
* @description
* # MainCtrl
* Controller of the hadaAdminApp
*/
(function () {
var app = angular.module("hadaAdminApp");
app.controller('MainCtrl', ['daysInterval', '$moment', '$location', 'hada-dal', '$mdToast', MainController]);
... | true |
fa7d3ae1078259832bdfeb9bdfd2eceb1e697c68 | JavaScript | rafaelsteinlenzi/Trabalho_REDIS | /server/route/book/booksRoute.js | UTF-8 | 1,773 | 2.6875 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
const booksService = require('../../service/book/booksService');
// vai retornar todos os livros inseridos no banco de dados
router.get('/books', async function(req, res){
const books = await booksService.getBooks();
res.json(books);... | true |
c370815005760ebeb7e8d4226e9fb2f2bc945f74 | JavaScript | crumler/wd64-javascriptLibrary | /05-Node-Server/client/index.js | UTF-8 | 4,998 | 3.734375 | 4 | [] | no_license | function fetchHelloDataFromAPI() {
fetch('http://localhost:3000/test/helloclient', { //tests endpoint with fixed value to verify server works
method: 'GET',
headers: new Headers({ //sends our headers to the server with the Headers() constructor object.
'Content-Type': 'application/json'
... | true |
d962262b25d40240293ace4b6c01d6f27333eda8 | JavaScript | mgilcrease/sample-pwa | /server-api.js | UTF-8 | 467 | 2.640625 | 3 | [] | no_license | const init = require("./init.js");
// Invoking the init script will run all subsidiary scripts in the init directory,
// which will take care of all the necessary details of connecting to the database,
// starting up the api server, initializing connections to any other resources such as redis,
// etc, etc.
const star... | true |
f65b18540b38480f5656b68f23f82fdd0b71ecc3 | JavaScript | langara-coding/wmdd4820-jan2018-t1 | /4/Gian/index.js | UTF-8 | 5,621 | 3.953125 | 4 | [] | no_license | // Gianlucci Badiali Minarelli
// Dilpreet sidhu
// #1. Method Exercise
//
// Create a car object with speed attribute then add a park method to your car
// that logs "Parking!" to the console and a stop method that returns "Stopping!"
const car = {
speed: Math.round(Math.random() * 150), // speed is a random numb... | true |
b0020d878c51515e113a77d0b4dc32f621845b20 | JavaScript | ssaji1/Lab-3-Group-10 | /project2/js/chapter09-project02.js | UTF-8 | 1,223 | 2.9375 | 3 | [] | no_license | /* add code here */
window.addEventListener('load', function(){// creating event handler after loading window
var featuredImg = document.querySelector('#featured img');
var imageClick = document.querySelector('#thumbnails');
imageClick.addEventListener("click", function () {
//changing image s... | true |
5a1277a166510bb291f09790d2b889efc4c3203a | JavaScript | GM-Coding-Club/birdhouse | /models/cloud.js | UTF-8 | 1,348 | 2.8125 | 3 | [] | no_license |
import cloud1 from '../img/cloud_1.png'
import cloud2 from '../img/cloud_2.png'
import cloud3 from '../img/cloud_3.png'
import cloud4 from '../img/cloud_4.png'
import cloud5 from '../img/cloud_5.png'
import cloud6 from '../img/cloud_6.png'
import cloud7 from '../img/cloud_7.png'
import cloud8 from '../img/cloud_8.png'... | true |
b5e365bda6d160b0066703d26432cfd7081c1f8d | JavaScript | jivison/codecore | /week1/day3/labs/printMulti.js | UTF-8 | 301 | 2.9375 | 3 | [] | no_license | function printMulti(multiDiArray) {
for (let xElement of multiDiArray) {
for (let yElement of xElement) {
console.log(yElement);
}
}
}
// Tests
const myArray = [[2,3,4], ["Hello CodeCore", 1, true]];
printMulti(myArray);
const myArray = [];
printMulti(myArray); | true |
790aa5078108237a590bf3b183545da04d815580 | JavaScript | notlfish/To-Do-List | /src/task.js | UTF-8 | 2,278 | 2.9375 | 3 | [
"MIT"
] | permissive | import {
completeTaskListener,
descriptionListener,
taskUpdateListener,
} from './crud';
export default class Task {
constructor(description, index, completed = false) {
this.description = description;
this.index = index;
this.completed = completed;
}
renderCompleteButton() {
const complet... | true |
3e754baa4cb0fcc2f68c2ce715c5adf05d471723 | JavaScript | superguigui/a-christmas-tale | /src/entities/SnowFlake.js | UTF-8 | 1,122 | 2.953125 | 3 | [] | no_license | var SnowFlake = (function(){
function SnowFlake() {
Particle.call(this);
this.abstract.setSize.call(this, Math.random() * 3 + 1, Math.random() * 3 + 1);
var graphics = new PIXI.Graphics();
graphics.lineStyle(0);
graphics.beginFill(0x71b4ca, 1);
graphics.drawCircle(this.width, this.width, this.... | true |
c0b37ad39e3746f4ab330f4d30ca2511c9e4916c | JavaScript | M-o-h-a-n-S-i-n-g-h/Refreshing-Javascript | /React/practicing-react/src/components/apiHandling/ApiHandling.jsx | UTF-8 | 858 | 2.796875 | 3 | [] | no_license | import React, { useState } from "react";
import { logDOM } from "@testing-library/react";
const ApiHandler = () => {
const [posts, setPosts] = useState([]);
const fetchPosts = async () => {
try {
const fetchedData = await fetch("https://jsonplaceholder.typicode.com/posts", {method: "GET"});
... | true |
01ccad7a9e016dca44f4c40806f6e38deeae83ee | JavaScript | emmet-gingles/NodeJS-USCapitals | /MySQL/queryData.js | UTF-8 | 1,710 | 3.546875 | 4 | [] | no_license | // MySQL module for establishing connections
var mysql = require('mysql');
// Path to file for database connection
var mysqldb = require('./db/db_connection.js');
// Readline module for reading user input
var readline = require('readline');
// Variable for connecting to MySQL using the variables provided in the connec... | true |
a54a98181167fccabf8cc3342f5cbe2b2754b0ab | JavaScript | David-E-Alvarez/node-auth2-project | /users/users-router.js | UTF-8 | 2,661 | 2.609375 | 3 | [] | no_license | //?
const router = require("express").Router();
//importing bcrypt for hashing password
const bcrypt = require("bcryptjs");
//JSON web token
const jwt = require("jsonwebtoken");
//isValid
const { isValid } = require("../users/users-service.js");
//helper functions
const Users = require("./users-model.js");
router.get... | true |
c5e5e84ccb17707ee4e3fd8a858e5e28adec27f7 | JavaScript | ricardoekm/Kyrix | /front-end/js/globalVar.js | UTF-8 | 2,943 | 2.59375 | 3 | [] | no_license | // setting up global variables
var globalVar = {};
// kyrix backend url
globalVar.serverAddr = "N/A";
// tile width and tile height
globalVar.tileW = 0;
globalVar.tileH = 0;
// cache
globalVar.cachedCanvases = {};
// global rendering params (specified by the developer)
globalVar.renderingParams = null;
// global v... | true |
f41805849b3b64ef449fc1b0b9e6d025d03af0af | JavaScript | FEWDMaterials/IntermediateJS | /solution/javascript/main.js | UTF-8 | 4,224 | 3.59375 | 4 | [] | no_license | /* CURRENTLY IN: javascript/main.js */
/*
var $bod = $('body').css();
*/
function add( a, b ) {
return a + b;
}
function $() {
return {
};
}
//singleton pattern
/**
VERSION 1
*/
// function $( selector ) {
// var _el = document.querySelectorAll( selector ); // this should store dom object of selector
// co... | true |
bc33aa1744753076fdbffa04bf95af413c1fdacf | JavaScript | videoexplorer/home | /assets/logic/file_exist.js | UTF-8 | 1,342 | 2.765625 | 3 | [] | no_license | export const file_exist = function (file_address = "./", file_name = []) {
let xmlhttp;
let yourFileURL;
let result;
if(window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();//其他浏览器
} else if (window.ActiveXObject) {
try {
xmlhttp = new Act... | true |
988a2b81e50bdb59d3afdde14005aad96f534115 | JavaScript | saarsoo/timesf | /qml/database.js | UTF-8 | 1,185 | 2.59375 | 3 | [] | no_license | .import QtQuick.LocalStorage 2.0 as LS
var db;
function checkDBConnection(){
if (db){
return;
}
db = LS.LocalStorage.openDatabaseSync('timesfDB', '1.0');
db.transaction(function(tx){
tx.executeSql('CREATE TABLE IF NOT EXISTS settings(key TEXT, value TEXT)');
});
}
function getSe... | true |
f6eee1faf1ee7bfe3314ffeb1ecd2c1b091666a6 | JavaScript | swannodette/todomvc | /architecture-examples/backbone/js/app.js | UTF-8 | 973 | 2.59375 | 3 | [
"MIT"
] | permissive | /*global $ */
/*jshint unused:false */
var app = app || {};
var ENTER_KEY = 13;
$(function () {
'use strict';
// kick things off by creating the `App`
window.appview = new app.AppView();
window.benchmark1 = function() {
var s = new Date();
for(var i = 0; i < 200; i++) {
app.todos.create({
... | true |
001a675b282a40e0f91fc1f2c3dd3fccba6bc8d1 | JavaScript | dekkofilms/angular-curriculum | /unit-1.6/app.js | UTF-8 | 1,106 | 2.546875 | 3 | [] | no_license | var app = angular.module("firstApp", []);
app.controller("MyFirstController", ['$scope', function($scope) {
$scope.name = "Severus Snape";
}])
app.controller("ExercisesController", ['$scope', ($scope) => {
$scope.FavColor = 'Burnt Orange';
$scope.secondsInACentury = 60 * 60 * 24 * 365 * 100;
$scope.rightNow =... | true |
639a66390831f3d7fab2ad015f3e328e81bc9220 | JavaScript | Donskoy89/Mineswiper_2 | /src/main.js | UTF-8 | 608 | 2.859375 | 3 | [] | no_license | const root = document.querySelector('#root');
document.getElementById('startGame').onclick = startGame;
document.querySelector('#resetGame').onclick = () => {
window.location.reload();
}
function startGame(event) {
event.preventDefault();
const cols = document.getElementById('cols').value;
const rows... | true |
8a661be742d686a7492582ac6b102ba179a312c5 | JavaScript | dechasanson/Plant-Gallerie | /src/components/SingleUserAdmin.js | UTF-8 | 3,518 | 2.765625 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import "./SingleUserAdmin.css";
import { fetchAPI, BASE_URL } from "../api";
const SingleUserAdmin = (props) => {
const { userToUpdate, activeUser, history, setUsersList } = props;
const [firstName, setFirstName] = useState("");
const [lastName, setLastName] = us... | true |
dbf3b336d79d11d9cc250e5a784bfad42473305d | JavaScript | coreycaplan3/React-CardMatchingGame | /src/components/GameScreen.js | UTF-8 | 3,223 | 2.640625 | 3 | [] | no_license | import React, {Component} from 'react';
import {AppRegistry, ScrollView, View, Text, StyleSheet} from 'react-native';
import CardTile from "./CardTile";
import CardModel from "./CardModel";
export default class GameScreen extends Component {
static navigationOptions = {
title: "Game"
};
tileList:... | true |