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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
b3b01eb12221c819adadf244976b171c934ab6e0 | JavaScript | pacificclimate/weather-anomaly-tool | /src/components/utils.js | UTF-8 | 393 | 2.640625 | 3 | [] | no_license | import _ from 'lodash';
export function bindFunctions(obj, functionNames) {
if (typeof functionNames === 'string') {
functionNames = functionNames.split(/\s+/);
}
functionNames.forEach((name) => {
obj[name] = obj[name].bind(obj);
});
}
export function pick(obj, names) {
if (typeof names === 'strin... | true |
13904c90423715a98b1c88f5d8ecbaff83b821b9 | JavaScript | hilltopmediadesign/wordpress-linkedThemeTemplate | /js/equalize.js | UTF-8 | 469 | 2.796875 | 3 | [] | no_license |
//Equalizing any three css elements by tallest height
function equalHeight(group) {
var tallest = 0;
group.each(function() {
var thisHeight = $(this).height();
if(thisHeight > tallest) {
tallest = thisHeight;
}
});
group.height(tallest);
}
//insert tag... | true |
a3a3b3f1b5a51f07e1a275c4389fb06d9879d9f6 | JavaScript | kiliankoe/nodedraw | /public/javascripts/draw.js | UTF-8 | 891 | 2.8125 | 3 | [] | no_license | tool.maxDistance = 50;
function randomColor() {
return {
red: 0,
green: Math.random(),
blue: Math.random(),
alpha: (Math.random() * 0.25) + 0.05
};
}
function onMouseDrag(event) {
var x = event.middlePoint.x;
var y = event.middlePoint.y;
var radius = event.delta.length / 2;
var color = randomColor();
... | true |
f2b6f3387b93104db1719f0cffa4b9d79ab4a177 | JavaScript | Misterkevin23/initial_project | /jquery/js/td_panier.js | UTF-8 | 816 | 2.8125 | 3 | [] | no_license | function aPayerParArticle(){
var matchFacturations=document.querySelectorAll(".match .element")
console.log(matchFacturations[0]);
for(var i=1; i<matchFacturation.length; i++)
if(matchFacturation[i]=matchFacturation.getElementsByClassName("price")){
var price = facturation.querySelector(".price");
return... | true |
720ed4f82c61a586744a68856a8dc0fa5bc57726 | JavaScript | NataliaYaremko/CRUD2 | /public/javascripts/client.js | UTF-8 | 1,003 | 3.046875 | 3 | [] | no_license | let modal;
let name;
let lastname;
let email;
let age;
let form;
let id;
window.onload = function () {
modal = document.getElementById('myModal');
name = document.getElementById('name');
lastname = document.getElementById('lastname');
email = document.getElementById('email');
age = document.getElementById('a... | true |
9b7a5e7c80f41bb3b60ec4a8403aebc959a79ff2 | JavaScript | minhhieu1/resume | /Asset/JS/bindingdata.js | UTF-8 | 419 | 2.75 | 3 | [
"MIT"
] | permissive | function loadData(request, targetId, sourceId) {
var PATH = "./Asset/Data/"+request+".json"
fetch(PATH)
.then(response => response.json())
.then(json => {
let jsonData = {
data: json
};
let target = $(targetId);
let source = $(sourceId).html();
... | true |
cc35c8651ee96ea83d8e049131ddd0fb94e63039 | JavaScript | MarcoASC4/Marco | /ogre.js | UTF-8 | 1,214 | 3.46875 | 3 | [] | no_license | var hp = 100;
var gold = 0;
var numberDefeated = 0;
function setup() {
$("body").append("<h1> Welcome to Ogre Fighter v1.0</h1>");
$("body").append("<p> Ogres are attacking your village! When you slay one, they drop 10 gold. The more gold you carry, though, the harder it is to defeat an ogre.</p>");
$("body").... | true |
46b1dc15386ebcd79f84113c0edfe456070c9d07 | JavaScript | gmackie/EuIrcBot | /modules/join.js | UTF-8 | 684 | 2.5625 | 3 | [
"MIT"
] | permissive | let bot;
module.exports.name = 'sirc-joinchannel';
module.exports.init = function (b) {
bot = b;
channels = [];
bot.readDataFile('channels.txt', (err, data) => {
if (err) return console.log(err);
data.toString().split('\n').forEach((channel) => {
if (channel.length > 0) {
bot.client.join(c... | true |
f32b6520c7a088e740197d2465b9340c9b8baefc | JavaScript | Steve9hw2/cart253 | /exercises/exercise5/js/ActiveBalls.js | UTF-8 | 260 | 2.984375 | 3 | [] | no_license | class ActiveBalls {
constructor(x,y) {
this.x = x;
this.y = y;
this.value = 0;
this.text = `Active Balls: `;
}
display() {
push();
textSize(25);
fill(255);
text(this.text + this.value, this.x, this.y);
pop();
}
}
| true |
fcf6c5e35ce0b9ab4e5d3f1ee6aa97840a40cf6a | JavaScript | solomonfrank/myApp | /logger.js | UTF-8 | 245 | 2.625 | 3 | [] | no_license |
const EventEmitter = require('events')
class Logger extends EventEmitter{
log( message) {
console.log('hello ' + message);
this.emit('Me', {id : 1, name: 'solomon'});
}
}
module.exports = Logger | true |
2c47345933864febdb04c2f43cfa29119b23c6b2 | JavaScript | CodeWritingCow/bad-movies-mock-ta | /db/mongodb/index.js | UTF-8 | 1,006 | 2.65625 | 3 | [
"MIT"
] | permissive | //
const mongoose = require('mongoose');
if(process.env.MONGODB_URI){
mongoose.connect(process.env.MONGODB_URI)
} else{
mongoose.connect('mongodb://localhost:27017/badmovies', { useNewUrlParser: true });
}
const db = mongoose.connection;
mongoose.Promise = Promise;
db.on('error', console.error.bind(console, 'Co... | true |
12d10a4a8ac1e0230b53e727accf38f34889fa76 | JavaScript | lpabinash/Shoplane | /orderconfirmation.js | UTF-8 | 1,490 | 2.875 | 3 | [] | no_license | // var http = new XMLHttpRequest();
// var url = 'https://5d76bf96515d1a0014085cf9.mockapi.io/order/';
// var id=1;
// var d = new Date();
// var params = {
// "id":id,
// "createdAt":d,
// "name":"Abinash",
// "avatar":"http://onepiece-treasurecruise.com/en/wp-content/uploads/c0... | true |
adab4279bc151f7f3d92702100f09411f559676c | JavaScript | hitesh-patil/play-with-node | /Pure-JS/protoTypeInheritance.js | UTF-8 | 449 | 3.21875 | 3 | [] | no_license | function User(name, email) {
this.name = name;
this.email = email;
}
User.prototype.getUsername = function() {
return this.name;
}
const userInstance = new User('Hitesh', 'htp437@gmail.com');
function Admin(...args) {
User.apply(this, args);
}
Admin.prototype = Object.create(User.prototype);
const adminIns... | true |
402f3a7e459fe521f9a3be5a6655d713bfa5e494 | JavaScript | MathResE/chkp | /chkp.js | UTF-8 | 3,297 | 3.21875 | 3 | [] | no_license | let buttonEnter=document.querySelector('.startButton');
let enterNamber=document.querySelector('.inputNumber');
let resaltOut=document.querySelector('.resalt');
function selectInvertorSecondHalf(resalt){
let lengthResalt=resalt.toString().length;
let halfLenght=lengthResalt/2;
let firstHalfResalt=resalt.sli... | true |
a3bcf4cb63de0145b17ddda3dbd594d1c0112e49 | JavaScript | jlp0422/react-practice-1 | /src/Team.js | UTF-8 | 1,314 | 2.609375 | 3 | [] | no_license | /* eslint-disable */
import React from 'react';
import { Link } from 'react-router-dom';
import { Helmet } from 'react-helmet';
import axios from 'axios';
export default class Team extends React.Component {
constructor(props) {
super(props)
this.state = {
team: {},
players: []
}
this.setT... | true |
012019129508756f27576617414e24ccb517f897 | JavaScript | ElenaSei/Software-Technologies | /JavaScript Basics - Exercises/09. Set Values to Indexes in Array.js | UTF-8 | 494 | 3.546875 | 4 | [] | no_license | function solution(input) {
let arr = new Array(Number(input[0]));
//arr = arr.fill(0, 0 , arr.length);
for (let i = 1; i < input.length; i++) {
let index = Number(input[i].split(" - ")[0]);
let value = Number(input[i].split(" - ")[1]);
arr[index] = value;
}
for (let i = 0;... | true |
bfeaacdeb07e384ce9bc38af70fd8b200ab022cd | JavaScript | RDaniil/Virtual-Machine | /machine.js | UTF-8 | 5,316 | 2.828125 | 3 | [] | no_license | Machine = function(){
this.p = new Proc();
this.m = new Memory();
this.numOfRegisters;
}
Machine.prototype.init = function(code)
{
this.numOfRegisters = 6; //При изменении числа регистров не забудь в хтмл заглянуть
this.p.initProc(this.numOfRegisters);
this.m.initMemory(code);
this.refreshRegs();
}
//Don't loo... | true |
d060c22d20c4f1ed9e6114bab8a4518b149d62fa | JavaScript | sambydefault/ReactTraining | /ES2015/restParameters.js | UTF-8 | 147 | 2.890625 | 3 | [] | no_license | function Add(a,b,...c){
console.log(a+b+c.length);
c.forEach(element =>
console.log(element));
}
let result = Add(1,2,2,3,4,45,7); | true |
f7d4edc7b20d9e6f9291ee75a0a832e5fc1619d2 | JavaScript | glingo/DrapeauRouge_1_0 | /js/Jeu/RadialGradient.js | UTF-8 | 547 | 3.109375 | 3 | [] | no_license | function RadialGradient(x, y, width, height){
Item.call(this, x ,y, width, height);
this.grd;
}
extend(RadialGradient, Item);
RadialGradient.prototype.draw = function(){
this.ctx.beginPath();
this.ctx.arc(this.canvas.width / 2, this.canvas.height/3*2, 70, 0, 2 * Math.PI, true);
this.ctx.closePath();
this.ctx.fil... | true |
5402742c8bb5b1f3c1d73237674d678b4fd61451 | JavaScript | MoMoOwO/Koa2Study | /koa框架介绍与搭建及预备知识/01.ES6常用语法.js | UTF-8 | 2,152 | 4.65625 | 5 | [
"MIT"
] | permissive | // let 关键字与 var 关键字类似,用于声明变量
// 不同的是 let 声明的变量是在块作用域中生效,var 生命的变量在全局作用域中生效
let a = 123;
console.log(a);
console.log("-----");
/* if (true) {
let b = 123;
}
console.log(b); // b is not defined */
// const 也是声明块级作用域的变量,
// 但是使用 const 关键字声明的变量是常量,初始化之后不能再做改变
const c = 321;
//c = 123; // 报错
console.log("-----");
... | true |
8a28c08de3e6b8cfca59f32cc65033461050b277 | JavaScript | audunhauge/audunhauge.github.io | /it2/nodeServer/app.js | UTF-8 | 1,086 | 2.578125 | 3 | [] | no_license | // @ts-check
//const CONNECTSTRING = "postgres://shop:123@localhost/shop";
const PORT = 3004;
const express = require("express");
//const pgp = require("pg-promise")();
//const db = pgp(CONNECTSTRING);
const app = express();
const bodyParser = require("body-parser");
//const fs = require("fs");
const kunder = [
{... | true |
1f84595d2fcff15f530fd5babd1984125c3384b2 | JavaScript | rooneyp/JS | /vanilla/TheGoodParts/js/main.js | UTF-8 | 3,327 | 4 | 4 | [] | no_license | //"use strict"
//creates new methods. pg4
Function.prototype.method = function (name, func) {
this.prototype[name] = func;
return this;
};
l = function(msg) {
console.log(msg);
}
//learnStrings();
//learnEquals();
//learnScope();
//l(" is b visible globally: " + globalB);
//l(" is lateDefined visible gl... | true |
dac5e7e644e6060bbf3e760f7cec14d89c220063 | JavaScript | FahmiA/herp-derp | /player.js | UTF-8 | 7,423 | 2.828125 | 3 | [] | no_license | /** Player */
var Player = me.ObjectEntity.extend(
{
init: function(x, y, settings)
{
this.parent(x, y, settings);
this.map = new me.Vector2d(settings.x, settings.y);
this.collidable = true;
this.type = 'player';
this.anchorPoint = new me.Vector2d(this.width/2, this.heig... | true |
6b9878d205853b252203d52b7ea5b475dad5e893 | JavaScript | minhphuoc275/nodejs-sample | /05.function.js | UTF-8 | 426 | 3.890625 | 4 | [] | no_license | // 3 ways to create and call functions
function itotal(a,b){
return a+b;
}
var x = itotal(7,8);
console.log("Total function: " + x);
function sayhello(){
console.log("Hello everyone! This test from callFun fn()");
}
function callFun(fn){
fn();
}
callFun(sayhello);
var callFuntionByVariable = function(){
conso... | true |
e13d9aaef374f289ac75964aa96e65aa0575be0e | JavaScript | bzaino/Code | /EDMS/ASA.Web/Sites/SALT/JSTestFramework/Specs/ruleOf72.js | UTF-8 | 757 | 2.5625 | 3 | [] | no_license | /*global describe, it, chai, sinon */
define([
'Tools/ruleOf72'
], function (ruleOf72) {
var assert = chai.assert;
var expect = chai.expect;
describe('ruleOf72', function () {
it('Calculate years taken to double your money', function () {
var retVal = ruleOf72.global.utils.calcula... | true |
042734c07dd8c812d3311d0d41b32a69cb2a2a7d | JavaScript | 2239682857/YouthHostel | /utils/util.js | UTF-8 | 1,423 | 2.953125 | 3 | [] | no_license | const formatTime = date => {
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()
return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minut... | true |
e437b57e48af5ddbd82183d30e49f58f5ab9e1de | JavaScript | abhaysaxena1904/Microgrid_Blockchain_Project | /test/Exchange.test.js | UTF-8 | 12,667 | 2.53125 | 3 | [] | no_license | const assert = require('assert');
const ganache = require('ganache-cli');
const Web3 = require('web3');
//const web3 = new Web3(ganache.provider());
const web3 = new Web3( new Web3.providers.HttpProvider("http://localhost:8545"))
//const web3 = require('../ethereum/web3-ganache.js');
const compiledFactory = require('... | true |
c6e04747c9b431bc7a4d80f4f26b8d419fcf25ab | JavaScript | shweta24paliwal/Gif-search-app | /src/Components/Gifted/Gifted.js | UTF-8 | 3,862 | 2.640625 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | import React, { Component } from "react";
import GiphyCards from "../GiphyCards/GiphyCards";
import axios from "axios";
import NoResults from "../NoResults/NoResults";
import styles from "./Gifted.module.css";
class Gifted extends Component {
constructor(props) {
super(props);
this.state = {
giphyData:... | true |
8d4f395df5e7113058b4dda3fc0b87f9b92c0a1e | JavaScript | sofiiaAhafonova/Quickstand | /server/public/javascripts/cookie.js | UTF-8 | 195 | 2.65625 | 3 | [] | no_license | const Cookie = name => {
let cookiestr = RegExp('' + name + '[^;]+').exec(document.cookie);
return decodeURIComponent(!!cookiestr ? cookiestr.toString().replace(/^[^=]+./, '') : '');
}; | true |
d513505fc89561a0bd651b9498d5a7c28e16d6b1 | JavaScript | mbalabanov/adam-api | /main.js | UTF-8 | 3,387 | 2.921875 | 3 | [] | no_license | // Define the constants for the express server (needed to serve the API), the body parser (needed to parse the requests) and morgan (updates the server and reloads when code changes).
const express = require( 'express' );
const bp = require( 'body-parser' );
const morgan = require('morgan');
// These are the functions... | true |
a27d7160d6d7ea157ece58f612c70ba0d5b1737a | JavaScript | OfirArviv/OneNoteCNApiSample | /src/OneNoteCNApiSample/wwwroot/scripts/copycontents.js | UTF-8 | 3,706 | 2.6875 | 3 | [
"MIT"
] | permissive | (function() {
var authContext = new AuthenticationContext(config);
var user = authContext.getCachedUser();
var sectionSelectorTitle = '<option value="0">Select section to copy</option>';
// Get copy contents-related UI elements
var $message = $("#copyContentsMessage");
var $sourceSelector = $(... | true |
3e35ab1867dad2423bc54649524a60ca84147bbe | JavaScript | PaulCampbell/Flailr | /public/scripts/flailr.js | UTF-8 | 7,331 | 2.5625 | 3 | [] | no_license | var Flailr = function () {
var flailr = {};
var canvasSource, video, canvasBlended, contextSource, contextBlended, timeOut, lastImageData, container;
flailr.width = 640
flailr.height = 480
flailr.containerId = '';
flailr.hitTargets = [];
flailr.sensitivity = 60;
flailr.showVideo = true;
flailr.show... | true |
2e7900aad4d363dfd7f464b715369202f9240919 | JavaScript | subinvarghesein/TrelloAddons | /script.js | UTF-8 | 4,123 | 2.625 | 3 | [
"MIT"
] | permissive | /*
* TrelloAddons v0.0.2 <https://github.com/subinvarghesein/TrelloAddons>
* Inspired by TrelloWIPLimits <https://github.com/NateHark/TrelloWIPLimits/>
*
* Original Author:
* Subin Varghese <https://github.com/subinvarghesein>
*/
;(function(){
TrelloAddons = {};
TrelloAddons.WIPLimits = function() {
... | true |
fda94e77738a6db35a5f815f7a7ae4de6fb9f321 | JavaScript | daelp/js1-10 | /script.js | UTF-8 | 2,672 | 3.96875 | 4 | [] | no_license | //write first method
function sleepIn(x,y) {
var x = "loht";
}
//write second method
function nextOne(param1, param2) {
return param1;
}
//function runs on click and outputs test cases you create to page
function tester() {
document.getElementById("output").innerHTML += sleepIn(true, false);
document.... | true |
b795a0d2303946d739d296b9adf8725168fff4c1 | JavaScript | Tonewall/Crime-Analytics | /client/src/components/BuildingInformation.js | UTF-8 | 5,637 | 2.546875 | 3 | [] | no_license | import React, { Component } from 'react';
import "./Data.css";
import { MDBDataTable } from 'mdbreact';
import { Redirect } from 'react-router-dom';
class BuildingInformation extends Component {
constructor(props) {
super(props);
this.state = {
buildingNum: null,
zone1: {
... | true |
e7585707357ee06d6153f1159f83b1de664ff1ba | JavaScript | zxc0987612345/2020webfinal | /mindquiz/data.js | UTF-8 | 5,640 | 2.8125 | 3 | [] | no_license | let questions = [
{
"question":"面試的時候,問你的性格是內向還是外向,你會覺得?",
"answers":[
["很容易回答,直接給出答案",1],
["很難啊!有時候是內向,有時候是外向,但是面試的時候好像又不說一半一半",2],
]
},
{
"question":"你在家裡的客廳看電視的時候,聽到家人回來開門的聲音,你會?",
"answers":[
["家人進來後,很快點個頭,在繼續看電視",1],
... | true |
8f08e38b89a95a8953cb3abbf81c48b0c76e33fb | JavaScript | michaelgallipo/code-challenges | /javascript/all-longest-characters.js | UTF-8 | 825 | 4.03125 | 4 | [] | no_license | function allLongestStrings(inputArray) {
let length = 0;
let outputArray = [];
inputArray.forEach(function(word) {
if (word.length > length) {
outputArray = [word];
length = word.length;
} else if (word.length === length) {
outputArray.push(word);
... | true |
8a70993e39b384ef6649149be2914f0f0df02634 | JavaScript | Brian-Quach/Web-Crawl | /src/static/assets/js/api_host.js | UTF-8 | 1,246 | 2.765625 | 3 | [] | no_license | var host = (function(){
"use strict";
function send(method, url, data, callback){
var xhr = new XMLHttpRequest();
xhr.onload = function() {
if (xhr.status !== 200) callback("[" + xhr.status + "]" + xhr.responseText, null);
else callback(null, JSON.parse(xhr.responseT... | true |
045ee887533566758fa6239db3d905dc14bd9d27 | JavaScript | zhamborova/cs4550-f20-final-project-backend | /firebase/event-db.js | UTF-8 | 1,810 | 2.8125 | 3 | [] | no_license | firebase = require('./firebase')
var db = firebase.db
const getAllEvents = () =>
db.collection('events').get().then(snapshot=>
snapshot.docs.map(doc => ({...doc.data(), id:doc.id})))
const deleteEvent = (eventId) => {
db.collection("events").doc(eventId).delete().then(function() {
console.log... | true |
24670a86d9644b9584f5e0f034f0104c070fdf56 | JavaScript | slochowsky/java-coffee | /scripts/equipment/Equipment.js | UTF-8 | 621 | 2.546875 | 3 | [] | no_license | const allEquipment = (equipmentObject) => {
return `
<div class="single_equipment">
<ul>
<section class="serialNumber">Serial Number: ${equipmentObject.serialNumber}</section>
<section class="modleNumber">Model Number: ${equipmentObject.model}</section>
... | true |
79dee6f259845f1b09ada4ee8aaf0713fb1b57a4 | JavaScript | LeonardoCesca/es6-origamid | /Objetos/constructor-functions/script.js | UTF-8 | 1,387 | 4.59375 | 5 | [] | no_license | // Transforme o objeto abaixo em uma Constructor Function
const pessoa = {
nome: 'Nome pessoa',
idade: 0,
andar() {
console.log(this.nome + ' andou');
}
}
function People(name, age) {
this.name = name,
this.age = age,
this.walk = function () {
console.log(name + ... | true |
c6c98240f087d3feaef28b2ce9d32606f7614d1d | JavaScript | kermitt/simple_diagramer | /SVG_DOM.js | UTF-8 | 3,451 | 2.796875 | 3 | [] | no_license | // + -- Add a node: TODO: This has defaults: make those params --------------- +
function addNode (x, y) {
// for raw nodes not from the data store
let id = getNextLetter()
NODES[id] = {x: x, y: y, id: id, size: default_size, text: '', siblings: [], color: getColor()}
inflateNode(NODES[id])
makeInfoTable()
}... | true |
1bc1e00f4f7467fb65b2da453ef464593c1231e7 | JavaScript | SomethingClever76/react-demo-app | /src/components/jeopardyDisplay/JeopardyDisplay.js | UTF-8 | 1,553 | 2.53125 | 3 | [] | no_license | import React from "react";
function JeopardyDisplay(props) {
return (
<div className="parentDiv">
<div className="jeopardyClue">
{/* The values of the props being passed are defined in
JeopardyMediumMode, lines 86-92. We are using props."whatever the name
... | true |
efacacac4c4a37c396776028a136322114ea890b | JavaScript | ak1103dev/BattleShip | /src/utils/isLegal.js | UTF-8 | 1,200 | 2.828125 | 3 | [
"MIT"
] | permissive | const _ = require('lodash');
const isLegal = (board, positions) => {
let checkingArea = [];
positions.map((p) => {
if (p === 0) return (checkingArea = _.union(checkingArea, [0, 1, 10, 11]));
if (p === 9) return (checkingArea = _.union(checkingArea, [8, 9, 18, 19]));
if (p === 90) return (checkingArea =... | true |
fa7e42c798554da8c267fc3677d2b18c15d4838f | JavaScript | magdacorina26/ecommerce-catalog | /public/js/script.js | UTF-8 | 2,369 | 2.734375 | 3 | [
"MIT"
] | permissive | $(document).ready(function(){
showCategories()
showProducts()
})
function showCategories() {
$.get( "/categories", function( data ) {
var html = ''
data.forEach(function(category) {
html = html + '<li><a href="#" onClick="showProducts('+category.id+')">'+category.name+'</a></li>... | true |
ec5e379c4c1203f8bdec389c9c64274d2c7dda81 | JavaScript | boyrunhuo/car | /src/utils/index.js | UTF-8 | 1,656 | 2.75 | 3 | [] | no_license | export default {
addSuffix(data, length) {
//截取添加省略号
if (data.length > length) {
return '...' + data.substring(data.length - length)
} else {
return data
}
},
scroll(id) {
//滚动显示
function newContent(content) {
var z = cont... | true |
8547f81dc863c8fa727fd0f8eeba2e57e9246134 | JavaScript | DevDams/sharing-app-api | /script.js | UTF-8 | 840 | 2.546875 | 3 | [] | no_license | const File = require('./models/file.model')
const connectDB = require('./database/database')
connectDB()
async function fetchData() {
try {
const pastDate = new Date(Date.now() - 24 * 60 * 60 * 1000)
const files = await File.find({ createdAat: { $lt: pastDate } })
if (files.length) {
for (const ... | true |
998707575aa6d9f952ef1d590f6e275e8274be19 | JavaScript | qianlongo/code-pen | /pub-sub/pub-sub-1.js | UTF-8 | 1,814 | 3.4375 | 3 | [
"MIT"
] | permissive | // 发布订阅模式
// 定义一个对象,内部包含三个方法,发布、订阅和退订
let pubsub = {}
;((q) => {
let topics = {} // 回调函数存放
let subUid = -1
// 订阅方法
q.subscribe = (topic, func) => {
if (!topics[topic]) {
topics[topic] = []
}
let token = (++subUid).toString()
topics[topic].push({
func,
token
})
return t... | true |
b77e5129064c7354392e50676c2bb2863b98bde0 | JavaScript | Nitya3008/CRUMPLED-PAPER-BALLS | /sketch.js | UTF-8 | 1,041 | 2.859375 | 3 | [] | no_license |
const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Body = Matter.Body;
var ball;
var groundObj,leftSide,rightSide;
function preload()
{
}
function setup() {
createCanvas(1200, 700);
engine = Engine.create();
world = engine.world;
var ball_options={
isStatic:... | true |
9399418519ac1d52c83e67c066f1e5819a207062 | JavaScript | 00Emily00/Initial-Pre-Work | /5-Introduction-to-JavaScript/94-Iterate_with_JavaScript_For_Loops.js | UTF-8 | 748 | 4.53125 | 5 | [] | no_license | // Another type of JavaScript loop is the for loop. It will run a code for a specific amount of times. The syntax is for([initialization]; [condition]; [final-expression]). Initialization executes one time before loop starts. It's used to define and set up loop variables. Condition statement is evaluated at the beginni... | true |
0f0ef57a41acae0d5c1d2216ee4c23c8123508dd | JavaScript | void666/in-memory-queue | /models/consumer.js | UTF-8 | 711 | 2.671875 | 3 | [
"MIT"
] | permissive | 'use strict';
const shortId = require('shortid');
const logger = require('../utilities/logger')('consumer');
class Consumer {
constructor(topic, priority, handler) {
this._id = shortId.generate();
this._topic = topic;
this._priority = priority;
this._handler = handler;
}
ge... | true |
53b5074afbb32c49ebaf12906096494e032a1296 | JavaScript | SETTER2000/named-ranges | /named-ranges.js | UTF-8 | 20,071 | 2.984375 | 3 | [
"MIT"
] | permissive | /**
* Created by PhpStorm.
* Company: Appalachian Ltd.
* Developer: SETTER
* Suite: appalachi.ru
* Email: info@appalachi.ru
* Date: 03.06.2017
* Time: 11:03
*/
/**
* Конструктор диапазона.
* Именуем диапазоны входящего xlsx для удобного разбора и валидации
* name - наименование диапазона
* range - сам диапа... | true |
87bf476efdafbf82d2c66e0dff2f57e555874cfb | JavaScript | david-barth/Project-12-Backup | /Tools/dataPreprocesser.js | UTF-8 | 3,342 | 3.0625 | 3 | [] | no_license | const cleaner = require('./cleaner').Cleaner;
const tweet = require('../models/tweet');
const wordMap = require('../models/wordMap');
const vector = require('../models/vector');
//Preprocessor Setup:
class Preprocessor {
constructor() {
this.cleaner = new cleaner(null);
}
asyn... | true |
35a22b710926a8468a24349b050fd9aa0242af6b | JavaScript | Jaredk3nt/kana-trainer | /src/hooks/useMySets.js | UTF-8 | 1,178 | 2.625 | 3 | [] | no_license | import { useCallback, useEffect, useState } from 'react';
// Variables
const LS_KEY = 'custom-kana-training-sets';
export default function useMySets() {
const [sets, setSets] = useState(() => {
try {
const ls = window.localStorage.getItem(LS_KEY);
const val = ls ? JSON.parse(ls) : {};
return v... | true |
4561361317f9466254deb16f1d5cbfc487e66727 | JavaScript | dnogueir/challenges-docker | /pfa-1/node/index.js | UTF-8 | 1,036 | 2.515625 | 3 | [] | no_license | const express = require('express')
const app = express()
const port = 3000
const config = {
host: 'dbcontainer',
user: 'root',
password: 'root',
database: 'nodedb'
}
const mysql = require('mysql')
const connection = mysql.createConnection(config)
const sqltable = `CREATE TABLE IF NOT EXISTS courseunit (... | true |
84c177ba97ab7024de04fcf9e8d1a58a71b7efdb | JavaScript | Szwarceneger16/digi_task_2 | /scripts/api/fetchMarsPhotos.js | UTF-8 | 538 | 2.5625 | 3 | [
"MIT"
] | permissive | // use NASA Mars Rover Photos
// https://api.nasa.gov/index.html#apply-for-an-api-key
export function fetchMarsPhoto(earthDate, rover, camera, page = 1) {
return fetch(
`https://api.nasa.gov/mars-photos/api/v1/rovers/${rover}/photos?` +
`api_key=${nasaKeyApi}` +
`&earth_date=${earthDate.toISOString().... | true |
cd0bd1ccdf3d08b52fcb543247fa5308b4aeb157 | JavaScript | zeyashah/jQuery-Assignment | /jQueryBasics.js | UTF-8 | 1,301 | 2.859375 | 3 | [
"MIT"
] | permissive | $(document).ready(function() {
$(".liner").hide(); // to hide everything on the page, until the box is clicked
$(".box").animate({
width: "130px",
height: "70px",
opacity: 0.5
}, 2000, function() {
$(".box").animate({
width: "100px",
height: "40px",
}, 50)
});
// click box to reveal page, ... | true |
d2b91e6193fd913e7225885c7e4e00815712f635 | JavaScript | FlUxIuS/gattacker | /hookFunctions/rolljam.js | UTF-8 | 3,070 | 2.59375 | 3 | [
"MIT"
] | permissive | var fs = require('fs');
var colors = require('colors');
var utils = require('../lib/utils');
/*
* RollJam hook helper by @FlUxIuS
*/
// RollJam vars
var rolljam_cmd1=[];
var rolljam_cmd2=[];
var rolljam_ctr = 0;
var rolljam_ctr2 = 0;
var rjconfig = JSON.parse(fs.readFileSync('hookFunctions/RollJam.json'));
functi... | true |
5073b15cebdeb1b01b56520a4a70cc7b4efeab93 | JavaScript | profeweb/WEBDEV | /DATASTRUCTS/EXAMPLES/STACK/visual stack/ItemList.js | UTF-8 | 545 | 2.984375 | 3 | [] | no_license |
class ItemList {
constructor(info){
this.info = info;
}
display(i, l, p, x, y, w, h){
rectMode(CENTER);
strokeWeight(2);
if(i==p){
fill(200,200,100, 55);
rect(x, y, w*1.15, h*2.25);
}
fill(220, 53, 69);
rect(x, y, w, h);
ellipseMode(CENTER);
fill(200); strokeWeight(0.0);
ellipse(x, y-h... | true |
8bfc2d11a552a66f997cf211a38bb0556e2d20c6 | JavaScript | joseortiz9/clothing-shop-react | /client/src/redux/cart/cart.utils.js | UTF-8 | 1,101 | 3 | 3 | [] | no_license |
export const addItemToCart = (actualCartItems, cartItemToAdd) => {
const existingCartItem = actualCartItems.find(cartItem => cartItem.id === cartItemToAdd.id);
if (existingCartItem) {
return actualCartItems.map(cartItem =>
cartItem.id === cartItemToAdd.id ?
{...cartItem, qu... | true |
29266e603da111612b2fe9e7e532be263bf31728 | JavaScript | felix-ping/practice | /100.js | UTF-8 | 106,091 | 3.734375 | 4 | [] | no_license | /*1st:(滴滴、饿了么)写 React / Vue 项目时为什么要在列表组件中写 key,其作用是什么?
*受楼下答案的一些特殊情况影响,导致很多人都认为key不能"提高"diff速度。在此继续重新梳理一下答案。
在楼下的答案中,部分讨论都是基于没有key的情况diff速度会更快。确实,这种观点并没有错。没有绑定key的情况下,并且在遍历模板简单的情况下,会导致虚拟新旧节点对比更快,节点也会复用。而这种复用是就地复用,一种鸭子辩型的复用。以下为简单的例子:
<div id="app">
<div v-for="i in dataList">{{ i }}</div>
</div>
var vm = new Vue({... | true |
e9b3bea29921200f094dd588d20a2d8982e3257c | JavaScript | jurongqixun/vue-map | /src/cesium-viewer/util/GeoJson.js | UTF-8 | 4,149 | 2.796875 | 3 | [] | no_license | import cesium from 'cesium/Cesium';
//import shp from 'shp';
import Shapefile from '@inlog/js-shapefile-to-geojson/shapefile'
/**
* GeoJson 工具类
*/
export default class GeoJson {
/**
* 转换 shp 文件为 Geo JSON
* @param sourceFile
* @returns {GeoJson}
*/
static fromShpFile(sourceFile, callback) ... | true |
f2403f4b73341391b02b4e6cb611f8488e8e0d57 | JavaScript | rloiselle/PCS | /Activities/Week4/Exercises/Fizzbuzz/src/FizzBuzz.js | UTF-8 | 1,400 | 4.9375 | 5 | [] | no_license | // "Write a program that prints the numbers from 1 to 100.
// But for multiples of three print “Fizz” instead of the number
// and for the multiples of five print “Buzz”.
// For numbers which are multiples of both three and
// five print “FizzBuzz”."
// This example allows the user to get the values from the functio... | true |
0eb2124c6b11f63f4b49f9abc1f77d7aff64e7c0 | JavaScript | mateuszmaczynski/Bootcamp-JS | /Zadania bootcamp JS/week 2/zadanie 2/js/script.js | UTF-8 | 2,380 | 3.390625 | 3 | [] | no_license | (function() {
function Validator(form) {
this.form = form;
this.emailField = form.querySelector("input[name='email']");
this.nameField = form.querySelector("input[name='name']");
this.ageField = form.querySelector("input[name='age']");
this.messageField = form.querySelector... | true |
43a06ba5f0a60d0d3110889f28620cc9655ce327 | JavaScript | yarKode/forkify | /src/js/model.js | UTF-8 | 3,587 | 2.640625 | 3 | [] | no_license | import { API_URL, RES_PER_PAGE, KEY } from "./config";
import { AJAX } from "./helpers";
export const state = {
recipe: {},
search: {
query: "",
result: [],
page: 1,
resultsPerPage: RES_PER_PAGE,
},
bookmarks: [],
};
function createObjectFromResponse(data) {
const {
cooking_time: cooking... | true |
a8b8787f16bd40a6d9e47878d6307116dac487f2 | JavaScript | Tartalon/projects.github.io | /del-food_js/js/main.js | UTF-8 | 21,083 | 2.828125 | 3 | [] | no_license | // используем строгий режим
'use strict';
const cartButton = document.querySelector('#cart-button');
const modal = document.querySelector('.modal');
const close = document.querySelector('.close');
//получаем кнопку ВОЙТИ со страницы
const buttonAuth = document.querySelector('.button-auth');
//получаем модальное окно в... | true |
f4a6dfeab8ea222eeec496376b58f6b375de4ab5 | JavaScript | zhml8951/tianhuan | /expApp01/syncDemo.js | UTF-8 | 463 | 2.734375 | 3 | [] | no_license | var fs = require('fs');
var data = fs.readFileSync('package.json');
console.log('sync read file');
console.log(data.toString());
console.log('file read finish.')
console.log("\n");
fs.readFile('typings.json','utf-8', function (err, data) {
if(err) return console.log(err);
console.log(data.toString());
});
cons... | true |
dbc2896de62de545d98f29e776ce607ab525270e | JavaScript | ZekeriyaErturk/blogs | /utils/list_helper.js | UTF-8 | 620 | 2.84375 | 3 | [] | no_license | const _ = require("lodash");
const totalLikes = (blogs) =>
blogs.reduce((sum, blog) => (sum += blog.likes), 0);
const favoriteBlog = (blogs) => {
let max = -Infinity;
for (let i = 0; i < blogs.length; i++) {
max = Math.max(max, blogs[i].likes);
}
return blogs.find((blog) => blog.likes === max);
};
cons... | true |
95e687491d0fd85ae625db5e44ef3fd66ab26015 | JavaScript | markusdeli/Calori-the-perfect-Calorie-Counter | /lib/data/MealRepository.js | UTF-8 | 1,801 | 2.640625 | 3 | [] | no_license | /* eslint-env node */
const AbstractRepository = require("./AbstractRepository");
/**
* Repository für Mahlzeiten
*/
class MealRepository extends AbstractRepository {
/**
* Der Typ dieses Repositories
*
* @override
* @readonly
*/
static get type() {
return "meal";
}
... | true |
8a14164a074a100df18d171fb78ba227470e0ff3 | JavaScript | spianoDev/Algorithms-DataStructures-Practice | /Recursion/palindrome.js | UTF-8 | 700 | 4.21875 | 4 | [] | no_license | /** Is Palindrome **/
// Write a recursive function called 'isPalindrome' which returns true if the string passed to it is a palindrome
// (reads the same forward and backward). Otherwise, it returns false.
function isPalindrome(str){
function reverse(string) {
if (string.length <= 1) return string;
... | true |
b11a42a956ed0e91aecae53f1f2997687803c5eb | JavaScript | nataliasabadysh/goit-fe-course | /Module 12/API Gallery Fetch/src/services/api.js | UTF-8 | 537 | 2.609375 | 3 | [] | no_license | import axios from 'axios';
const API_KEY = '5837779-ac3ba737206b541ae294f1119';
export const fetchImages = ({ query, count, page }) => {
const url = `https://pixabay.com/api/?image_type=photo&q=${query}&per_page=${count}&page=${page}&key=${API_KEY}`;
return fetch(url)
.then(response => {
if... | true |
15fdd5d78572f99ab49289ee3c6500233ef872e4 | JavaScript | Indranil-Sarmah/FED-Project-MCA-10011-19 | /app1.js | UTF-8 | 3,974 | 3.078125 | 3 | [] | no_license | const calculate =()=>{
let Vaccine = document.getElementById("vaccine");
let selectedVaccine = Vaccine.options[Vaccine.selectedIndex].text;
let selectedVaciineValue =Vaccine.value;
var radios = document.getElementsByName('dose');
var selectedDose;
for (var radio of radios) {
if (radio.c... | true |
f1a71f3c271f481f61549bf390098cec2fe5bdaf | JavaScript | kryptopus/kryptopus | /src/util/date/convertDateStringToTimestamp.js | UTF-8 | 333 | 2.984375 | 3 | [
"MIT"
] | permissive | const assert = require("assert");
module.exports = function convertDateStringToTimestamp(dateString) {
let timestamp;
if (dateString === "now") {
timestamp = Date.now();
} else {
timestamp = Date.parse(dateString);
}
assert(!Number.isNaN(timestamp), `Invalid date string: ${dateString}`);
return t... | true |
e4df45711c8d48ec8731efe307b8ea68dc374ca5 | JavaScript | howardlau1999/sysu-web-homework | /09-sign-up/server/urls.js | UTF-8 | 718 | 2.578125 | 3 | [] | no_license | function Router(pathname, callbacks) {
this.pathname = pathname;
this.callbacks = callbacks;
}
function MethodNotSupported(pathname, accept, received) {
this.pathname = pathname;
this.accept = accept;
this.received = received;
}
Router.prototype = {
accept: function (req, res) {
let m... | true |
46180e40b418612fdb0041c4bc89c1d32fb05b76 | JavaScript | JenCarrigan/seattle-javascript-401d27 | /06-tcp-server/server.js | UTF-8 | 3,183 | 3.203125 | 3 | [] | no_license | 'use strict';
// first-party modules -- built in to Node
const net = require('net');
const EE = require('events');
// internal files
const Client = require('./demo/model/client.js');
// environment
require('dotenv').config();
const PORT = process.env.PORT || 3000;
// make a new server
const server = net.createServe... | true |
d39d578327ef613ff6a7f7854cedf7cfa4baa626 | JavaScript | zeachco/tangerine | /secret_provider.js | UTF-8 | 509 | 2.53125 | 3 | [
"MIT"
] | permissive | class SecretProvider {
constructor() {
this.login = {
username: '',
pin: '',
phrase: '',
questions: {}
};
}
set_login(login) {
this.login = login;
}
get_username() {
return this.login.username;
}
get_password(phrase) {
if (phrase === this.login.phrase) {
return this.login.pin;
}
}
... | true |
88fe45240b94d09ccaab4230448a9c92dd8e43b6 | JavaScript | PavelZvonnikov/bootstrapTask | /js/main.js | UTF-8 | 3,310 | 2.625 | 3 | [] | no_license | import { data } from './data.js';
const { menu, content: {articles}, dopMenu, cards, footer } = data;
const createMenu = (menuData) => {
const menuList = document.createElement('ul');
menuList.classList.add('navbar-nav');
menuData.items.forEach(({title, src}) => {
const menuItem = document.createElement('l... | true |
2666a265e7065667121cd5ecba079d097b4202d3 | JavaScript | SwordSageKeith/Keith-Julian-quiz | /Scripts/screen.js | UTF-8 | 3,688 | 3.078125 | 3 | [] | no_license | const screenStuff = (function(){
function showanswer(){
//hide form and update text
$('.field').toggleClass('hidden', true);
$('.button').toggleClass('buttonCentre', true);
$('.button').attr('value', 'Continue!');
}
function showImage(int){
var x = window.matchMedia("(min-width: 600px)");
... | true |
0bbdc09bf9465b627e464a039c086c4e99fc2ff4 | JavaScript | carol-en/shane-george-web | /pages/p/[param].js | UTF-8 | 2,123 | 2.703125 | 3 | [] | no_license | import { useRouter } from 'next/router';
import { BLOCKS, MARKS } from '@contentful/rich-text-types';
import { documentToReactComponents } from '@contentful/rich-text-react-renderer';
import style from './page.module.scss';
// =======================
// COMPONENT FOR STATIC PAGES
// =======================
const Page =... | true |
eab9a25582b6908961d14003194c591e2a3780b9 | JavaScript | tristanneumann1/tic-tac-toe | /ticTacToe.js | UTF-8 | 3,832 | 3.296875 | 3 | [] | no_license | const fs = require('fs');
const path = require('path');
const prompt = require('prompt');
const moves = {
7: [0, 0],
8: [0, 1],
9: [0, 2],
4: [1, 0],
5: [1, 1],
6: [1, 2],
1: [2, 0],
2: [2, 1],
3: [2, 2],
};
// Helper Functions
function checkRow(board, i) {
if (board[i][0] !== ' ' && board[i][0... | true |
5592065b2a40955dc886ce75daf098968dc832b2 | JavaScript | dorothy7964/react_posts | /src/components/Post/Post.js | UTF-8 | 1,716 | 2.625 | 3 | [] | no_license | import React, { Component } from 'react';
import './Post.css';
import { CommentList } from '../';
class Post extends Component {
constructor(props) {
super(props);
this.state = {
postInfo : {
title : null,
body : null,
comments : []
},
animate : false,
directio... | true |
1785ac81e7dcd4dc3319323f92dd83fd0837ab03 | JavaScript | basakrajarshi/web-telemetry | /scripts/telemetry.js | UTF-8 | 9,376 | 2.71875 | 3 | [
"MIT"
] | permissive | var telemetry = (function() {
var queue = [];
var _backendURL = '';
var httpRequest = new XMLHttpRequest();
var _isQueing = false;
var _sessionURL;
var _isSessionSet = false;
var getTimestamp = function() {
return new Date().toLocaleString();
};
var _makeRequest = function() {
... | true |
98b254f813dffb9402614512e49c1e6f6e2e0f7c | JavaScript | daniellehoo/travel_awesomely | /client/src/components/Country.jsx | UTF-8 | 1,770 | 2.5625 | 3 | [] | no_license | import React, { Component } from 'react';
import Nav from '../partials/Nav';
import Footer from '../partials/Footer';
import CityList from './CityList';
class Country extends Component {
constructor(props){
super(props);
this.state = {
country: '',
id: '',
citiesListData: '',
citiesLi... | true |
4fce49ecfec1ea3d50d4a74040126d7df7a9ca50 | JavaScript | 201026-reston-java-msa/demos | /week3/IntroToJavaScript/06-objects.js | UTF-8 | 1,443 | 4.8125 | 5 | [] | no_license | /*
JavaScript allows to define Object literals - this is an obj
that cosists of key-pairs and is surrounded by curly brackets
*/
let personLiteral =
{
name: 'Wilson',
hairColor: 'brown',
favoriteFood: 'tacos'
}
console.log(personLiteral);
console.log(personLiteral.favoriteFood)
console.log(personLiteral[... | true |
f93bcd15ab04ab72acc5cbb136fe50dd5a0a1320 | JavaScript | bofa/signal | /src/lqr.js | UTF-8 | 2,277 | 2.6875 | 3 | [] | no_license | // var numeric = require('./../node_modules/numeric-1.2.6.js');
/*
// Example values for the control system.
var add = numeric.add;
var trans = numeric.transpose;
var inv = numeric.inv;
var mult = numeric.dot;
var sub = numeric.sub;
var diag = numeric.diag;
var M = 50;
var r = 0.1;
var I = 1/3*M*r*r;
var Acont = [[... | true |
115f809a499b1ce2037fc15fe275174877f53b6e | JavaScript | dhershman1/dustyjs | /src/values.js | UTF-8 | 442 | 3.84375 | 4 | [
"MIT"
] | permissive | /**
* @name values
* @since v2.0.3
* @category Object
* @sig Object { k: v } -> Array v
* @description Grabs the values from a key value pair object
* @param {Object} obj The object we want to grab our values from
* @return {Array} An array of values from the object
*
* @example
*
* value({ a: 1, ... | true |
515ef195d66194655f5de90471156273dade5067 | JavaScript | Lumexralph/fun-learning-projects | /myPromise.js | UTF-8 | 3,582 | 3.796875 | 4 | [] | no_license | const hrRespond = true;
const applyForLeave = new Promise(
(resolve, reject) => {
if (hrRespond) { // when hr responds
const leaveDetails = {
startDate: 'Monday',
endDate: 'Tuesday'
};
resolve(leaveDetails);
} else { // if hr chooses... | true |
72d630940b3aeb8d6d663989db75a4e14e727926 | JavaScript | smisyuk4/Petr_JS | /Les_5/js/script.js | UTF-8 | 1,141 | 2.640625 | 3 | [] | no_license | let menu = document.getElementsByClassName('menu'),
curentMenu = menu[0];
let menuItem = document.getElementsByClassName('menu-item');
curentMenu.insertBefore(menuItem[2], menuItem[1]);
let newBtn = document.createElement('li');
newBtn.classList.add('menu-item');
newBtn.textContent = 'П... | true |
85f8f76fec67ec071528ee571f40c6dec7475620 | JavaScript | Sirkevich/fpro-hw4 | /task3-while/app.js | UTF-8 | 254 | 3.265625 | 3 | [] | no_license | const userNumber = +prompt('Введите число от 1 до 100, и я покажу все числа, которые будут ему кратны');
let i = 1;
while (i <= 100 ) {
if (i % userNumber === 0)
console.log(i);
i++;
}
| true |
f7e1a7cc01c10142e4d4f069a9f4218a076daede | JavaScript | DakOneil/leetcode | /7-4-21.js | UTF-8 | 1,074 | 4.375 | 4 | [] | no_license | // Maximum subarray sum
// The maximum sum subarray problem consists in finding the maximum sum of a contiguous subsequence in an array or list of integers:
// maxSequence([-2, 1, -3, 4, -1, 2, 1, -5, 4])
// // should be 6: [4, -1, 2, 1]
// Easy case is when the list is made up of only positive numbers and the maximu... | true |
476e1aa208be3c187c5f3d6749b5b8a68e6c43e1 | JavaScript | StonePang/blog | /blog/model/weather.js | UTF-8 | 784 | 2.703125 | 3 | [] | no_license | const log = console.log.bind(console)
const request = require('sync-request')
const fs = require('fs')
const guasync = function(callback) {
setTimeout(function() {
callback()
}, 0)
}
const w = {}
w.data = (city) => {
var d = new Date()
var s = d.toLocaleDateString()
var cacheFile = `db/${... | true |
d75d852c803a8240b5b7aa19a822957c5b1f48e7 | JavaScript | craigphicks/yamato_daiwa-es_extensions | /Distributable/TypeGuards/Numbers/isNegativeDecimalFraction.js | UTF-8 | 233 | 2.59375 | 3 | [
"MIT"
] | permissive | export default function isNegativeDecimalFraction(potentialDecimalFraction) {
if (typeof potentialDecimalFraction !== "number") {
return false;
}
return /^-\d+\.\d+$/u.test(potentialDecimalFraction.toString());
}
| true |
27930820034ce371e15511b29f6eabce29cd68ec | JavaScript | danielrodriguezo/Bander | /src/services/geo-location.service.js | UTF-8 | 3,546 | 2.671875 | 3 | [
"MIT"
] | permissive | import config from 'react-native-config';
export const GeoLocationService = {
getLocation: (callback) => {
let result = {
city: {
name: '',
id: ''
},
country: {
name: '',
id: ''
}
};
... | true |
20a87e849fd705f29ccabef3bc4eef964260753c | JavaScript | yoonchaiyoung/chaingflix | /src/routes/Home/HomeContainer.js | UTF-8 | 3,316 | 3.375 | 3 | [] | no_license | import React from "react";
import HomePresenter from "./HomePresenter";
import { moviesApi } from "../../api";
// container가 반드시 presenter가 포함
// container가 presenter의 부모 컴포넌트
// Container의 역할 : Application에서 사용되어지는 기능(함수), 상태(state), 이벤트 등을 구현, Presenter에 전달
export default class extends React.Component {
// class형... | true |
53fc8b125476a207ba7def3e86b6def192270301 | JavaScript | krokben/krokben-portfolio-mkii | /src/js/helpers/withLanding.js | UTF-8 | 802 | 2.640625 | 3 | [] | no_license | /*
Higher-Order Component to forward ref into parent component
...
NOTE: This only works with single ref.
Investigate further how to do this with multiple refs.
Use landingElements.js until better solution figured out.
*/
import React, { Component } from 'react';
function withLanding(Component) {
class Wi... | true |
2bd8328f17c9e7bdd2de9ab6354f6bd9f38eeb69 | JavaScript | abhi5658/VR-RTO | /Server/index.js | UTF-8 | 2,202 | 2.703125 | 3 | [] | no_license | var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
var path = require('path');
var cordinates = {
"u" : 0,
"d" : 0,
"l" : 0,
"r" : 0
};
/*
app.get('/', function(req, res){
res.sendFile('D:/Practice/node'+'/index.html');
});
*/
var convertedData = {
"H" :... | true |
ee63a73642cbfe624a7a5136346882e91b5f4228 | JavaScript | ale-sanchez-g/expressResponsive | /app/features/support/dictionary.js | UTF-8 | 889 | 3.09375 | 3 | [] | no_license | var fs = require('fs');
var spanish = require('./languages/palabras.json');
var english = require('./languages/words.json');
var german = require('./languages/worts.json');
function searchMyWords (word, languageDictionary) {
var jsonList;
switch (languageDictionary.toLowerCase()) {
case 'english':
... | true |
466565039b7c38314c4c46ec332eca708e147ce0 | JavaScript | Karimfactory/Exos-JavaScript | /Arrays.js | UTF-8 | 415 | 3.828125 | 4 | [] | no_license | // création de tableaux
let arr1 = ['a','b','c'];
let arr2 = [{nom:'Abdelhadi',prénom:'Karim'},
{nom:'John',prénom:'Wick'},
{nom:'Lara',prénom:'Croft'},
{nom:'Harry',prénom:'Potter'}
];
//Affichage de données dans la console
console.log(arr1... | true |
a61a0e78fedf0bfbc12a1d64afb4689855275860 | JavaScript | daniel-certa-1228/Seasonal-Sales | /js/seasonal-sales.js | UTF-8 | 4,454 | 3.25 | 3 | [] | no_license | console.log( "seasonal-sales.js" );
//IIFE that unpacks the discount values into an array
{
let discounts= []
// console.log( "discounts", discounts );
StoreInfo.discount = (categoryObject) => {
let categories = categoryObject.categories;
// console.log( "categories", categories );
for (let i = 0; i < cate... | true |
71d7758fd97f413a899ab9baf8718d9dd0c39582 | JavaScript | samrodd/assignment3 | /script.js | UTF-8 | 4,039 | 3.515625 | 4 | [] | no_license | let numRows = 0;
let numCols = 0;
let colorSelected;
//Add a row
function addR() {
//declare tbl variable and set it equal to grid element
var tbl = document.getElementById("grid");
//handle case where no columns have been added
if(numCols === 0){
var row = tbl.insertRow();
var cell = ... | true |