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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
3ffd1a8ea999beb6d3d40e3c7b3e91363776f904 | JavaScript | vasylsemak/Redux-Groceries | /client/store/grocery-store.js | UTF-8 | 1,832 | 3.015625 | 3 | [] | no_license | const ADD_GROCERY = "ADD_GROCERY";
const TOGGLE_ITEM = "TOGGLE_ITEM";
const REMOVE_ITEM = "REMOVE_ITEM";
const SET_QUANTITY = "SET_QUANTITY";
const SET_VISIBILITY_FILTER = "SET_VISIBILITY_FILTER";
export const SHOW_ALL = "SHOW_ALL";
export const SHOW_BOUGHT = "SHOW_BOUGHT";
export const SHOW_ACTIVE = "SHOW_ACTIVE";
... | true |
cf47ebe91e0e31cbddee9fdb8b868d7b6d98edf2 | JavaScript | finguy/saan | /saan/www/js/services/util.js | UTF-8 | 4,018 | 2.578125 | 3 | [] | no_license | angular.module('saan.services')
.service('Util', function($http) {
return {
getRandomNumber: function(top){
return Math.floor((Math.random() * top));
},
getRandomElemFromArray : function(arrayArg) {
if (!arrayArg) {
return null;
}
var index = this.getRandomNumber(... | true |
c5a58fec7f49310cc93bb0b8e694371258ea4afd | JavaScript | hu512175088/myServlet | /web/js/Register.js | UTF-8 | 1,002 | 2.625 | 3 | [] | no_license | $(document).ready(function () {
$("#register_btn").click(function () {
var userName = $("#userName").val();
var password = $("#password").val();
if(userName =="" || userName==null){
$("#userNameSpan").text("用户名不能为空").css({"color":"red"});
return false;
}else i... | true |
a31f7c4ab96ac523d0f1cc48b2644f92a277df72 | JavaScript | thraxil/mithras | /media/js/comments.js | UTF-8 | 3,098 | 3.03125 | 3 | [] | no_license | function commentSubmit() {
var content = document.getElementById('comment-textarea').value;
var name = document.getElementById('comment-name').value;
var email = document.getElementById('comment-email').value;
var url = document.getElementById('comment-url').value;
if (content === '') {
al... | true |
0916047197528d9457800b71543e10ad8784a377 | JavaScript | slunchice/PetPal | /routes/api-routes.js | UTF-8 | 1,741 | 2.921875 | 3 | [] | no_license | // importing `models` folder in order to use Sequelize models for Owner and Pet tables
var db = require("../models")
var keys = require("../keys.js");
var EventBriteAPI = require("node-eventbrite");
var eventBrite = new EventBriteAPI(keys.eventBrite);
module.exports = function (app) {
// Route for posting new owne... | true |
d321e549933f6e20bafd74cdf13476f65f2e1f38 | JavaScript | ExzoTiQQ/guess-the-flag | /src/CountryPick.js | UTF-8 | 519 | 2.6875 | 3 | [] | no_license | import React from 'react';
import shuffle from 'shuffle-array';
import './CountryPick.css';
const CountryPick = ({choices, onClick}) => {
choices = shuffle(choices);
if(choices.length === 4) {
var names = choices.map(country => country.name);
var buttons = names.map(name => (
<butt... | true |
869824e28884246b1197a593907375a3b08da1a1 | JavaScript | Cosen95/design_pattern | /src/pattern/factory.js | UTF-8 | 1,449 | 3.15625 | 3 | [] | no_license | // 工厂模式
class Product {
constructor(name) {
this.name = name
}
init() {
console.log('init')
}
fun1() {
console.log('fun1')
}
fun2() {
console.log('fun2')
}
}
class Creator {
create(name) {
return new Product(name)
}
}
let creator = new Cre... | true |
94532fd4811953def012108c1ad4fb6acd25f849 | JavaScript | nla/sprightly-public | /sprightly-public/public/javascripts/lib/jquery-ajax-form.nla.js | UTF-8 | 4,288 | 2.65625 | 3 | [] | no_license | /*******************************************************************************
*******************************************************************************
*
* AjaxFormHelper
*
* To be used in conjunction with the ajax_form_for helper method.
*
* Converts the standard POST form into an ajax form which will ... | true |
0e3c5bb4cbb81b2aaf9af28293005bebdc389d2a | JavaScript | Kijimai/pokemon-api-react-axios | /src/App.js | UTF-8 | 4,049 | 3.265625 | 3 | [] | no_license | //fetch url from pokemon api
//distribute retrieved data to components
//add an input to display a new list of pokemon based on parameters
//Show only names of pokemon first, but when user clicks on the name
//show the extended info of the specific pokemon that they clicked
//Add buttons to show the pokemon that is nex... | true |
905029a7e632ed5e92e1864898c29d6e81b251e4 | JavaScript | moid-khan/javascript-practice-from-chapter-1-to-67 | /Chapter 31 - 34/Question 14/app.js | UTF-8 | 1,578 | 3.84375 | 4 | [] | no_license | // 14. Write a program to generate your K - Electric bill in your browser.All the amounts should be
// rounded off to 2 decimal places.Display the following fields:
// a.Customer Name
// b.Current Month
// c.Number of units
// d.Charges per unit
// e.Net Amount Payable(within Due Date)
// f.Late Payment Surcharge g.Gro... | true |
77779af7fd0ab2a7e556a1bdbae18c6b8da54791 | JavaScript | Aplatonova/YaWorkshop | /index.js | UTF-8 | 2,617 | 2.96875 | 3 | [] | no_license | const express = require('express');
const app = express();
const fs = require('fs');
const bodyParser = require('body-parser');
app.use(bodyParser.json());
app.use(express.static('public'));
app.get('/', (req, res) => {
res.send(`<!doctype html>
<html>
<head>
<link rel="stylesheet" href="/style.css">
</head... | true |
52d71f07a6ea4328fba9a727a17850a316d7e80a | JavaScript | etvoilajw/etvoilajw.github.io | /spaceguardian/comet.js | UTF-8 | 964 | 3.296875 | 3 | [] | no_license | var comets = {},
cometIndex = 0;
Comet = function(x, y, tier) {
this.x = x;
this.y = y;
if(tier == 1) {
this.r = 5;
this.vx = (((Math.random() * 150) + canvasCenterX - (150/2)) - x) / 200;
this.vy = (((Math.random() * 150) + canvasCenterY - (150/2)) - y) / 200;
}
else if (tier == 2) {
... | true |
5bb033ca02119071568bd268f61421838179ed4c | JavaScript | vinipachecov/code-Challenges | /HackerRank/Staircase/main.js | UTF-8 | 410 | 3.453125 | 3 | [] | no_license |
var A = 6;
var numberOfspaces = A-1;
var numberOfHashes = 1;
var finalString = "";
//number
for(var i = 0; i < A; i++){
finalString = "";
for(var ns = 0; ns < numberOfspaces; ns++){
finalString = finalString + " ";
}
for(var nh = 0; nh < numberOfHashes; nh++){
finalString = finalStrin... | true |
915016bf5bbb46b8d6f1c8f1ad18a04292b5b205 | JavaScript | PierreWeets/javascript-exercices | /01.Series-1/03-colors/01-change-bcg-one/script.js | UTF-8 | 513 | 3.4375 | 3 | [] | no_license |
// 03-colors/01-change-bcg-one/script.js - 3.1: Bcg one (1)
function colorBackground(color){
//alert(`clicked_id = ${color}`);
document.body.style.background = color;
};
/* get ref of all objects button, and for each button , add a 'click' event listener that triggers
the fct that... | true |
49ec0d4e036ea67a8df2cc244109b21d962254bc | JavaScript | yen-shi/2018-fall-ICG-Projects | /src/js/my-webgl-utils.js | UTF-8 | 3,449 | 2.6875 | 3 | [] | no_license | var gl, shaderProgram;
function initGL(canvas) {
try {
gl = canvas.getContext("experimental-webgl");
gl.viewportWidth = canvas.width;
gl.viewportHeight = canvas.height;
} catch (e) {
}
if (!gl) {
alert("Could not initialise WebGL, sorry :-(");
}
if (!gl.getExtens... | true |
7cc6f6749d4b0ec53187f070b33f7dc01e1e6baf | JavaScript | noguntuberu/ceros-skifree | /src/Entities/Rhino.js | UTF-8 | 2,987 | 3.046875 | 3 | [] | no_license | /** */
import * as Constants from "../Constants";
import { Entity } from "./Entity";
import { delay, intersectTwoRects, Rect } from "../Core/Utils";
export class Rhino extends Entity {
assetName = Constants.RHINO;
isPaused = false;
skier = null;
skierIsCaught = false;
speed = Constants.SKIER_STARTI... | true |
944fae5e9093f7038a5ae520279b9784d1b86934 | JavaScript | felipealvss/test-omniproject | /backend/src/controller/devController.js | UTF-8 | 964 | 2.734375 | 3 | [] | no_license | const axios = require('axios')
const Dev = require('../model/dev')
module.exports = {
async store(req, res) {
const { username } = req.body // definindo uma constante contaendo o username obtido na requisição
// Definido uma lógica para ser sefinida quando já houver uma requisição de meso usuario ... | true |
fa1e7b5c467c8fbd0b8de62c1a8f66b0d7e75654 | JavaScript | Daon1109/Baseball_Link | /nightMODE.js | UTF-8 | 456 | 2.734375 | 3 | [] | no_license | function nightDay(self) {
if(self.value==='NightMode') {
document.querySelector('body').style.backgroundColor='black';
document.querySelector('body').style.color='white';
self.value='DayMode';
self.className = 'daymode';
}
else {
document.querySelector('body').style.backgroundColor='wh... | true |
cfee87fe5d55743109da6e54b4246a65cf8b11db | JavaScript | Mateok51/Pay-Share-App | /screens/subscription_screens/PaymentManagamentScreen.js | UTF-8 | 10,415 | 2.640625 | 3 | [] | no_license | import React, { useCallback, useEffect, useReducer, useState } from "react"
import {
Text,
StyleSheet,
ScrollView,
Alert,
View,
Keyboard,
ActivityIndicator,
} from "react-native"
import { useDispatch, useSelector } from "react-redux"
import { Button } from "react-native-paper"
import InputRow from "../..... | true |
07e217726a51e5aa42d6612a216fe8f0069a210d | JavaScript | AlexanderNeishkasha/grokking_algorithms | /chapter_7/graph_with_weight.js | UTF-8 | 979 | 3.109375 | 3 | [] | no_license | const graph = {
book: {
cd: 5,
poster: 0,
},
cd: {
poster: 1,
},
poster: {
drums: 35,
},
drums: {},
};
let costs = {
cd: 5,
poster: 0,
drums: Infinity,
};
let parents = {
cd: 'book',
poster: 'book',
drums: null,
};
let processed = [];
function find_lowest_cost_node(costs) {... | true |
51ea041d72abcc3643003f8affdcc6c67843bf4d | JavaScript | imlhx0926/GraphHopper | /GeoApp/utilities.js | UTF-8 | 3,714 | 2.578125 | 3 | [] | no_license | function loadXMLDoc(dname)
{
if (window.XMLHttpRequest)
{
xhttp=new XMLHttpRequest();
}
else
{
xhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xhttp.open("GET",dname,false);
xhttp.send();
return xhttp.responseXML;
}
function loadConfig(filename){
if (filename==un... | true |
fe39a409e311517c4030a2a951de8e73c1e9d91f | JavaScript | ParkDongJo/software_language | /functional_javascript/coding_test/testdemo/js/test5.js | UTF-8 | 603 | 3.078125 | 3 | [] | no_license | function calcAvgHeight(data) {
// Calculate average height from received data. If no data, return null.
let len = Object.keys(data).length;
let sum = 0;
if (data === undefined || len === 0) return null;
for (let key in data) {
sum += data[key].height;
}
return sum / len;
}
va... | true |
cf36baf5eb52c286ea609442e552a1042044c213 | JavaScript | Fretwells/Equipay | /src/Roles.js | UTF-8 | 5,440 | 2.828125 | 3 | [] | no_license | import {React, useState} from 'react';
import {Link, useParams} from 'react-router-dom';
import {CompanyHeader, Nav, FormButton} from './App';
import amazon_card from "./imgs/amazon_card.jpeg";
import google_card from "./imgs/google_card.jpeg";
import microsoft_card from "./imgs/microsoft_card.jpeg";
import lodash from... | true |
b9d926d698d6db7b83b4d2a78f3f9a3fd94c1371 | JavaScript | zhongyuanyou/shupianwap | /utils/check-types.js | UTF-8 | 2,260 | 3.734375 | 4 | [] | no_license | /* eslint-disable */
/**
* 数据类型检测工具函数
* @author chenmingbing
* @since 2020/11/04
*/
const toString = Object.prototype.toString
const hasOwn = Object.prototype.hasOwnProperty
export const isArray = (arr) => {
return Array.isArray
? Array.isArray(arr)
: toString.call(arr) === '[object Array]'
}
export co... | true |
5e44b8b214b86e9c8e5a8205ce8f4fb54bfc41be | JavaScript | dineshkummarc/tiddlywiki-svn-mirror | /contributors/PaulDowney/plugins/YYYYMMDDHHMMSSMMMPlugin/testYYYYMMDDHHMMSSMMMPlugin.jsspec.js | UTF-8 | 4,598 | 2.65625 | 3 | [] | no_license | // <![CDATA[
function __main() {
store = new TiddlyWiki();
loadShadowTiddlers();
store.loadFromDiv("storeArea","store",true);
loadPlugins();
}
describe('Date.convertFromYYYYMMDDHHMMSSMMM', {
before_each : function() {
__main();
},
'should parse define a function' : function() {
... | true |
021bc41fb911702efc36712b44bb0661b61c6130 | JavaScript | ZepseWolf/node-app-chat | /server/utils/person.js | UTF-8 | 634 | 3.203125 | 3 | [] | no_license |
class Person {
constructor(){
this.user = [];
}
addUser(id, name, room){
var user = {id,name, room};
this.user.push(user);
return user;
}
getUser(id){
return this.user.filter((user) => user.id === id)[0];
}
removeUser(id){
var user = this.getUser(id);
if(user){
this.u... | true |
0c1e89ec39e846dc900f073ab88dd54469ccda5f | JavaScript | teghsingh123/project36 | /sketch.js | UTF-8 | 2,155 | 3.40625 | 3 | [] | no_license | //Create variables here
var dog,dogIm, HappyDog,database,foodS,foodStock,feed,addFood,fedTime,lastFed,foodObj;
var gameState,changingGameState,readingGameState,currentTime;
var bedroom,garden,washroom;
var sadDog;
function preload()
{
//load images here
dogIm = loadImage("images/dogImg.png");
HappyDog = loadImage... | true |
90483f30e59ab5a5cf818901459ab55342acb56e | JavaScript | educa77/challenge-laravel | /resources/js/nav_menu.js | UTF-8 | 474 | 2.796875 | 3 | [
"MIT"
] | permissive | var btnOpen = document.querySelector(".btn-menu");
var btnClose = document.querySelector(".btn-menu-close");
var menuList = document.querySelector(".menu");
btnOpen.onclick = function() {
activateShow();
};
btnClose.onclick = function(e) {
e.preventDefault();
menuList.className = "menu";
};
function acti... | true |
adf396334c7a581b3defe45ecc234d7f80cd66bf | JavaScript | surya1701/MiniScreen-Extension | /assets/link.js | UTF-8 | 2,574 | 2.625 | 3 | [] | no_license | function is_url(str) {
regexp = /^(?:(?:https?|ftp):\/\/)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-... | true |
07612e49a60202a93628a7cfeb350293d87632f5 | JavaScript | iAshokGV/simpleCalcApp | /src/App.js | UTF-8 | 4,194 | 2.734375 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import './App.css';
import axios from 'axios';
import {
Container,
Grid,
NativeSelect,
FormControl,
Input
} from "@material-ui/core";
import Button from "@material-ui/core/Button";
import TableList from "../src/Components/Table";
function App() {
const r... | true |
b0c8a9ab74d4f3a735695ecefff7cb4a26b9075b | JavaScript | ajannat/js-daily | /javascript/vlc.js | UTF-8 | 315 | 3.453125 | 3 | [] | no_license | if(true){
var varVariable = "var";
}
console.log(varVariable);
let a = 23;
if(true){
let letVariable = "var";
}
console.log(letVariable);//cannot access letVariable here because it is a blocked scoped variable
const pi = 3.1416;
pi = 3.1314;//cannot do that cause const variable can be assigned only once
| true |
36d81dec70f95fe713900ecf4e149b941faa5f7f | JavaScript | Kartik-Mathur/NagarroWebTraining | /Lecture-2/callbacks.js | UTF-8 | 908 | 3.203125 | 3 | [] | no_license | function download(url,downloaded){
console.log(`Download started at ${url}`)
setTimeout(function(){
let file = url.split('/').pop()
downloaded(file)
},2000)
}
function compressFile(file,compressed){
console.log("Compression started of",file)
setTimeout(function(){
let minfil... | true |
5852035629a6af1928e7dded68e9f4cf70235925 | JavaScript | lyntonbr9/js-dev | /design-patterns/revealing-module.js | UTF-8 | 387 | 2.90625 | 3 | [
"MIT"
] | permissive | var myRevealingModule = (function () {
var name = 'John Smith';
var age = 40;
function updatePerson() {
name = 'John Smith Updated';
}
function setPerson() {
name = 'John Smith Set';
}
function getPerson() {
return name;
}
return {
set: setPerson,
... | true |
d53ea29f6efa25a768a0baec1f7be1f29bd8b5f5 | JavaScript | jimiyang/react-demo | /src/store/reduces/index.js | UTF-8 | 1,112 | 2.8125 | 3 | [] | no_license | import { combineReducers } from 'redux';
const EDIT_TODO = 'EDIT_TODO';
const ADD_TODO = 'ADD_TODO';
const ROUTER_TODO = 'ROUTER_TODO';
//如果action申明了要做什么,那么具体区改变(更新)state,就是reducer做的事情了,
//这样理解吧,action约定了一个type,然后reducer遇到这个type,就去做一件事
//type是这个指令的唯一标识
const initialState = {
count: 0,
arr: [],
routerType: '... | true |
93cea779004a0f7227d26e6107eabc1bc523866c | JavaScript | Swarantej/javascriptPractice | /AdvanceJS/Object.js | UTF-8 | 828 | 4.3125 | 4 | [] | no_license |
var objPrototype = {
calculateAge: function() {
console.log(2020 - yearOfBirth);
}
};
var myDetails = Object.create(objPrototype);
myDetails.name = 'Swaran';
myDetails.yearOfBirth = 1993;
myDetails.city= 'Hyd';
myDetails.calculateAge;
/*
* Objects and Primitives
*/
var a = 20;
var b =a;
a= 50;
cons... | true |
8b2df79aa995f57e2f70758ed06c257dc97f5e4a | JavaScript | sofyloafy/review3 | /src/megaSoftWeird.js | UTF-8 | 471 | 2.9375 | 3 | [] | no_license | class megaSoftWeird {
spellChecker(string) {
let wordBank = ["Hello", "World", "there"]
let splitSentence = string.split(" ")
let updatedString = []
for(var i = 0; i < splitSentence.length; i++){
if (wordBank.includes(splitSentence[i])){
updatedString.push(splitSentence[i])
}
... | true |
fdd1eb2ce19949f96d25aba05543bcc61516d374 | JavaScript | gusvalenzuela/crew-management-service-app | /develop/db/Questions.js | UTF-8 | 10,332 | 2.6875 | 3 | [] | no_license | module.exports = {
activeWord: activeWord = ``,
results: results = [],
// module
forAddingRecord: [
{
name: `table`,
type: `list`,
message: `What would you like to add?`,
choices: [`New Employee`, `New Department`, `New Role`, `<< GO BACK`]
... | true |
4e9e1037bc00fdab18feff0c63a51b820e2faabe | JavaScript | khu-md/Wikistack | /index.js | UTF-8 | 1,402 | 2.984375 | 3 | [] | no_license | // Set up our express app
const express = require('express');
const app = express();
const PORT = 1234;
// Require some middleware and routes
const morgan = require('morgan');
const path = require('path');
const wikiRoutes = require('./routes/wiki');
const userRoutes = require('./routes/users');
// Require some views... | true |
b9e1fe1e6073db6e851df4acbe677ed3feeb3161 | JavaScript | LaxOn/MathSocWebsiteRebuild | /tangent/static/tangent/js/membercount.js | UTF-8 | 661 | 2.859375 | 3 | [] | no_license | buttonLoading = false;
function loadSocMemberCount() {
if (!buttonLoading) {
buttonLoading = true;
button = document.getElementById("socCountButton")
button.innerHTML = "Loading";
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status ==... | true |
2da07204b89e307f8a212be5690d8f4d581728a9 | JavaScript | Akash-Mech/RockPaperScissor | /main.js | UTF-8 | 2,885 | 3.15625 | 3 | [] | no_license |
const scoreValue = document.getElementById('value');
let paper = document.getElementById('paper');
let scissors = document.getElementById('scissor');
let rock = document.getElementById('rock');
const resultContainer = document.querySelector('.result-container');
const resetBtn = document.getElementById('play... | true |
2ec237916a690fdfa3527f55f7537c4d9602614f | JavaScript | mtyiu/csci4140-spring16 | /tutorials/8/example_code/ex10-time-server.js | UTF-8 | 477 | 2.734375 | 3 | [] | no_license | var net = require( 'net' );
var server = net.createServer( function( socket ) {
var date = new Date();
var zerofill = function( val ) {
return ( val <= 9 ? '0' : '' ) + val;
};
socket.end( date.getFullYear() + '-'
+ zerofill( date.getMonth() + 1 ) + '-'
+ zerofill( date.getDate() ) + ' ... | true |
7aa1647d1a53e5984c677d75bc76ce07879fd0fd | JavaScript | mattjared/reactreps | /rep009/src/App.js | UTF-8 | 2,409 | 2.890625 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
var Button = props => <span onClick={props.onClick} className={props.btnColor}>{ props.text }</span>
var ButtonGrow = React.createClass({
getInitialState: function(){
return {
currentBlueClicks: 0,
currentRedClicks: 0
... | true |
1bb06d43639c22f4afffaa9d6d7fd5b9fafea4d4 | JavaScript | allenn159/Web-Development | /Timer Project/timer.js | UTF-8 | 1,073 | 3.4375 | 3 | [] | no_license | const durationInput = document.querySelector("#duration");
const startButton = document.querySelector("#start");
const pauseButton = document.querySelector("#pause");
const circle = document.querySelector("circle");
const restartButton = document.createElement("button");
const restartIcon = document.createElement("ico... | true |
a401fe36d9baecc806f1cf49623d4e3b2552fd92 | JavaScript | minojeyam/CRUD-App-using-Mongoose.js | /routes/api.js | UTF-8 | 1,039 | 2.59375 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
const Student = require('../models/student');
// Get all students details from the db
router.get('/students',function(req,res,next){
Student.find({}).then(function(students){
res.send(students);
}).catch(next);
});
// Ad... | true |
c8d464a189cc9e34fd29fe08ed2d68e8072c3601 | JavaScript | yuniegu3/pokedex | /main.js | UTF-8 | 12,138 | 3.453125 | 3 | [] | no_license |
$( document ).ready(function() {
console.log( "ready!" );
// my blueprint for pokemon
class Pokemon {
constructor(pokname, hpstat, defstat, atkstat, abilities) {
this.obj ={
pokname : pokname,
hpstat : hpstat,
defstat : defstat,
atkstat : atkstat,
abilities : abilities,
}
}
returnData() {return this... | true |
833b52e6ab5dba36446685aa6ddbf644df4f0642 | JavaScript | nikolasrangel/design-patterns-js | /Structural/Flyweight/flyweight.js | UTF-8 | 227 | 2.703125 | 3 | [] | no_license | /**
* Conserves memory by sharing portions of an object between objects.
*
* 1. Flyweight shares data across objects;
* 2. Results in a smaller memory footprint;
* 3. Only useful if there is a large number of objects.
*/ | true |
1878b00ec2ff25ee9ad949d0682848bcbc7a68bd | JavaScript | SakuragiZHX/anu | /test/modules/ReactEmptyComponent-test.jsx | UTF-8 | 3,280 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | import React from "dist/React";
//https://github.com/facebook/react/blob/master/src/isomorphic/children/__tests__/ReactChildren-test.js
var ReactDOM = window.ReactDOM || React;
describe("ReactEmptyComponent", function() {
this.timeout(200000);
it("should not produce child DOM nodes for null and false", funct... | true |
5752917eaee06edca8e24fff29bba9a170edd3a6 | JavaScript | M-Bray/assignments | /text-to-speech/src/App.js | UTF-8 | 984 | 2.984375 | 3 | [] | no_license | import VoiceButton from './VoiceButton'
import React, { Component } from 'react'
export default class App extends Component {
constructor(props) {
super(props)
this.state = {
input: ""
}
this.onChangeHandler = this.onChangeHandler.bind(this)
this.buttonClickHandler = this.buttonC... | true |
b2f805a886f606a570de73a3686e8400320465e8 | JavaScript | hsinwustar/Business | /untitled2/public/javascripts/main.js | UTF-8 | 575 | 2.6875 | 3 | [] | no_license | function main(){
var oli=document.getElementsByTagName('li');
for(var i=0;i<oli.length;i++)
{
console.log("ahhah")
oli[i].index=i;
oli[i].onclick=function (){
if(this.index==0)window.location.href="purchase";
if(this.index==1)window.location.href="sell";
... | true |
d9d6e69a190277be00d9736a07c1a061293008f5 | JavaScript | SakibShahrier/Up-And-Down-Time-Tracking-Using-Nodejs | /lib/workers.js | UTF-8 | 4,713 | 2.828125 | 3 | [] | no_license | /*
*/
//dependencies
const data = require('./data');
const environment = require('../helpers/environments');
const {parseJSON} = require('../helpers/utilities');
const url = require('url');
const http = require('http');
const https = require('https');
const {sendTwilioSms} = require('../helpers/notifications');
// W... | true |
b19504d1d2427299cfb8a134dbaf0f6ddbfaae37 | JavaScript | IsleneGomes/Trybe-Exercises | /Bloco_4/4.2/exercicio_1.js | UTF-8 | 646 | 3.234375 | 3 | [] | no_license | /*let menu = ['Home', 'Serviços', 'Portfólio', 'Links'];
let menuServices = menu.length;
console.log(menuServices);
*/
/*let menu = ['Home', 'Serviços', 'Portfólio', 'Links'];
let indexOfPortfolio = menu.indexOf('Portfólio');
console.log(indexOfPortfolio);*/
/*let menu = ['Home', 'Serviços', 'Portfólio', 'Links'];
... | true |
65556ab89b962781829cf2e003b82a330f79263b | JavaScript | Vikramviki009/Background-Generator | /script.js | UTF-8 | 570 | 3.09375 | 3 | [] | no_license | var css = document.querySelector('h3');
var color1 = document.querySelector("input[name='color1']");
var color2 = document.querySelector("input[name='color2']")
var body = document.querySelector('body');
color1.addEventListener("input", function(e){
body.style.background= "linear-gradient(to bottom,"+color1.value+","... | true |
3602b79b7528c8fedefd11050614ebb293c1d258 | JavaScript | jessynd/nimblenews | /script.js | UTF-8 | 460 | 2.515625 | 3 | [] | no_license | var nn = {};
nn.api_key = "7E776CF1C5DD322E58250545B073106D:5:68907953";
nn.buri = "http://api.nytimes.com/svc/search/v2/articlesearch.json?";
nn.userSearch = $("input.search").val()
nn.getNews = function(){
var userSearch = encodeURI(nn.userSearch)
$.ajax(nn.buri + "fq=" + nn.userSearch + "&api-key=" + nn.api_ke... | true |
f3a3b99e87235e91c2a0c233715516262d8402c8 | JavaScript | amZotti/Javascript-challenges | /pluralizeNames/pluralizeNames.js | UTF-8 | 580 | 3.71875 | 4 | [] | no_license | function likes(names) {
if (names.length == 0)
return "no one likes this";
else if (names.length == 1)
return names[0] + " likes this"l
else if (names.length == 2)
return names[0] + " and " + names[1] + " like this";
else if (names.length == 3)
return names[0] + ", " + names[1] + " and " + names... | true |
877552387ae212a9240d8d5ac05fc3a94ae8abba | JavaScript | stevehong423/CodeSocial | /config/db.js | UTF-8 | 845 | 2.8125 | 3 | [] | no_license | //CONNECTION TO DATABASE FILE
//require in mongoose and config (to access mongoURI)
const mongoose = require('mongoose');
const config = require('config');
const db = config.get('mongoURI'); //<--using config.get() allows us access to any value from default.json()
//connect with mongoDB. this returns a promise (use ... | true |
40b3cfc844f5c5ffa37d42a39a286a632ad9c15f | JavaScript | abdulhannanali/js-design-patterns | /what-is-pattern/car-class.js | UTF-8 | 317 | 3.765625 | 4 | [
"LicenseRef-scancode-unknown-license-reference",
"Unlicense"
] | permissive | // JavaScript is a class-less programming language
// but classes can be simulated in JavaScript
function Car (model) {
this.model = model
this.color = "silver"
this.year = 2012
this.getInfo = function () {
return this.model + " " + this.year
}
}
var myCar = new Car("Ferrari")
console.log(myCar.getInfo()) | true |
5bf3c6056b2277476562800cc26fbce6ca8238b6 | JavaScript | norandiaconu/Cleanify | /Cleanify.js | WINDOWS-1252 | 3,473 | 2.546875 | 3 | [] | no_license | // ==UserScript==
// @name Cleanify
// @version 1.9
// @description Clean Spotify artists page with over 50 artists(Chrome/Firefox).
// @author Noran D
// @match https://open.spotify.com/collection/artists
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
// ==... | true |
da0d4e0a133e8b7d7b2bd8a55a28a360618d64db | JavaScript | Frazer/lowLevelJSColorBlender | /source/slider.js | UTF-8 | 990 | 2.796875 | 3 | [] | no_license | // modified from https://codepen.io/leemark/pen/lpEHr
imageController.r = document.querySelector('#r');
imageController.g = document.querySelector('#g');
imageController.b = document.querySelector('#b');
var body = document.body,
r_out = document.querySelector('#r_out'),
g_out = document.querySelector('#... | true |
db73c23692794bed77e8c6254e8ce102615c9648 | JavaScript | azavada/weather | /parse.js | UTF-8 | 1,348 | 2.9375 | 3 | [] | no_license | var fs = require('fs');
function parseFile(fileName) {
fs.readFile(fileName, "utf8", function (err, data) {
if (err) {
console.log(err)
} else {
process(fileName, data, "avg");
process(fileName, data, "min");
}
});
}
function process(inputFilename, d... | true |
1c0d5ae2f675162b1c6cbff7d4b54c3558503c56 | JavaScript | SOI-Unipr/javascript-lesson-snippets | /js/this-beast.js | UTF-8 | 809 | 4.21875 | 4 | [
"MIT"
] | permissive | // try these commands in a console (node or browser)
function printMe() { console.log('this.x is ' + this.x); }
const ctx = { x: 10 };
// we can run printMe as if it was a method of `ctx`
printMe.apply(ctx); //> this.x is 10
Reflect.apply(printMe, ctx, []); //> this.x is 10
// we can make printMe a method of `ctx` ... | true |
aee2f941472e722bfc856465cac9cf4e6f488ef4 | JavaScript | wlkodlak/FreediveCompWeb | /src/api/GenerateUuid.js | UTF-8 | 388 | 2.703125 | 3 | [] | no_license | function GenerateUuid() {
const randomHex = () => Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
const randomUuid =
randomHex() + randomHex() + "-" +
randomHex() + "-" +
"4" + randomHex().substring(1) + "-" +
"a" + randomHex().substring(1) + "-" +
randomHex() + randomHex() ... | true |
62965f883230f65550370d08d28adab07357e2bf | JavaScript | m4nu56/my-personal-budget | /src/budget/form/BudgetForm.js | UTF-8 | 5,578 | 2.578125 | 3 | [] | no_license | // @flow
import React from 'react';
import {Button} from 'react-bootstrap';
import InputCategorie from './InputCategorie';
import moment from 'moment';
import CONSTANTS from '../../Constants';
import {makeFetch} from '../../api';
type PropsBudgetForm = {
onSubmit: Function,
onSaveMouvement: Function,
onHi... | true |
5bfe106943b15327192405d93ec6b65c96d1fde5 | JavaScript | Comara17/node-FlashCard | /clozeCard.js | UTF-8 | 462 | 2.96875 | 3 | [] | no_license | module.exports = ClozeCard;
function ClozeCard (fullText, deletion) {
this.fullText = fullText;
this.deletion = deletion;
this.partialText = "";
this.clozeDeletion = function() {
var textArray = this.fullText.split(" ");
for (var i = 0; i < textArray.length; i++){
if (this.deletion === textArra... | true |
5cc0ae11ea2a14b88c3770fa2d8e7674d84d94c7 | JavaScript | knakamura13/Javascript-Coding-Challenges | /Practice Problems/project_euler/054-poker-hands.js | UTF-8 | 11,778 | 3.5 | 4 | [] | no_license | // TODO: Find the bug that causes player1 to win ~15% more often than expected.
let fs = require("fs");
const NumericValue = {
/* Bubble sort. */
sort: function(cards) {
let len = cards.length;
for (let i = 0; i < len; i++) {
for (let j = 0; j < len; j++) {
let currValue = NumericValue[cards[j].split(""... | true |
36eac895ae119c6b6067224dbd2c071bb6c36ad5 | JavaScript | rafmesal/bpmn-js-examples | /overlays/app/app.js | UTF-8 | 1,880 | 2.703125 | 3 | [
"MIT"
] | permissive | 'use strict';
// we use fs + brfs to inline an example XML document.
// exclude fs in package.json#browser + use the brfs transform
// to generate a clean browserified bundle
var fs = require('fs');
// inlined in result file via brfs
var qrDiagram = fs.readFileSync(__dirname + '/../resources/qr-code.bpmn', 'utf-8');
... | true |
ec153d5a9c1978341532ea25d8846cc65c0b84b1 | JavaScript | pohsiangchen/slot-game | /src/js/utils.js | UTF-8 | 1,217 | 2.84375 | 3 | [] | no_license | export function getSizeToFillScreen(content, screen) {
if ((screen.width / screen.height) > (content.width / content.height)) {
return {
width: screen.width,
height: content.height * (screen.width / content.width)
};
} else {
return {
width: content.width * (screen.height / content.hei... | true |
a7ff529a94b602aba9a82b36928ee2a7eae8b351 | JavaScript | nateman1989/foxxy-coffee | /layout/scripts/catalog.js | UTF-8 | 805 | 2.65625 | 3 | [] | no_license | var xhr = new XMLHttpRequest();
xhr.onload = function () {
if (xhr.status === 200) {
responseObject = JSON.parse(xhr.responseText);
var newContent = '';
for (var i = 0; i < responseObject.catalog.length; i++) {
newContent += '<div class="cat_item">';
newContent += '... | true |
a9a4a758c39f07bdb28a1312c36175c8df1bbc7c | JavaScript | wangxiaoxing/toOffer-JS | /防止递归栈溢出错误.js | UTF-8 | 902 | 3.859375 | 4 | [] | no_license | //阶乘尾递归优化
function factorial(n) {
if (n === 1) return 1;
return n * factorial(n - 1);
}
function factorial2(n, total) {
if (n == 1) return total;
return factorial2(n - 1, total * n);
}
//利用函数默认值优化
function factorial3(n, total = 1) {
if (n == 1) return total;
return factorial3(n - 1, total * n)... | true |
28fee3e9ec71274c1d47a56865a0f539bf70f7fc | JavaScript | subsidel/do-whiel | /index-test.js | UTF-8 | 695 | 3.046875 | 3 | [
"MIT"
] | permissive | const doWhiel = require('./')
const chai = require('chai')
const expect = chai.expect
describe('when we do not give the right arguments', function() {
it('complains about them', function () {
expect(() => doWhiel('not a function', true)).to.throw(TypeError, 'd0 is no function!, D0 MUST BE A FUNCTION')
expect... | true |
1f2c18cda1414aab201f0e5f4ee725dad4d27463 | JavaScript | FurrGotten/DonutsDemo | /src/states/helpers.js | UTF-8 | 4,165 | 3.03125 | 3 | [
"MIT"
] | permissive | export const FIELD_COLUMNS = 10;
export const FIELD_ROWS = 8;
function removeDuplicates(donuts, donutTypes, row, column) {
let filtered = [...donutTypes];
// Don't repeat donuts indexes horizontally more than two times
if (column > 1) {
const prevKey = donuts[donuts.length - 1].key;
const p... | true |
98ee099cdbf61c307f35af61b34d1df6bd5cd6fc | JavaScript | craig-weston/Twitter-Interface-Node-JS | /app.js | UTF-8 | 4,394 | 2.625 | 3 | [] | no_license | 'use strict';
// Import statements
const express = require('express');
const bodyParser = require('body-parser');
const async = require('async');
const Twit = require('twit');
const config = require('./config.js');
const app = express();
const twitter = new Twit(config);
// serve the static files
app.use(
'/stati... | true |
65a862902761be42978ff0418af80a47bfb31ec4 | JavaScript | IsYtotheL/javascript_fullstack | /hanjia/know/85.js | UTF-8 | 225 | 2.921875 | 3 | [] | no_license | function foo() {
console.log(this.a);
}
var obj = {
a: 2,
foo: foo
};
obj.foo()
function foo1() {
console.log(this.a1);
}
var obj2 = {
a1: 42,
foo1:foo1
};
var obj1 = {
a1: 2,
obj2: obj2
};
obj1.obj2.foo1(); | true |
716ff56404aa84c91a5064bffbcaafe1aab78d19 | JavaScript | Guz1992/Game-Order | /www/js/data-base/delete.js | UTF-8 | 3,229 | 2.875 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | function onDelete(){
var id = document.itemForm.id.value;
var query = "delete from player where id=?;";
try {
localDB.transaction(function(transaction){
transaction.executeSql(query, [id], function(transaction, results){
if (!results.rowsAffected) {
... | true |
12ea48b9cf7af21b1a433fb3949acf4c8cedb3b7 | JavaScript | jamesformica/wordly | /src/reducer.js | UTF-8 | 547 | 2.65625 | 3 | [] | no_license | export const DEFAULT_STATE = {
isEditing: true,
title: '',
narative: '',
shape: 'circle',
}
const reducer = (state, action) => {
switch (action.type) {
case 'TITLE_UPDATE':
return { ...state, title: action.title }
case 'NARATIVE_UPDATE':
return { ...state, narative: action.narative }
... | true |
f39a53cc86996d40c0a568730a9707870c5e970d | JavaScript | sabeerzaman/jsblogtutorial | /specs/View-Blogpost.spec.js | UTF-8 | 6,880 | 2.75 | 3 | [] | no_license | describe( '(Blog)Post View (for src/views/post.js)', function() {
it( 'is defined', function() {
expect( Blog.Views.Post ).toBeDefined();
});
it( 'should be a Backbone View', function() {
expect( Blog.Views.Post.constructor ).toEqual( Backbone.View.constructor );
});
it( 'should throw an error if initialized... | true |
cd8fabf0f32cdb8e8dc0147312cd49482accb9c3 | JavaScript | MaxDaniLOVE/DIMS.UI-5 | /src/tests/sortFromOldToNew.test.js | UTF-8 | 784 | 2.75 | 3 | [] | no_license | import sortFromOldToNew from '../utils/sortFromOldToNew';
describe('Sorting array:', () => {
it('should return sort for given array from old trackDate to new', () => {
const givenArray = [
{
trackDate: 1588032000000,
userName: 'Tester',
},
{
trackDate: 0,
userNam... | true |
d28e3b3e2aa42e74e5ad140eb94082fb573f124f | JavaScript | cogerk/Bioreactor_Interface | /templates/test.js | UTF-8 | 654 | 2.875 | 3 | [] | no_license | $(document).ready(function(){
$("#signal").on('change', function() {
// This function gets current slopes/ints of a signal and returns it to form when a new signal is selected
// Current values are sent from server on page load as {#slopes#} & {#ints#}
// This converts that dictionary of current... | true |
c815e1db72d4847ec2478d4162108511c1a9b310 | JavaScript | NwekeChidi/Coursera_Software_Engineering_Specialization | /Course_1/loops_and_conditional_statements.js | UTF-8 | 6,144 | 4 | 4 | [] | no_license | // This code is written using the IDE developed by https://www.dukelearntoprogram.com//course1/example/index.php
// Practicing For Loops
// To create a new image with all black pixels
var newImg = new SimpleImage( 200, 200 );
print( newImg );
// Writing a For Loop to change the pixels of the image to yellow
// yel... | true |
fb194cb6b0cd8eef303a82fd3766c72ba84a3a69 | JavaScript | subramanyam-Reddy/Angular1Demo | /src/controllers/child/childCtrl.js | UTF-8 | 8,763 | 3.390625 | 3 | [] | no_license | (function() {
'use strict';
angular
.module('myApp')
.controller('childController', childController);
function childController($scope, $rootScope, $location, $window) {
$scope.childName = "Hi childCtrl";
$scope.myUrl = $location.absUrl();
$scope.arrayName = 'red';
$scope.yourVar = 42;
$... | true |
dd24b649eafae490552fdc69abbee32d9dafa1c2 | JavaScript | ancientwind/es6-prac | /test/data_structure/linked_list.spec.js | UTF-8 | 619 | 2.796875 | 3 | [] | no_license | /**
* Created by 212331901 on 2017/11/6.
*/
import LinkedList from '../../src/data_structure/linked_list'
import chai from 'chai'
const expect = chai.expect
describe( ' Double linked list functionality' , () => {
let myLL = new LinkedList()
it ( ' should add a new Node to the end of the linked_list', () =>... | true |
ca1830b03e90ac80845f509851c72d4acaa994af | JavaScript | LovishPrajapati/assignment-ekaleido | /src/App.js | UTF-8 | 1,629 | 2.578125 | 3 | [] | no_license | import React, { useState } from "react";
import "react-responsive-carousel/lib/styles/carousel.min.css";
import { Carousel } from "react-responsive-carousel";
import data from "./data.json";
function App() {
const [currentQue, setCurrentQue] = useState(0);
const submitHandler = (e, que) => {
e.preventDefault(... | true |
18963bb05fe83f2aafb96f3f9425cc6a2204beb9 | JavaScript | ferlycreator/archive-mt.js | /test/geometry/PolylineSpec.js | UTF-8 | 3,548 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | describe('PolylineSpec', function() {
var container;
var map;
var tile;
var center = new Z.Coordinate(118.846825, 32.046534);
var layer;
var canvasContainer;
beforeEach(function() {
var setups = commonSetupMap(center);
container = setups.container;
map = setups.map;... | true |
081928bdc028db779c257896bc25ae7ff6843d0f | JavaScript | onshimiye/wejapa_assignments | /v1/hashDate.js | UTF-8 | 544 | 4.03125 | 4 | [] | no_license | /*
The Javascript date object returns a new Date like this(2020-08-04T13:34:42.351Z) using the constructor new Date(),
return the day:day, month:month and year:year as key value pairs in a hash.
*/
function hashDate() {
let date = new Date();
let obj = {
day: date.getDay(),
month: date.getMo... | true |
f1d0749d2d21ed12725f27b4fde076fe3339d479 | JavaScript | margauxcleo/P3BikinToulouse | /js/timer.js | UTF-8 | 2,929 | 2.6875 | 3 | [] | no_license | class Timer {
constructor() {
this.timerBlock = $('#timer');
this.timeOut = $('#timeOut');
this.infoResaOn = $('#infosResaOn');
this.cancelledResaMsg = $('#cancelledResaMsg');
}
setTimer() {
this.finishTime = new Date().getTime() + 1200000; //1200000 20 minutes !!!!!! p... | true |
d82855c096f538a623b6af38d3b8f480ed00a0b1 | JavaScript | DaoFof/mySignInUpNode | /server/middleware/authenticate.js | UTF-8 | 1,018 | 2.59375 | 3 | [] | no_license | var {User} = require('./../models/user');
const Cookies = require('cookies');
var authenticate = (req, res, next) =>{
//var token = req.header('x-auth');
/*
req.header() is getting the value so we only pass the key
*/
var cookies = new Cookies(req, res);
var token = cookies.get('token');
//console.log('... | true |
601b09ce69e649b7f9d4c50d69ae005faf9efc06 | JavaScript | PatrickGitundu/tax_lookup | /tax_lookup/test/test.js | UTF-8 | 1,396 | 2.65625 | 3 | [] | no_license | process.env.NODE_ENV = 'test';
//Require the dev-dependencies
let request = require('supertest');
/*
* Start our tests
*/
describe('Loading our Express Server', function () {
// Load our server
let server;
before(function () {
server = require('../app');
});
// Test that our home page renders.
it... | true |
c50dc223dca389dbc83bcbed10511aeda9be740a | JavaScript | danZzyy/bmore-data | /bmore_springmvc/bmore/src/main/webapp/resources/scripts/locscript.js | UTF-8 | 6,102 | 2.703125 | 3 | [] | no_license | var geocoder;
var map;
var currentPt = null;
var currentLoc = {id:null, name:'', address:'', lat:null, lng:null, accessibility:''};
var bikepaths = [];
// intialize map after html loads
function init(){
geocoder = new google.maps.Geocoder(... | true |
6b281f737d581e3434847eb287246b3407fdabf3 | JavaScript | huang6349/react-dva | /src/utils/request.js | UTF-8 | 1,315 | 2.71875 | 3 | [
"MIT"
] | permissive | import { message } from 'antd';
import fetch from 'dva/fetch';
/**
* Requests a URL, returning a promise.
*
* @param {string} url The URL we want to request
* @param {object} [options] The options we want to pass to "fetch"
* @return {object} An object containing either "data" or "err"
*/
expor... | true |
610861c889904cb1365c109210040ea3c5f49961 | JavaScript | niklasbuechner/slack-api-presentation | /code/actions/githubLabels.js | UTF-8 | 3,621 | 2.546875 | 3 | [] | no_license | const process = require('process');
const axios = require('axios');
const github = require('../services/github');
let labels = [];
async function slackMessage(labelTitle, labelMessage, number, message) {
if (labels.length < 1) {
labels = await github.getAvailableLabels(process.env.GITHUB_REPOSITORY);
... | true |
5f372b9d24b5b7b299ac57d6ca4829eb3531567a | JavaScript | los4673/NYTSearch | /client/src/pages/Home/Home.js | UTF-8 | 4,856 | 2.796875 | 3 | [] | no_license | import React, { Component } from "react";
import Jumbotron from "../../components/Jumbotron";
import API from "../../utils/API";
import { Link } from "react-router-dom";
import { Col, Row, Container } from "../../components/Grid";
import { List, ListItem } from "../../components/List";
import { Input, FormBtn } from ".... | true |
688e0e03be23a283dd87ef47070b5b92fe1099e5 | JavaScript | riyad1992/weather-map | /js/script.js | UTF-8 | 1,380 | 3.328125 | 3 | [] | no_license | document.getElementById('button-input').addEventListener('click', function(){
const searchValue = document.getElementById('input-field');
const searchText = searchValue.value ;
const url = `https://api.openweathermap.org/data/2.5/find?q=${searchText}&units=metric&appid=cc859b38975d313bab0f2544cd15a6a6`
... | true |
21cf050f4cb860fd0b23a1223ff5d997561bbdb6 | JavaScript | shaungt1/next-wordpress-starter | /src/lib/pages.js | UTF-8 | 2,963 | 2.71875 | 3 | [
"MIT"
] | permissive | import { getApolloClient } from 'lib/apollo-client';
import { QUERY_ALL_PAGES, getQueryPageById, getQueryPageByUri } from 'data/pages';
/**
* pagePathBySlug
*/
export function pagePathBySlug(slug) {
return `/${slug}`;
}
/**
* getPageById
*/
export async function getPageById(id) {
const apolloClient = getAp... | true |
87bc9222c662b35e3cc4a7343ddb6e8437b1d93e | JavaScript | yuriy-yarvinen/basic_chat_laravel_app_with_pusher | /resources/js/shared/utils/functions.js | UTF-8 | 321 | 2.984375 | 3 | [] | no_license | export const checkFunction = (functionName) => {
if (typeof functionName == 'function' || typeof functionName == 'object') {
return true;
} else {
return false;
}
}
export const addCssToDocument = (css) =>{
var style = document.createElement('style')
style.innerText = css
document.head.appendChild(style)
... | true |
ced9f7bea7c2eee65fdd7d348b20ebb285623c87 | JavaScript | saogat/uhired | /server/controllers/jobsController.js | UTF-8 | 4,846 | 2.671875 | 3 | [] | no_license | // Our scraping tools
// Axios is a promised-based http library, similar to jQuery's Ajax method
// It works on the client and on the server
const axios = require("axios");
const cheerio = require("cheerio");
// Require all models
const db = require("../models"); // Routes
module.exports = {
// A GET route for scra... | true |
b4639bde070612b74cb1fa4300dac963c7dbba0f | JavaScript | MrFoxxz/Ecommerce7wines | /client/src/components/Usuarios/logout.js | UTF-8 | 1,607 | 2.703125 | 3 | [] | no_license | import axios from 'axios';
export default function handleSumitSalir(e){
e.preventDefault();
let productos;
if(!localStorage.getItem('productos')){
productos = [];
}else {
productos = JSON.parse(localStorage.getItem('productos'));
}
let cantidad;
if(!localStorage.getI... | true |
d396471402a7d103379a02fd44d08ce8e8305357 | JavaScript | Coder-IsiahJones/Launch-Countdown-Timer | /counter.js | UTF-8 | 1,484 | 3.8125 | 4 | [] | no_license | // Variables
const daysInterval = document.getElementById("days");
const hoursInterval = document.getElementById("hours");
const minutesInterval = document.getElementById("minutes");
const secondsInterval = document.getElementById("seconds");
//Use Day.js to get date and add one month
const nextMonth = (dayjs()... | true |
392185cea677f9bde4572b9e58890acb6ce43474 | JavaScript | Grace-Rasaily780/rasailygrace.github.io | /views/relativechords/relative.js | UTF-8 | 9,676 | 2.65625 | 3 | [] | no_license |
var C = document.getElementById('C');
var Cs = document.getElementById('C#');
var D = document.getElementById('D');
var Ds = document.getElementById('D#');
var E = document.getElementById('E');
var F = document.getElementById('F');
var Fs = document.getElementById('F#');
var G = document.getElementById('G');
var Gs = ... | true |
a7b99b716a9776507766522283f806421250116f | JavaScript | EricaReis/bootcamp-gostack | /backend/src/index.js | UTF-8 | 682 | 2.5625 | 3 | [] | no_license | const express = require('express');
const app = express();
app.get('/projects', (request, response) => {
return response.json([
'Projeto1',
'Projeto2',
]);
});
app.post('/projects', (request, response) =>{
return response.json([
'Projeto1',
'Projeto2',
'Projeto3',
... | true |
e58dc6de7dda487a9ee45d72e8f5912544ae3136 | JavaScript | andres-martin/holbertonschool-web_back_end | /0x0E-ES6_basic/10-loops.js | UTF-8 | 227 | 3.140625 | 3 | [] | no_license | export default function appendToEachArrayValue(array, appendString) {
const array2 = array;
for (const value of array) {
const idx = array.indexOf(value);
array2[idx] = appendString + value;
}
return array2;
}
| true |
b8e0ebacc83262a43920de70b311bea7813a1c51 | JavaScript | shuhei/ml | /vector.js | UTF-8 | 1,186 | 3.171875 | 3 | [] | no_license | 'use strict';
function make(length, initialValue) {
var result = new Array(length);
var i;
if (initialValue === undefined) {
initialValue = 0;
}
for (i = 0; i < length; i++) {
result[i] = initialValue;
}
return result;
}
function copy(from, to) {
if (from.length !== to.length) {
throw new ... | true |