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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
93cdfa4e285068f865a87b77c0ba11c49afa5759 | JavaScript | edcycle/edcycle.github.io | /Osteoporosis_Risk/app.js | UTF-8 | 1,112 | 3.03125 | 3 | [] | no_license | function resetForm() {
$("input:text").each(function () {
$(this).val("");
});
$("input:radio").each(function () {
$(this).prop("checked", false);
});
$("#msg_body").text("勾選所有項目後點確認!");
$("article.message").removeClass("is-success is-warning");
}
$(document).ready(function () {
$("input:radio"... | true |
fb2c16d267165c673ef07bbf6efd348c97f24592 | JavaScript | itsbaldeep/pongjs | /game.js | UTF-8 | 469 | 3.625 | 4 | [] | no_license | // The ball and the paddle
const ball = new Ball(width/2, height/2);
const paddle = new Paddle();
// Draw things on the canvas
function draw() {
// Clear previous frame
ctx.clearRect(0, 0, width, height);
// Ball behaviour
ball.show();
ball.move();
ball.constrain();
// Paddle behaviour
... | true |
93e621fad7991eb7794582bd7857ec51fb857cfb | JavaScript | benjaminjcash/restful-api-mongo | /src/controllers/item.controller.js | UTF-8 | 2,200 | 2.65625 | 3 | [] | no_license | const Item = require("../models/item.model");
const { doGetItem, doGetAllItems, doUpdateItem } = require("../utils/db-helpers");
exports.createItem = (req, res) => {
const newItem = new Item({
name: req.body.name,
type: req.body.type
});
newItem.save()
.then((data) => {
... | true |
21d0b2edce1096397735c3c34ba0799615e2918f | JavaScript | nameofname/random-scripts | /js/problems/amazon/closedCompartments.js | UTF-8 | 806 | 3.078125 | 3 | [] | no_license | // https://www.careercup.com/question?id=5670248861138944
function closedCompartments(s, startI, endI) {
function _compute(s, start, end) {
const sub = s.slice(start - 1, end);
let open = false;
let currCount = 0;
let count = 0;
for (l of sub) {
if (l === '|') {
... | true |
714cd8182d4f923c8bd490c1dc0b6aa745e1c62e | JavaScript | Cagoss85/CS-3733-Group-Project-Kotlin | /js/createDisapproval.js | UTF-8 | 3,973 | 2.890625 | 3 | [] | no_license | /**
*
*/
function disapprovalControlsVisible(){ //USED TO BOTH ENABLE AND REFRESH STATE (COLOR) OF DISAPPROVAL CONTROLS
//ALTERNATIVE 1 (ARRAY ID 0)
document.getElementById("alt1DisButton").style.display='inline-block';
if(userPresent(0, false)){
document.getElementById("alt1DisButton").style.backgroundColor... | true |
3ec7662e349cba8636059cd5ac06d0ccd13da44e | JavaScript | kmizu/minis | /expression/expression_ast.js | UTF-8 | 745 | 3 | 3 | [] | no_license | class Expr {
constructor() {
this.type = 'Expr';
}
}
function tAdd(a, b) {
return new BinExpr('+', a, b);
}
function tSub(a, b) {
return new BinExpr('-', a, b);
}
function tMul(a, b) {
return new BinExpr('*', a, b);
}
function tDiv(a, b) {
return new BinExpr('/', a, b);
}
function t... | true |
eaa50fe0e9e83cf10e5fb15b7eb47fe94c29d5ee | JavaScript | Kevin-Conroy/DSA-recursion | /power-calc.js | UTF-8 | 278 | 3.625 | 4 | [] | no_license | 'use strict';
function powerCalculator(base, exp) {
if (exp < 0) {
return 'Exponent should be >= 0';
}
if (exp === 1) {
return base;
}
return base * powerCalculator(base, exp-1);
}
console.log(powerCalculator(10, 4));
console.log(powerCalculator(10, 7)); | true |
709befea12f36e623e25aa0a3174752dfe8faed5 | JavaScript | rverdon/CGAT | /ui/js/login.js | UTF-8 | 4,477 | 2.65625 | 3 | [] | no_license | "use strict";
// TODO(eriq): Check email
// TODO(eriq): Enforce valid password constraints
document.addEventListener('DOMContentLoaded', function () {
//TODO(eriq): Add onchange validators for passwords and email.
$('.login-field').keydown(function() {
// On enter, try to login.
if (event.keyCode =... | true |
93ebdb2f5e155138d3b2de62c3d557955a92e887 | JavaScript | GerasimovDG/NCr_TS_HW | /release/binary-tree.js | UTF-8 | 4,513 | 2.984375 | 3 | [] | no_license | import { MyNode } from "./my-node.js";
export class BinaryTree {
constructor(numb) {
this._root = null;
if (numb) {
this._root = new MyNode(numb);
}
}
// добавление вершины
addNode(numb, data) {
let newNode;
data ? newNode = new MyNode(numb, data) : ne... | true |
092d486785727a8c4c97ed8678bf02bcc64ca3c7 | JavaScript | navaradia/navaradia.github.io | /script.js | UTF-8 | 1,104 | 3.90625 | 4 | [] | no_license | let name='Mark';
let greeting= `Hello ${name}`
console.log(greeting)
let even;
for (let i = 1; i < 10; i++) {
even=i*2;
console.log(even);
}
let add=(a,b) => {
return (a+b);
}
console.log(add(2, 8765));
let printNumbersTill = (till) => {
console.log(`This will print the numbers until ${till}`)... | true |
f8102e8f979a2c2d678f41e86d3871433b4f80ae | JavaScript | ajinkyac/auto-complete | /tests/e2e/l0_search_no_repositories_found.spec.js | UTF-8 | 669 | 2.515625 | 3 | [] | no_license | /*
* Test case to look up a valid username on github using autocomplete component.
* To execute, on terminal $> npm run test:e2e
*/
describe('Looking up an invalid username on github', function() {
it('should display error message', function() {
browser.get('http://localhost:8000');
var searchBox = elemen... | true |
525e7482b593af3f7487e233c3942b1efaaf6697 | JavaScript | enatividad/practice_cat_browser | /src/services/theCatApi.js | UTF-8 | 494 | 2.796875 | 3 | [] | no_license | export default async function theCatApi(path, ...args) {
if (path[0] === '/') path = path.slice(1);
try {
const res = await fetch(`https://api.thecatapi.com/v1/${path}`, ...args);
if (res.ok)
return res.json();
else
throw new Error(`"${path}" request returned "${res.status}" status`);
} ca... | true |
488ba0ac9aef072fed19f4fe0d7acb23a34a62a2 | JavaScript | Dahlia75/CompITExercises | /JS/ex_109/index.js | UTF-8 | 1,890 | 4.09375 | 4 | [] | no_license | /* Define a validateUser function that accepts the following parameters: username and password
This function returns true or false if username and password match any of the following values:
username: nacho, password: Nerd1979
username: pedro, password: Batman0217
username: marta, password: Mother2312
Show the followin... | true |
1b86a14aeb73da9807cd177b3a6e81175ae55cde | JavaScript | bamtron5/socketChat | /say.js | UTF-8 | 1,051 | 3 | 3 | [] | no_license | const SimpleTTS = require('simpletts');
console.log(SimpleTTS.getTTSSystem()); // 'SAPI' or 'espeak'
SimpleTTS.getVoices().then(function(voices) {
console.log(voices); // depend of the TTS system used
SimpleTTS.read({
text: "ceci est un test",
voice: voices[0], // optionnal, object or ... | true |
e5800cd616f71d3b8e2ac6b03cdfa7879f4f5dcc | JavaScript | VODOROD1/Task07_React_Introduction | /src/components/add-modal/validation.js | UTF-8 | 551 | 2.90625 | 3 | [] | no_license | export let isValidTitle;
export let isValidText;
export let isCommonValidate;
export let commonValidate = (title, text) => {
let title1 = title.trim();
let text1 = text.trim();
if( (title1.length == 0 && text1.length != 0) ||
(title1.length != 0 && text1.length == 0) ||
(title1.length != 0 && text1.l... | true |
7b852f937205af930f8e87e7a33def500059f5f9 | JavaScript | abhaga/substance | /collab/CollabEngine.js | UTF-8 | 9,449 | 2.578125 | 3 | [
"MIT"
] | permissive | "use strict";
var EventEmitter = require('../util/EventEmitter');
var forEach = require('lodash/forEach');
var map = require('lodash/map');
var extend = require('lodash/extend');
var DocumentChange = require('../model/DocumentChange');
var Selection = require('../model/Selection');
var Err = require('../util/Error');
... | true |
a3a88ac72272a541574313ec0c6a866f019e92c1 | JavaScript | SusanDikramanjian/PingPong | /app/score-keeper-services/player-service.js | UTF-8 | 1,516 | 3.03125 | 3 | [
"MIT"
] | permissive | /**
* Created by sdikramanjian on 4/7/2017.
*/
(function(ng){
'use strict';
function PlayerService(){
return {
getNewPlayer:_getNewPlayer,
getWinner: _getWinner
};
/**
* @name getWinner
* @description returns the winner if any , else return... | true |
1b1c6c0f1e57490b415faf54343560c3301893dc | JavaScript | Nikolay16031982/-qualityIndicators | /src/Model/funct.js | UTF-8 | 2,136 | 2.625 | 3 | [] | no_license |
const getNormArr = (Nb, Nr) => {
let temp = [{ reS: 0, imS: 0, reC: 0, imC: 0 }];
for (let i = 0; i < Nb; ++i)
for (let j = 0; j < Nr; ++j) {
temp[i][j].reS = Math.random;
temp[i][j].ImS = Math.random;
temp[i][j].reS = Math.random;
temp[i][j].ImS = Math.r... | true |
ccb2af3e179b2b6d15862d14e9009e26b113504b | JavaScript | david2999999/BackBoneJS | /PDF/Backbonejs/js/Collection/Merge-Collection.js | UTF-8 | 334 | 3.21875 | 3 | [] | no_license | let items = new Backbone.Collection;
items.add([{id: 1, name: "dog", age: 3}, {id: 2, name: "cat", age: 2}]);
items.add([{id: 1, name: "bear"}], {merge: true});
items.add([{id: 2, name: "lion"}]); // merge: false
console.log(JSON.stringify(items.toJSON()));
// [{"id":1,"name":"Bear","age":3},{"id":2,"name":"ca... | true |
c0c1dcc88ca6204a38a438e6d59bba68b27c05c9 | JavaScript | qoterwoter/project-4-sem | /web-app/src/Api/ApiService.js | UTF-8 | 2,355 | 2.5625 | 3 | [] | no_license | import React from 'react'
const URL = 'http://project-4-sem.std-962.ist.mospolytech.ru/api';
export default class ApiService extends React.Component {
getStatus(status,postfix, secondpostfix,about) {
let outStat;
switch(status) {
case 'q':
outStat = `Зачислен ${postfix}... | true |
21f1d379f203bdac3fc14d4c63f4e535c8b0aa00 | JavaScript | Njumbi/franchhise_management | /public/js/product.js | UTF-8 | 4,137 | 2.546875 | 3 | [
"MIT"
] | permissive | $(document).ready(function () {
fetchProducts()
addProducts()
});
const fetchProducts = () => {
var table = $('#products_table').DataTable({
"pageLength": 30,
"processing": true,
"serverSide": false,
'ajax': {
'type': 'GET',
'url': '/products/data'
... | true |
732653fb16eab2f31da3e9082c858a725e50f0af | JavaScript | sbmajuanl/ProyectoF_Sprint2 | /assets/js/login.js | UTF-8 | 1,585 | 3.015625 | 3 | [] | no_license | window.addEventListener("load", function () {
document.getElementById("login").addEventListener("click",function (e) {
e.preventDefault();
var correo = document.getElementById("correo").value;
var contrasena = document.getElementById("contrasena").value;
var regEmail = /([^@\s]+)@((?:[-a-z0-9]+\... | true |
66175ff43ba6690df1655e2b33b659676aef7dd7 | JavaScript | Habeebopeyemi/testing | /script.js | UTF-8 | 4,078 | 4.1875 | 4 | [] | no_license | // creating an age array
/*var year = [1990,1980,1987,2006,1999]
function arrayCalc(arr,fn){
var resultingAge = []
for(var i = 0;i < arr.length;i++){
resultingAge.push(fn(arr[i]))
}
return resultingAge
}
// creating a call back function that calculate ages
function agecalculator(el){
return ... | true |
016171ad0e31d5f7555f1b11d8eae97806ed7f90 | JavaScript | Abhishek-Padhi/Forbes-Tests | /Forbes/TestCases/checkf.js | UTF-8 | 928 | 2.640625 | 3 | [] | no_license |
describe("Sample", function () {
it("checking", function () {
browser.waitForAngularEnabled(false);
browser.get("https://www.forbes.com/");
browser.ignoreSynchronization = true;
console.log("working");
browser.sleep(6000);
element(by.xpath('/html/body/div[1]/heade... | true |
7e8c7f219397aeb635ddfd00b13bf50b0e726211 | JavaScript | Max-1992/Node.js-Micro-Servicios | /post/components/controller.js | UTF-8 | 2,726 | 2.734375 | 3 | [] | no_license | // Import Modules
const store = require('./store');
const response = require('../../network/response');
// Declare Controllers
const addPost = async (req, res) => {
try {
const dataPost = req.body;
const { idUser } = req.params;
if( !idUser ) {
const message = `No se recib... | true |
9023ddd8922c464ab1c8e13649d1203185003cb2 | JavaScript | zacpez/ProjectNaN | /server/Game.js | UTF-8 | 4,185 | 2.875 | 3 | [] | no_license | /**
* @constructor
* @class Game
* @param {object} roomInfo
* @param {integer} maxplayers
* @param {integer} maxcharacters
* @param {integer} movementDistance
*/
var Game = function (roomInfo) {
var rules = this;
this.currentPlayer = 0;
this.players = [];
this.spectators = [];
this.equipment... | true |
291a8fff24b4f4cecaae2a8f8d3462870abea322 | JavaScript | marilynaguilar/LIM012-cipher | /src/cipher.js | UTF-8 | 1,294 | 3.171875 | 3 | [] | no_license |
const cipher = {
encode: (valueNum,valueText) => {
let resultEncode = '';
if(valueNum == null || valueNum == 0)
{
throw new TypeError();
}
for (let i = 0; i < valueText.length; i++) //creando un ciclo for que recorra. 0 xque es la posicion inicial
{
let asciiPositionText... | true |
4d26d7a99e614efec7378beb6dcb930a043c03f7 | JavaScript | MichaelTrestman/TreeOfMind.org | /app/assets/javascripts/stores/publications-store.js | UTF-8 | 3,794 | 2.53125 | 3 | [] | no_license | //= require constants/ToM-constants
//= require dispatchers/ToM-dispatcher
var PublicationsStore = (function(){
var _publications = [];
var _active_pub = {};
_active_pub.topics = [];
_active_pub.distribution = null;
var CHANGE_EVENT = 'change';
var FAIL_TO_CREATE_EVENT = 'creation-failed';
return {
... | true |
b60f4a86e3591f0fc4ccfe9520d752bb10f7284e | JavaScript | maungmatubbar/AllPractices | /jquery-2/js/main.js | UTF-8 | 994 | 2.671875 | 3 | [] | no_license | $(document).ready(function(){
$('#pass').keyup(function(){
len = $(this).val().length;
if(len==0){
$('#checker').removeClass('weak');
$('#checker').removeClass('good');
$('#checker').removeClass('strong');
$('#checker').text(' ');
}
els... | true |
b24b610762218e312a3b350014e46480dba05c5f | JavaScript | tanmayshishodia/reddit-backend | /controller/incrementKarma.js | UTF-8 | 1,044 | 2.515625 | 3 | [] | no_license | const user = require('../models/User')
exports.updateKarma = async function(id, req, state, karmaPoints) {
//console.log("state: ",state)
if(state == "increment") {
//console.log("karma points: ",karmaPoints)
user.updateOne(
{_id: id},
{
$inc: {
... | true |
566c8be7aef452d849f5379e0d033322caf4ddf2 | JavaScript | hanks-bs/naszechoinki | /api/dbAccess/pricelistAccess.js | UTF-8 | 1,890 | 2.546875 | 3 | [] | no_license | import { db } from "./../dataBase/connection.js";
import * as fs from 'fs';
class PricelistAccess {
async GetItems() {
try {
const items = await db("pricelist_items").select("*");
return items;
} catch (error) {
console.log(error);
return {error};
}
}
async DeleteItem(id, path... | true |
299c2981ce6f4322920e106b3bba4281777ad7e2 | JavaScript | avmitroshin/human-readable-number | /src/index.js | UTF-8 | 1,494 | 3.3125 | 3 | [
"MIT"
] | permissive | module.exports = function toReadable (number) {
function parseHundred (value) {
let result = "";
result += value[0] < "1" ? "" : VOC[value[0]] + " hundred";
if (value[1] > "1") {
result += `${value[1]}0` in VOC ? ` ${VOC[value[1]+"0"]}` : ` ${VOC[value[1]]}ty`;
} else if (value[1] > "0"){
... | true |
76d514c82821c603d8bced7fd8a252762f4c68ed | JavaScript | santiap03/Proyecto_web | /search.js | UTF-8 | 1,921 | 2.921875 | 3 | [] | no_license | function search(){
const list1= ["inicio", "mision", "publico"]
const list2= ["comienzo", "beneficio", "beneficios", "razones", "consejos"]
const list3= ["libros", "datos", "lista"]
const list4= ["sugerencia", "queja", "quejas", "reclamo", "reclamos"]
const list5= ["registro", "inscripcion"]
c... | true |
d3a33f1c77473216beec6e5e5a701850f9ecaed6 | JavaScript | FMularski/django-chat-app | /chat/static/chat/js/invitations.js | UTF-8 | 4,117 | 2.5625 | 3 | [] | no_license | (function(){
function handleInvitation(action, msg) {
const handleBtns = document.querySelectorAll('.' + action);
handleBtns.forEach(function(btn) {
btn.addEventListener('click', function(){
const invitationId = btn.getAttribute('invite-id');
co... | true |
f5434095e70161d12e31ed723247da8be2afa4ff | JavaScript | okb1100/Solo-Test-React | /src/App.js | UTF-8 | 3,919 | 2.578125 | 3 | [] | no_license | import React from 'react';
import './App.css'
const Hole = ({hasPawn, ...rest}) => {
return <span {...rest}>
{hasPawn ? '⛳️' : '🕳'}
</span>
}
class App extends React.Component {
constructor(props){
super(props)
this.state = {
map: Object.assign({},[
"0","0","+","+","+","0","0",
"0","0","+","... | true |
49f68d9e029bf518be3467e6ea2fa7a80ee8bf9b | JavaScript | mohamadebrahimh/online-shopping | /Businessdevweb/Scripts/JavaScriptHelper.js | UTF-8 | 1,347 | 2.609375 | 3 | [
"MIT"
] | permissive |
//شمارنده کاراکتر ها
var badgeElement = document.querySelectorAll('.mdl-badge-counter');
for (var i = 0; i < badgeElement.length; i++) {
var dataId = badgeElement.item(i).getAttribute('for');
document.getElementById(dataId.toString()).addEventListener('keyup', function () {
do... | true |
2cd673a22a27b80e0401e46194f18a8400eba4d9 | JavaScript | SilentSpud/jsinjector | /js/injector.js | UTF-8 | 839 | 2.640625 | 3 | [] | no_license | var injector = {};
var i=0;
// Javascript Injector
injector.injectScript = function(tabId, code) {
chrome.tabs.executeScript(tabId, {code:code}, function() {
console.log("Script injected: \n" + code);
});
}
// jQuery Injector
injector.injectJQuery = function(tabId, callback) {
chrome.tabs.executeScript(... | true |
afe621b06f3dcf4874cd61d06dfb1e21e0f9670d | JavaScript | slovn1k/typescript | /main.js | UTF-8 | 151 | 3.359375 | 3 | [] | no_license | //Simple javascript function that will console log a message
function log(message) {
console.log(message);
}
var message = "Hello world";
log(message);
| true |
313f3914b16a87b891877520bdef5dbbcda3a0a2 | JavaScript | whj666/demo | /server/app/userInfo/userData/saveUserData.js | UTF-8 | 1,112 | 2.6875 | 3 | [] | no_license | /**
* 保存个人信息
*/
const UserData = require("./userData.js");
const saveUserData = function(option){
return new Promise(resolve => {
UserData.findOne({userName: option.userName}, function(err, res){
if(err){
console.log("Error:" + err);
}else{
if(!res)... | true |
a6519aadfc63b0f16170b307e9c4ac5bed4e9662 | JavaScript | SE2-Team-14/Project-SE2-2020 | /client/src/Components/BookedStudentsList.js | UTF-8 | 1,693 | 2.53125 | 3 | [] | no_license | import React from 'react';
import { AuthContext } from '../auth/AuthContext'
import API from '../api/API';
import { Redirect } from 'react-router-dom';
import BookingTable from "./BookingTable"
class BookedStudentsList extends React.Component {
constructor(props) {
super(props)
this.state = {
... | true |
ae2b840232c6c8173ae3f4518d41d0cfdcbaadda | JavaScript | vandanajamnal02/trelloprotractor | /specs/CardSpec.js | UTF-8 | 2,508 | 2.640625 | 3 | [] | no_license | const SignUpLogin = require('../pages/SignUpAndLogin');
const Board = require('../pages/Board');
const List = require('../pages/listFunctionality');
const Utils = require('../pages/Utils');
const boardName = Utils.getRandomBoardName();
const privateBoard = false;
const ListName = Utils.getRandomListName();
const Card =... | true |
0e76b308a017e52c3b5389b9ee914afef99e159e | JavaScript | diwalker/dcalc | /js/app.js | UTF-8 | 558 | 3.609375 | 4 | [] | no_license | function insert (num) {
var numero = document.getElementById('resultado').innerHTML;
document.getElementById('resultado').innerHTML = numero + num;
}
function clean() {
document.getElementById('resultado').innerHTML = "";
}
function back() {
var numero = document.getElementById('resultado').innerHTML;
docum... | true |
68c163dda4c44b1d3b6443b0294cac614cfcf425 | JavaScript | ThatSkiPatroller/ThatSkiPatroller.github.io-Password-Generator | /Assets/script.js | UTF-8 | 2,699 | 4.3125 | 4 | [] | no_license | // Assignment Code
// HTML Element selectors
var generateBtn = document.querySelector("#generate");
var passwordText = document.querySelector("#password");
// Write password to the #password input
function writePassword(passwordLength, uppercase, lowercase, numeric, special) {
// Array to hold characters
const pa... | true |
a0847a565fdcdd2c5c487ba36803f66f3bd8da33 | JavaScript | adzafic/express-test | /modules/mail.js | UTF-8 | 1,987 | 2.515625 | 3 | [] | no_license | var mail = (function(){
const helper = require('sendgrid').mail;
const config = require('./../config/config.js');
const sg = require('sendgrid')(config.SENDGRID_API_KEY);
const fs = require('fs');
var from_email = new helper.Email('no.replay@localhost.com');
var to_email = new helper.Email(config.TO_MAIL);... | true |
8627998822f6ec29f4856c522c7a19477ed2edfd | JavaScript | rachwongrw/famous-people | /lookup_people.js | UTF-8 | 1,909 | 3.25 | 3 | [] | no_license | // SETUP
const myArgs = process.argv[2]; // take in arguments from the CLI
const pg = require('pg');
const moment = require('moment'); // required moment to display date as displayed in example
const settings = require('./settings.json');
const client = new pg.Client({
user : settings.user,
password : sett... | true |
28844b6c1736df51f9ce13d120f1aea21ef23d9b | JavaScript | Grinzzly/JS-algorithms-and-structures | /data-structures/tree/red-black-tree/RedBalckTree.js | UTF-8 | 2,843 | 3.625 | 4 | [] | no_license | const COLORS = {
RED: 0,
BLACK: 1
};
class Node {
constructor(key, value, left, right, color) {
this.key = key;
this.left = left;
this.right = right;
this.value = value;
this.color = color;
}
isRed() {
return this.color === COLORS.RED;
};
flipColor() {
if ... | true |
7a5880a464c98b42c5eb694c4012e795c5a09d16 | JavaScript | liyanxiangable/CodingNotes | /LeetCode/606-ConstructStringFromBinaryTree/ConstructStringFromBinaryTree.js | UTF-8 | 785 | 3.375 | 3 | [] | no_license | /**
* Created by liyanxiang on 2017/8/20.
*/
/**
* Definition for a binary tree node.
* function TreeNode(val) {
* this.val = val;
* this.left = this.right = null;
* }
*/
/**
* @param {TreeNode} t
* @return {string}
*/
var tree2str = function(t) {
let string = '';
function preOrderTraversal(t... | true |
fd4c81cced41d62109cc41c159cbef9e6e931671 | JavaScript | topazahmed/whoami | /aboutme.js | UTF-8 | 1,541 | 2.6875 | 3 | [] | no_license | (function ($) {
"use strict";
console.log("Who Am I?");
// Size of browser viewport.
console.log("window height" + $(window).height());
console.log("window height" + $(window).width());
// Size of HTML document (same as pageHeight/pageWidth in screenshot).
console.log("document height" + $... | true |
906468cf6fde80b70c6aea4d6c99e34bdc1b44d8 | JavaScript | hunhrabo/bored-APP | /src/Services/activities.js | UTF-8 | 1,139 | 2.859375 | 3 | [] | no_license | import axios from "axios";
const baseURL = "http://www.boredapi.com/api/activity";
const getInitialActivity = async () => {
try {
const response = await axios.get(baseURL);
return response.data;
} catch (err) {
console.log(err);
return null;
}
};
const getRandomActivity = async (type, participa... | true |
e86d6c61ac87b2dda6ac7235141cc3412e56828c | JavaScript | aelyasov/JSDomTest | /examples/apps/sudoku/newGame.js | UTF-8 | 413 | 2.5625 | 3 | [] | no_license | /*t dom */
function test() {
var obj = document.getElementById('sudoku');
var subObjects = obj.getElementsByTagName('DIV');
for(var no=0; no<subObjects.length; no++){
if(subObjects[no].className=='sudokuSquare') {
subObjects[no].style.backgroundColor='';
var spans = subObjects[no].getElementsByTag... | true |
754d4d14f4af69262ca632ce1739bfa312635b62 | JavaScript | walkwel/ALSET-reactGame | /scripts/bot1.js | UTF-8 | 1,307 | 2.90625 | 3 | [] | no_license | // module.exports = function(world, playerNum) {
// var player = world.players[playerNum - 1];
// var closestGem = false;
// var closest;
// world.stones.forEach(stone => {
// if (closestGem === false) closestGem = stone;
// else if (
// Math.abs(
// Math.sqrt(closestGem.x * closestGem.x +... | true |
9b177b32e85e00b7a49739d645f6ccec167dea1d | JavaScript | Meschreiber/02-router | /start/browser/react/components/Artist.js | UTF-8 | 2,643 | 2.625 | 3 | [] | no_license | import React from 'react';
import { Link } from 'react-router';
import axios from 'axios';
import Songs from './Songs';
import Albums from './Albums';
export default class Artist extends React.Component {
componentDidMount() {
const artistId = this.props.routeParams.artistId;
const selectArtist = ... | true |
cf8e6354a23cf3f11fb533c14baa475c3f2ae09f | JavaScript | charlesgery/bsport-calendar-test | /src/components/App.js | UTF-8 | 3,085 | 2.796875 | 3 | [] | no_license | import React from 'react';
import moment from 'moment';
import ListOffers from './ListOffers/ListOffers';
import Calendar from './Calendar/Calendar';
import './App.css';
/**
* Main component of the app
* Contains most of the stateful logic
*/
class App extends React.Component {
constructor(props) {
super(p... | true |
4d7b0defc567588f763f705341a1263321d2339d | JavaScript | akabekobeko/examples-nw | /audio-player/src/js/actions/MusicListAction.js | UTF-8 | 1,128 | 2.6875 | 3 | [
"MIT"
] | permissive | import { Action } from 'material-flux';
/**
* 音楽リストの操作種別を定義します。
* @type {Object}
*/
export const Keys = {
init: Symbol( 'MusicListAction.init' ),
select: Symbol( 'MusicListAction.select' ),
add: Symbol( 'MusicListAction.add' ),
remove: Symbol( 'MusicListAction.remove' ),
clear: Symbol( 'MusicListAct... | true |
fd4d6791ac20854f3380d7767f776afad5df3f57 | JavaScript | seventhclass/delicious | /src/js/home.js | UTF-8 | 4,031 | 2.984375 | 3 | [
"MIT"
] | permissive | window.onload = function() {
var container = document.getElementById('content_home');
var list = document.getElementById('list');
var buttons = document.getElementById('buttons').getElementsByTagName('span');
var prev = document.getElementById('prev');
var next = document.getElementById('next');
//var pause = d... | true |
7a31faedef0e3a1b71ac7246ffc53ef2e53b8d2e | JavaScript | mishalisovskiy/project-lvl1-s438 | /src/utils.js | UTF-8 | 292 | 2.921875 | 3 | [] | no_license | export const getNumber = (min, max = 0) => Math.floor((Math.random() * max) + min);
export const buildYesOrNoFunc = (predicateFunc, min, max) => {
const question = `${getNumber(min, max)}`;
const answer = predicateFunc(Number(question)) ? 'yes' : 'no';
return { question, answer };
};
| true |
b2c7a8b5676fa4eeb1d96a6904cf3a85b84bacd1 | JavaScript | sdierauf/javascripts | /problemset1.js | UTF-8 | 3,055 | 4.09375 | 4 | [] | no_license | //Stefan Dierauf Nov 2013
//solutions to problem set 1 from sudo soldiers
//find the sum of all the multiples of 3 and 5 below 1000
var problem1 = function() {
var sum = 0;
for (var i = 1; i < 1000; i++) {
if (i % 3 == 0) {
sum += i;
} else if (i % 5 == 0) {
sum += i;
}
}
console.log("... | true |
e2bf5d99e7945c6bf6be13f862d9bb6361eb5b39 | JavaScript | SirPotatoIV/pong-continued | /src/App.js | UTF-8 | 4,482 | 2.84375 | 3 | [] | no_license | import React, { useReducer, useEffect } from "react";
import "./styles.css";
import Paddle from "./components/Paddle";
import Ball from "./components/Ball";
import Brick from "./components/Brick";
const initialState = {
paddle1: {
y: 0
},
paddle2: {
y: 0
},
ball: {
x: 50,
y: 50,
dx: 5,
... | true |
60f5bd4de0c8746dec22769e642e55df4aaec20a | JavaScript | ranthilina99/newmobilecsse | /WEB/client/src/umesh/supervisor.js | UTF-8 | 1,512 | 2.515625 | 3 | [] | no_license | import React, {Component} from 'react';
import axios from "axios";
class Supervisor extends Component {
constructor(props) {
super(props);
this.state={
firstname:'',
lastname:''
}
}
componentDidMount() {
const token = localStorage.getItem('token');
... | true |
3c0398b7450c6cb41f7f1cfce8520297e97bb92d | JavaScript | Basharath/emart-api | /controllers/categories.js | UTF-8 | 1,593 | 2.59375 | 3 | [] | no_license | const { Category, validate } = require('../models/category');
const getCategories = async (req, res, next) => {
try {
const categories = await Category.find();
if (!categories) return res.status(404).send('No categories found');
return res.send(categories);
} catch (err) {
next(err);
}
};
const ... | true |
a048c31e27e974d5e1689a250bb1c0f0f04e8c02 | JavaScript | LDflex/LDflex | /test/unit/SortHandler-test.js | UTF-8 | 1,668 | 2.578125 | 3 | [
"MIT"
] | permissive | import SortHandler from '../../src/SortHandler';
describe('a SortHandler instance', () => {
const path = {
p1: { predicate: 'http://p.example/#1' },
p2: { predicate: 'http://p.example/#2' },
};
const pathData = {
extendPath: jest.fn(data => ({ ...data, ...path })),
};
let handler;
beforeAll(()... | true |
d7b2942136643944a114f1b147aea08788df8b5a | JavaScript | bullish-ventures/gluegun | /src/utils/print.js | UTF-8 | 2,643 | 2.734375 | 3 | [
"MIT"
] | permissive | const colors = require('colors')
const AsciiTable = require('ascii-table')
const ora = require('ora')
/**
* Sets the color scheme.
*/
colors.setTheme({
highlight: 'cyan',
info: 'reset',
warning: 'yellow',
success: 'green',
error: 'red',
line: 'grey',
muted: 'grey'
})
/**
* Print a blank line.
*/
fun... | true |
40aec53762cc2b7d094fa4999466508570222a4b | JavaScript | PangKimJin/CS3219_B | /web/src/Delete.js | UTF-8 | 1,526 | 2.75 | 3 | [] | no_license | import React, { useState } from 'react';
import axios from 'axios';
const Delete = () => {
const [errorMessage, setErrorMessage] = React.useState("");
const [successMessage, setSuccessMessage] = React.useState("");
const [id, setId] = useState("");
async function deletePost(e) {
e.preventDefau... | true |
ed7eb35800369e92243be33c96232c020c7356bb | JavaScript | AtsushiM/AMIDA-Wars | /src/js/namespace_start.js | UTF-8 | 2,703 | 2.625 | 3 | [] | no_license | //init enchant.js
enchant();
var AW = (function(W) {
//set scroll
var doScroll = function() {
if (W.pageYOffset === 0) {
W.scrollTo(0, 1);
}
};
W.onorientationchange = function() {
setTimeout(doScroll, 100);
};
W.addEventListener('load', W.onorientationchange, false);
/* TODO:
☆各クラスの最適&効率化(常時タスク)
・ユ... | true |
7c3e71bb02285d9461f978fb7ba41ff81fb0f2ae | JavaScript | taylorrgriffin/Beerbook | /src/Hops/Hops.js | UTF-8 | 3,437 | 2.59375 | 3 | [] | no_license | /** @jsx jsx */
import { useState, useEffect } from 'react';
import { css, jsx } from '@emotion/core';
import HopsItem from './HopsItem';
import { apiKey } from '../secrets.json';
import ClipLoader from "react-spinners/ClipLoader";
const hopsStyles = css `
/* background-color: #e9ebee;
justify-content: center;
... | true |
34ac411e0b6ca3d72d8769a2e1dbb70084000b64 | JavaScript | ferhatcamgoz/Url-shortener | /src/main/reactui/src/redux/reducer.js | UTF-8 | 434 | 2.703125 | 3 | [] | no_license | const defaultState={
isLoggedIn:false,
userName:undefined,
password:undefined
};
const authReducer = (state=defaultState,action)=>{
console.log(action.toString())
if(action.type=="logout-success"){
return defaultState;
}
if(action.type=="login-success"){
return {
... | true |
82f0e966799e1b7be32b32e27b30bbd310174e5e | JavaScript | cherrybomb1994/cherrybomb1994.github.io | /IFE/yaoyao/UI_1/UI_1.js | UTF-8 | 1,638 | 2.84375 | 3 | [] | no_license | var m_x=0;
var m_y=0;
var m_x_c=0;
var m_y_c=0;
var uitop=0;
var uileft=0;
var drag = false;
var down = false;
//将float居中
function autoCenter(el) {
var bodyW = document.body.clientWidth;
var bodyH = document.body.clientHeight;
var elW = parseInt(el.style.width);
var elH = parseInt(el.style.height);
... | true |
d1117a54d86a8ddc755d17cb601a889e6305c8bc | JavaScript | dejosli/testdrivennode | /test/unit/game-spec.js | UTF-8 | 894 | 2.515625 | 3 | [
"MIT"
] | permissive | var Game = require('../../lib/game');
var sandbox = require('sandboxed-module');
describe("Game", function() {
var game;
beforeEach(function(){
game = new Game();
});
it("has a grid for the player", function(){
expect(game.primaryGrid).toBeDefined();
});
it("has a grid for the opponent", functio... | true |
bb518638b69cec5444d3c6766f1d002bea3f41e7 | JavaScript | MrCorax/274053-kekstagram-19 | /js/main.js | UTF-8 | 5,290 | 3.203125 | 3 | [] | no_license | 'use strict';
var OBJECT_QUANTITY = 25;
var objectNumber = 0;
var minQuantityLikes = 15;
var maxQuantityLikes = 200;
var minQuantityComment = 2;
var maxQuantityComment = 4;
var minQuantityAvatar = 1;
var maxQuantityAvatar = 6;
var minQuantityMessage = 1;
var maxQuantityMessage = 2;
var getMix = function (array) {
f... | true |
ca4932f1ced23dd82fce587e83d3a18673c4eb04 | JavaScript | ethunk/Launch-Academy | /startup-mad-libs/main.js | UTF-8 | 611 | 2.84375 | 3 | [] | no_license | let companyName = 'ChangeforCause Inc.,';
let anOffering = 'a new way to donate';
let aTargetAudience = 'to help make it easier to give';
let solveAProblem = 'by providing incentives';
let secretSauce = 'where big brands give big rewards \n for every donation they make';
// your code, here
let lineOne = "My company, "... | true |
4f9b85fbbc7786b412da9f484a38d742406b04db | JavaScript | Epersonf/RPS-Back | /Utility/util.js | UTF-8 | 2,369 | 3.015625 | 3 | [] | no_license | import { Chat } from "../Classes/Room/RoomChat.js";
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
export const generateToken = () => {
let build = '';
for (let i = 0; i < 50; i++)
build += chars[getRandomInt(0, chars.length - 1)];
return build;
}
export function ... | true |
cbd31155ec4aab351dd208e72a674131dfb5117f | JavaScript | kmboese/tic-tac-toe-react | /src/index.js | UTF-8 | 5,004 | 3.46875 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
function Square(props) {
return (
<button className="square" onClick={props.onClick}>
{props.value}
</button>
);
}
class Board extends React.Component {
constructor(props) {
super(props);
this.state = {... | true |
fef0c806e5bf76f2a62fef0a496db5f492a565be | JavaScript | EuraKo/uiuxmyweb | /web/deepening/c_jquery_reboot/js/js_01_showHide.js | UTF-8 | 2,182 | 3.5625 | 4 | [] | no_license | // js_01_showHide.js
(function($){
// show(),hide(),toggle()
// fadeIn(),fadeOut(),fadeToggle()
// slideDown(),slideUp,slideToggle()
// addClass(),removeClass(),toggleClass()
// 선택자.on('click',콜백함수(인수){인자.prevrntDefault(); });
// 1.
// 선택자 가져오기
var btn = $('#navigation').find('li');
var par = $('p');
var timed = 500... | true |
b21dee713caff6c930c409021194c4ad4fd2827a | JavaScript | Piecha93/nodeGame | /public/javascripts/graphics/playerrender.js | UTF-8 | 1,744 | 2.984375 | 3 | [] | no_license | /*
player render
*/
function PlayerRender(game, group, player) {
this.game = game;
this.group = group;
this.player = player;
this.sprite = null;
this.nameText = null;
//1 - no lerp, >1 - lerp, do not set this to <1
this.lerpRate = 10;
}
PlayerRender.prototype.init = function () {
th... | true |
61db459cfd0dfe51bdad35a5d2019d2de0e8def2 | JavaScript | anggadewa/test-pokeapi-react-native | /src/pages/PokemonList/index.js | UTF-8 | 3,226 | 2.53125 | 3 | [] | no_license | import axios from 'axios';
import React, {useEffect, useState} from 'react';
import {
View,
Text,
StyleSheet,
Image,
FlatList,
ScrollView,
TouchableOpacity,
} from 'react-native';
const Item = ({name, imageUrl, onPress}) => {
return (
<TouchableOpacity style={styles.cardContent} onPress={onPress}>
... | true |
33d4b48d4740397e879042462d5642562504253a | JavaScript | Zweihand3r/three.js-Stuff | /scenes/components/template_scene.js | UTF-8 | 3,151 | 2.734375 | 3 | [] | no_license | const PLANE_SIZE = 40
const CREATE_PLACEHOLDER_CUBE = true
const { canvas, renderer, scene, gui, cam_world } = init()
function render(time) {
renderer.render(scene, cam_world)
requestAnimationFrame(render)
}
requestAnimationFrame(render)
/* -------------- Init -------------- */
function init() {
cons... | true |
812747ba31a55467b9f4b01ca5b57502155bd2c4 | JavaScript | reacticoon/reacticoon | /src/view/hook/useDebouncedSubmit.js | UTF-8 | 999 | 2.53125 | 3 | [] | no_license | import React from 'react'
// TODO: remove this file and those?
import useConstant from 'use-constant'
import AwesomeDebouncePromise from 'awesome-debounce-promise'
import { useAsync } from 'react-async-hook'
// https://stackoverflow.com/questions/23123138/perform-debounce-in-react-js
const useDebouncedSubmit = (submit... | true |
36e721c71c3649ce3d87534a9ce0c19f9a206a65 | JavaScript | andyhmltn/grape-js | /test/main.js | UTF-8 | 870 | 2.765625 | 3 | [
"MIT"
] | permissive | var assert = require('assert'),
Grape = require('../grape/grape.js')
describe("Grape.JS", function() {
it("Extracts the arguments correctly", function() {
var test_function = function(hello,world) {}
var instance = new Grape({})
assert.equal(instance.extractArguments(test_function).length,2)
as... | true |
fad6e6ea86314132677a0240655d614c4e82c43a | JavaScript | manhmayman/JS_CodersX | /Bài 32.2.js | UTF-8 | 466 | 2.984375 | 3 | [] | no_license | /**
* Ghi lại những kiến thức mà bạn hiểu được trong bài bằng cách trả lời các câu hỏi sau:
* 1. JSON là gì?* 2. Cấu trúc JSON?
*/
function answer() {
// Ghi câu trả lời của bạn bên trong 2 dấu ``
return `
1.Json là định. dạng lưu trữ thông tin dùng để truyển dữ liệu giữa sever và clinet.
2. Cấu trúc JSON:
Key : Là một... | true |
ca9a66d88c15c452d37d7576d50f2bd68dc69d0b | JavaScript | tmslee/EQworks-sample | /src/components/DataTable/DataTableComponent.jsx | UTF-8 | 3,238 | 2.6875 | 3 | [] | no_license | import React, {useEffect, useState} from 'react';
import {Table} from 'react-bootstrap';
import './DataTableComponent.scss';
export default function DataTableComponent (props) {
const {queryRes} = props;
const [tableData, setTableData] = useState(queryRes);
// const sortQueryRes = function(sortBy, ascend) {
... | true |
50454af501e38eb4ef635f48acf0687c806855c9 | JavaScript | almero-digital-marketing/mikser | /lib/queue.js | UTF-8 | 3,615 | 2.703125 | 3 | [] | no_license | 'use strict'
var Promise = require('bluebird');
var moment = require('moment');
var S = require('string');
var _ = require('lodash');
module.exports = function(mikser) {
mikser.queue = {
concurrency: mikser.config.workers * 3,
processed: 0,
pending: 0,
remainingTime: 0,
averageTime: 0
};
let debug = mik... | true |
f4bd641bd64777ea4ccfd6ab476c1cfb0edeac44 | JavaScript | wangcheng714/fis-auto-packager | /test/reference/map-batman-old/common/widget/datepicker/datepicker.js | UTF-8 | 17,890 | 2.546875 | 3 | [] | no_license | /**
* @file 实现了通用highlight方法。
* @name Highlight
* @desc 点击高亮效果
* @import core/zepto.js
*/
var Zepto = $;
(function($) {
var actElem, inited = false, timer, cls, removeCls = function(){
clearTimeout(timer);
if(actElem && (cls = actElem.attr('highlight-cls'))){
actElem.removeClas... | true |
a87d56ec61f18096065d46c49553a24cdf3ba10c | JavaScript | QkSr4497/Book-Reading | /public/js/grown-up/notifications-scripts.js | UTF-8 | 1,806 | 2.578125 | 3 | [] | no_license |
(function() {
var tableHeaders = document.getElementsByClassName("c-table__header");
var tableCells = document.getElementsByClassName("c-table__cell");
var span = document.createElement("span");
for (var i = 0; i < tableCells.length; i++) {
span = document.createElement("span");
span.c... | true |
5c60d34388c282e5f2a9513bac8dd3ef674159e3 | JavaScript | aman-raza/TwitScript | /script.js | UTF-8 | 1,909 | 2.515625 | 3 | [] | no_license | const Twit = require('twit')
// const notifier = require('node-notifier');
// const open = require('open');
// const franc = require('franc')
const apikey = 'DEY1Nna....aARlKgRPwFZ6gB'
const apiSecretKey = 'i3ubTxuix3Z0CEVqTmxwC9gaq6....ZJFsdAPSqP2uRqxg7KEf'
const accessToken = '959877444965511168-H... | true |
2954f3d641cbf0b9094a930c78a0bc1cad4a4285 | JavaScript | Zylviij/zylviij.github.io | /public/logo.js | UTF-8 | 1,276 | 3.1875 | 3 | [
"MIT"
] | permissive |
let logo = (canvas, image) => {
const context = canvas.getContext('2d')
canvas.width = window.innerWidth
canvas.height = window.innerHeight
const start = Date.now()
let draw = () => {
context.clearRect(0, 0, canvas.width, canvas.height)
// fade out over 3.5 seconds
let alpha = ... | true |
1347c05e363a1f21e52dcdc3d8023718c9e0fcd2 | JavaScript | andreaaperz/Final-proj-geo | /js/autorizacion.js | UTF-8 | 2,792 | 2.84375 | 3 | [] | no_license | const formaingresar = document.getElementById("formaingresar");
formaingresar.addEventListener('submit', (e) => {
e.preventDefault();
let correo = formaingresar['correo'].value;
let contrasena = formaingresar['contrasena'].value;
auth.signInWithEmailAndPassword(correo, contrasena).then(() => {
... | true |
ddc4d63726bf3cee4ccf9228d897886a0ebcf1c6 | JavaScript | step-batch-7/geometry-nooranasrin | /test/testLine.js | UTF-8 | 17,946 | 3.234375 | 3 | [] | no_license | "use strict";
const assert = require("chai").assert;
const Line = require("../src/line");
const Point = require("../src/point");
describe("Line", () => {
describe("isEqualTo", () => {
it("should validate when the two instances are equal", () => {
const line = new Line({ x: 10, y: 11 }, { x: 12, y: 13 });
... | true |
89b57cfc283dfc451bc6c743acdaead47f72f4c7 | JavaScript | Henrycall/EstudosJsUdemy | /Fundamentos/tipagemFraca.js | UTF-8 | 185 | 2.8125 | 3 | [] | no_license | let qualquer = "legal";
console.log(qualquer)
console.log(typeof qualquer)
qualquer = 3.912312
console.log(qualquer)
console.log(typeof qualquer)
// evitar nome genéricos e siglas. | true |
6c6ce571ab06704d98726cbf614c1ed5cf283647 | JavaScript | brunolm/codewars | /4 kyu/next-bigger-number-with-the-same-digits.js | UTF-8 | 844 | 3.640625 | 4 | [] | no_license | // http://www.codewars.com/kata/next-bigger-number-with-the-same-digits
function nextBigger(n) {
let s = n.toString().split('').map(v => +v);
for (let i = s.length - 1; i > 0; --i) {
if (s[i] > s[i - 1]) {
let e = s.slice(i - 1)
.map((v, ind) => { return { n: v, i: ind, r: v - s[i - 1] } })
... | true |
681e603d2d95a92c7c50d38197c51a68e8aac98c | JavaScript | madebymilly/react-bad-jokes | /src/Joke.js | UTF-8 | 2,176 | 2.8125 | 3 | [] | no_license | import React, { Component } from 'react'
import './Joke.css'
export default class Joke extends Component {
constructor(props) {
super(props)
this.handleScoreUp = this.handleScoreUp.bind(this)
this.handleScoreDown = this.handleScoreDown.bind(this)
this.getColor = this.getColor.bind(this)
this.g... | true |
5915fba89fa16d0aff926cf2e1afd8bce64374f4 | JavaScript | falafel-v-postel/Money-Exchange | /src/index.js | UTF-8 | 1,172 | 3.484375 | 3 | [] | no_license | // PLEASE DON'T change function name
module.exports = function makeExchange(currency) {
// Your code goes here!
// Return an object containing the minimum number of coins needed to make change
let Obj = {};
let H = 50;
let Q = 25;
let D = 10;
let N = 5;
let P = 1;
if (currency>10000)... | true |
c603a19927539becef08533d98012932f7eded53 | JavaScript | kotRks/verivox | /cypress/pages/TariffPage.js | UTF-8 | 803 | 2.546875 | 3 | [] | no_license | export default class TariffInfo{
constructor(){
this.TariifAmount = '[class="price"]';
this.FirstInfoButton = '[data-description="firstAvailabilityCheckButton"]';
this.SecondInfoButton = '[data-description="secondAvailabilityCheckButton"]';
this.TariffName = '.tariff-details > .group... | true |
40bee53a027fc530b1e751bdbc29ceb724d978e0 | JavaScript | alinasmirnova/mesto | /src/scripts/components/PopupWithForm.js | UTF-8 | 1,557 | 2.765625 | 3 | [] | no_license | import Popup from "./Popup.js";
class PopupWithForm extends Popup {
constructor(popupSelector, onFormSubmit) {
super(popupSelector);
this._onFormSubmit = onFormSubmit;
this._form = this._popup.querySelector('.form');
this.setEventListeners();
this._submitButton = this._pop... | true |
cca03351b0ec0416fc6e8f1d3fb2e20155af728a | JavaScript | Joaquinchable/FULLJSBD | /ECMASCRIPT6/VarLetConst.js | UTF-8 | 3,367 | 4.0625 | 4 | [] | no_license | // ECMAscript6
// ECMAScript es una especificación de lenguaje de programación publicada
// por ECMA International. El desarrollo empezó en 1996 y estuvo basado en el popular lenguaje JavaScript
// propuesto como estándar por Netscape Communications Corporation.
// Actualmente está aceptado como el estándar ISO/IE... | true |
d5cb2bdabfa17c8c14bb9d53c86865e3cc91032e | JavaScript | SwarazK/JSGames | /Snake/script.js | UTF-8 | 3,688 | 3.65625 | 4 | [] | no_license | const squares = document.querySelectorAll(".grid div");
const scoreDisplay = document.querySelector("span");
const startBtn = document.querySelector(".start-btn");
const width = 20;
// let currentIndex = 0;
let foodIndex = 0;
let snake = [2,1,0]; //First element is the position of the head and the last element is the ... | true |
0eb618ff588490ec2a926f5cca2350b0fd31ee0b | JavaScript | CalderWhite/devstack | /app/functions/index.js | UTF-8 | 5,158 | 2.65625 | 3 | [] | no_license | const functions = require('firebase-functions');
const admin = require('firebase-admin');
const express = require('express');
const querystring = require('querystring');
const app = express();
const MAX_RESULTS = 50;
const CACHE_TIME = 60*10;
// this is relative to the MAX_RESULTS. this limit will be adjusted if the... | true |
90a8f6a01cc3e294f602a13927a8374ba76df0aa | JavaScript | tbranyen/pigeonpost | /server/handler/actions/fetch-resources.js | UTF-8 | 666 | 2.703125 | 3 | [] | no_license | const Bluebird = require('bluebird');
const fetchResource = require('./fetch-resource');
/**
* Fetch and save the template and data resources to the state object.
*
* @param state
* @return state
*/
module.exports = function fetchResources(state) {
// If the `body` property is already attached, skip this step.
... | true |
f0429cd0678e3585f113c42b43e86de3ea991f01 | JavaScript | oddnetworks/tinypass | /lib/tinypass.js | UTF-8 | 3,683 | 2.625 | 3 | [] | no_license | var _ = require('lodash');
var crypto = require('crypto');
var aesjs = require('aes-js');
var DELIM = '~~~';
Tinypass = function(options) {
this.options = options;
return this;
};
exports.Tinypass = Tinypass;
Tinypass.prototype.authorizationHeader = function(data) {
return this.options.aid + ':' + this.hashHma... | true |
6f13ae983203331eb8c5e8acf2c8401bbdfcb9d2 | JavaScript | alejoroldan608/gifosroldan | /js/index.js | UTF-8 | 5,040 | 2.859375 | 3 | [] | no_license | let giphy = new Giphy();
let storage = new MiStorage();
const CLASS_FAVORITO='favorito';
giphy.getTextTrending().then((text) => {
let contString = document.getElementById('reactions');
contString.innerText = '';
text.data.forEach((reaction) => {
contString.insertAdjacentHTML('beforeend', `<a href="... | true |
9ed3a7eaf90abab18ddab256aca99322493aaad9 | JavaScript | kushagra1212/To-Do-List-App | /src/App.js | UTF-8 | 2,277 | 2.5625 | 3 | [] | no_license | import React, { Component } from "react";
import Styles from "./App.module.css";
import Amain from "./components/Amain";
import Ls from "./components/Ls";
import cross from "./cross.png";
class App extends Component {
state = {
show: true,
com: false,
all: true,
ourInt: false,
};
lsHandler = () =>... | true |